Thread (19 messages) 19 messages, 5 authors, 2014-10-30

[PATCH 6/7] arm: mediatek: enable gpt6 on boot up to make arch timer working

From: matthias.bgg@gmail.com (Matthias Brugger)
Date: 2014-08-13 09:29:14
Also in: linux-devicetree, lkml

2014-08-13 10:47 GMT+02:00 Linus Walleij [off-list ref]:
On Tue, Aug 12, 2014 at 11:02 AM, Matthias Brugger
[off-list ref] wrote:
quoted
2014-08-11 9:15 GMT+02:00 Linus Walleij [off-list ref]:
quoted
On Thu, Jul 31, 2014 at 6:42 PM, Matthias Brugger
[off-list ref] wrote:
quoted
We enable GTP6 which ungates the arch timer clock. Apart we write the
frequency with which the timer is running in the CNTFREQ register.
In the future this should be done in the bootloader.

Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
(...)
quoted
+       if (of_machine_is_compatible("mediatek,mt6589")) {
+               /* set cntfreq register which is not done in bootloader */
+               asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r" (13000000));
I guess this is for something like the ARM arch timer in
drivers/clocksource/arm_arch_timer.c

Instead of doing this, use the DT property "clock-frequency" on
the ARM arch timer node, as that overrides the CP15 setting.
quoted
+
+               /* turn on GPT6 which ungates arch timer clocks */
+               gpt_base = ioremap(GPT6_CON_MT65xx, 0x04);
+       }
+
+       /* enabel clock and set to free-run */
+       if (gpt_base)
+               writel(0x31, gpt_base);
Why is this not done properly in the GPT driver (I guess
in drivers/clocksource/mtk_timer.c) instead of remapping
it and fiddling around in the machine?
I didn't put it in the GPT driver, because that would mean, that you
need to have the mtk_timer to be able to use the ARM arch timer.
From my understanding this are two independent blocks in the SoC.
Apart from that, as stated in the commit message, this patch is a
workaround until we have a bootloader which does this for us.
Therefore I thought the init_time function would be the better place to do this.
OK I get the point...

What about the ARM arch timer fixup then, will that also be
fixed in the boot loader eventually?
Do you refer to clock frequency in the cntfreq register? I think that
this should go in the DTS as you said.
Same holds for the magic 0x31, which should be done through defines.

Cheers,
Matthias
Yours,
Linus Walleij


-- 
motzblog.wordpress.com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help