Path: blob/master/arch/arm/mach-at91/board-csb337.c
10817 views
/*1* linux/arch/arm/mach-at91/board-csb337.c2*3* Copyright (C) 2005 SAN People4*5* This program is free software; you can redistribute it and/or modify6* it under the terms of the GNU General Public License as published by7* the Free Software Foundation; either version 2 of the License, or8* (at your option) any later version.9*10* This program is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13* GNU General Public License for more details.14*15* You should have received a copy of the GNU General Public License16* along with this program; if not, write to the Free Software17* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA18*/1920#include <linux/types.h>21#include <linux/init.h>22#include <linux/mm.h>23#include <linux/module.h>24#include <linux/platform_device.h>25#include <linux/spi/spi.h>26#include <linux/mtd/physmap.h>27#include <linux/input.h>28#include <linux/gpio_keys.h>2930#include <asm/setup.h>31#include <asm/mach-types.h>32#include <asm/irq.h>3334#include <asm/mach/arch.h>35#include <asm/mach/map.h>36#include <asm/mach/irq.h>3738#include <mach/hardware.h>39#include <mach/board.h>40#include <mach/gpio.h>4142#include "generic.h"434445static void __init csb337_init_early(void)46{47/* Initialize processor: 3.6864 MHz crystal */48at91rm9200_initialize(3686400);4950/* Setup the LEDs */51at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1);5253/* DBGU on ttyS0 */54at91_register_uart(0, 0, 0);5556/* make console=ttyS0 the default */57at91_set_serial_console(0);58}5960static void __init csb337_init_irq(void)61{62at91rm9200_init_interrupts(NULL);63}6465static struct at91_eth_data __initdata csb337_eth_data = {66.phy_irq_pin = AT91_PIN_PC2,67.is_rmii = 0,68};6970static struct at91_usbh_data __initdata csb337_usbh_data = {71.ports = 2,72};7374static struct at91_udc_data __initdata csb337_udc_data = {75// this has no VBUS sensing pin76.pullup_pin = AT91_PIN_PA24,77};7879static struct i2c_board_info __initdata csb337_i2c_devices[] = {80{81I2C_BOARD_INFO("ds1307", 0x68),82},83};8485static struct at91_cf_data __initdata csb337_cf_data = {86/*87* connector P4 on the CSB 337 mates to88* connector P8 on the CSB 300CF89*/9091/* CSB337 specific */92.det_pin = AT91_PIN_PC3,9394/* CSB300CF specific */95.irq_pin = AT91_PIN_PA19,96.vcc_pin = AT91_PIN_PD0,97.rst_pin = AT91_PIN_PD2,98};99100static struct at91_mmc_data __initdata csb337_mmc_data = {101.det_pin = AT91_PIN_PD5,102.slot_b = 0,103.wire4 = 1,104.wp_pin = AT91_PIN_PD6,105};106107static struct spi_board_info csb337_spi_devices[] = {108{ /* CAN controller */109.modalias = "sak82c900",110.chip_select = 0,111.max_speed_hz = 6 * 1000 * 1000,112},113};114115#define CSB_FLASH_BASE AT91_CHIPSELECT_0116#define CSB_FLASH_SIZE SZ_8M117118static struct mtd_partition csb_flash_partitions[] = {119{120.name = "uMON flash",121.offset = 0,122.size = MTDPART_SIZ_FULL,123.mask_flags = MTD_WRITEABLE, /* read only */124}125};126127static struct physmap_flash_data csb_flash_data = {128.width = 2,129.parts = csb_flash_partitions,130.nr_parts = ARRAY_SIZE(csb_flash_partitions),131};132133static struct resource csb_flash_resources[] = {134{135.start = CSB_FLASH_BASE,136.end = CSB_FLASH_BASE + CSB_FLASH_SIZE - 1,137.flags = IORESOURCE_MEM,138}139};140141static struct platform_device csb_flash = {142.name = "physmap-flash",143.id = 0,144.dev = {145.platform_data = &csb_flash_data,146},147.resource = csb_flash_resources,148.num_resources = ARRAY_SIZE(csb_flash_resources),149};150151/*152* GPIO Buttons (on CSB300)153*/154#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)155static struct gpio_keys_button csb300_buttons[] = {156{157.gpio = AT91_PIN_PB29,158.code = BTN_0,159.desc = "sw0",160.active_low = 1,161.wakeup = 1,162},163{164.gpio = AT91_PIN_PB28,165.code = BTN_1,166.desc = "sw1",167.active_low = 1,168.wakeup = 1,169},170{171.gpio = AT91_PIN_PA21,172.code = BTN_2,173.desc = "sw2",174.active_low = 1,175.wakeup = 1,176}177};178179static struct gpio_keys_platform_data csb300_button_data = {180.buttons = csb300_buttons,181.nbuttons = ARRAY_SIZE(csb300_buttons),182};183184static struct platform_device csb300_button_device = {185.name = "gpio-keys",186.id = -1,187.num_resources = 0,188.dev = {189.platform_data = &csb300_button_data,190}191};192193static void __init csb300_add_device_buttons(void)194{195at91_set_gpio_input(AT91_PIN_PB29, 1); /* sw0 */196at91_set_deglitch(AT91_PIN_PB29, 1);197at91_set_gpio_input(AT91_PIN_PB28, 1); /* sw1 */198at91_set_deglitch(AT91_PIN_PB28, 1);199at91_set_gpio_input(AT91_PIN_PA21, 1); /* sw2 */200at91_set_deglitch(AT91_PIN_PA21, 1);201202platform_device_register(&csb300_button_device);203}204#else205static void __init csb300_add_device_buttons(void) {}206#endif207208static struct gpio_led csb_leds[] = {209{ /* "led0", yellow */210.name = "led0",211.gpio = AT91_PIN_PB2,212.active_low = 1,213.default_trigger = "heartbeat",214},215{ /* "led1", green */216.name = "led1",217.gpio = AT91_PIN_PB1,218.active_low = 1,219.default_trigger = "mmc0",220},221{ /* "led2", yellow */222.name = "led2",223.gpio = AT91_PIN_PB0,224.active_low = 1,225.default_trigger = "ide-disk",226}227};228229230static void __init csb337_board_init(void)231{232/* Serial */233at91_add_device_serial();234/* Ethernet */235at91_add_device_eth(&csb337_eth_data);236/* USB Host */237at91_add_device_usbh(&csb337_usbh_data);238/* USB Device */239at91_add_device_udc(&csb337_udc_data);240/* I2C */241at91_add_device_i2c(csb337_i2c_devices, ARRAY_SIZE(csb337_i2c_devices));242/* Compact Flash */243at91_set_gpio_input(AT91_PIN_PB22, 1); /* IOIS16 */244at91_add_device_cf(&csb337_cf_data);245/* SPI */246at91_add_device_spi(csb337_spi_devices, ARRAY_SIZE(csb337_spi_devices));247/* MMC */248at91_add_device_mmc(0, &csb337_mmc_data);249/* NOR flash */250platform_device_register(&csb_flash);251/* LEDs */252at91_gpio_leds(csb_leds, ARRAY_SIZE(csb_leds));253/* Switches on CSB300 */254csb300_add_device_buttons();255}256257MACHINE_START(CSB337, "Cogent CSB337")258/* Maintainer: Bill Gatliff */259.timer = &at91rm9200_timer,260.map_io = at91rm9200_map_io,261.init_early = csb337_init_early,262.init_irq = csb337_init_irq,263.init_machine = csb337_board_init,264MACHINE_END265266267