* [PATCH 0/2] clk: imx: pll14xx: io relaxed fix
@ 2019-11-13 7:24 Peng Fan
2019-11-13 7:24 ` [PATCH 1/2] clk: imx: pll14xx: use writel_relaxed Peng Fan
2019-11-13 7:24 ` [PATCH 2/2] clk: imx: pll14xx: use readl to force write completed Peng Fan
0 siblings, 2 replies; 6+ messages in thread
From: Peng Fan @ 2019-11-13 7:24 UTC (permalink / raw)
To: sboyd, shawnguo, s.hauer, festevam, Abel Vesa
Cc: kernel, dl-linux-imx, Aisheng Dong, linux-clk, linux-arm-kernel,
linux-kernel, Leonard Crestez, Alice Guo, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
This patchset is insipred from Will Deacon's slide/video:
https://elinux.org/images/a/a8/Uh-oh-Its-IO-Ordering-Will-Deacon-Arm.pdf
https://www.youtube.com/watch?v=i6DayghhA8Q
Peng Fan (2):
clk: imx: pll14xx: use writel_relaxed
clk: imx: pll14xx: use readl to force write completed
drivers/clk/imx/clk-pll14xx.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--
2.16.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] clk: imx: pll14xx: use writel_relaxed
2019-11-13 7:24 [PATCH 0/2] clk: imx: pll14xx: io relaxed fix Peng Fan
@ 2019-11-13 7:24 ` Peng Fan
2019-11-13 11:10 ` Daniel Baluta
2019-11-13 7:24 ` [PATCH 2/2] clk: imx: pll14xx: use readl to force write completed Peng Fan
1 sibling, 1 reply; 6+ messages in thread
From: Peng Fan @ 2019-11-13 7:24 UTC (permalink / raw)
To: sboyd, shawnguo, s.hauer, festevam, Abel Vesa
Cc: kernel, dl-linux-imx, Aisheng Dong, linux-clk, linux-arm-kernel,
linux-kernel, Leonard Crestez, Alice Guo, Peng Fan, Will Deacon
From: Peng Fan <peng.fan@nxp.com>
It not make sense to use writel, use relaxed variant.
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/clk/imx/clk-pll14xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/imx/clk-pll14xx.c b/drivers/clk/imx/clk-pll14xx.c
index 5682fce9f5e5..e34813904023 100644
--- a/drivers/clk/imx/clk-pll14xx.c
+++ b/drivers/clk/imx/clk-pll14xx.c
@@ -199,7 +199,7 @@ static int clk_pll1416x_set_rate(struct clk_hw *hw, unsigned long drate,
/* Enable BYPASS */
tmp |= BYPASS_MASK;
- writel(tmp, pll->base);
+ writel_relaxed(tmp, pll->base);
div_val = (rate->mdiv << MDIV_SHIFT) | (rate->pdiv << PDIV_SHIFT) |
(rate->sdiv << SDIV_SHIFT);
--
2.16.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] clk: imx: pll14xx: use readl to force write completed
2019-11-13 7:24 [PATCH 0/2] clk: imx: pll14xx: io relaxed fix Peng Fan
2019-11-13 7:24 ` [PATCH 1/2] clk: imx: pll14xx: use writel_relaxed Peng Fan
@ 2019-11-13 7:24 ` Peng Fan
1 sibling, 0 replies; 6+ messages in thread
From: Peng Fan @ 2019-11-13 7:24 UTC (permalink / raw)
To: sboyd, shawnguo, s.hauer, festevam, Abel Vesa
Cc: kernel, dl-linux-imx, Aisheng Dong, linux-clk, linux-arm-kernel,
linux-kernel, Leonard Crestez, Alice Guo, Peng Fan, Will Deacon
From: Peng Fan <peng.fan@nxp.com>
To ensure writes to clock registers have properly completed,
add a readl after writel_relaxed. Then we could make sure
when udelay, write has been completed.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Will Deacon <will@kernel.org>
---
drivers/clk/imx/clk-pll14xx.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/clk/imx/clk-pll14xx.c b/drivers/clk/imx/clk-pll14xx.c
index e34813904023..2bbcfbf8081a 100644
--- a/drivers/clk/imx/clk-pll14xx.c
+++ b/drivers/clk/imx/clk-pll14xx.c
@@ -205,6 +205,12 @@ static int clk_pll1416x_set_rate(struct clk_hw *hw, unsigned long drate,
(rate->sdiv << SDIV_SHIFT);
writel_relaxed(div_val, pll->base + 0x4);
+ /*
+ * readl will force write completed. There is a udelay below,
+ * we need make sure before udelay, write has been completed
+ */
+ readl(pll->base + 0x4);
+
/*
* According to SPEC, t3 - t2 need to be greater than
* 1us and 1/FREF, respectively.
--
2.16.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] clk: imx: pll14xx: use writel_relaxed
2019-11-13 7:24 ` [PATCH 1/2] clk: imx: pll14xx: use writel_relaxed Peng Fan
@ 2019-11-13 11:10 ` Daniel Baluta
2019-11-13 12:15 ` Peng Fan
0 siblings, 1 reply; 6+ messages in thread
From: Daniel Baluta @ 2019-11-13 11:10 UTC (permalink / raw)
To: Peng Fan, s.hauer, Abel Vesa, sboyd, shawnguo, festevam
Cc: dl-linux-imx, linux-kernel, Aisheng Dong, Alice Guo,
linux-arm-kernel, linux-clk, Leonard Crestez, kernel, will
On Wed, 2019-11-13 at 07:24 +0000, Peng Fan wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> It not make sense to use writel, use relaxed variant.
>
Hi Peng,
Please explain why this change is needed.
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH 1/2] clk: imx: pll14xx: use writel_relaxed
2019-11-13 11:10 ` Daniel Baluta
@ 2019-11-13 12:15 ` Peng Fan
2019-11-13 12:35 ` Daniel Baluta
0 siblings, 1 reply; 6+ messages in thread
From: Peng Fan @ 2019-11-13 12:15 UTC (permalink / raw)
To: Daniel Baluta, s.hauer, Abel Vesa, sboyd, shawnguo, festevam
Cc: dl-linux-imx, linux-kernel, Aisheng Dong, Alice Guo,
linux-arm-kernel, linux-clk, Leonard Crestez, kernel, will
Hi Daniel,
> Subject: Re: [PATCH 1/2] clk: imx: pll14xx: use writel_relaxed
>
>
> On Wed, 2019-11-13 at 07:24 +0000, Peng Fan wrote:
> > From: Peng Fan <peng.fan@nxp.com>
> >
> > It not make sense to use writel, use relaxed variant.
> >
>
> Hi Peng,
>
> Please explain why this change is needed.
writel has a barrier, however that barrier is not needed,
because device memory access is in order and clk driver
has spin_lock or other lock to make sure write finished.
I would hear more comments before I post V2 about
the change and other similar patches to switch to
use relaxed API.
Thanks,
Peng.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] clk: imx: pll14xx: use writel_relaxed
2019-11-13 12:15 ` Peng Fan
@ 2019-11-13 12:35 ` Daniel Baluta
0 siblings, 0 replies; 6+ messages in thread
From: Daniel Baluta @ 2019-11-13 12:35 UTC (permalink / raw)
To: Peng Fan, s.hauer, Abel Vesa, sboyd, shawnguo, festevam
Cc: dl-linux-imx, linux-kernel, Aisheng Dong, Alice Guo,
linux-arm-kernel, linux-clk, Leonard Crestez, kernel, will
On Wed, 2019-11-13 at 12:15 +0000, Peng Fan wrote:
> Hi Daniel,
>
> > Subject: Re: [PATCH 1/2] clk: imx: pll14xx: use writel_relaxed
> >
> >
> > On Wed, 2019-11-13 at 07:24 +0000, Peng Fan wrote:
> > > From: Peng Fan <peng.fan@nxp.com>
> > >
> > > It not make sense to use writel, use relaxed variant.
> > >
> >
> > Hi Peng,
> >
> > Please explain why this change is needed.
>
> writel has a barrier, however that barrier is not needed,
> because device memory access is in order and clk driver
> has spin_lock or other lock to make sure write finished.
>
Make sure you add this in the commit message for v2 :).
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-11-13 12:36 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-13 7:24 [PATCH 0/2] clk: imx: pll14xx: io relaxed fix Peng Fan
2019-11-13 7:24 ` [PATCH 1/2] clk: imx: pll14xx: use writel_relaxed Peng Fan
2019-11-13 11:10 ` Daniel Baluta
2019-11-13 12:15 ` Peng Fan
2019-11-13 12:35 ` Daniel Baluta
2019-11-13 7:24 ` [PATCH 2/2] clk: imx: pll14xx: use readl to force write completed Peng Fan
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).