Skip to contentSkip to conversation

Renesas ARM based r8a7740 SoC updates for v3.11

GIT PULL New Simon Horman 7 participants 33 messages May 27, 2013 – Jun 6, 2013

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

Hi Arnd, Hi Olof,

The following changes since commit c7788792a5e7b0d5d7f96d0766b4cb6112d47d75:

Linux 3.10-rc2 (2013-05-20 14:37:38 -0700)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git tags/renesas-soc-r8a7740-for-v3.11

for you to fetch changes up to 0a9e1c1eef2b050a16685952ce20575348b94d5c:

ARM: shmobile: clock-r8a7740: add TPU PWM support (2013-05-27 17:45:27 +0900)

----------------------------------------------------------------
Renesas ARM based r8a7740 SoC updates for v3.11

* Clean-ups from Kuninori Morimoto, Magnus Damm and Laurent Pinchart.
* Extended clock coverage by Bastian Hecht.
* Support for initialising GIC from OF by Bastian Hecht.
* Support for reference DT initialisation by Bastian Hecht. This is used in conjunction with other changes initialise the Armadillo 800 eva board in DT as much as possible.
* Suspend to RAM and CPUIdle support by Bastian Hecht
* Build fix for fallout by Arnd Bergmann from suspend to RAM change.

----------------------------------------------------------------
Arnd Bergmann (1):
ARM: shmobile: fix sleep-r8a7740.S miscompiles

Bastian Hecht (7):
ARM: shmobile: r8a7740: Add interim sh-eth device name to clocks list
ARM: shmobile: r8a7740: Add DT name to clock list for CMT10
ARM: shmobile: r8a7740: Add I2C DT clock names
ARM: shmobile: r8a7740: Add OF support to initialze the GIC
ARM: shmobile: r8a7740: Prepare for reference DT setup
ARM: shmobile: r8a7740: Add Suspend-To-RAM A3SM
ARM: shmobile: r8a7740: Add CPUIdle

Kuninori Morimoto (1):
ARM: shmobile: remove ";" from SH_FIXED_RATIO_CLK*() macro

Laurent Pinchart (2):
ARM: shmobile: r8a7740: Make private clock arrays static
ARM: shmobile: clock-r8a7740: add TPU PWM support

Magnus Damm (1):
ARM: shmobile: r8a7740 pinmux platform device cleanup

 arch/arm/boot/dts/r8a7740.dtsi                |  117 ++++++++++++++++++
 arch/arm/mach-shmobile/Makefile               |    2 +-
 arch/arm/mach-shmobile/clock-r8a7740.c        |   12 +-
 arch/arm/mach-shmobile/cpuidle-r8a7740.c      |   62 ++++++++++
 arch/arm/mach-shmobile/include/mach/clock.h   |    4 +-
 arch/arm/mach-shmobile/include/mach/r8a7740.h |    7 ++
 arch/arm/mach-shmobile/intc-r8a7740.c         |   24 +++-
 arch/arm/mach-shmobile/pm-r8a7740.c           |  165 ++++++++++++++++++++++++-
 arch/arm/mach-shmobile/setup-r8a7740.c        |   78 +++++-------
 arch/arm/mach-shmobile/sleep-r8a7740.S        |   57 +++++++++
 10 files changed, 469 insertions(+), 59 deletions(-)
 create mode 100644 arch/arm/mach-shmobile/cpuidle-r8a7740.c
 create mode 100644 arch/arm/mach-shmobile/sleep-r8a7740.S
#1 lore raw

PATCH 1/12 ARM: shmobile: remove "; " from SH_FIXED_RATIO_CLK*() macro

From: Kuninori Morimoto <[email protected]>

---
 arch/arm/mach-shmobile/include/mach/clock.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-shmobile/include/mach/clock.h +2 -2
index 76ac612..8902044 100644
@@ -24,11 +24,11 @@ struct clk name = {			\
 }
 
 #define SH_FIXED_RATIO_CLK(name, p, r)		\
-static SH_FIXED_RATIO_CLKg(name, p, r);
+static SH_FIXED_RATIO_CLKg(name, p, r)
 
 #define SH_FIXED_RATIO_CLK_SET(name, p, m, d)	\
 	SH_CLK_RATIO(name, m, d);		\
-	SH_FIXED_RATIO_CLK(name, p, name);
+	SH_FIXED_RATIO_CLK(name, p, name)
 
 #define SH_CLK_SET_RATIO(p, m, d)	\
 {			\
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 2/12 ARM: shmobile: r8a7740 pinmux platform device cleanup

In reply to Simon Horman

From: Magnus Damm <[email protected]>

Use DEFINE_RES_MEM() and platform_device_register_simple() to save a couple of lines of code.

---
 arch/arm/mach-shmobile/setup-r8a7740.c |   24 +++++-------------------
 1 file changed, 5 insertions(+), 19 deletions(-)
arch/arm/mach-shmobile/setup-r8a7740.c +5 -19
index 326a4ab..3a6b6fe 100644
@@ -70,29 +70,15 @@ void __init r8a7740_map_io(void)
 }
 
 /* PFC */
-static struct resource r8a7740_pfc_resources[] = {
-	[0] = {
-		.start	= 0xe6050000,
-		.end	= 0xe6057fff,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1] = {
-		.start	= 0xe605800c,
-		.end	= 0xe605802b,
-		.flags	= IORESOURCE_MEM,
-	}
-};
-
-static struct platform_device r8a7740_pfc_device = {
-	.name		= "pfc-r8a7740",
-	.id		= -1,
-	.resource	= r8a7740_pfc_resources,
-	.num_resources	= ARRAY_SIZE(r8a7740_pfc_resources),
+static const struct resource pfc_resources[] = {
+	DEFINE_RES_MEM(0xe6050000, 0x8000),
+	DEFINE_RES_MEM(0xe605800c, 0x0020),
 };
 
 void __init r8a7740_pinmux_init(void)
 {
-	platform_device_register(&r8a7740_pfc_device);
+	platform_device_register_simple("pfc-r8a7740", -1, pfc_resources,
+					ARRAY_SIZE(pfc_resources));
 }
 
 static struct renesas_intc_irqpin_config irqpin0_platform_data = {
Signature · 1 line
1.7.10.4
#3 lore raw

PATCH 3/12 ARM: shmobile: r8a7740: Add interim sh-eth device name to clocks list

In reply to Simon Horman

From: Bastian Hecht <[email protected]>

When we use the ethernet device via DT setup, we need to add it to a lookup list until this is properly handled later in a DT-only fashion.

---
 arch/arm/mach-shmobile/clock-r8a7740.c |    1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-shmobile/clock-r8a7740.c +1 -0
index c0d39aa..5bd8da0 100644
@@ -592,6 +592,7 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_DEV_ID("sh_mmcif",		&mstp_clks[MSTP312]),
 	CLKDEV_DEV_ID("e6bd0000.mmcif",         &mstp_clks[MSTP312]),
 	CLKDEV_DEV_ID("sh-eth",			&mstp_clks[MSTP309]),
+	CLKDEV_DEV_ID("e9a00000.sh-eth",	&mstp_clks[MSTP309]),
 
 	CLKDEV_DEV_ID("sh_mobile_sdhi.2",	&mstp_clks[MSTP415]),
 	CLKDEV_DEV_ID("e6870000.sdhi",          &mstp_clks[MSTP415]),
Signature · 1 line
1.7.10.4
#4 lore raw

PATCH 4/12 ARM: shmobile: r8a7740: Add DT name to clock list for CMT10

In reply to Simon Horman

From: Bastian Hecht <[email protected]>

This adds temporarily the alternative device name to the clock list that is used when booting via Device Tree setup.

---
 arch/arm/mach-shmobile/clock-r8a7740.c |    1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-shmobile/clock-r8a7740.c +1 -0
index 5bd8da0..8fc396a 100644
@@ -582,6 +582,7 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_DEV_ID("e6cc0000.sci",		&mstp_clks[MSTP230]),
 
 	CLKDEV_DEV_ID("sh_cmt.10",		&mstp_clks[MSTP329]),
+	CLKDEV_DEV_ID("e6138010.timer",		&mstp_clks[MSTP329]),
 	CLKDEV_DEV_ID("sh_fsi2",		&mstp_clks[MSTP328]),
 	CLKDEV_DEV_ID("i2c-sh_mobile.1",	&mstp_clks[MSTP323]),
 	CLKDEV_DEV_ID("renesas_usbhs",		&mstp_clks[MSTP320]),
Signature · 1 line
1.7.10.4
#5 lore raw

PATCH 4/12 ARM: shmobile: r8a7740: Add DT name to clock list for CMT10

Hi,

Quoted 27 lines · Simon Horman

From: Bastian Hecht <[email protected]>

This adds temporarily the alternative device name to the clock list that is used when booting via Device Tree setup.

---
 arch/arm/mach-shmobile/clock-r8a7740.c |    1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-shmobile/clock-r8a7740.c +1 -0
index 5bd8da0..8fc396a 100644
@@ -582,6 +582,7 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_DEV_ID("e6cc0000.sci",		&mstp_clks[MSTP230]),
 
 	CLKDEV_DEV_ID("sh_cmt.10",		&mstp_clks[MSTP329]),
+	CLKDEV_DEV_ID("e6138010.timer",		&mstp_clks[MSTP329]),
 	CLKDEV_DEV_ID("sh_fsi2",		&mstp_clks[MSTP328]),
 	CLKDEV_DEV_ID("i2c-sh_mobile.1",	&mstp_clks[MSTP323]),
 	CLKDEV_DEV_ID("renesas_usbhs",		&mstp_clks[MSTP320]),
Signature · 1 line
1.7.10.4

Usually this is instead handled by adding entries to OF_DEV_AUXDATA() to rename the device in the board file. Would you mind doing that instead?

Thanks,

-Olof

#6 lore raw

PATCH 4/12 ARM: shmobile: r8a7740: Add DT name to clock list for CMT10

Quoted 22 lines · Olof Johansson

Hi,

Quoted 19 lines · Simon Horman

From: Bastian Hecht <[email protected]>

This adds temporarily the alternative device name to the clock list that is used when booting via Device Tree setup.

---
 arch/arm/mach-shmobile/clock-r8a7740.c |    1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-shmobile/clock-r8a7740.c +0 -0
index 5bd8da0..8fc396a 100644
@@ -582,6 +582,7 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_DEV_ID("e6cc0000.sci",		&mstp_clks[MSTP230]),
 
Quoted 11 lines
Quoted 8 lines
arch/arm/mach-shmobile/clock-r8a7740.c +1 -0
 	CLKDEV_DEV_ID("sh_cmt.10",		&mstp_clks[MSTP329]),
+	CLKDEV_DEV_ID("e6138010.timer",		&mstp_clks[MSTP329]),
 	CLKDEV_DEV_ID("sh_fsi2",		&mstp_clks[MSTP328]),
 	CLKDEV_DEV_ID("i2c-sh_mobile.1",	&mstp_clks[MSTP323]),
 	CLKDEV_DEV_ID("renesas_usbhs",		&mstp_clks[MSTP320]),
Signature · 1 line
1.7.10.4

Usually this is instead handled by adding entries to OF_DEV_AUXDATA() to rename the device in the board file. Would you mind doing that instead?

Magnus has indicated in the past that he prefers this method over using OF_DEV_AUXDATA() and the above is consistent with other shmobile code.

#7 lore raw

PATCH 4/12 ARM: shmobile: r8a7740: Add DT name to clock list for CMT10

Quoted 35 lines · Simon Horman
Quoted 22 lines · Olof Johansson

Hi,

Quoted 19 lines · Simon Horman

From: Bastian Hecht <[email protected]>

This adds temporarily the alternative device name to the clock list that is used when booting via Device Tree setup.

---
 arch/arm/mach-shmobile/clock-r8a7740.c |    1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-shmobile/clock-r8a7740.c +0 -0
index 5bd8da0..8fc396a 100644
@@ -582,6 +582,7 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_DEV_ID("e6cc0000.sci",		&mstp_clks[MSTP230]),
 
Quoted 11 lines
Quoted 8 lines
arch/arm/mach-shmobile/clock-r8a7740.c +1 -0
 	CLKDEV_DEV_ID("sh_cmt.10",		&mstp_clks[MSTP329]),
+	CLKDEV_DEV_ID("e6138010.timer",		&mstp_clks[MSTP329]),
 	CLKDEV_DEV_ID("sh_fsi2",		&mstp_clks[MSTP328]),
 	CLKDEV_DEV_ID("i2c-sh_mobile.1",	&mstp_clks[MSTP323]),
 	CLKDEV_DEV_ID("renesas_usbhs",		&mstp_clks[MSTP320]),
Signature · 1 line
1.7.10.4

Usually this is instead handled by adding entries to OF_DEV_AUXDATA() to rename the device in the board file. Would you mind doing that instead?

Quoted 3 lines

Magnus has indicated in the past that he prefers this method over using OF_DEV_AUXDATA() and the above is consistent with other shmobile code.

Ho hum. That's 180 degrees opposite to how we've been doing it on all other ARM platforms. :)

Once you guys have clock bindings for device tree, the aliases should be possible to remove. That's where having them as auxdata is useful, since it's just one place and it's also obvious just what clocks and what drivers need aliases on device tree.

Where are you guys at on your plans for getting DT_based clock going? That will sort of indicate just how temporary these clock alaises will be. I'm guessing we'll be living with them for a while though?

-Olof

maintainer
#8 lore raw

PATCH 4/12 ARM: shmobile: r8a7740: Add DT name to clock list for CMT10

Hi Olof,

Quoted 36 lines · Olof Johansson
Quoted 35 lines · Simon Horman
Quoted 33 lines · Olof Johansson

Hi,

Quoted 25 lines · Simon Horman

From: Bastian Hecht <[email protected]>

This adds temporarily the alternative device name to the clock list that is used when booting via Device Tree setup.

---
 arch/arm/mach-shmobile/clock-r8a7740.c |    1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-shmobile/clock-r8a7740.c +1 -1
index 5bd8da0..8fc396a 100644
@@ -582,6 +582,7 @@ static struct clk_lookup lookups[] = {
  CLKDEV_DEV_ID("e6cc0000.sci",           &mstp_clks[MSTP230]),
 
  CLKDEV_DEV_ID("sh_cmt.10",              &mstp_clks[MSTP329]),
+ CLKDEV_DEV_ID("e6138010.timer",         &mstp_clks[MSTP329]),
  CLKDEV_DEV_ID("sh_fsi2",                &mstp_clks[MSTP328]),
  CLKDEV_DEV_ID("i2c-sh_mobile.1",        &mstp_clks[MSTP323]),
  CLKDEV_DEV_ID("renesas_usbhs",          &mstp_clks[MSTP320]),
--
Quoted 2 lines

1.7.10.4

Usually this is instead handled by adding entries to OF_DEV_AUXDATA() to rename the device in the board file. Would you mind doing that instead?

Quoted 6 lines
Quoted 3 lines

Magnus has indicated in the past that he prefers this method over using OF_DEV_AUXDATA() and the above is consistent with other shmobile code.

Ho hum. That's 180 degrees opposite to how we've been doing it on all other ARM platforms. :)

Correct! =) But that is not the only thing! The mach-shmobile implementation style for DT is also different. I guess you've seen other mach-shmobile-specific oddities like the DT -reference boards in parallel with the C version, right?

With mach-shmobile we have deliberately chosen to avoid AUXDATA. The reason for that is that we keep the DT version of a device clean from the beginning so it is kept totally free of platform data while in parallel we also have a regular platform device with platform data for the old legacy C version of board support. Other ARM subarchitectures seem to use DT together with platform data which is a step that we prefer to skip by using a C version and a DT version of board support in parallel. The idea is that we should be able to existing level of support in the C version while incrementally doing development on the DT -reference code. Then drop the C version when the DT version has become good enough. Current blockers are GPIO/PFC DT and common clock framework.

Regarding AUXDATA, I don't really mind using it that much, except that I prefer to not use DT together with platform data. So that's what we've been doing. As for device name conversion with AUXDATA, yes, we could use that, but it turns out that if you're not using platform data then it becomes more verbose line wise compared to just popping in an additional line in the clock lookup like the patch above does. It is already abstracted per-SoC but with AUXDATA i suspect we will have to mix board specific bits with new SoC specific tables.

You can probably find other instances of similar mixed DT names with regular platform device names in various clock lookup tables in mach-shmobile. Of course we will convert them over if that makes your life easier. Personally, due to limited time I'd rather work on other non-cosmetic stuff like getting rid off CONFIG_MEMORY_START and others and also fixing up 64-bit memory that seems broken in the generic ARM kernel.

Quoted 4 lines

Once you guys have clock bindings for device tree, the aliases should be possible to remove. That's where having them as auxdata is useful, since it's just one place and it's also obvious just what clocks and what drivers need aliases on device tree.

I agree that common clocks and DT bindings will make it possible for us to remove these special cases, but from my point of view it is even easier to kill off DT special case names like we already have in clock-r8axxx.c when moving to common clocks (and getting rid of that file) instead of introducing AUXDATA just to remove it soon again.

Quoted 3 lines

Where are you guys at on your plans for getting DT_based clock going? That will sort of indicate just how temporary these clock alaises will be. I'm guessing we'll be living with them for a while though?

I have to deal with LPAE soon according to my todo list. After that I will make sure common clock conversion starts moving. There are many SoCs to convert, so it will have to happen gradually. I doubt we will get any code ready for merge in v3.11, getting some bits into v3.12 is probably possible.

Apart from moving to common clocks and after that adding support for a single multi-subarch kernel binary, is there anything you want us to implement? Anything for v3.11? I'd like to get the memory bits sorted out if possible.

Thanks for your help.

Cheers,

/ magnus

#9 lore raw

PATCH 4/12 ARM: shmobile: r8a7740: Add DT name to clock list for CMT10

Quoted 4 lines · Magnus Damm

With mach-shmobile we have deliberately chosen to avoid AUXDATA. The reason for that is that we keep the DT version of a device clean from the beginning so it is kept totally free of platform data while in parallel we also have a regular platform device with platform data for

Quoted 8 lines

the old legacy C version of board support. Other ARM subarchitectures seem to use DT together with platform data which is a step that we prefer to skip by using a C version and a DT version of board support in parallel. The idea is that we should be able to existing level of support in the C version while incrementally doing development on the DT -reference code. Then drop the C version when the DT version has become good enough. Current blockers are GPIO/PFC DT and common clock framework.

I think this makes sense and you we shouldn't force you as the platform maintainer to do it the other way. Incrementally removing the auxdata and platform_data structures as most platforms do is nice in the sense that it allows you to have a fully working system booting with DT from the start and to reduce the amount of code as early as possible, and for instance this has worked rather well on kirkwood/orion/dove/mvebu.

The price for that method is that you end up having to coordinate patches carefully between subsystems so you first add DT support to a driver, and then atomically change the dts file and the board file to the method. With your way, you can avoid a lot of the trouble we've seen on other platforms with complex dependency graphs or broken bisection.

Quoted 10 lines
Quoted 3 lines

Where are you guys at on your plans for getting DT_based clock going? That will sort of indicate just how temporary these clock alaises will be. I'm guessing we'll be living with them for a while though?

I have to deal with LPAE soon according to my todo list. After that I will make sure common clock conversion starts moving. There are many SoCs to convert, so it will have to happen gradually. I doubt we will get any code ready for merge in v3.11, getting some bits into v3.12 is probably possible.

Quoted 4 lines

Apart from moving to common clocks and after that adding support for a single multi-subarch kernel binary, is there anything you want us to implement? Anything for v3.11? I'd like to get the memory bits sorted out if possible.

My preference would be if you can get CONFIG_MULTIPLATFORM to work on as many of your SoCs as possible, but that depends on having at least some support for COMMON_CLK.

Arnd

#10 lore raw

PATCH 4/12 ARM: shmobile: r8a7740: Add DT name to clock list for CMT10

Quoted 21 lines · Arnd Bergmann
Quoted 4 lines · Magnus Damm

With mach-shmobile we have deliberately chosen to avoid AUXDATA. The reason for that is that we keep the DT version of a device clean from the beginning so it is kept totally free of platform data while in parallel we also have a regular platform device with platform data for

Quoted 8 lines

the old legacy C version of board support. Other ARM subarchitectures seem to use DT together with platform data which is a step that we prefer to skip by using a C version and a DT version of board support in parallel. The idea is that we should be able to existing level of support in the C version while incrementally doing development on the DT -reference code. Then drop the C version when the DT version has become good enough. Current blockers are GPIO/PFC DT and common clock framework.

I think this makes sense and you we shouldn't force you as the platform maintainer to do it the other way. Incrementally removing the auxdata and platform_data structures as most platforms do is nice in the sense that it allows you to have a fully working system booting with DT from the start and to reduce the amount of code as early as possible, and for instance this has worked rather well on kirkwood/orion/dove/mvebu.

Quoted 6 lines

The price for that method is that you end up having to coordinate patches carefully between subsystems so you first add DT support to a driver, and then atomically change the dts file and the board file to the method. With your way, you can avoid a lot of the trouble we've seen on other platforms with complex dependency graphs or broken bisection.

Well, or at least you have to add the auxdata table entries as you enable drivers, it doesn't have to be strictly coordinated.

Anyway, that isn't really worth arguing here since it's not relevant to the shmobile case. If doing clocks this way makes more sense for you for now, you should continue with it. Sounds like people are aware of the trade-offs, etc.

Quoted 10 lines
Quoted 10 lines
Quoted 3 lines

Where are you guys at on your plans for getting DT_based clock going? That will sort of indicate just how temporary these clock alaises will be. I'm guessing we'll be living with them for a while though?

I have to deal with LPAE soon according to my todo list. After that I will make sure common clock conversion starts moving. There are many SoCs to convert, so it will have to happen gradually. I doubt we will get any code ready for merge in v3.11, getting some bits into v3.12 is probably possible.

Quoted 8 lines
Quoted 4 lines

Apart from moving to common clocks and after that adding support for a single multi-subarch kernel binary, is there anything you want us to implement? Anything for v3.11? I'd like to get the memory bits sorted out if possible.

My preference would be if you can get CONFIG_MULTIPLATFORM to work on as many of your SoCs as possible, but that depends on having at least some support for COMMON_CLK.

Yep, agreed. Thanks for the update on your plans as well, Magnus.

-Olof

#11 lore raw

PATCH 5/12 ARM: shmobile: r8a7740: Make private clock arrays static

In reply to Simon Horman

From: Laurent Pinchart <[email protected]>

Both clock-r8a7740.c and clock-r8a7790.c define a div4_clks array as non-static. Compiling support for both SoCs thus result in a symbol redefinition. Fix it by defining the arrays as static.

To avoid further similar issues, also define the main_clks as static.

---
 arch/arm/mach-shmobile/clock-r8a7740.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-shmobile/clock-r8a7740.c +2 -2
index 8fc396a..a2a612f 100644
@@ -266,7 +266,7 @@ static struct clk fsiack_clk = {
 static struct clk fsibck_clk = {
 };
 
-struct clk *main_clks[] = {
+static struct clk *main_clks[] = {
 	&extalr_clk,
 	&extal1_clk,
 	&extal2_clk,
@@ -317,7 +317,7 @@ enum {
 	DIV4_NR
 };
 
-struct clk div4_clks[DIV4_NR] = {
+static struct clk div4_clks[DIV4_NR] = {
 	[DIV4_I]	= SH_CLK_DIV4(&pllc1_clk, FRQCRA, 20, 0x6fff, CLK_ENABLE_ON_INIT),
 	[DIV4_ZG]	= SH_CLK_DIV4(&pllc1_clk, FRQCRA, 16, 0x6fff, CLK_ENABLE_ON_INIT),
 	[DIV4_B]	= SH_CLK_DIV4(&pllc1_clk, FRQCRA,  8, 0x6fff, CLK_ENABLE_ON_INIT),
Signature · 1 line
1.7.10.4
#12 lore raw

PATCH 6/12 ARM: shmobile: r8a7740: Add I2C DT clock names

In reply to Simon Horman

From: Bastian Hecht <[email protected]>

Add clock association for i2c0 and i2c1 for the new DT names.

---
 arch/arm/mach-shmobile/clock-r8a7740.c |    2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-shmobile/clock-r8a7740.c +2 -0
index a2a612f..b12c476 100644
@@ -551,6 +551,7 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_DEV_ID("sh_tmu.4",		&mstp_clks[MSTP111]),
 	CLKDEV_DEV_ID("sh_tmu.5",		&mstp_clks[MSTP111]),
 	CLKDEV_DEV_ID("i2c-sh_mobile.0",	&mstp_clks[MSTP116]),
+	CLKDEV_DEV_ID("fff20000.i2c",		&mstp_clks[MSTP116]),
 	CLKDEV_DEV_ID("sh_mobile_lcdc_fb.1",	&mstp_clks[MSTP117]),
 	CLKDEV_DEV_ID("sh_tmu.0",		&mstp_clks[MSTP125]),
 	CLKDEV_DEV_ID("sh_tmu.1",		&mstp_clks[MSTP125]),
@@ -585,6 +586,7 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_DEV_ID("e6138010.timer",		&mstp_clks[MSTP329]),
 	CLKDEV_DEV_ID("sh_fsi2",		&mstp_clks[MSTP328]),
 	CLKDEV_DEV_ID("i2c-sh_mobile.1",	&mstp_clks[MSTP323]),
+	CLKDEV_DEV_ID("e6c20000.i2c",		&mstp_clks[MSTP323]),
 	CLKDEV_DEV_ID("renesas_usbhs",		&mstp_clks[MSTP320]),
 	CLKDEV_DEV_ID("sh_mobile_sdhi.0",	&mstp_clks[MSTP314]),
 	CLKDEV_DEV_ID("e6850000.sdhi",          &mstp_clks[MSTP314]),
Signature · 1 line
1.7.10.4
#13 lore raw

PATCH 6/12 ARM: shmobile: r8a7740: Add I2C DT clock names

Hi,

Quoted 24 lines · Simon Horman

From: Bastian Hecht <[email protected]>

Add clock association for i2c0 and i2c1 for the new DT names.

---
 arch/arm/mach-shmobile/clock-r8a7740.c |    2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-shmobile/clock-r8a7740.c +1 -0
index a2a612f..b12c476 100644
@@ -551,6 +551,7 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_DEV_ID("sh_tmu.4",		&mstp_clks[MSTP111]),
 	CLKDEV_DEV_ID("sh_tmu.5",		&mstp_clks[MSTP111]),
 	CLKDEV_DEV_ID("i2c-sh_mobile.0",	&mstp_clks[MSTP116]),
+	CLKDEV_DEV_ID("fff20000.i2c",		&mstp_clks[MSTP116]),
 	CLKDEV_DEV_ID("sh_mobile_lcdc_fb.1",	&mstp_clks[MSTP117]),
 	CLKDEV_DEV_ID("sh_tmu.0",		&mstp_clks[MSTP125]),
 	CLKDEV_DEV_ID("sh_tmu.1",		&mstp_clks[MSTP125]),

arch/arm/mach-shmobile/clock-r8a7740.c static struct clk_lookup lookups[] = { · line 592

Quoted 7 lines
arch/arm/mach-shmobile/clock-r8a7740.c +1 -0
@@ -585,6 +586,7 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_DEV_ID("e6138010.timer",		&mstp_clks[MSTP329]),
 	CLKDEV_DEV_ID("sh_fsi2",		&mstp_clks[MSTP328]),
 	CLKDEV_DEV_ID("i2c-sh_mobile.1",	&mstp_clks[MSTP323]),
+	CLKDEV_DEV_ID("e6c20000.i2c",		&mstp_clks[MSTP323]),
 	CLKDEV_DEV_ID("renesas_usbhs",		&mstp_clks[MSTP320]),
 	CLKDEV_DEV_ID("sh_mobile_sdhi.0",	&mstp_clks[MSTP314]),
 	CLKDEV_DEV_ID("e6850000.sdhi",          &mstp_clks[MSTP314]),

Same here w.r.t. OF_DEV_AUXDATA().

-Olof

#14 lore raw

PATCH 7/12 ARM: shmobile: r8a7740: Add OF support to initialze the GIC

In reply to Simon Horman

From: Bastian Hecht <[email protected]>

We add a variant to initalize the interrupt controller in case we describe the GIC using the Device Tree and not platform data.

---
 arch/arm/mach-shmobile/include/mach/r8a7740.h |    1 +
 arch/arm/mach-shmobile/intc-r8a7740.c         |   24 ++++++++++++++++++------
 2 files changed, 19 insertions(+), 6 deletions(-)
arch/arm/mach-shmobile/include/mach/r8a7740.h +1 -0
index abdc4d4..19c0423 100644
@@ -534,6 +534,7 @@ enum {
 
 extern void r8a7740_meram_workaround(void);
 extern void r8a7740_init_irq(void);
+extern void r8a7740_init_irq_of(void);
 extern void r8a7740_map_io(void);
 extern void r8a7740_add_early_devices(void);
 extern void r8a7740_add_standard_devices(void);
arch/arm/mach-shmobile/intc-r8a7740.c +18 -6
index b741c84..8871f77 100644
@@ -20,19 +20,15 @@
 
 #include <linux/init.h>
 #include <linux/io.h>
+#include <linux/irqchip.h>
 #include <linux/irqchip/arm-gic.h>
 
-void __init r8a7740_init_irq(void)
+static void __init r8a7740_init_irq_common(void)
 {
-	void __iomem *gic_dist_base = ioremap_nocache(0xc2800000, 0x1000);
-	void __iomem *gic_cpu_base = ioremap_nocache(0xc2000000, 0x1000);
 	void __iomem *intc_prio_base = ioremap_nocache(0xe6900010, 0x10);
 	void __iomem *intc_msk_base = ioremap_nocache(0xe6900040, 0x10);
 	void __iomem *pfc_inta_ctrl = ioremap_nocache(0xe605807c, 0x4);
 
-	/* initialize the Generic Interrupt Controller PL390 r0p0 */
-	gic_init(0, 29, gic_dist_base, gic_cpu_base);
-
 	/* route signals to GIC */
 	iowrite32(0x0, pfc_inta_ctrl);
 
@@ -54,3 +50,19 @@ void __init r8a7740_init_irq(void)
 	iounmap(intc_msk_base);
 	iounmap(pfc_inta_ctrl);
 }
+
+void __init r8a7740_init_irq_of(void)
+{
+	irqchip_init();
+	r8a7740_init_irq_common();
+}
+
+void __init r8a7740_init_irq(void)
+{
+	void __iomem *gic_dist_base = ioremap_nocache(0xc2800000, 0x1000);
+	void __iomem *gic_cpu_base = ioremap_nocache(0xc2000000, 0x1000);
+
+	/* initialize the Generic Interrupt Controller PL390 r0p0 */
+	gic_init(0, 29, gic_dist_base, gic_cpu_base);
+	r8a7740_init_irq_common();
+}
Signature · 1 line
1.7.10.4
#15 lore raw

PATCH 7/12 ARM: shmobile: r8a7740: Add OF support to initialze the GIC

Hi,

Quoted 17 lines · Simon Horman

From: Bastian Hecht <[email protected]>

We add a variant to initalize the interrupt controller in case we describe the GIC using the Device Tree and not platform data.

---
 arch/arm/mach-shmobile/include/mach/r8a7740.h |    1 +
 arch/arm/mach-shmobile/intc-r8a7740.c         |   24 ++++++++++++++++++------
 2 files changed, 19 insertions(+), 6 deletions(-)
arch/arm/mach-shmobile/include/mach/r8a7740.h +0 -0
index abdc4d4..19c0423 100644

arch/arm/mach-shmobile/include/mach/r8a7740.h enum { · line 540

Quoted 7 lines
arch/arm/mach-shmobile/include/mach/r8a7740.h +1 -0
@@ -534,6 +534,7 @@ enum {
 
 extern void r8a7740_meram_workaround(void);
 extern void r8a7740_init_irq(void);
+extern void r8a7740_init_irq_of(void);
 extern void r8a7740_map_io(void);
 extern void r8a7740_add_early_devices(void);
 extern void r8a7740_add_standard_devices(void);

This is not a comment on this patch per se, but this header file should probably be directly under the mach directory instead of under include/mach.

In particular, if/when the shmobile platforms get converted to multiplatform, the header file has to move. And I see that most of these functions are only used locally in that directory anyway.

It'd be nice to see some of that addressed by 3.12 or so, if you have a chance.

-Olof

#16 lore raw

PATCH 8/12 ARM: shmobile: r8a7740: Prepare for reference DT setup

In reply to Simon Horman

From: Bastian Hecht <[email protected]>

We need three steps to prepare for the new Armadillo reference DT board code:
- Split the device list into r8a7740_early_devices used by the old platform data setup (board-armadillo.c) and r8a7740_devices_dt used by both setup variants.
- Introduce new r8a7740_init_delay() to be more flexible about calling shmobile_setup_delay().
- For the generic r8a7740 support, we switch to device tree setup for the GIC, the irqpin devices and the I2C controllers.

This is slightly similar to commit 3b00f9342623a5ebc "ARM: shmobile: sh73a0: Do not use early devices with DT reference"

---
 arch/arm/boot/dts/r8a7740.dtsi                |  117 +++++++++++++++++++++++++
 arch/arm/mach-shmobile/include/mach/r8a7740.h |    2 +
 arch/arm/mach-shmobile/setup-r8a7740.c        |   54 ++++++------
 3 files changed, 148 insertions(+), 25 deletions(-)
arch/arm/boot/dts/r8a7740.dtsi +117 -0
index 798fa35..25dc930 100644
@@ -18,4 +18,121 @@
 			compatible = "arm,cortex-a9";
 		};
 	};
+
+	gic: interrupt-controller at c2800000 {
+		compatible = "arm,cortex-a9-gic";
+		#interrupt-cells = <3>;
+		#address-cells = <1>;
+		interrupt-controller;
+		reg = <0xc2800000 0x1000>,
+		      <0xc2000000 0x1000>;
+	};
+
+	/* irqpin0: IRQ0 - IRQ7 */
+	irqpin0: irqpin at e6900000 {
+		compatible = "renesas,intc-irqpin";
+		#interrupt-cells = <2>;
+		interrupt-controller;
+		reg = <0xe6900000 4>,
+			<0xe6900010 4>,
+			<0xe6900020 1>,
+			<0xe6900040 1>,
+			<0xe6900060 1>;
+		interrupt-parent = <&gic>;
+		interrupts = <0 149 0x4
+			      0 149 0x4
+			      0 149 0x4
+			      0 149 0x4
+			      0 149 0x4
+			      0 149 0x4
+			      0 149 0x4
+			      0 149 0x4>;
+	};
+
+	/* irqpin1: IRQ8 - IRQ15 */
+	irqpin1: irqpin at e6900004 {
+		compatible = "renesas,intc-irqpin";
+		#interrupt-cells = <2>;
+		interrupt-controller;
+		reg = <0xe6900004 4>,
+			<0xe6900014 4>,
+			<0xe6900024 1>,
+			<0xe6900044 1>,
+			<0xe6900064 1>;
+		interrupt-parent = <&gic>;
+		interrupts = <0 149 0x4
+			      0 149 0x4
+			      0 149 0x4
+			      0 149 0x4
+			      0 149 0x4
+			      0 149 0x4
+			      0 149 0x4
+			      0 149 0x4>;
+	};
+
+	/* irqpin2: IRQ16 - IRQ23 */
+	irqpin2: irqpin at e6900008 {
+		compatible = "renesas,intc-irqpin";
+		#interrupt-cells = <2>;
+		interrupt-controller;
+		reg = <0xe6900008 4>,
+			<0xe6900018 4>,
+			<0xe6900028 1>,
+			<0xe6900048 1>,
+			<0xe6900068 1>;
+		interrupt-parent = <&gic>;
+		interrupts = <0 149 0x4
+			      0 149 0x4
+			      0 149 0x4
+			      0 149 0x4
+			      0 149 0x4
+			      0 149 0x4
+			      0 149 0x4
+			      0 149 0x4>;
+	};
+
+	/* irqpin3: IRQ24 - IRQ31 */
+	irqpin3: irqpin at e690000c {
+		compatible = "renesas,intc-irqpin";
+		#interrupt-cells = <2>;
+		interrupt-controller;
+		reg = <0xe690000c 4>,
+			<0xe690001c 4>,
+			<0xe690002c 1>,
+			<0xe690004c 1>,
+			<0xe690006c 1>;
+		interrupt-parent = <&gic>;
+		interrupts = <0 149 0x4
+			      0 149 0x4
+			      0 149 0x4
+			      0 149 0x4
+			      0 149 0x4
+			      0 149 0x4
+			      0 149 0x4
+			      0 149 0x4>;
+	};
+
+	i2c0: i2c at fff20000 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "renesas,rmobile-iic";
+		reg = <0xfff20000 0x425>;
+		interrupt-parent = <&gic>;
+		interrupts = <0 201 0x4
+			      0 202 0x4
+			      0 203 0x4
+			      0 204 0x4>;
+	};
+
+	i2c1: i2c at e6c20000 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "renesas,rmobile-iic";
+		reg = <0xe6c20000 0x425>;
+		interrupt-parent = <&gic>;
+		interrupts = <0 70 0x4
+			      0 71 0x4
+			      0 72 0x4
+			      0 73 0x4>;
+	};
 };
arch/arm/mach-shmobile/include/mach/r8a7740.h +2 -0
index 19c0423..1cf6869 100644
@@ -533,11 +533,13 @@ enum {
 };
 
 extern void r8a7740_meram_workaround(void);
+extern void r8a7740_init_delay(void);
 extern void r8a7740_init_irq(void);
 extern void r8a7740_init_irq_of(void);
 extern void r8a7740_map_io(void);
 extern void r8a7740_add_early_devices(void);
 extern void r8a7740_add_standard_devices(void);
+extern void r8a7740_add_standard_devices_dt(void);
 extern void r8a7740_clock_init(u8 md_ck);
 extern void r8a7740_pinmux_init(void);
 extern void r8a7740_pm_init(void);
arch/arm/mach-shmobile/setup-r8a7740.c +29 -25

100 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#17 lore raw

PATCH 9/12 ARM: shmobile: r8a7740: Add Suspend-To-RAM A3SM

In reply to Simon Horman

From: Bastian Hecht <[email protected]>

We add 2 Suspend to RAM modes:
- A3SM PLL0 on/off: Power domain A3SM that contains the ARM core
and the 2nd level cache with either PLL0 on or off

As the suspend to memory mechanism we use A3SM PLL off. A3SM PLL on is included here too, so CPUIdle can use both power down modes (not included in this patch).

The setup of the SYSC regarding the external IRQs is taken from pm-sh7372.c from Magnus Damm.

---
 arch/arm/mach-shmobile/Makefile               |    2 +-
 arch/arm/mach-shmobile/include/mach/r8a7740.h |    3 +
 arch/arm/mach-shmobile/pm-r8a7740.c           |  164 ++++++++++++++++++++++++-
 arch/arm/mach-shmobile/sleep-r8a7740.S        |   57 +++++++++
 4 files changed, 222 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/mach-shmobile/sleep-r8a7740.S
arch/arm/mach-shmobile/Makefile +1 -1
index 068f1da..0568894 100644
@@ -30,7 +30,7 @@ obj-$(CONFIG_SUSPEND)		+= suspend.o
 obj-$(CONFIG_CPU_IDLE)		+= cpuidle.o
 obj-$(CONFIG_ARCH_SHMOBILE)	+= pm-rmobile.o
 obj-$(CONFIG_ARCH_SH7372)	+= pm-sh7372.o sleep-sh7372.o
-obj-$(CONFIG_ARCH_R8A7740)	+= pm-r8a7740.o
+obj-$(CONFIG_ARCH_R8A7740)	+= pm-r8a7740.o sleep-r8a7740.o
 obj-$(CONFIG_ARCH_R8A7779)	+= pm-r8a7779.o
 obj-$(CONFIG_ARCH_SH73A0)	+= pm-sh73a0.o
 
arch/arm/mach-shmobile/include/mach/r8a7740.h +3 -0
index 1cf6869..5cfe5d9 100644
@@ -543,6 +543,9 @@ extern void r8a7740_add_standard_devices_dt(void);
 extern void r8a7740_clock_init(u8 md_ck);
 extern void r8a7740_pinmux_init(void);
 extern void r8a7740_pm_init(void);
+extern void r8a7740_resume(void);
+extern void r8a7740_shutdown(void);
+extern void r8a7740_enter_a3sm_common(int);
 
 #ifdef CONFIG_PM
 extern void __init r8a7740_init_pm_domains(void);
arch/arm/mach-shmobile/pm-r8a7740.c +161 -3

191 lines not on this page · raw message

arch/arm/mach-shmobile/sleep-r8a7740.S new file +57 -0

57 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#18 lore raw

PATCH 9/12 ARM: shmobile: r8a7740: Add Suspend-To-RAM A3SM

Hi,

Quoted 7 lines · Simon Horman

From: Bastian Hecht <[email protected]>

We add 2 Suspend to RAM modes:
- A3SM PLL0 on/off: Power domain A3SM that contains the ARM core
and the 2nd level cache with either PLL0 on or off

Quoted 8 lines

As the suspend to memory mechanism we use A3SM PLL off. A3SM PLL on is included here too, so CPUIdle can use both power down modes (not included in this patch).

The setup of the SYSC regarding the external IRQs is taken from pm-sh7372.c from Magnus Damm.

Missing S-o-b from you, Simon?

arch/arm/mach-shmobile/sleep-r8a7740.S line 41

Quoted 5 lines
arch/arm/mach-shmobile/sleep-r8a7740.S new file +5 -0
+	.text
+ENTRY(v7_cpu_resume)
+	bl	v7_invalidate_l1
+	b	cpu_resume
+ENDPROC(v7_cpu_resume)

This is a global namespace so it'll conflict with i.MX whenever you multiplatform enable shmobile. Might want to pick a more unique name.

-Olof

#19 lore raw

PATCH 9/12 ARM: shmobile: r8a7740: Add Suspend-To-RAM A3SM

Quoted 14 lines · Olof Johansson

Hi,

Quoted 11 lines · Simon Horman

From: Bastian Hecht <[email protected]>

We add 2 Suspend to RAM modes:
- A3SM PLL0 on/off: Power domain A3SM that contains the ARM core
and the 2nd level cache with either PLL0 on or off

As the suspend to memory mechanism we use A3SM PLL off. A3SM PLL on is included here too, so CPUIdle can use both power down modes (not included in this patch).

Quoted 6 lines
Quoted 4 lines

The setup of the SYSC regarding the external IRQs is taken from pm-sh7372.c from Magnus Damm.

Missing S-o-b from you, Simon?

Oops sorry about that.

Quoted 9 lines

arch/arm/mach-shmobile/sleep-r8a7740.S line 41

Quoted 5 lines
arch/arm/mach-shmobile/sleep-r8a7740.S new file +5 -0
+	.text
+ENTRY(v7_cpu_resume)
+	bl	v7_invalidate_l1
+	b	cpu_resume
+ENDPROC(v7_cpu_resume)

This is a global namespace so it'll conflict with i.MX whenever you multiplatform enable shmobile. Might want to pick a more unique name.

Bastian, could you suggest an alternate name?

#20 lore raw

PATCH 9/12 ARM: shmobile: r8a7740: Add Suspend-To-RAM A3SM

2013/5/28 Simon Horman <[email protected]>:

Quoted 34 lines · Olof Johansson
Quoted 14 lines

Hi,

Quoted 11 lines · Simon Horman

From: Bastian Hecht <[email protected]>

We add 2 Suspend to RAM modes:
- A3SM PLL0 on/off: Power domain A3SM that contains the ARM core
and the 2nd level cache with either PLL0 on or off

As the suspend to memory mechanism we use A3SM PLL off. A3SM PLL on is included here too, so CPUIdle can use both power down modes (not included in this patch).

Quoted 6 lines
Quoted 4 lines

The setup of the SYSC regarding the external IRQs is taken from pm-sh7372.c from Magnus Damm.

Missing S-o-b from you, Simon?

Oops sorry about that.

Quoted 9 lines

arch/arm/mach-shmobile/sleep-r8a7740.S line 41

Quoted 5 lines
arch/arm/mach-shmobile/sleep-r8a7740.S new file +5 -0
+   .text
+ENTRY(v7_cpu_resume)
+   bl      v7_invalidate_l1
+   b       cpu_resume
+ENDPROC(v7_cpu_resume)

This is a global namespace so it'll conflict with i.MX whenever you multiplatform enable shmobile. Might want to pick a more unique name.

Quoted 1 line

Bastian, could you suggest an alternate name?

It should really be a temporary thing, as this should be handled in the generic ARM code. So how about:

r8a7740_cpu_resume()

Cheers,

Bastian

#21 lore raw

PATCH 9/12 ARM: shmobile: r8a7740: Add Suspend-To-RAM A3SM

In reply to Olof Johansson
Quoted 21 lines · Olof Johansson

Hi,

Quoted 7 lines · Simon Horman

From: Bastian Hecht <[email protected]>

We add 2 Suspend to RAM modes:
- A3SM PLL0 on/off: Power domain A3SM that contains the ARM core
and the 2nd level cache with either PLL0 on or off

Quoted 8 lines

As the suspend to memory mechanism we use A3SM PLL off. A3SM PLL on is included here too, so CPUIdle can use both power down modes (not included in this patch).

The setup of the SYSC regarding the external IRQs is taken from pm-sh7372.c from Magnus Damm.

Missing S-o-b from you, Simon?

Quoted 9 lines

arch/arm/mach-shmobile/sleep-r8a7740.S line 41

Quoted 5 lines
arch/arm/mach-shmobile/sleep-r8a7740.S new file +5 -0
+	.text
+ENTRY(v7_cpu_resume)
+	bl	v7_invalidate_l1
+	b	cpu_resume
+ENDPROC(v7_cpu_resume)

This is a global namespace so it'll conflict with i.MX whenever you multiplatform enable shmobile. Might want to pick a more unique name.

I have decided to drop this and related cpuidle and suspend-to-ram patches for r8a7740 after discussion with Magnus.

#22 lore raw

PATCH 9/12 ARM: shmobile: r8a7740: Add Suspend-To-RAM A3SM

Hi Simon,

quite some effort has gone into this patch. People from ARM Ltd. have discussed issues about the shutdown in other threads and I spent quite some time on it. What are the problems? Are we concerned about the stability of our system? The CPUIdle feature shut down my r8a7740 on the Armadillo board more than 1 million times successfully. Further CPUIdle is deselected as default config anyway. And single suspend/resume cycles should be even less problematic.

Thanks,

Bastian

2013/6/4 Simon Horman <[email protected]>:

Quoted 34 lines · Olof Johansson
Quoted 21 lines

Hi,

Quoted 7 lines · Simon Horman

From: Bastian Hecht <[email protected]>

We add 2 Suspend to RAM modes:
- A3SM PLL0 on/off: Power domain A3SM that contains the ARM core
and the 2nd level cache with either PLL0 on or off

Quoted 8 lines

As the suspend to memory mechanism we use A3SM PLL off. A3SM PLL on is included here too, so CPUIdle can use both power down modes (not included in this patch).

The setup of the SYSC regarding the external IRQs is taken from pm-sh7372.c from Magnus Damm.

Missing S-o-b from you, Simon?

Quoted 9 lines

arch/arm/mach-shmobile/sleep-r8a7740.S line 41

Quoted 5 lines
arch/arm/mach-shmobile/sleep-r8a7740.S new file +5 -0
+   .text
+ENTRY(v7_cpu_resume)
+   bl      v7_invalidate_l1
+   b       cpu_resume
+ENDPROC(v7_cpu_resume)

This is a global namespace so it'll conflict with i.MX whenever you multiplatform enable shmobile. Might want to pick a more unique name.

I have decided to drop this and related cpuidle and suspend-to-ram patches for r8a7740 after discussion with Magnus.

#23 lore raw

PATCH 9/12 ARM: shmobile: r8a7740: Add Suspend-To-RAM A3SM

Hi Bastian,

I wasn't implying that I have rejected these patches outright, I apologise if that is the way that I cam across. Rather, that they seem to need a little more work.

* ARM: shmobile: r8a7740: Add CPUIdle

There was some discussion in a different sub-thread that this should be Acked by Rafael and possibly go through his tree. Could you talk with Rafael about his feelings with regards to both of these.

* ARM: shmobile: r8a7740: Add Suspend-To-RAM A3SM

I'm unclear if this is also in Rafael's domain or not, but as it depends on the first patch it seems as well to talk post it to Rafael with the other patch for his consideration.

This patch also seems to have some minor problems.

1. When you repost could you please squash in the fix provided by Arnd as "ARM: shmobile: r8a7740: Add Suspend-To-RAM A3SM".

2. As noticed by Olof, v7_cpu_resume needs a different name. I believe you have already proposed a trivial fix for this.

Quoted 55 lines · Bastian Hecht

Hi Simon,

quite some effort has gone into this patch. People from ARM Ltd. have discussed issues about the shutdown in other threads and I spent quite some time on it. What are the problems? Are we concerned about the stability of our system? The CPUIdle feature shut down my r8a7740 on the Armadillo board more than 1 million times successfully. Further CPUIdle is deselected as default config anyway. And single suspend/resume cycles should be even less problematic.

Thanks,

Bastian

2013/6/4 Simon Horman <[email protected]>:

Quoted 32 lines · Olof Johansson
Quoted 21 lines

Hi,

Quoted 7 lines · Simon Horman

From: Bastian Hecht <[email protected]>

We add 2 Suspend to RAM modes:
- A3SM PLL0 on/off: Power domain A3SM that contains the ARM core
and the 2nd level cache with either PLL0 on or off

Quoted 8 lines

As the suspend to memory mechanism we use A3SM PLL off. A3SM PLL on is included here too, so CPUIdle can use both power down modes (not included in this patch).

The setup of the SYSC regarding the external IRQs is taken from pm-sh7372.c from Magnus Damm.

Missing S-o-b from you, Simon?

Quoted 9 lines

arch/arm/mach-shmobile/sleep-r8a7740.S line 41

Quoted 5 lines
arch/arm/mach-shmobile/sleep-r8a7740.S new file +5 -0
+   .text
+ENTRY(v7_cpu_resume)
+   bl      v7_invalidate_l1
+   b       cpu_resume
+ENDPROC(v7_cpu_resume)

This is a global namespace so it'll conflict with i.MX whenever you multiplatform enable shmobile. Might want to pick a more unique name.

Quoted 2 lines

I have decided to drop this and related cpuidle and suspend-to-ram patches for r8a7740 after discussion with Magnus.

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#24 lore raw

PATCH 10/12 ARM: shmobile: r8a7740: Add CPUIdle

In reply to Simon Horman

From: Bastian Hecht <[email protected]>

We make use of the r8a7740 Suspend To Ram code to plug together a CPUIdle driver.

---
 arch/arm/mach-shmobile/Makefile               |    2 +-
 arch/arm/mach-shmobile/cpuidle-r8a7740.c      |   62 +++++++++++++++++++++++++
 arch/arm/mach-shmobile/include/mach/r8a7740.h |    1 +
 arch/arm/mach-shmobile/pm-r8a7740.c           |    1 +
 4 files changed, 65 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-shmobile/cpuidle-r8a7740.c
arch/arm/mach-shmobile/Makefile +1 -1
index 0568894..2852dcf 100644
@@ -30,7 +30,7 @@ obj-$(CONFIG_SUSPEND)		+= suspend.o
 obj-$(CONFIG_CPU_IDLE)		+= cpuidle.o
 obj-$(CONFIG_ARCH_SHMOBILE)	+= pm-rmobile.o
 obj-$(CONFIG_ARCH_SH7372)	+= pm-sh7372.o sleep-sh7372.o
-obj-$(CONFIG_ARCH_R8A7740)	+= pm-r8a7740.o sleep-r8a7740.o
+obj-$(CONFIG_ARCH_R8A7740)	+= pm-r8a7740.o sleep-r8a7740.o cpuidle-r8a7740.o
 obj-$(CONFIG_ARCH_R8A7779)	+= pm-r8a7779.o
 obj-$(CONFIG_ARCH_SH73A0)	+= pm-sh73a0.o
 
arch/arm/mach-shmobile/cpuidle-r8a7740.c new file +62 -0

62 lines not on this page · raw message

arch/arm/mach-shmobile/include/mach/r8a7740.h +1 -0
index 5cfe5d9..3b538e3 100644
@@ -545,6 +545,7 @@ extern void r8a7740_pinmux_init(void);
 extern void r8a7740_pm_init(void);
 extern void r8a7740_resume(void);
 extern void r8a7740_shutdown(void);
+extern void r8a7740_cpuidle_init(void);
 extern void r8a7740_enter_a3sm_common(int);
 
 #ifdef CONFIG_PM
arch/arm/mach-shmobile/pm-r8a7740.c +1 -0
index fe3c867..2f196bd 100644
@@ -237,4 +237,5 @@ static void r8a7740_suspend_init(void) {}
 void __init r8a7740_pm_init(void)
 {
 	r8a7740_suspend_init();
+	r8a7740_cpuidle_init();
 }
Signature · 1 line
1.7.10.4
#25 lore raw

PATCH 10/12 ARM: shmobile: r8a7740: Add CPUIdle

Quoted 8 lines · Simon Horman

From: Bastian Hecht <[email protected]>

We make use of the r8a7740 Suspend To Ram code to plug together a CPUIdle driver.

---

Shouldn't it go through Rafael's tree ? Or does the patch contains some dependencies on a code only visible in the ARM tree ?

Quoted 111 lines
 arch/arm/mach-shmobile/Makefile               |    2 +-
 arch/arm/mach-shmobile/cpuidle-r8a7740.c      |   62 +++++++++++++++++++++++++
 arch/arm/mach-shmobile/include/mach/r8a7740.h |    1 +
 arch/arm/mach-shmobile/pm-r8a7740.c           |    1 +
 4 files changed, 65 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-shmobile/cpuidle-r8a7740.c
arch/arm/mach-shmobile/Makefile +1 -1
index 0568894..2852dcf 100644
@@ -30,7 +30,7 @@ obj-$(CONFIG_SUSPEND)		+= suspend.o
 obj-$(CONFIG_CPU_IDLE)		+= cpuidle.o
 obj-$(CONFIG_ARCH_SHMOBILE)	+= pm-rmobile.o
 obj-$(CONFIG_ARCH_SH7372)	+= pm-sh7372.o sleep-sh7372.o
-obj-$(CONFIG_ARCH_R8A7740)	+= pm-r8a7740.o sleep-r8a7740.o
+obj-$(CONFIG_ARCH_R8A7740)	+= pm-r8a7740.o sleep-r8a7740.o cpuidle-r8a7740.o
 obj-$(CONFIG_ARCH_R8A7779)	+= pm-r8a7779.o
 obj-$(CONFIG_ARCH_SH73A0)	+= pm-sh73a0.o
 
arch/arm/mach-shmobile/cpuidle-r8a7740.c new file +62 -0
new file mode 100644
index 0000000..48c7a6c
@@ -0,0 +1,62 @@
+/*
+ * CPUIdle code for SoC r8a7740
+ *
+ * Copyright (C) 2013 Bastian Hecht
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+#include <linux/cpuidle.h>
+#include <linux/module.h>
+#include <asm/cpuidle.h>
+#include <mach/common.h>
+#include <mach/r8a7740.h>
+
+#if defined(CONFIG_SUSPEND) && defined(CONFIG_CPU_IDLE)
+static int r8a7740_enter_a3sm_pll_on(struct cpuidle_device *dev,
+					struct cpuidle_driver *drv, int index)
+{
+	r8a7740_enter_a3sm_common(1);
+	return 1;
+}
+
+static int r8a7740_enter_a3sm_pll_off(struct cpuidle_device *dev,
+					struct cpuidle_driver *drv, int index)
+{
+	r8a7740_enter_a3sm_common(0);
+	return 2;
+}
+
+static struct cpuidle_driver r8a7740_cpuidle_driver = {
+	.name			= "r8a7740_cpuidle",
+	.owner			= THIS_MODULE,
+	.en_core_tk_irqen	= 1,
+	.state_count		= 3,
+	.safe_state_index	= 0, /* C1 */
+	.states[0] = ARM_CPUIDLE_WFI_STATE,
+	.states[1] = {
+		.name = "C2",
+		.desc = "A3SM PLL ON",
+		.exit_latency = 40,
+		.target_residency = 30 + 40,
+		.flags = CPUIDLE_FLAG_TIME_VALID,
+		.enter = r8a7740_enter_a3sm_pll_on,
+	},
+	.states[2] = {
+		.name = "C3",
+		.desc = "A3SM PLL OFF",
+		.exit_latency = 120,
+		.target_residency = 30 + 120,
+		.flags = CPUIDLE_FLAG_TIME_VALID,
+		.enter = r8a7740_enter_a3sm_pll_off,
+	},
+};
+
+void r8a7740_cpuidle_init(void)
+{
+	shmobile_cpuidle_set_driver(&r8a7740_cpuidle_driver);
+}
+#else
+void r8a7740_cpuidle_init(void) {}
+#endif
arch/arm/mach-shmobile/include/mach/r8a7740.h +1 -0
index 5cfe5d9..3b538e3 100644
@@ -545,6 +545,7 @@ extern void r8a7740_pinmux_init(void);
 extern void r8a7740_pm_init(void);
 extern void r8a7740_resume(void);
 extern void r8a7740_shutdown(void);
+extern void r8a7740_cpuidle_init(void);
 extern void r8a7740_enter_a3sm_common(int);
 
 #ifdef CONFIG_PM
arch/arm/mach-shmobile/pm-r8a7740.c +1 -0
index fe3c867..2f196bd 100644
@@ -237,4 +237,5 @@ static void r8a7740_suspend_init(void) {}
 void __init r8a7740_pm_init(void)
 {
 	r8a7740_suspend_init();
+	r8a7740_cpuidle_init();
 }
Signature · 5 lines
 <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#26 lore raw

PATCH 10/12 ARM: shmobile: r8a7740: Add CPUIdle

Quoted 6 lines · Daniel Lezcano
Quoted 5 lines · Simon Horman

From: Bastian Hecht <[email protected]>

We make use of the r8a7740 Suspend To Ram code to plug together a CPUIdle driver.

Quoted 6 lines
Quoted 3 lines

---

Shouldn't it go through Rafael's tree ? Or does the patch contains some dependencies on a code only visible in the ARM tree ?

Missing S-o-b from Simon. But this patch clearly builds on the preceding one in the series, so merging them independently might not make much sense. Getting an ack from Rafael would be nice though.

I was going to say that it should probably go under drivers/cpuidle as well, but that just seems silly -- there is practically no code to share with any other platform in this small driver, AND there's not really any subsystem-internal data exposed. So it might just make more sense to keep it under arch/arm instead.

Likewise, looking at the kirkwood and calxeda drivers under drivers/cpuidle, I'm wondering why we thought it was a good idea to merge them there, besides getting caught up in the "nothing can live under arch/arm any more" frenzy.

-Olof

#27 lore raw

PATCH 10/12 ARM: shmobile: r8a7740: Add CPUIdle

Quoted 11 lines · Olof Johansson
Quoted 10 lines · Daniel Lezcano
Quoted 8 lines · Simon Horman

From: Bastian Hecht <[email protected]>

We make use of the r8a7740 Suspend To Ram code to plug together a CPUIdle driver.

---

Quoted 6 lines
Quoted 2 lines

Shouldn't it go through Rafael's tree ? Or does the patch contains some dependencies on a code only visible in the ARM tree ?

Missing S-o-b from Simon. But this patch clearly builds on the preceding one in the series, so merging them independently might not make much sense. Getting an ack from Rafael would be nice though.

I was not suggesting to put the driver in the drivers/cpuidle directory but to merge the driver through Rafael's tree as we decided some weeks ago [1]. Although having the drivers all over the place does not help to consolidate the code, so moving them little by little to drivers/cpuidle makes sense but this is part of another work.

Quoted 9 lines

I was going to say that it should probably go under drivers/cpuidle as well, but that just seems silly -- there is practically no code to share with any other platform in this small driver, AND there's not really any subsystem-internal data exposed. So it might just make more sense to keep it under arch/arm instead.

Likewise, looking at the kirkwood and calxeda drivers under drivers/cpuidle, I'm wondering why we thought it was a good idea to merge them there, besides getting caught up in the "nothing can live under arch/arm any more" frenzy.

Having the drivers in the drivers/cpuidle directory like drivers/cpufreq will help to keep a consistency with the code and a single entry point for upstream and review.

Thanks.
-- Daniel

[1] https://patchwork.kernel.org/patch/2492841/

Signature · 5 lines
 <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#28 lore raw

PATCH 10/12 ARM: shmobile: r8a7740: Add CPUIdle

In reply to Olof Johansson
Quoted 24 lines · Olof Johansson
Quoted 6 lines · Daniel Lezcano
Quoted 5 lines · Simon Horman

From: Bastian Hecht <[email protected]>

We make use of the r8a7740 Suspend To Ram code to plug together a CPUIdle driver.

Quoted 6 lines
Quoted 3 lines

---

Shouldn't it go through Rafael's tree ? Or does the patch contains some dependencies on a code only visible in the ARM tree ?

Missing S-o-b from Simon. But this patch clearly builds on the preceding one in the series, so merging them independently might not make much sense. Getting an ack from Rafael would be nice though.

I was going to say that it should probably go under drivers/cpuidle as well, but that just seems silly -- there is practically no code to share with any other platform in this small driver, AND there's not really any subsystem-internal data exposed. So it might just make more sense to keep it under arch/arm instead.

Quoted 3 lines

Likewise, looking at the kirkwood and calxeda drivers under drivers/cpuidle, I'm wondering why we thought it was a good idea to merge them there, besides getting caught up in the "nothing can live under arch/arm any more" frenzy.

After discussion with Magnus I have decided to drop these changes. We can revisit them for a future release.

#29 lore raw

PATCH 11/12 ARM: shmobile: fix sleep-r8a7740.S miscompiles

In reply to Simon Horman

From: Arnd Bergmann <[email protected]>

The newly added sleep-r8a7740.S file in shmobile does not actually build because of renamed symbols.

---
 arch/arm/mach-shmobile/sleep-r8a7740.S |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-shmobile/sleep-r8a7740.S +2 -2
index 435531b..982eacb 100644
@@ -32,7 +32,7 @@ ENTRY(r8a7740_shutdown)
 wfi_loop:
 	bl	cpu_v7_do_idle
 	b wfi_loop
-ENDPROC(r8a7740)
+ENDPROC(r8a7740_shutdown)
 
 	.text
 ENTRY(v7_cpu_resume)
@@ -53,5 +53,5 @@ ENDPROC(v7_cpu_resume)
 ENTRY(r8a7740_resume)
 	ldr	pc, 1f
 1:	.long	v7_cpu_resume - PAGE_OFFSET + PLAT_PHYS_OFFSET
-ENDPROC(r8a7740_resume_core_standby)
+ENDPROC(r8a7740_resume)
 #endif
Signature · 1 line
1.7.10.4
#30 lore raw

PATCH 12/12 ARM: shmobile: clock-r8a7740: add TPU PWM support

In reply to Simon Horman

From: Laurent Pinchart <[email protected]>

---
 arch/arm/mach-shmobile/clock-r8a7740.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-shmobile/clock-r8a7740.c +3 -1
index b12c476..6ad4640 100644
@@ -461,7 +461,7 @@ enum {
 
 	MSTP329, MSTP328, MSTP323, MSTP320,
 	MSTP314, MSTP313, MSTP312,
-	MSTP309,
+	MSTP309, MSTP304,
 
 	MSTP416, MSTP415, MSTP407, MSTP406,
 
@@ -499,6 +499,7 @@ static struct clk mstp_clks[MSTP_NR] = {
 	[MSTP313] = SH_CLK_MSTP32(&div4_clks[DIV4_HP],	SMSTPCR3, 13, 0), /* SDHI1 */
 	[MSTP312] = SH_CLK_MSTP32(&div4_clks[DIV4_HP],	SMSTPCR3, 12, 0), /* MMC */
 	[MSTP309] = SH_CLK_MSTP32(&div4_clks[DIV4_HP],	SMSTPCR3,  9, 0), /* GEther */
+	[MSTP304] = SH_CLK_MSTP32(&div4_clks[DIV4_CP],	SMSTPCR3,  4, 0), /* TPU0 */
 
 	[MSTP416] = SH_CLK_MSTP32(&div4_clks[DIV4_HP],	SMSTPCR4, 16, 0), /* USBHOST */
 	[MSTP415] = SH_CLK_MSTP32(&div4_clks[DIV4_HP],	SMSTPCR4, 15, 0), /* SDHI2 */
@@ -596,6 +597,7 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_DEV_ID("e6bd0000.mmcif",         &mstp_clks[MSTP312]),
 	CLKDEV_DEV_ID("sh-eth",			&mstp_clks[MSTP309]),
 	CLKDEV_DEV_ID("e9a00000.sh-eth",	&mstp_clks[MSTP309]),
+	CLKDEV_DEV_ID("renesas_tpu_pwm",	&mstp_clks[MSTP304]),
 
 	CLKDEV_DEV_ID("sh_mobile_sdhi.2",	&mstp_clks[MSTP415]),
 	CLKDEV_DEV_ID("e6870000.sdhi",          &mstp_clks[MSTP415]),
Signature · 1 line
1.7.10.4
#31 lore raw
In reply to Simon Horman

Hi Simon,

Quoted 17 lines · Simon Horman

Hi Arnd, Hi Olof,

The following changes since commit c7788792a5e7b0d5d7f96d0766b4cb6112d47d75:

Linux 3.10-rc2 (2013-05-20 14:37:38 -0700)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git tags/renesas-soc-r8a7740-for-v3.11

for you to fetch changes up to 0a9e1c1eef2b050a16685952ce20575348b94d5c:

ARM: shmobile: clock-r8a7740: add TPU PWM support (2013-05-27 17:45:27 +0900)

----------------------------------------------------------------
Renesas ARM based r8a7740 SoC updates for v3.11

Quoted 8 lines

* Clean-ups from Kuninori Morimoto, Magnus Damm and Laurent Pinchart.
* Extended clock coverage by Bastian Hecht.
* Support for initialising GIC from OF by Bastian Hecht.
* Support for reference DT initialisation by Bastian Hecht. This is used in conjunction with other changes initialise the Armadillo 800 eva board in DT as much as possible.
* Suspend to RAM and CPUIdle support by Bastian Hecht
* Build fix for fallout by Arnd Bergmann from suspend to RAM change.

So, looking at this branch, I think you need to reorganize your patches a bit. You seem to have fallen back to the case of only sorting patches by what Renesas SoC they are for, while they are clearly of different kinds such that we would prefer to see them sorted differently for arm-soc.

For example, the fix from Arnd should go in a shared shmobile fixes branch, ideally. Some of the DT initialization should maybe go in a separate (shmobile-shared) DT branch. Clock, suspend/resume and other patches can go in a shared SoC branch across all of shmobile though.

Care to respin? I had a handful of comments on the patches as well, and I'll continue to look at some of the other ones.

Since you'll have to respin, we might as well see the reshuffling into shared shmobile branches, so I'll drop the three merges I had already done of SoC-specific branches. I'll follow up on the ones I claimed to have merged. None had been pushed out anyway.

Regards,

-Olof

#32 lore raw
Quoted 39 lines · Olof Johansson

Hi Simon,

Quoted 17 lines · Simon Horman

Hi Arnd, Hi Olof,

The following changes since commit c7788792a5e7b0d5d7f96d0766b4cb6112d47d75:

Linux 3.10-rc2 (2013-05-20 14:37:38 -0700)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git tags/renesas-soc-r8a7740-for-v3.11

for you to fetch changes up to 0a9e1c1eef2b050a16685952ce20575348b94d5c:

ARM: shmobile: clock-r8a7740: add TPU PWM support (2013-05-27 17:45:27 +0900)

----------------------------------------------------------------
Renesas ARM based r8a7740 SoC updates for v3.11

Quoted 8 lines

* Clean-ups from Kuninori Morimoto, Magnus Damm and Laurent Pinchart.
* Extended clock coverage by Bastian Hecht.
* Support for initialising GIC from OF by Bastian Hecht.
* Support for reference DT initialisation by Bastian Hecht. This is used in conjunction with other changes initialise the Armadillo 800 eva board in DT as much as possible.
* Suspend to RAM and CPUIdle support by Bastian Hecht
* Build fix for fallout by Arnd Bergmann from suspend to RAM change.

So, looking at this branch, I think you need to reorganize your patches a bit. You seem to have fallen back to the case of only sorting patches by what Renesas SoC they are for, while they are clearly of different kinds such that we would prefer to see them sorted differently for arm-soc.

For example, the fix from Arnd should go in a shared shmobile fixes branch, ideally. Some of the DT initialization should maybe go in a separate (shmobile-shared) DT branch. Clock, suspend/resume and other patches can go in a shared SoC branch across all of shmobile though.

Quoted 7 lines

Care to respin? I had a handful of comments on the patches as well, and I'll continue to look at some of the other ones.

Since you'll have to respin, we might as well see the reshuffling into shared shmobile branches, so I'll drop the three merges I had already done of SoC-specific branches. I'll follow up on the ones I claimed to have merged. None had been pushed out anyway.

Sure, I will re-spin and try to re-arange my branches as you describe above.