Igor Plyatov | fcdc2ea | 2011-01-14 19:01:13 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 Christian Glindkamp <christian.glindkamp@taskit.de> |
| 3 | * taskit GmbH |
| 4 | * 2010 Igor Plyatov <plyatov@gmail.com> |
| 5 | * GeoSIG Ltd |
| 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/platform_device.h> |
| 23 | #include <linux/gpio.h> |
| 24 | #include <linux/w1-gpio.h> |
| 25 | #include <linux/i2c.h> |
| 26 | #include <linux/i2c/pcf857x.h> |
| 27 | #include <linux/gpio_keys.h> |
| 28 | #include <linux/input.h> |
| 29 | |
| 30 | #include <asm/mach-types.h> |
| 31 | #include <asm/mach/arch.h> |
| 32 | |
| 33 | #include <mach/board.h> |
| 34 | #include <mach/at91sam9_smc.h> |
| 35 | #include <mach/gsia18s.h> |
| 36 | #include <mach/stamp9g20.h> |
| 37 | |
| 38 | #include "sam9_smc.h" |
| 39 | #include "generic.h" |
| 40 | |
Jean-Christophe PLAGNIOL-VILLARD | 1b021a3 | 2011-04-28 20:19:32 +0800 | [diff] [blame] | 41 | static void __init gsia18s_init_early(void) |
Igor Plyatov | fcdc2ea | 2011-01-14 19:01:13 +0100 | [diff] [blame] | 42 | { |
Jean-Christophe PLAGNIOL-VILLARD | 1b021a3 | 2011-04-28 20:19:32 +0800 | [diff] [blame] | 43 | stamp9g20_init_early(); |
Igor Plyatov | fcdc2ea | 2011-01-14 19:01:13 +0100 | [diff] [blame] | 44 | |
| 45 | /* |
| 46 | * USART0 on ttyS1 (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI). |
| 47 | * Used for Internal Analog Modem. |
| 48 | */ |
| 49 | at91_register_uart(AT91SAM9260_ID_US0, 1, |
| 50 | ATMEL_UART_CTS | ATMEL_UART_RTS | |
| 51 | ATMEL_UART_DTR | ATMEL_UART_DSR | |
| 52 | ATMEL_UART_DCD | ATMEL_UART_RI); |
| 53 | /* |
| 54 | * USART1 on ttyS2 (Rx, Tx, CTS, RTS). |
| 55 | * Used for GPS or WiFi or Data stream. |
| 56 | */ |
| 57 | at91_register_uart(AT91SAM9260_ID_US1, 2, |
| 58 | ATMEL_UART_CTS | ATMEL_UART_RTS); |
| 59 | /* |
| 60 | * USART2 on ttyS3 (Rx, Tx, CTS, RTS). |
| 61 | * Used for External Modem. |
| 62 | */ |
| 63 | at91_register_uart(AT91SAM9260_ID_US2, 3, |
| 64 | ATMEL_UART_CTS | ATMEL_UART_RTS); |
| 65 | /* |
| 66 | * USART3 on ttyS4 (Rx, Tx, RTS). |
| 67 | * Used for RS-485. |
| 68 | */ |
| 69 | at91_register_uart(AT91SAM9260_ID_US3, 4, ATMEL_UART_RTS); |
| 70 | |
| 71 | /* |
| 72 | * USART4 on ttyS5 (Rx, Tx). |
| 73 | * Used for TRX433 Radio Module. |
| 74 | */ |
| 75 | at91_register_uart(AT91SAM9260_ID_US4, 5, 0); |
| 76 | } |
| 77 | |
Igor Plyatov | fcdc2ea | 2011-01-14 19:01:13 +0100 | [diff] [blame] | 78 | /* |
| 79 | * Two USB Host ports |
| 80 | */ |
| 81 | static struct at91_usbh_data __initdata usbh_data = { |
| 82 | .ports = 2, |
| 83 | }; |
| 84 | |
| 85 | /* |
| 86 | * USB Device port |
| 87 | */ |
| 88 | static struct at91_udc_data __initdata udc_data = { |
| 89 | .vbus_pin = AT91_PIN_PA22, |
| 90 | .pullup_pin = 0, /* pull-up driven by UDC */ |
| 91 | }; |
| 92 | |
| 93 | /* |
| 94 | * MACB Ethernet device |
| 95 | */ |
| 96 | static struct at91_eth_data __initdata macb_data = { |
| 97 | .phy_irq_pin = AT91_PIN_PA28, |
| 98 | .is_rmii = 1, |
| 99 | }; |
| 100 | |
| 101 | /* |
| 102 | * LEDs and GPOs |
| 103 | */ |
| 104 | static struct gpio_led gpio_leds[] = { |
| 105 | { |
| 106 | .name = "gpo:spi1reset", |
| 107 | .gpio = AT91_PIN_PC1, |
| 108 | .active_low = 0, |
| 109 | .default_trigger = "none", |
| 110 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 111 | }, |
| 112 | { |
| 113 | .name = "gpo:trig_net_out", |
| 114 | .gpio = AT91_PIN_PB20, |
| 115 | .active_low = 0, |
| 116 | .default_trigger = "none", |
| 117 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 118 | }, |
| 119 | { |
| 120 | .name = "gpo:trig_net_dir", |
| 121 | .gpio = AT91_PIN_PB19, |
| 122 | .active_low = 0, |
| 123 | .default_trigger = "none", |
| 124 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 125 | }, |
| 126 | { |
| 127 | .name = "gpo:charge_dis", |
| 128 | .gpio = AT91_PIN_PC2, |
| 129 | .active_low = 0, |
| 130 | .default_trigger = "none", |
| 131 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 132 | }, |
| 133 | { |
| 134 | .name = "led:event", |
| 135 | .gpio = AT91_PIN_PB17, |
| 136 | .active_low = 1, |
| 137 | .default_trigger = "none", |
| 138 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 139 | }, |
| 140 | { |
| 141 | .name = "led:lan", |
| 142 | .gpio = AT91_PIN_PB18, |
| 143 | .active_low = 1, |
| 144 | .default_trigger = "none", |
| 145 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 146 | }, |
| 147 | { |
| 148 | .name = "led:error", |
| 149 | .gpio = AT91_PIN_PB16, |
| 150 | .active_low = 1, |
| 151 | .default_trigger = "none", |
| 152 | .default_state = LEDS_GPIO_DEFSTATE_ON, |
| 153 | } |
| 154 | }; |
| 155 | |
| 156 | static struct gpio_led_platform_data gpio_led_info = { |
| 157 | .leds = gpio_leds, |
| 158 | .num_leds = ARRAY_SIZE(gpio_leds), |
| 159 | }; |
| 160 | |
| 161 | static struct platform_device leds = { |
| 162 | .name = "leds-gpio", |
| 163 | .id = 0, |
| 164 | .dev = { |
| 165 | .platform_data = &gpio_led_info, |
| 166 | } |
| 167 | }; |
| 168 | |
| 169 | static void __init gsia18s_leds_init(void) |
| 170 | { |
| 171 | platform_device_register(&leds); |
| 172 | } |
| 173 | |
| 174 | /* PCF8574 0x20 GPIO - U1 on the GS_IA18-CB_V3 board */ |
| 175 | static struct gpio_led pcf_gpio_leds1[] = { |
| 176 | { /* bit 0 */ |
| 177 | .name = "gpo:hdc_power", |
| 178 | .gpio = PCF_GPIO_HDC_POWER, |
| 179 | .active_low = 0, |
| 180 | .default_trigger = "none", |
| 181 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 182 | }, |
| 183 | { /* bit 1 */ |
| 184 | .name = "gpo:wifi_setup", |
| 185 | .gpio = PCF_GPIO_WIFI_SETUP, |
| 186 | .active_low = 1, |
| 187 | .default_trigger = "none", |
| 188 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 189 | }, |
| 190 | { /* bit 2 */ |
| 191 | .name = "gpo:wifi_enable", |
| 192 | .gpio = PCF_GPIO_WIFI_ENABLE, |
| 193 | .active_low = 1, |
| 194 | .default_trigger = "none", |
| 195 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 196 | }, |
| 197 | { /* bit 3 */ |
| 198 | .name = "gpo:wifi_reset", |
| 199 | .gpio = PCF_GPIO_WIFI_RESET, |
| 200 | .active_low = 1, |
| 201 | .default_trigger = "none", |
| 202 | .default_state = LEDS_GPIO_DEFSTATE_ON, |
| 203 | }, |
| 204 | /* bit 4 used as GPI */ |
| 205 | { /* bit 5 */ |
| 206 | .name = "gpo:gps_setup", |
| 207 | .gpio = PCF_GPIO_GPS_SETUP, |
| 208 | .active_low = 1, |
| 209 | .default_trigger = "none", |
| 210 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 211 | }, |
| 212 | { /* bit 6 */ |
| 213 | .name = "gpo:gps_standby", |
| 214 | .gpio = PCF_GPIO_GPS_STANDBY, |
| 215 | .active_low = 0, |
| 216 | .default_trigger = "none", |
| 217 | .default_state = LEDS_GPIO_DEFSTATE_ON, |
| 218 | }, |
| 219 | { /* bit 7 */ |
| 220 | .name = "gpo:gps_power", |
| 221 | .gpio = PCF_GPIO_GPS_POWER, |
| 222 | .active_low = 0, |
| 223 | .default_trigger = "none", |
| 224 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 225 | } |
| 226 | }; |
| 227 | |
| 228 | static struct gpio_led_platform_data pcf_gpio_led_info1 = { |
| 229 | .leds = pcf_gpio_leds1, |
| 230 | .num_leds = ARRAY_SIZE(pcf_gpio_leds1), |
| 231 | }; |
| 232 | |
| 233 | static struct platform_device pcf_leds1 = { |
| 234 | .name = "leds-gpio", /* GS_IA18-CB_board */ |
| 235 | .id = 1, |
| 236 | .dev = { |
| 237 | .platform_data = &pcf_gpio_led_info1, |
| 238 | } |
| 239 | }; |
| 240 | |
| 241 | /* PCF8574 0x22 GPIO - U1 on the GS_2G_OPT1-A_V0 board (Alarm) */ |
| 242 | static struct gpio_led pcf_gpio_leds2[] = { |
| 243 | { /* bit 0 */ |
| 244 | .name = "gpo:alarm_1", |
| 245 | .gpio = PCF_GPIO_ALARM1, |
| 246 | .active_low = 1, |
| 247 | .default_trigger = "none", |
| 248 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 249 | }, |
| 250 | { /* bit 1 */ |
| 251 | .name = "gpo:alarm_2", |
| 252 | .gpio = PCF_GPIO_ALARM2, |
| 253 | .active_low = 1, |
| 254 | .default_trigger = "none", |
| 255 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 256 | }, |
| 257 | { /* bit 2 */ |
| 258 | .name = "gpo:alarm_3", |
| 259 | .gpio = PCF_GPIO_ALARM3, |
| 260 | .active_low = 1, |
| 261 | .default_trigger = "none", |
| 262 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 263 | }, |
| 264 | { /* bit 3 */ |
| 265 | .name = "gpo:alarm_4", |
| 266 | .gpio = PCF_GPIO_ALARM4, |
| 267 | .active_low = 1, |
| 268 | .default_trigger = "none", |
| 269 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 270 | }, |
| 271 | /* bits 4, 5, 6 not used */ |
| 272 | { /* bit 7 */ |
| 273 | .name = "gpo:alarm_v_relay_on", |
| 274 | .gpio = PCF_GPIO_ALARM_V_RELAY_ON, |
| 275 | .active_low = 0, |
| 276 | .default_trigger = "none", |
| 277 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 278 | }, |
| 279 | }; |
| 280 | |
| 281 | static struct gpio_led_platform_data pcf_gpio_led_info2 = { |
| 282 | .leds = pcf_gpio_leds2, |
| 283 | .num_leds = ARRAY_SIZE(pcf_gpio_leds2), |
| 284 | }; |
| 285 | |
| 286 | static struct platform_device pcf_leds2 = { |
| 287 | .name = "leds-gpio", |
| 288 | .id = 2, |
| 289 | .dev = { |
| 290 | .platform_data = &pcf_gpio_led_info2, |
| 291 | } |
| 292 | }; |
| 293 | |
| 294 | /* PCF8574 0x24 GPIO U1 on the GS_2G-OPT23-A_V0 board (Modem) */ |
| 295 | static struct gpio_led pcf_gpio_leds3[] = { |
| 296 | { /* bit 0 */ |
| 297 | .name = "gpo:modem_power", |
| 298 | .gpio = PCF_GPIO_MODEM_POWER, |
| 299 | .active_low = 1, |
| 300 | .default_trigger = "none", |
| 301 | .default_state = LEDS_GPIO_DEFSTATE_OFF, |
| 302 | }, |
| 303 | /* bits 1 and 2 not used */ |
| 304 | { /* bit 3 */ |
| 305 | .name = "gpo:modem_reset", |
| 306 | .gpio = PCF_GPIO_MODEM_RESET, |
| 307 | .active_low = 1, |
| 308 | .default_trigger = "none", |
| 309 | .default_state = LEDS_GPIO_DEFSTATE_ON, |
| 310 | }, |
| 311 | /* bits 4, 5 and 6 not used */ |
| 312 | { /* bit 7 */ |
| 313 | .name = "gpo:trx_reset", |
| 314 | .gpio = PCF_GPIO_TRX_RESET, |
| 315 | .active_low = 1, |
| 316 | .default_trigger = "none", |
| 317 | .default_state = LEDS_GPIO_DEFSTATE_ON, |
| 318 | } |
| 319 | }; |
| 320 | |
| 321 | static struct gpio_led_platform_data pcf_gpio_led_info3 = { |
| 322 | .leds = pcf_gpio_leds3, |
| 323 | .num_leds = ARRAY_SIZE(pcf_gpio_leds3), |
| 324 | }; |
| 325 | |
| 326 | static struct platform_device pcf_leds3 = { |
| 327 | .name = "leds-gpio", |
| 328 | .id = 3, |
| 329 | .dev = { |
| 330 | .platform_data = &pcf_gpio_led_info3, |
| 331 | } |
| 332 | }; |
| 333 | |
| 334 | static void __init gsia18s_pcf_leds_init(void) |
| 335 | { |
| 336 | platform_device_register(&pcf_leds1); |
| 337 | platform_device_register(&pcf_leds2); |
| 338 | platform_device_register(&pcf_leds3); |
| 339 | } |
| 340 | |
| 341 | /* |
| 342 | * SPI busses. |
| 343 | */ |
| 344 | static struct spi_board_info gsia18s_spi_devices[] = { |
| 345 | { /* User accessible spi0, cs0 used for communication with MSP RTC */ |
| 346 | .modalias = "spidev", |
| 347 | .bus_num = 0, |
| 348 | .chip_select = 0, |
| 349 | .max_speed_hz = 580000, |
| 350 | .mode = SPI_MODE_1, |
| 351 | }, |
| 352 | { /* User accessible spi1, cs0 used for communication with int. DSP */ |
| 353 | .modalias = "spidev", |
| 354 | .bus_num = 1, |
| 355 | .chip_select = 0, |
| 356 | .max_speed_hz = 5600000, |
| 357 | .mode = SPI_MODE_0, |
| 358 | }, |
| 359 | { /* User accessible spi1, cs1 used for communication with ext. DSP */ |
| 360 | .modalias = "spidev", |
| 361 | .bus_num = 1, |
| 362 | .chip_select = 1, |
| 363 | .max_speed_hz = 5600000, |
| 364 | .mode = SPI_MODE_0, |
| 365 | }, |
| 366 | { /* User accessible spi1, cs2 used for communication with ext. DSP */ |
| 367 | .modalias = "spidev", |
| 368 | .bus_num = 1, |
| 369 | .chip_select = 2, |
| 370 | .max_speed_hz = 5600000, |
| 371 | .mode = SPI_MODE_0, |
| 372 | }, |
| 373 | { /* User accessible spi1, cs3 used for communication with ext. DSP */ |
| 374 | .modalias = "spidev", |
| 375 | .bus_num = 1, |
| 376 | .chip_select = 3, |
| 377 | .max_speed_hz = 5600000, |
| 378 | .mode = SPI_MODE_0, |
| 379 | } |
| 380 | }; |
| 381 | |
| 382 | /* |
| 383 | * GPI Buttons |
| 384 | */ |
| 385 | static struct gpio_keys_button buttons[] = { |
| 386 | { |
| 387 | .gpio = GPIO_TRIG_NET_IN, |
| 388 | .code = BTN_1, |
| 389 | .desc = "TRIG_NET_IN", |
| 390 | .type = EV_KEY, |
| 391 | .active_low = 0, |
| 392 | .wakeup = 1, |
| 393 | }, |
| 394 | { /* SW80 on the GS_IA18_S-MN board*/ |
| 395 | .gpio = GPIO_CARD_UNMOUNT_0, |
| 396 | .code = BTN_2, |
| 397 | .desc = "Card umount 0", |
| 398 | .type = EV_KEY, |
| 399 | .active_low = 1, |
| 400 | .wakeup = 1, |
| 401 | }, |
| 402 | { /* SW79 on the GS_IA18_S-MN board*/ |
| 403 | .gpio = GPIO_CARD_UNMOUNT_1, |
| 404 | .code = BTN_3, |
| 405 | .desc = "Card umount 1", |
| 406 | .type = EV_KEY, |
| 407 | .active_low = 1, |
| 408 | .wakeup = 1, |
| 409 | }, |
| 410 | { /* SW280 on the GS_IA18-CB board*/ |
| 411 | .gpio = GPIO_KEY_POWER, |
| 412 | .code = KEY_POWER, |
| 413 | .desc = "Power Off Button", |
| 414 | .type = EV_KEY, |
| 415 | .active_low = 0, |
| 416 | .wakeup = 1, |
| 417 | } |
| 418 | }; |
| 419 | |
| 420 | static struct gpio_keys_platform_data button_data = { |
| 421 | .buttons = buttons, |
| 422 | .nbuttons = ARRAY_SIZE(buttons), |
| 423 | }; |
| 424 | |
| 425 | static struct platform_device button_device = { |
| 426 | .name = "gpio-keys", |
| 427 | .id = -1, |
| 428 | .num_resources = 0, |
| 429 | .dev = { |
| 430 | .platform_data = &button_data, |
| 431 | } |
| 432 | }; |
| 433 | |
| 434 | static void __init gsia18s_add_device_buttons(void) |
| 435 | { |
| 436 | at91_set_gpio_input(GPIO_TRIG_NET_IN, 1); |
| 437 | at91_set_deglitch(GPIO_TRIG_NET_IN, 1); |
| 438 | at91_set_gpio_input(GPIO_CARD_UNMOUNT_0, 1); |
| 439 | at91_set_deglitch(GPIO_CARD_UNMOUNT_0, 1); |
| 440 | at91_set_gpio_input(GPIO_CARD_UNMOUNT_1, 1); |
| 441 | at91_set_deglitch(GPIO_CARD_UNMOUNT_1, 1); |
| 442 | at91_set_gpio_input(GPIO_KEY_POWER, 0); |
| 443 | at91_set_deglitch(GPIO_KEY_POWER, 1); |
| 444 | |
| 445 | platform_device_register(&button_device); |
| 446 | } |
| 447 | |
| 448 | /* |
| 449 | * I2C |
| 450 | */ |
| 451 | static int pcf8574x_0x20_setup(struct i2c_client *client, int gpio, |
| 452 | unsigned int ngpio, void *context) |
| 453 | { |
| 454 | int status; |
| 455 | |
| 456 | status = gpio_request(gpio + PCF_GPIO_ETH_DETECT, "eth_det"); |
| 457 | if (status < 0) { |
| 458 | pr_err("error: can't request GPIO%d\n", |
| 459 | gpio + PCF_GPIO_ETH_DETECT); |
| 460 | return status; |
| 461 | } |
| 462 | status = gpio_direction_input(gpio + PCF_GPIO_ETH_DETECT); |
| 463 | if (status < 0) { |
| 464 | pr_err("error: can't setup GPIO%d as input\n", |
| 465 | gpio + PCF_GPIO_ETH_DETECT); |
| 466 | return status; |
| 467 | } |
| 468 | status = gpio_export(gpio + PCF_GPIO_ETH_DETECT, false); |
| 469 | if (status < 0) { |
| 470 | pr_err("error: can't export GPIO%d\n", |
| 471 | gpio + PCF_GPIO_ETH_DETECT); |
| 472 | return status; |
| 473 | } |
| 474 | status = gpio_sysfs_set_active_low(gpio + PCF_GPIO_ETH_DETECT, 1); |
| 475 | if (status < 0) { |
| 476 | pr_err("error: gpio_sysfs_set active_low(GPIO%d, 1)\n", |
| 477 | gpio + PCF_GPIO_ETH_DETECT); |
| 478 | return status; |
| 479 | } |
| 480 | |
| 481 | return 0; |
| 482 | } |
| 483 | |
| 484 | static int pcf8574x_0x20_teardown(struct i2c_client *client, int gpio, |
| 485 | unsigned ngpio, void *context) |
| 486 | { |
| 487 | gpio_free(gpio + PCF_GPIO_ETH_DETECT); |
| 488 | return 0; |
| 489 | } |
| 490 | |
| 491 | static struct pcf857x_platform_data pcf20_pdata = { |
| 492 | .gpio_base = GS_IA18_S_PCF_GPIO_BASE0, |
| 493 | .n_latch = (1 << 4), |
| 494 | .setup = pcf8574x_0x20_setup, |
| 495 | .teardown = pcf8574x_0x20_teardown, |
| 496 | }; |
| 497 | |
| 498 | static struct pcf857x_platform_data pcf22_pdata = { |
| 499 | .gpio_base = GS_IA18_S_PCF_GPIO_BASE1, |
| 500 | }; |
| 501 | |
| 502 | static struct pcf857x_platform_data pcf24_pdata = { |
| 503 | .gpio_base = GS_IA18_S_PCF_GPIO_BASE2, |
| 504 | }; |
| 505 | |
| 506 | static struct i2c_board_info __initdata gsia18s_i2c_devices[] = { |
| 507 | { /* U1 on the GS_IA18-CB_V3 board */ |
| 508 | I2C_BOARD_INFO("pcf8574", 0x20), |
| 509 | .platform_data = &pcf20_pdata, |
| 510 | }, |
| 511 | { /* U1 on the GS_2G_OPT1-A_V0 board (Alarm) */ |
| 512 | I2C_BOARD_INFO("pcf8574", 0x22), |
| 513 | .platform_data = &pcf22_pdata, |
| 514 | }, |
| 515 | { /* U1 on the GS_2G-OPT23-A_V0 board (Modem) */ |
| 516 | I2C_BOARD_INFO("pcf8574", 0x24), |
| 517 | .platform_data = &pcf24_pdata, |
| 518 | }, |
| 519 | { /* U161 on the GS_IA18_S-MN board */ |
| 520 | I2C_BOARD_INFO("24c1024", 0x50), |
| 521 | }, |
| 522 | { /* U162 on the GS_IA18_S-MN board */ |
| 523 | I2C_BOARD_INFO("24c01", 0x53), |
| 524 | }, |
| 525 | }; |
| 526 | |
| 527 | /* |
| 528 | * Compact Flash |
| 529 | */ |
| 530 | static struct at91_cf_data __initdata gsia18s_cf1_data = { |
| 531 | .irq_pin = AT91_PIN_PA27, |
| 532 | .det_pin = AT91_PIN_PB30, |
| 533 | .rst_pin = AT91_PIN_PB31, |
| 534 | .chipselect = 5, |
| 535 | .flags = AT91_CF_TRUE_IDE, |
| 536 | }; |
| 537 | |
| 538 | /* Power Off by RTC */ |
| 539 | static void gsia18s_power_off(void) |
| 540 | { |
| 541 | pr_notice("Power supply will be switched off automatically now or after 60 seconds without ArmDAS.\n"); |
| 542 | at91_set_gpio_output(AT91_PIN_PA25, 1); |
| 543 | /* Spin to death... */ |
| 544 | while (1) |
| 545 | ; |
| 546 | } |
| 547 | |
| 548 | static int __init gsia18s_power_off_init(void) |
| 549 | { |
| 550 | pm_power_off = gsia18s_power_off; |
| 551 | return 0; |
| 552 | } |
| 553 | |
| 554 | /* ---------------------------------------------------------------------------*/ |
| 555 | |
| 556 | static void __init gsia18s_board_init(void) |
| 557 | { |
| 558 | stamp9g20_board_init(); |
| 559 | at91_add_device_usbh(&usbh_data); |
| 560 | at91_add_device_udc(&udc_data); |
| 561 | at91_add_device_eth(&macb_data); |
| 562 | gsia18s_leds_init(); |
| 563 | gsia18s_pcf_leds_init(); |
| 564 | gsia18s_add_device_buttons(); |
| 565 | at91_add_device_i2c(gsia18s_i2c_devices, |
| 566 | ARRAY_SIZE(gsia18s_i2c_devices)); |
| 567 | at91_add_device_cf(&gsia18s_cf1_data); |
| 568 | at91_add_device_spi(gsia18s_spi_devices, |
| 569 | ARRAY_SIZE(gsia18s_spi_devices)); |
| 570 | gsia18s_power_off_init(); |
| 571 | } |
| 572 | |
| 573 | MACHINE_START(GSIA18S, "GS_IA18_S") |
Igor Plyatov | fcdc2ea | 2011-01-14 19:01:13 +0100 | [diff] [blame] | 574 | .timer = &at91sam926x_timer, |
Jean-Christophe PLAGNIOL-VILLARD | 21d08b9 | 2011-04-23 15:28:34 +0800 | [diff] [blame] | 575 | .map_io = at91_map_io, |
Jean-Christophe PLAGNIOL-VILLARD | 1b021a3 | 2011-04-28 20:19:32 +0800 | [diff] [blame] | 576 | .init_early = gsia18s_init_early, |
Jean-Christophe PLAGNIOL-VILLARD | 92100c1 | 2011-04-23 15:28:34 +0800 | [diff] [blame] | 577 | .init_irq = at91_init_irq_default, |
Igor Plyatov | fcdc2ea | 2011-01-14 19:01:13 +0100 | [diff] [blame] | 578 | .init_machine = gsia18s_board_init, |
| 579 | MACHINE_END |