* [PATCH 1/8] ARM: shmobile: sh73a0 pinmux platform device cleanup
2013-05-27 9:00 [GIT PULL] Renesas ARM based sh73a0 SoC updates for v3.11 Simon Horman
@ 2013-05-27 9:00 ` Simon Horman
2013-05-27 14:13 ` Sergei Shtylyov
2013-05-27 9:00 ` [PATCH 2/8] ARM: shmobile: sh73a0: add support for adjusting CPU frequency Simon Horman
` (5 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: Simon Horman @ 2013-05-27 9:00 UTC (permalink / raw)
To: linux-arm-kernel
From: Magnus Damm <damm@opensource.se>
Use DEFINE_RES_MEM() and platform_device_register_simple()
to save a couple of lines of code.
Signed-off-by: Magnus Damm <damm@opensource.se>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
arch/arm/mach-shmobile/setup-sh73a0.c | 25 ++++++-------------------
1 file changed, 6 insertions(+), 19 deletions(-)
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index fdf3894..f8f4261 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -61,29 +61,16 @@ void __init sh73a0_map_io(void)
iotable_init(sh73a0_io_desc, ARRAY_SIZE(sh73a0_io_desc));
}
-static struct resource sh73a0_pfc_resources[] = {
- [0] = {
- .start = 0xe6050000,
- .end = 0xe6057fff,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = 0xe605801c,
- .end = 0xe6058027,
- .flags = IORESOURCE_MEM,
- }
-};
-
-static struct platform_device sh73a0_pfc_device = {
- .name = "pfc-sh73a0",
- .id = -1,
- .resource = sh73a0_pfc_resources,
- .num_resources = ARRAY_SIZE(sh73a0_pfc_resources),
+/* PFC */
+static const struct resource pfc_resources[] = {
+ DEFINE_RES_MEM(0xe6050000, 0x8000),
+ DEFINE_RES_MEM(0xe605801c, 0x000c),
};
void __init sh73a0_pinmux_init(void)
{
- platform_device_register(&sh73a0_pfc_device);
+ platform_device_register_simple("pfc-sh73a0", -1, pfc_resources,
+ ARRAY_SIZE(pfc_resources));
}
static struct plat_sci_port scif0_platform_data = {
--
1.7.10.4
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [PATCH 1/8] ARM: shmobile: sh73a0 pinmux platform device cleanup
2013-05-27 9:00 ` [PATCH 1/8] ARM: shmobile: sh73a0 pinmux platform device cleanup Simon Horman
@ 2013-05-27 14:13 ` Sergei Shtylyov
2013-05-28 4:02 ` Olof Johansson
0 siblings, 1 reply; 15+ messages in thread
From: Sergei Shtylyov @ 2013-05-27 14:13 UTC (permalink / raw)
To: linux-arm-kernel
Hello.
On 27-05-2013 13:00, Simon Horman wrote:
> From: Magnus Damm <damm@opensource.se>
> Use DEFINE_RES_MEM() and platform_device_register_simple()
> to save a couple of lines of code.
> Signed-off-by: Magnus Damm <damm@opensource.se>
> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> ---
> arch/arm/mach-shmobile/setup-sh73a0.c | 25 ++++++-------------------
> 1 file changed, 6 insertions(+), 19 deletions(-)
> diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
> index fdf3894..f8f4261 100644
> --- a/arch/arm/mach-shmobile/setup-sh73a0.c
> +++ b/arch/arm/mach-shmobile/setup-sh73a0.c
> @@ -61,29 +61,16 @@ void __init sh73a0_map_io(void)
[...]
> +/* PFC */
> +static const struct resource pfc_resources[] = {
Should have been annotated as __initdata... too late, need another
patch.
> + DEFINE_RES_MEM(0xe6050000, 0x8000),
> + DEFINE_RES_MEM(0xe605801c, 0x000c),
> };
>
> void __init sh73a0_pinmux_init(void)
> {
> - platform_device_register(&sh73a0_pfc_device);
> + platform_device_register_simple("pfc-sh73a0", -1, pfc_resources,
> + ARRAY_SIZE(pfc_resources));
> }
WBR, Sergei
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH 1/8] ARM: shmobile: sh73a0 pinmux platform device cleanup
2013-05-27 14:13 ` Sergei Shtylyov
@ 2013-05-28 4:02 ` Olof Johansson
2013-06-04 5:20 ` Simon Horman
0 siblings, 1 reply; 15+ messages in thread
From: Olof Johansson @ 2013-05-28 4:02 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, May 27, 2013 at 06:13:22PM +0400, Sergei Shtylyov wrote:
> Hello.
>
> On 27-05-2013 13:00, Simon Horman wrote:
>
> >From: Magnus Damm <damm@opensource.se>
>
> >Use DEFINE_RES_MEM() and platform_device_register_simple()
> >to save a couple of lines of code.
>
> >Signed-off-by: Magnus Damm <damm@opensource.se>
> >Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> >Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> >---
> > arch/arm/mach-shmobile/setup-sh73a0.c | 25 ++++++-------------------
> > 1 file changed, 6 insertions(+), 19 deletions(-)
>
> >diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
> >index fdf3894..f8f4261 100644
> >--- a/arch/arm/mach-shmobile/setup-sh73a0.c
> >+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
> >@@ -61,29 +61,16 @@ void __init sh73a0_map_io(void)
> [...]
> >+/* PFC */
> >+static const struct resource pfc_resources[] = {
>
> Should have been annotated as __initdata... too late, need
> another patch.
See comments on other patches/pull requests, I think there's time to revisit
this. I.e. I'll hold off on pulling this based on the other feedback.
-Olof
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH 1/8] ARM: shmobile: sh73a0 pinmux platform device cleanup
2013-05-28 4:02 ` Olof Johansson
@ 2013-06-04 5:20 ` Simon Horman
2013-06-04 13:20 ` Simon Horman
0 siblings, 1 reply; 15+ messages in thread
From: Simon Horman @ 2013-06-04 5:20 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, May 27, 2013 at 09:02:43PM -0700, Olof Johansson wrote:
> On Mon, May 27, 2013 at 06:13:22PM +0400, Sergei Shtylyov wrote:
> > Hello.
> >
> > On 27-05-2013 13:00, Simon Horman wrote:
> >
> > >From: Magnus Damm <damm@opensource.se>
> >
> > >Use DEFINE_RES_MEM() and platform_device_register_simple()
> > >to save a couple of lines of code.
> >
> > >Signed-off-by: Magnus Damm <damm@opensource.se>
> > >Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > >Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> > >---
> > > arch/arm/mach-shmobile/setup-sh73a0.c | 25 ++++++-------------------
> > > 1 file changed, 6 insertions(+), 19 deletions(-)
> >
> > >diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
> > >index fdf3894..f8f4261 100644
> > >--- a/arch/arm/mach-shmobile/setup-sh73a0.c
> > >+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
> > >@@ -61,29 +61,16 @@ void __init sh73a0_map_io(void)
> > [...]
> > >+/* PFC */
> > >+static const struct resource pfc_resources[] = {
> >
> > Should have been annotated as __initdata... too late, need
> > another patch.
>
> See comments on other patches/pull requests, I think there's time to revisit
> this. I.e. I'll hold off on pulling this based on the other feedback.
As I am respining I will fix this.
However, it had been reviewed and I think that ordinarily
it would be reasonable to perform further clean-up
work in a subsequent patch.
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH 1/8] ARM: shmobile: sh73a0 pinmux platform device cleanup
2013-06-04 5:20 ` Simon Horman
@ 2013-06-04 13:20 ` Simon Horman
2013-06-10 12:31 ` Laurent Pinchart
0 siblings, 1 reply; 15+ messages in thread
From: Simon Horman @ 2013-06-04 13:20 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Jun 04, 2013 at 02:20:43PM +0900, Simon Horman wrote:
> On Mon, May 27, 2013 at 09:02:43PM -0700, Olof Johansson wrote:
> > On Mon, May 27, 2013 at 06:13:22PM +0400, Sergei Shtylyov wrote:
> > > Hello.
> > >
> > > On 27-05-2013 13:00, Simon Horman wrote:
> > >
> > > >From: Magnus Damm <damm@opensource.se>
> > >
> > > >Use DEFINE_RES_MEM() and platform_device_register_simple()
> > > >to save a couple of lines of code.
> > >
> > > >Signed-off-by: Magnus Damm <damm@opensource.se>
> > > >Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > >Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> > > >---
> > > > arch/arm/mach-shmobile/setup-sh73a0.c | 25 ++++++-------------------
> > > > 1 file changed, 6 insertions(+), 19 deletions(-)
> > >
> > > >diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
> > > >index fdf3894..f8f4261 100644
> > > >--- a/arch/arm/mach-shmobile/setup-sh73a0.c
> > > >+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
> > > >@@ -61,29 +61,16 @@ void __init sh73a0_map_io(void)
> > > [...]
> > > >+/* PFC */
> > > >+static const struct resource pfc_resources[] = {
> > >
> > > Should have been annotated as __initdata... too late, need
> > > another patch.
> >
> > See comments on other patches/pull requests, I think there's time to revisit
> > this. I.e. I'll hold off on pulling this based on the other feedback.
>
> As I am respining I will fix this.
>
> However, it had been reviewed and I think that ordinarily
> it would be reasonable to perform further clean-up
> work in a subsequent patch.
I decided to simply drop the patch and revisit it later.
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH 1/8] ARM: shmobile: sh73a0 pinmux platform device cleanup
2013-06-04 13:20 ` Simon Horman
@ 2013-06-10 12:31 ` Laurent Pinchart
2013-06-11 4:48 ` Simon Horman
0 siblings, 1 reply; 15+ messages in thread
From: Laurent Pinchart @ 2013-06-10 12:31 UTC (permalink / raw)
To: linux-arm-kernel
Hi Simon,
On Tuesday 04 June 2013 22:20:59 Simon Horman wrote:
> On Tue, Jun 04, 2013 at 02:20:43PM +0900, Simon Horman wrote:
> > On Mon, May 27, 2013 at 09:02:43PM -0700, Olof Johansson wrote:
> > > On Mon, May 27, 2013 at 06:13:22PM +0400, Sergei Shtylyov wrote:
> > > > On 27-05-2013 13:00, Simon Horman wrote:
> > > > >From: Magnus Damm <damm@opensource.se>
> > > > >
> > > > >Use DEFINE_RES_MEM() and platform_device_register_simple()
> > > > >to save a couple of lines of code.
> > > > >
> > > > >Signed-off-by: Magnus Damm <damm@opensource.se>
> > > > >Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > > >Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> > > > >---
> > > > >
> > > > > arch/arm/mach-shmobile/setup-sh73a0.c | 25
> > > > > ++++++-------------------
> > > > > 1 file changed, 6 insertions(+), 19 deletions(-)
> > > > >
> > > > >diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c
> > > > >b/arch/arm/mach-shmobile/setup-sh73a0.c index fdf3894..f8f4261
> > > > >100644
> > > > >--- a/arch/arm/mach-shmobile/setup-sh73a0.c
> > > > >+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
> > > > >@@ -61,29 +61,16 @@ void __init sh73a0_map_io(void)
> > > >
> > > > [...]
> > > >
> > > > >+/* PFC */
> > > > >+static const struct resource pfc_resources[] = {
> > > > >
> > > > Should have been annotated as __initdata... too late, need
> > > >
> > > > another patch.
> > >
> > > See comments on other patches/pull requests, I think there's time to
> > > revisit this. I.e. I'll hold off on pulling this based on the other
> > > feedback.
> >
> > As I am respining I will fix this.
> >
> > However, it had been reviewed and I think that ordinarily
> > it would be reasonable to perform further clean-up
> > work in a subsequent patch.
>
> I decided to simply drop the patch and revisit it later.
This patch (as well as the sh7372 equivalent) is pretty simple. What about
just adding __initdata and resubmitting them ? Otherwise they will get lost.
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH 1/8] ARM: shmobile: sh73a0 pinmux platform device cleanup
2013-06-10 12:31 ` Laurent Pinchart
@ 2013-06-11 4:48 ` Simon Horman
2013-06-19 0:37 ` Laurent Pinchart
0 siblings, 1 reply; 15+ messages in thread
From: Simon Horman @ 2013-06-11 4:48 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Jun 10, 2013 at 02:31:31PM +0200, Laurent Pinchart wrote:
> Hi Simon,
>
> On Tuesday 04 June 2013 22:20:59 Simon Horman wrote:
> > On Tue, Jun 04, 2013 at 02:20:43PM +0900, Simon Horman wrote:
> > > On Mon, May 27, 2013 at 09:02:43PM -0700, Olof Johansson wrote:
> > > > On Mon, May 27, 2013 at 06:13:22PM +0400, Sergei Shtylyov wrote:
> > > > > On 27-05-2013 13:00, Simon Horman wrote:
> > > > > >From: Magnus Damm <damm@opensource.se>
> > > > > >
> > > > > >Use DEFINE_RES_MEM() and platform_device_register_simple()
> > > > > >to save a couple of lines of code.
> > > > > >
> > > > > >Signed-off-by: Magnus Damm <damm@opensource.se>
> > > > > >Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > > > >Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> > > > > >---
> > > > > >
> > > > > > arch/arm/mach-shmobile/setup-sh73a0.c | 25
> > > > > > ++++++-------------------
> > > > > > 1 file changed, 6 insertions(+), 19 deletions(-)
> > > > > >
> > > > > >diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c
> > > > > >b/arch/arm/mach-shmobile/setup-sh73a0.c index fdf3894..f8f4261
> > > > > >100644
> > > > > >--- a/arch/arm/mach-shmobile/setup-sh73a0.c
> > > > > >+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
> > > > > >@@ -61,29 +61,16 @@ void __init sh73a0_map_io(void)
> > > > >
> > > > > [...]
> > > > >
> > > > > >+/* PFC */
> > > > > >+static const struct resource pfc_resources[] = {
> > > > > >
> > > > > Should have been annotated as __initdata... too late, need
> > > > >
> > > > > another patch.
> > > >
> > > > See comments on other patches/pull requests, I think there's time to
> > > > revisit this. I.e. I'll hold off on pulling this based on the other
> > > > feedback.
> > >
> > > As I am respining I will fix this.
> > >
> > > However, it had been reviewed and I think that ordinarily
> > > it would be reasonable to perform further clean-up
> > > work in a subsequent patch.
> >
> > I decided to simply drop the patch and revisit it later.
>
> This patch (as well as the sh7372 equivalent) is pretty simple. What about
> just adding __initdata and resubmitting them ? Otherwise they will get lost.
Sure. I took a look at doing this but with the patch below applied I see:
# make kzm9g_defconfig
# make
In file included from arch/arm/mach-shmobile/setup-sh73a0.c:27:
include/linux/platform_device.h: In function ‘sh73a0_pinmux_init’:
arch/arm/mach-shmobile/setup-sh73a0.c:65: error: pfc_resources causes a section type conflict
From 23ea305bcb4513e33ad636b1c735439993fcff74 Mon Sep 17 00:00:00 2001
From: Magnus Damm <damm@opensource.se>
Date: Mon, 27 May 2013 09:00:45 +0000
Subject: [PATCH] ARM: shmobile: sh73a0 pinmux platform device cleanup
Use DEFINE_RES_MEM() and platform_device_register_simple()
to save a couple of lines of code.
Signed-off-by: Magnus Damm <damm@opensource.se>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[ Annotate pfc_resources with __initdata: causes section missmatch! ]
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
arch/arm/mach-shmobile/setup-sh73a0.c | 25 ++++++-------------------
1 file changed, 6 insertions(+), 19 deletions(-)
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index c5028f1f..7d90eed 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -61,29 +61,16 @@ void __init sh73a0_map_io(void)
iotable_init(sh73a0_io_desc, ARRAY_SIZE(sh73a0_io_desc));
}
-static struct resource sh73a0_pfc_resources[] = {
- [0] = {
- .start = 0xe6050000,
- .end = 0xe6057fff,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = 0xe605801c,
- .end = 0xe6058027,
- .flags = IORESOURCE_MEM,
- }
-};
-
-static struct platform_device sh73a0_pfc_device = {
- .name = "pfc-sh73a0",
- .id = -1,
- .resource = sh73a0_pfc_resources,
- .num_resources = ARRAY_SIZE(sh73a0_pfc_resources),
+/* PFC */
+static const struct resource pfc_resources[] __initdata = {
+ DEFINE_RES_MEM(0xe6050000, 0x8000),
+ DEFINE_RES_MEM(0xe605801c, 0x000c),
};
void __init sh73a0_pinmux_init(void)
{
- platform_device_register(&sh73a0_pfc_device);
+ platform_device_register_simple("pfc-sh73a0", -1, pfc_resources,
+ ARRAY_SIZE(pfc_resources));
}
static struct plat_sci_port scif0_platform_data = {
--
1.8.2.1
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [PATCH 1/8] ARM: shmobile: sh73a0 pinmux platform device cleanup
2013-06-11 4:48 ` Simon Horman
@ 2013-06-19 0:37 ` Laurent Pinchart
0 siblings, 0 replies; 15+ messages in thread
From: Laurent Pinchart @ 2013-06-19 0:37 UTC (permalink / raw)
To: linux-arm-kernel
Hi Simon,
On Tuesday 11 June 2013 13:48:47 Simon Horman wrote:
> On Mon, Jun 10, 2013 at 02:31:31PM +0200, Laurent Pinchart wrote:
> > On Tuesday 04 June 2013 22:20:59 Simon Horman wrote:
> > > On Tue, Jun 04, 2013 at 02:20:43PM +0900, Simon Horman wrote:
> > > > On Mon, May 27, 2013 at 09:02:43PM -0700, Olof Johansson wrote:
> > > > > On Mon, May 27, 2013 at 06:13:22PM +0400, Sergei Shtylyov wrote:
> > > > > > On 27-05-2013 13:00, Simon Horman wrote:
> > > > > > >From: Magnus Damm <damm@opensource.se>
> > > > > > >
> > > > > > >Use DEFINE_RES_MEM() and platform_device_register_simple()
> > > > > > >to save a couple of lines of code.
> > > > > > >
> > > > > > >Signed-off-by: Magnus Damm <damm@opensource.se>
> > > > > > >Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > > > > >Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> > > > > > >---
> > > > > > >
> > > > > > > arch/arm/mach-shmobile/setup-sh73a0.c | 25
> > > > > > > ++++++-------------------
> > > > > > > 1 file changed, 6 insertions(+), 19 deletions(-)
> > > > > > >
> > > > > > >diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c
> > > > > > >b/arch/arm/mach-shmobile/setup-sh73a0.c index fdf3894..f8f4261
> > > > > > >100644
> > > > > > >--- a/arch/arm/mach-shmobile/setup-sh73a0.c
> > > > > > >+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
> > > > > > >@@ -61,29 +61,16 @@ void __init sh73a0_map_io(void)
> > > > > >
> > > > > > [...]
> > > > > >
> > > > > > >+/* PFC */
> > > > > > >+static const struct resource pfc_resources[] = {
> > > > > > >
> > > > > > Should have been annotated as __initdata... too late, need
> > > > > >
> > > > > > another patch.
> > > > >
> > > > > See comments on other patches/pull requests, I think there's time to
> > > > > revisit this. I.e. I'll hold off on pulling this based on the other
> > > > > feedback.
> > > >
> > > > As I am respining I will fix this.
> > > >
> > > > However, it had been reviewed and I think that ordinarily
> > > > it would be reasonable to perform further clean-up
> > > > work in a subsequent patch.
> > >
> > > I decided to simply drop the patch and revisit it later.
> >
> > This patch (as well as the sh7372 equivalent) is pretty simple. What about
> > just adding __initdata and resubmitting them ? Otherwise they will get
> > lost.
>
> Sure. I took a look at doing this but with the patch below applied I see:
>
> # make kzm9g_defconfig
> # make
> In file included from arch/arm/mach-shmobile/setup-sh73a0.c:27:
> include/linux/platform_device.h: In function ‘sh73a0_pinmux_init’:
> arch/arm/mach-shmobile/setup-sh73a0.c:65: error: pfc_resources causes a
> section type conflict
That's strange, I don't get that warning with
$ arm-linux-gnueabihf-gcc --version
arm-linux-gnueabihf-gcc (crosstool-NG linaro-1.13.1-4.7-2013.02-01-20130221 -
Linaro GCC 2013.02) 4.7.3 20130205 (prerelease)
> From 23ea305bcb4513e33ad636b1c735439993fcff74 Mon Sep 17 00:00:00 2001
> From: Magnus Damm <damm@opensource.se>
> Date: Mon, 27 May 2013 09:00:45 +0000
> Subject: [PATCH] ARM: shmobile: sh73a0 pinmux platform device cleanup
>
> Use DEFINE_RES_MEM() and platform_device_register_simple()
> to save a couple of lines of code.
>
> Signed-off-by: Magnus Damm <damm@opensource.se>
> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> [ Annotate pfc_resources with __initdata: causes section missmatch! ]
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> ---
> arch/arm/mach-shmobile/setup-sh73a0.c | 25 ++++++-------------------
> 1 file changed, 6 insertions(+), 19 deletions(-)
>
> diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c
> b/arch/arm/mach-shmobile/setup-sh73a0.c index c5028f1f..7d90eed 100644
> --- a/arch/arm/mach-shmobile/setup-sh73a0.c
> +++ b/arch/arm/mach-shmobile/setup-sh73a0.c
> @@ -61,29 +61,16 @@ void __init sh73a0_map_io(void)
> iotable_init(sh73a0_io_desc, ARRAY_SIZE(sh73a0_io_desc));
> }
>
> -static struct resource sh73a0_pfc_resources[] = {
> - [0] = {
> - .start = 0xe6050000,
> - .end = 0xe6057fff,
> - .flags = IORESOURCE_MEM,
> - },
> - [1] = {
> - .start = 0xe605801c,
> - .end = 0xe6058027,
> - .flags = IORESOURCE_MEM,
> - }
> -};
> -
> -static struct platform_device sh73a0_pfc_device = {
> - .name = "pfc-sh73a0",
> - .id = -1,
> - .resource = sh73a0_pfc_resources,
> - .num_resources = ARRAY_SIZE(sh73a0_pfc_resources),
> +/* PFC */
> +static const struct resource pfc_resources[] __initdata = {
> + DEFINE_RES_MEM(0xe6050000, 0x8000),
> + DEFINE_RES_MEM(0xe605801c, 0x000c),
> };
>
> void __init sh73a0_pinmux_init(void)
> {
> - platform_device_register(&sh73a0_pfc_device);
> + platform_device_register_simple("pfc-sh73a0", -1, pfc_resources,
> + ARRAY_SIZE(pfc_resources));
> }
>
> static struct plat_sci_port scif0_platform_data = {
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 2/8] ARM: shmobile: sh73a0: add support for adjusting CPU frequency
2013-05-27 9:00 [GIT PULL] Renesas ARM based sh73a0 SoC updates for v3.11 Simon Horman
2013-05-27 9:00 ` [PATCH 1/8] ARM: shmobile: sh73a0 pinmux platform device cleanup Simon Horman
@ 2013-05-27 9:00 ` Simon Horman
2013-05-27 9:00 ` [PATCH 3/8] ARM: shmobile: sh73a0: add CPUFreq support Simon Horman
` (4 subsequent siblings)
6 siblings, 0 replies; 15+ messages in thread
From: Simon Horman @ 2013-05-27 9:00 UTC (permalink / raw)
To: linux-arm-kernel
From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
On SH73A0 the output of PLL0 is supplied to two dividers, feeding clock to
the CPU core and SGX. Lower CPU frequencies allow the use of lower supply
voltages and thus reduce power consumption.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
arch/arm/mach-shmobile/clock-sh73a0.c | 95 ++++++++++++++++++++++++++++++++-
1 file changed, 93 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
index 784fbaa..acb9e09 100644
--- a/arch/arm/mach-shmobile/clock-sh73a0.c
+++ b/arch/arm/mach-shmobile/clock-sh73a0.c
@@ -228,6 +228,11 @@ enum { DIV4_I, DIV4_ZG, DIV4_M3, DIV4_B, DIV4_M1, DIV4_M2,
static struct clk div4_clks[DIV4_NR] = {
[DIV4_I] = DIV4(FRQCRA, 20, 0xdff, CLK_ENABLE_ON_INIT),
+ /*
+ * ZG clock is dividing PLL0 frequency to supply SGX. Make sure not to
+ * exceed maximum frequencies of 201.5MHz for VDD_DVFS=1.175 and
+ * 239.2MHz for VDD_DVFS=1.315V.
+ */
[DIV4_ZG] = SH_CLK_DIV4(&pll0_clk, FRQCRA, 16, 0xd7f, CLK_ENABLE_ON_INIT),
[DIV4_M3] = DIV4(FRQCRA, 12, 0x1dff, CLK_ENABLE_ON_INIT),
[DIV4_B] = DIV4(FRQCRA, 8, 0xdff, CLK_ENABLE_ON_INIT),
@@ -252,6 +257,85 @@ static struct clk twd_clk = {
.ops = &twd_clk_ops,
};
+static int (*div4_set_rate)(struct clk *clk, unsigned long rate);
+static unsigned long (*div4_recalc)(struct clk *clk);
+static long (*div4_round_rate)(struct clk *clk, unsigned long rate);
+
+static int zclk_set_rate(struct clk *clk, unsigned long rate)
+{
+ int ret;
+
+ if (!clk->parent || !__clk_get(clk->parent))
+ return -ENODEV;
+
+ if (readl(FRQCRB) & (1 << 31))
+ return -EBUSY;
+
+ if (rate = clk_get_rate(clk->parent)) {
+ /* 1:1 - switch off divider */
+ __raw_writel(__raw_readl(FRQCRB) & ~(1 << 28), FRQCRB);
+ /* nullify the divider to prepare for the next time */
+ ret = div4_set_rate(clk, rate / 2);
+ if (!ret)
+ ret = frqcr_kick();
+ if (ret > 0)
+ ret = 0;
+ } else {
+ /* Enable the divider */
+ __raw_writel(__raw_readl(FRQCRB) | (1 << 28), FRQCRB);
+
+ ret = frqcr_kick();
+ if (ret >= 0)
+ /*
+ * set the divider - call the DIV4 method, it will kick
+ * FRQCRB too
+ */
+ ret = div4_set_rate(clk, rate);
+ if (ret < 0)
+ goto esetrate;
+ }
+
+esetrate:
+ __clk_put(clk->parent);
+ return ret;
+}
+
+static long zclk_round_rate(struct clk *clk, unsigned long rate)
+{
+ unsigned long div_freq = div4_round_rate(clk, rate),
+ parent_freq = clk_get_rate(clk->parent);
+
+ if (rate > div_freq && abs(parent_freq - rate) < rate - div_freq)
+ return parent_freq;
+
+ return div_freq;
+}
+
+static unsigned long zclk_recalc(struct clk *clk)
+{
+ /*
+ * Must recalculate frequencies in case PLL0 has been changed, even if
+ * the divisor is unused ATM!
+ */
+ unsigned long div_freq = div4_recalc(clk);
+
+ if (__raw_readl(FRQCRB) & (1 << 28))
+ return div_freq;
+
+ return clk_get_rate(clk->parent);
+}
+
+static void zclk_extend(void)
+{
+ /* We extend the DIV4 clock with a 1:1 pass-through case */
+ div4_set_rate = div4_clks[DIV4_Z].ops->set_rate;
+ div4_round_rate = div4_clks[DIV4_Z].ops->round_rate;
+ div4_recalc = div4_clks[DIV4_Z].ops->recalc;
+ div4_clks[DIV4_Z].ops->set_rate = zclk_set_rate;
+ div4_clks[DIV4_Z].ops->round_rate = zclk_round_rate;
+ div4_clks[DIV4_Z].ops->recalc = zclk_recalc;
+}
+
enum { DIV6_VCK1, DIV6_VCK2, DIV6_VCK3, DIV6_ZB1,
DIV6_FLCTL, DIV6_SDHI0, DIV6_SDHI1, DIV6_SDHI2,
DIV6_FSIA, DIV6_FSIB, DIV6_SUB,
@@ -450,7 +534,7 @@ static struct clk *late_main_clks[] = {
};
enum { MSTP001,
- MSTP129, MSTP128, MSTP127, MSTP126, MSTP125, MSTP118, MSTP116, MSTP100,
+ MSTP129, MSTP128, MSTP127, MSTP126, MSTP125, MSTP118, MSTP116, MSTP112, MSTP100,
MSTP219, MSTP218, MSTP217,
MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200,
MSTP331, MSTP329, MSTP328, MSTP325, MSTP323, MSTP322,
@@ -471,6 +555,7 @@ static struct clk mstp_clks[MSTP_NR] = {
[MSTP125] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR1, 25, 0), /* TMU0 */
[MSTP118] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 18, 0), /* DSITX0 */
[MSTP116] = MSTP(&div4_clks[DIV4_HP], SMSTPCR1, 16, 0), /* IIC0 */
+ [MSTP112] = MSTP(&div4_clks[DIV4_ZG], SMSTPCR1, 12, 0), /* SGX */
[MSTP100] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */
[MSTP219] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 19, 0), /* SCIFA7 */
[MSTP218] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 18, 0), /* SY-DMAC */
@@ -513,6 +598,9 @@ static struct clk_lookup lookups[] = {
CLKDEV_CON_ID("r_clk", &r_clk),
CLKDEV_DEV_ID("smp_twd", &twd_clk), /* smp_twd */
+ /* DIV4 clocks */
+ CLKDEV_DEV_ID("cpufreq-cpu0", &div4_clks[DIV4_Z]),
+
/* DIV6 clocks */
CLKDEV_CON_ID("vck1_clk", &div6_clks[DIV6_VCK1]),
CLKDEV_CON_ID("vck2_clk", &div6_clks[DIV6_VCK2]),
@@ -604,8 +692,11 @@ void __init sh73a0_clock_init(void)
for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
ret = clk_register(main_clks[k]);
- if (!ret)
+ if (!ret) {
ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table);
+ if (!ret)
+ zclk_extend();
+ }
if (!ret)
ret = sh_clk_div6_reparent_register(div6_clks, DIV6_NR);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH 3/8] ARM: shmobile: sh73a0: add CPUFreq support
2013-05-27 9:00 [GIT PULL] Renesas ARM based sh73a0 SoC updates for v3.11 Simon Horman
2013-05-27 9:00 ` [PATCH 1/8] ARM: shmobile: sh73a0 pinmux platform device cleanup Simon Horman
2013-05-27 9:00 ` [PATCH 2/8] ARM: shmobile: sh73a0: add support for adjusting CPU frequency Simon Horman
@ 2013-05-27 9:00 ` Simon Horman
2013-05-27 9:00 ` [PATCH 5/8] ARM: shmobile: sh73a0: Remove init_irq declaration in machine description Simon Horman
` (3 subsequent siblings)
6 siblings, 0 replies; 15+ messages in thread
From: Simon Horman @ 2013-05-27 9:00 UTC (permalink / raw)
To: linux-arm-kernel
From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
This patch enables the use of the generic cpufreq-cpu0 driver on sh73a0.
Providing a regulator, a list of OPPs in DT, combined with a virtual
cpufreq-cpu0 platform device and a clock, attached to it is everything,
the cpufreq-cpu0 driver needs. The first sh73a0 platform, implementing
such CPUFreq support is kzm9g-reference.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
arch/arm/mach-shmobile/Kconfig | 2 ++
arch/arm/mach-shmobile/setup-sh73a0.c | 5 +++++
2 files changed, 7 insertions(+)
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 1a517e2..7cfb9d1 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -169,6 +169,8 @@ config MACH_KZM9D
config MACH_KZM9G
bool "KZM-A9-GT board"
depends on ARCH_SH73A0
+ select ARCH_HAS_CPUFREQ
+ select ARCH_HAS_OPP
select ARCH_REQUIRE_GPIOLIB
select REGULATOR_FIXED_VOLTAGE if REGULATOR
select SND_SOC_AK4642 if SND_SIMPLE_CARD
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index f8f4261..88e6ea0 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -1003,6 +1003,8 @@ static const struct of_dev_auxdata sh73a0_auxdata_lookup[] __initconst = {
void __init sh73a0_add_standard_devices_dt(void)
{
+ struct platform_device_info devinfo = { .name = "cpufreq-cpu0", .id = -1, };
+
/* clocks are setup late during boot in the case of DT */
sh73a0_clock_init();
@@ -1010,6 +1012,9 @@ void __init sh73a0_add_standard_devices_dt(void)
ARRAY_SIZE(sh73a0_devices_dt));
of_platform_populate(NULL, of_default_bus_match_table,
sh73a0_auxdata_lookup, NULL);
+
+ /* Instantiate cpufreq-cpu0 */
+ platform_device_register_full(&devinfo);
}
static const char *sh73a0_boards_compat_dt[] __initdata = {
--
1.7.10.4
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH 5/8] ARM: shmobile: sh73a0: Remove init_irq declaration in machine description
2013-05-27 9:00 [GIT PULL] Renesas ARM based sh73a0 SoC updates for v3.11 Simon Horman
` (2 preceding siblings ...)
2013-05-27 9:00 ` [PATCH 3/8] ARM: shmobile: sh73a0: add CPUFreq support Simon Horman
@ 2013-05-27 9:00 ` Simon Horman
2013-05-27 9:00 ` [PATCH 6/8] ARM: shmobile: sh73a0: Always use shmobile_setup_delay() Simon Horman
` (2 subsequent siblings)
6 siblings, 0 replies; 15+ messages in thread
From: Simon Horman @ 2013-05-27 9:00 UTC (permalink / raw)
To: linux-arm-kernel
From: Maxime Ripard <maxime.ripard@free-electrons.com>
Commit ebafed7a ("ARM: irq: Call irqchip_init if no init_irq function is
specified") removed the need to explictly setup the init_irq field in
the machine description when using only irqchip_init. Remove that
declaration for shmobile as well.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
arch/arm/mach-shmobile/setup-sh73a0.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index cd81832..9986515 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -22,7 +22,6 @@
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
-#include <linux/irqchip.h>
#include <linux/platform_device.h>
#include <linux/of_platform.h>
#include <linux/delay.h>
@@ -974,7 +973,6 @@ DT_MACHINE_START(SH73A0_DT, "Generic SH73A0 (Flattened Device Tree)")
.map_io = sh73a0_map_io,
.init_early = sh73a0_init_delay,
.nr_irqs = NR_IRQS_LEGACY,
- .init_irq = irqchip_init,
.init_machine = sh73a0_add_standard_devices_dt,
.dt_compat = sh73a0_boards_compat_dt,
MACHINE_END
--
1.7.10.4
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH 6/8] ARM: shmobile: sh73a0: Always use shmobile_setup_delay()
2013-05-27 9:00 [GIT PULL] Renesas ARM based sh73a0 SoC updates for v3.11 Simon Horman
` (3 preceding siblings ...)
2013-05-27 9:00 ` [PATCH 5/8] ARM: shmobile: sh73a0: Remove init_irq declaration in machine description Simon Horman
@ 2013-05-27 9:00 ` Simon Horman
2013-05-27 9:00 ` [PATCH 7/8] ARM: shmobile: sh73a0: do not overwrite all div4 clock operations Simon Horman
2013-05-27 9:00 ` [PATCH 8/8] ARM: shmobile: sh73a0: div4 clocks must check the kick bit before changing rate Simon Horman
6 siblings, 0 replies; 15+ messages in thread
From: Simon Horman @ 2013-05-27 9:00 UTC (permalink / raw)
To: linux-arm-kernel
From: Magnus Damm <damm@opensource.se>
Break out the function sh73a0_init_delay() that now
gets called both for the C version of the code and
the DT -reference boards. This way we handle both
cases in the same way.
Allows us to boot with TWD only in the kernel configuration
for C board code. TWD is not yet enabled in the case of
DT -reference - this due to a dependency on CCF.
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
arch/arm/mach-shmobile/setup-sh73a0.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index 9986515..8bb879f 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -915,11 +915,17 @@ void __init sh73a0_add_standard_devices(void)
ARRAY_SIZE(sh73a0_late_devices));
}
+void __init sh73a0_init_delay(void)
+{
+ shmobile_setup_delay(1196, 44, 46); /* Cortex-A9 @ 1196MHz */
+}
+
/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
void __init __weak sh73a0_register_twd(void) { }
void __init sh73a0_earlytimer_init(void)
{
+ sh73a0_init_delay();
sh73a0_clock_init();
shmobile_earlytimer_init();
sh73a0_register_twd();
@@ -938,11 +944,6 @@ void __init sh73a0_add_early_devices(void)
#ifdef CONFIG_USE_OF
-void __init sh73a0_init_delay(void)
-{
- shmobile_setup_delay(1196, 44, 46); /* Cortex-A9 @ 1196MHz */
-}
-
static const struct of_dev_auxdata sh73a0_auxdata_lookup[] __initconst = {
{},
};
--
1.7.10.4
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH 7/8] ARM: shmobile: sh73a0: do not overwrite all div4 clock operations
2013-05-27 9:00 [GIT PULL] Renesas ARM based sh73a0 SoC updates for v3.11 Simon Horman
` (4 preceding siblings ...)
2013-05-27 9:00 ` [PATCH 6/8] ARM: shmobile: sh73a0: Always use shmobile_setup_delay() Simon Horman
@ 2013-05-27 9:00 ` Simon Horman
2013-05-27 9:00 ` [PATCH 8/8] ARM: shmobile: sh73a0: div4 clocks must check the kick bit before changing rate Simon Horman
6 siblings, 0 replies; 15+ messages in thread
From: Simon Horman @ 2013-05-27 9:00 UTC (permalink / raw)
To: linux-arm-kernel
From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
An earlier commit "ARM: shmobile: sh73a0: add support for adjusting CPU
frequency" intended to replace some clock operations only for the Z-clock,
instead it replaced them for all div4 clocks, since all div4 clocks share
the same copy of clock operations. Fix this by using a separate clock
operations structure for Z-clock.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
arch/arm/mach-shmobile/clock-sh73a0.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
index acb9e09..d05cf90 100644
--- a/arch/arm/mach-shmobile/clock-sh73a0.c
+++ b/arch/arm/mach-shmobile/clock-sh73a0.c
@@ -257,9 +257,8 @@ static struct clk twd_clk = {
.ops = &twd_clk_ops,
};
-static int (*div4_set_rate)(struct clk *clk, unsigned long rate);
-static unsigned long (*div4_recalc)(struct clk *clk);
-static long (*div4_round_rate)(struct clk *clk, unsigned long rate);
+static struct sh_clk_ops zclk_ops;
+static const struct sh_clk_ops *div4_clk_ops;
static int zclk_set_rate(struct clk *clk, unsigned long rate)
{
@@ -275,7 +274,7 @@ static int zclk_set_rate(struct clk *clk, unsigned long rate)
/* 1:1 - switch off divider */
__raw_writel(__raw_readl(FRQCRB) & ~(1 << 28), FRQCRB);
/* nullify the divider to prepare for the next time */
- ret = div4_set_rate(clk, rate / 2);
+ ret = div4_clk_ops->set_rate(clk, rate / 2);
if (!ret)
ret = frqcr_kick();
if (ret > 0)
@@ -290,7 +289,7 @@ static int zclk_set_rate(struct clk *clk, unsigned long rate)
* set the divider - call the DIV4 method, it will kick
* FRQCRB too
*/
- ret = div4_set_rate(clk, rate);
+ ret = div4_clk_ops->set_rate(clk, rate);
if (ret < 0)
goto esetrate;
}
@@ -302,7 +301,7 @@ esetrate:
static long zclk_round_rate(struct clk *clk, unsigned long rate)
{
- unsigned long div_freq = div4_round_rate(clk, rate),
+ unsigned long div_freq = div4_clk_ops->round_rate(clk, rate),
parent_freq = clk_get_rate(clk->parent);
if (rate > div_freq && abs(parent_freq - rate) < rate - div_freq)
@@ -317,7 +316,7 @@ static unsigned long zclk_recalc(struct clk *clk)
* Must recalculate frequencies in case PLL0 has been changed, even if
* the divisor is unused ATM!
*/
- unsigned long div_freq = div4_recalc(clk);
+ unsigned long div_freq = div4_clk_ops->recalc(clk);
if (__raw_readl(FRQCRB) & (1 << 28))
return div_freq;
@@ -327,13 +326,16 @@ static unsigned long zclk_recalc(struct clk *clk)
static void zclk_extend(void)
{
+ div4_clk_ops = div4_clks[DIV4_Z].ops;
+
/* We extend the DIV4 clock with a 1:1 pass-through case */
- div4_set_rate = div4_clks[DIV4_Z].ops->set_rate;
- div4_round_rate = div4_clks[DIV4_Z].ops->round_rate;
- div4_recalc = div4_clks[DIV4_Z].ops->recalc;
- div4_clks[DIV4_Z].ops->set_rate = zclk_set_rate;
- div4_clks[DIV4_Z].ops->round_rate = zclk_round_rate;
- div4_clks[DIV4_Z].ops->recalc = zclk_recalc;
+ zclk_ops = *div4_clk_ops;
+
+ zclk_ops.set_rate = zclk_set_rate;
+ zclk_ops.round_rate = zclk_round_rate;
+ zclk_ops.recalc = zclk_recalc;
+
+ div4_clks[DIV4_Z].ops = &zclk_ops;
}
enum { DIV6_VCK1, DIV6_VCK2, DIV6_VCK3, DIV6_ZB1,
--
1.7.10.4
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH 8/8] ARM: shmobile: sh73a0: div4 clocks must check the kick bit before changing rate
2013-05-27 9:00 [GIT PULL] Renesas ARM based sh73a0 SoC updates for v3.11 Simon Horman
` (5 preceding siblings ...)
2013-05-27 9:00 ` [PATCH 7/8] ARM: shmobile: sh73a0: do not overwrite all div4 clock operations Simon Horman
@ 2013-05-27 9:00 ` Simon Horman
6 siblings, 0 replies; 15+ messages in thread
From: Simon Horman @ 2013-05-27 9:00 UTC (permalink / raw)
To: linux-arm-kernel
From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
According to the datasheet, it is not allowed to change div4 clock rates
if an earlier rate change operation is still in progress, as indicated by
a set kick bit.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
arch/arm/mach-shmobile/clock-sh73a0.c | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
index d05cf90..d9fd033 100644
--- a/arch/arm/mach-shmobile/clock-sh73a0.c
+++ b/arch/arm/mach-shmobile/clock-sh73a0.c
@@ -257,7 +257,7 @@ static struct clk twd_clk = {
.ops = &twd_clk_ops,
};
-static struct sh_clk_ops zclk_ops;
+static struct sh_clk_ops zclk_ops, kicker_ops;
static const struct sh_clk_ops *div4_clk_ops;
static int zclk_set_rate(struct clk *clk, unsigned long rate)
@@ -324,18 +324,32 @@ static unsigned long zclk_recalc(struct clk *clk)
return clk_get_rate(clk->parent);
}
-static void zclk_extend(void)
+static int kicker_set_rate(struct clk *clk, unsigned long rate)
{
- div4_clk_ops = div4_clks[DIV4_Z].ops;
+ if (__raw_readl(FRQCRB) & (1 << 31))
+ return -EBUSY;
+
+ return div4_clk_ops->set_rate(clk, rate);
+}
+
+static void div4_clk_extend(void)
+{
+ int i;
+
+ div4_clk_ops = div4_clks[0].ops;
+ /* Add a kicker-busy check before changing the rate */
+ kicker_ops = *div4_clk_ops;
/* We extend the DIV4 clock with a 1:1 pass-through case */
zclk_ops = *div4_clk_ops;
+ kicker_ops.set_rate = kicker_set_rate;
zclk_ops.set_rate = zclk_set_rate;
zclk_ops.round_rate = zclk_round_rate;
zclk_ops.recalc = zclk_recalc;
- div4_clks[DIV4_Z].ops = &zclk_ops;
+ for (i = 0; i < DIV4_NR; i++)
+ div4_clks[i].ops = i = DIV4_Z ? &zclk_ops : &kicker_ops;
}
enum { DIV6_VCK1, DIV6_VCK2, DIV6_VCK3, DIV6_ZB1,
@@ -697,7 +711,7 @@ void __init sh73a0_clock_init(void)
if (!ret) {
ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table);
if (!ret)
- zclk_extend();
+ div4_clk_extend();
}
if (!ret)
--
1.7.10.4
^ permalink raw reply related [flat|nested] 15+ messages in thread