diff options
author | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2015-01-27 11:38:46 -0500 |
---|---|---|
committer | Nicolas Ferre <nicolas.ferre@atmel.com> | 2015-02-02 05:01:29 -0500 |
commit | 827de1f123ba0880033d1b5299e116470e19bafb (patch) | |
tree | 202bca915b75331c525075d28e346bceb356f6ab /arch/arm/mach-at91 | |
parent | cac0172389688b861d269eb4f1fee679d21a1372 (diff) |
ARM: at91: remove at91_dt_initialize and machine init_early()
Move the ramc initialization to pm.c as it is the only user left.
This allows us to get rid of at91_dt_initialize() that was the only one called
by the init_early() function pointer of struct machine_desc.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
[nicolas.ferre@atmel.com: adapt patch to newer series]
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Diffstat (limited to 'arch/arm/mach-at91')
-rw-r--r-- | arch/arm/mach-at91/at91rm9200.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-at91/generic.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-at91/pm.c | 44 | ||||
-rw-r--r-- | arch/arm/mach-at91/sama5.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-at91/setup.c | 45 |
6 files changed, 44 insertions, 54 deletions
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c index ec89806c9d5d..49ae3d455bd5 100644 --- a/arch/arm/mach-at91/at91rm9200.c +++ b/arch/arm/mach-at91/at91rm9200.c | |||
@@ -62,7 +62,6 @@ static const char *at91rm9200_dt_board_compat[] __initconst = { | |||
62 | DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200 (Device Tree)") | 62 | DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200 (Device Tree)") |
63 | .init_time = at91rm9200_dt_timer_init, | 63 | .init_time = at91rm9200_dt_timer_init, |
64 | .map_io = at91_map_io, | 64 | .map_io = at91_map_io, |
65 | .init_early = at91_dt_initialize, | ||
66 | .init_machine = rm9200_dt_device_init, | 65 | .init_machine = rm9200_dt_device_init, |
67 | .dt_compat = at91rm9200_dt_board_compat, | 66 | .dt_compat = at91rm9200_dt_board_compat, |
68 | MACHINE_END | 67 | MACHINE_END |
diff --git a/arch/arm/mach-at91/at91sam9.c b/arch/arm/mach-at91/at91sam9.c index 04a9af79aadb..ecbe535c2ce0 100644 --- a/arch/arm/mach-at91/at91sam9.c +++ b/arch/arm/mach-at91/at91sam9.c | |||
@@ -41,7 +41,6 @@ static const char *at91_dt_board_compat[] __initconst = { | |||
41 | DT_MACHINE_START(at91sam_dt, "Atmel AT91SAM (Device Tree)") | 41 | DT_MACHINE_START(at91sam_dt, "Atmel AT91SAM (Device Tree)") |
42 | /* Maintainer: Atmel */ | 42 | /* Maintainer: Atmel */ |
43 | .map_io = at91_map_io, | 43 | .map_io = at91_map_io, |
44 | .init_early = at91_dt_initialize, | ||
45 | .init_machine = sam9_dt_device_init, | 44 | .init_machine = sam9_dt_device_init, |
46 | .dt_compat = at91_dt_board_compat, | 45 | .dt_compat = at91_dt_board_compat, |
47 | MACHINE_END | 46 | MACHINE_END |
@@ -62,7 +61,6 @@ static const char *at91_9g45_board_compat[] __initconst = { | |||
62 | DT_MACHINE_START(at91sam9g45_dt, "Atmel AT91SAM9G45") | 61 | DT_MACHINE_START(at91sam9g45_dt, "Atmel AT91SAM9G45") |
63 | /* Maintainer: Atmel */ | 62 | /* Maintainer: Atmel */ |
64 | .map_io = at91_map_io, | 63 | .map_io = at91_map_io, |
65 | .init_early = at91_dt_initialize, | ||
66 | .init_machine = sam9g45_dt_device_init, | 64 | .init_machine = sam9g45_dt_device_init, |
67 | .dt_compat = at91_9g45_board_compat, | 65 | .dt_compat = at91_9g45_board_compat, |
68 | MACHINE_END | 66 | MACHINE_END |
@@ -84,7 +82,6 @@ static const char *at91_9x5_board_compat[] __initconst = { | |||
84 | DT_MACHINE_START(at91sam9x5_dt, "Atmel AT91SAM9") | 82 | DT_MACHINE_START(at91sam9x5_dt, "Atmel AT91SAM9") |
85 | /* Maintainer: Atmel */ | 83 | /* Maintainer: Atmel */ |
86 | .map_io = at91_map_io, | 84 | .map_io = at91_map_io, |
87 | .init_early = at91_dt_initialize, | ||
88 | .init_machine = sam9x5_dt_device_init, | 85 | .init_machine = sam9x5_dt_device_init, |
89 | .dt_compat = at91_9x5_board_compat, | 86 | .dt_compat = at91_9x5_board_compat, |
90 | MACHINE_END | 87 | MACHINE_END |
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h index a8ee83ef6cd4..9c6e5b9f87ff 100644 --- a/arch/arm/mach-at91/generic.h +++ b/arch/arm/mach-at91/generic.h | |||
@@ -18,9 +18,6 @@ | |||
18 | extern void __init at91_map_io(void); | 18 | extern void __init at91_map_io(void); |
19 | extern void __init at91_alt_map_io(void); | 19 | extern void __init at91_alt_map_io(void); |
20 | 20 | ||
21 | /* Processors */ | ||
22 | extern void __init at91_dt_initialize(void); | ||
23 | |||
24 | /* Timer */ | 21 | /* Timer */ |
25 | extern void at91rm9200_timer_init(void); | 22 | extern void at91rm9200_timer_init(void); |
26 | 23 | ||
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 87c1fd8aa1b6..25bb93db8208 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | #include <linux/of.h> | 21 | #include <linux/of.h> |
22 | #include <linux/of_platform.h> | 22 | #include <linux/of_platform.h> |
23 | #include <linux/of_address.h> | ||
23 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
24 | #include <linux/io.h> | 25 | #include <linux/io.h> |
25 | #include <linux/clk/at91_pmc.h> | 26 | #include <linux/clk/at91_pmc.h> |
@@ -41,6 +42,7 @@ static struct { | |||
41 | } at91_pm_data; | 42 | } at91_pm_data; |
42 | 43 | ||
43 | static void (*at91_pm_standby)(void); | 44 | static void (*at91_pm_standby)(void); |
45 | void __iomem *at91_ramc_base[2]; | ||
44 | 46 | ||
45 | static int at91_pm_valid_state(suspend_state_t state) | 47 | static int at91_pm_valid_state(suspend_state_t state) |
46 | { | 48 | { |
@@ -224,6 +226,43 @@ void at91_pm_set_standby(void (*at91_standby)(void)) | |||
224 | } | 226 | } |
225 | } | 227 | } |
226 | 228 | ||
229 | static struct of_device_id ramc_ids[] = { | ||
230 | { .compatible = "atmel,at91rm9200-sdramc", .data = at91rm9200_standby }, | ||
231 | { .compatible = "atmel,at91sam9260-sdramc", .data = at91sam9_sdram_standby }, | ||
232 | { .compatible = "atmel,at91sam9g45-ddramc", .data = at91_ddr_standby }, | ||
233 | { .compatible = "atmel,sama5d3-ddramc", .data = at91_ddr_standby }, | ||
234 | { /*sentinel*/ } | ||
235 | }; | ||
236 | |||
237 | static void at91_dt_ramc(void) | ||
238 | { | ||
239 | struct device_node *np; | ||
240 | const struct of_device_id *of_id; | ||
241 | int idx = 0; | ||
242 | const void *standby = NULL; | ||
243 | |||
244 | for_each_matching_node_and_match(np, ramc_ids, &of_id) { | ||
245 | at91_ramc_base[idx] = of_iomap(np, 0); | ||
246 | if (!at91_ramc_base[idx]) | ||
247 | panic(pr_fmt("unable to map ramc[%d] cpu registers\n"), idx); | ||
248 | |||
249 | if (!standby) | ||
250 | standby = of_id->data; | ||
251 | |||
252 | idx++; | ||
253 | } | ||
254 | |||
255 | if (!idx) | ||
256 | panic(pr_fmt("unable to find compatible ram controller node in dtb\n")); | ||
257 | |||
258 | if (!standby) { | ||
259 | pr_warn("ramc no standby function available\n"); | ||
260 | return; | ||
261 | } | ||
262 | |||
263 | at91_pm_set_standby(standby); | ||
264 | } | ||
265 | |||
227 | #ifdef CONFIG_AT91_SLOW_CLOCK | 266 | #ifdef CONFIG_AT91_SLOW_CLOCK |
228 | static void __init at91_pm_sram_init(void) | 267 | static void __init at91_pm_sram_init(void) |
229 | { | 268 | { |
@@ -282,6 +321,8 @@ static void __init at91_pm_init(void) | |||
282 | 321 | ||
283 | void __init at91_rm9200_pm_init(void) | 322 | void __init at91_rm9200_pm_init(void) |
284 | { | 323 | { |
324 | at91_dt_ramc(); | ||
325 | |||
285 | /* | 326 | /* |
286 | * AT91RM9200 SDRAM low-power mode cannot be used with self-refresh. | 327 | * AT91RM9200 SDRAM low-power mode cannot be used with self-refresh. |
287 | */ | 328 | */ |
@@ -295,6 +336,7 @@ void __init at91_rm9200_pm_init(void) | |||
295 | 336 | ||
296 | void __init at91_sam9260_pm_init(void) | 337 | void __init at91_sam9260_pm_init(void) |
297 | { | 338 | { |
339 | at91_dt_ramc(); | ||
298 | at91_pm_data.memctrl = AT91_MEMCTRL_SDRAMC; | 340 | at91_pm_data.memctrl = AT91_MEMCTRL_SDRAMC; |
299 | at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP; | 341 | at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP; |
300 | return at91_pm_init(); | 342 | return at91_pm_init(); |
@@ -302,6 +344,7 @@ void __init at91_sam9260_pm_init(void) | |||
302 | 344 | ||
303 | void __init at91_sam9g45_pm_init(void) | 345 | void __init at91_sam9g45_pm_init(void) |
304 | { | 346 | { |
347 | at91_dt_ramc(); | ||
305 | at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP; | 348 | at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP; |
306 | at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR; | 349 | at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR; |
307 | return at91_pm_init(); | 350 | return at91_pm_init(); |
@@ -309,6 +352,7 @@ void __init at91_sam9g45_pm_init(void) | |||
309 | 352 | ||
310 | void __init at91_sam9x5_pm_init(void) | 353 | void __init at91_sam9x5_pm_init(void) |
311 | { | 354 | { |
355 | at91_dt_ramc(); | ||
312 | at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP; | 356 | at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP; |
313 | at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR; | 357 | at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR; |
314 | return at91_pm_init(); | 358 | return at91_pm_init(); |
diff --git a/arch/arm/mach-at91/sama5.c b/arch/arm/mach-at91/sama5.c index 22944d7e1a63..9816ef0f203d 100644 --- a/arch/arm/mach-at91/sama5.c +++ b/arch/arm/mach-at91/sama5.c | |||
@@ -60,7 +60,6 @@ static const char *sama5_dt_board_compat[] __initconst = { | |||
60 | DT_MACHINE_START(sama5_dt, "Atmel SAMA5 (Device Tree)") | 60 | DT_MACHINE_START(sama5_dt, "Atmel SAMA5 (Device Tree)") |
61 | /* Maintainer: Atmel */ | 61 | /* Maintainer: Atmel */ |
62 | .map_io = at91_map_io, | 62 | .map_io = at91_map_io, |
63 | .init_early = at91_dt_initialize, | ||
64 | .init_machine = sama5_dt_device_init, | 63 | .init_machine = sama5_dt_device_init, |
65 | .dt_compat = sama5_dt_board_compat, | 64 | .dt_compat = sama5_dt_board_compat, |
66 | MACHINE_END | 65 | MACHINE_END |
@@ -106,7 +105,6 @@ static const char *sama5_alt_dt_board_compat[] __initconst = { | |||
106 | DT_MACHINE_START(sama5_alt_dt, "Atmel SAMA5 (Device Tree)") | 105 | DT_MACHINE_START(sama5_alt_dt, "Atmel SAMA5 (Device Tree)") |
107 | /* Maintainer: Atmel */ | 106 | /* Maintainer: Atmel */ |
108 | .map_io = sama5_alt_map_io, | 107 | .map_io = sama5_alt_map_io, |
109 | .init_early = at91_dt_initialize, | ||
110 | .init_machine = sama5_dt_device_init, | 108 | .init_machine = sama5_dt_device_init, |
111 | .dt_compat = sama5_alt_dt_board_compat, | 109 | .dt_compat = sama5_alt_dt_board_compat, |
112 | .l2c_aux_mask = ~0UL, | 110 | .l2c_aux_mask = ~0UL, |
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c index b6a903410b92..4e58bc90ed21 100644 --- a/arch/arm/mach-at91/setup.c +++ b/arch/arm/mach-at91/setup.c | |||
@@ -28,9 +28,6 @@ | |||
28 | struct at91_socinfo at91_soc_initdata; | 28 | struct at91_socinfo at91_soc_initdata; |
29 | EXPORT_SYMBOL(at91_soc_initdata); | 29 | EXPORT_SYMBOL(at91_soc_initdata); |
30 | 30 | ||
31 | void __iomem *at91_ramc_base[2]; | ||
32 | EXPORT_SYMBOL_GPL(at91_ramc_base); | ||
33 | |||
34 | static struct map_desc at91_io_desc __initdata __maybe_unused = { | 31 | static struct map_desc at91_io_desc __initdata __maybe_unused = { |
35 | .virtual = (unsigned long)AT91_VA_BASE_SYS, | 32 | .virtual = (unsigned long)AT91_VA_BASE_SYS, |
36 | .pfn = __phys_to_pfn(AT91_BASE_SYS), | 33 | .pfn = __phys_to_pfn(AT91_BASE_SYS), |
@@ -331,45 +328,3 @@ void __init at91_ioremap_matrix(u32 base_addr) | |||
331 | if (!at91_matrix_base) | 328 | if (!at91_matrix_base) |
332 | panic(pr_fmt("Impossible to ioremap at91_matrix_base\n")); | 329 | panic(pr_fmt("Impossible to ioremap at91_matrix_base\n")); |
333 | } | 330 | } |
334 | |||
335 | static struct of_device_id ramc_ids[] = { | ||
336 | { .compatible = "atmel,at91rm9200-sdramc", .data = at91rm9200_standby }, | ||
337 | { .compatible = "atmel,at91sam9260-sdramc", .data = at91sam9_sdram_standby }, | ||
338 | { .compatible = "atmel,at91sam9g45-ddramc", .data = at91_ddr_standby }, | ||
339 | { .compatible = "atmel,sama5d3-ddramc", .data = at91_ddr_standby }, | ||
340 | { /*sentinel*/ } | ||
341 | }; | ||
342 | |||
343 | static void at91_dt_ramc(void) | ||
344 | { | ||
345 | struct device_node *np; | ||
346 | const struct of_device_id *of_id; | ||
347 | int idx = 0; | ||
348 | const void *standby = NULL; | ||
349 | |||
350 | for_each_matching_node_and_match(np, ramc_ids, &of_id) { | ||
351 | at91_ramc_base[idx] = of_iomap(np, 0); | ||
352 | if (!at91_ramc_base[idx]) | ||
353 | panic(pr_fmt("unable to map ramc[%d] cpu registers\n"), idx); | ||
354 | |||
355 | if (!standby) | ||
356 | standby = of_id->data; | ||
357 | |||
358 | idx++; | ||
359 | } | ||
360 | |||
361 | if (!idx) | ||
362 | panic(pr_fmt("unable to find compatible ram controller node in dtb\n")); | ||
363 | |||
364 | if (!standby) { | ||
365 | pr_warn("ramc no standby function available\n"); | ||
366 | return; | ||
367 | } | ||
368 | |||
369 | at91_pm_set_standby(standby); | ||
370 | } | ||
371 | |||
372 | void __init at91_dt_initialize(void) | ||
373 | { | ||
374 | at91_dt_ramc(); | ||
375 | } | ||