diff options
Diffstat (limited to 'arch/arm/mach-at91/at91sam9263_devices.c')
-rw-r--r-- | arch/arm/mach-at91/at91sam9263_devices.c | 72 |
1 files changed, 62 insertions, 10 deletions
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index 366a7765635..53688c46f95 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <mach/board.h> | 23 | #include <mach/board.h> |
24 | #include <mach/at91sam9263.h> | 24 | #include <mach/at91sam9263.h> |
25 | #include <mach/at91sam9263_matrix.h> | 25 | #include <mach/at91sam9263_matrix.h> |
26 | #include <mach/at91_matrix.h> | ||
26 | #include <mach/at91sam9_smc.h> | 27 | #include <mach/at91sam9_smc.h> |
27 | 28 | ||
28 | #include "generic.h" | 29 | #include "generic.h" |
@@ -409,7 +410,7 @@ void __init at91_add_device_cf(struct at91_cf_data *data) | |||
409 | * we assume SMC timings are configured by board code, | 410 | * we assume SMC timings are configured by board code, |
410 | * except True IDE where timings are controlled by driver | 411 | * except True IDE where timings are controlled by driver |
411 | */ | 412 | */ |
412 | ebi0_csa = at91_sys_read(AT91_MATRIX_EBI0CSA); | 413 | ebi0_csa = at91_matrix_read(AT91_MATRIX_EBI0CSA); |
413 | switch (data->chipselect) { | 414 | switch (data->chipselect) { |
414 | case 4: | 415 | case 4: |
415 | at91_set_A_periph(AT91_PIN_PD6, 0); /* EBI0_NCS4/CFCS0 */ | 416 | at91_set_A_periph(AT91_PIN_PD6, 0); /* EBI0_NCS4/CFCS0 */ |
@@ -428,7 +429,7 @@ void __init at91_add_device_cf(struct at91_cf_data *data) | |||
428 | data->chipselect); | 429 | data->chipselect); |
429 | return; | 430 | return; |
430 | } | 431 | } |
431 | at91_sys_write(AT91_MATRIX_EBI0CSA, ebi0_csa); | 432 | at91_matrix_write(AT91_MATRIX_EBI0CSA, ebi0_csa); |
432 | 433 | ||
433 | if (gpio_is_valid(data->det_pin)) { | 434 | if (gpio_is_valid(data->det_pin)) { |
434 | at91_set_gpio_input(data->det_pin, 1); | 435 | at91_set_gpio_input(data->det_pin, 1); |
@@ -496,8 +497,8 @@ void __init at91_add_device_nand(struct atmel_nand_data *data) | |||
496 | if (!data) | 497 | if (!data) |
497 | return; | 498 | return; |
498 | 499 | ||
499 | csa = at91_sys_read(AT91_MATRIX_EBI0CSA); | 500 | csa = at91_matrix_read(AT91_MATRIX_EBI0CSA); |
500 | at91_sys_write(AT91_MATRIX_EBI0CSA, csa | AT91_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA); | 501 | at91_matrix_write(AT91_MATRIX_EBI0CSA, csa | AT91_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA); |
501 | 502 | ||
502 | /* enable pin */ | 503 | /* enable pin */ |
503 | if (gpio_is_valid(data->enable_pin)) | 504 | if (gpio_is_valid(data->enable_pin)) |
@@ -891,7 +892,8 @@ static struct platform_device at91sam9263_isi_device = { | |||
891 | .num_resources = ARRAY_SIZE(isi_resources), | 892 | .num_resources = ARRAY_SIZE(isi_resources), |
892 | }; | 893 | }; |
893 | 894 | ||
894 | void __init at91_add_device_isi(void) | 895 | void __init at91_add_device_isi(struct isi_platform_data *data, |
896 | bool use_pck_as_mck) | ||
895 | { | 897 | { |
896 | at91_set_A_periph(AT91_PIN_PE0, 0); /* ISI_D0 */ | 898 | at91_set_A_periph(AT91_PIN_PE0, 0); /* ISI_D0 */ |
897 | at91_set_A_periph(AT91_PIN_PE1, 0); /* ISI_D1 */ | 899 | at91_set_A_periph(AT91_PIN_PE1, 0); /* ISI_D1 */ |
@@ -904,14 +906,20 @@ void __init at91_add_device_isi(void) | |||
904 | at91_set_A_periph(AT91_PIN_PE8, 0); /* ISI_PCK */ | 906 | at91_set_A_periph(AT91_PIN_PE8, 0); /* ISI_PCK */ |
905 | at91_set_A_periph(AT91_PIN_PE9, 0); /* ISI_HSYNC */ | 907 | at91_set_A_periph(AT91_PIN_PE9, 0); /* ISI_HSYNC */ |
906 | at91_set_A_periph(AT91_PIN_PE10, 0); /* ISI_VSYNC */ | 908 | at91_set_A_periph(AT91_PIN_PE10, 0); /* ISI_VSYNC */ |
907 | at91_set_B_periph(AT91_PIN_PE11, 0); /* ISI_MCK (PCK3) */ | ||
908 | at91_set_B_periph(AT91_PIN_PE12, 0); /* ISI_PD8 */ | 909 | at91_set_B_periph(AT91_PIN_PE12, 0); /* ISI_PD8 */ |
909 | at91_set_B_periph(AT91_PIN_PE13, 0); /* ISI_PD9 */ | 910 | at91_set_B_periph(AT91_PIN_PE13, 0); /* ISI_PD9 */ |
910 | at91_set_B_periph(AT91_PIN_PE14, 0); /* ISI_PD10 */ | 911 | at91_set_B_periph(AT91_PIN_PE14, 0); /* ISI_PD10 */ |
911 | at91_set_B_periph(AT91_PIN_PE15, 0); /* ISI_PD11 */ | 912 | at91_set_B_periph(AT91_PIN_PE15, 0); /* ISI_PD11 */ |
913 | |||
914 | if (use_pck_as_mck) { | ||
915 | at91_set_B_periph(AT91_PIN_PE11, 0); /* ISI_MCK (PCK3) */ | ||
916 | |||
917 | /* TODO: register the PCK for ISI_MCK and set its parent */ | ||
918 | } | ||
912 | } | 919 | } |
913 | #else | 920 | #else |
914 | void __init at91_add_device_isi(void) {} | 921 | void __init at91_add_device_isi(struct isi_platform_data *data, |
922 | bool use_pck_as_mck) {} | ||
915 | #endif | 923 | #endif |
916 | 924 | ||
917 | 925 | ||
@@ -959,6 +967,8 @@ static struct resource rtt0_resources[] = { | |||
959 | .start = AT91SAM9263_BASE_RTT0, | 967 | .start = AT91SAM9263_BASE_RTT0, |
960 | .end = AT91SAM9263_BASE_RTT0 + SZ_16 - 1, | 968 | .end = AT91SAM9263_BASE_RTT0 + SZ_16 - 1, |
961 | .flags = IORESOURCE_MEM, | 969 | .flags = IORESOURCE_MEM, |
970 | }, { | ||
971 | .flags = IORESOURCE_MEM, | ||
962 | } | 972 | } |
963 | }; | 973 | }; |
964 | 974 | ||
@@ -966,7 +976,6 @@ static struct platform_device at91sam9263_rtt0_device = { | |||
966 | .name = "at91_rtt", | 976 | .name = "at91_rtt", |
967 | .id = 0, | 977 | .id = 0, |
968 | .resource = rtt0_resources, | 978 | .resource = rtt0_resources, |
969 | .num_resources = ARRAY_SIZE(rtt0_resources), | ||
970 | }; | 979 | }; |
971 | 980 | ||
972 | static struct resource rtt1_resources[] = { | 981 | static struct resource rtt1_resources[] = { |
@@ -974,6 +983,8 @@ static struct resource rtt1_resources[] = { | |||
974 | .start = AT91SAM9263_BASE_RTT1, | 983 | .start = AT91SAM9263_BASE_RTT1, |
975 | .end = AT91SAM9263_BASE_RTT1 + SZ_16 - 1, | 984 | .end = AT91SAM9263_BASE_RTT1 + SZ_16 - 1, |
976 | .flags = IORESOURCE_MEM, | 985 | .flags = IORESOURCE_MEM, |
986 | }, { | ||
987 | .flags = IORESOURCE_MEM, | ||
977 | } | 988 | } |
978 | }; | 989 | }; |
979 | 990 | ||
@@ -981,11 +992,53 @@ static struct platform_device at91sam9263_rtt1_device = { | |||
981 | .name = "at91_rtt", | 992 | .name = "at91_rtt", |
982 | .id = 1, | 993 | .id = 1, |
983 | .resource = rtt1_resources, | 994 | .resource = rtt1_resources, |
984 | .num_resources = ARRAY_SIZE(rtt1_resources), | ||
985 | }; | 995 | }; |
986 | 996 | ||
997 | #if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9) | ||
998 | static void __init at91_add_device_rtt_rtc(void) | ||
999 | { | ||
1000 | struct platform_device *pdev; | ||
1001 | struct resource *r; | ||
1002 | |||
1003 | switch (CONFIG_RTC_DRV_AT91SAM9_RTT) { | ||
1004 | case 0: | ||
1005 | /* | ||
1006 | * The second resource is needed only for the chosen RTT: | ||
1007 | * GPBR will serve as the storage for RTC time offset | ||
1008 | */ | ||
1009 | at91sam9263_rtt0_device.num_resources = 2; | ||
1010 | at91sam9263_rtt1_device.num_resources = 1; | ||
1011 | pdev = &at91sam9263_rtt0_device; | ||
1012 | r = rtt0_resources; | ||
1013 | break; | ||
1014 | case 1: | ||
1015 | at91sam9263_rtt0_device.num_resources = 1; | ||
1016 | at91sam9263_rtt1_device.num_resources = 2; | ||
1017 | pdev = &at91sam9263_rtt1_device; | ||
1018 | r = rtt1_resources; | ||
1019 | break; | ||
1020 | default: | ||
1021 | pr_err("at91sam9263: only supports 2 RTT (%d)\n", | ||
1022 | CONFIG_RTC_DRV_AT91SAM9_RTT); | ||
1023 | return; | ||
1024 | } | ||
1025 | |||
1026 | pdev->name = "rtc-at91sam9"; | ||
1027 | r[1].start = AT91SAM9263_BASE_GPBR + 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR; | ||
1028 | r[1].end = r[1].start + 3; | ||
1029 | } | ||
1030 | #else | ||
1031 | static void __init at91_add_device_rtt_rtc(void) | ||
1032 | { | ||
1033 | /* Only one resource is needed: RTT not used as RTC */ | ||
1034 | at91sam9263_rtt0_device.num_resources = 1; | ||
1035 | at91sam9263_rtt1_device.num_resources = 1; | ||
1036 | } | ||
1037 | #endif | ||
1038 | |||
987 | static void __init at91_add_device_rtt(void) | 1039 | static void __init at91_add_device_rtt(void) |
988 | { | 1040 | { |
1041 | at91_add_device_rtt_rtc(); | ||
989 | platform_device_register(&at91sam9263_rtt0_device); | 1042 | platform_device_register(&at91sam9263_rtt0_device); |
990 | platform_device_register(&at91sam9263_rtt1_device); | 1043 | platform_device_register(&at91sam9263_rtt1_device); |
991 | } | 1044 | } |
@@ -1371,7 +1424,6 @@ static inline void configure_usart2_pins(unsigned pins) | |||
1371 | } | 1424 | } |
1372 | 1425 | ||
1373 | static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ | 1426 | static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ |
1374 | struct platform_device *atmel_default_console_device; /* the serial console device */ | ||
1375 | 1427 | ||
1376 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) | 1428 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) |
1377 | { | 1429 | { |