Renesas ARM Based SoC Updates for v4.1
Hi Olof, Hi Kevin, Hi Arnd,
Please consider these Renesas ARM based SoC updates for v4.1.
Some of these changes are arguably cleanups and could have been queued up in the soc-cleanups-for-v4.1 branch. However, I am reluctant to reshuffle things between branches at this point.
The following changes since commit c517d838eb7d07bbe9507871fab3931deccff539:
Linux 4.0-rc1 (2015-02-22 18:21:14 -0800)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git tags/renesas-soc-for-v4.1
for you to fetch changes up to 72016d009e6bcf6cb6a289382bfc21185122b22e:
ARM: shmobile: r8a7740: Remove restart callback (2015-02-24 08:02:49 +0900)
----------------------------------------------------------------
Renesas ARM Based SoC Updates for v4.1
* Remove restart callback from r8a7740 SoC
* Add support SOC_BUS to R-Car Gen2
* Expose SoCs revision data for R-Car Gen2
* Remove check for CONFIG_COMMON_CLK from R-Car Gen2 code as it is always set
* Allow R-Car Gen2 platforms to boot with CMA enabled and HIGHMEM disabled
----------------------------------------------------------------
Geert Uytterhoeven (2):
ARM: shmobile: R-Car Gen2: CONFIG_COMMON_CLK is always set
ARM: shmobile: r8a7740: Remove restart callback
Magnus Damm (1):
ARM: shmobile: No R-Car Gen2 CMA reservation when HIGHMEM=n
Nobuhiro Iwamatsu (2):
ARM: shmobile: Add function to get SoCs revision data for R-Car Gen2
ARM: shmobile: Add support SOC_BUS to R-Car Gen2
arch/arm/mach-shmobile/Kconfig | 1 + arch/arm/mach-shmobile/rcar-gen2.h | 1 + arch/arm/mach-shmobile/setup-r8a7740.c | 8 ----- arch/arm/mach-shmobile/setup-r8a7790.c | 1 + arch/arm/mach-shmobile/setup-r8a7791.c | 1 + arch/arm/mach-shmobile/setup-r8a7794.c | 1 + arch/arm/mach-shmobile/setup-rcar-gen2.c | 58 +++++++++++++++++++++++++++++--- 7 files changed, 58 insertions(+), 13 deletions(-)
PATCH 1/5 ARM: shmobile: No R-Car Gen2 CMA reservation when HIGHMEM=n
From: Magnus Damm <[email protected]>
Allow R-Car Gen2 platforms to boot with CMA enabled and HIGHMEM disabled. This patch adds code to check if the R-Car Gen2 specific memory reservation window is included in the kernel memory range or not. When HIGHMEM is disabled the R-Car Gen2 reservation area is outside the kernel memory range and in such case the memory reservation is simply skipped over.
Without this patch the kernel boot hangs when CMA is enabled and HIGHMEM is disabled on the r8a7791 Koelsch hardware platform:
WARNING: CPU: 1 PID: 1 at mm/cma.c:113 cma_init_reserved_areas+0x88/0x1d4()
...
WARNING: CPU: 1 PID: 1 at mm/cma.c:121 cma_init_reserved_areas+0xf8/0x1d4()
...
Unable to handle kernel NULL pointer dereference at virtual address 00000160
pgd = c0003000
[00000160] *pgd=80000040004003, *pmd=00000000
Internal error: Oops: 206 [#1] SMP ARM
Modules linked in:
CPU: 1 PID: 1 Comm: swapper/0 Tainted: G W
3.19.0-rc4-koelsch-01450-g7f9b6075ce12c3ea-dirty #735
Hardware name: Generic R8A7791 (Flattened Device Tree)
task: edc553c0 ti: edc56000 task.ti: edc56000
PC is at set_pfnblock_flags_mask+0x54/0xa0
LR is at 0x440In the current shmobile_defconfig HIGHMEM is enabled while CMA is disabled, so to trigger this the kernel configuration for both CMA and HIGHMEM needs to be adjusted.
--- arch/arm/mach-shmobile/setup-rcar-gen2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-shmobile/setup-rcar-gen2.c +2 -1
@@ -21,6 +21,7 @@#include <linux/dma-contiguous.h> #include <linux/io.h> #include <linux/kernel.h> +#include <linux/memblock.h> #include <linux/of.h> #include <linux/of_fdt.h> #include <asm/mach/arch.h>
@@ -199,7 +200,7 @@ void __init rcar_gen2_reserve(void)of_scan_flat_dt (rcar_gen2_scan_mem, &mrc);#ifdef CONFIG_DMA_CMA -if (mrc.size) +if (mrc.size &&memblock_is_region_memory (mrc.base, mrc.size))dma_contiguous_reserve_area (mrc.size, mrc.base,0 , &rcar_gen2_dma_contiguous, true);#endif
Signature · 1 line
2.1.4
PATCH 2/5 ARM: shmobile: R-Car Gen2: CONFIG_COMMON_CLK is always set
In reply to Simon HormanFrom: Geert Uytterhoeven <[email protected]>
Since commit e042681894b62d60 ("ARM: shmobile: r8a7790: Remove legacy code"), all R-Car Gen2 SoCs are supported by multiplatform kernels only. As CONFIG_COMMON_CLK is always set for multiplatform kernels, we can remove related #ifdefs in code specific to R-Car Gen2 SoCs.
--- arch/arm/mach-shmobile/setup-rcar-gen2.c | 4 ---- 1 file changed, 4 deletions(-)
arch/arm/mach-shmobile/setup-rcar-gen2.c +0 -4
@@ -51,9 +51,7 @@ u32 rcar_gen2_read_mode_pins(void)void __init rcar_gen2_timer_init (void ) { -#if defined(CONFIG_ARM_ARCH_TIMER ) || defined(CONFIG_COMMON_CLK )u32 mode =rcar_gen2_read_mode_pins (); -#endif #ifdef CONFIG_ARM_ARCH_TIMER void __iomem *base;int extal_mhz =0 ;
@@ -129,9 +127,7 @@ void __init rcar_gen2_timer_init(void)iounmap (base);#endif /* CONFIG_ARM_ARCH_TIMER */ -#ifdef CONFIG_COMMON_CLK rcar_gen2_clocks_init (mode); -#endif #ifdef CONFIG_ARCH_SHMOBILE_MULTI clocksource_of_init ();#endif
Signature · 1 line
2.1.4
PATCH 3/5 ARM: shmobile: Add function to get SoCs revision data for R-Car Gen2
In reply to Simon HormanFrom: Nobuhiro Iwamatsu <[email protected]>
SoCs of R-Car Gen2 have some revision. This adds function to get SoCs revision data, and change so that user can confirm from /proc/cpuinfo.
--- arch/arm/mach-shmobile/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-r8a7794.c | 1 + arch/arm/mach-shmobile/setup-rcar-gen2.c | 21 +++++++++++++++++++++ 5 files changed, 25 insertions(+)
arch/arm/mach-shmobile/rcar-gen2.h +1 -0
@@ -5,5 +5,6 @@ void rcar_gen2_timer_init(void);#define MD (nr) BIT(nr)u32 rcar_gen2_read_mode_pins (void );void rcar_gen2_reserve (void ); +void __init rcar_gen2_init_machine (void );#endif /* __ASM_RCAR_GEN2_H__ */
arch/arm/mach-shmobile/setup-r8a7790.c +1 -0
@@ -30,6 +30,7 @@ static const char * const r8a7790_boards_compat_dt[] __initconst = {DT_MACHINE_START (R8A7790_DT ,"Generic R8A7790 (Flattened Device Tree)" ) .smp = smp_ops(r8a7790_smp_ops), .init_early = shmobile_init_delay, + .init_machine = rcar_gen2_init_machine, .init_time = rcar_gen2_timer_init, .init_late = shmobile_init_late, .reserve = rcar_gen2_reserve,
arch/arm/mach-shmobile/setup-r8a7791.c +1 -0
@@ -33,6 +33,7 @@ DT_MACHINE_START(R8A7791_DT, "Generic R8A7791 (Flattened Device Tree)") .init_early = shmobile_init_delay, .init_time = rcar_gen2_timer_init, .init_late = shmobile_init_late, + .init_machine = rcar_gen2_init_machine, .reserve = rcar_gen2_reserve, .dt_compat = r8a7791_boards_compat_dt,MACHINE_END
arch/arm/mach-shmobile/setup-r8a7794.c +1 -0
@@ -27,6 +27,7 @@ static const char * const r8a7794_boards_compat_dt[] __initconst = {DT_MACHINE_START (R8A7794_DT ,"Generic R8A7794 (Flattened Device Tree)" ) .init_early = shmobile_init_delay, .init_late = shmobile_init_late, + .init_machine = rcar_gen2_init_machine, .init_time = rcar_gen2_timer_init, .reserve = rcar_gen2_reserve, .dt_compat = r8a7794_boards_compat_dt,
arch/arm/mach-shmobile/setup-rcar-gen2.c +21 -0
@@ -4,6 +4,7 @@* Copyright (C) 2013 Renesas Solutions Corp. * Copyright (C) 2013 Magnus Damm * Copyright (C) 2014 Ulrich Hecht +* Copyright (C) 2015 Nobuhiro Iwamatsu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -24,6 +25,8 @@#include <linux/memblock.h> #include <linux/of.h> #include <linux/of_fdt.h> +#include <linux/of_platform.h> +#include <asm/system_info.h> #include <asm/mach/arch.h> #include "common.h" #include "rcar-gen2.h"
@@ -201,3 +204,21 @@ void __init rcar_gen2_reserve(void) &rcar_gen2_dma_contiguous, true);#endif } + +#define PRR 0xFF000044 +static unsigned int __init rcar_gen2_get_cut (void ) +{ +void __iomem *addr =ioremap_nocache (PRR ,4 ); +u32 data =ioread32 (addr); + +iounmap (addr); + +return (data &0xFF ) +0x10 ; +} + +void __init rcar_gen2_init_machine (void ) +{ + system_rev =rcar_gen2_get_cut (); + +of_platform_populate (NULL , of_default_bus_match_table,NULL ,NULL ); +}
Signature · 1 line
2.1.4
PATCH 4/5 ARM: shmobile: Add support SOC_BUS to R-Car Gen2
In reply to Simon HormanFrom: Nobuhiro Iwamatsu <[email protected]>
This provides information through SOC_BUS to sysfs. And this moves all on-SoC devices from /sys/devices/platform to /sys/devices/socX/.
--- arch/arm/mach-shmobile/Kconfig | 1 + arch/arm/mach-shmobile/setup-rcar-gen2.c | 38 ++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-)
arch/arm/mach-shmobile/Kconfig +1 -0
@@ -19,6 +19,7 @@ config ARCH_RCAR_GEN2 bool select PM_RCAR if PM || SMP select RENESAS_IRQC + select SOC_BUS select SYS_SUPPORTS_SH_CMT select PCI_DOMAINS if PCI
arch/arm/mach-shmobile/setup-rcar-gen2.c +34 -4
@@ -26,6 +26,8 @@#include <linux/of.h> #include <linux/of_fdt.h> #include <linux/of_platform.h> +#include <linux/slab.h> +#include <linux/sys_soc.h> #include <asm/system_info.h> #include <asm/mach/arch.h> #include "common.h"
@@ -206,19 +208,47 @@ void __init rcar_gen2_reserve(void) }#define PRR 0xFF000044 -static unsigned int __init rcar_gen2_get_cut (void ) +static u32 __init rcar_gen2_get_prr (void ) {void __iomem *addr =ioremap_nocache (PRR ,4 );u32 data =ioread32 (addr);iounmap (addr); -return (data &0xFF ) +0x10 ; +return data; }void __init rcar_gen2_init_machine (void ) { - system_rev =rcar_gen2_get_cut (); +struct soc_device_attribute *soc_dev_attr; +struct soc_device *soc_dev; +struct device *parent =NULL ; +u32 prr; + + soc_dev_attr =kzalloc (sizeof (*soc_dev_attr),GFP_KERNEL ); +if (!soc_dev_attr) + goto out; + + prr =rcar_gen2_get_prr (); + system_rev = (prr &0xFF ) +0x10 ; + + soc_dev_attr->machine =of_flat_dt_get_machine_name (); + soc_dev_attr->family =kasprintf (GFP_KERNEL ,"Renesas R-Car Gen2" ); + soc_dev_attr->revision =kasprintf (GFP_KERNEL ,"%u.%u" , + system_rev >>4 , system_rev &0xF ); + soc_dev_attr->soc_id =kasprintf (GFP_KERNEL ,"%04x" , + (prr &0x7F00 ) >>8 ); + + soc_dev =soc_device_register (soc_dev_attr); +if (IS_ERR (soc_dev)) { +kfree (soc_dev_attr->family); +kfree (soc_dev_attr->revision); +kfree (soc_dev_attr->soc_id); +kfree (soc_dev_attr); + goto out; + } -of_platform_populate (NULL , of_default_bus_match_table,NULL ,NULL ); + parent =soc_device_to_device (soc_dev); +out: +of_platform_populate (NULL , of_default_bus_match_table,NULL , parent); }
Signature · 1 line
2.1.4
PATCH 4/5 ARM: shmobile: Add support SOC_BUS to R-Car Gen2
Quoted 6 lines · On Thursday 26 February 2015 15:22:44 Simon Horman wrote:
From: Nobuhiro Iwamatsu <[email protected]>
This provides information through
SOC_BUSto sysfs. And this moves all on-SoC devices from/sys/devices/platformto/sys/devices/socX/.
Quoted 7 lines
Signed-off-by Nobuhiro Iwamatsu <[email protected]>Signed-off-by Simon Horman <[email protected]>--- arch/arm/mach-shmobile/Kconfig | 1 + arch/arm/mach-shmobile/setup-rcar-gen2.c | 38 ++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-)
I think this would be better done as a standalone driver in drivers/soc, to avoid having to add the init_machine callbacks in patch 3.
Quoted 6 lines
void
__initrcar_gen2_init_machine(void)
{arch/arm/mach-shmobile/setup-rcar-gen2.c +3
-1- system_rev =rcar_gen2_get_cut (); +struct soc_device_attribute *soc_dev_attr; +struct soc_device *soc_dev; +struct device *parent =NULL ;
arch/arm/mach-shmobile/setup-rcar-gen2.c void __init rcar_gen2_reserve(void) · line 235
Quoted 10 lines
arch/arm/mach-shmobile/setup-rcar-gen2.c +10
-0+u32 prr; + + soc_dev_attr =kzalloc (sizeof (*soc_dev_attr),GFP_KERNEL ); +if (!soc_dev_attr) + goto out; + + prr =rcar_gen2_get_prr (); + system_rev = (prr &0xFF ) +0x10 ; + + soc_dev_attr->machine =of_flat_dt_get_machine_name ();
I would not duplicate that information here. Can you find out the SoC name from registers and put it here?
ARnd
PATCH 4/5 ARM: shmobile: Add support SOC_BUS to R-Car Gen2
Hi Arnd,
Quoted 15 lines · Arnd Bergmann
Quoted 6 lines · On Thursday 26 February 2015 15:22:44 Simon Horman wrote:
From: Nobuhiro Iwamatsu <[email protected]>
This provides information through
SOC_BUSto sysfs. And this moves all on-SoC devices from/sys/devices/platformto/sys/devices/socX/.Quoted 7 lines
Signed-off-by Nobuhiro Iwamatsu <[email protected]>Signed-off-by Simon Horman <[email protected]>--- arch/arm/mach-shmobile/Kconfig | 1 + arch/arm/mach-shmobile/setup-rcar-gen2.c | 38 ++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-)
Quoted 2 lines
I think this would be better done as a standalone driver in
drivers/soc, to avoid having to add theinit_machinecallbacks in patch 3.
Could we handle this as follow-up work?
Quoted 22 lines
Quoted 6 lines
void
__initrcar_gen2_init_machine(void)
{arch/arm/mach-shmobile/setup-rcar-gen2.c +3
-1- system_rev =rcar_gen2_get_cut (); +struct soc_device_attribute *soc_dev_attr; +struct soc_device *soc_dev; +struct device *parent =NULL ;arch/arm/mach-shmobile/setup-rcar-gen2.c void __init rcar_gen2_reserve(void) · line 235
Quoted 10 lines
arch/arm/mach-shmobile/setup-rcar-gen2.c +10
-0+u32 prr; + + soc_dev_attr =kzalloc (sizeof (*soc_dev_attr),GFP_KERNEL ); +if (!soc_dev_attr) + goto out; + + prr =rcar_gen2_get_prr (); + system_rev = (prr &0xFF ) +0x10 ; + + soc_dev_attr->machine =of_flat_dt_get_machine_name ();I would not duplicate that information here. Can you find out the SoC name from registers and put it here?
ARnd
PATCH 4/5 ARM: shmobile: Add support SOC_BUS to R-Car Gen2
Quoted 17 lines · On Friday 27 February 2015 09:52:23 Simon Horman wrote:
Quoted 15 lines · Arnd Bergmann
Quoted 13 lines · On Thursday 26 February 2015 15:22:44 Simon Horman wrote:
From: Nobuhiro Iwamatsu <[email protected]>
This provides information through
SOC_BUSto sysfs. And this moves all on-SoC devices from/sys/devices/platformto/sys/devices/socX/.Signed-off-by Nobuhiro Iwamatsu <[email protected]>Signed-off-by Simon Horman <[email protected]>--- arch/arm/mach-shmobile/Kconfig | 1 + arch/arm/mach-shmobile/setup-rcar-gen2.c | 38 ++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-)
Quoted 4 lines
Quoted 2 lines
I think this would be better done as a standalone driver in
drivers/soc, to avoid having to add theinit_machinecallbacks in patch 3.Could we handle this as follow-up work?
That was my first idea when I looked at patch 3, but then I had the other comment below:
Quoted 2 lines
I would not duplicate that information here. Can you find out the SoC name from registers and put it here?
We must not introduce the user interface in one kernel and then change it in the next one, so I'm cautious about taking the pull request in the current form. Once we have agreed on what the contents of the sysfs files should be, I can take the patches, and then we are free to move the implementation later.
Arnd
PATCH 4/5 ARM: shmobile: Add support SOC_BUS to R-Car Gen2
Hi Arnd,
Quoted 29 lines · Arnd Bergmann
Quoted 17 lines · On Friday 27 February 2015 09:52:23 Simon Horman wrote:
Quoted 15 lines · Arnd Bergmann
Quoted 13 lines · On Thursday 26 February 2015 15:22:44 Simon Horman wrote:
From: Nobuhiro Iwamatsu <[email protected]>
This provides information through
SOC_BUSto sysfs. And this moves all on-SoC devices from/sys/devices/platformto/sys/devices/socX/.Signed-off-by Nobuhiro Iwamatsu <[email protected]>Signed-off-by Simon Horman <[email protected]>--- arch/arm/mach-shmobile/Kconfig | 1 + arch/arm/mach-shmobile/setup-rcar-gen2.c | 38 ++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-)Quoted 4 lines
Quoted 2 lines
I think this would be better done as a standalone driver in
drivers/soc, to avoid having to add theinit_machinecallbacks in patch 3.Could we handle this as follow-up work?
That was my first idea when I looked at patch 3, but then I had the other comment below:
Quoted 1 line
Quoted 1 line
Quoted 1 line
+
soc_dev_attr->machine=of_flat_dt_get_machine_name();
Quoted 8 lines
Quoted 2 lines
I would not duplicate that information here. Can you find out the SoC name from registers and put it here?
We must not introduce the user interface in one kernel and then change it in the next one, so I'm cautious about taking the pull request in the current form. Once we have agreed on what the contents of the sysfs files should be, I can take the patches, and then we are free to move the implementation later.
Currently machine contains e.g. "Koelsch", which is the name of the board, not of the SoC.
We can derive the SoC name from soc_id, e.g. 0x47 = "R-Car M2-W".
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at 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
PATCH 4/5 ARM: shmobile: Add support SOC_BUS to R-Car Gen2
Quoted 11 lines · On Friday 27 February 2015 11:41:04 Geert Uytterhoeven wrote:
Quoted 5 lines
We must not introduce the user interface in one kernel and then change it in the next one, so I'm cautious about taking the pull request in the current form. Once we have agreed on what the contents of the sysfs files should be, I can take the patches, and then we are free to move the implementation later.
Currently machine contains e.g. "Koelsch", which is the name of the board, not of the SoC.
We can derive the SoC name from
soc_id, e.g.0x47= "R-Car M2-W".
Yes, I think that would be best.
Arnd
PATCH 4/5 ARM: shmobile: Add support SOC_BUS to R-Car Gen2
In reply to Arnd BergmannQuoted 26 lines · Arnd Bergmann
Quoted 17 lines · On Friday 27 February 2015 09:52:23 Simon Horman wrote:
Quoted 15 lines · Arnd Bergmann
Quoted 13 lines · On Thursday 26 February 2015 15:22:44 Simon Horman wrote:
From: Nobuhiro Iwamatsu <[email protected]>
This provides information through
SOC_BUSto sysfs. And this moves all on-SoC devices from/sys/devices/platformto/sys/devices/socX/.Signed-off-by Nobuhiro Iwamatsu <[email protected]>Signed-off-by Simon Horman <[email protected]>--- arch/arm/mach-shmobile/Kconfig | 1 + arch/arm/mach-shmobile/setup-rcar-gen2.c | 38 ++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-)Quoted 4 lines
Quoted 2 lines
I think this would be better done as a standalone driver in
drivers/soc, to avoid having to add theinit_machinecallbacks in patch 3.Could we handle this as follow-up work?
That was my first idea when I looked at patch 3, but then I had the other comment below:
Quoted 8 lines
Quoted 2 lines
I would not duplicate that information here. Can you find out the SoC name from registers and put it here?
We must not introduce the user interface in one kernel and then change it in the next one, so I'm cautious about taking the pull request in the current form. Once we have agreed on what the contents of the sysfs files should be, I can take the patches, and then we are free to move the implementation later.
Thanks for the clarification. Accordingly I'd like to withdraw this pull
request: I will drop these patches.
PATCH 5/5 ARM: shmobile: r8a7740: Remove restart callback
In reply to Simon HormanFrom: Geert Uytterhoeven <[email protected]>
Remove the restart handling hack from the r8a7740 generic multiplatform case.
Restart on DT-based r8a7740 platforms is now handled through the R-Mobile reset driver.
This reverts commit 1174c712afa2779f ("ARM: shmobile: r8a7740: Add restart callback").
--- arch/arm/mach-shmobile/setup-r8a7740.c | 8 -------- 1 file changed, 8 deletions(-)
arch/arm/mach-shmobile/setup-r8a7740.c +0 -8
@@ -842,13 +842,6 @@ static void __init r8a7740_generic_init(void)of_platform_populate (NULL , of_default_bus_match_table,NULL ,NULL ); } -#define RESCNT2 IOMEM(0xe6188020) -static void r8a7740_restart (enum reboot_mode mode,const char *cmd) -{ -/* Do soft power on reset */ -writel (1 <<31 ,RESCNT2 ); -} -static const char *r8a7740_boards_compat_dt[]__initdata = {"renesas,r8a7740" ,NULL ,
@@ -861,7 +854,6 @@ DT_MACHINE_START(R8A7740_DT, "Generic R8A7740 (Flattened Device Tree)") .init_machine = r8a7740_generic_init, .init_late = shmobile_init_late, .dt_compat = r8a7740_boards_compat_dt, - .restart = r8a7740_restart, MACHINE_END#endif /* CONFIG_USE_OF */
Signature · 1 line
2.1.4