ARM: OMAP2+: hwmod: RTC: Add lock and unlock hooks
Subsystems (5)
v3 cover ARM: OMAP2+: hwmod: RTC: Add lock and unlock hooks
This series implements lock and unlock functions for RTC and hooks the same to DRA7 and AMx3xx hwmod.
This is dependent on the patch https://patchwork.kernel.org/patch/6578281/,
which is queued recently by Paul.
Changes since v2:
- Add kerneldoc for omap_hwmod_rtc_lock() function.
Lokesh Vutla (3):
ARM: hwmod: RTC: Add lock and unlock functions
ARM: DRA7: RTC: Add lock and unlock functions
ARM: AMx3xx: RTC: Add lock and unlock functions
arch/arm/mach-omap2/omap_hwmod.h | 2 + .../mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c | 2 + arch/arm/mach-omap2/omap_hwmod_7xx_data.c | 2 + arch/arm/mach-omap2/omap_hwmod_reset.c | 65 ++++++++++++++++++++++ 4 files changed, 71 insertions(+)
Signature · 1 line
2.1.4
PATCH v3 1/3 ARM: hwmod: RTC: Add lock and unlock functions
RTC IP have kicker feature which prevents spurious writes to its registers. In order to write into any of the RTC registers, KICK values has to be written to KICK registers.
Introduce omap_hwmod_rtc_unlock/lock functions, which writes into these KICK registers inorder to lock and unlock RTC registers.
--- arch/arm/mach-omap2/omap_hwmod.h | 2 ++ arch/arm/mach-omap2/omap_hwmod_reset.c | 65 ++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+)
arch/arm/mach-omap2/omap_hwmod.h +2 -0
@@ -748,6 +748,8 @@ const char *omap_hwmod_get_main_clk(struct omap_hwmod *oh);*/ extern int omap_hwmod_aess_preprogram (struct omap_hwmod *oh); +void omap_hwmod_rtc_unlock (struct omap_hwmod *oh); +void omap_hwmod_rtc_lock (struct omap_hwmod *oh);/* * Chip variant-specific hwmod init routines - XXX should be converted
arch/arm/mach-omap2/omap_hwmod_reset.c +65 -0
74 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH v3 2/3 ARM: DRA7: RTC: Add lock and unlock functions
In reply to Lokesh VutlaHook omap_hwmod_rtc_unlock/lock functions into RTC hwmod, so that SYSCONFIG register is updated properly
--- arch/arm/mach-omap2/omap_hwmod_7xx_data.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/mach-omap2/omap_hwmod_7xx_data.c +2 -0
@@ -1572,6 +1572,8 @@ static struct omap_hwmod_class_sysconfig dra7xx_rtcss_sysc = {static struct omap_hwmod_class dra7xx_rtcss_hwmod_class = { .name ="rtcss" , .sysc = &dra7xx_rtcss_sysc, + .unlock = &omap_hwmod_rtc_unlock, + .lock = &omap_hwmod_rtc_lock, };/* rtcss */
Signature · 1 line
2.1.4
PATCH v3 3/3 ARM: AMx3xx: RTC: Add lock and unlock functions
In reply to Lokesh VutlaHook omap_hwmod_rtc_unlock/lock functions into RTC hwmod, so that SYSCONFIG register is updated properly.
--- arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c +2 -0
@@ -918,6 +918,8 @@ static struct omap_hwmod_class_sysconfig am33xx_rtc_sysc = {static struct omap_hwmod_class am33xx_rtc_hwmod_class = { .name ="rtc" , .sysc = &am33xx_rtc_sysc, + .unlock = &omap_hwmod_rtc_unlock, + .lock = &omap_hwmod_rtc_lock, };struct omap_hwmod am33xx_rtc_hwmod = {
Signature · 1 line
2.1.4
v3 cover ARM: OMAP2+: hwmod: RTC: Add lock and unlock hooks
In reply to Lokesh VutlaHi Paul,
Quoted 4 lines · Lokesh Vutla
This series implements lock and unlock functions for RTC and hooks the same to DRA7 and AMx3xx hwmod.
This is dependent on the patch https://patchwork.kernel.org/patch/6578281/,
which is queued recently by Paul.
Gentle ping on this series.
Thanks and regards,
Lokesh
Quoted 15 lines
Changes since v2:
- Add kerneldoc foromap_hwmod_rtc_lock()function.Lokesh Vutla (3):
ARM: hwmod: RTC: Add lock and unlock functions
ARM: DRA7: RTC: Add lock and unlock functions
ARM: AMx3xx: RTC: Add lock and unlock functionsarch/arm/mach-omap2/omap_hwmod.h | 2 + .../mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c | 2 + arch/arm/mach-omap2/omap_hwmod_7xx_data.c | 2 + arch/arm/mach-omap2/omap_hwmod_reset.c | 65 ++++++++++++++++++++++ 4 files changed, 71 insertions(+)
v3 cover ARM: OMAP2+: hwmod: RTC: Add lock and unlock hooks
Hi Paul,
Quoted 8 lines · Lokesh Vutla
Hi Paul,
Quoted 4 lines · Lokesh Vutla
This series implements lock and unlock functions for RTC and hooks the same to DRA7 and AMx3xx hwmod.
This is dependent on the patch https://patchwork.kernel.org/patch/6578281/,
which is queued recently by Paul.Gentle ping on this series.
Do you have any comments on this series?
Thanks and regards,
Lokesh
Quoted 18 lines
Thanks and regards,
LokeshQuoted 15 lines
Changes since v2:
- Add kerneldoc foromap_hwmod_rtc_lock()function.Lokesh Vutla (3):
ARM: hwmod: RTC: Add lock and unlock functions
ARM: DRA7: RTC: Add lock and unlock functions
ARM: AMx3xx: RTC: Add lock and unlock functionsarch/arm/mach-omap2/omap_hwmod.h | 2 + .../mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c | 2 + arch/arm/mach-omap2/omap_hwmod_7xx_data.c | 2 + arch/arm/mach-omap2/omap_hwmod_reset.c | 65 ++++++++++++++++++++++ 4 files changed, 71 insertions(+)
Paul Walmsley
maintainerv3 cover ARM: OMAP2+: hwmod: RTC: Add lock and unlock hooks
Quoted 8 lines · Lokesh Vutla
Quoted 6 lines · Lokesh Vutla
Quoted 4 lines · Lokesh Vutla
This series implements lock and unlock functions for RTC and hooks the same to DRA7 and AMx3xx hwmod.
This is dependent on the patch https://patchwork.kernel.org/patch/6578281/,
which is queued recently by Paul.Gentle ping on this series.
Do you have any comments on this series?
Looks pretty good. I'm slightly concerned about the latency jitter impact on -rt kernels for that local_irq_disable() section. Looks like it could hold off interrupts for ~(50 udelay ?s) + 50*((RTC register read time) + 1). But I'm not sure if preempt_enable/disable() is a good alternative since a bunch of interrupt top halves could conceivably run after the RTC goes non-busy and result in the RTC not being locked/unlocked.
Is there an RTC IP block register that the code can read, or a safe sequence that the code can execute, after the RTC lock/unlock operation to verify that the RTC has successfully been locked or unlocked? If so then it's probably worth converting the local_irq_disable/enable() to preempt_disable/enable() and testing that, then retrying the lock/unlock if it fails.
- Paul
v3 cover ARM: OMAP2+: hwmod: RTC: Add lock and unlock hooks
Hi Paul,
Quoted 9 lines · Paul Walmsley
Quoted 7 lines · Lokesh Vutla
Quoted 6 lines · Lokesh Vutla
Quoted 4 lines · Lokesh Vutla
This series implements lock and unlock functions for RTC and hooks the same to DRA7 and AMx3xx hwmod.
This is dependent on the patch https://patchwork.kernel.org/patch/6578281/,
which is queued recently by Paul.Gentle ping on this series.
Quoted 8 lines
Quoted 1 line
Do you have any comments on this series?
Looks pretty good. I'm slightly concerned about the latency jitter impact on -rt kernels for that
local_irq_disable()section. Looks like it could hold off interrupts for ~(50 udelay ?s) + 50*((RTC register read time) + 1). But I'm not sure if preempt_enable/disable() is a good alternative since a bunch of interrupt top halves could conceivably run after the RTC goes non-busy and result in the RTC not being locked/unlocked.
Agree.
Quoted 7 lines
Is there an RTC IP block register that the code can read, or a safe sequence that the code can execute, after the RTC lock/unlock operation to verify that the RTC has successfully been locked or unlocked? If so then it's probably worth converting the local_irq_disable/enable() to preempt_disable/enable() and testing that, then retrying the lock/unlock if it fails.
I am afraid there is no such register to verify lock or unlock. Also these KICK registers are Write only registers so can't read back the value. Even the driver implement the same api's for writing into registers.
One thing I can think of is that to write a known pattern to scratch pad register and read back the value to confirm if it is locked/unlocked. But don't think this is a good approach.
Thanks and regards,
Lokesh