* [GIT PULL] Renesas CPG update for v3.15
@ 2014-02-06 6:14 Simon Horman
2014-02-06 6:15 ` [PATCH] ARM: shmobile: wait for MSTP clock status to toggle, when enabling it Simon Horman
2014-02-20 8:18 ` [GIT PULL] Renesas CPG update for v3.15 Olof Johansson
0 siblings, 2 replies; 4+ messages in thread
From: Simon Horman @ 2014-02-06 6:14 UTC (permalink / raw)
To: linux-arm-kernel
Hi Olof, Hi Kevin, Hi Arnd,
please consider this Renesas CPG update for v3.15.
The following changes since commit 38dbfb59d1175ef458d006556061adeaa8751b72:
Linus 3.14-rc1 (2014-02-02 16:42:13 -0800)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git tags/renesas-cpg-for-v3.15
for you to fetch changes up to a028c6da34d434e35ba8322568c756ea97ff3c18:
ARM: shmobile: wait for MSTP clock status to toggle, when enabling it (2014-02-04 10:22:39 +0900)
----------------------------------------------------------------
Renesas CPG update for v3.15
* Wait for MSTP clock status to toggle when enabling it
----------------------------------------------------------------
Guennadi Liakhovetski (1):
ARM: shmobile: wait for MSTP clock status to toggle, when enabling it
drivers/sh/clk/cpg.c | 38 ++++++++++++++++++++++++++++++++++++++
include/linux/sh_clk.h | 19 ++++++++++++-------
2 files changed, 50 insertions(+), 7 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] ARM: shmobile: wait for MSTP clock status to toggle, when enabling it
2014-02-06 6:14 [GIT PULL] Renesas CPG update for v3.15 Simon Horman
@ 2014-02-06 6:15 ` Simon Horman
2014-02-20 8:18 ` [GIT PULL] Renesas CPG update for v3.15 Olof Johansson
1 sibling, 0 replies; 4+ messages in thread
From: Simon Horman @ 2014-02-06 6:15 UTC (permalink / raw)
To: linux-arm-kernel
From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
On r-/sh-mobile SoCs MSTP clocks are used by the runtime PM to dynamically
enable and disable peripheral clocks. To make sure the clock has really
started we have to read back its status register until it confirms success.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
drivers/sh/clk/cpg.c | 38 ++++++++++++++++++++++++++++++++++++++
include/linux/sh_clk.h | 19 ++++++++++++-------
2 files changed, 50 insertions(+), 7 deletions(-)
diff --git a/drivers/sh/clk/cpg.c b/drivers/sh/clk/cpg.c
index 1ebe67c..7442bc1 100644
--- a/drivers/sh/clk/cpg.c
+++ b/drivers/sh/clk/cpg.c
@@ -36,9 +36,47 @@ static void sh_clk_write(int value, struct clk *clk)
iowrite32(value, clk->mapped_reg);
}
+static unsigned int r8(const void __iomem *addr)
+{
+ return ioread8(addr);
+}
+
+static unsigned int r16(const void __iomem *addr)
+{
+ return ioread16(addr);
+}
+
+static unsigned int r32(const void __iomem *addr)
+{
+ return ioread32(addr);
+}
+
static int sh_clk_mstp_enable(struct clk *clk)
{
sh_clk_write(sh_clk_read(clk) & ~(1 << clk->enable_bit), clk);
+ if (clk->status_reg) {
+ unsigned int (*read)(const void __iomem *addr);
+ int i;
+ void __iomem *mapped_status = (phys_addr_t)clk->status_reg -
+ (phys_addr_t)clk->enable_reg + clk->mapped_reg;
+
+ if (clk->flags & CLK_ENABLE_REG_8BIT)
+ read = r8;
+ else if (clk->flags & CLK_ENABLE_REG_16BIT)
+ read = r16;
+ else
+ read = r32;
+
+ for (i = 1000;
+ (read(mapped_status) & (1 << clk->enable_bit)) && i;
+ i--)
+ cpu_relax();
+ if (!i) {
+ pr_err("cpg: failed to enable %p[%d]\n",
+ clk->enable_reg, clk->enable_bit);
+ return -ETIMEDOUT;
+ }
+ }
return 0;
}
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
index 60c7239..1f208b2 100644
--- a/include/linux/sh_clk.h
+++ b/include/linux/sh_clk.h
@@ -52,6 +52,7 @@ struct clk {
unsigned long flags;
void __iomem *enable_reg;
+ void __iomem *status_reg;
unsigned int enable_bit;
void __iomem *mapped_reg;
@@ -116,22 +117,26 @@ long clk_round_parent(struct clk *clk, unsigned long target,
unsigned long *best_freq, unsigned long *parent_freq,
unsigned int div_min, unsigned int div_max);
-#define SH_CLK_MSTP(_parent, _enable_reg, _enable_bit, _flags) \
+#define SH_CLK_MSTP(_parent, _enable_reg, _enable_bit, _status_reg, _flags) \
{ \
.parent = _parent, \
.enable_reg = (void __iomem *)_enable_reg, \
.enable_bit = _enable_bit, \
+ .status_reg = _status_reg, \
.flags = _flags, \
}
-#define SH_CLK_MSTP32(_p, _r, _b, _f) \
- SH_CLK_MSTP(_p, _r, _b, _f | CLK_ENABLE_REG_32BIT)
+#define SH_CLK_MSTP32(_p, _r, _b, _f) \
+ SH_CLK_MSTP(_p, _r, _b, 0, _f | CLK_ENABLE_REG_32BIT)
-#define SH_CLK_MSTP16(_p, _r, _b, _f) \
- SH_CLK_MSTP(_p, _r, _b, _f | CLK_ENABLE_REG_16BIT)
+#define SH_CLK_MSTP32_STS(_p, _r, _b, _s, _f) \
+ SH_CLK_MSTP(_p, _r, _b, _s, _f | CLK_ENABLE_REG_32BIT)
-#define SH_CLK_MSTP8(_p, _r, _b, _f) \
- SH_CLK_MSTP(_p, _r, _b, _f | CLK_ENABLE_REG_8BIT)
+#define SH_CLK_MSTP16(_p, _r, _b, _f) \
+ SH_CLK_MSTP(_p, _r, _b, 0, _f | CLK_ENABLE_REG_16BIT)
+
+#define SH_CLK_MSTP8(_p, _r, _b, _f) \
+ SH_CLK_MSTP(_p, _r, _b, 0, _f | CLK_ENABLE_REG_8BIT)
int sh_clk_mstp_register(struct clk *clks, int nr);
--
1.8.5.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [GIT PULL] Renesas CPG update for v3.15
2014-02-06 6:14 [GIT PULL] Renesas CPG update for v3.15 Simon Horman
2014-02-06 6:15 ` [PATCH] ARM: shmobile: wait for MSTP clock status to toggle, when enabling it Simon Horman
@ 2014-02-20 8:18 ` Olof Johansson
2014-02-20 8:31 ` Olof Johansson
1 sibling, 1 reply; 4+ messages in thread
From: Olof Johansson @ 2014-02-20 8:18 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Feb 06, 2014 at 03:14:00PM +0900, Simon Horman wrote:
> Hi Olof, Hi Kevin, Hi Arnd,
>
> please consider this Renesas CPG update for v3.15.
>
>
> The following changes since commit 38dbfb59d1175ef458d006556061adeaa8751b72:
>
> Linus 3.14-rc1 (2014-02-02 16:42:13 -0800)
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git tags/renesas-cpg-for-v3.15
>
> for you to fetch changes up to a028c6da34d434e35ba8322568c756ea97ff3c18:
>
> ARM: shmobile: wait for MSTP clock status to toggle, when enabling it (2014-02-04 10:22:39 +0900)
>
> ----------------------------------------------------------------
> Renesas CPG update for v3.15
>
> * Wait for MSTP clock status to toggle when enabling it
Hi Simon,
Is there a reason this is coming to arm-soc instead of to the clk tree
maintainer?
-Olof
^ permalink raw reply [flat|nested] 4+ messages in thread
* [GIT PULL] Renesas CPG update for v3.15
2014-02-20 8:18 ` [GIT PULL] Renesas CPG update for v3.15 Olof Johansson
@ 2014-02-20 8:31 ` Olof Johansson
0 siblings, 0 replies; 4+ messages in thread
From: Olof Johansson @ 2014-02-20 8:31 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Feb 20, 2014 at 12:18 AM, Olof Johansson <olof@lixom.net> wrote:
> On Thu, Feb 06, 2014 at 03:14:00PM +0900, Simon Horman wrote:
>> Hi Olof, Hi Kevin, Hi Arnd,
>>
>> please consider this Renesas CPG update for v3.15.
>>
>>
>> The following changes since commit 38dbfb59d1175ef458d006556061adeaa8751b72:
>>
>> Linus 3.14-rc1 (2014-02-02 16:42:13 -0800)
>>
>> are available in the git repository at:
>>
>> git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git tags/renesas-cpg-for-v3.15
>>
>> for you to fetch changes up to a028c6da34d434e35ba8322568c756ea97ff3c18:
>>
>> ARM: shmobile: wait for MSTP clock status to toggle, when enabling it (2014-02-04 10:22:39 +0900)
>>
>> ----------------------------------------------------------------
>> Renesas CPG update for v3.15
>>
>> * Wait for MSTP clock status to toggle when enabling it
>
> Hi Simon,
>
> Is there a reason this is coming to arm-soc instead of to the clk tree
> maintainer?
Nevermind, I came across the dependent branch now.
-Olof
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-02-20 8:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-06 6:14 [GIT PULL] Renesas CPG update for v3.15 Simon Horman
2014-02-06 6:15 ` [PATCH] ARM: shmobile: wait for MSTP clock status to toggle, when enabling it Simon Horman
2014-02-20 8:18 ` [GIT PULL] Renesas CPG update for v3.15 Olof Johansson
2014-02-20 8:31 ` Olof Johansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).