dm: omap-timer: Make timer driver SoC independent
cover dm: omap-timer: Make timer driver SoC independent
Make omap timer driver independent of SoC, so that new generation TI SoCs can use this driver without any dependencies.
Lokesh Vutla (4):
arm: omap4+: Move SCLK to include/configs
dm: omap-timer: Do not include asm/arch/clock.h
dm: omap-timer: Use 64bit for counter values
dm: omap-timer: Update clock rate only if not populated
arch/arm/include/asm/arch-omap4/clock.h | 4 ---- arch/arm/include/asm/arch-omap5/clock.h | 8 -------- drivers/timer/omap-timer.c | 7 ++++--- include/configs/ti_omap4_common.h | 4 ++++ include/configs/ti_omap5_common.h | 8 ++++++++ 5 files changed, 16 insertions(+), 15 deletions(-)
Signature · 1 line
2.18.0
PATCH 1/4 arm: omap4+: Move SCLK to include/configs
Similar to every other SoCs define oscillator clock definitions for OMAP4+ SoCs to include/configs/. This will allow to not depend on SoC clock.h header file for getting default timer frequency.
--- arch/arm/include/asm/arch-omap4/clock.h | 4 ---- arch/arm/include/asm/arch-omap5/clock.h | 8 -------- include/configs/ti_omap4_common.h | 4 ++++ include/configs/ti_omap5_common.h | 8 ++++++++ 4 files changed, 12 insertions(+), 12 deletions(-)
arch/arm/include/asm/arch-omap4/clock.h +0 -4
@@ -205,10 +205,6 @@#define DPLL_NO_LOCK 0#define DPLL_LOCK 1 -/* Clock Defines */ -#define V_OSCK 38400000/* Clock output from T2 */ -#define V_SCLK V_OSCK -struct omap4_scrm_regs {u32 revision;/* 0x0000 */ u32 pad00[63 ];
arch/arm/include/asm/arch-omap5/clock.h +0 -8
@@ -391,14 +391,6 @@#define DPLL_NO_LOCK 0#define DPLL_LOCK 1 -#if defined(CONFIG_DRA7XX ) -#define V_OSCK 20000000/* Clock output from T2 */ -#else -#define V_OSCK 19200000/* Clock output from T2 */ -#endif - -#define V_SCLK V_OSCK -/* CKO buffer control */ #define CKOBUFFER_CLK_ENABLE_MASK (1 << 28)
include/configs/ti_omap4_common.h +4 -0
@@ -22,6 +22,10 @@#include <asm/arch/cpu.h> #include <asm/arch/omap.h> +/* Clock Defines */ +#define V_OSCK 38400000/* Clock output from T2 */ +#define V_SCLK V_OSCK +/* Use General purpose timer 1 */ #define CONFIG_SYS_TIMERBASE GPT2_BASE
include/configs/ti_omap5_common.h +8 -0
@@ -37,6 +37,14 @@#include <configs/ti_armv7_omap.h> +#if defined(CONFIG_DRA7XX ) +#define V_OSCK 20000000/* Clock output from T2 */ +#else +#define V_OSCK 19200000/* Clock output from T2 */ +#endif + +#define V_SCLK V_OSCK +/* * Hardware drivers */
Signature · 1 line
2.18.0
PATCH 1/4 arm: omap4+: Move SCLK to include/configs
Quoted 11 lines · Lokesh Vutla
Similar to every other SoCs define oscillator clock definitions for OMAP4+ SoCs to
include/configs/. This will allow to not depend on SoCclock.hheader file for getting default timer frequency.Signed-off-by Lokesh Vutla <[email protected]>--- arch/arm/include/asm/arch-omap4/clock.h | 4 ---- arch/arm/include/asm/arch-omap5/clock.h | 8 -------- include/configs/ti_omap4_common.h | 4 ++++ include/configs/ti_omap5_common.h | 8 ++++++++ 4 files changed, 12 insertions(+), 12 deletions(-)
Nak. Long term, include/configs/ files are going away.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180816/8810dac6/attachment.sig>
PATCH 1/4 arm: omap4+: Move SCLK to include/configs
Quoted 14 lines · Tom Rini
Quoted 11 lines · Lokesh Vutla
Similar to every other SoCs define oscillator clock definitions for OMAP4+ SoCs to
include/configs/. This will allow to not depend on SoCclock.hheader file for getting default timer frequency.Signed-off-by Lokesh Vutla <[email protected]>--- arch/arm/include/asm/arch-omap4/clock.h | 4 ---- arch/arm/include/asm/arch-omap5/clock.h | 8 -------- include/configs/ti_omap4_common.h | 4 ++++ include/configs/ti_omap5_common.h | 8 ++++++++ 4 files changed, 12 insertions(+), 12 deletions(-)
Quoted 2 lines
Nak. Long term,
include/configs/files are going away.
okay. patch 3/4 and 4/4 are independent of this and are still valid. Any objections on them?
Thanks and regards,
Lokesh
PATCH 1/4 arm: omap4+: Move SCLK to include/configs
Quoted 17 lines · Lokesh Vutla
Quoted 14 lines · Tom Rini
Quoted 11 lines · Lokesh Vutla
Similar to every other SoCs define oscillator clock definitions for OMAP4+ SoCs to
include/configs/. This will allow to not depend on SoCclock.hheader file for getting default timer frequency.Signed-off-by Lokesh Vutla <[email protected]>--- arch/arm/include/asm/arch-omap4/clock.h | 4 ---- arch/arm/include/asm/arch-omap5/clock.h | 8 -------- include/configs/ti_omap4_common.h | 4 ++++ include/configs/ti_omap5_common.h | 8 ++++++++ 4 files changed, 12 insertions(+), 12 deletions(-)
Quoted 5 lines
Quoted 2 lines
Nak. Long term,
include/configs/files are going away.okay. patch 3/4 and 4/4 are independent of this and are still valid. Any objections on them?
Nope, those are fine. Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180817/875fa3c8/attachment.sig>
PATCH 2/4 dm: omap-timer: Do not include asm/arch/clock.h
In reply to Lokesh Vutlaasm/arch/clock.h is not used by timer driver anymore. So drop this header file.
--- drivers/timer/omap-timer.c | 1 - 1 file changed, 1 deletion(-)
drivers/timer/omap-timer.c +0 -1
@@ -10,7 +10,6 @@#include <errno.h> #include <timer.h> #include <asm/io.h> -#include <asm/arch/clock.h> /* Timer register bits */ #define TCLR_START BIT(0)/* Start=1 */
Signature · 1 line
2.18.0
PATCH 3/4 dm: omap-timer: Use 64bit for counter values
In reply to Lokesh VutlaIn order to handle counter overflows use 64 bit values for counter. Also load the initial value during probe.
--- drivers/timer/omap-timer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/timer/omap-timer.c +2 -1
@@ -50,7 +50,7 @@ static int omap_timer_get_count(struct udevice *dev, u64 *count) {struct omap_timer_priv *priv =dev_get_priv (dev); - *count =readl (&priv->regs->tcrr); + *count =timer_conv_64 (readl (&priv->regs->tcrr));return 0 ; }
@@ -64,6 +64,7 @@ static int omap_timer_probe(struct udevice *dev)/* start the counter ticking up, reload value on overflow */ writel (0 , &priv->regs->tldr); +writel (0 , &priv->regs->tcrr);/* enable timer */ writel ((CONFIG_SYS_PTV <<2 ) |TCLR_PRE_EN |TCLR_AUTO_RELOAD |TCLR_START , &priv->regs->tclr);
Signature · 1 line
2.18.0
PATCH 3/4 dm: omap-timer: Use 64bit for counter values
Quoted 4 lines · Lokesh Vutla
In order to handle counter overflows use 64 bit values for counter. Also load the initial value during probe.
Signed-off-by Lokesh Vutla <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180911/f07562cc/attachment.sig>
PATCH 4/4 dm: omap-timer: Update clock rate only if not populated
In reply to Lokesh Vutlatimer_pre_probe() tries to populate the clock rate from DT. omap timer driver tries to overwrite this value irrespective of the value populated fro DT. So update this value only when DT doesn't populate the clock rate.
--- drivers/timer/omap-timer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/timer/omap-timer.c +2 -1
@@ -60,7 +60,8 @@ static int omap_timer_probe(struct udevice *dev)struct timer_dev_priv *uc_priv =dev_get_uclass_priv (dev);struct omap_timer_priv *priv =dev_get_priv (dev); - uc_priv->clock_rate =TIMER_CLOCK ; +if (!uc_priv->clock_rate) + uc_priv->clock_rate =TIMER_CLOCK ;/* start the counter ticking up, reload value on overflow */ writel (0 , &priv->regs->tldr);
Signature · 1 line
2.18.0
PATCH 4/4 dm: omap-timer: Update clock rate only if not populated
Quoted 6 lines · Lokesh Vutla
timer_pre_probe()tries to populate the clock rate from DT. omap timer driver tries to overwrite this value irrespective of the value populated fro DT. So update this value only when DT doesn't populate the clock rate.Signed-off-by Lokesh Vutla <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180911/802c0c90/attachment.sig>