diff options
Diffstat (limited to 'arch/arm/mach-at91/at91sam9260_devices.c')
-rw-r--r-- | arch/arm/mach-at91/at91sam9260_devices.c | 68 |
1 files changed, 53 insertions, 15 deletions
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c index 642ccb6d26b2..7e5651ee9f85 100644 --- a/arch/arm/mach-at91/at91sam9260_devices.c +++ b/arch/arm/mach-at91/at91sam9260_devices.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <mach/cpu.h> | 21 | #include <mach/cpu.h> |
22 | #include <mach/at91sam9260.h> | 22 | #include <mach/at91sam9260.h> |
23 | #include <mach/at91sam9260_matrix.h> | 23 | #include <mach/at91sam9260_matrix.h> |
24 | #include <mach/at91_matrix.h> | ||
24 | #include <mach/at91sam9_smc.h> | 25 | #include <mach/at91sam9_smc.h> |
25 | 26 | ||
26 | #include "generic.h" | 27 | #include "generic.h" |
@@ -84,7 +85,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) {} | |||
84 | * USB Device (Gadget) | 85 | * USB Device (Gadget) |
85 | * -------------------------------------------------------------------- */ | 86 | * -------------------------------------------------------------------- */ |
86 | 87 | ||
87 | #ifdef CONFIG_USB_AT91 | 88 | #if defined(CONFIG_USB_AT91) || defined(CONFIG_USB_AT91_MODULE) |
88 | static struct at91_udc_data udc_data; | 89 | static struct at91_udc_data udc_data; |
89 | 90 | ||
90 | static struct resource udc_resources[] = { | 91 | static struct resource udc_resources[] = { |
@@ -422,8 +423,8 @@ void __init at91_add_device_nand(struct atmel_nand_data *data) | |||
422 | if (!data) | 423 | if (!data) |
423 | return; | 424 | return; |
424 | 425 | ||
425 | csa = at91_sys_read(AT91_MATRIX_EBICSA); | 426 | csa = at91_matrix_read(AT91_MATRIX_EBICSA); |
426 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); | 427 | at91_matrix_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); |
427 | 428 | ||
428 | /* enable pin */ | 429 | /* enable pin */ |
429 | if (gpio_is_valid(data->enable_pin)) | 430 | if (gpio_is_valid(data->enable_pin)) |
@@ -641,7 +642,7 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) | |||
641 | static struct resource tcb0_resources[] = { | 642 | static struct resource tcb0_resources[] = { |
642 | [0] = { | 643 | [0] = { |
643 | .start = AT91SAM9260_BASE_TCB0, | 644 | .start = AT91SAM9260_BASE_TCB0, |
644 | .end = AT91SAM9260_BASE_TCB0 + SZ_16K - 1, | 645 | .end = AT91SAM9260_BASE_TCB0 + SZ_256 - 1, |
645 | .flags = IORESOURCE_MEM, | 646 | .flags = IORESOURCE_MEM, |
646 | }, | 647 | }, |
647 | [1] = { | 648 | [1] = { |
@@ -671,7 +672,7 @@ static struct platform_device at91sam9260_tcb0_device = { | |||
671 | static struct resource tcb1_resources[] = { | 672 | static struct resource tcb1_resources[] = { |
672 | [0] = { | 673 | [0] = { |
673 | .start = AT91SAM9260_BASE_TCB1, | 674 | .start = AT91SAM9260_BASE_TCB1, |
674 | .end = AT91SAM9260_BASE_TCB1 + SZ_16K - 1, | 675 | .end = AT91SAM9260_BASE_TCB1 + SZ_256 - 1, |
675 | .flags = IORESOURCE_MEM, | 676 | .flags = IORESOURCE_MEM, |
676 | }, | 677 | }, |
677 | [1] = { | 678 | [1] = { |
@@ -698,8 +699,25 @@ static struct platform_device at91sam9260_tcb1_device = { | |||
698 | .num_resources = ARRAY_SIZE(tcb1_resources), | 699 | .num_resources = ARRAY_SIZE(tcb1_resources), |
699 | }; | 700 | }; |
700 | 701 | ||
702 | #if defined(CONFIG_OF) | ||
703 | static struct of_device_id tcb_ids[] = { | ||
704 | { .compatible = "atmel,at91rm9200-tcb" }, | ||
705 | { /*sentinel*/ } | ||
706 | }; | ||
707 | #endif | ||
708 | |||
701 | static void __init at91_add_device_tc(void) | 709 | static void __init at91_add_device_tc(void) |
702 | { | 710 | { |
711 | #if defined(CONFIG_OF) | ||
712 | struct device_node *np; | ||
713 | |||
714 | np = of_find_matching_node(NULL, tcb_ids); | ||
715 | if (np) { | ||
716 | of_node_put(np); | ||
717 | return; | ||
718 | } | ||
719 | #endif | ||
720 | |||
703 | platform_device_register(&at91sam9260_tcb0_device); | 721 | platform_device_register(&at91sam9260_tcb0_device); |
704 | platform_device_register(&at91sam9260_tcb1_device); | 722 | platform_device_register(&at91sam9260_tcb1_device); |
705 | } | 723 | } |
@@ -717,18 +735,42 @@ static struct resource rtt_resources[] = { | |||
717 | .start = AT91SAM9260_BASE_RTT, | 735 | .start = AT91SAM9260_BASE_RTT, |
718 | .end = AT91SAM9260_BASE_RTT + SZ_16 - 1, | 736 | .end = AT91SAM9260_BASE_RTT + SZ_16 - 1, |
719 | .flags = IORESOURCE_MEM, | 737 | .flags = IORESOURCE_MEM, |
720 | } | 738 | }, { |
739 | .flags = IORESOURCE_MEM, | ||
740 | }, | ||
721 | }; | 741 | }; |
722 | 742 | ||
723 | static struct platform_device at91sam9260_rtt_device = { | 743 | static struct platform_device at91sam9260_rtt_device = { |
724 | .name = "at91_rtt", | 744 | .name = "at91_rtt", |
725 | .id = 0, | 745 | .id = 0, |
726 | .resource = rtt_resources, | 746 | .resource = rtt_resources, |
727 | .num_resources = ARRAY_SIZE(rtt_resources), | ||
728 | }; | 747 | }; |
729 | 748 | ||
749 | |||
750 | #if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9) | ||
751 | static void __init at91_add_device_rtt_rtc(void) | ||
752 | { | ||
753 | at91sam9260_rtt_device.name = "rtc-at91sam9"; | ||
754 | /* | ||
755 | * The second resource is needed: | ||
756 | * GPBR will serve as the storage for RTC time offset | ||
757 | */ | ||
758 | at91sam9260_rtt_device.num_resources = 2; | ||
759 | rtt_resources[1].start = AT91SAM9260_BASE_GPBR + | ||
760 | 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR; | ||
761 | rtt_resources[1].end = rtt_resources[1].start + 3; | ||
762 | } | ||
763 | #else | ||
764 | static void __init at91_add_device_rtt_rtc(void) | ||
765 | { | ||
766 | /* Only one resource is needed: RTT not used as RTC */ | ||
767 | at91sam9260_rtt_device.num_resources = 1; | ||
768 | } | ||
769 | #endif | ||
770 | |||
730 | static void __init at91_add_device_rtt(void) | 771 | static void __init at91_add_device_rtt(void) |
731 | { | 772 | { |
773 | at91_add_device_rtt_rtc(); | ||
732 | platform_device_register(&at91sam9260_rtt_device); | 774 | platform_device_register(&at91sam9260_rtt_device); |
733 | } | 775 | } |
734 | 776 | ||
@@ -1139,7 +1181,6 @@ static inline void configure_usart5_pins(void) | |||
1139 | } | 1181 | } |
1140 | 1182 | ||
1141 | static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ | 1183 | static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ |
1142 | struct platform_device *atmel_default_console_device; /* the serial console device */ | ||
1143 | 1184 | ||
1144 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) | 1185 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) |
1145 | { | 1186 | { |
@@ -1215,8 +1256,7 @@ void __init at91_add_device_serial(void) {} | |||
1215 | * CF/IDE | 1256 | * CF/IDE |
1216 | * -------------------------------------------------------------------- */ | 1257 | * -------------------------------------------------------------------- */ |
1217 | 1258 | ||
1218 | #if defined(CONFIG_BLK_DEV_IDE_AT91) || defined(CONFIG_BLK_DEV_IDE_AT91_MODULE) || \ | 1259 | #if defined(CONFIG_PATA_AT91) || defined(CONFIG_PATA_AT91_MODULE) || \ |
1219 | defined(CONFIG_PATA_AT91) || defined(CONFIG_PATA_AT91_MODULE) || \ | ||
1220 | defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE) | 1260 | defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE) |
1221 | 1261 | ||
1222 | static struct at91_cf_data cf0_data; | 1262 | static struct at91_cf_data cf0_data; |
@@ -1265,7 +1305,7 @@ void __init at91_add_device_cf(struct at91_cf_data *data) | |||
1265 | if (!data) | 1305 | if (!data) |
1266 | return; | 1306 | return; |
1267 | 1307 | ||
1268 | csa = at91_sys_read(AT91_MATRIX_EBICSA); | 1308 | csa = at91_matrix_read(AT91_MATRIX_EBICSA); |
1269 | 1309 | ||
1270 | switch (data->chipselect) { | 1310 | switch (data->chipselect) { |
1271 | case 4: | 1311 | case 4: |
@@ -1288,7 +1328,7 @@ void __init at91_add_device_cf(struct at91_cf_data *data) | |||
1288 | return; | 1328 | return; |
1289 | } | 1329 | } |
1290 | 1330 | ||
1291 | at91_sys_write(AT91_MATRIX_EBICSA, csa); | 1331 | at91_matrix_write(AT91_MATRIX_EBICSA, csa); |
1292 | 1332 | ||
1293 | if (gpio_is_valid(data->rst_pin)) { | 1333 | if (gpio_is_valid(data->rst_pin)) { |
1294 | at91_set_multi_drive(data->rst_pin, 0); | 1334 | at91_set_multi_drive(data->rst_pin, 0); |
@@ -1313,10 +1353,8 @@ void __init at91_add_device_cf(struct at91_cf_data *data) | |||
1313 | if (data->flags & AT91_CF_TRUE_IDE) | 1353 | if (data->flags & AT91_CF_TRUE_IDE) |
1314 | #if defined(CONFIG_PATA_AT91) || defined(CONFIG_PATA_AT91_MODULE) | 1354 | #if defined(CONFIG_PATA_AT91) || defined(CONFIG_PATA_AT91_MODULE) |
1315 | pdev->name = "pata_at91"; | 1355 | pdev->name = "pata_at91"; |
1316 | #elif defined(CONFIG_BLK_DEV_IDE_AT91) || defined(CONFIG_BLK_DEV_IDE_AT91_MODULE) | ||
1317 | pdev->name = "at91_ide"; | ||
1318 | #else | 1356 | #else |
1319 | #warning "board requires AT91_CF_TRUE_IDE: enable either at91_ide or pata_at91" | 1357 | #warning "board requires AT91_CF_TRUE_IDE: enable pata_at91" |
1320 | #endif | 1358 | #endif |
1321 | else | 1359 | else |
1322 | pdev->name = "at91_cf"; | 1360 | pdev->name = "at91_cf"; |