arm: mediatek: Add more basic features
Subsystems (5)
Matthias Brugger
maintainercover arm: mediatek: Add more basic features
This patch set is based on the patches merged for v3.17 in the clock [0] and arm-soc [1] repositories.
The most important patch enables the arm arch timer for mt6589. As already seen on other vendor SoCs, to enable the arch timer we have to enable a SoC timer. This should be normally done by the bootloader. As up to now no open source bootloader exists for the mt6589, I added the functionality to the init_time function.
Other features are low-level debugging on the mt6589, the addition to the "make dtbs" and multi_v7_defconfig, as well as a small typo in the dtsi file.
[0] http://git.linaro.org/people/daniel.lezcano/linux.git/shortlog/refs/heads/clockevents/3.17
[1] https://git.kernel.org/cgit/linux/kernel/git/arm/arm-soc.git/commit/?h=next/soc&id=60c70c8c58d8cde3813e730d4e753531f292a1f0
Matthias Brugger (7):
arm: dts: Build dtb for Mediatek board
arm: multi_v7_defconfig: Enable Mediatek platform
arm: dts: mt6589: Fix typo in GIC unit address
arm: mediatek: Add earlyprintk support for mt6589
arm: dts: mt6589-aquaris5: Add boot argument earlyprintk
arm: mediatek: enable gpt6 on boot up to make arch timer working
arm: dts: mt6589: Add arm arch timer node
arch/arm/Kconfig.debug | 10 ++++++++++ arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/mt6589-aquaris5.dts | 4 ++++ arch/arm/boot/dts/mt6589.dtsi | 14 +++++++++++--- arch/arm/configs/multi_v7_defconfig | 1 + arch/arm/mach-mediatek/mediatek.c | 27 +++++++++++++++++++++++++++ 6 files changed, 54 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.9.5
Matthias Brugger
maintainerPATCH 1/7 arm: dts: Build dtb for Mediatek board
This allows the "make dtbs" to build the aquaris5 dtb for the Mediatek SoC.
--- arch/arm/boot/dts/Makefile | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/Makefile +1 -0
@@ -445,6 +445,7 @@ dtb-$(CONFIG_MACH_DOVE) += dove-cm-a510.dtb \ dove-d2plug.dtb \ dove-d3plug.dtb \ dove-dove-db.dtb +dtb-$(CONFIG_ARCH_MEDIATEK) += mt6589-aquaris5.dtb targets += dtbs dtbs_install targets += $(dtb-y)
Signature · 1 line
1.7.9.5
Matthias Brugger
maintainerPATCH 2/7 arm: multi_v7_defconfig: Enable Mediatek platform
In reply to Matthias BruggerEnable Mediatek platform support for multi_v7_defconfig.
--- arch/arm/configs/multi_v7_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/configs/multi_v7_defconfig +1 -0
@@ -39,6 +39,7 @@ CONFIG_SOC_AM33XX=y CONFIG_SOC_AM43XX=y CONFIG_SOC_DRA7XX=y CONFIG_ARCH_QCOM=y +CONFIG_ARCH_MEDIATEK=y CONFIG_ARCH_MSM8X60=y CONFIG_ARCH_MSM8960=y CONFIG_ARCH_MSM8974=y
Signature · 1 line
1.7.9.5
Matthias Brugger
maintainerPATCH 3/7 arm: dts: mt6589: Fix typo in GIC unit address
In reply to Matthias BruggerThis changes the unit address of the gic node to it's first register area.
--- arch/arm/boot/dts/mt6589.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/mt6589.dtsi +1 -1
@@ -81,7 +81,7 @@ clock-names = "system-clk", "rtc-clk"; }; - gic: interrupt-controller at 10212000 { + gic: interrupt-controller at 10211000 { compatible = "arm,cortex-a15-gic"; interrupt-controller; #interrupt-cells = <3>;
Signature · 1 line
1.7.9.5
Matthias Brugger
maintainerPATCH 4/7 arm: mediatek: Add earlyprintk support for mt6589
In reply to Matthias BruggerEnable low-level debug for Mediatek mt6589 SoC on UART0.
--- arch/arm/Kconfig.debug | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm/Kconfig.debug +10 -0
@@ -818,6 +818,14 @@ choice Say Y here if you want kernel low-level debugging support on Ux500 based platforms. + config DEBUG_MT6589_UART0 + bool "Mediatek mt6589 UART0" + depends on ARCH_MEDIATEK + select DEBUG_UART_8250 + help + Say Y here if you want kernel low-level debugging support + for Mediatek mt6589 based platforms on UART0. + config DEBUG_VEXPRESS_UART0_DETECT bool "Autodetect UART0 on Versatile Express Cortex-A core tiles" depends on ARCH_VEXPRESS && CPU_CP15_MMU
@@ -1053,6 +1061,7 @@ config DEBUG_UART_PHYS default 0x10126000 if DEBUG_RK3X_UART1 default 0x101f1000 if ARCH_VERSATILE default 0x101fb000 if DEBUG_NOMADIK_UART + default 0x11006000 if DEBUG_MT6589_UART0 default 0x16000000 if ARCH_INTEGRATOR default 0x18000300 if DEBUG_BCM_5301X default 0x1c090000 if DEBUG_VEXPRESS_UART0_RS1
@@ -1114,6 +1123,7 @@ config DEBUG_UART_VIRT default 0xf01fb000 if DEBUG_NOMADIK_UART default 0xf0201000 if DEBUG_BCM2835 default 0xf1000300 if DEBUG_BCM_5301X + default 0xf1006000 if DEBUG_MT6589_UART0 default 0xf11f1000 if ARCH_VERSATILE default 0xf1600000 if ARCH_INTEGRATOR default 0xf1c28000 if DEBUG_SUNXI_UART0
Signature · 1 line
1.7.9.5
Matthias Brugger
maintainerPATCH 5/7 arm: dts: mt6589-aquaris5: Add boot argument earlyprintk
In reply to Matthias BruggerAdd boot argument for earlyprintk to the aquaris5 device tree file.
--- arch/arm/boot/dts/mt6589-aquaris5.dts | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/boot/dts/mt6589-aquaris5.dts +4 -0
@@ -19,6 +19,10 @@ / { model = "bq Aquaris5"; + chosen { + bootargs = "earlyprintk"; + }; + memory { reg = <0x80000000 0x40000000>; };
Signature · 1 line
1.7.9.5
Matthias Brugger
maintainerPATCH 6/7 arm: mediatek: enable gpt6 on boot up to make arch timer working
In reply to Matthias BruggerWe 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.
--- arch/arm/mach-mediatek/mediatek.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
arch/arm/mach-mediatek/mediatek.c +27 -0
@@ -16,6 +16,32 @@*/ #include <linux/init.h> #include <asm/mach/arch.h> +#include <linux/of.h> +#include <linux/clk-provider.h> +#include <linux/clocksource.h> + + +#define GPT6_CON_MT65xx 0x10008060 + +static void __init mediatek_timer_init (void ) +{ +static void __iomem *gpt_base; + +if (of_machine_is_compatible ("mediatek,mt6589" )) { +/* set cntfreq register which is not done in bootloader */ + asmvolatile ("mcr p15, 0, %0, c14, c0, 0" : :"r" (13000000 )); + +/* 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); + +of_clk_init (NULL ); +clocksource_of_init (); +};static const char *const mediatek_board_dt_compat[] = {"mediatek,mt6589" ,
@@ -24,4 +50,5 @@ static const char * const mediatek_board_dt_compat[] = {DT_MACHINE_START (MEDIATEK_DT ,"Mediatek Cortex-A7 (Device Tree)" ) .dt_compat = mediatek_board_dt_compat, + .init_time = mediatek_timer_init,MACHINE_END
Signature · 1 line
1.7.9.5
Re: [PATCH 6/7] arm: mediatek: enable gpt6 on boot up to make arch timer working
Quoted 5 lines · Matthias Brugger
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 <[email protected]>
(...)
arch/arm/mach-mediatek/mediatek.c line 32
Quoted 3 lines
arch/arm/mach-mediatek/mediatek.c +3
-0+if (of_machine_is_compatible ("mediatek,mt6589" )) { +/* set cntfreq register which is not done in bootloader */ + asmvolatile ("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.
arch/arm/mach-mediatek/mediatek.c line 40
Quoted 8 lines
arch/arm/mach-mediatek/mediatek.c +8
-0+ +/* 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?
If it only affects the mt6589 just add another compatible string to that driver like "mediatek,mt6589-timer" as it properly reflects the fact that this timer is slightly different on the 6589.
Also use a #define for the magic constant 0x31.
Yours,
Linus Walleij
Matthias Brugger
maintainerRe: [PATCH 6/7] arm: mediatek: enable gpt6 on boot up to make arch timer working
2014-08-11 9:15 GMT+02:00 Linus Walleij <[email protected]>:
Quoted 20 lines
Quoted 5 lines · Matthias Brugger
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 <[email protected]>(...)
arch/arm/mach-mediatek/mediatek.c line 32
Quoted 3 lines
arch/arm/mach-mediatek/mediatek.c +3
-0+if (of_machine_is_compatible ("mediatek,mt6589" )) { +/* set cntfreq register which is not done in bootloader */ + asmvolatile ("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.cInstead of doing this, use the DT property "clock-frequency" on the ARM arch timer node, as that overrides the CP15 setting.
Quoted 12 lines
arch/arm/mach-mediatek/mediatek.c line 40
Quoted 8 lines
arch/arm/mach-mediatek/mediatek.c +8
-0+ +/* 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.
Quoted 1 line
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.
Thanks,
Matthias
Quoted 9 lines
If it only affects the mt6589 just add another compatible string to that driver like "mediatek,mt6589-timer" as it properly reflects the fact that this timer is slightly different on the 6589.
Also use a #define for the magic constant
0x31.Yours,
Linus Walleij
Signature · 1 line
motzblog.wordpress.com
Re: [PATCH 6/7] arm: mediatek: enable gpt6 on boot up to make arch timer working
Quoted 34 lines · Matthias Brugger
2014-08-11 9:15 GMT+02:00 Linus Walleij <[email protected]>:
Quoted 20 lines
Quoted 5 lines · Matthias Brugger
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 <[email protected]>(...)
arch/arm/mach-mediatek/mediatek.c line 32
Quoted 3 lines
arch/arm/mach-mediatek/mediatek.c +3
-0+if (of_machine_is_compatible ("mediatek,mt6589" )) { +/* set cntfreq register which is not done in bootloader */ + asmvolatile ("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.cInstead of doing this, use the DT property "clock-frequency" on the ARM arch timer node, as that overrides the CP15 setting.
Quoted 12 lines
arch/arm/mach-mediatek/mediatek.c line 40
Quoted 8 lines
arch/arm/mach-mediatek/mediatek.c +8
-0+ +/* 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?
Quoted 6 lines
I didn't put it in the GPT driver, because that would mean, that you need to have the
mtk_timerto 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 theinit_timefunction would be the better place to do this.
I agree that the bootloader is the right place, and the fixup in the machine code until that is in place is the right place for the fixup.
Rob
Re: [PATCH 6/7] arm: mediatek: enable gpt6 on boot up to make arch timer working
In reply to Matthias BruggerQuoted 34 lines · Matthias Brugger
2014-08-11 9:15 GMT+02:00 Linus Walleij <[email protected]>:
Quoted 20 lines
Quoted 5 lines · Matthias Brugger
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 <[email protected]>(...)
arch/arm/mach-mediatek/mediatek.c line 32
Quoted 3 lines
arch/arm/mach-mediatek/mediatek.c +3
-0+if (of_machine_is_compatible ("mediatek,mt6589" )) { +/* set cntfreq register which is not done in bootloader */ + asmvolatile ("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.cInstead of doing this, use the DT property "clock-frequency" on the ARM arch timer node, as that overrides the CP15 setting.
Quoted 12 lines
arch/arm/mach-mediatek/mediatek.c line 40
Quoted 8 lines
arch/arm/mach-mediatek/mediatek.c +8
-0+ +/* 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?
Quoted 6 lines
I didn't put it in the GPT driver, because that would mean, that you need to have the
mtk_timerto 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 theinit_timefunction 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?
Yours,
Linus Walleij
Matthias Brugger
maintainerRe: [PATCH 6/7] arm: mediatek: enable gpt6 on boot up to make arch timer working
2014-08-13 10:47 GMT+02:00 Linus Walleij <[email protected]>:
Quoted 43 lines
Quoted 34 lines · Matthias Brugger
2014-08-11 9:15 GMT+02:00 Linus Walleij <[email protected]>:
Quoted 20 lines
Quoted 5 lines · Matthias Brugger
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 <[email protected]>(...)
arch/arm/mach-mediatek/mediatek.c line 32
Quoted 3 lines
arch/arm/mach-mediatek/mediatek.c +3
-0+if (of_machine_is_compatible ("mediatek,mt6589" )) { +/* set cntfreq register which is not done in bootloader */ + asmvolatile ("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.cInstead of doing this, use the DT property "clock-frequency" on the ARM arch timer node, as that overrides the CP15 setting.
Quoted 12 lines
arch/arm/mach-mediatek/mediatek.c line 40
Quoted 8 lines
arch/arm/mach-mediatek/mediatek.c +8
-0+ +/* 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?Quoted 6 lines
I didn't put it in the GPT driver, because that would mean, that you need to have the
mtk_timerto 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 theinit_timefunction would be the better place to do this.
Quoted 4 lines
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
Quoted 3 lines
Yours,
Linus Walleij
Signature · 1 line
motzblog.wordpress.com
Re: [PATCH 6/7] arm: mediatek: enable gpt6 on boot up to make arch timer working
Hi Matthias,
I didn't saw this in v3.18-rc1, are you working on version 2 of this? mt8135 and m8127 also need this fixup and we need this to have SMP working.
Joe.C
Matthias Brugger
maintainerRe: [PATCH 6/7] arm: mediatek: enable gpt6 on boot up to make arch timer working
Hi Joe,
2014-10-24 15:53 GMT+02:00 Yingjoe Chen <[email protected]>:
Quoted 6 lines
Hi Matthias,
I didn't saw this in v3.18-rc1, are you working on version 2 of this? mt8135 and m8127 also need this fixup and we need this to have SMP working.
I had a discussion with Mark Rutland from ARM on this [0]. At that point he convinced me that this was not critical.
If we need this for SMP, things really change here I think.
Cheers,
Matthias
[0] https://lkml.org/lkml/2014/8/21/170
Quoted 4 lines
Joe.C
Signature · 1 line
motzblog.wordpress.com
Re: [PATCH 6/7] arm: mediatek: enable gpt6 on boot up to make arch timer working
Hi Matthias,
Quoted 6 lines · Matthias Brugger
Hi Joe,
2014-10-24 15:53 GMT+02:00 Yingjoe Chen <[email protected]>:
Quoted 3 lines
Hi Matthias,
Quoted 8 lines
Quoted 3 lines
I didn't saw this in v3.18-rc1, are you working on version 2 of this? mt8135 and m8127 also need this fixup and we need this to have SMP working.
I had a discussion with Mark Rutland from ARM on this [0]. At that point he convinced me that this was not critical.
If we need this for SMP, things really change here I think.
We have some driver now, and we started to implement SMP enable method internally. I think it is reasonable to discuss this now.
We could include this patch in our SMP patch series. Do you prefer we do this?
Joe.C
Matthias Brugger
maintainerRe: [PATCH 6/7] arm: mediatek: enable gpt6 on boot up to make arch timer working
2014-10-30 4:23 GMT+01:00 Yingjoe Chen <[email protected]>:
Quoted 16 lines
Hi Matthias,
Quoted 13 lines · Matthias Brugger
Hi Joe,
2014-10-24 15:53 GMT+02:00 Yingjoe Chen <[email protected]>:
Quoted 6 lines
Hi Matthias,
I didn't saw this in v3.18-rc1, are you working on version 2 of this? mt8135 and m8127 also need this fixup and we need this to have SMP working.
I had a discussion with Mark Rutland from ARM on this [0]. At that point he convinced me that this was not critical.
Quoted 6 lines
Quoted 1 line
If we need this for SMP, things really change here I think.
We have some driver now, and we started to implement SMP enable method internally. I think it is reasonable to discuss this now.
We could include this patch in our SMP patch series. Do you prefer we do this?
Alright. Please remind that we don't need to set the cntfreq register here but define the clock frequency in the dts.
Thanks,
Matthias
Quoted 5 lines
Joe.C
Signature · 1 line
motzblog.wordpress.com
PATCH 6/7 arm: mediatek: enable gpt6 on boot up to make arch timer working
In reply to Matthias BruggerQuoted 34 lines · Matthias Brugger
2014-08-11 9:15 GMT+02:00 Linus Walleij <[email protected]>:
Quoted 20 lines
Quoted 5 lines · Matthias Brugger
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 <[email protected]>(...)
arch/arm/mach-mediatek/mediatek.c line 32
Quoted 3 lines
arch/arm/mach-mediatek/mediatek.c +3
-0+if (of_machine_is_compatible ("mediatek,mt6589" )) { +/* set cntfreq register which is not done in bootloader */ + asmvolatile ("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.cInstead of doing this, use the DT property "clock-frequency" on the ARM arch timer node, as that overrides the CP15 setting.
Quoted 12 lines
arch/arm/mach-mediatek/mediatek.c line 40
Quoted 8 lines
arch/arm/mach-mediatek/mediatek.c +8
-0+ +/* 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?
Quoted 6 lines
I didn't put it in the GPT driver, because that would mean, that you need to have the
mtk_timerto 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 theinit_timefunction would be the better place to do this.
Can we have a separate node like mt6577-timerfixup then?
I'm preparing patch for mt8127 and mt8135. They all need this and use same address and. In current form, I'll have to make this check against a compatible string array.
Joe.C
Matthias Brugger
maintainerRe: [PATCH 6/7] arm: mediatek: enable gpt6 on boot up to make arch timer working
2014-08-14 4:24 GMT+02:00 Joe.C <[email protected]>:
Quoted 42 lines · Matthias Brugger
Quoted 34 lines
2014-08-11 9:15 GMT+02:00 Linus Walleij <[email protected]>:
Quoted 20 lines
Quoted 5 lines · Matthias Brugger
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 <[email protected]>(...)
arch/arm/mach-mediatek/mediatek.c line 32
Quoted 3 lines
arch/arm/mach-mediatek/mediatek.c +3
-0+if (of_machine_is_compatible ("mediatek,mt6589" )) { +/* set cntfreq register which is not done in bootloader */ + asmvolatile ("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.cInstead of doing this, use the DT property "clock-frequency" on the ARM arch timer node, as that overrides the CP15 setting.
Quoted 12 lines
arch/arm/mach-mediatek/mediatek.c line 40
Quoted 8 lines
arch/arm/mach-mediatek/mediatek.c +8
-0+ +/* 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?Quoted 6 lines
I didn't put it in the GPT driver, because that would mean, that you need to have the
mtk_timerto 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 theinit_timefunction would be the better place to do this.
Quoted 4 lines
Can we have a separate node like mt6577-timerfixup then?
I'm preparing patch for mt8127 and mt8135. They all need this and use same address and. In current form, I'll have to make this check against a compatible string array.
The way to go is to add another of_machine_is_compatible for every SoC. If the address is the same just use logical or.
Cheers,
Matthias
Quoted 4 lines
Joe.C
Signature · 1 line
motzblog.wordpress.com
Matthias Brugger
maintainerPATCH 7/7 arm: dts: mt6589: Add arm arch timer node
In reply to Matthias BruggerThis patch adds the device tree node for the arm architecture timer.
--- arch/arm/boot/dts/mt6589.dtsi | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
arch/arm/boot/dts/mt6589.dtsi +10 -2
@@ -73,14 +73,22 @@ compatible = "simple-bus"; ranges; - timer: timer at 10008000 { + timer1: timer at 10008000 { compatible = "mediatek,mt6577-timer"; - reg = <0x10008000 0x80>; + reg = <0x10008000 0x60>; interrupts = <GIC_SPI 113 IRQ_TYPE_EDGE_RISING>; clocks = <&system_clk>, <&rtc_clk>; clock-names = "system-clk", "rtc-clk"; }; + timer2: timer { + compatible = "arm,armv7-timer"; + interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, + <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, + <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, + <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>; + }; + gic: interrupt-controller at 10211000 { compatible = "arm,cortex-a15-gic"; interrupt-controller;
Signature · 1 line
1.7.9.5