All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/3] CPUFreq for sh73a0 / kzm9g, using cpufreq-cpu0
@ 2013-03-24 19:27 ` Guennadi Liakhovetski
  0 siblings, 0 replies; 24+ messages in thread
From: Guennadi Liakhovetski @ 2013-03-24 19:27 UTC (permalink / raw)
  To: linux-arm-kernel

The cpufreq-cpu0 CPUFreq driver has been recently been converted to a 
platform driver, which made v3 of this patch set non-functional. This 
version performs the necessary update and also modifies kzm9g-reference 
AS3711 support to be suitable for the mainline by removing LCDC hacks.

Guennadi Liakhovetski (3):
  ARM: shmobile: sh73a0: add support for adjusting CPU frequency
  ARM: shmobile: add framebuffer and backlight support to
    kzm9g-reference
  ARM: shmobile: kzm9g-reference: add CPUFreq support

 arch/arm/boot/dts/sh73a0-kzm9g-reference.dts |   86 +++++++++++++++++++++++
 arch/arm/mach-shmobile/Kconfig               |    2 +
 arch/arm/mach-shmobile/clock-sh73a0.c        |   95 +++++++++++++++++++++++++-
 arch/arm/mach-shmobile/setup-sh73a0.c        |    5 ++
 4 files changed, 186 insertions(+), 2 deletions(-)

-- 
1.7.2.5

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH v4 0/3] CPUFreq for sh73a0 / kzm9g, using cpufreq-cpu0
@ 2013-03-24 19:27 ` Guennadi Liakhovetski
  0 siblings, 0 replies; 24+ messages in thread
From: Guennadi Liakhovetski @ 2013-03-24 19:27 UTC (permalink / raw)
  To: linux-arm-kernel

The cpufreq-cpu0 CPUFreq driver has been recently been converted to a 
platform driver, which made v3 of this patch set non-functional. This 
version performs the necessary update and also modifies kzm9g-reference 
AS3711 support to be suitable for the mainline by removing LCDC hacks.

Guennadi Liakhovetski (3):
  ARM: shmobile: sh73a0: add support for adjusting CPU frequency
  ARM: shmobile: add framebuffer and backlight support to
    kzm9g-reference
  ARM: shmobile: kzm9g-reference: add CPUFreq support

 arch/arm/boot/dts/sh73a0-kzm9g-reference.dts |   86 +++++++++++++++++++++++
 arch/arm/mach-shmobile/Kconfig               |    2 +
 arch/arm/mach-shmobile/clock-sh73a0.c        |   95 +++++++++++++++++++++++++-
 arch/arm/mach-shmobile/setup-sh73a0.c        |    5 ++
 4 files changed, 186 insertions(+), 2 deletions(-)

-- 
1.7.2.5

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH v4 0/3] CPUFreq for sh73a0 / kzm9g, using cpufreq-cpu0
@ 2013-03-24 19:27 ` Guennadi Liakhovetski
  0 siblings, 0 replies; 24+ messages in thread
From: Guennadi Liakhovetski @ 2013-03-24 19:27 UTC (permalink / raw)
  To: linux-sh
  Cc: Magnus Damm, Simon Horman, linux-arm-kernel, Rafael J. Wysocki, cpufreq

The cpufreq-cpu0 CPUFreq driver has been recently been converted to a 
platform driver, which made v3 of this patch set non-functional. This 
version performs the necessary update and also modifies kzm9g-reference 
AS3711 support to be suitable for the mainline by removing LCDC hacks.

Guennadi Liakhovetski (3):
  ARM: shmobile: sh73a0: add support for adjusting CPU frequency
  ARM: shmobile: add framebuffer and backlight support to
    kzm9g-reference
  ARM: shmobile: kzm9g-reference: add CPUFreq support

 arch/arm/boot/dts/sh73a0-kzm9g-reference.dts |   86 +++++++++++++++++++++++
 arch/arm/mach-shmobile/Kconfig               |    2 +
 arch/arm/mach-shmobile/clock-sh73a0.c        |   95 +++++++++++++++++++++++++-
 arch/arm/mach-shmobile/setup-sh73a0.c        |    5 ++
 4 files changed, 186 insertions(+), 2 deletions(-)

-- 
1.7.2.5

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH v4 1/3] ARM: shmobile: sh73a0: add support for adjusting CPU frequency
  2013-03-24 19:27 ` Guennadi Liakhovetski
  (?)
@ 2013-03-24 19:27   ` Guennadi Liakhovetski
  -1 siblings, 0 replies; 24+ messages in thread
From: Guennadi Liakhovetski @ 2013-03-24 19:27 UTC (permalink / raw)
  To: linux-arm-kernel

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

v4: update Z-clock lookup name for the new version of the cpufreq-cpu0 
driver.

 arch/arm/mach-shmobile/clock-sh73a0.c |   95 ++++++++++++++++++++++++++++++++-
 1 files changed, 93 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
index c992600..509be3e 100644
--- a/arch/arm/mach-shmobile/clock-sh73a0.c
+++ b/arch/arm/mach-shmobile/clock-sh73a0.c
@@ -282,6 +282,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),
@@ -308,6 +313,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,
@@ -506,7 +590,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,
@@ -527,6 +611,7 @@ static struct clk mstp_clks[MSTP_NR] = {
 	[MSTP125] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR1, 25, MSTPSR1, 0), /* TMU0 */
 	[MSTP118] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 18, MSTPSR1, 0), /* DSITX0 */
 	[MSTP116] = MSTP(&div4_clks[DIV4_HP], SMSTPCR1, 16, MSTPSR1, 0), /* IIC0 */
+	[MSTP112] = MSTP(&div4_clks[DIV4_ZG], SMSTPCR1, 12, MSTPSR1, 0), /* SGX */
 	[MSTP100] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 0, MSTPSR1, 0), /* LCDC0 */
 	[MSTP219] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 19, MSTPSR2, 0), /* SCIFA7 */
 	[MSTP218] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 18, MSTPSR2, 0), /* SY-DMAC */
@@ -569,6 +654,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]),
@@ -660,8 +748,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.2.5


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH v4 1/3] ARM: shmobile: sh73a0: add support for adjusting CPU frequency
@ 2013-03-24 19:27   ` Guennadi Liakhovetski
  0 siblings, 0 replies; 24+ messages in thread
From: Guennadi Liakhovetski @ 2013-03-24 19:27 UTC (permalink / raw)
  To: linux-arm-kernel

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

v4: update Z-clock lookup name for the new version of the cpufreq-cpu0 
driver.

 arch/arm/mach-shmobile/clock-sh73a0.c |   95 ++++++++++++++++++++++++++++++++-
 1 files changed, 93 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
index c992600..509be3e 100644
--- a/arch/arm/mach-shmobile/clock-sh73a0.c
+++ b/arch/arm/mach-shmobile/clock-sh73a0.c
@@ -282,6 +282,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),
@@ -308,6 +313,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,
@@ -506,7 +590,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,
@@ -527,6 +611,7 @@ static struct clk mstp_clks[MSTP_NR] = {
 	[MSTP125] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR1, 25, MSTPSR1, 0), /* TMU0 */
 	[MSTP118] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 18, MSTPSR1, 0), /* DSITX0 */
 	[MSTP116] = MSTP(&div4_clks[DIV4_HP], SMSTPCR1, 16, MSTPSR1, 0), /* IIC0 */
+	[MSTP112] = MSTP(&div4_clks[DIV4_ZG], SMSTPCR1, 12, MSTPSR1, 0), /* SGX */
 	[MSTP100] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 0, MSTPSR1, 0), /* LCDC0 */
 	[MSTP219] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 19, MSTPSR2, 0), /* SCIFA7 */
 	[MSTP218] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 18, MSTPSR2, 0), /* SY-DMAC */
@@ -569,6 +654,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]),
@@ -660,8 +748,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.2.5

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH v4 1/3] ARM: shmobile: sh73a0: add support for adjusting CPU frequency
@ 2013-03-24 19:27   ` Guennadi Liakhovetski
  0 siblings, 0 replies; 24+ messages in thread
From: Guennadi Liakhovetski @ 2013-03-24 19:27 UTC (permalink / raw)
  To: linux-sh
  Cc: Magnus Damm, Simon Horman, linux-arm-kernel, Rafael J. Wysocki,
	cpufreq, Guennadi Liakhovetski

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

v4: update Z-clock lookup name for the new version of the cpufreq-cpu0 
driver.

 arch/arm/mach-shmobile/clock-sh73a0.c |   95 ++++++++++++++++++++++++++++++++-
 1 files changed, 93 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
index c992600..509be3e 100644
--- a/arch/arm/mach-shmobile/clock-sh73a0.c
+++ b/arch/arm/mach-shmobile/clock-sh73a0.c
@@ -282,6 +282,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),
@@ -308,6 +313,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,
@@ -506,7 +590,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,
@@ -527,6 +611,7 @@ static struct clk mstp_clks[MSTP_NR] = {
 	[MSTP125] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR1, 25, MSTPSR1, 0), /* TMU0 */
 	[MSTP118] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 18, MSTPSR1, 0), /* DSITX0 */
 	[MSTP116] = MSTP(&div4_clks[DIV4_HP], SMSTPCR1, 16, MSTPSR1, 0), /* IIC0 */
+	[MSTP112] = MSTP(&div4_clks[DIV4_ZG], SMSTPCR1, 12, MSTPSR1, 0), /* SGX */
 	[MSTP100] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 0, MSTPSR1, 0), /* LCDC0 */
 	[MSTP219] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 19, MSTPSR2, 0), /* SCIFA7 */
 	[MSTP218] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 18, MSTPSR2, 0), /* SY-DMAC */
@@ -569,6 +654,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]),
@@ -660,8 +748,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.2.5


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH v4 2/3] ARM: shmobile: kzm9g-reference: add AS3711 and CPUFreq DT bindings
  2013-03-24 19:27 ` Guennadi Liakhovetski
  (?)
@ 2013-03-24 19:27   ` Guennadi Liakhovetski
  -1 siblings, 0 replies; 24+ messages in thread
From: Guennadi Liakhovetski @ 2013-03-24 19:27 UTC (permalink / raw)
  To: linux-arm-kernel

This adds Dt bindings for an AS3711 PMIC, used for supplying power to the
CPU, some peripherals and the backlight, as well as extends the cpu0 DT
node with OPPs and a reference to the PMIC to support the CPUFreq and
CPU DVFS functions.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
---

v4: remove the LCDC hack

 arch/arm/boot/dts/sh73a0-kzm9g-reference.dts |   86 ++++++++++++++++++++++++++
 1 files changed, 86 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
index 5972abb..dd1cd80 100644
--- a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
+++ b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
@@ -18,6 +18,19 @@
 	model = "KZM-A9-GT";
 	compatible = "renesas,kzm9g-reference", "renesas,sh73a0";
 
+	cpus {
+		cpu@0 {
+			cpu0-supply = <&vdd_dvfs>;
+			operating-points = <
+				/* kHz  uV */
+				1196000 1315000
+				 598000 1175000
+				 398667 1065000
+			>;
+			voltage-tolerance = <1>; /* 1% */
+		};
+	};
+
 	chosen {
 		bootargs = "console=tty0 console=ttySC4,115200 root=/dev/nfs ip=dhcp ignore_loglevel earlyprintk=sh-sci.4,115200";
 	};
@@ -59,6 +72,79 @@
 	};
 };
 
+&i2c0 {
+	as3711@40 {
+		compatible = "ams,as3711";
+		reg = <0x40>;
+
+		regulators {
+			sd1 {
+				regulator-name = "1.315V CPU";
+				regulator-min-microvolt = <1315000>;
+				regulator-max-microvolt = <1335000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+			sd2 {
+				regulator-name = "1.8V";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+			sd4 {
+				regulator-name = "1.215V";
+				regulator-min-microvolt = <1215000>;
+				regulator-max-microvolt = <1235000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+			ldo2 {
+				regulator-name = "2.8V CPU";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+			ldo3 {
+				regulator-name = "3.0V CPU";
+				regulator-min-microvolt = <3000000>;
+				regulator-max-microvolt = <3000000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+			ldo4 {
+				regulator-name = "2.8V";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+			ldo5 {
+				regulator-name = "2.8V #2";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+			ldo7 {
+				regulator-name = "1.15V CPU";
+				regulator-min-microvolt = <1150000>;
+				regulator-max-microvolt = <1150000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+			ldo8 {
+				regulator-name = "1.15V CPU #2";
+				regulator-min-microvolt = <1150000>;
+				regulator-max-microvolt = <1150000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+		};
+	};
+};
+
 &mmcif {
 	bus-width = <8>;
 	vmmc-supply = <&reg_1p8v>;
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH v4 2/3] ARM: shmobile: kzm9g-reference: add AS3711 and CPUFreq DT bindings
@ 2013-03-24 19:27   ` Guennadi Liakhovetski
  0 siblings, 0 replies; 24+ messages in thread
From: Guennadi Liakhovetski @ 2013-03-24 19:27 UTC (permalink / raw)
  To: linux-arm-kernel

This adds Dt bindings for an AS3711 PMIC, used for supplying power to the
CPU, some peripherals and the backlight, as well as extends the cpu0 DT
node with OPPs and a reference to the PMIC to support the CPUFreq and
CPU DVFS functions.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
---

v4: remove the LCDC hack

 arch/arm/boot/dts/sh73a0-kzm9g-reference.dts |   86 ++++++++++++++++++++++++++
 1 files changed, 86 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
index 5972abb..dd1cd80 100644
--- a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
+++ b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
@@ -18,6 +18,19 @@
 	model = "KZM-A9-GT";
 	compatible = "renesas,kzm9g-reference", "renesas,sh73a0";
 
+	cpus {
+		cpu at 0 {
+			cpu0-supply = <&vdd_dvfs>;
+			operating-points = <
+				/* kHz  uV */
+				1196000 1315000
+				 598000 1175000
+				 398667 1065000
+			>;
+			voltage-tolerance = <1>; /* 1% */
+		};
+	};
+
 	chosen {
 		bootargs = "console=tty0 console=ttySC4,115200 root=/dev/nfs ip=dhcp ignore_loglevel earlyprintk=sh-sci.4,115200";
 	};
@@ -59,6 +72,79 @@
 	};
 };
 
+&i2c0 {
+	as3711 at 40 {
+		compatible = "ams,as3711";
+		reg = <0x40>;
+
+		regulators {
+			sd1 {
+				regulator-name = "1.315V CPU";
+				regulator-min-microvolt = <1315000>;
+				regulator-max-microvolt = <1335000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+			sd2 {
+				regulator-name = "1.8V";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+			sd4 {
+				regulator-name = "1.215V";
+				regulator-min-microvolt = <1215000>;
+				regulator-max-microvolt = <1235000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+			ldo2 {
+				regulator-name = "2.8V CPU";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+			ldo3 {
+				regulator-name = "3.0V CPU";
+				regulator-min-microvolt = <3000000>;
+				regulator-max-microvolt = <3000000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+			ldo4 {
+				regulator-name = "2.8V";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+			ldo5 {
+				regulator-name = "2.8V #2";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+			ldo7 {
+				regulator-name = "1.15V CPU";
+				regulator-min-microvolt = <1150000>;
+				regulator-max-microvolt = <1150000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+			ldo8 {
+				regulator-name = "1.15V CPU #2";
+				regulator-min-microvolt = <1150000>;
+				regulator-max-microvolt = <1150000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+		};
+	};
+};
+
 &mmcif {
 	bus-width = <8>;
 	vmmc-supply = <&reg_1p8v>;
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH v4 2/3] ARM: shmobile: kzm9g-reference: add AS3711 and CPUFreq DT bindings
@ 2013-03-24 19:27   ` Guennadi Liakhovetski
  0 siblings, 0 replies; 24+ messages in thread
From: Guennadi Liakhovetski @ 2013-03-24 19:27 UTC (permalink / raw)
  To: linux-sh
  Cc: Magnus Damm, Simon Horman, linux-arm-kernel, Rafael J. Wysocki,
	cpufreq, Guennadi Liakhovetski

This adds Dt bindings for an AS3711 PMIC, used for supplying power to the
CPU, some peripherals and the backlight, as well as extends the cpu0 DT
node with OPPs and a reference to the PMIC to support the CPUFreq and
CPU DVFS functions.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
---

v4: remove the LCDC hack

 arch/arm/boot/dts/sh73a0-kzm9g-reference.dts |   86 ++++++++++++++++++++++++++
 1 files changed, 86 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
index 5972abb..dd1cd80 100644
--- a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
+++ b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
@@ -18,6 +18,19 @@
 	model = "KZM-A9-GT";
 	compatible = "renesas,kzm9g-reference", "renesas,sh73a0";
 
+	cpus {
+		cpu@0 {
+			cpu0-supply = <&vdd_dvfs>;
+			operating-points = <
+				/* kHz  uV */
+				1196000 1315000
+				 598000 1175000
+				 398667 1065000
+			>;
+			voltage-tolerance = <1>; /* 1% */
+		};
+	};
+
 	chosen {
 		bootargs = "console=tty0 console=ttySC4,115200 root=/dev/nfs ip=dhcp ignore_loglevel earlyprintk=sh-sci.4,115200";
 	};
@@ -59,6 +72,79 @@
 	};
 };
 
+&i2c0 {
+	as3711@40 {
+		compatible = "ams,as3711";
+		reg = <0x40>;
+
+		regulators {
+			sd1 {
+				regulator-name = "1.315V CPU";
+				regulator-min-microvolt = <1315000>;
+				regulator-max-microvolt = <1335000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+			sd2 {
+				regulator-name = "1.8V";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+			sd4 {
+				regulator-name = "1.215V";
+				regulator-min-microvolt = <1215000>;
+				regulator-max-microvolt = <1235000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+			ldo2 {
+				regulator-name = "2.8V CPU";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+			ldo3 {
+				regulator-name = "3.0V CPU";
+				regulator-min-microvolt = <3000000>;
+				regulator-max-microvolt = <3000000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+			ldo4 {
+				regulator-name = "2.8V";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+			ldo5 {
+				regulator-name = "2.8V #2";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+			ldo7 {
+				regulator-name = "1.15V CPU";
+				regulator-min-microvolt = <1150000>;
+				regulator-max-microvolt = <1150000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+			ldo8 {
+				regulator-name = "1.15V CPU #2";
+				regulator-min-microvolt = <1150000>;
+				regulator-max-microvolt = <1150000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+		};
+	};
+};
+
 &mmcif {
 	bus-width = <8>;
 	vmmc-supply = <&reg_1p8v>;
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH v4 3/3] ARM: shmobile: kzm9g-reference: add CPUFreq support
  2013-03-24 19:27 ` Guennadi Liakhovetski
  (?)
@ 2013-03-24 19:27   ` Guennadi Liakhovetski
  -1 siblings, 0 replies; 24+ messages in thread
From: Guennadi Liakhovetski @ 2013-03-24 19:27 UTC (permalink / raw)
  To: linux-arm-kernel

This patch enables the use of the generic cpufreq-cpu0 driver on kzm9g.
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.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
---

v4: add a cpufreq-cpu0 platform device for the new cpufreq-cpu0 
initialisation procedure

 arch/arm/boot/dts/sh73a0-kzm9g-reference.dts |    6 +++---
 arch/arm/mach-shmobile/Kconfig               |    2 ++
 arch/arm/mach-shmobile/setup-sh73a0.c        |    5 +++++
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
index dd1cd80..b6f759e 100644
--- a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
+++ b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
@@ -78,10 +78,10 @@
 		reg = <0x40>;
 
 		regulators {
-			sd1 {
+			vdd_dvfs: sd1 {
 				regulator-name = "1.315V CPU";
-				regulator-min-microvolt = <1315000>;
-				regulator-max-microvolt = <1335000>;
+				regulator-min-microvolt = <1050000>;
+				regulator-max-microvolt = <1350000>;
 				regulator-always-on;
 				regulator-boot-on;
 			};
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index eb3a7ff..8a0420b 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -134,6 +134,8 @@ config MACH_KZM9G
 config MACH_KZM9G_REFERENCE
 	bool "KZM-A9-GT board - Reference Device Tree Implementation"
 	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 e8cd93a..0469e84 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -1016,6 +1016,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();
 
@@ -1023,6 +1025,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.2.5


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH v4 3/3] ARM: shmobile: kzm9g-reference: add CPUFreq support
@ 2013-03-24 19:27   ` Guennadi Liakhovetski
  0 siblings, 0 replies; 24+ messages in thread
From: Guennadi Liakhovetski @ 2013-03-24 19:27 UTC (permalink / raw)
  To: linux-arm-kernel

This patch enables the use of the generic cpufreq-cpu0 driver on kzm9g.
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.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
---

v4: add a cpufreq-cpu0 platform device for the new cpufreq-cpu0 
initialisation procedure

 arch/arm/boot/dts/sh73a0-kzm9g-reference.dts |    6 +++---
 arch/arm/mach-shmobile/Kconfig               |    2 ++
 arch/arm/mach-shmobile/setup-sh73a0.c        |    5 +++++
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
index dd1cd80..b6f759e 100644
--- a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
+++ b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
@@ -78,10 +78,10 @@
 		reg = <0x40>;
 
 		regulators {
-			sd1 {
+			vdd_dvfs: sd1 {
 				regulator-name = "1.315V CPU";
-				regulator-min-microvolt = <1315000>;
-				regulator-max-microvolt = <1335000>;
+				regulator-min-microvolt = <1050000>;
+				regulator-max-microvolt = <1350000>;
 				regulator-always-on;
 				regulator-boot-on;
 			};
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index eb3a7ff..8a0420b 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -134,6 +134,8 @@ config MACH_KZM9G
 config MACH_KZM9G_REFERENCE
 	bool "KZM-A9-GT board - Reference Device Tree Implementation"
 	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 e8cd93a..0469e84 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -1016,6 +1016,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();
 
@@ -1023,6 +1025,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.2.5

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH v4 3/3] ARM: shmobile: kzm9g-reference: add CPUFreq support
@ 2013-03-24 19:27   ` Guennadi Liakhovetski
  0 siblings, 0 replies; 24+ messages in thread
From: Guennadi Liakhovetski @ 2013-03-24 19:27 UTC (permalink / raw)
  To: linux-sh
  Cc: Magnus Damm, Simon Horman, linux-arm-kernel, Rafael J. Wysocki,
	cpufreq, Guennadi Liakhovetski

This patch enables the use of the generic cpufreq-cpu0 driver on kzm9g.
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.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
---

v4: add a cpufreq-cpu0 platform device for the new cpufreq-cpu0 
initialisation procedure

 arch/arm/boot/dts/sh73a0-kzm9g-reference.dts |    6 +++---
 arch/arm/mach-shmobile/Kconfig               |    2 ++
 arch/arm/mach-shmobile/setup-sh73a0.c        |    5 +++++
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
index dd1cd80..b6f759e 100644
--- a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
+++ b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
@@ -78,10 +78,10 @@
 		reg = <0x40>;
 
 		regulators {
-			sd1 {
+			vdd_dvfs: sd1 {
 				regulator-name = "1.315V CPU";
-				regulator-min-microvolt = <1315000>;
-				regulator-max-microvolt = <1335000>;
+				regulator-min-microvolt = <1050000>;
+				regulator-max-microvolt = <1350000>;
 				regulator-always-on;
 				regulator-boot-on;
 			};
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index eb3a7ff..8a0420b 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -134,6 +134,8 @@ config MACH_KZM9G
 config MACH_KZM9G_REFERENCE
 	bool "KZM-A9-GT board - Reference Device Tree Implementation"
 	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 e8cd93a..0469e84 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -1016,6 +1016,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();
 
@@ -1023,6 +1025,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.2.5


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCH v4 0/3] CPUFreq for sh73a0 / kzm9g, using cpufreq-cpu0
  2013-03-24 19:27 ` Guennadi Liakhovetski
  (?)
@ 2013-03-27  5:29   ` Simon Horman
  -1 siblings, 0 replies; 24+ messages in thread
From: Simon Horman @ 2013-03-27  5:29 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Mar 24, 2013 at 08:27:32PM +0100, Guennadi Liakhovetski wrote:
> The cpufreq-cpu0 CPUFreq driver has been recently been converted to a 
> platform driver, which made v3 of this patch set non-functional. This 
> version performs the necessary update and also modifies kzm9g-reference 
> AS3711 support to be suitable for the mainline by removing LCDC hacks.
> 
> Guennadi Liakhovetski (3):
>   ARM: shmobile: sh73a0: add support for adjusting CPU frequency
>   ARM: shmobile: add framebuffer and backlight support to
>     kzm9g-reference
>   ARM: shmobile: kzm9g-reference: add CPUFreq support
> 
>  arch/arm/boot/dts/sh73a0-kzm9g-reference.dts |   86 +++++++++++++++++++++++
>  arch/arm/mach-shmobile/Kconfig               |    2 +
>  arch/arm/mach-shmobile/clock-sh73a0.c        |   95 +++++++++++++++++++++++++-
>  arch/arm/mach-shmobile/setup-sh73a0.c        |    5 ++
>  4 files changed, 186 insertions(+), 2 deletions(-)

Magnus, can I get an Ack from you?

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH v4 0/3] CPUFreq for sh73a0 / kzm9g, using cpufreq-cpu0
@ 2013-03-27  5:29   ` Simon Horman
  0 siblings, 0 replies; 24+ messages in thread
From: Simon Horman @ 2013-03-27  5:29 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Mar 24, 2013 at 08:27:32PM +0100, Guennadi Liakhovetski wrote:
> The cpufreq-cpu0 CPUFreq driver has been recently been converted to a 
> platform driver, which made v3 of this patch set non-functional. This 
> version performs the necessary update and also modifies kzm9g-reference 
> AS3711 support to be suitable for the mainline by removing LCDC hacks.
> 
> Guennadi Liakhovetski (3):
>   ARM: shmobile: sh73a0: add support for adjusting CPU frequency
>   ARM: shmobile: add framebuffer and backlight support to
>     kzm9g-reference
>   ARM: shmobile: kzm9g-reference: add CPUFreq support
> 
>  arch/arm/boot/dts/sh73a0-kzm9g-reference.dts |   86 +++++++++++++++++++++++
>  arch/arm/mach-shmobile/Kconfig               |    2 +
>  arch/arm/mach-shmobile/clock-sh73a0.c        |   95 +++++++++++++++++++++++++-
>  arch/arm/mach-shmobile/setup-sh73a0.c        |    5 ++
>  4 files changed, 186 insertions(+), 2 deletions(-)

Magnus, can I get an Ack from you?

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v4 0/3] CPUFreq for sh73a0 / kzm9g, using cpufreq-cpu0
@ 2013-03-27  5:29   ` Simon Horman
  0 siblings, 0 replies; 24+ messages in thread
From: Simon Horman @ 2013-03-27  5:29 UTC (permalink / raw)
  To: Guennadi Liakhovetski
  Cc: linux-sh, Magnus Damm, linux-arm-kernel, Rafael J. Wysocki, cpufreq

On Sun, Mar 24, 2013 at 08:27:32PM +0100, Guennadi Liakhovetski wrote:
> The cpufreq-cpu0 CPUFreq driver has been recently been converted to a 
> platform driver, which made v3 of this patch set non-functional. This 
> version performs the necessary update and also modifies kzm9g-reference 
> AS3711 support to be suitable for the mainline by removing LCDC hacks.
> 
> Guennadi Liakhovetski (3):
>   ARM: shmobile: sh73a0: add support for adjusting CPU frequency
>   ARM: shmobile: add framebuffer and backlight support to
>     kzm9g-reference
>   ARM: shmobile: kzm9g-reference: add CPUFreq support
> 
>  arch/arm/boot/dts/sh73a0-kzm9g-reference.dts |   86 +++++++++++++++++++++++
>  arch/arm/mach-shmobile/Kconfig               |    2 +
>  arch/arm/mach-shmobile/clock-sh73a0.c        |   95 +++++++++++++++++++++++++-
>  arch/arm/mach-shmobile/setup-sh73a0.c        |    5 ++
>  4 files changed, 186 insertions(+), 2 deletions(-)

Magnus, can I get an Ack from you?

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v4 3/3] ARM: shmobile: kzm9g-reference: add CPUFreq support
  2013-03-24 19:27   ` Guennadi Liakhovetski
  (?)
@ 2013-04-04  4:37     ` Simon Horman
  -1 siblings, 0 replies; 24+ messages in thread
From: Simon Horman @ 2013-04-04  4:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Mar 24, 2013 at 08:27:35PM +0100, Guennadi Liakhovetski wrote:
> This patch enables the use of the generic cpufreq-cpu0 driver on kzm9g.
> 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.

I wonder if it would be possible to re-arange this patch a little.

1) vdd_dvfs is added in this patch but it appears to be used in the
   previous patch in the series. I wonder if this can be resolved
   by re-ordering the patches.

2) It includes both kzm9g board and sh73a0 SoC changes.
   I would prefer if the sh73a0 SoC portion (setup-sh73a0.c)
   was moved into a separate patch. The arm-soc people
   like to have separate board and SoC branches.

> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
> ---
> 
> v4: add a cpufreq-cpu0 platform device for the new cpufreq-cpu0 
> initialisation procedure
> 
>  arch/arm/boot/dts/sh73a0-kzm9g-reference.dts |    6 +++---
>  arch/arm/mach-shmobile/Kconfig               |    2 ++
>  arch/arm/mach-shmobile/setup-sh73a0.c        |    5 +++++
>  3 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
> index dd1cd80..b6f759e 100644
> --- a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
> +++ b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
> @@ -78,10 +78,10 @@
>  		reg = <0x40>;
>  
>  		regulators {
> -			sd1 {
> +			vdd_dvfs: sd1 {
>  				regulator-name = "1.315V CPU";
> -				regulator-min-microvolt = <1315000>;
> -				regulator-max-microvolt = <1335000>;
> +				regulator-min-microvolt = <1050000>;
> +				regulator-max-microvolt = <1350000>;
>  				regulator-always-on;
>  				regulator-boot-on;
>  			};
> diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
> index eb3a7ff..8a0420b 100644
> --- a/arch/arm/mach-shmobile/Kconfig
> +++ b/arch/arm/mach-shmobile/Kconfig
> @@ -134,6 +134,8 @@ config MACH_KZM9G
>  config MACH_KZM9G_REFERENCE
>  	bool "KZM-A9-GT board - Reference Device Tree Implementation"
>  	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 e8cd93a..0469e84 100644
> --- a/arch/arm/mach-shmobile/setup-sh73a0.c
> +++ b/arch/arm/mach-shmobile/setup-sh73a0.c
> @@ -1016,6 +1016,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();
>  
> @@ -1023,6 +1025,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.2.5
> 

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH v4 3/3] ARM: shmobile: kzm9g-reference: add CPUFreq support
@ 2013-04-04  4:37     ` Simon Horman
  0 siblings, 0 replies; 24+ messages in thread
From: Simon Horman @ 2013-04-04  4:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Mar 24, 2013 at 08:27:35PM +0100, Guennadi Liakhovetski wrote:
> This patch enables the use of the generic cpufreq-cpu0 driver on kzm9g.
> 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.

I wonder if it would be possible to re-arange this patch a little.

1) vdd_dvfs is added in this patch but it appears to be used in the
   previous patch in the series. I wonder if this can be resolved
   by re-ordering the patches.

2) It includes both kzm9g board and sh73a0 SoC changes.
   I would prefer if the sh73a0 SoC portion (setup-sh73a0.c)
   was moved into a separate patch. The arm-soc people
   like to have separate board and SoC branches.

> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
> ---
> 
> v4: add a cpufreq-cpu0 platform device for the new cpufreq-cpu0 
> initialisation procedure
> 
>  arch/arm/boot/dts/sh73a0-kzm9g-reference.dts |    6 +++---
>  arch/arm/mach-shmobile/Kconfig               |    2 ++
>  arch/arm/mach-shmobile/setup-sh73a0.c        |    5 +++++
>  3 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
> index dd1cd80..b6f759e 100644
> --- a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
> +++ b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
> @@ -78,10 +78,10 @@
>  		reg = <0x40>;
>  
>  		regulators {
> -			sd1 {
> +			vdd_dvfs: sd1 {
>  				regulator-name = "1.315V CPU";
> -				regulator-min-microvolt = <1315000>;
> -				regulator-max-microvolt = <1335000>;
> +				regulator-min-microvolt = <1050000>;
> +				regulator-max-microvolt = <1350000>;
>  				regulator-always-on;
>  				regulator-boot-on;
>  			};
> diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
> index eb3a7ff..8a0420b 100644
> --- a/arch/arm/mach-shmobile/Kconfig
> +++ b/arch/arm/mach-shmobile/Kconfig
> @@ -134,6 +134,8 @@ config MACH_KZM9G
>  config MACH_KZM9G_REFERENCE
>  	bool "KZM-A9-GT board - Reference Device Tree Implementation"
>  	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 e8cd93a..0469e84 100644
> --- a/arch/arm/mach-shmobile/setup-sh73a0.c
> +++ b/arch/arm/mach-shmobile/setup-sh73a0.c
> @@ -1016,6 +1016,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();
>  
> @@ -1023,6 +1025,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.2.5
> 

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v4 3/3] ARM: shmobile: kzm9g-reference: add CPUFreq support
@ 2013-04-04  4:37     ` Simon Horman
  0 siblings, 0 replies; 24+ messages in thread
From: Simon Horman @ 2013-04-04  4:37 UTC (permalink / raw)
  To: Guennadi Liakhovetski
  Cc: linux-sh, Magnus Damm, linux-arm-kernel, Rafael J. Wysocki,
	cpufreq, Guennadi Liakhovetski

On Sun, Mar 24, 2013 at 08:27:35PM +0100, Guennadi Liakhovetski wrote:
> This patch enables the use of the generic cpufreq-cpu0 driver on kzm9g.
> 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.

I wonder if it would be possible to re-arange this patch a little.

1) vdd_dvfs is added in this patch but it appears to be used in the
   previous patch in the series. I wonder if this can be resolved
   by re-ordering the patches.

2) It includes both kzm9g board and sh73a0 SoC changes.
   I would prefer if the sh73a0 SoC portion (setup-sh73a0.c)
   was moved into a separate patch. The arm-soc people
   like to have separate board and SoC branches.

> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
> ---
> 
> v4: add a cpufreq-cpu0 platform device for the new cpufreq-cpu0 
> initialisation procedure
> 
>  arch/arm/boot/dts/sh73a0-kzm9g-reference.dts |    6 +++---
>  arch/arm/mach-shmobile/Kconfig               |    2 ++
>  arch/arm/mach-shmobile/setup-sh73a0.c        |    5 +++++
>  3 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
> index dd1cd80..b6f759e 100644
> --- a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
> +++ b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
> @@ -78,10 +78,10 @@
>  		reg = <0x40>;
>  
>  		regulators {
> -			sd1 {
> +			vdd_dvfs: sd1 {
>  				regulator-name = "1.315V CPU";
> -				regulator-min-microvolt = <1315000>;
> -				regulator-max-microvolt = <1335000>;
> +				regulator-min-microvolt = <1050000>;
> +				regulator-max-microvolt = <1350000>;
>  				regulator-always-on;
>  				regulator-boot-on;
>  			};
> diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
> index eb3a7ff..8a0420b 100644
> --- a/arch/arm/mach-shmobile/Kconfig
> +++ b/arch/arm/mach-shmobile/Kconfig
> @@ -134,6 +134,8 @@ config MACH_KZM9G
>  config MACH_KZM9G_REFERENCE
>  	bool "KZM-A9-GT board - Reference Device Tree Implementation"
>  	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 e8cd93a..0469e84 100644
> --- a/arch/arm/mach-shmobile/setup-sh73a0.c
> +++ b/arch/arm/mach-shmobile/setup-sh73a0.c
> @@ -1016,6 +1016,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();
>  
> @@ -1023,6 +1025,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.2.5
> 

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v4 3/3] ARM: shmobile: kzm9g-reference: add CPUFreq support
  2013-04-04  4:37     ` Simon Horman
  (?)
@ 2013-04-04 21:54       ` Guennadi Liakhovetski
  -1 siblings, 0 replies; 24+ messages in thread
From: Guennadi Liakhovetski @ 2013-04-04 21:54 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Simon

Thanks for the review

On Thu, 4 Apr 2013, Simon Horman wrote:

> On Sun, Mar 24, 2013 at 08:27:35PM +0100, Guennadi Liakhovetski wrote:
> > This patch enables the use of the generic cpufreq-cpu0 driver on kzm9g.
> > 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.
> 
> I wonder if it would be possible to re-arange this patch a little.
> 
> 1) vdd_dvfs is added in this patch but it appears to be used in the
>    previous patch in the series. I wonder if this can be resolved
>    by re-ordering the patches.

Right, I'll change that.

> 2) It includes both kzm9g board and sh73a0 SoC changes.
>    I would prefer if the sh73a0 SoC portion (setup-sh73a0.c)
>    was moved into a separate patch. The arm-soc people
>    like to have separate board and SoC branches.

Yes, I'll probably just merge the sh73a0-kzm9g-reference.dts hunk into the 
previous patch.

Thanks
Guennadi

> 
> > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
> > ---
> > 
> > v4: add a cpufreq-cpu0 platform device for the new cpufreq-cpu0 
> > initialisation procedure
> > 
> >  arch/arm/boot/dts/sh73a0-kzm9g-reference.dts |    6 +++---
> >  arch/arm/mach-shmobile/Kconfig               |    2 ++
> >  arch/arm/mach-shmobile/setup-sh73a0.c        |    5 +++++
> >  3 files changed, 10 insertions(+), 3 deletions(-)
> > 
> > diff --git a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
> > index dd1cd80..b6f759e 100644
> > --- a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
> > +++ b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
> > @@ -78,10 +78,10 @@
> >  		reg = <0x40>;
> >  
> >  		regulators {
> > -			sd1 {
> > +			vdd_dvfs: sd1 {
> >  				regulator-name = "1.315V CPU";
> > -				regulator-min-microvolt = <1315000>;
> > -				regulator-max-microvolt = <1335000>;
> > +				regulator-min-microvolt = <1050000>;
> > +				regulator-max-microvolt = <1350000>;
> >  				regulator-always-on;
> >  				regulator-boot-on;
> >  			};
> > diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
> > index eb3a7ff..8a0420b 100644
> > --- a/arch/arm/mach-shmobile/Kconfig
> > +++ b/arch/arm/mach-shmobile/Kconfig
> > @@ -134,6 +134,8 @@ config MACH_KZM9G
> >  config MACH_KZM9G_REFERENCE
> >  	bool "KZM-A9-GT board - Reference Device Tree Implementation"
> >  	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 e8cd93a..0469e84 100644
> > --- a/arch/arm/mach-shmobile/setup-sh73a0.c
> > +++ b/arch/arm/mach-shmobile/setup-sh73a0.c
> > @@ -1016,6 +1016,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();
> >  
> > @@ -1023,6 +1025,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.2.5
> > 
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH v4 3/3] ARM: shmobile: kzm9g-reference: add CPUFreq support
@ 2013-04-04 21:54       ` Guennadi Liakhovetski
  0 siblings, 0 replies; 24+ messages in thread
From: Guennadi Liakhovetski @ 2013-04-04 21:54 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Simon

Thanks for the review

On Thu, 4 Apr 2013, Simon Horman wrote:

> On Sun, Mar 24, 2013 at 08:27:35PM +0100, Guennadi Liakhovetski wrote:
> > This patch enables the use of the generic cpufreq-cpu0 driver on kzm9g.
> > 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.
> 
> I wonder if it would be possible to re-arange this patch a little.
> 
> 1) vdd_dvfs is added in this patch but it appears to be used in the
>    previous patch in the series. I wonder if this can be resolved
>    by re-ordering the patches.

Right, I'll change that.

> 2) It includes both kzm9g board and sh73a0 SoC changes.
>    I would prefer if the sh73a0 SoC portion (setup-sh73a0.c)
>    was moved into a separate patch. The arm-soc people
>    like to have separate board and SoC branches.

Yes, I'll probably just merge the sh73a0-kzm9g-reference.dts hunk into the 
previous patch.

Thanks
Guennadi

> 
> > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
> > ---
> > 
> > v4: add a cpufreq-cpu0 platform device for the new cpufreq-cpu0 
> > initialisation procedure
> > 
> >  arch/arm/boot/dts/sh73a0-kzm9g-reference.dts |    6 +++---
> >  arch/arm/mach-shmobile/Kconfig               |    2 ++
> >  arch/arm/mach-shmobile/setup-sh73a0.c        |    5 +++++
> >  3 files changed, 10 insertions(+), 3 deletions(-)
> > 
> > diff --git a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
> > index dd1cd80..b6f759e 100644
> > --- a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
> > +++ b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
> > @@ -78,10 +78,10 @@
> >  		reg = <0x40>;
> >  
> >  		regulators {
> > -			sd1 {
> > +			vdd_dvfs: sd1 {
> >  				regulator-name = "1.315V CPU";
> > -				regulator-min-microvolt = <1315000>;
> > -				regulator-max-microvolt = <1335000>;
> > +				regulator-min-microvolt = <1050000>;
> > +				regulator-max-microvolt = <1350000>;
> >  				regulator-always-on;
> >  				regulator-boot-on;
> >  			};
> > diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
> > index eb3a7ff..8a0420b 100644
> > --- a/arch/arm/mach-shmobile/Kconfig
> > +++ b/arch/arm/mach-shmobile/Kconfig
> > @@ -134,6 +134,8 @@ config MACH_KZM9G
> >  config MACH_KZM9G_REFERENCE
> >  	bool "KZM-A9-GT board - Reference Device Tree Implementation"
> >  	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 e8cd93a..0469e84 100644
> > --- a/arch/arm/mach-shmobile/setup-sh73a0.c
> > +++ b/arch/arm/mach-shmobile/setup-sh73a0.c
> > @@ -1016,6 +1016,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();
> >  
> > @@ -1023,6 +1025,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.2.5
> > 
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v4 3/3] ARM: shmobile: kzm9g-reference: add CPUFreq support
@ 2013-04-04 21:54       ` Guennadi Liakhovetski
  0 siblings, 0 replies; 24+ messages in thread
From: Guennadi Liakhovetski @ 2013-04-04 21:54 UTC (permalink / raw)
  To: Simon Horman
  Cc: linux-sh, Magnus Damm, linux-arm-kernel, Rafael J. Wysocki, cpufreq

Hi Simon

Thanks for the review

On Thu, 4 Apr 2013, Simon Horman wrote:

> On Sun, Mar 24, 2013 at 08:27:35PM +0100, Guennadi Liakhovetski wrote:
> > This patch enables the use of the generic cpufreq-cpu0 driver on kzm9g.
> > 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.
> 
> I wonder if it would be possible to re-arange this patch a little.
> 
> 1) vdd_dvfs is added in this patch but it appears to be used in the
>    previous patch in the series. I wonder if this can be resolved
>    by re-ordering the patches.

Right, I'll change that.

> 2) It includes both kzm9g board and sh73a0 SoC changes.
>    I would prefer if the sh73a0 SoC portion (setup-sh73a0.c)
>    was moved into a separate patch. The arm-soc people
>    like to have separate board and SoC branches.

Yes, I'll probably just merge the sh73a0-kzm9g-reference.dts hunk into the 
previous patch.

Thanks
Guennadi

> 
> > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
> > ---
> > 
> > v4: add a cpufreq-cpu0 platform device for the new cpufreq-cpu0 
> > initialisation procedure
> > 
> >  arch/arm/boot/dts/sh73a0-kzm9g-reference.dts |    6 +++---
> >  arch/arm/mach-shmobile/Kconfig               |    2 ++
> >  arch/arm/mach-shmobile/setup-sh73a0.c        |    5 +++++
> >  3 files changed, 10 insertions(+), 3 deletions(-)
> > 
> > diff --git a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
> > index dd1cd80..b6f759e 100644
> > --- a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
> > +++ b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
> > @@ -78,10 +78,10 @@
> >  		reg = <0x40>;
> >  
> >  		regulators {
> > -			sd1 {
> > +			vdd_dvfs: sd1 {
> >  				regulator-name = "1.315V CPU";
> > -				regulator-min-microvolt = <1315000>;
> > -				regulator-max-microvolt = <1335000>;
> > +				regulator-min-microvolt = <1050000>;
> > +				regulator-max-microvolt = <1350000>;
> >  				regulator-always-on;
> >  				regulator-boot-on;
> >  			};
> > diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
> > index eb3a7ff..8a0420b 100644
> > --- a/arch/arm/mach-shmobile/Kconfig
> > +++ b/arch/arm/mach-shmobile/Kconfig
> > @@ -134,6 +134,8 @@ config MACH_KZM9G
> >  config MACH_KZM9G_REFERENCE
> >  	bool "KZM-A9-GT board - Reference Device Tree Implementation"
> >  	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 e8cd93a..0469e84 100644
> > --- a/arch/arm/mach-shmobile/setup-sh73a0.c
> > +++ b/arch/arm/mach-shmobile/setup-sh73a0.c
> > @@ -1016,6 +1016,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();
> >  
> > @@ -1023,6 +1025,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.2.5
> > 
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v4 3/3] ARM: shmobile: kzm9g-reference: add CPUFreq support
  2013-04-04 21:54       ` Guennadi Liakhovetski
  (?)
@ 2013-04-05  0:40         ` Simon Horman
  -1 siblings, 0 replies; 24+ messages in thread
From: Simon Horman @ 2013-04-05  0:40 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Apr 04, 2013 at 11:54:20PM +0200, Guennadi Liakhovetski wrote:
> Hi Simon
> 
> Thanks for the review
> 
> On Thu, 4 Apr 2013, Simon Horman wrote:
> 
> > On Sun, Mar 24, 2013 at 08:27:35PM +0100, Guennadi Liakhovetski wrote:
> > > This patch enables the use of the generic cpufreq-cpu0 driver on kzm9g.
> > > 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.
> > 
> > I wonder if it would be possible to re-arange this patch a little.
> > 
> > 1) vdd_dvfs is added in this patch but it appears to be used in the
> >    previous patch in the series. I wonder if this can be resolved
> >    by re-ordering the patches.
> 
> Right, I'll change that.
> 
> > 2) It includes both kzm9g board and sh73a0 SoC changes.
> >    I would prefer if the sh73a0 SoC portion (setup-sh73a0.c)
> >    was moved into a separate patch. The arm-soc people
> >    like to have separate board and SoC branches.
> 
> Yes, I'll probably just merge the sh73a0-kzm9g-reference.dts hunk into the 
> previous patch.

Thanks, I think that approach should work well.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH v4 3/3] ARM: shmobile: kzm9g-reference: add CPUFreq support
@ 2013-04-05  0:40         ` Simon Horman
  0 siblings, 0 replies; 24+ messages in thread
From: Simon Horman @ 2013-04-05  0:40 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Apr 04, 2013 at 11:54:20PM +0200, Guennadi Liakhovetski wrote:
> Hi Simon
> 
> Thanks for the review
> 
> On Thu, 4 Apr 2013, Simon Horman wrote:
> 
> > On Sun, Mar 24, 2013 at 08:27:35PM +0100, Guennadi Liakhovetski wrote:
> > > This patch enables the use of the generic cpufreq-cpu0 driver on kzm9g.
> > > 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.
> > 
> > I wonder if it would be possible to re-arange this patch a little.
> > 
> > 1) vdd_dvfs is added in this patch but it appears to be used in the
> >    previous patch in the series. I wonder if this can be resolved
> >    by re-ordering the patches.
> 
> Right, I'll change that.
> 
> > 2) It includes both kzm9g board and sh73a0 SoC changes.
> >    I would prefer if the sh73a0 SoC portion (setup-sh73a0.c)
> >    was moved into a separate patch. The arm-soc people
> >    like to have separate board and SoC branches.
> 
> Yes, I'll probably just merge the sh73a0-kzm9g-reference.dts hunk into the 
> previous patch.

Thanks, I think that approach should work well.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v4 3/3] ARM: shmobile: kzm9g-reference: add CPUFreq support
@ 2013-04-05  0:40         ` Simon Horman
  0 siblings, 0 replies; 24+ messages in thread
From: Simon Horman @ 2013-04-05  0:40 UTC (permalink / raw)
  To: Guennadi Liakhovetski
  Cc: linux-sh, Magnus Damm, linux-arm-kernel, Rafael J. Wysocki, cpufreq

On Thu, Apr 04, 2013 at 11:54:20PM +0200, Guennadi Liakhovetski wrote:
> Hi Simon
> 
> Thanks for the review
> 
> On Thu, 4 Apr 2013, Simon Horman wrote:
> 
> > On Sun, Mar 24, 2013 at 08:27:35PM +0100, Guennadi Liakhovetski wrote:
> > > This patch enables the use of the generic cpufreq-cpu0 driver on kzm9g.
> > > 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.
> > 
> > I wonder if it would be possible to re-arange this patch a little.
> > 
> > 1) vdd_dvfs is added in this patch but it appears to be used in the
> >    previous patch in the series. I wonder if this can be resolved
> >    by re-ordering the patches.
> 
> Right, I'll change that.
> 
> > 2) It includes both kzm9g board and sh73a0 SoC changes.
> >    I would prefer if the sh73a0 SoC portion (setup-sh73a0.c)
> >    was moved into a separate patch. The arm-soc people
> >    like to have separate board and SoC branches.
> 
> Yes, I'll probably just merge the sh73a0-kzm9g-reference.dts hunk into the 
> previous patch.

Thanks, I think that approach should work well.

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2013-04-05  0:40 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-24 19:27 [PATCH v4 0/3] CPUFreq for sh73a0 / kzm9g, using cpufreq-cpu0 Guennadi Liakhovetski
2013-03-24 19:27 ` Guennadi Liakhovetski
2013-03-24 19:27 ` Guennadi Liakhovetski
2013-03-24 19:27 ` [PATCH v4 1/3] ARM: shmobile: sh73a0: add support for adjusting CPU frequency Guennadi Liakhovetski
2013-03-24 19:27   ` Guennadi Liakhovetski
2013-03-24 19:27   ` Guennadi Liakhovetski
2013-03-24 19:27 ` [PATCH v4 2/3] ARM: shmobile: kzm9g-reference: add AS3711 and CPUFreq DT bindings Guennadi Liakhovetski
2013-03-24 19:27   ` Guennadi Liakhovetski
2013-03-24 19:27   ` Guennadi Liakhovetski
2013-03-24 19:27 ` [PATCH v4 3/3] ARM: shmobile: kzm9g-reference: add CPUFreq support Guennadi Liakhovetski
2013-03-24 19:27   ` Guennadi Liakhovetski
2013-03-24 19:27   ` Guennadi Liakhovetski
2013-04-04  4:37   ` Simon Horman
2013-04-04  4:37     ` Simon Horman
2013-04-04  4:37     ` Simon Horman
2013-04-04 21:54     ` Guennadi Liakhovetski
2013-04-04 21:54       ` Guennadi Liakhovetski
2013-04-04 21:54       ` Guennadi Liakhovetski
2013-04-05  0:40       ` Simon Horman
2013-04-05  0:40         ` Simon Horman
2013-04-05  0:40         ` Simon Horman
2013-03-27  5:29 ` [PATCH v4 0/3] CPUFreq for sh73a0 / kzm9g, using cpufreq-cpu0 Simon Horman
2013-03-27  5:29   ` Simon Horman
2013-03-27  5:29   ` Simon Horman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.