All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/4] dm: omap-timer: Make timer driver SoC independent
@ 2018-08-16 12:56 Lokesh Vutla
  2018-08-16 12:56 ` [U-Boot] [PATCH 1/4] arm: omap4+: Move SCLK to include/configs Lokesh Vutla
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Lokesh Vutla @ 2018-08-16 12:56 UTC (permalink / raw)
  To: u-boot

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(-)

-- 
2.18.0

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH 1/4] arm: omap4+: Move SCLK to include/configs
  2018-08-16 12:56 [U-Boot] [PATCH 0/4] dm: omap-timer: Make timer driver SoC independent Lokesh Vutla
@ 2018-08-16 12:56 ` Lokesh Vutla
  2018-08-17  0:54   ` Tom Rini
  2018-08-16 12:56 ` [U-Boot] [PATCH 2/4] dm: omap-timer: Do not include asm/arch/clock.h Lokesh Vutla
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Lokesh Vutla @ 2018-08-16 12:56 UTC (permalink / raw)
  To: u-boot

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.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
---
 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(-)

diff --git a/arch/arm/include/asm/arch-omap4/clock.h b/arch/arm/include/asm/arch-omap4/clock.h
index 037045ca31..ba92ca8ee9 100644
--- a/arch/arm/include/asm/arch-omap4/clock.h
+++ b/arch/arm/include/asm/arch-omap4/clock.h
@@ -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];
diff --git a/arch/arm/include/asm/arch-omap5/clock.h b/arch/arm/include/asm/arch-omap5/clock.h
index e261bd43f2..b5da576e70 100644
--- a/arch/arm/include/asm/arch-omap5/clock.h
+++ b/arch/arm/include/asm/arch-omap5/clock.h
@@ -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)
 
diff --git a/include/configs/ti_omap4_common.h b/include/configs/ti_omap4_common.h
index 33761c65e9..53982f0246 100644
--- a/include/configs/ti_omap4_common.h
+++ b/include/configs/ti_omap4_common.h
@@ -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
 
diff --git a/include/configs/ti_omap5_common.h b/include/configs/ti_omap5_common.h
index 8bf4a6b7e9..6ae725d413 100644
--- a/include/configs/ti_omap5_common.h
+++ b/include/configs/ti_omap5_common.h
@@ -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
  */
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH 2/4] dm: omap-timer: Do not include asm/arch/clock.h
  2018-08-16 12:56 [U-Boot] [PATCH 0/4] dm: omap-timer: Make timer driver SoC independent Lokesh Vutla
  2018-08-16 12:56 ` [U-Boot] [PATCH 1/4] arm: omap4+: Move SCLK to include/configs Lokesh Vutla
@ 2018-08-16 12:56 ` Lokesh Vutla
  2018-08-16 12:56 ` [U-Boot] [PATCH 3/4] dm: omap-timer: Use 64bit for counter values Lokesh Vutla
  2018-08-16 12:56 ` [U-Boot] [PATCH 4/4] dm: omap-timer: Update clock rate only if not populated Lokesh Vutla
  3 siblings, 0 replies; 10+ messages in thread
From: Lokesh Vutla @ 2018-08-16 12:56 UTC (permalink / raw)
  To: u-boot

asm/arch/clock.h is not used by timer driver anymore. So drop
this header file.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
---
 drivers/timer/omap-timer.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/timer/omap-timer.c b/drivers/timer/omap-timer.c
index 3f847984cb..313eda54b5 100644
--- a/drivers/timer/omap-timer.c
+++ b/drivers/timer/omap-timer.c
@@ -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 */
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH 3/4] dm: omap-timer: Use 64bit for counter values
  2018-08-16 12:56 [U-Boot] [PATCH 0/4] dm: omap-timer: Make timer driver SoC independent Lokesh Vutla
  2018-08-16 12:56 ` [U-Boot] [PATCH 1/4] arm: omap4+: Move SCLK to include/configs Lokesh Vutla
  2018-08-16 12:56 ` [U-Boot] [PATCH 2/4] dm: omap-timer: Do not include asm/arch/clock.h Lokesh Vutla
@ 2018-08-16 12:56 ` Lokesh Vutla
  2018-09-11 12:25   ` [U-Boot] [U-Boot, " Tom Rini
  2018-08-16 12:56 ` [U-Boot] [PATCH 4/4] dm: omap-timer: Update clock rate only if not populated Lokesh Vutla
  3 siblings, 1 reply; 10+ messages in thread
From: Lokesh Vutla @ 2018-08-16 12:56 UTC (permalink / raw)
  To: u-boot

In order to handle counter overflows use 64 bit values for counter.
Also load the initial value during probe.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
---
 drivers/timer/omap-timer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/timer/omap-timer.c b/drivers/timer/omap-timer.c
index 313eda54b5..b8f52ef2e4 100644
--- a/drivers/timer/omap-timer.c
+++ b/drivers/timer/omap-timer.c
@@ -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);
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH 4/4] dm: omap-timer: Update clock rate only if not populated
  2018-08-16 12:56 [U-Boot] [PATCH 0/4] dm: omap-timer: Make timer driver SoC independent Lokesh Vutla
                   ` (2 preceding siblings ...)
  2018-08-16 12:56 ` [U-Boot] [PATCH 3/4] dm: omap-timer: Use 64bit for counter values Lokesh Vutla
@ 2018-08-16 12:56 ` Lokesh Vutla
  2018-09-11 12:25   ` [U-Boot] [U-Boot, " Tom Rini
  3 siblings, 1 reply; 10+ messages in thread
From: Lokesh Vutla @ 2018-08-16 12:56 UTC (permalink / raw)
  To: u-boot

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 <lokeshvutla@ti.com>
---
 drivers/timer/omap-timer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/timer/omap-timer.c b/drivers/timer/omap-timer.c
index b8f52ef2e4..59154b5158 100644
--- a/drivers/timer/omap-timer.c
+++ b/drivers/timer/omap-timer.c
@@ -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);
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH 1/4] arm: omap4+: Move SCLK to include/configs
  2018-08-16 12:56 ` [U-Boot] [PATCH 1/4] arm: omap4+: Move SCLK to include/configs Lokesh Vutla
@ 2018-08-17  0:54   ` Tom Rini
  2018-08-17  5:52     ` Lokesh Vutla
  0 siblings, 1 reply; 10+ messages in thread
From: Tom Rini @ 2018-08-17  0:54 UTC (permalink / raw)
  To: u-boot

On Thu, Aug 16, 2018 at 06:26:52PM +0530, Lokesh Vutla wrote:

> 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.
> 
> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
> ---
>  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.

-- 
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>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH 1/4] arm: omap4+: Move SCLK to include/configs
  2018-08-17  0:54   ` Tom Rini
@ 2018-08-17  5:52     ` Lokesh Vutla
  2018-08-17 11:26       ` Tom Rini
  0 siblings, 1 reply; 10+ messages in thread
From: Lokesh Vutla @ 2018-08-17  5:52 UTC (permalink / raw)
  To: u-boot



On Friday 17 August 2018 06:24 AM, Tom Rini wrote:
> On Thu, Aug 16, 2018 at 06:26:52PM +0530, Lokesh Vutla wrote:
> 
>> 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.
>>
>> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
>> ---
>>  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.
> 

okay. patch 3/4 and 4/4 are independent of this and are still valid. Any
objections on them?

Thanks and regards,
Lokesh

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH 1/4] arm: omap4+: Move SCLK to include/configs
  2018-08-17  5:52     ` Lokesh Vutla
@ 2018-08-17 11:26       ` Tom Rini
  0 siblings, 0 replies; 10+ messages in thread
From: Tom Rini @ 2018-08-17 11:26 UTC (permalink / raw)
  To: u-boot

On Fri, Aug 17, 2018 at 11:22:22AM +0530, Lokesh Vutla wrote:
> 
> 
> On Friday 17 August 2018 06:24 AM, Tom Rini wrote:
> > On Thu, Aug 16, 2018 at 06:26:52PM +0530, Lokesh Vutla wrote:
> > 
> >> 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.
> >>
> >> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
> >> ---
> >>  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.
> > 
> 
> okay. patch 3/4 and 4/4 are independent of this and are still valid. Any
> objections on them?

Nope, those are fine.  Thanks!

-- 
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>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [U-Boot, 3/4] dm: omap-timer: Use 64bit for counter values
  2018-08-16 12:56 ` [U-Boot] [PATCH 3/4] dm: omap-timer: Use 64bit for counter values Lokesh Vutla
@ 2018-09-11 12:25   ` Tom Rini
  0 siblings, 0 replies; 10+ messages in thread
From: Tom Rini @ 2018-09-11 12:25 UTC (permalink / raw)
  To: u-boot

On Thu, Aug 16, 2018 at 06:26:54PM +0530, Lokesh Vutla wrote:

> In order to handle counter overflows use 64 bit values for counter.
> Also load the initial value during probe.
> 
> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>

Applied to u-boot/master, thanks!

-- 
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>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [U-Boot, 4/4] dm: omap-timer: Update clock rate only if not populated
  2018-08-16 12:56 ` [U-Boot] [PATCH 4/4] dm: omap-timer: Update clock rate only if not populated Lokesh Vutla
@ 2018-09-11 12:25   ` Tom Rini
  0 siblings, 0 replies; 10+ messages in thread
From: Tom Rini @ 2018-09-11 12:25 UTC (permalink / raw)
  To: u-boot

On Thu, Aug 16, 2018 at 06:26:55PM +0530, Lokesh Vutla wrote:

> 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 <lokeshvutla@ti.com>

Applied to u-boot/master, thanks!

-- 
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>

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-09-11 12:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-16 12:56 [U-Boot] [PATCH 0/4] dm: omap-timer: Make timer driver SoC independent Lokesh Vutla
2018-08-16 12:56 ` [U-Boot] [PATCH 1/4] arm: omap4+: Move SCLK to include/configs Lokesh Vutla
2018-08-17  0:54   ` Tom Rini
2018-08-17  5:52     ` Lokesh Vutla
2018-08-17 11:26       ` Tom Rini
2018-08-16 12:56 ` [U-Boot] [PATCH 2/4] dm: omap-timer: Do not include asm/arch/clock.h Lokesh Vutla
2018-08-16 12:56 ` [U-Boot] [PATCH 3/4] dm: omap-timer: Use 64bit for counter values Lokesh Vutla
2018-09-11 12:25   ` [U-Boot] [U-Boot, " Tom Rini
2018-08-16 12:56 ` [U-Boot] [PATCH 4/4] dm: omap-timer: Update clock rate only if not populated Lokesh Vutla
2018-09-11 12:25   ` [U-Boot] [U-Boot, " Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.