Discussion:
[GIT PULL] Renesas ARM Based SoC Updates for v4.1
Simon Horman
2015-02-26 06:22:41 UTC
Permalink
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(-)
Simon Horman
2015-02-26 06:22:41 UTC
Permalink
From: Magnus Damm <damm+***@opensource.se>

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 0x440

In 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.

Signed-off-by: Magnus Damm <damm+***@opensource.se>
Tested-by: Geert Uytterhoeven <geert+***@glider.be>
Signed-off-by: Simon Horman <horms+***@verge.net.au>
---
arch/arm/mach-shmobile/setup-rcar-gen2.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c
index d1fa625..8c7ec93 100644
--- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
+++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
@@ -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
--
2.1.4
Simon Horman
2015-02-26 06:22:42 UTC
Permalink
From: Geert Uytterhoeven <geert+***@glider.be>

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.

Signed-off-by: Geert Uytterhoeven <geert+***@glider.be>
Signed-off-by: Simon Horman <horms+***@verge.net.au>
---
arch/arm/mach-shmobile/setup-rcar-gen2.c | 4 ----
1 file changed, 4 deletions(-)

diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c
index 8c7ec93..5d13595 100644
--- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
+++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
@@ -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
--
2.1.4
Simon Horman
2015-02-26 06:22:44 UTC
Permalink
From: Nobuhiro Iwamatsu <***@renesas.com>

This provides information through SOC_BUS to sysfs.
And this moves all on-SoC devices from /sys/devices/platform to
/sys/devices/socX/.

Signed-off-by: Nobuhiro Iwamatsu <***@renesas.com>
Acked-by: Geert Uytterhoeven <geert+***@glider.be>
Signed-off-by: Simon Horman <horms+***@verge.net.au>
---
arch/arm/mach-shmobile/Kconfig | 1 +
arch/arm/mach-shmobile/setup-rcar-gen2.c | 38 ++++++++++++++++++++++++++++----
2 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 2f36c85..a7f5ab5 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -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

diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c
index 6f290a8..9cc2a90 100644
--- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
+++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
@@ -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);
}
--
2.1.4
Arnd Bergmann
2015-02-26 15:53:39 UTC
Permalink
Post by Simon Horman
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(-)
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.
Post by Simon Horman
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();
I would not duplicate that information here. Can you find out the SoC
name from registers and put it here?

ARnd
Simon Horman
2015-02-27 00:52:23 UTC
Permalink
Hi Arnd,
Post by Arnd Bergmann
Post by Simon Horman
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(-)
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.
Could we handle this as follow-up work?
Post by Arnd Bergmann
Post by Simon Horman
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();
I would not duplicate that information here. Can you find out the SoC
name from registers and put it here?
ARnd
Arnd Bergmann
2015-02-27 09:00:04 UTC
Permalink
Post by Simon Horman
Post by Arnd Bergmann
Post by Simon Horman
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(-)
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.
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
Post by Simon Horman
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
Geert Uytterhoeven
2015-02-27 10:41:04 UTC
Permalink
This post might be inappropriate. Click to display it.
Arnd Bergmann
2015-02-27 13:44:08 UTC
Permalink
Post by Geert Uytterhoeven
Post by Arnd Bergmann
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
Simon Horman
2015-03-01 01:52:31 UTC
Permalink
Post by Arnd Bergmann
Post by Simon Horman
Post by Arnd Bergmann
Post by Simon Horman
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(-)
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.
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
Post by Simon Horman
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.

Simon Horman
2015-02-26 06:22:43 UTC
Permalink
From: Nobuhiro Iwamatsu <***@renesas.com>

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.

Signed-off-by: Nobuhiro Iwamatsu <***@renesas.com>
Acked-by: Geert Uytterhoeven <geert+***@glider.be>
Signed-off-by: Simon Horman <horms+***@verge.net.au>
---
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(+)

diff --git a/arch/arm/mach-shmobile/rcar-gen2.h b/arch/arm/mach-shmobile/rcar-gen2.h
index ce53cb5..b232956 100644
--- a/arch/arm/mach-shmobile/rcar-gen2.h
+++ b/arch/arm/mach-shmobile/rcar-gen2.h
@@ -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__ */
diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
index 3a18af4..8d26ab0 100644
--- a/arch/arm/mach-shmobile/setup-r8a7790.c
+++ b/arch/arm/mach-shmobile/setup-r8a7790.c
@@ -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,
diff --git a/arch/arm/mach-shmobile/setup-r8a7791.c b/arch/arm/mach-shmobile/setup-r8a7791.c
index ef8eb3a..c528b0f 100644
--- a/arch/arm/mach-shmobile/setup-r8a7791.c
+++ b/arch/arm/mach-shmobile/setup-r8a7791.c
@@ -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
diff --git a/arch/arm/mach-shmobile/setup-r8a7794.c b/arch/arm/mach-shmobile/setup-r8a7794.c
index d2b0930..eb86656 100644
--- a/arch/arm/mach-shmobile/setup-r8a7794.c
+++ b/arch/arm/mach-shmobile/setup-r8a7794.c
@@ -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,
diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c
index 5d13595..6f290a8 100644
--- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
+++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
@@ -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);
+}
--
2.1.4
Simon Horman
2015-02-26 06:22:45 UTC
Permalink
This post might be inappropriate. Click to display it.
Loading...