* [PATCH 00/02] ARM: shmobile: Consolidate early delay setup code
@ 2014-03-06 3:28 ` Magnus Damm
0 siblings, 0 replies; 14+ messages in thread
From: Magnus Damm @ 2014-03-06 3:28 UTC (permalink / raw)
To: linux-arm-kernel
ARM: shmobile: Consolidate early delay setup code
[PATCH 01/02] ARM: shmobile: Add shared shmobile_init_delay()
[PATCH 02/02] ARM: shmobile: Use shmobile_init_delay() on r8a7791/Koelsch
Add code to retrieve early delay handling parameters from DT and
as example convert r8a7791 and Koelsch. The first patch should be
rather useful as-is but the second needs to be broken out into
SoC and board specific bits to fit board/soc pull request style.
Also, all mach-shmobile SoCs can be converted to use patch [1/1]
Signed-off-by: Magnus Damm <damm@opensource.se>
---
Written against renesas.git tag renesas-devel-v3.14-rc4-20140227
and patch [2/2] also depends on
[PATCH] ARM: shmobile: Update r8a7791 CPU freq to 1500MHz in C
arch/arm/mach-shmobile/board-koelsch-reference.c | 2 -
arch/arm/mach-shmobile/board-koelsch.c | 2 -
arch/arm/mach-shmobile/include/mach/common.h | 1
arch/arm/mach-shmobile/include/mach/r8a7791.h | 1
arch/arm/mach-shmobile/setup-r8a7791.c | 9 -------
arch/arm/mach-shmobile/timer.c | 28 ++++++++++++++++++++++
6 files changed, 32 insertions(+), 11 deletions(-)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 00/02] ARM: shmobile: Consolidate early delay setup code
@ 2014-03-06 3:28 ` Magnus Damm
0 siblings, 0 replies; 14+ messages in thread
From: Magnus Damm @ 2014-03-06 3:28 UTC (permalink / raw)
To: linux-arm-kernel
ARM: shmobile: Consolidate early delay setup code
[PATCH 01/02] ARM: shmobile: Add shared shmobile_init_delay()
[PATCH 02/02] ARM: shmobile: Use shmobile_init_delay() on r8a7791/Koelsch
Add code to retrieve early delay handling parameters from DT and
as example convert r8a7791 and Koelsch. The first patch should be
rather useful as-is but the second needs to be broken out into
SoC and board specific bits to fit board/soc pull request style.
Also, all mach-shmobile SoCs can be converted to use patch [1/1]
Signed-off-by: Magnus Damm <damm@opensource.se>
---
Written against renesas.git tag renesas-devel-v3.14-rc4-20140227
and patch [2/2] also depends on
[PATCH] ARM: shmobile: Update r8a7791 CPU freq to 1500MHz in C
arch/arm/mach-shmobile/board-koelsch-reference.c | 2 -
arch/arm/mach-shmobile/board-koelsch.c | 2 -
arch/arm/mach-shmobile/include/mach/common.h | 1
arch/arm/mach-shmobile/include/mach/r8a7791.h | 1
arch/arm/mach-shmobile/setup-r8a7791.c | 9 -------
arch/arm/mach-shmobile/timer.c | 28 ++++++++++++++++++++++
6 files changed, 32 insertions(+), 11 deletions(-)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 01/02] ARM: shmobile: Add shared shmobile_init_delay()
2014-03-06 3:28 ` Magnus Damm
@ 2014-03-06 3:28 ` Magnus Damm
-1 siblings, 0 replies; 14+ messages in thread
From: Magnus Damm @ 2014-03-06 3:28 UTC (permalink / raw)
To: linux-arm-kernel
From: Magnus Damm <damm@opensource.se>
Introduce shmobile_init_delay() that gets CPU specific
parameters from DT and sets up the early delay from
there. This allows us to both remove frequency information
from the C code and consolidate existing code.
Signed-off-by: Magnus Damm <damm@opensource.se>
---
arch/arm/mach-shmobile/include/mach/common.h | 1
arch/arm/mach-shmobile/timer.c | 28 ++++++++++++++++++++++++++
2 files changed, 29 insertions(+)
--- 0001/arch/arm/mach-shmobile/include/mach/common.h
+++ work/arch/arm/mach-shmobile/include/mach/common.h 2014-03-06 12:06:03.000000000 +0900
@@ -4,6 +4,7 @@
extern void shmobile_earlytimer_init(void);
extern void shmobile_setup_delay(unsigned int max_cpu_core_mhz,
unsigned int mult, unsigned int div);
+extern void shmobile_init_delay(void);
struct twd_local_timer;
extern void shmobile_setup_console(void);
extern void shmobile_boot_vector(void);
--- 0001/arch/arm/mach-shmobile/timer.c
+++ work/arch/arm/mach-shmobile/timer.c 2014-03-06 12:06:03.000000000 +0900
@@ -21,6 +21,7 @@
#include <linux/platform_device.h>
#include <linux/clocksource.h>
#include <linux/delay.h>
+#include <linux/of_address.h>
void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz,
unsigned int mult, unsigned int div)
@@ -39,6 +40,33 @@ void __init shmobile_setup_delay(unsigne
preset_lpj = max_cpu_core_mhz * value;
}
+void __init shmobile_init_delay(void)
+{
+ struct device_node *np, *parent;
+ u32 max_freq, freq;
+
+ max_freq = 0;
+
+ parent = of_find_node_by_path("/cpus");
+ if (parent) {
+ for_each_child_of_node(parent, np) {
+ if (!of_property_read_u32(np, "clock-frequency", &freq))
+ max_freq = max(max_freq, freq);
+ }
+ of_node_put(parent);
+ }
+
+ if (max_freq) {
+ if (of_find_compatible_node(NULL, NULL, "arm,cortex-a8"))
+ shmobile_setup_delay(max_freq, 1, 3);
+ else if (of_find_compatible_node(NULL, NULL, "arm,cortex-a9"))
+ shmobile_setup_delay(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);
+ }
+}
+
static void __init shmobile_late_time_init(void)
{
/*
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 01/02] ARM: shmobile: Add shared shmobile_init_delay()
@ 2014-03-06 3:28 ` Magnus Damm
0 siblings, 0 replies; 14+ messages in thread
From: Magnus Damm @ 2014-03-06 3:28 UTC (permalink / raw)
To: linux-arm-kernel
From: Magnus Damm <damm@opensource.se>
Introduce shmobile_init_delay() that gets CPU specific
parameters from DT and sets up the early delay from
there. This allows us to both remove frequency information
from the C code and consolidate existing code.
Signed-off-by: Magnus Damm <damm@opensource.se>
---
arch/arm/mach-shmobile/include/mach/common.h | 1
arch/arm/mach-shmobile/timer.c | 28 ++++++++++++++++++++++++++
2 files changed, 29 insertions(+)
--- 0001/arch/arm/mach-shmobile/include/mach/common.h
+++ work/arch/arm/mach-shmobile/include/mach/common.h 2014-03-06 12:06:03.000000000 +0900
@@ -4,6 +4,7 @@
extern void shmobile_earlytimer_init(void);
extern void shmobile_setup_delay(unsigned int max_cpu_core_mhz,
unsigned int mult, unsigned int div);
+extern void shmobile_init_delay(void);
struct twd_local_timer;
extern void shmobile_setup_console(void);
extern void shmobile_boot_vector(void);
--- 0001/arch/arm/mach-shmobile/timer.c
+++ work/arch/arm/mach-shmobile/timer.c 2014-03-06 12:06:03.000000000 +0900
@@ -21,6 +21,7 @@
#include <linux/platform_device.h>
#include <linux/clocksource.h>
#include <linux/delay.h>
+#include <linux/of_address.h>
void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz,
unsigned int mult, unsigned int div)
@@ -39,6 +40,33 @@ void __init shmobile_setup_delay(unsigne
preset_lpj = max_cpu_core_mhz * value;
}
+void __init shmobile_init_delay(void)
+{
+ struct device_node *np, *parent;
+ u32 max_freq, freq;
+
+ max_freq = 0;
+
+ parent = of_find_node_by_path("/cpus");
+ if (parent) {
+ for_each_child_of_node(parent, np) {
+ if (!of_property_read_u32(np, "clock-frequency", &freq))
+ max_freq = max(max_freq, freq);
+ }
+ of_node_put(parent);
+ }
+
+ if (max_freq) {
+ if (of_find_compatible_node(NULL, NULL, "arm,cortex-a8"))
+ shmobile_setup_delay(max_freq, 1, 3);
+ else if (of_find_compatible_node(NULL, NULL, "arm,cortex-a9"))
+ shmobile_setup_delay(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);
+ }
+}
+
static void __init shmobile_late_time_init(void)
{
/*
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 02/02] ARM: shmobile: Use shmobile_init_delay() on r8a7791/Koelsch
2014-03-06 3:28 ` Magnus Damm
@ 2014-03-06 3:28 ` Magnus Damm
-1 siblings, 0 replies; 14+ messages in thread
From: Magnus Damm @ 2014-03-06 3:28 UTC (permalink / raw)
To: linux-arm-kernel
From: Magnus Damm <damm@opensource.se>
Prototype to convert Koelsch and r8a7791 to using
shmobile_init_delay() and by that allow removing
CPU frequency information from the C code.
Needs to be reworked to fit ARM SoC board/SoC branch style.
Not-yet-Signed-off-by: Magnus Damm <damm@opensource.se>
---
arch/arm/mach-shmobile/board-koelsch-reference.c | 2 +-
arch/arm/mach-shmobile/board-koelsch.c | 2 +-
arch/arm/mach-shmobile/include/mach/r8a7791.h | 1 -
arch/arm/mach-shmobile/setup-r8a7791.c | 9 +--------
4 files changed, 3 insertions(+), 11 deletions(-)
--- 0001/arch/arm/mach-shmobile/board-koelsch-reference.c
+++ work/arch/arm/mach-shmobile/board-koelsch-reference.c 2014-03-06 12:08:22.000000000 +0900
@@ -139,7 +139,7 @@ static const char * const koelsch_boards
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,
--- 0001/arch/arm/mach-shmobile/board-koelsch.c
+++ work/arch/arm/mach-shmobile/board-koelsch.c 2014-03-06 12:08:22.000000000 +0900
@@ -522,7 +522,7 @@ static const char * const koelsch_boards
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,
--- 0001/arch/arm/mach-shmobile/include/mach/r8a7791.h
+++ work/arch/arm/mach-shmobile/include/mach/r8a7791.h 2014-03-06 12:08:22.000000000 +0900
@@ -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__ */
--- 0003/arch/arm/mach-shmobile/setup-r8a7791.c
+++ work/arch/arm/mach-shmobile/setup-r8a7791.c 2014-03-06 12:08:22.000000000 +0900
@@ -210,13 +210,6 @@ void __init r8a7791_add_standard_devices
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",
@@ -225,7 +218,7 @@ static const char *r8a7791_boards_compat
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
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 02/02] ARM: shmobile: Use shmobile_init_delay() on r8a7791/Koelsch
@ 2014-03-06 3:28 ` Magnus Damm
0 siblings, 0 replies; 14+ messages in thread
From: Magnus Damm @ 2014-03-06 3:28 UTC (permalink / raw)
To: linux-arm-kernel
From: Magnus Damm <damm@opensource.se>
Prototype to convert Koelsch and r8a7791 to using
shmobile_init_delay() and by that allow removing
CPU frequency information from the C code.
Needs to be reworked to fit ARM SoC board/SoC branch style.
Not-yet-Signed-off-by: Magnus Damm <damm@opensource.se>
---
arch/arm/mach-shmobile/board-koelsch-reference.c | 2 +-
arch/arm/mach-shmobile/board-koelsch.c | 2 +-
arch/arm/mach-shmobile/include/mach/r8a7791.h | 1 -
arch/arm/mach-shmobile/setup-r8a7791.c | 9 +--------
4 files changed, 3 insertions(+), 11 deletions(-)
--- 0001/arch/arm/mach-shmobile/board-koelsch-reference.c
+++ work/arch/arm/mach-shmobile/board-koelsch-reference.c 2014-03-06 12:08:22.000000000 +0900
@@ -139,7 +139,7 @@ static const char * const koelsch_boards
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,
--- 0001/arch/arm/mach-shmobile/board-koelsch.c
+++ work/arch/arm/mach-shmobile/board-koelsch.c 2014-03-06 12:08:22.000000000 +0900
@@ -522,7 +522,7 @@ static const char * const koelsch_boards
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,
--- 0001/arch/arm/mach-shmobile/include/mach/r8a7791.h
+++ work/arch/arm/mach-shmobile/include/mach/r8a7791.h 2014-03-06 12:08:22.000000000 +0900
@@ -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__ */
--- 0003/arch/arm/mach-shmobile/setup-r8a7791.c
+++ work/arch/arm/mach-shmobile/setup-r8a7791.c 2014-03-06 12:08:22.000000000 +0900
@@ -210,13 +210,6 @@ void __init r8a7791_add_standard_devices
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",
@@ -225,7 +218,7 @@ static const char *r8a7791_boards_compat
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
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 01/02] ARM: shmobile: Add shared shmobile_init_delay()
2014-03-06 3:28 ` Magnus Damm
@ 2014-03-07 0:00 ` Simon Horman
-1 siblings, 0 replies; 14+ messages in thread
From: Simon Horman @ 2014-03-07 0:00 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Mar 06, 2014 at 12:28:24PM +0900, Magnus Damm wrote:
> From: Magnus Damm <damm@opensource.se>
>
> Introduce shmobile_init_delay() that gets CPU specific
> parameters from DT and sets up the early delay from
> there. This allows us to both remove frequency information
> from the C code and consolidate existing code.
>
> Signed-off-by: Magnus Damm <damm@opensource.se>
Hi Magnus,
I am holding off on this one until the rest of the series is finalised.
> ---
>
> arch/arm/mach-shmobile/include/mach/common.h | 1
> arch/arm/mach-shmobile/timer.c | 28 ++++++++++++++++++++++++++
> 2 files changed, 29 insertions(+)
>
> --- 0001/arch/arm/mach-shmobile/include/mach/common.h
> +++ work/arch/arm/mach-shmobile/include/mach/common.h 2014-03-06 12:06:03.000000000 +0900
> @@ -4,6 +4,7 @@
> extern void shmobile_earlytimer_init(void);
> extern void shmobile_setup_delay(unsigned int max_cpu_core_mhz,
> unsigned int mult, unsigned int div);
> +extern void shmobile_init_delay(void);
> struct twd_local_timer;
> extern void shmobile_setup_console(void);
> extern void shmobile_boot_vector(void);
> --- 0001/arch/arm/mach-shmobile/timer.c
> +++ work/arch/arm/mach-shmobile/timer.c 2014-03-06 12:06:03.000000000 +0900
> @@ -21,6 +21,7 @@
> #include <linux/platform_device.h>
> #include <linux/clocksource.h>
> #include <linux/delay.h>
> +#include <linux/of_address.h>
>
> void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz,
> unsigned int mult, unsigned int div)
> @@ -39,6 +40,33 @@ void __init shmobile_setup_delay(unsigne
> preset_lpj = max_cpu_core_mhz * value;
> }
>
> +void __init shmobile_init_delay(void)
> +{
> + struct device_node *np, *parent;
> + u32 max_freq, freq;
> +
> + max_freq = 0;
> +
> + parent = of_find_node_by_path("/cpus");
> + if (parent) {
> + for_each_child_of_node(parent, np) {
> + if (!of_property_read_u32(np, "clock-frequency", &freq))
> + max_freq = max(max_freq, freq);
> + }
> + of_node_put(parent);
> + }
> +
> + if (max_freq) {
> + if (of_find_compatible_node(NULL, NULL, "arm,cortex-a8"))
> + shmobile_setup_delay(max_freq, 1, 3);
> + else if (of_find_compatible_node(NULL, NULL, "arm,cortex-a9"))
> + shmobile_setup_delay(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);
> + }
> +}
> +
> static void __init shmobile_late_time_init(void)
> {
> /*
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 01/02] ARM: shmobile: Add shared shmobile_init_delay()
@ 2014-03-07 0:00 ` Simon Horman
0 siblings, 0 replies; 14+ messages in thread
From: Simon Horman @ 2014-03-07 0:00 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Mar 06, 2014 at 12:28:24PM +0900, Magnus Damm wrote:
> From: Magnus Damm <damm@opensource.se>
>
> Introduce shmobile_init_delay() that gets CPU specific
> parameters from DT and sets up the early delay from
> there. This allows us to both remove frequency information
> from the C code and consolidate existing code.
>
> Signed-off-by: Magnus Damm <damm@opensource.se>
Hi Magnus,
I am holding off on this one until the rest of the series is finalised.
> ---
>
> arch/arm/mach-shmobile/include/mach/common.h | 1
> arch/arm/mach-shmobile/timer.c | 28 ++++++++++++++++++++++++++
> 2 files changed, 29 insertions(+)
>
> --- 0001/arch/arm/mach-shmobile/include/mach/common.h
> +++ work/arch/arm/mach-shmobile/include/mach/common.h 2014-03-06 12:06:03.000000000 +0900
> @@ -4,6 +4,7 @@
> extern void shmobile_earlytimer_init(void);
> extern void shmobile_setup_delay(unsigned int max_cpu_core_mhz,
> unsigned int mult, unsigned int div);
> +extern void shmobile_init_delay(void);
> struct twd_local_timer;
> extern void shmobile_setup_console(void);
> extern void shmobile_boot_vector(void);
> --- 0001/arch/arm/mach-shmobile/timer.c
> +++ work/arch/arm/mach-shmobile/timer.c 2014-03-06 12:06:03.000000000 +0900
> @@ -21,6 +21,7 @@
> #include <linux/platform_device.h>
> #include <linux/clocksource.h>
> #include <linux/delay.h>
> +#include <linux/of_address.h>
>
> void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz,
> unsigned int mult, unsigned int div)
> @@ -39,6 +40,33 @@ void __init shmobile_setup_delay(unsigne
> preset_lpj = max_cpu_core_mhz * value;
> }
>
> +void __init shmobile_init_delay(void)
> +{
> + struct device_node *np, *parent;
> + u32 max_freq, freq;
> +
> + max_freq = 0;
> +
> + parent = of_find_node_by_path("/cpus");
> + if (parent) {
> + for_each_child_of_node(parent, np) {
> + if (!of_property_read_u32(np, "clock-frequency", &freq))
> + max_freq = max(max_freq, freq);
> + }
> + of_node_put(parent);
> + }
> +
> + if (max_freq) {
> + if (of_find_compatible_node(NULL, NULL, "arm,cortex-a8"))
> + shmobile_setup_delay(max_freq, 1, 3);
> + else if (of_find_compatible_node(NULL, NULL, "arm,cortex-a9"))
> + shmobile_setup_delay(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);
> + }
> +}
> +
> static void __init shmobile_late_time_init(void)
> {
> /*
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 01/02] ARM: shmobile: Add shared shmobile_init_delay()
2014-03-07 0:00 ` Simon Horman
@ 2014-03-07 1:48 ` Simon Horman
-1 siblings, 0 replies; 14+ messages in thread
From: Simon Horman @ 2014-03-07 1:48 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Mar 07, 2014 at 09:00:06AM +0900, Simon Horman wrote:
> On Thu, Mar 06, 2014 at 12:28:24PM +0900, Magnus Damm wrote:
> > From: Magnus Damm <damm@opensource.se>
> >
> > Introduce shmobile_init_delay() that gets CPU specific
> > parameters from DT and sets up the early delay from
> > there. This allows us to both remove frequency information
> > from the C code and consolidate existing code.
> >
> > Signed-off-by: Magnus Damm <damm@opensource.se>
>
> Hi Magnus,
>
> I am holding off on this one until the rest of the series is finalised.
After some discussion off-list I have queued this up.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 01/02] ARM: shmobile: Add shared shmobile_init_delay()
@ 2014-03-07 1:48 ` Simon Horman
0 siblings, 0 replies; 14+ messages in thread
From: Simon Horman @ 2014-03-07 1:48 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Mar 07, 2014 at 09:00:06AM +0900, Simon Horman wrote:
> On Thu, Mar 06, 2014 at 12:28:24PM +0900, Magnus Damm wrote:
> > From: Magnus Damm <damm@opensource.se>
> >
> > Introduce shmobile_init_delay() that gets CPU specific
> > parameters from DT and sets up the early delay from
> > there. This allows us to both remove frequency information
> > from the C code and consolidate existing code.
> >
> > Signed-off-by: Magnus Damm <damm@opensource.se>
>
> Hi Magnus,
>
> I am holding off on this one until the rest of the series is finalised.
After some discussion off-list I have queued this up.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 01/02] ARM: shmobile: Add shared R-Car Gen2 CMA reservation code
2014-03-06 3:28 ` Magnus Damm
(?)
(?)
@ 2014-06-09 12:38 ` Magnus Damm
-1 siblings, 0 replies; 14+ messages in thread
From: Magnus Damm @ 2014-06-09 12:38 UTC (permalink / raw)
To: linux-sh
From: Magnus Damm <damm+renesas@opensource.se>
Add R-Car Gen2 CMA memory reservation code that can be
shared between multiple SoCs and boards. At this point
r8a7790 and r8a7791 are supported.
The top 256MiB of the legacy 32-bit physical memory space
is assigned to a separate CMA area that may be assigned
to various devices later on.
Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---
arch/arm/mach-shmobile/include/mach/rcar-gen2.h | 1
arch/arm/mach-shmobile/setup-r8a7790.c | 1
arch/arm/mach-shmobile/setup-r8a7791.c | 1
arch/arm/mach-shmobile/setup-rcar-gen2.c | 79 +++++++++++++++++++++++
4 files changed, 82 insertions(+)
--- 0001/arch/arm/mach-shmobile/include/mach/rcar-gen2.h
+++ work/arch/arm/mach-shmobile/include/mach/rcar-gen2.h 2014-06-09 20:51:34.000000000 +0900
@@ -4,5 +4,6 @@
void rcar_gen2_timer_init(void);
#define MD(nr) BIT(nr)
u32 rcar_gen2_read_mode_pins(void);
+void rcar_gen2_reserve(void);
#endif /* __ASM_RCAR_GEN2_H__ */
--- 0001/arch/arm/mach-shmobile/setup-r8a7790.c
+++ work/arch/arm/mach-shmobile/setup-r8a7790.c 2014-06-09 21:02:30.000000000 +0900
@@ -319,6 +319,7 @@ DT_MACHINE_START(R8A7790_DT, "Generic R8
.init_early = shmobile_init_delay,
.init_time = rcar_gen2_timer_init,
.init_late = shmobile_init_late,
+ .reserve = rcar_gen2_reserve,
.dt_compat = r8a7790_boards_compat_dt,
MACHINE_END
#endif /* CONFIG_USE_OF */
--- 0001/arch/arm/mach-shmobile/setup-r8a7791.c
+++ work/arch/arm/mach-shmobile/setup-r8a7791.c 2014-06-09 21:02:37.000000000 +0900
@@ -218,6 +218,7 @@ DT_MACHINE_START(R8A7791_DT, "Generic R8
.init_early = shmobile_init_delay,
.init_time = rcar_gen2_timer_init,
.init_late = shmobile_init_late,
+ .reserve = rcar_gen2_reserve,
.dt_compat = r8a7791_boards_compat_dt,
MACHINE_END
#endif /* CONFIG_USE_OF */
--- 0001/arch/arm/mach-shmobile/setup-rcar-gen2.c
+++ work/arch/arm/mach-shmobile/setup-rcar-gen2.c 2014-06-09 21:01:33.000000000 +0900
@@ -20,8 +20,11 @@
#include <linux/clk/shmobile.h>
#include <linux/clocksource.h>
+#include <linux/device.h>
+#include <linux/dma-contiguous.h>
#include <linux/io.h>
#include <linux/kernel.h>
+#include <linux/of_fdt.h>
#include <mach/common.h>
#include <mach/rcar-gen2.h>
#include <asm/mach/arch.h>
@@ -110,3 +113,79 @@ void __init rcar_gen2_timer_init(void)
#endif
clocksource_of_init();
}
+
+struct memory_reserve_config {
+ u64 reserved;
+ u64 base, size;
+};
+
+static int __init rcar_gen2_scan_mem(unsigned long node, const char *uname,
+ int depth, void *data)
+{
+ char *type = of_get_flat_dt_prop(node, "device_type", NULL);
+ __be32 *reg, *endp;
+ unsigned long l;
+ struct memory_reserve_config *mrc = data;
+ u64 lpae_start = (u64)1 << 32;
+
+ /* We are scanning "memory" nodes only */
+ if (type = NULL) {
+ /*
+ * The longtrail doesn't have a device_type on the
+ * /memory node, so look for the node called /memory@0.
+ */
+ if (depth != 1 || strcmp(uname, "memory@0") != 0)
+ return 0;
+ } else if (strcmp(type, "memory") != 0)
+ return 0;
+
+ reg = of_get_flat_dt_prop(node, "linux,usable-memory", &l);
+ if (reg = NULL)
+ reg = of_get_flat_dt_prop(node, "reg", &l);
+ if (reg = NULL)
+ return 0;
+
+ endp = reg + (l / sizeof(__be32));
+ while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) {
+ u64 base, size;
+
+ base = dt_mem_next_cell(dt_root_addr_cells, ®);
+ size = dt_mem_next_cell(dt_root_size_cells, ®);
+
+ if (base >= lpae_start)
+ continue;
+
+ if ((base + size) >= lpae_start)
+ size = lpae_start - base;
+
+ if (size < mrc->reserved)
+ continue;
+
+ if (base < mrc->base)
+ continue;
+
+ /* keep the area at top near the 32-bit legacy limit */
+ mrc->base = base + size - mrc->reserved;
+ mrc->size = mrc->reserved;
+ }
+
+ return 0;
+}
+
+struct cma *rcar_gen2_dma_contiguous;
+
+void __init rcar_gen2_reserve(void)
+{
+ struct memory_reserve_config mrc;
+
+ /* reserve 256 MiB at the top of the physical legacy 32-bit space */
+ memset(&mrc, 0, sizeof(mrc));
+ mrc.reserved = SZ_256M;
+
+ of_scan_flat_dt(rcar_gen2_scan_mem, &mrc);
+#ifdef CONFIG_DMA_CMA
+ if (mrc.size)
+ dma_contiguous_reserve_area(mrc.size, mrc.base, 0,
+ &rcar_gen2_dma_contiguous);
+#endif
+}
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 01/02] ARM: shmobile: Add shared R-Car Gen2 CMA reservation code
2014-03-06 3:28 ` Magnus Damm
` (2 preceding siblings ...)
(?)
@ 2014-06-10 7:19 ` Geert Uytterhoeven
-1 siblings, 0 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2014-06-10 7:19 UTC (permalink / raw)
To: linux-sh
Hi Magnus,
On Mon, Jun 9, 2014 at 2:38 PM, Magnus Damm <magnus.damm@gmail.com> wrote:
> --- 0001/arch/arm/mach-shmobile/setup-rcar-gen2.c
> +++ work/arch/arm/mach-shmobile/setup-rcar-gen2.c 2014-06-09 21:01:33.000000000 +0900
> +static int __init rcar_gen2_scan_mem(unsigned long node, const char *uname,
> + int depth, void *data)
> +{
> + u64 lpae_start = (u64)1 << 32;
Casts are evil:
1ULL << 32
(I hope one day gcc will gain a "-Wcast" option, so we can easily find and
inspect all casts, as C-style casts are much more difficult to grep for than
C++-style casts).
> + /* We are scanning "memory" nodes only */
> + if (type = NULL) {
> + /*
> + * The longtrail doesn't have a device_type on the
> + * /memory node, so look for the node called /memory@0.
> + */
> + if (depth != 1 || strcmp(uname, "memory@0") != 0)
> + return 0;
AFAIK Open Firmware in the LongTrail does not support plugging in ARM CPUs
in its PPC 603e/604e-compatible CPU socket ;-)
> +struct cma *rcar_gen2_dma_contiguous;
> +
> +void __init rcar_gen2_reserve(void)
> +{
> +#ifdef CONFIG_DMA_CMA
> + if (mrc.size)
> + dma_contiguous_reserve_area(mrc.size, mrc.base, 0,
> + &rcar_gen2_dma_contiguous);
> +#endif
I assume one day rcar_gen2_dma_contiguous will become used?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 01/02] ARM: shmobile: Add shared R-Car Gen2 CMA reservation code
2014-03-06 3:28 ` Magnus Damm
` (3 preceding siblings ...)
(?)
@ 2014-06-10 10:51 ` Magnus Damm
-1 siblings, 0 replies; 14+ messages in thread
From: Magnus Damm @ 2014-06-10 10:51 UTC (permalink / raw)
To: linux-sh
Hi Geert,
Thanks for your feedback!
On Tue, Jun 10, 2014 at 4:19 PM, Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
> Hi Magnus,
>
> On Mon, Jun 9, 2014 at 2:38 PM, Magnus Damm <magnus.damm@gmail.com> wrote:
>> --- 0001/arch/arm/mach-shmobile/setup-rcar-gen2.c
>> +++ work/arch/arm/mach-shmobile/setup-rcar-gen2.c 2014-06-09 21:01:33.000000000 +0900
>
>> +static int __init rcar_gen2_scan_mem(unsigned long node, const char *uname,
>> + int depth, void *data)
>> +{
>
>> + u64 lpae_start = (u64)1 << 32;
>
> Casts are evil:
>
> 1ULL << 32
>
> (I hope one day gcc will gain a "-Wcast" option, so we can easily find and
> inspect all casts, as C-style casts are much more difficult to grep for than
> C++-style casts).
Oh, right, I totally forgot I added that one. =)
>> + /* We are scanning "memory" nodes only */
>> + if (type = NULL) {
>> + /*
>> + * The longtrail doesn't have a device_type on the
>> + * /memory node, so look for the node called /memory@0.
>> + */
>> + if (depth != 1 || strcmp(uname, "memory@0") != 0)
>> + return 0;
>
> AFAIK Open Firmware in the LongTrail does not support plugging in ARM CPUs
> in its PPC 603e/604e-compatible CPU socket ;-)
You never know - anything is possible with DT. =)
But yes, I get your point - will clean up.
>> +struct cma *rcar_gen2_dma_contiguous;
>> +
>> +void __init rcar_gen2_reserve(void)
>> +{
>
>> +#ifdef CONFIG_DMA_CMA
>> + if (mrc.size)
>> + dma_contiguous_reserve_area(mrc.size, mrc.base, 0,
>> + &rcar_gen2_dma_contiguous);
>> +#endif
>
> I assume one day rcar_gen2_dma_contiguous will become used?
That's the idea, yes!
Since Simon kindly queued this up already I will submit an incremental
fix to deal with the issues that you pointed out.
Cheers,
/ magnus
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 01/02] ARM: shmobile: Add shared R-Car Gen2 CMA reservation code
2014-03-06 3:28 ` Magnus Damm
` (4 preceding siblings ...)
(?)
@ 2014-06-10 23:40 ` Simon Horman
-1 siblings, 0 replies; 14+ messages in thread
From: Simon Horman @ 2014-06-10 23:40 UTC (permalink / raw)
To: linux-sh
On Tue, Jun 10, 2014 at 07:51:38PM +0900, Magnus Damm wrote:
> Hi Geert,
>
> Thanks for your feedback!
>
> On Tue, Jun 10, 2014 at 4:19 PM, Geert Uytterhoeven
> <geert@linux-m68k.org> wrote:
> > Hi Magnus,
> >
> > On Mon, Jun 9, 2014 at 2:38 PM, Magnus Damm <magnus.damm@gmail.com> wrote:
> >> --- 0001/arch/arm/mach-shmobile/setup-rcar-gen2.c
> >> +++ work/arch/arm/mach-shmobile/setup-rcar-gen2.c 2014-06-09 21:01:33.000000000 +0900
> >
> >> +static int __init rcar_gen2_scan_mem(unsigned long node, const char *uname,
> >> + int depth, void *data)
> >> +{
> >
> >> + u64 lpae_start = (u64)1 << 32;
> >
> > Casts are evil:
> >
> > 1ULL << 32
> >
> > (I hope one day gcc will gain a "-Wcast" option, so we can easily find and
> > inspect all casts, as C-style casts are much more difficult to grep for than
> > C++-style casts).
>
> Oh, right, I totally forgot I added that one. =)
>
> >> + /* We are scanning "memory" nodes only */
> >> + if (type = NULL) {
> >> + /*
> >> + * The longtrail doesn't have a device_type on the
> >> + * /memory node, so look for the node called /memory@0.
> >> + */
> >> + if (depth != 1 || strcmp(uname, "memory@0") != 0)
> >> + return 0;
> >
> > AFAIK Open Firmware in the LongTrail does not support plugging in ARM CPUs
> > in its PPC 603e/604e-compatible CPU socket ;-)
>
> You never know - anything is possible with DT. =)
>
> But yes, I get your point - will clean up.
>
> >> +struct cma *rcar_gen2_dma_contiguous;
> >> +
> >> +void __init rcar_gen2_reserve(void)
> >> +{
> >
> >> +#ifdef CONFIG_DMA_CMA
> >> + if (mrc.size)
> >> + dma_contiguous_reserve_area(mrc.size, mrc.base, 0,
> >> + &rcar_gen2_dma_contiguous);
> >> +#endif
> >
> > I assume one day rcar_gen2_dma_contiguous will become used?
>
> That's the idea, yes!
>
> Since Simon kindly queued this up already I will submit an incremental
> fix to deal with the issues that you pointed out.
Thanks. FWIW I quite dislike casts.
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2014-06-10 23:40 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-06 3:28 [PATCH 00/02] ARM: shmobile: Consolidate early delay setup code Magnus Damm
2014-03-06 3:28 ` Magnus Damm
2014-03-06 3:28 ` [PATCH 01/02] ARM: shmobile: Add shared shmobile_init_delay() Magnus Damm
2014-03-06 3:28 ` Magnus Damm
2014-03-07 0:00 ` Simon Horman
2014-03-07 0:00 ` Simon Horman
2014-03-07 1:48 ` Simon Horman
2014-03-07 1:48 ` Simon Horman
2014-06-09 12:38 ` [PATCH 01/02] ARM: shmobile: Add shared R-Car Gen2 CMA reservation code Magnus Damm
2014-06-10 7:19 ` Geert Uytterhoeven
2014-06-10 10:51 ` Magnus Damm
2014-06-10 23:40 ` Simon Horman
2014-03-06 3:28 ` [PATCH 02/02] ARM: shmobile: Use shmobile_init_delay() on r8a7791/Koelsch Magnus Damm
2014-03-06 3:28 ` Magnus Damm
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.