arm64: mediatek: enable MTK_TIMER
Subsystems (4)
PATCH 1/2 arm64: mediatek: enable MTK_TIMER
Enable MTK_TIMER for MediaTek plaform, which will be used as schedule clock.
--- arch/arm64/Kconfig.platforms | 1 + 1 file changed, 1 insertion(+)
arch/arm64/Kconfig.platforms +1 -0
@@ -42,6 +42,7 @@ config ARCH_MEDIATEK bool "Mediatek MT65xx & MT81xx ARMv8 SoC" select ARM_GIC select PINCTRL + select MTK_TIMER help Support for Mediatek MT65xx & MT81xx ARMv8 SoCs
Signature · 1 line
1.9.1
PATCH 2/2 arm64: dts: mt8173: add timer node
From: Daniel Kurtz <[email protected]>
Add device node to enable GPT timer. This timer will be used as sched clock source.
--- arch/arm64/boot/dts/mediatek/mt8173.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm64/boot/dts/mediatek/mt8173.dtsi +9 -0
@@ -238,6 +238,15 @@ reg = <0 0x10007000 0 0x100>; }; + timer: timer at 10008000 { + compatible = "mediatek,mt8173-timer", + "mediatek,mt6577-timer"; + reg = <0 0x10008000 0 0x1000>; + interrupts = <GIC_SPI 144 IRQ_TYPE_LEVEL_LOW>; + clocks = <&infracfg CLK_INFRA_CLK_13M>, + <&topckgen CLK_TOP_RTC_SEL>; + }; + pwrap: pwrap at 1000d000 { compatible = "mediatek,mt8173-pwrap"; reg = <0 0x1000d000 0 0x1000>;
Signature · 1 line
1.9.1
Re: [PATCH 2/2] arm64: dts: mt8173: add timer node
Quoted 5 lines · Yingjoe Chen
From: Daniel Kurtz <[email protected]>
Add device node to enable GPT timer. This timer will be used as sched clock source.
Interesting any known issues with or advantage over the arch timers to prefer it as sched clock source. I see even arch timers are present in DT, hence the question. Or is it just a incorrect commit log ?
How does this get selected as sched clock source ? I don't see sched_clock_register in mtk_timer.c
To be clear, I am not against adding this timer support, but just want to know is it preferred for sched clock source ? if yes why ? better resolution ?
Quoted 1 line
Change-Id: Idc4e3f0ee80b5c36cae6f0f2328f94aafcca1253
^ Should be dropped
Quoted 12 lines
Signed-off-by Daniel Kurtz <[email protected]>Signed-off-by Eddie Huang <[email protected]>Signed-off-by Yingjoe Chen <[email protected]>--- arch/arm64/boot/dts/mediatek/mt8173.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+)arch/arm64/boot/dts/mediatek/mt8173.dtsi +0
-0
arch/arm64/boot/dts/mediatek/mt8173.dtsi line 242
Quoted 5 lines
arch/arm64/boot/dts/mediatek/mt8173.dtsi +2
-0@@ -238,6 +238,15 @@ reg = <0 0x10007000 0 0x100>; }; + timer: timer at 10008000 { + compatible = "mediatek,mt8173-timer",
Missing documentation ? I am referring upstream and it might be in some patches already queued perhaps ?
Regards,
Sudeep
Re: [PATCH 2/2] arm64: dts: mt8173: add timer node
Quoted 12 lines · Sudeep Holla
Quoted 5 lines · Yingjoe Chen
From: Daniel Kurtz <[email protected]>
Add device node to enable GPT timer. This timer will be used as sched clock source.
Interesting any known issues with or advantage over the arch timers to prefer it as sched clock source. I see even arch timers are present in DT, hence the question. Or is it just a incorrect commit log ?
Quoted 6 lines
How does this get selected as sched clock source ? I don't see
sched_clock_registerinmtk_timer.cTo be clear, I am not against adding this timer support, but just want to know is it preferred for sched clock source ? if yes why ? better resolution ?
Hi Sudeep,
Thanks for your review.
I hit the send too soon and missed cover letter, please see:
http://lists.infradead.org/pipermail/linux-mediatek/2015-September/002303.html
The main reason to use GPT as sched clock is it won't stop during idle.
Quoted 19 lines
Quoted 1 line
Change-Id: Idc4e3f0ee80b5c36cae6f0f2328f94aafcca1253
^ Should be dropped
Quoted 15 lines
Signed-off-by Daniel Kurtz <[email protected]>Signed-off-by Eddie Huang <[email protected]>Signed-off-by Yingjoe Chen <[email protected]>--- arch/arm64/boot/dts/mediatek/mt8173.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+)arch/arm64/boot/dts/mediatek/mt8173.dtsi +0
-0@@ -238,6 +238,15 @@ reg = <0 0x10007000 0 0x100>; };
Quoted 5 lines
arch/arm64/boot/dts/mediatek/mt8173.dtsi line 242
Quoted 2 lines
arch/arm64/boot/dts/mediatek/mt8173.dtsi +2
-0+ timer: timer at 10008000 { + compatible = "mediatek,mt8173-timer",Missing documentation ? I am referring upstream and it might be in some patches already queued perhaps ?
This is documented in Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txt. Do you mean I should add "mediatek,mt8173-timer" to that file?
Joe.C
Re: [PATCH 2/2] arm64: dts: mt8173: add timer node
Quoted 20 lines · Yingjoe Chen
Quoted 12 lines · Sudeep Holla
Quoted 5 lines · Yingjoe Chen
From: Daniel Kurtz <[email protected]>
Add device node to enable GPT timer. This timer will be used as sched clock source.
Interesting any known issues with or advantage over the arch timers to prefer it as sched clock source. I see even arch timers are present in DT, hence the question. Or is it just a incorrect commit log ?
Quoted 6 lines
How does this get selected as sched clock source ? I don't see
sched_clock_registerinmtk_timer.cTo be clear, I am not against adding this timer support, but just want to know is it preferred for sched clock source ? if yes why ? better resolution ?
Quoted 7 lines
Hi Sudeep,
Thanks for your review.
I hit the send too soon and missed cover letter, please see:
http://lists.infradead.org/pipermail/linux-mediatek/2015-September/002303.html
OK
Quoted 3 lines
The main reason to use GPT as sched clock is it won't stop during idle.
I think your are confusing the system counter with arch timers. System counter is always-on, but the arch timers(logic implementing timers comparators) might not be off when the processor is powered down.
I think you need this timer and are using it for low power idle states in which case you will use this as a clock event and not clock source. It will be used as a hardware broadcast event source.
There's no call to sched_clock_register in mtk_timer.c, so it can't be the sched clock, so you need to fix the commit log.
[...]
Quoted 14 lines
Quoted 8 lines
Quoted 8 lines
arch/arm64/boot/dts/mediatek/mt8173.dtsi +0
-0@@ -238,6 +238,15 @@ reg = <0 0x10007000 0 0x100>; };Quoted 5 lines
arch/arm64/boot/dts/mediatek/mt8173.dtsi line 242
Quoted 2 lines
arch/arm64/boot/dts/mediatek/mt8173.dtsi +2
-0+ timer: timer at 10008000 { + compatible = "mediatek,mt8173-timer",Missing documentation ? I am referring upstream and it might be in some patches already queued perhaps ?
Quoted 4 lines
This is documented in
Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txt. Do you mean I should add "mediatek,mt8173-timer" to that file?
Yes
Regards,
Sudeep
Re: [PATCH 2/2] arm64: dts: mt8173: add timer node
Quoted 40 lines · Sudeep Holla
Quoted 20 lines · Yingjoe Chen
Quoted 12 lines · Sudeep Holla
Quoted 5 lines · Yingjoe Chen
From: Daniel Kurtz <[email protected]>
Add device node to enable GPT timer. This timer will be used as sched clock source.
Interesting any known issues with or advantage over the arch timers to prefer it as sched clock source. I see even arch timers are present in DT, hence the question. Or is it just a incorrect commit log ?
Quoted 6 lines
How does this get selected as sched clock source ? I don't see
sched_clock_registerinmtk_timer.cTo be clear, I am not against adding this timer support, but just want to know is it preferred for sched clock source ? if yes why ? better resolution ?
Quoted 7 lines
Hi Sudeep,
Thanks for your review.
I hit the send too soon and missed cover letter, please see:
http://lists.infradead.org/pipermail/linux-mediatek/2015-September/002303.htmlOK
Quoted 3 lines
The main reason to use GPT as sched clock is it won't stop during idle.
I think your are confusing the system counter with arch timers. System counter is always-on, but the arch timers(logic implementing timers comparators) might not be off when the processor is powered down.
Quoted 6 lines
I think you need this timer and are using it for low power idle states in which case you will use this as a clock event and not clock source. It will be used as a hardware broadcast event source.
There's no call to
sched_clock_registerinmtk_timer.c, so it can't be the sched clock, so you need to fix the commit log.
Hi Sudeep,
Sorry for late reply.
For sched_clock_register, please see
http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001547.html
which was accepted in
https://git.linaro.org/people/daniel.lezcano/linux.git/shortlog/refs/heads/clockevents/4.4
You are right it is also used as clock event. I think we don't need to mention those detail in commit message, so I'll change to just:
"Add device node to enable GPT timer."
Quoted 17 lines
[...]
Quoted 14 lines
Quoted 13 lines
arch/arm64/boot/dts/mediatek/mt8173.dtsi line 242
Quoted 10 lines
arch/arm64/boot/dts/mediatek/mt8173.dtsi +2
-0@@ -238,6 +238,15 @@ reg = <0 0x10007000 0 0x100>; }; + timer: timer at 10008000 { + compatible = "mediatek,mt8173-timer",Missing documentation ? I am referring upstream and it might be in some patches already queued perhaps ?
Quoted 6 lines
Quoted 4 lines
This is documented in
Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txt. Do you mean I should add "mediatek,mt8173-timer" to that file?Yes
Will do in next round.
Thanks
Joe.C
Re: [PATCH 2/2] arm64: dts: mt8173: add timer node
Quoted 2 lines · Yingjoe Chen
Quoted 1 line · Sudeep Holla
[...]
Quoted 12 lines
Quoted 11 lines
I think your are confusing the system counter with arch timers. System counter is always-on, but the arch timers(logic implementing timers comparators) might not be off when the processor is powered down.
I think you need this timer and are using it for low power idle states in which case you will use this as a clock event and not clock source. It will be used as a hardware broadcast event source.
There's no call to
sched_clock_registerinmtk_timer.c, so it can't be the sched clock, so you need to fix the commit log.
Quoted 9 lines
Hi Sudeep,
Sorry for late reply.
For
sched_clock_register, please see
http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001547.html
which was accepted in
https://git.linaro.org/people/daniel.lezcano/linux.git/shortlog/refs/heads/clockevents/4.4
The commit message makes no sense to me. The counters should continue to work as long as they are in always-on domain. Only timers are lost when you enter deeper idle states. So I agree with using MTK timer as broadcast timer/eventsource. You still didn't answer what's the need to use MTK timer as sched clocksource ?
Regards,
Sudeep
Re: [PATCH 2/2] arm64: dts: mt8173: add timer node
Quoted 29 lines · Sudeep Holla
Quoted 2 lines · Yingjoe Chen
Quoted 1 line · Sudeep Holla
[...]
Quoted 12 lines
Quoted 11 lines
I think your are confusing the system counter with arch timers. System counter is always-on, but the arch timers(logic implementing timers comparators) might not be off when the processor is powered down.
I think you need this timer and are using it for low power idle states in which case you will use this as a clock event and not clock source. It will be used as a hardware broadcast event source.
There's no call to
sched_clock_registerinmtk_timer.c, so it can't be the sched clock, so you need to fix the commit log.Quoted 9 lines
Hi Sudeep,
Sorry for late reply.
For
sched_clock_register, please see
http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001547.html
which was accepted in
https://git.linaro.org/people/daniel.lezcano/linux.git/shortlog/refs/heads/clockevents/4.4
Quoted 5 lines
The commit message makes no sense to me. The counters should continue to work as long as they are in always-on domain. Only timers are lost when you enter deeper idle states. So I agree with using MTK timer as broadcast timer/eventsource. You still didn't answer what's the need to use MTK timer as sched clocksource ?
Hi, Sudeep,
ARM ARM said the counter should be in always-on domain, but unfortunately that not true for mt8173. The last CPU enter idle can choose to enter deep idle mode and the counter value would be lost. Our firmware backup/recover the counter so it looks like it is stopped. That's why I thought we need to use it as sched clocksource.
On mt8173, we will fix the firmware to add missing counts, so it will looks like the counter keep counting. But other mediatek platform have similar issue, and the 2 counter have same resolution, so I still want to keep using GPT as sched clocksource.
Joe.C
Mark Rutland
reviewerRe: [PATCH 2/2] arm64: dts: mt8173: add timer node
In reply to Yingjoe ChenQuoted 20 lines · Yingjoe Chen
Quoted 12 lines · Sudeep Holla
Quoted 5 lines · Yingjoe Chen
From: Daniel Kurtz <[email protected]>
Add device node to enable GPT timer. This timer will be used as sched clock source.
Interesting any known issues with or advantage over the arch timers to prefer it as sched clock source. I see even arch timers are present in DT, hence the question. Or is it just a incorrect commit log ?
Quoted 6 lines
How does this get selected as sched clock source ? I don't see
sched_clock_registerinmtk_timer.cTo be clear, I am not against adding this timer support, but just want to know is it preferred for sched clock source ? if yes why ? better resolution ?
Quoted 8 lines
Hi Sudeep,
Thanks for your review.
I hit the send too soon and missed cover letter, please see:
http://lists.infradead.org/pipermail/linux-mediatek/2015-September/002303.htmlThe main reason to use GPT as sched clock is it won't stop during idle.
You don't mean sched clock, you just mean a clock_event_device.
A sched_clock is a high-precision clocksource that is read from (which by definition requires the CPUs to be non-idle). It doesn't have anything to do with interrupts and therefore cannot wake devices from idle.
While the clock_event_device for the generic timer can't necessarily wake CPUs from idle. The generic timer system counter counts even if CPUs are idle, so the generic timer is fine as a sched_clock.
Thanks,
Mark.
Re: [PATCH 2/2] arm64: dts: mt8173: add timer node
Quoted 32 lines · Mark Rutland
Quoted 20 lines · Yingjoe Chen
Quoted 12 lines · Sudeep Holla
Quoted 5 lines · Yingjoe Chen
From: Daniel Kurtz <[email protected]>
Add device node to enable GPT timer. This timer will be used as sched clock source.
Interesting any known issues with or advantage over the arch timers to prefer it as sched clock source. I see even arch timers are present in DT, hence the question. Or is it just a incorrect commit log ?
Quoted 6 lines
How does this get selected as sched clock source ? I don't see
sched_clock_registerinmtk_timer.cTo be clear, I am not against adding this timer support, but just want to know is it preferred for sched clock source ? if yes why ? better resolution ?
Quoted 8 lines
Hi Sudeep,
Thanks for your review.
I hit the send too soon and missed cover letter, please see:
http://lists.infradead.org/pipermail/linux-mediatek/2015-September/002303.htmlThe main reason to use GPT as sched clock is it won't stop during idle.
You don't mean sched clock, you just mean a
clock_event_device.
Quoted 8 lines
A
sched_clockis a high-precision clocksource that is read from (which by definition requires the CPUs to be non-idle). It doesn't have anything to do with interrupts and therefore cannot wake devices from idle.While the
clock_event_devicefor the generic timer can't necessarily wake CPUs from idle. The generic timer system counter counts even if CPUs are idle, so the generic timer is fine as asched_clock.
Hi, Mark,
Thanks for your info and sorry for late reply.
I notice ARM ARM said the arch timer shouldn't stop when idle, but unfortunately that not true for mt8173. The last CPU enter idle can choose to enter deep idle mode and the counter value would be lost. Our firmware backup/recover the counter so it looks like it is stopped.
We will change the firmware to add missing count when back from deep idle to make it looks like the counter never stop.
Joe.C
Quoted 2 lines · Yingjoe Chen
Enable
MTK_TIMERfor MediaTek plaform, which will be used as schedule clock.
Sorry, sending this series too early without cover letter and removing Change-Id. Here's the cover letter:
This is actually v3 of "add GPT timer support for mt8173" series. This is based on v4.3-rc1 + clockevents-4.4[1] and James's mediatek-clk tree[2].
Changes compare to previous version[3]:
- the first two mtk_timer related changes are removed because they are replaced/accepted in clockevents tree.
- Remove 'add 13mhz clock for MT8173' because it is accepted in mediatek-clk tree.
- Kconfig.platforms path change.
So we only have 2 patches left here.
Matthias, can you take these and help to remove the Change-Id?
Daniel Kurtz (1):
arm64: dts: mt8173: add timer node
Yingjoe Chen (1):
arm64: mediatek: enable MTK_TIMER
[1]
https://git.linaro.org/people/daniel.lezcano/linux.git clockevents/4.4
[2]
http://lists.infradead.org/pipermail/linux-mediatek/2015-August/002069.html
[3]
http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001544.html
Matthias Brugger
maintainerQuoted 19 lines · Yingjoe Chen
Quoted 2 lines · Yingjoe Chen
Enable
MTK_TIMERfor MediaTek plaform, which will be used as schedule clock.Sorry, sending this series too early without cover letter and removing Change-Id. Here's the cover letter:
This is actually v3 of "add GPT timer support for mt8173" series. This is based on v4.3-rc1 + clockevents-4.4[1] and James's mediatek-clk tree[2].
Changes compare to previous version[3]:
- the first twomtk_timerrelated changes are removed because they are replaced/accepted in clockevents tree.
- Remove 'add 13mhz clock for MT8173' because it is accepted in mediatek-clk tree.
-Kconfig.platformspath change.
Quoted 2 lines
So we only have 2 patches left here.
Matthias, can you take these and help to remove the Change-Id?
Yes I can take this two patches, but I don't see the mediatek-clk tree accepted by the maintainers yet. As far as I can see, without the 13 MHz clock [1], the sched clock won't work.
[1]
https://github.com/jamesjjliao/linux/commit/add5e89d657fa6c0e5a517890f996c796b768064
Quoted 20 lines
Daniel Kurtz (1):
arm64: dts: mt8173: add timer nodeYingjoe Chen (1):
arm64: mediatek: enableMTK_TIMER[1]
https://git.linaro.org/people/daniel.lezcano/linux.git clockevents/4.4
[2]
http://lists.infradead.org/pipermail/linux-mediatek/2015-August/002069.html
[3]
http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001544.html