diff options
Diffstat (limited to 'arch/arm/mach-at91/at91sam9g45_devices.c')
-rw-r--r-- | arch/arm/mach-at91/at91sam9g45_devices.c | 69 |
1 files changed, 46 insertions, 23 deletions
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c index 09a16d6bd5cd..b7582dd10dc3 100644 --- a/arch/arm/mach-at91/at91sam9g45_devices.c +++ b/arch/arm/mach-at91/at91sam9g45_devices.c | |||
@@ -44,8 +44,8 @@ static struct at_dma_platform_data atdma_pdata = { | |||
44 | 44 | ||
45 | static struct resource hdmac_resources[] = { | 45 | static struct resource hdmac_resources[] = { |
46 | [0] = { | 46 | [0] = { |
47 | .start = AT91_BASE_SYS + AT91_DMA, | 47 | .start = AT91SAM9G45_BASE_DMA, |
48 | .end = AT91_BASE_SYS + AT91_DMA + SZ_512 - 1, | 48 | .end = AT91SAM9G45_BASE_DMA + SZ_512 - 1, |
49 | .flags = IORESOURCE_MEM, | 49 | .flags = IORESOURCE_MEM, |
50 | }, | 50 | }, |
51 | [1] = { | 51 | [1] = { |
@@ -120,7 +120,7 @@ void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data) | |||
120 | 120 | ||
121 | /* Enable VBus control for UHP ports */ | 121 | /* Enable VBus control for UHP ports */ |
122 | for (i = 0; i < data->ports; i++) { | 122 | for (i = 0; i < data->ports; i++) { |
123 | if (data->vbus_pin[i]) | 123 | if (gpio_is_valid(data->vbus_pin[i])) |
124 | at91_set_gpio_output(data->vbus_pin[i], 0); | 124 | at91_set_gpio_output(data->vbus_pin[i], 0); |
125 | } | 125 | } |
126 | 126 | ||
@@ -181,7 +181,7 @@ void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data) | |||
181 | 181 | ||
182 | /* Enable VBus control for UHP ports */ | 182 | /* Enable VBus control for UHP ports */ |
183 | for (i = 0; i < data->ports; i++) { | 183 | for (i = 0; i < data->ports; i++) { |
184 | if (data->vbus_pin[i]) | 184 | if (gpio_is_valid(data->vbus_pin[i])) |
185 | at91_set_gpio_output(data->vbus_pin[i], 0); | 185 | at91_set_gpio_output(data->vbus_pin[i], 0); |
186 | } | 186 | } |
187 | 187 | ||
@@ -263,7 +263,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data) | |||
263 | usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep); | 263 | usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep); |
264 | memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep)); | 264 | memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep)); |
265 | 265 | ||
266 | if (data && data->vbus_pin > 0) { | 266 | if (data && gpio_is_valid(data->vbus_pin)) { |
267 | at91_set_gpio_input(data->vbus_pin, 0); | 267 | at91_set_gpio_input(data->vbus_pin, 0); |
268 | at91_set_deglitch(data->vbus_pin, 1); | 268 | at91_set_deglitch(data->vbus_pin, 1); |
269 | usba_udc_data.pdata.vbus_pin = data->vbus_pin; | 269 | usba_udc_data.pdata.vbus_pin = data->vbus_pin; |
@@ -284,7 +284,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data) {} | |||
284 | 284 | ||
285 | #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE) | 285 | #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE) |
286 | static u64 eth_dmamask = DMA_BIT_MASK(32); | 286 | static u64 eth_dmamask = DMA_BIT_MASK(32); |
287 | static struct at91_eth_data eth_data; | 287 | static struct macb_platform_data eth_data; |
288 | 288 | ||
289 | static struct resource eth_resources[] = { | 289 | static struct resource eth_resources[] = { |
290 | [0] = { | 290 | [0] = { |
@@ -311,12 +311,12 @@ static struct platform_device at91sam9g45_eth_device = { | |||
311 | .num_resources = ARRAY_SIZE(eth_resources), | 311 | .num_resources = ARRAY_SIZE(eth_resources), |
312 | }; | 312 | }; |
313 | 313 | ||
314 | void __init at91_add_device_eth(struct at91_eth_data *data) | 314 | void __init at91_add_device_eth(struct macb_platform_data *data) |
315 | { | 315 | { |
316 | if (!data) | 316 | if (!data) |
317 | return; | 317 | return; |
318 | 318 | ||
319 | if (data->phy_irq_pin) { | 319 | if (gpio_is_valid(data->phy_irq_pin)) { |
320 | at91_set_gpio_input(data->phy_irq_pin, 0); | 320 | at91_set_gpio_input(data->phy_irq_pin, 0); |
321 | at91_set_deglitch(data->phy_irq_pin, 1); | 321 | at91_set_deglitch(data->phy_irq_pin, 1); |
322 | } | 322 | } |
@@ -348,7 +348,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data) | |||
348 | platform_device_register(&at91sam9g45_eth_device); | 348 | platform_device_register(&at91sam9g45_eth_device); |
349 | } | 349 | } |
350 | #else | 350 | #else |
351 | void __init at91_add_device_eth(struct at91_eth_data *data) {} | 351 | void __init at91_add_device_eth(struct macb_platform_data *data) {} |
352 | #endif | 352 | #endif |
353 | 353 | ||
354 | 354 | ||
@@ -449,11 +449,11 @@ void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) | |||
449 | 449 | ||
450 | 450 | ||
451 | /* input/irq */ | 451 | /* input/irq */ |
452 | if (data->slot[0].detect_pin) { | 452 | if (gpio_is_valid(data->slot[0].detect_pin)) { |
453 | at91_set_gpio_input(data->slot[0].detect_pin, 1); | 453 | at91_set_gpio_input(data->slot[0].detect_pin, 1); |
454 | at91_set_deglitch(data->slot[0].detect_pin, 1); | 454 | at91_set_deglitch(data->slot[0].detect_pin, 1); |
455 | } | 455 | } |
456 | if (data->slot[0].wp_pin) | 456 | if (gpio_is_valid(data->slot[0].wp_pin)) |
457 | at91_set_gpio_input(data->slot[0].wp_pin, 1); | 457 | at91_set_gpio_input(data->slot[0].wp_pin, 1); |
458 | 458 | ||
459 | if (mmc_id == 0) { /* MCI0 */ | 459 | if (mmc_id == 0) { /* MCI0 */ |
@@ -529,8 +529,8 @@ static struct resource nand_resources[] = { | |||
529 | .flags = IORESOURCE_MEM, | 529 | .flags = IORESOURCE_MEM, |
530 | }, | 530 | }, |
531 | [1] = { | 531 | [1] = { |
532 | .start = AT91_BASE_SYS + AT91_ECC, | 532 | .start = AT91SAM9G45_BASE_ECC, |
533 | .end = AT91_BASE_SYS + AT91_ECC + SZ_512 - 1, | 533 | .end = AT91SAM9G45_BASE_ECC + SZ_512 - 1, |
534 | .flags = IORESOURCE_MEM, | 534 | .flags = IORESOURCE_MEM, |
535 | } | 535 | } |
536 | }; | 536 | }; |
@@ -556,15 +556,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data) | |||
556 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA); | 556 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA); |
557 | 557 | ||
558 | /* enable pin */ | 558 | /* enable pin */ |
559 | if (data->enable_pin) | 559 | if (gpio_is_valid(data->enable_pin)) |
560 | at91_set_gpio_output(data->enable_pin, 1); | 560 | at91_set_gpio_output(data->enable_pin, 1); |
561 | 561 | ||
562 | /* ready/busy pin */ | 562 | /* ready/busy pin */ |
563 | if (data->rdy_pin) | 563 | if (gpio_is_valid(data->rdy_pin)) |
564 | at91_set_gpio_input(data->rdy_pin, 1); | 564 | at91_set_gpio_input(data->rdy_pin, 1); |
565 | 565 | ||
566 | /* card detect pin */ | 566 | /* card detect pin */ |
567 | if (data->det_pin) | 567 | if (gpio_is_valid(data->det_pin)) |
568 | at91_set_gpio_input(data->det_pin, 1); | 568 | at91_set_gpio_input(data->det_pin, 1); |
569 | 569 | ||
570 | nand_data = *data; | 570 | nand_data = *data; |
@@ -859,7 +859,7 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data) | |||
859 | at91_set_A_periph(AT91_PIN_PD6, 0); /* AC97RX */ | 859 | at91_set_A_periph(AT91_PIN_PD6, 0); /* AC97RX */ |
860 | 860 | ||
861 | /* reset */ | 861 | /* reset */ |
862 | if (data->reset_pin) | 862 | if (gpio_is_valid(data->reset_pin)) |
863 | at91_set_gpio_output(data->reset_pin, 0); | 863 | at91_set_gpio_output(data->reset_pin, 0); |
864 | 864 | ||
865 | ac97_data = *data; | 865 | ac97_data = *data; |
@@ -1009,10 +1009,24 @@ static void __init at91_add_device_tc(void) { } | |||
1009 | * -------------------------------------------------------------------- */ | 1009 | * -------------------------------------------------------------------- */ |
1010 | 1010 | ||
1011 | #if defined(CONFIG_RTC_DRV_AT91RM9200) || defined(CONFIG_RTC_DRV_AT91RM9200_MODULE) | 1011 | #if defined(CONFIG_RTC_DRV_AT91RM9200) || defined(CONFIG_RTC_DRV_AT91RM9200_MODULE) |
1012 | static struct resource rtc_resources[] = { | ||
1013 | [0] = { | ||
1014 | .start = AT91SAM9G45_BASE_RTC, | ||
1015 | .end = AT91SAM9G45_BASE_RTC + SZ_256 - 1, | ||
1016 | .flags = IORESOURCE_MEM, | ||
1017 | }, | ||
1018 | [1] = { | ||
1019 | .start = AT91_ID_SYS, | ||
1020 | .end = AT91_ID_SYS, | ||
1021 | .flags = IORESOURCE_IRQ, | ||
1022 | }, | ||
1023 | }; | ||
1024 | |||
1012 | static struct platform_device at91sam9g45_rtc_device = { | 1025 | static struct platform_device at91sam9g45_rtc_device = { |
1013 | .name = "at91_rtc", | 1026 | .name = "at91_rtc", |
1014 | .id = -1, | 1027 | .id = -1, |
1015 | .num_resources = 0, | 1028 | .resource = rtc_resources, |
1029 | .num_resources = ARRAY_SIZE(rtc_resources), | ||
1016 | }; | 1030 | }; |
1017 | 1031 | ||
1018 | static void __init at91_add_device_rtc(void) | 1032 | static void __init at91_add_device_rtc(void) |
@@ -1081,8 +1095,8 @@ void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data) {} | |||
1081 | 1095 | ||
1082 | static struct resource rtt_resources[] = { | 1096 | static struct resource rtt_resources[] = { |
1083 | { | 1097 | { |
1084 | .start = AT91_BASE_SYS + AT91_RTT, | 1098 | .start = AT91SAM9G45_BASE_RTT, |
1085 | .end = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1, | 1099 | .end = AT91SAM9G45_BASE_RTT + SZ_16 - 1, |
1086 | .flags = IORESOURCE_MEM, | 1100 | .flags = IORESOURCE_MEM, |
1087 | } | 1101 | } |
1088 | }; | 1102 | }; |
@@ -1133,10 +1147,19 @@ static void __init at91_add_device_trng(void) {} | |||
1133 | * -------------------------------------------------------------------- */ | 1147 | * -------------------------------------------------------------------- */ |
1134 | 1148 | ||
1135 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) | 1149 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) |
1150 | static struct resource wdt_resources[] = { | ||
1151 | { | ||
1152 | .start = AT91SAM9G45_BASE_WDT, | ||
1153 | .end = AT91SAM9G45_BASE_WDT + SZ_16 - 1, | ||
1154 | .flags = IORESOURCE_MEM, | ||
1155 | } | ||
1156 | }; | ||
1157 | |||
1136 | static struct platform_device at91sam9g45_wdt_device = { | 1158 | static struct platform_device at91sam9g45_wdt_device = { |
1137 | .name = "at91_wdt", | 1159 | .name = "at91_wdt", |
1138 | .id = -1, | 1160 | .id = -1, |
1139 | .num_resources = 0, | 1161 | .resource = wdt_resources, |
1162 | .num_resources = ARRAY_SIZE(wdt_resources), | ||
1140 | }; | 1163 | }; |
1141 | 1164 | ||
1142 | static void __init at91_add_device_watchdog(void) | 1165 | static void __init at91_add_device_watchdog(void) |
@@ -1332,8 +1355,8 @@ void __init at91_add_device_ssc(unsigned id, unsigned pins) {} | |||
1332 | #if defined(CONFIG_SERIAL_ATMEL) | 1355 | #if defined(CONFIG_SERIAL_ATMEL) |
1333 | static struct resource dbgu_resources[] = { | 1356 | static struct resource dbgu_resources[] = { |
1334 | [0] = { | 1357 | [0] = { |
1335 | .start = AT91_BASE_SYS + AT91_DBGU, | 1358 | .start = AT91SAM9G45_BASE_DBGU, |
1336 | .end = AT91_BASE_SYS + AT91_DBGU + SZ_512 - 1, | 1359 | .end = AT91SAM9G45_BASE_DBGU + SZ_512 - 1, |
1337 | .flags = IORESOURCE_MEM, | 1360 | .flags = IORESOURCE_MEM, |
1338 | }, | 1361 | }, |
1339 | [1] = { | 1362 | [1] = { |