diff options
Diffstat (limited to 'arch/arm/mach-at91/at91sam9260_devices.c')
-rw-r--r-- | arch/arm/mach-at91/at91sam9260_devices.c | 98 |
1 files changed, 13 insertions, 85 deletions
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c index 7b9c2ba396ed..a76b8684f52d 100644 --- a/arch/arm/mach-at91/at91sam9260_devices.c +++ b/arch/arm/mach-at91/at91sam9260_devices.c | |||
@@ -209,92 +209,10 @@ void __init at91_add_device_eth(struct macb_platform_data *data) {} | |||
209 | 209 | ||
210 | 210 | ||
211 | /* -------------------------------------------------------------------- | 211 | /* -------------------------------------------------------------------- |
212 | * MMC / SD | ||
213 | * -------------------------------------------------------------------- */ | ||
214 | |||
215 | #if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) | ||
216 | static u64 mmc_dmamask = DMA_BIT_MASK(32); | ||
217 | static struct at91_mmc_data mmc_data; | ||
218 | |||
219 | static struct resource mmc_resources[] = { | ||
220 | [0] = { | ||
221 | .start = AT91SAM9260_BASE_MCI, | ||
222 | .end = AT91SAM9260_BASE_MCI + SZ_16K - 1, | ||
223 | .flags = IORESOURCE_MEM, | ||
224 | }, | ||
225 | [1] = { | ||
226 | .start = NR_IRQS_LEGACY + AT91SAM9260_ID_MCI, | ||
227 | .end = NR_IRQS_LEGACY + AT91SAM9260_ID_MCI, | ||
228 | .flags = IORESOURCE_IRQ, | ||
229 | }, | ||
230 | }; | ||
231 | |||
232 | static struct platform_device at91sam9260_mmc_device = { | ||
233 | .name = "at91_mci", | ||
234 | .id = -1, | ||
235 | .dev = { | ||
236 | .dma_mask = &mmc_dmamask, | ||
237 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
238 | .platform_data = &mmc_data, | ||
239 | }, | ||
240 | .resource = mmc_resources, | ||
241 | .num_resources = ARRAY_SIZE(mmc_resources), | ||
242 | }; | ||
243 | |||
244 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) | ||
245 | { | ||
246 | if (!data) | ||
247 | return; | ||
248 | |||
249 | /* input/irq */ | ||
250 | if (gpio_is_valid(data->det_pin)) { | ||
251 | at91_set_gpio_input(data->det_pin, 1); | ||
252 | at91_set_deglitch(data->det_pin, 1); | ||
253 | } | ||
254 | if (gpio_is_valid(data->wp_pin)) | ||
255 | at91_set_gpio_input(data->wp_pin, 1); | ||
256 | if (gpio_is_valid(data->vcc_pin)) | ||
257 | at91_set_gpio_output(data->vcc_pin, 0); | ||
258 | |||
259 | /* CLK */ | ||
260 | at91_set_A_periph(AT91_PIN_PA8, 0); | ||
261 | |||
262 | if (data->slot_b) { | ||
263 | /* CMD */ | ||
264 | at91_set_B_periph(AT91_PIN_PA1, 1); | ||
265 | |||
266 | /* DAT0, maybe DAT1..DAT3 */ | ||
267 | at91_set_B_periph(AT91_PIN_PA0, 1); | ||
268 | if (data->wire4) { | ||
269 | at91_set_B_periph(AT91_PIN_PA5, 1); | ||
270 | at91_set_B_periph(AT91_PIN_PA4, 1); | ||
271 | at91_set_B_periph(AT91_PIN_PA3, 1); | ||
272 | } | ||
273 | } else { | ||
274 | /* CMD */ | ||
275 | at91_set_A_periph(AT91_PIN_PA7, 1); | ||
276 | |||
277 | /* DAT0, maybe DAT1..DAT3 */ | ||
278 | at91_set_A_periph(AT91_PIN_PA6, 1); | ||
279 | if (data->wire4) { | ||
280 | at91_set_A_periph(AT91_PIN_PA9, 1); | ||
281 | at91_set_A_periph(AT91_PIN_PA10, 1); | ||
282 | at91_set_A_periph(AT91_PIN_PA11, 1); | ||
283 | } | ||
284 | } | ||
285 | |||
286 | mmc_data = *data; | ||
287 | platform_device_register(&at91sam9260_mmc_device); | ||
288 | } | ||
289 | #else | ||
290 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} | ||
291 | #endif | ||
292 | |||
293 | /* -------------------------------------------------------------------- | ||
294 | * MMC / SD Slot for Atmel MCI Driver | 212 | * MMC / SD Slot for Atmel MCI Driver |
295 | * -------------------------------------------------------------------- */ | 213 | * -------------------------------------------------------------------- */ |
296 | 214 | ||
297 | #if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE) | 215 | #if IS_ENABLED(CONFIG_MMC_ATMELMCI) |
298 | static u64 mmc_dmamask = DMA_BIT_MASK(32); | 216 | static u64 mmc_dmamask = DMA_BIT_MASK(32); |
299 | static struct mci_platform_data mmc_data; | 217 | static struct mci_platform_data mmc_data; |
300 | 218 | ||
@@ -503,7 +421,6 @@ static struct resource twi_resources[] = { | |||
503 | }; | 421 | }; |
504 | 422 | ||
505 | static struct platform_device at91sam9260_twi_device = { | 423 | static struct platform_device at91sam9260_twi_device = { |
506 | .name = "at91_i2c", | ||
507 | .id = -1, | 424 | .id = -1, |
508 | .resource = twi_resources, | 425 | .resource = twi_resources, |
509 | .num_resources = ARRAY_SIZE(twi_resources), | 426 | .num_resources = ARRAY_SIZE(twi_resources), |
@@ -511,6 +428,13 @@ static struct platform_device at91sam9260_twi_device = { | |||
511 | 428 | ||
512 | void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) | 429 | void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) |
513 | { | 430 | { |
431 | /* IP version is not the same on 9260 and g20 */ | ||
432 | if (cpu_is_at91sam9g20()) { | ||
433 | at91sam9260_twi_device.name = "i2c-at91sam9g20"; | ||
434 | } else { | ||
435 | at91sam9260_twi_device.name = "i2c-at91sam9260"; | ||
436 | } | ||
437 | |||
514 | /* pins used for TWI interface */ | 438 | /* pins used for TWI interface */ |
515 | at91_set_A_periph(AT91_PIN_PA23, 0); /* TWD */ | 439 | at91_set_A_periph(AT91_PIN_PA23, 0); /* TWD */ |
516 | at91_set_multi_drive(AT91_PIN_PA23, 1); | 440 | at91_set_multi_drive(AT91_PIN_PA23, 1); |
@@ -726,6 +650,8 @@ static struct resource rtt_resources[] = { | |||
726 | .flags = IORESOURCE_MEM, | 650 | .flags = IORESOURCE_MEM, |
727 | }, { | 651 | }, { |
728 | .flags = IORESOURCE_MEM, | 652 | .flags = IORESOURCE_MEM, |
653 | }, { | ||
654 | .flags = IORESOURCE_IRQ, | ||
729 | }, | 655 | }, |
730 | }; | 656 | }; |
731 | 657 | ||
@@ -744,10 +670,12 @@ static void __init at91_add_device_rtt_rtc(void) | |||
744 | * The second resource is needed: | 670 | * The second resource is needed: |
745 | * GPBR will serve as the storage for RTC time offset | 671 | * GPBR will serve as the storage for RTC time offset |
746 | */ | 672 | */ |
747 | at91sam9260_rtt_device.num_resources = 2; | 673 | at91sam9260_rtt_device.num_resources = 3; |
748 | rtt_resources[1].start = AT91SAM9260_BASE_GPBR + | 674 | rtt_resources[1].start = AT91SAM9260_BASE_GPBR + |
749 | 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR; | 675 | 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR; |
750 | rtt_resources[1].end = rtt_resources[1].start + 3; | 676 | rtt_resources[1].end = rtt_resources[1].start + 3; |
677 | rtt_resources[2].start = NR_IRQS_LEGACY + AT91_ID_SYS; | ||
678 | rtt_resources[2].end = NR_IRQS_LEGACY + AT91_ID_SYS; | ||
751 | } | 679 | } |
752 | #else | 680 | #else |
753 | static void __init at91_add_device_rtt_rtc(void) | 681 | static void __init at91_add_device_rtt_rtc(void) |