Andrew Victor | 022cbd7 | 2006-12-01 14:38:59 +0100 | [diff] [blame] | 1 | /* |
Andrew Victor | d0760b3 | 2007-02-08 09:00:39 +0100 | [diff] [blame] | 2 | * linux/arch/arm/mach-at91/board-sam9261ek.c |
Andrew Victor | 022cbd7 | 2006-12-01 14:38:59 +0100 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2005 SAN People |
| 5 | * Copyright (C) 2006 Atmel |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 20 | */ |
| 21 | |
| 22 | #include <linux/types.h> |
| 23 | #include <linux/init.h> |
| 24 | #include <linux/mm.h> |
| 25 | #include <linux/module.h> |
| 26 | #include <linux/platform_device.h> |
| 27 | #include <linux/spi/spi.h> |
Andrew Victor | 2352272 | 2007-05-02 17:58:51 +0100 | [diff] [blame] | 28 | #include <linux/spi/ads7846.h> |
Andrew Victor | 5e9df92 | 2008-04-02 22:18:35 +0100 | [diff] [blame^] | 29 | #include <linux/spi/at73c213.h> |
| 30 | #include <linux/clk.h> |
Andrew Victor | 022cbd7 | 2006-12-01 14:38:59 +0100 | [diff] [blame] | 31 | #include <linux/dm9000.h> |
Andrew Victor | cdf95c7 | 2007-05-14 15:08:21 +0100 | [diff] [blame] | 32 | #include <linux/fb.h> |
Andrew Victor | d0f9b55 | 2007-06-04 08:41:59 +0100 | [diff] [blame] | 33 | #include <linux/gpio_keys.h> |
| 34 | #include <linux/input.h> |
Andrew Victor | cdf95c7 | 2007-05-14 15:08:21 +0100 | [diff] [blame] | 35 | |
| 36 | #include <video/atmel_lcdc.h> |
Andrew Victor | 022cbd7 | 2006-12-01 14:38:59 +0100 | [diff] [blame] | 37 | |
| 38 | #include <asm/hardware.h> |
| 39 | #include <asm/setup.h> |
| 40 | #include <asm/mach-types.h> |
| 41 | #include <asm/irq.h> |
| 42 | |
| 43 | #include <asm/mach/arch.h> |
| 44 | #include <asm/mach/map.h> |
| 45 | #include <asm/mach/irq.h> |
| 46 | |
| 47 | #include <asm/arch/board.h> |
| 48 | #include <asm/arch/gpio.h> |
Andrew Victor | b78eabd | 2008-04-02 21:38:40 +0100 | [diff] [blame] | 49 | #include <asm/arch/at91sam9_smc.h> |
Andrew Victor | 022cbd7 | 2006-12-01 14:38:59 +0100 | [diff] [blame] | 50 | |
| 51 | #include "generic.h" |
| 52 | |
| 53 | |
Andrew Victor | 022cbd7 | 2006-12-01 14:38:59 +0100 | [diff] [blame] | 54 | static void __init ek_map_io(void) |
| 55 | { |
| 56 | /* Initialize processor: 18.432 MHz crystal */ |
| 57 | at91sam9261_initialize(18432000); |
| 58 | |
Andrew Victor | 302c0ef | 2007-05-09 11:42:53 +0100 | [diff] [blame] | 59 | /* Setup the LEDs */ |
| 60 | at91_init_leds(AT91_PIN_PA13, AT91_PIN_PA14); |
| 61 | |
Andrew Victor | a3da122 | 2008-04-02 21:47:29 +0100 | [diff] [blame] | 62 | /* DGBU on ttyS0. (Rx & Tx only) */ |
| 63 | at91_register_uart(0, 0, 0); |
| 64 | |
| 65 | /* set serial console to ttyS0 (ie, DBGU) */ |
| 66 | at91_set_serial_console(0); |
Andrew Victor | 022cbd7 | 2006-12-01 14:38:59 +0100 | [diff] [blame] | 67 | } |
| 68 | |
| 69 | static void __init ek_init_irq(void) |
| 70 | { |
| 71 | at91sam9261_init_interrupts(NULL); |
| 72 | } |
| 73 | |
| 74 | |
| 75 | /* |
| 76 | * DM9000 ethernet device |
| 77 | */ |
| 78 | #if defined(CONFIG_DM9000) |
| 79 | static struct resource at91sam9261_dm9000_resource[] = { |
| 80 | [0] = { |
| 81 | .start = AT91_CHIPSELECT_2, |
| 82 | .end = AT91_CHIPSELECT_2 + 3, |
| 83 | .flags = IORESOURCE_MEM |
| 84 | }, |
| 85 | [1] = { |
| 86 | .start = AT91_CHIPSELECT_2 + 0x44, |
| 87 | .end = AT91_CHIPSELECT_2 + 0xFF, |
| 88 | .flags = IORESOURCE_MEM |
| 89 | }, |
| 90 | [2] = { |
| 91 | .start = AT91_PIN_PC11, |
| 92 | .end = AT91_PIN_PC11, |
| 93 | .flags = IORESOURCE_IRQ |
| 94 | } |
| 95 | }; |
| 96 | |
| 97 | static struct dm9000_plat_data dm9000_platdata = { |
| 98 | .flags = DM9000_PLATF_16BITONLY, |
| 99 | }; |
| 100 | |
| 101 | static struct platform_device at91sam9261_dm9000_device = { |
| 102 | .name = "dm9000", |
| 103 | .id = 0, |
| 104 | .num_resources = ARRAY_SIZE(at91sam9261_dm9000_resource), |
| 105 | .resource = at91sam9261_dm9000_resource, |
| 106 | .dev = { |
| 107 | .platform_data = &dm9000_platdata, |
| 108 | } |
| 109 | }; |
| 110 | |
| 111 | static void __init ek_add_device_dm9000(void) |
| 112 | { |
| 113 | /* |
| 114 | * Configure Chip-Select 2 on SMC for the DM9000. |
| 115 | * Note: These timings were calculated for MASTER_CLOCK = 100000000 |
| 116 | * according to the DM9000 timings. |
| 117 | */ |
| 118 | at91_sys_write(AT91_SMC_SETUP(2), AT91_SMC_NWESETUP_(2) | AT91_SMC_NCS_WRSETUP_(0) | AT91_SMC_NRDSETUP_(2) | AT91_SMC_NCS_RDSETUP_(0)); |
| 119 | at91_sys_write(AT91_SMC_PULSE(2), AT91_SMC_NWEPULSE_(4) | AT91_SMC_NCS_WRPULSE_(8) | AT91_SMC_NRDPULSE_(4) | AT91_SMC_NCS_RDPULSE_(8)); |
| 120 | at91_sys_write(AT91_SMC_CYCLE(2), AT91_SMC_NWECYCLE_(16) | AT91_SMC_NRDCYCLE_(16)); |
| 121 | at91_sys_write(AT91_SMC_MODE(2), AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_WRITE | AT91_SMC_DBW_16 | AT91_SMC_TDF_(1)); |
| 122 | |
| 123 | /* Configure Reset signal as output */ |
| 124 | at91_set_gpio_output(AT91_PIN_PC10, 0); |
| 125 | |
| 126 | /* Configure Interrupt pin as input, no pull-up */ |
| 127 | at91_set_gpio_input(AT91_PIN_PC11, 0); |
| 128 | |
| 129 | platform_device_register(&at91sam9261_dm9000_device); |
| 130 | } |
| 131 | #else |
| 132 | static void __init ek_add_device_dm9000(void) {} |
| 133 | #endif /* CONFIG_DM9000 */ |
| 134 | |
| 135 | |
| 136 | /* |
| 137 | * USB Host Port |
| 138 | */ |
| 139 | static struct at91_usbh_data __initdata ek_usbh_data = { |
| 140 | .ports = 2, |
| 141 | }; |
| 142 | |
| 143 | |
| 144 | /* |
| 145 | * USB Device Port |
| 146 | */ |
| 147 | static struct at91_udc_data __initdata ek_udc_data = { |
| 148 | .vbus_pin = AT91_PIN_PB29, |
| 149 | .pullup_pin = 0, /* pull-up driven by UDC */ |
| 150 | }; |
| 151 | |
| 152 | |
| 153 | /* |
| 154 | * MCI (SD/MMC) |
| 155 | */ |
| 156 | static struct at91_mmc_data __initdata ek_mmc_data = { |
| 157 | .wire4 = 1, |
| 158 | // .det_pin = ... not connected |
| 159 | // .wp_pin = ... not connected |
| 160 | // .vcc_pin = ... not connected |
| 161 | }; |
| 162 | |
| 163 | |
| 164 | /* |
| 165 | * NAND flash |
| 166 | */ |
| 167 | static struct mtd_partition __initdata ek_nand_partition[] = { |
| 168 | { |
| 169 | .name = "Partition 1", |
| 170 | .offset = 0, |
| 171 | .size = 256 * 1024, |
| 172 | }, |
| 173 | { |
| 174 | .name = "Partition 2", |
| 175 | .offset = 256 * 1024 , |
| 176 | .size = MTDPART_SIZ_FULL, |
| 177 | }, |
| 178 | }; |
| 179 | |
Russell King | cdea460 | 2007-05-30 17:48:45 +0100 | [diff] [blame] | 180 | static struct mtd_partition * __init nand_partitions(int size, int *num_partitions) |
Andrew Victor | 022cbd7 | 2006-12-01 14:38:59 +0100 | [diff] [blame] | 181 | { |
| 182 | *num_partitions = ARRAY_SIZE(ek_nand_partition); |
| 183 | return ek_nand_partition; |
| 184 | } |
| 185 | |
| 186 | static struct at91_nand_data __initdata ek_nand_data = { |
| 187 | .ale = 22, |
| 188 | .cle = 21, |
| 189 | // .det_pin = ... not connected |
| 190 | .rdy_pin = AT91_PIN_PC15, |
| 191 | .enable_pin = AT91_PIN_PC14, |
| 192 | .partition_info = nand_partitions, |
| 193 | #if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16) |
| 194 | .bus_width_16 = 1, |
| 195 | #else |
| 196 | .bus_width_16 = 0, |
| 197 | #endif |
| 198 | }; |
| 199 | |
| 200 | /* |
Andrew Victor | 2352272 | 2007-05-02 17:58:51 +0100 | [diff] [blame] | 201 | * ADS7846 Touchscreen |
| 202 | */ |
| 203 | #if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) |
| 204 | |
| 205 | static int ads7843_pendown_state(void) |
| 206 | { |
| 207 | return !at91_get_gpio_value(AT91_PIN_PC2); /* Touchscreen PENIRQ */ |
| 208 | } |
| 209 | |
| 210 | static struct ads7846_platform_data ads_info = { |
| 211 | .model = 7843, |
| 212 | .x_min = 150, |
| 213 | .x_max = 3830, |
| 214 | .y_min = 190, |
| 215 | .y_max = 3830, |
| 216 | .vref_delay_usecs = 100, |
| 217 | .x_plate_ohms = 450, |
| 218 | .y_plate_ohms = 250, |
| 219 | .pressure_max = 15000, |
| 220 | .debounce_max = 1, |
| 221 | .debounce_rep = 0, |
| 222 | .debounce_tol = (~0), |
| 223 | .get_pendown_state = ads7843_pendown_state, |
| 224 | }; |
| 225 | |
| 226 | static void __init ek_add_device_ts(void) |
| 227 | { |
| 228 | at91_set_B_periph(AT91_PIN_PC2, 1); /* External IRQ0, with pullup */ |
| 229 | at91_set_gpio_input(AT91_PIN_PA11, 1); /* Touchscreen BUSY signal */ |
| 230 | } |
| 231 | #else |
| 232 | static void __init ek_add_device_ts(void) {} |
| 233 | #endif |
| 234 | |
| 235 | /* |
Andrew Victor | 5e9df92 | 2008-04-02 22:18:35 +0100 | [diff] [blame^] | 236 | * Audio |
| 237 | */ |
| 238 | static struct at73c213_board_info at73c213_data = { |
| 239 | .ssc_id = 1, |
| 240 | .shortname = "AT91SAM9261-EK external DAC", |
| 241 | }; |
| 242 | |
| 243 | #if defined(CONFIG_SND_AT73C213) || defined(CONFIG_SND_AT73C213_MODULE) |
| 244 | static void __init at73c213_set_clk(struct at73c213_board_info *info) |
| 245 | { |
| 246 | struct clk *pck2; |
| 247 | struct clk *plla; |
| 248 | |
| 249 | pck2 = clk_get(NULL, "pck2"); |
| 250 | plla = clk_get(NULL, "plla"); |
| 251 | |
| 252 | /* AT73C213 MCK Clock */ |
| 253 | at91_set_B_periph(AT91_PIN_PB31, 0); /* PCK2 */ |
| 254 | |
| 255 | clk_set_parent(pck2, plla); |
| 256 | clk_put(plla); |
| 257 | |
| 258 | info->dac_clk = pck2; |
| 259 | } |
| 260 | #else |
| 261 | static void __init at73c213_set_clk(struct at73c213_board_info *info) {} |
| 262 | #endif |
| 263 | |
| 264 | /* |
Andrew Victor | 022cbd7 | 2006-12-01 14:38:59 +0100 | [diff] [blame] | 265 | * SPI devices |
| 266 | */ |
| 267 | static struct spi_board_info ek_spi_devices[] = { |
| 268 | { /* DataFlash chip */ |
| 269 | .modalias = "mtd_dataflash", |
| 270 | .chip_select = 0, |
| 271 | .max_speed_hz = 15 * 1000 * 1000, |
| 272 | .bus_num = 0, |
| 273 | }, |
Andrew Victor | 2352272 | 2007-05-02 17:58:51 +0100 | [diff] [blame] | 274 | #if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) |
| 275 | { |
| 276 | .modalias = "ads7846", |
| 277 | .chip_select = 2, |
| 278 | .max_speed_hz = 125000 * 26, /* (max sample rate @ 3V) * (cmd + data + overhead) */ |
| 279 | .bus_num = 0, |
| 280 | .platform_data = &ads_info, |
| 281 | .irq = AT91SAM9261_ID_IRQ0, |
Andrew Victor | 5e9df92 | 2008-04-02 22:18:35 +0100 | [diff] [blame^] | 282 | .controller_data = (void *) AT91_PIN_PA28, /* CS pin */ |
Andrew Victor | 2352272 | 2007-05-02 17:58:51 +0100 | [diff] [blame] | 283 | }, |
| 284 | #endif |
Andrew Victor | 022cbd7 | 2006-12-01 14:38:59 +0100 | [diff] [blame] | 285 | #if defined(CONFIG_MTD_AT91_DATAFLASH_CARD) |
| 286 | { /* DataFlash card - jumper (J12) configurable to CS3 or CS0 */ |
| 287 | .modalias = "mtd_dataflash", |
| 288 | .chip_select = 3, |
| 289 | .max_speed_hz = 15 * 1000 * 1000, |
| 290 | .bus_num = 0, |
| 291 | }, |
Andrew Victor | 2352272 | 2007-05-02 17:58:51 +0100 | [diff] [blame] | 292 | #elif defined(CONFIG_SND_AT73C213) || defined(CONFIG_SND_AT73C213_MODULE) |
Andrew Victor | 022cbd7 | 2006-12-01 14:38:59 +0100 | [diff] [blame] | 293 | { /* AT73C213 DAC */ |
Andrew Victor | 2352272 | 2007-05-02 17:58:51 +0100 | [diff] [blame] | 294 | .modalias = "at73c213", |
Andrew Victor | 022cbd7 | 2006-12-01 14:38:59 +0100 | [diff] [blame] | 295 | .chip_select = 3, |
| 296 | .max_speed_hz = 10 * 1000 * 1000, |
| 297 | .bus_num = 0, |
Andrew Victor | 5e9df92 | 2008-04-02 22:18:35 +0100 | [diff] [blame^] | 298 | .mode = SPI_MODE_1, |
| 299 | .platform_data = &at73c213_data, |
| 300 | .controller_data = (void*) AT91_PIN_PA29, /* default for CS3 is PA6, but it must be PA29 */ |
Andrew Victor | 022cbd7 | 2006-12-01 14:38:59 +0100 | [diff] [blame] | 301 | }, |
| 302 | #endif |
| 303 | }; |
| 304 | |
| 305 | |
Andrew Victor | cdf95c7 | 2007-05-14 15:08:21 +0100 | [diff] [blame] | 306 | /* |
| 307 | * LCD Controller |
| 308 | */ |
| 309 | #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) |
Andrew Victor | 5170874 | 2007-11-20 09:40:12 +0100 | [diff] [blame] | 310 | |
| 311 | #if defined(CONFIG_FB_ATMEL_STN) |
| 312 | |
| 313 | /* STN */ |
| 314 | static struct fb_videomode at91_stn_modes[] = { |
| 315 | { |
| 316 | .name = "SP06Q002 @ 75", |
| 317 | .refresh = 75, |
| 318 | .xres = 320, .yres = 240, |
| 319 | .pixclock = KHZ2PICOS(1440), |
| 320 | |
| 321 | .left_margin = 1, .right_margin = 1, |
| 322 | .upper_margin = 0, .lower_margin = 0, |
| 323 | .hsync_len = 1, .vsync_len = 1, |
| 324 | |
| 325 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, |
| 326 | .vmode = FB_VMODE_NONINTERLACED, |
| 327 | }, |
| 328 | }; |
| 329 | |
| 330 | static struct fb_monspecs at91fb_default_stn_monspecs = { |
| 331 | .manufacturer = "HIT", |
| 332 | .monitor = "SP06Q002", |
| 333 | |
| 334 | .modedb = at91_stn_modes, |
| 335 | .modedb_len = ARRAY_SIZE(at91_stn_modes), |
| 336 | .hfmin = 15000, |
| 337 | .hfmax = 64000, |
| 338 | .vfmin = 50, |
| 339 | .vfmax = 150, |
| 340 | }; |
| 341 | |
| 342 | #define AT91SAM9261_DEFAULT_STN_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \ |
| 343 | | ATMEL_LCDC_DISTYPE_STNMONO \ |
| 344 | | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE \ |
| 345 | | ATMEL_LCDC_IFWIDTH_4 \ |
| 346 | | ATMEL_LCDC_SCANMOD_SINGLE) |
| 347 | |
| 348 | static void at91_lcdc_stn_power_control(int on) |
| 349 | { |
| 350 | /* backlight */ |
| 351 | if (on) { /* power up */ |
| 352 | at91_set_gpio_value(AT91_PIN_PC14, 0); |
| 353 | at91_set_gpio_value(AT91_PIN_PC15, 0); |
| 354 | } else { /* power down */ |
| 355 | at91_set_gpio_value(AT91_PIN_PC14, 1); |
| 356 | at91_set_gpio_value(AT91_PIN_PC15, 1); |
| 357 | } |
| 358 | } |
| 359 | |
| 360 | static struct atmel_lcdfb_info __initdata ek_lcdc_data = { |
| 361 | .default_bpp = 1, |
| 362 | .default_dmacon = ATMEL_LCDC_DMAEN, |
| 363 | .default_lcdcon2 = AT91SAM9261_DEFAULT_STN_LCDCON2, |
| 364 | .default_monspecs = &at91fb_default_stn_monspecs, |
| 365 | .atmel_lcdfb_power_control = at91_lcdc_stn_power_control, |
| 366 | .guard_time = 1, |
| 367 | }; |
| 368 | |
| 369 | #else |
| 370 | |
| 371 | /* TFT */ |
Andrew Victor | cdf95c7 | 2007-05-14 15:08:21 +0100 | [diff] [blame] | 372 | static struct fb_videomode at91_tft_vga_modes[] = { |
| 373 | { |
| 374 | .name = "TX09D50VM1CCA @ 60", |
| 375 | .refresh = 60, |
| 376 | .xres = 240, .yres = 320, |
| 377 | .pixclock = KHZ2PICOS(4965), |
| 378 | |
| 379 | .left_margin = 1, .right_margin = 33, |
| 380 | .upper_margin = 1, .lower_margin = 0, |
| 381 | .hsync_len = 5, .vsync_len = 1, |
| 382 | |
| 383 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, |
| 384 | .vmode = FB_VMODE_NONINTERLACED, |
| 385 | }, |
| 386 | }; |
| 387 | |
Andrew Victor | 5170874 | 2007-11-20 09:40:12 +0100 | [diff] [blame] | 388 | static struct fb_monspecs at91fb_default_tft_monspecs = { |
Andrew Victor | cdf95c7 | 2007-05-14 15:08:21 +0100 | [diff] [blame] | 389 | .manufacturer = "HIT", |
| 390 | .monitor = "TX09D50VM1CCA", |
| 391 | |
| 392 | .modedb = at91_tft_vga_modes, |
| 393 | .modedb_len = ARRAY_SIZE(at91_tft_vga_modes), |
| 394 | .hfmin = 15000, |
| 395 | .hfmax = 64000, |
| 396 | .vfmin = 50, |
| 397 | .vfmax = 150, |
| 398 | }; |
| 399 | |
Andrew Victor | 5170874 | 2007-11-20 09:40:12 +0100 | [diff] [blame] | 400 | #define AT91SAM9261_DEFAULT_TFT_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \ |
Andrew Victor | cdf95c7 | 2007-05-14 15:08:21 +0100 | [diff] [blame] | 401 | | ATMEL_LCDC_DISTYPE_TFT \ |
| 402 | | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE) |
| 403 | |
Andrew Victor | 5170874 | 2007-11-20 09:40:12 +0100 | [diff] [blame] | 404 | static void at91_lcdc_tft_power_control(int on) |
Andrew Victor | cdf95c7 | 2007-05-14 15:08:21 +0100 | [diff] [blame] | 405 | { |
| 406 | if (on) |
| 407 | at91_set_gpio_value(AT91_PIN_PA12, 0); /* power up */ |
| 408 | else |
| 409 | at91_set_gpio_value(AT91_PIN_PA12, 1); /* power down */ |
| 410 | } |
| 411 | |
Andrew Victor | cdf95c7 | 2007-05-14 15:08:21 +0100 | [diff] [blame] | 412 | static struct atmel_lcdfb_info __initdata ek_lcdc_data = { |
David Brownell | a9a84c3 | 2008-02-06 01:39:26 -0800 | [diff] [blame] | 413 | .lcdcon_is_backlight = true, |
Andrew Victor | cdf95c7 | 2007-05-14 15:08:21 +0100 | [diff] [blame] | 414 | .default_bpp = 16, |
| 415 | .default_dmacon = ATMEL_LCDC_DMAEN, |
Andrew Victor | 5170874 | 2007-11-20 09:40:12 +0100 | [diff] [blame] | 416 | .default_lcdcon2 = AT91SAM9261_DEFAULT_TFT_LCDCON2, |
| 417 | .default_monspecs = &at91fb_default_tft_monspecs, |
| 418 | .atmel_lcdfb_power_control = at91_lcdc_tft_power_control, |
Andrew Victor | cdf95c7 | 2007-05-14 15:08:21 +0100 | [diff] [blame] | 419 | .guard_time = 1, |
| 420 | }; |
Andrew Victor | 5170874 | 2007-11-20 09:40:12 +0100 | [diff] [blame] | 421 | #endif |
Andrew Victor | cdf95c7 | 2007-05-14 15:08:21 +0100 | [diff] [blame] | 422 | |
| 423 | #else |
| 424 | static struct atmel_lcdfb_info __initdata ek_lcdc_data; |
| 425 | #endif |
| 426 | |
| 427 | |
Andrew Victor | d0f9b55 | 2007-06-04 08:41:59 +0100 | [diff] [blame] | 428 | /* |
| 429 | * GPIO Buttons |
| 430 | */ |
| 431 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 432 | static struct gpio_keys_button ek_buttons[] = { |
| 433 | { |
| 434 | .gpio = AT91_PIN_PA27, |
David Brownell | eaf858a | 2008-01-14 08:53:22 +0100 | [diff] [blame] | 435 | .code = BTN_0, |
Andrew Victor | d0f9b55 | 2007-06-04 08:41:59 +0100 | [diff] [blame] | 436 | .desc = "Button 0", |
| 437 | .active_low = 1, |
| 438 | }, |
| 439 | { |
| 440 | .gpio = AT91_PIN_PA26, |
David Brownell | eaf858a | 2008-01-14 08:53:22 +0100 | [diff] [blame] | 441 | .code = BTN_1, |
Andrew Victor | d0f9b55 | 2007-06-04 08:41:59 +0100 | [diff] [blame] | 442 | .desc = "Button 1", |
| 443 | .active_low = 1, |
| 444 | }, |
| 445 | { |
| 446 | .gpio = AT91_PIN_PA25, |
David Brownell | eaf858a | 2008-01-14 08:53:22 +0100 | [diff] [blame] | 447 | .code = BTN_2, |
Andrew Victor | d0f9b55 | 2007-06-04 08:41:59 +0100 | [diff] [blame] | 448 | .desc = "Button 2", |
| 449 | .active_low = 1, |
| 450 | }, |
| 451 | { |
| 452 | .gpio = AT91_PIN_PA24, |
David Brownell | eaf858a | 2008-01-14 08:53:22 +0100 | [diff] [blame] | 453 | .code = BTN_3, |
Andrew Victor | d0f9b55 | 2007-06-04 08:41:59 +0100 | [diff] [blame] | 454 | .desc = "Button 3", |
| 455 | .active_low = 1, |
| 456 | } |
| 457 | }; |
| 458 | |
| 459 | static struct gpio_keys_platform_data ek_button_data = { |
| 460 | .buttons = ek_buttons, |
| 461 | .nbuttons = ARRAY_SIZE(ek_buttons), |
| 462 | }; |
| 463 | |
| 464 | static struct platform_device ek_button_device = { |
| 465 | .name = "gpio-keys", |
| 466 | .id = -1, |
| 467 | .num_resources = 0, |
| 468 | .dev = { |
| 469 | .platform_data = &ek_button_data, |
| 470 | } |
| 471 | }; |
| 472 | |
| 473 | static void __init ek_add_device_buttons(void) |
| 474 | { |
Andrew Victor | 302edfd | 2007-11-20 09:12:41 +0100 | [diff] [blame] | 475 | at91_set_gpio_input(AT91_PIN_PA27, 0); /* btn0 */ |
| 476 | at91_set_deglitch(AT91_PIN_PA27, 1); |
| 477 | at91_set_gpio_input(AT91_PIN_PA26, 0); /* btn1 */ |
| 478 | at91_set_deglitch(AT91_PIN_PA26, 1); |
| 479 | at91_set_gpio_input(AT91_PIN_PA25, 0); /* btn2 */ |
| 480 | at91_set_deglitch(AT91_PIN_PA25, 1); |
| 481 | at91_set_gpio_input(AT91_PIN_PA24, 0); /* btn3 */ |
| 482 | at91_set_deglitch(AT91_PIN_PA24, 1); |
Andrew Victor | d0f9b55 | 2007-06-04 08:41:59 +0100 | [diff] [blame] | 483 | |
| 484 | platform_device_register(&ek_button_device); |
| 485 | } |
| 486 | #else |
| 487 | static void __init ek_add_device_buttons(void) {} |
| 488 | #endif |
| 489 | |
Andrew Victor | 022cbd7 | 2006-12-01 14:38:59 +0100 | [diff] [blame] | 490 | static void __init ek_board_init(void) |
| 491 | { |
| 492 | /* Serial */ |
| 493 | at91_add_device_serial(); |
| 494 | /* USB Host */ |
| 495 | at91_add_device_usbh(&ek_usbh_data); |
| 496 | /* USB Device */ |
| 497 | at91_add_device_udc(&ek_udc_data); |
| 498 | /* I2C */ |
Andrew Victor | f230d3f | 2007-11-19 13:47:20 +0100 | [diff] [blame] | 499 | at91_add_device_i2c(NULL, 0); |
Andrew Victor | 022cbd7 | 2006-12-01 14:38:59 +0100 | [diff] [blame] | 500 | /* NAND */ |
| 501 | at91_add_device_nand(&ek_nand_data); |
| 502 | /* DM9000 ethernet */ |
| 503 | ek_add_device_dm9000(); |
| 504 | |
| 505 | /* spi0 and mmc/sd share the same PIO pins */ |
| 506 | #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) |
| 507 | /* SPI */ |
| 508 | at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); |
Andrew Victor | 2352272 | 2007-05-02 17:58:51 +0100 | [diff] [blame] | 509 | /* Touchscreen */ |
| 510 | ek_add_device_ts(); |
Andrew Victor | 5e9df92 | 2008-04-02 22:18:35 +0100 | [diff] [blame^] | 511 | /* SSC (to AT73C213) */ |
| 512 | at73c213_set_clk(&at73c213_data); |
| 513 | at91_add_device_ssc(AT91SAM9261_ID_SSC1, ATMEL_SSC_TX); |
Andrew Victor | 022cbd7 | 2006-12-01 14:38:59 +0100 | [diff] [blame] | 514 | #else |
| 515 | /* MMC */ |
Andrew Victor | d0760b3 | 2007-02-08 09:00:39 +0100 | [diff] [blame] | 516 | at91_add_device_mmc(0, &ek_mmc_data); |
Andrew Victor | 022cbd7 | 2006-12-01 14:38:59 +0100 | [diff] [blame] | 517 | #endif |
Andrew Victor | cdf95c7 | 2007-05-14 15:08:21 +0100 | [diff] [blame] | 518 | /* LCD Controller */ |
| 519 | at91_add_device_lcdc(&ek_lcdc_data); |
Andrew Victor | d0f9b55 | 2007-06-04 08:41:59 +0100 | [diff] [blame] | 520 | /* Push Buttons */ |
| 521 | ek_add_device_buttons(); |
Andrew Victor | 022cbd7 | 2006-12-01 14:38:59 +0100 | [diff] [blame] | 522 | } |
| 523 | |
| 524 | MACHINE_START(AT91SAM9261EK, "Atmel AT91SAM9261-EK") |
| 525 | /* Maintainer: Atmel */ |
| 526 | .phys_io = AT91_BASE_SYS, |
| 527 | .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc, |
| 528 | .boot_params = AT91_SDRAM_BASE + 0x100, |
| 529 | .timer = &at91sam926x_timer, |
| 530 | .map_io = ek_map_io, |
| 531 | .init_irq = ek_init_irq, |
| 532 | .init_machine = ek_board_init, |
| 533 | MACHINE_END |