From 63575d8cd5cba0c657ac5c18f75e91e2e30cc0eb Mon Sep 17 00:00:00 2001 From: Magnus Damm Date: Thu, 8 May 2014 08:32:29 +0900 Subject: ARM: shmobile: Add r8a7740 Maximum CPU Frequency to DTS Add 800 MHz to the r8a7740 DTS to describe the maximum CPU frequency. Signed-off-by: Magnus Damm Tested-by: Geert Uytterhoeven Signed-off-by: Simon Horman --- arch/arm/boot/dts/r8a7740.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi index 8280884bfa59..67c4b8ba1f3e 100644 --- a/arch/arm/boot/dts/r8a7740.dtsi +++ b/arch/arm/boot/dts/r8a7740.dtsi @@ -22,6 +22,7 @@ compatible = "arm,cortex-a9"; device_type = "cpu"; reg = <0x0>; + clock-frequency = <800000000>; }; }; -- cgit v1.2.3 From a0c1fb0c285d9aa5f9d078449cfa37883a3f5a91 Mon Sep 17 00:00:00 2001 From: Magnus Damm Date: Thu, 8 May 2014 08:32:38 +0900 Subject: ARM: shmobile: Use r8a7740 DT CPU Frequency in common case Convert the common C-code-less r8a7740 DT board support to use shmobile_init_delay() to be able to migrate away from per-SoC delay setup functions. Signed-off-by: Magnus Damm Tested-by: Geert Uytterhoeven Signed-off-by: Simon Horman --- arch/arm/mach-shmobile/setup-r8a7740.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c index 8f3c68101d59..d1ce3caa7d92 100644 --- a/arch/arm/mach-shmobile/setup-r8a7740.c +++ b/arch/arm/mach-shmobile/setup-r8a7740.c @@ -935,7 +935,7 @@ static const char *r8a7740_boards_compat_dt[] __initdata = { DT_MACHINE_START(R8A7740_DT, "Generic R8A7740 (Flattened Device Tree)") .map_io = r8a7740_map_io, - .init_early = r8a7740_init_delay, + .init_early = shmobile_init_delay, .init_irq = r8a7740_init_irq_of, .init_machine = r8a7740_generic_init, .dt_compat = r8a7740_boards_compat_dt, -- cgit v1.2.3 From e568802d13eb1dbcbe688aa4e7cf1db866a52e3e Mon Sep 17 00:00:00 2001 From: Magnus Damm Date: Thu, 8 May 2014 08:32:47 +0900 Subject: ARM: shmobile: Use r8a7740 DT CPU Frequency for Armadillo DT Ref Convert the Armadillo r8a7740 DT reference board support to use shmobile_init_delay() to be able to migrate away from per-SoC delay setup functions. Signed-off-by: Magnus Damm Tested-by: Geert Uytterhoeven Signed-off-by: Simon Horman --- arch/arm/mach-shmobile/board-armadillo800eva-reference.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-shmobile/board-armadillo800eva-reference.c b/arch/arm/mach-shmobile/board-armadillo800eva-reference.c index 57d1a78367b6..57d246eb8813 100644 --- a/arch/arm/mach-shmobile/board-armadillo800eva-reference.c +++ b/arch/arm/mach-shmobile/board-armadillo800eva-reference.c @@ -187,7 +187,7 @@ static const char *eva_boards_compat_dt[] __initdata = { DT_MACHINE_START(ARMADILLO800EVA_DT, "armadillo800eva-reference") .map_io = r8a7740_map_io, - .init_early = r8a7740_init_delay, + .init_early = shmobile_init_delay, .init_irq = r8a7740_init_irq_of, .init_machine = eva_init, .init_late = shmobile_init_late, -- cgit v1.2.3 From bf901fbd9040effe4aa1389f78efcc1c2736a44b Mon Sep 17 00:00:00 2001 From: Magnus Damm Date: Thu, 8 May 2014 08:32:56 +0900 Subject: ARM: shmobile: Remove unused r8a7740_init_delay() Remove the now unused r8a7740_init_delay() function. Signed-off-by: Magnus Damm Tested-by: Geert Uytterhoeven Signed-off-by: Simon Horman --- arch/arm/mach-shmobile/include/mach/r8a7740.h | 1 - arch/arm/mach-shmobile/setup-r8a7740.c | 5 ----- 2 files changed, 6 deletions(-) diff --git a/arch/arm/mach-shmobile/include/mach/r8a7740.h b/arch/arm/mach-shmobile/include/mach/r8a7740.h index d07932f872b6..5e3c9ec06303 100644 --- a/arch/arm/mach-shmobile/include/mach/r8a7740.h +++ b/arch/arm/mach-shmobile/include/mach/r8a7740.h @@ -47,7 +47,6 @@ enum { }; extern void r8a7740_meram_workaround(void); -extern void r8a7740_init_delay(void); extern void r8a7740_init_irq_of(void); extern void r8a7740_map_io(void); extern void r8a7740_add_early_devices(void); diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c index d1ce3caa7d92..eaec04346ea6 100644 --- a/arch/arm/mach-shmobile/setup-r8a7740.c +++ b/arch/arm/mach-shmobile/setup-r8a7740.c @@ -887,11 +887,6 @@ void __init r8a7740_add_standard_devices_dt(void) of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } -void __init r8a7740_init_delay(void) -{ - shmobile_setup_delay(800, 1, 3); /* Cortex-A9 @ 800MHz */ -}; - void __init r8a7740_init_irq_of(void) { void __iomem *intc_prio_base = ioremap_nocache(0xe6900010, 0x10); -- cgit v1.2.3 From 648c687a6a43a6473caedba4785a16537bd21bfb Mon Sep 17 00:00:00 2001 From: Magnus Damm Date: Mon, 12 May 2014 08:25:18 +0900 Subject: ARM: shmobile: Use r8a7791 DT CPU Frequency in common case Convert the common C-code-less r8a7791 DT board support to use shmobile_init_delay() to be able to migrate away from per-SoC delay setup functions. Signed-off-by: Magnus Damm Signed-off-by: Simon Horman --- arch/arm/mach-shmobile/setup-r8a7791.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-shmobile/setup-r8a7791.c b/arch/arm/mach-shmobile/setup-r8a7791.c index a7e4966f5e18..2c84e745c223 100644 --- a/arch/arm/mach-shmobile/setup-r8a7791.c +++ b/arch/arm/mach-shmobile/setup-r8a7791.c @@ -225,7 +225,7 @@ static const char *r8a7791_boards_compat_dt[] __initdata = { DT_MACHINE_START(R8A7791_DT, "Generic R8A7791 (Flattened Device Tree)") .smp = smp_ops(r8a7791_smp_ops), - .init_early = r8a7791_init_early, + .init_early = shmobile_init_delay, .init_time = rcar_gen2_timer_init, .dt_compat = r8a7791_boards_compat_dt, MACHINE_END -- cgit v1.2.3 From 7e99497cf5e7b46ff5f434beae45f6f35005e8b6 Mon Sep 17 00:00:00 2001 From: Magnus Damm Date: Mon, 12 May 2014 08:25:27 +0900 Subject: ARM: shmobile: Use r8a7791 DT CPU Frequency for Koelsch Convert the Koelsch board support to use shmobile_init_delay() to be able to migrate away from per-SoC delay setup functions. Signed-off-by: Magnus Damm Signed-off-by: Simon Horman --- arch/arm/mach-shmobile/board-koelsch-reference.c | 2 +- arch/arm/mach-shmobile/board-koelsch.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-shmobile/board-koelsch-reference.c b/arch/arm/mach-shmobile/board-koelsch-reference.c index a3fd30242bd8..ff33d9c4b658 100644 --- a/arch/arm/mach-shmobile/board-koelsch-reference.c +++ b/arch/arm/mach-shmobile/board-koelsch-reference.c @@ -139,7 +139,7 @@ static const char * const koelsch_boards_compat_dt[] __initconst = { DT_MACHINE_START(KOELSCH_DT, "koelsch") .smp = smp_ops(r8a7791_smp_ops), - .init_early = r8a7791_init_early, + .init_early = shmobile_init_delay, .init_time = rcar_gen2_timer_init, .init_machine = koelsch_add_standard_devices, .init_late = shmobile_init_late, diff --git a/arch/arm/mach-shmobile/board-koelsch.c b/arch/arm/mach-shmobile/board-koelsch.c index 5a034ff405d0..3cd8008d09dd 100644 --- a/arch/arm/mach-shmobile/board-koelsch.c +++ b/arch/arm/mach-shmobile/board-koelsch.c @@ -522,7 +522,7 @@ static const char * const koelsch_boards_compat_dt[] __initconst = { DT_MACHINE_START(KOELSCH_DT, "koelsch") .smp = smp_ops(r8a7791_smp_ops), - .init_early = r8a7791_init_early, + .init_early = shmobile_init_delay, .init_time = rcar_gen2_timer_init, .init_machine = koelsch_init, .init_late = shmobile_init_late, -- cgit v1.2.3 From 595e9b00fb81f971d84ff451861423d02c39d060 Mon Sep 17 00:00:00 2001 From: Magnus Damm Date: Mon, 12 May 2014 08:25:37 +0900 Subject: ARM: shmobile: Remove unused r8a7791_init_early() Remove the now unused r8a7791_init_early() function. Signed-off-by: Magnus Damm Signed-off-by: Simon Horman --- arch/arm/mach-shmobile/include/mach/r8a7791.h | 1 - arch/arm/mach-shmobile/setup-r8a7791.c | 7 ------- 2 files changed, 8 deletions(-) diff --git a/arch/arm/mach-shmobile/include/mach/r8a7791.h b/arch/arm/mach-shmobile/include/mach/r8a7791.h index 200fa699f730..664274cc4b64 100644 --- a/arch/arm/mach-shmobile/include/mach/r8a7791.h +++ b/arch/arm/mach-shmobile/include/mach/r8a7791.h @@ -5,7 +5,6 @@ void r8a7791_add_standard_devices(void); void r8a7791_add_dt_devices(void); void r8a7791_clock_init(void); void r8a7791_pinmux_init(void); -void r8a7791_init_early(void); extern struct smp_operations r8a7791_smp_ops; #endif /* __ASM_R8A7791_H__ */ diff --git a/arch/arm/mach-shmobile/setup-r8a7791.c b/arch/arm/mach-shmobile/setup-r8a7791.c index 2c84e745c223..949580ae150a 100644 --- a/arch/arm/mach-shmobile/setup-r8a7791.c +++ b/arch/arm/mach-shmobile/setup-r8a7791.c @@ -210,13 +210,6 @@ void __init r8a7791_add_standard_devices(void) r8a7791_register_thermal(); } -void __init r8a7791_init_early(void) -{ -#ifndef CONFIG_ARM_ARCH_TIMER - shmobile_setup_delay(1500, 2, 4); /* Cortex-A15 @ 1500MHz */ -#endif -} - #ifdef CONFIG_USE_OF static const char *r8a7791_boards_compat_dt[] __initdata = { "renesas,r8a7791", -- cgit v1.2.3 From 34b9fa401eeef4e388bb7563110733c73c452c80 Mon Sep 17 00:00:00 2001 From: Magnus Damm Date: Mon, 12 May 2014 08:10:50 +0900 Subject: ARM: shmobile: Use shmobile_init_late() on r8a7740 Hook up ->init_late for r8a7740 to initialize Suspend-to-RAM and CPUIdle in case of C-code less board support for r8a7740. Signed-off-by: Magnus Damm Acked-by: Geert Uytterhoeven Signed-off-by: Simon Horman --- arch/arm/mach-shmobile/setup-r8a7740.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c index eaec04346ea6..7bdc51c195c7 100644 --- a/arch/arm/mach-shmobile/setup-r8a7740.c +++ b/arch/arm/mach-shmobile/setup-r8a7740.c @@ -933,6 +933,7 @@ DT_MACHINE_START(R8A7740_DT, "Generic R8A7740 (Flattened Device Tree)") .init_early = shmobile_init_delay, .init_irq = r8a7740_init_irq_of, .init_machine = r8a7740_generic_init, + .init_late = shmobile_init_late, .dt_compat = r8a7740_boards_compat_dt, MACHINE_END -- cgit v1.2.3 From f492b81777c93b33afe892b424e022022b5bc297 Mon Sep 17 00:00:00 2001 From: Simon Horman Date: Tue, 13 May 2014 15:59:18 +0900 Subject: ARM: shmobile: Set clock frequency in HZ from OF nodes shmobile_init_delay() looks for OF "clock-frequency" to determine the delay which is set by calling shmobile_setup_delay(). Unfortunately this seems to be incorrect in detail as "clock-frequency" node values are in HZ whereas the frequency argument to shmobile_setup_delay() is in MHz. Provide a variant of shmobile_setup_delay() that accepts HZ to correct this problem. Signed-off-by: Simon Horman --- arch/arm/mach-shmobile/timer.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c index ccecde9a3362..68bc0b82226d 100644 --- a/arch/arm/mach-shmobile/timer.c +++ b/arch/arm/mach-shmobile/timer.c @@ -23,6 +23,23 @@ #include #include +void __init shmobile_setup_delay_hz(unsigned int max_cpu_core_hz, + unsigned int mult, unsigned int div) +{ + /* calculate a worst-case loops-per-jiffy value + * based on maximum cpu core hz setting and the + * __delay() implementation in arch/arm/lib/delay.S + * + * this will result in a longer delay than expected + * when the cpu core runs on lower frequencies. + */ + + unsigned int value = HZ * div / mult; + + if (!preset_lpj) + preset_lpj = max_cpu_core_hz / value; +} + void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz, unsigned int mult, unsigned int div) { @@ -58,12 +75,12 @@ void __init shmobile_init_delay(void) if (max_freq) { if (of_find_compatible_node(NULL, NULL, "arm,cortex-a8")) - shmobile_setup_delay(max_freq, 1, 3); + shmobile_setup_delay_hz(max_freq, 1, 3); else if (of_find_compatible_node(NULL, NULL, "arm,cortex-a9")) - shmobile_setup_delay(max_freq, 1, 3); + shmobile_setup_delay_hz(max_freq, 1, 3); else if (of_find_compatible_node(NULL, NULL, "arm,cortex-a15")) if (!IS_ENABLED(CONFIG_ARM_ARCH_TIMER)) - shmobile_setup_delay(max_freq, 2, 4); + shmobile_setup_delay_hz(max_freq, 2, 4); } } -- cgit v1.2.3