diff options
author | Nicolas Ferre <nicolas.ferre@atmel.com> | 2014-09-15 12:15:55 -0400 |
---|---|---|
committer | Nicolas Ferre <nicolas.ferre@atmel.com> | 2014-09-22 05:39:06 -0400 |
commit | 726d32bf79ef4042004535c9af9c8ea543abe46f (patch) | |
tree | ca28c5477eb81a6b595f5574c7789c7fddee9cce | |
parent | 2dc850b62e5b727a5413b60197cdddf92ab4f1a2 (diff) |
ARM: at91: SAMA5D4 SoC detection code and low level routines
SoC identification code, kernel uncompress and low level
debugging routines update.
On SAMA5D4, DBGU is at another address AT91_BASE_DBGU2 so another
round of detection is needed. We also had to differentiate with
SAMA5D3 SoC family and rename some variables.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
-rw-r--r-- | arch/arm/mach-at91/board-dt-sama5.c | 16 | ||||
-rw-r--r-- | arch/arm/mach-at91/generic.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/cpu.h | 13 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/debug-macro.S | 5 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/hardware.h | 19 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/uncompress.h | 21 | ||||
-rw-r--r-- | arch/arm/mach-at91/sama5d4.c | 28 | ||||
-rw-r--r-- | arch/arm/mach-at91/setup.c | 97 |
8 files changed, 188 insertions, 12 deletions
diff --git a/arch/arm/mach-at91/board-dt-sama5.c b/arch/arm/mach-at91/board-dt-sama5.c index 075ec0576ada..514956336025 100644 --- a/arch/arm/mach-at91/board-dt-sama5.c +++ b/arch/arm/mach-at91/board-dt-sama5.c | |||
@@ -73,7 +73,7 @@ static void __init sama5_dt_device_init(void) | |||
73 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | 73 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
74 | } | 74 | } |
75 | 75 | ||
76 | static const char *sama5_dt_board_compat[] __initdata = { | 76 | static const char *sama5_dt_board_compat[] __initconst = { |
77 | "atmel,sama5", | 77 | "atmel,sama5", |
78 | NULL | 78 | NULL |
79 | }; | 79 | }; |
@@ -88,3 +88,17 @@ DT_MACHINE_START(sama5_dt, "Atmel SAMA5 (Device Tree)") | |||
88 | .init_machine = sama5_dt_device_init, | 88 | .init_machine = sama5_dt_device_init, |
89 | .dt_compat = sama5_dt_board_compat, | 89 | .dt_compat = sama5_dt_board_compat, |
90 | MACHINE_END | 90 | MACHINE_END |
91 | |||
92 | static const char *sama5_alt_dt_board_compat[] __initconst = { | ||
93 | "atmel,sama5d4", | ||
94 | NULL | ||
95 | }; | ||
96 | |||
97 | DT_MACHINE_START(sama5_alt_dt, "Atmel SAMA5 (Device Tree)") | ||
98 | /* Maintainer: Atmel */ | ||
99 | .map_io = at91_alt_map_io, | ||
100 | .init_early = at91_dt_initialize, | ||
101 | .init_machine = sama5_dt_device_init, | ||
102 | .dt_compat = sama5_alt_dt_board_compat, | ||
103 | .l2c_aux_mask = ~0UL, | ||
104 | MACHINE_END | ||
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h index 631fa3b8c16d..cddf1e51c50e 100644 --- a/arch/arm/mach-at91/generic.h +++ b/arch/arm/mach-at91/generic.h | |||
@@ -14,6 +14,7 @@ | |||
14 | 14 | ||
15 | /* Map io */ | 15 | /* Map io */ |
16 | extern void __init at91_map_io(void); | 16 | extern void __init at91_map_io(void); |
17 | extern void __init at91_alt_map_io(void); | ||
17 | extern void __init at91_init_sram(int bank, unsigned long base, | 18 | extern void __init at91_init_sram(int bank, unsigned long base, |
18 | unsigned int length); | 19 | unsigned int length); |
19 | 20 | ||
diff --git a/arch/arm/mach-at91/include/mach/cpu.h b/arch/arm/mach-at91/include/mach/cpu.h index d77572e8cb15..b27e9ca65653 100644 --- a/arch/arm/mach-at91/include/mach/cpu.h +++ b/arch/arm/mach-at91/include/mach/cpu.h | |||
@@ -36,7 +36,7 @@ | |||
36 | #define ARCH_ID_AT91M40807 0x14080745 | 36 | #define ARCH_ID_AT91M40807 0x14080745 |
37 | #define ARCH_ID_AT91R40008 0x44000840 | 37 | #define ARCH_ID_AT91R40008 0x44000840 |
38 | 38 | ||
39 | #define ARCH_ID_SAMA5D3 0x8A5C07C0 | 39 | #define ARCH_ID_SAMA5 0x8A5C07C0 |
40 | 40 | ||
41 | #define ARCH_EXID_AT91SAM9M11 0x00000001 | 41 | #define ARCH_EXID_AT91SAM9M11 0x00000001 |
42 | #define ARCH_EXID_AT91SAM9M10 0x00000002 | 42 | #define ARCH_EXID_AT91SAM9M10 0x00000002 |
@@ -49,12 +49,19 @@ | |||
49 | #define ARCH_EXID_AT91SAM9G25 0x00000003 | 49 | #define ARCH_EXID_AT91SAM9G25 0x00000003 |
50 | #define ARCH_EXID_AT91SAM9X25 0x00000004 | 50 | #define ARCH_EXID_AT91SAM9X25 0x00000004 |
51 | 51 | ||
52 | #define ARCH_EXID_SAMA5D3 0x00004300 | ||
52 | #define ARCH_EXID_SAMA5D31 0x00444300 | 53 | #define ARCH_EXID_SAMA5D31 0x00444300 |
53 | #define ARCH_EXID_SAMA5D33 0x00414300 | 54 | #define ARCH_EXID_SAMA5D33 0x00414300 |
54 | #define ARCH_EXID_SAMA5D34 0x00414301 | 55 | #define ARCH_EXID_SAMA5D34 0x00414301 |
55 | #define ARCH_EXID_SAMA5D35 0x00584300 | 56 | #define ARCH_EXID_SAMA5D35 0x00584300 |
56 | #define ARCH_EXID_SAMA5D36 0x00004301 | 57 | #define ARCH_EXID_SAMA5D36 0x00004301 |
57 | 58 | ||
59 | #define ARCH_EXID_SAMA5D4 0x00000007 | ||
60 | #define ARCH_EXID_SAMA5D41 0x00000001 | ||
61 | #define ARCH_EXID_SAMA5D42 0x00000002 | ||
62 | #define ARCH_EXID_SAMA5D43 0x00000003 | ||
63 | #define ARCH_EXID_SAMA5D44 0x00000004 | ||
64 | |||
58 | #define ARCH_FAMILY_AT91X92 0x09200000 | 65 | #define ARCH_FAMILY_AT91X92 0x09200000 |
59 | #define ARCH_FAMILY_AT91SAM9 0x01900000 | 66 | #define ARCH_FAMILY_AT91SAM9 0x01900000 |
60 | #define ARCH_FAMILY_AT91SAM9XE 0x02900000 | 67 | #define ARCH_FAMILY_AT91SAM9XE 0x02900000 |
@@ -111,6 +118,10 @@ enum at91_soc_subtype { | |||
111 | AT91_SOC_SAMA5D31, AT91_SOC_SAMA5D33, AT91_SOC_SAMA5D34, | 118 | AT91_SOC_SAMA5D31, AT91_SOC_SAMA5D33, AT91_SOC_SAMA5D34, |
112 | AT91_SOC_SAMA5D35, AT91_SOC_SAMA5D36, | 119 | AT91_SOC_SAMA5D35, AT91_SOC_SAMA5D36, |
113 | 120 | ||
121 | /* SAMA5D4 */ | ||
122 | AT91_SOC_SAMA5D41, AT91_SOC_SAMA5D42, AT91_SOC_SAMA5D43, | ||
123 | AT91_SOC_SAMA5D44, | ||
124 | |||
114 | /* No subtype for this SoC */ | 125 | /* No subtype for this SoC */ |
115 | AT91_SOC_SUBTYPE_NONE, | 126 | AT91_SOC_SUBTYPE_NONE, |
116 | 127 | ||
diff --git a/arch/arm/mach-at91/include/mach/debug-macro.S b/arch/arm/mach-at91/include/mach/debug-macro.S index c6bb9e2d9baa..2103a90f2261 100644 --- a/arch/arm/mach-at91/include/mach/debug-macro.S +++ b/arch/arm/mach-at91/include/mach/debug-macro.S | |||
@@ -16,8 +16,11 @@ | |||
16 | 16 | ||
17 | #if defined(CONFIG_AT91_DEBUG_LL_DBGU0) | 17 | #if defined(CONFIG_AT91_DEBUG_LL_DBGU0) |
18 | #define AT91_DBGU AT91_BASE_DBGU0 | 18 | #define AT91_DBGU AT91_BASE_DBGU0 |
19 | #else | 19 | #elif defined(CONFIG_AT91_DEBUG_LL_DBGU1) |
20 | #define AT91_DBGU AT91_BASE_DBGU1 | 20 | #define AT91_DBGU AT91_BASE_DBGU1 |
21 | #else | ||
22 | /* On sama5d4, use USART3 as low level serial console */ | ||
23 | #define AT91_DBGU SAMA5D4_BASE_USART3 | ||
21 | #endif | 24 | #endif |
22 | 25 | ||
23 | .macro addruart, rp, rv, tmp | 26 | .macro addruart, rp, rv, tmp |
diff --git a/arch/arm/mach-at91/include/mach/hardware.h b/arch/arm/mach-at91/include/mach/hardware.h index 56338245653a..d84776f6b8ac 100644 --- a/arch/arm/mach-at91/include/mach/hardware.h +++ b/arch/arm/mach-at91/include/mach/hardware.h | |||
@@ -19,8 +19,10 @@ | |||
19 | /* DBGU base */ | 19 | /* DBGU base */ |
20 | /* rm9200, 9260/9g20, 9261/9g10, 9rl */ | 20 | /* rm9200, 9260/9g20, 9261/9g10, 9rl */ |
21 | #define AT91_BASE_DBGU0 0xfffff200 | 21 | #define AT91_BASE_DBGU0 0xfffff200 |
22 | /* 9263, 9g45 */ | 22 | /* 9263, 9g45, sama5d3 */ |
23 | #define AT91_BASE_DBGU1 0xffffee00 | 23 | #define AT91_BASE_DBGU1 0xffffee00 |
24 | /* sama5d4 */ | ||
25 | #define AT91_BASE_DBGU2 0xfc069000 | ||
24 | 26 | ||
25 | #if defined(CONFIG_ARCH_AT91X40) | 27 | #if defined(CONFIG_ARCH_AT91X40) |
26 | #include <mach/at91x40.h> | 28 | #include <mach/at91x40.h> |
@@ -34,6 +36,7 @@ | |||
34 | #include <mach/at91sam9x5.h> | 36 | #include <mach/at91sam9x5.h> |
35 | #include <mach/at91sam9n12.h> | 37 | #include <mach/at91sam9n12.h> |
36 | #include <mach/sama5d3.h> | 38 | #include <mach/sama5d3.h> |
39 | #include <mach/sama5d4.h> | ||
37 | 40 | ||
38 | /* | 41 | /* |
39 | * On all at91 except rm9200 and x40 have the System Controller starts | 42 | * On all at91 except rm9200 and x40 have the System Controller starts |
@@ -47,6 +50,11 @@ | |||
47 | * and map the same memory space | 50 | * and map the same memory space |
48 | */ | 51 | */ |
49 | #define AT91_BASE_SYS 0xffffc000 | 52 | #define AT91_BASE_SYS 0xffffc000 |
53 | |||
54 | /* | ||
55 | * On sama5d4 there is no system controller, we map some needed peripherals | ||
56 | */ | ||
57 | #define AT91_ALT_BASE_SYS 0xfc069000 | ||
50 | #endif | 58 | #endif |
51 | 59 | ||
52 | /* | 60 | /* |
@@ -69,6 +77,13 @@ | |||
69 | */ | 77 | */ |
70 | #define AT91_IO_PHYS_BASE 0xFFF78000 | 78 | #define AT91_IO_PHYS_BASE 0xFFF78000 |
71 | #define AT91_IO_VIRT_BASE IOMEM(0xFF000000 - AT91_IO_SIZE) | 79 | #define AT91_IO_VIRT_BASE IOMEM(0xFF000000 - AT91_IO_SIZE) |
80 | |||
81 | /* | ||
82 | * On sama5d4, remap the peripherals from address 0xFC069000 .. 0xFC06F000 | ||
83 | * to 0xFB069000 .. 0xFB06F000. (24Kb) | ||
84 | */ | ||
85 | #define AT91_ALT_IO_PHYS_BASE AT91_ALT_BASE_SYS | ||
86 | #define AT91_ALT_IO_VIRT_BASE IOMEM(0xFB069000) | ||
72 | #else | 87 | #else |
73 | /* | 88 | /* |
74 | * Identity mapping for the non MMU case. | 89 | * Identity mapping for the non MMU case. |
@@ -81,11 +96,13 @@ | |||
81 | 96 | ||
82 | /* Convert a physical IO address to virtual IO address */ | 97 | /* Convert a physical IO address to virtual IO address */ |
83 | #define AT91_IO_P2V(x) ((x) - AT91_IO_PHYS_BASE + AT91_IO_VIRT_BASE) | 98 | #define AT91_IO_P2V(x) ((x) - AT91_IO_PHYS_BASE + AT91_IO_VIRT_BASE) |
99 | #define AT91_ALT_IO_P2V(x) ((x) - AT91_ALT_IO_PHYS_BASE + AT91_ALT_IO_VIRT_BASE) | ||
84 | 100 | ||
85 | /* | 101 | /* |
86 | * Virtual to Physical Address mapping for IO devices. | 102 | * Virtual to Physical Address mapping for IO devices. |
87 | */ | 103 | */ |
88 | #define AT91_VA_BASE_SYS AT91_IO_P2V(AT91_BASE_SYS) | 104 | #define AT91_VA_BASE_SYS AT91_IO_P2V(AT91_BASE_SYS) |
105 | #define AT91_ALT_VA_BASE_SYS AT91_ALT_IO_P2V(AT91_ALT_BASE_SYS) | ||
89 | 106 | ||
90 | /* Internal SRAM is mapped below the IO devices */ | 107 | /* Internal SRAM is mapped below the IO devices */ |
91 | #define AT91_SRAM_MAX SZ_1M | 108 | #define AT91_SRAM_MAX SZ_1M |
diff --git a/arch/arm/mach-at91/include/mach/uncompress.h b/arch/arm/mach-at91/include/mach/uncompress.h index 4bb644f8e87c..acb2d890ad7e 100644 --- a/arch/arm/mach-at91/include/mach/uncompress.h +++ b/arch/arm/mach-at91/include/mach/uncompress.h | |||
@@ -94,7 +94,7 @@ static const u32 uarts_sam9x5[] = { | |||
94 | 0, | 94 | 0, |
95 | }; | 95 | }; |
96 | 96 | ||
97 | static const u32 uarts_sama5[] = { | 97 | static const u32 uarts_sama5d3[] = { |
98 | AT91_BASE_DBGU1, | 98 | AT91_BASE_DBGU1, |
99 | SAMA5D3_BASE_USART0, | 99 | SAMA5D3_BASE_USART0, |
100 | SAMA5D3_BASE_USART1, | 100 | SAMA5D3_BASE_USART1, |
@@ -103,6 +103,12 @@ static const u32 uarts_sama5[] = { | |||
103 | 0, | 103 | 0, |
104 | }; | 104 | }; |
105 | 105 | ||
106 | static const u32 uarts_sama5d4[] = { | ||
107 | AT91_BASE_DBGU2, | ||
108 | SAMA5D4_BASE_USART3, | ||
109 | 0, | ||
110 | }; | ||
111 | |||
106 | static inline const u32* decomp_soc_detect(void __iomem *dbgu_base) | 112 | static inline const u32* decomp_soc_detect(void __iomem *dbgu_base) |
107 | { | 113 | { |
108 | u32 cidr, socid; | 114 | u32 cidr, socid; |
@@ -134,8 +140,14 @@ static inline const u32* decomp_soc_detect(void __iomem *dbgu_base) | |||
134 | case ARCH_ID_AT91SAM9X5: | 140 | case ARCH_ID_AT91SAM9X5: |
135 | return uarts_sam9x5; | 141 | return uarts_sam9x5; |
136 | 142 | ||
137 | case ARCH_ID_SAMA5D3: | 143 | case ARCH_ID_SAMA5: |
138 | return uarts_sama5; | 144 | cidr = __raw_readl(dbgu_base + AT91_DBGU_EXID); |
145 | if (cidr & ARCH_EXID_SAMA5D3) | ||
146 | return uarts_sama5d3; | ||
147 | else if (cidr & ARCH_EXID_SAMA5D4) | ||
148 | return uarts_sama5d4; | ||
149 | |||
150 | break; | ||
139 | } | 151 | } |
140 | 152 | ||
141 | /* at91sam9g10 */ | 153 | /* at91sam9g10 */ |
@@ -156,9 +168,10 @@ static inline void arch_decomp_setup(void) | |||
156 | const u32* usarts; | 168 | const u32* usarts; |
157 | 169 | ||
158 | usarts = decomp_soc_detect((void __iomem *)AT91_BASE_DBGU0); | 170 | usarts = decomp_soc_detect((void __iomem *)AT91_BASE_DBGU0); |
159 | |||
160 | if (!usarts) | 171 | if (!usarts) |
161 | usarts = decomp_soc_detect((void __iomem *)AT91_BASE_DBGU1); | 172 | usarts = decomp_soc_detect((void __iomem *)AT91_BASE_DBGU1); |
173 | if (!usarts) | ||
174 | usarts = decomp_soc_detect((void __iomem *)AT91_BASE_DBGU2); | ||
162 | if (!usarts) { | 175 | if (!usarts) { |
163 | at91_uart = NULL; | 176 | at91_uart = NULL; |
164 | return; | 177 | return; |
diff --git a/arch/arm/mach-at91/sama5d4.c b/arch/arm/mach-at91/sama5d4.c index f81f11ed8deb..7638509639f4 100644 --- a/arch/arm/mach-at91/sama5d4.c +++ b/arch/arm/mach-at91/sama5d4.c | |||
@@ -25,9 +25,37 @@ | |||
25 | /* -------------------------------------------------------------------- | 25 | /* -------------------------------------------------------------------- |
26 | * Processor initialization | 26 | * Processor initialization |
27 | * -------------------------------------------------------------------- */ | 27 | * -------------------------------------------------------------------- */ |
28 | static struct map_desc at91_io_desc[] __initdata = { | ||
29 | { | ||
30 | .virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_MPDDRC), | ||
31 | .pfn = __phys_to_pfn(SAMA5D4_BASE_MPDDRC), | ||
32 | .length = SZ_512, | ||
33 | .type = MT_DEVICE, | ||
34 | }, | ||
35 | { | ||
36 | .virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_PMC), | ||
37 | .pfn = __phys_to_pfn(SAMA5D4_BASE_PMC), | ||
38 | .length = SZ_512, | ||
39 | .type = MT_DEVICE, | ||
40 | }, | ||
41 | { /* On sama5d4, we use USART3 as serial console */ | ||
42 | .virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_USART3), | ||
43 | .pfn = __phys_to_pfn(SAMA5D4_BASE_USART3), | ||
44 | .length = SZ_256, | ||
45 | .type = MT_DEVICE, | ||
46 | }, | ||
47 | { /* A bunch of peripheral with fine grained IO space */ | ||
48 | .virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_SYS2), | ||
49 | .pfn = __phys_to_pfn(SAMA5D4_BASE_SYS2), | ||
50 | .length = SZ_2K, | ||
51 | .type = MT_DEVICE, | ||
52 | }, | ||
53 | }; | ||
54 | |||
28 | 55 | ||
29 | static void __init sama5d4_map_io(void) | 56 | static void __init sama5d4_map_io(void) |
30 | { | 57 | { |
58 | iotable_init(at91_io_desc, ARRAY_SIZE(at91_io_desc)); | ||
31 | at91_init_sram(0, SAMA5D4_NS_SRAM_BASE, SAMA5D4_NS_SRAM_SIZE); | 59 | at91_init_sram(0, SAMA5D4_NS_SRAM_BASE, SAMA5D4_NS_SRAM_SIZE); |
32 | } | 60 | } |
33 | 61 | ||
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c index f7a07a58ebb6..535a6e70f4ef 100644 --- a/arch/arm/mach-at91/setup.c +++ b/arch/arm/mach-at91/setup.c | |||
@@ -96,6 +96,13 @@ static struct map_desc at91_io_desc __initdata __maybe_unused = { | |||
96 | .type = MT_DEVICE, | 96 | .type = MT_DEVICE, |
97 | }; | 97 | }; |
98 | 98 | ||
99 | static struct map_desc at91_alt_io_desc __initdata __maybe_unused = { | ||
100 | .virtual = (unsigned long)AT91_ALT_VA_BASE_SYS, | ||
101 | .pfn = __phys_to_pfn(AT91_ALT_BASE_SYS), | ||
102 | .length = 24 * SZ_1K, | ||
103 | .type = MT_DEVICE, | ||
104 | }; | ||
105 | |||
99 | static void __init soc_detect(u32 dbgu_base) | 106 | static void __init soc_detect(u32 dbgu_base) |
100 | { | 107 | { |
101 | u32 cidr, socid; | 108 | u32 cidr, socid; |
@@ -158,9 +165,12 @@ static void __init soc_detect(u32 dbgu_base) | |||
158 | at91_boot_soc = at91sam9n12_soc; | 165 | at91_boot_soc = at91sam9n12_soc; |
159 | break; | 166 | break; |
160 | 167 | ||
161 | case ARCH_ID_SAMA5D3: | 168 | case ARCH_ID_SAMA5: |
162 | at91_soc_initdata.type = AT91_SOC_SAMA5D3; | 169 | at91_soc_initdata.exid = __raw_readl(AT91_IO_P2V(dbgu_base) + AT91_DBGU_EXID); |
163 | at91_boot_soc = sama5d3_soc; | 170 | if (at91_soc_initdata.exid & ARCH_EXID_SAMA5D3) { |
171 | at91_soc_initdata.type = AT91_SOC_SAMA5D3; | ||
172 | at91_boot_soc = sama5d3_soc; | ||
173 | } | ||
164 | break; | 174 | break; |
165 | } | 175 | } |
166 | 176 | ||
@@ -183,7 +193,8 @@ static void __init soc_detect(u32 dbgu_base) | |||
183 | at91_soc_initdata.cidr = cidr; | 193 | at91_soc_initdata.cidr = cidr; |
184 | 194 | ||
185 | /* sub version of soc */ | 195 | /* sub version of soc */ |
186 | at91_soc_initdata.exid = __raw_readl(AT91_IO_P2V(dbgu_base) + AT91_DBGU_EXID); | 196 | if (!at91_soc_initdata.exid) |
197 | at91_soc_initdata.exid = __raw_readl(AT91_IO_P2V(dbgu_base) + AT91_DBGU_EXID); | ||
187 | 198 | ||
188 | if (at91_soc_initdata.type == AT91_SOC_SAM9G45) { | 199 | if (at91_soc_initdata.type == AT91_SOC_SAM9G45) { |
189 | switch (at91_soc_initdata.exid) { | 200 | switch (at91_soc_initdata.exid) { |
@@ -240,6 +251,54 @@ static void __init soc_detect(u32 dbgu_base) | |||
240 | } | 251 | } |
241 | } | 252 | } |
242 | 253 | ||
254 | static void __init alt_soc_detect(u32 dbgu_base) | ||
255 | { | ||
256 | u32 cidr, socid; | ||
257 | |||
258 | /* SoC ID */ | ||
259 | cidr = __raw_readl(AT91_ALT_IO_P2V(dbgu_base) + AT91_DBGU_CIDR); | ||
260 | socid = cidr & ~AT91_CIDR_VERSION; | ||
261 | |||
262 | switch (socid) { | ||
263 | case ARCH_ID_SAMA5: | ||
264 | at91_soc_initdata.exid = __raw_readl(AT91_ALT_IO_P2V(dbgu_base) + AT91_DBGU_EXID); | ||
265 | if (at91_soc_initdata.exid & ARCH_EXID_SAMA5D3) { | ||
266 | at91_soc_initdata.type = AT91_SOC_SAMA5D3; | ||
267 | at91_boot_soc = sama5d3_soc; | ||
268 | } else if (at91_soc_initdata.exid & ARCH_EXID_SAMA5D4) { | ||
269 | at91_soc_initdata.type = AT91_SOC_SAMA5D4; | ||
270 | at91_boot_soc = sama5d4_soc; | ||
271 | } | ||
272 | break; | ||
273 | } | ||
274 | |||
275 | if (!at91_soc_is_detected()) | ||
276 | return; | ||
277 | |||
278 | at91_soc_initdata.cidr = cidr; | ||
279 | |||
280 | /* sub version of soc */ | ||
281 | if (!at91_soc_initdata.exid) | ||
282 | at91_soc_initdata.exid = __raw_readl(AT91_ALT_IO_P2V(dbgu_base) + AT91_DBGU_EXID); | ||
283 | |||
284 | if (at91_soc_initdata.type == AT91_SOC_SAMA5D4) { | ||
285 | switch (at91_soc_initdata.exid) { | ||
286 | case ARCH_EXID_SAMA5D41: | ||
287 | at91_soc_initdata.subtype = AT91_SOC_SAMA5D41; | ||
288 | break; | ||
289 | case ARCH_EXID_SAMA5D42: | ||
290 | at91_soc_initdata.subtype = AT91_SOC_SAMA5D42; | ||
291 | break; | ||
292 | case ARCH_EXID_SAMA5D43: | ||
293 | at91_soc_initdata.subtype = AT91_SOC_SAMA5D43; | ||
294 | break; | ||
295 | case ARCH_EXID_SAMA5D44: | ||
296 | at91_soc_initdata.subtype = AT91_SOC_SAMA5D44; | ||
297 | break; | ||
298 | } | ||
299 | } | ||
300 | } | ||
301 | |||
243 | static const char *soc_name[] = { | 302 | static const char *soc_name[] = { |
244 | [AT91_SOC_RM9200] = "at91rm9200", | 303 | [AT91_SOC_RM9200] = "at91rm9200", |
245 | [AT91_SOC_SAM9260] = "at91sam9260", | 304 | [AT91_SOC_SAM9260] = "at91sam9260", |
@@ -252,6 +311,7 @@ static const char *soc_name[] = { | |||
252 | [AT91_SOC_SAM9X5] = "at91sam9x5", | 311 | [AT91_SOC_SAM9X5] = "at91sam9x5", |
253 | [AT91_SOC_SAM9N12] = "at91sam9n12", | 312 | [AT91_SOC_SAM9N12] = "at91sam9n12", |
254 | [AT91_SOC_SAMA5D3] = "sama5d3", | 313 | [AT91_SOC_SAMA5D3] = "sama5d3", |
314 | [AT91_SOC_SAMA5D4] = "sama5d4", | ||
255 | [AT91_SOC_UNKNOWN] = "Unknown", | 315 | [AT91_SOC_UNKNOWN] = "Unknown", |
256 | }; | 316 | }; |
257 | 317 | ||
@@ -279,6 +339,10 @@ static const char *soc_subtype_name[] = { | |||
279 | [AT91_SOC_SAMA5D34] = "sama5d34", | 339 | [AT91_SOC_SAMA5D34] = "sama5d34", |
280 | [AT91_SOC_SAMA5D35] = "sama5d35", | 340 | [AT91_SOC_SAMA5D35] = "sama5d35", |
281 | [AT91_SOC_SAMA5D36] = "sama5d36", | 341 | [AT91_SOC_SAMA5D36] = "sama5d36", |
342 | [AT91_SOC_SAMA5D41] = "sama5d41", | ||
343 | [AT91_SOC_SAMA5D42] = "sama5d42", | ||
344 | [AT91_SOC_SAMA5D43] = "sama5d43", | ||
345 | [AT91_SOC_SAMA5D44] = "sama5d44", | ||
282 | [AT91_SOC_SUBTYPE_NONE] = "None", | 346 | [AT91_SOC_SUBTYPE_NONE] = "None", |
283 | [AT91_SOC_SUBTYPE_UNKNOWN] = "Unknown", | 347 | [AT91_SOC_SUBTYPE_UNKNOWN] = "Unknown", |
284 | }; | 348 | }; |
@@ -341,6 +405,31 @@ void __init at91_ioremap_rstc(u32 base_addr) | |||
341 | panic("Impossible to ioremap at91_rstc_base\n"); | 405 | panic("Impossible to ioremap at91_rstc_base\n"); |
342 | } | 406 | } |
343 | 407 | ||
408 | void __init at91_alt_map_io(void) | ||
409 | { | ||
410 | /* Map peripherals */ | ||
411 | iotable_init(&at91_alt_io_desc, 1); | ||
412 | |||
413 | at91_soc_initdata.type = AT91_SOC_UNKNOWN; | ||
414 | at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_UNKNOWN; | ||
415 | |||
416 | alt_soc_detect(AT91_BASE_DBGU2); | ||
417 | if (!at91_soc_is_detected()) | ||
418 | panic("AT91: Impossible to detect the SOC type"); | ||
419 | |||
420 | pr_info("AT91: Detected soc type: %s\n", | ||
421 | at91_get_soc_type(&at91_soc_initdata)); | ||
422 | if (at91_soc_initdata.subtype != AT91_SOC_SUBTYPE_NONE) | ||
423 | pr_info("AT91: Detected soc subtype: %s\n", | ||
424 | at91_get_soc_subtype(&at91_soc_initdata)); | ||
425 | |||
426 | if (!at91_soc_is_enabled()) | ||
427 | panic("AT91: Soc not enabled"); | ||
428 | |||
429 | if (at91_boot_soc.map_io) | ||
430 | at91_boot_soc.map_io(); | ||
431 | } | ||
432 | |||
344 | void __iomem *at91_matrix_base; | 433 | void __iomem *at91_matrix_base; |
345 | EXPORT_SYMBOL_GPL(at91_matrix_base); | 434 | EXPORT_SYMBOL_GPL(at91_matrix_base); |
346 | 435 | ||