Currently, gpt timer's clock is from ipg_per, and ipg_per clock is from ipg
on most of i.MX6 series SOCs, but ipg's rate may be scaled when system enters
low bus mode for saving power, then gpt timer's clock rate will be scaled as
well, as system timer should be kept stable and NOT drift, better to keep gpt
timer's clk at fixed rate, on i.MX6Q TO > 1.0, i.MX6DL and i.MX6SX, there is
OSC clk available for gpt timer, we should enable this feature, the hardware
design is as below:
i.MX6Q TO > 1.0: GPT_CR_CLKSRC, 3b'101 selects fix clock
of OSC / 8 for gpt per clk;
i.MX6DL and i.MX6SX: GPT_CR_CLKSRC, 3b'101 selects OSC
for gpt per clk, and we must enable GPT_CR_24MEM to
enable OSC clk source for gpt per, GPT_PR_PRESCALER24M
is for pre-scaling of this OSC clk, here set it to 8
to make gpt per clk is 3MHz;
i.MX6SL: ipg_per can be from OSC directly, so no need to
implement this new clk source for gpt per.
As we still need to make it work on i.MX6Q TO1.0 which has no OSC clock source
for gpt per, so we add a soc_per clock for i.MX6Q, other SoCs all have OSC
clock source available for gpt per, so we can just replace the original gpt
per clk with gpt_3m clock.
Anson Huang (3):
ARM: imx: add gpt_3m clk for i.mx6qdl
ARM: dts: imx6: make gpt per clock can be from OSC
ARM: imx: source gpt per clk from OSC for system timer
arch/arm/boot/dts/imx6qdl.dtsi | 5 ++--
arch/arm/boot/dts/imx6sx.dtsi | 2 +-
arch/arm/mach-imx/clk-imx6q.c | 1 +
arch/arm/mach-imx/time.c | 41 ++++++++++++++++++++++++-----
include/dt-bindings/clock/imx6qdl-clock.h | 3 ++-
5 files changed, 42 insertions(+), 10 deletions(-)
--
1.7.9.5
Add gpt_3m clock for i.mx6qdl, as gpt can source clock
from OSC, some i.MX6 series SOCs has fixed divider of
8 for gpt clock, so here add a fix clk of gpt_3m.
Signed-off-by: Anson Huang <redacted>
---
arch/arm/mach-imx/clk-imx6q.c | 1 +
include/dt-bindings/clock/imx6qdl-clock.h | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
Original gpt per clk parent is from ipg_per clk which
may be scaled when system enter low bus mode, as ipg
clk will be lower in low bus mode, to keep system clk
NOT drift, select gpt per clk parent from OSC which
is at fixed freq always.
On i.mx6qdl, add a osc_per clk source for i.mx6q
TO > 1.0 and all i.MX6dl SoC.
On i.mx6sx, just make gpt per clk from OSC.
Signed-off-by: Anson Huang <redacted>
---
change log from v1 -> v2
on i.mx6q TO1.0, there is no OSC clk source for
gpt per, so I have to add a new clk source of
osc_per for gpt to cover i.mx6q TO1.0.
arch/arm/boot/dts/imx6qdl.dtsi | 5 +++--
arch/arm/boot/dts/imx6sx.dtsi | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
On i.MX6Q TO > 1.0, i.MX6DL and i.MX6SX, gpt per clock
can be from OSC instead of ipg_per, as ipg_per's rate
may be scaled when system enter low bus mode, to keep
system timer NOT drift, better to make gpt per clock
at fixed rate, here add support for gpt per clock to
be from OSC which is at fixed rate always.
There are some difference on this implementation of
gpt per clock source, see below for details:
i.MX6Q TO > 1.0: GPT_CR_CLKSRC, 3b'101 selects fix clock
of OSC / 8 for gpt per clk;
i.MX6DL and i.MX6SX: GPT_CR_CLKSRC, 3b'101 selects OSC
for gpt per clk, and we must enable GPT_CR_24MEM to
enable OSC clk source for gpt per, GPT_PR_PRESCALER24M
is for pre-scaling of this OSC clk, here set it to 8
to make gpt per clk is 3MHz;
i.MX6SL: ipg_per can be from OSC directly, so no need to
implement this new clk source for gpt per.
Signed-off-by: Anson Huang <redacted>
---
change logs v1 -> v2:
add gpt per clk rate check before setting gpt's clk
source, this is to cover all i.MX6 SoCs and make it
work with old dtb.
arch/arm/mach-imx/time.c | 41 +++++++++++++++++++++++++++++++++++------
1 file changed, 35 insertions(+), 6 deletions(-)
@@ -293,7 +299,7 @@ static int __init mxc_clockevent_init(struct clk *timer_clk)staticvoid__init_mxc_timer_init(intirq,structclk*clk_per,structclk*clk_ipg){-uint32_ttctl_val;+uint32_ttctl_val,tprer_val;if(IS_ERR(clk_per)){pr_err("i.MX timer: unable to get clk\n");
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html