mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] clocksource: timer-ti-dm: replace magic constant with descriptive macros
@ 2025-04-29 13:25 Ahmad Fatoum
  2025-04-29 13:25 ` [PATCH 2/2] clocksource: timer-ti-dm: adapt omap_dmtimer_init parameter type to usage Ahmad Fatoum
  2025-04-29 15:04 ` [PATCH 1/2] clocksource: timer-ti-dm: replace magic constant with descriptive macros Sascha Hauer
  0 siblings, 2 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2025-04-29 13:25 UTC (permalink / raw)
  To: barebox; +Cc: Daniel Lezcano, Ahmad Fatoum

This improves readability a bit, but introduces no functional change.

Suggested-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/clocksource/timer-ti-dm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clocksource/timer-ti-dm.c b/drivers/clocksource/timer-ti-dm.c
index 1090b96a0e94..572ea2fdc945 100644
--- a/drivers/clocksource/timer-ti-dm.c
+++ b/drivers/clocksource/timer-ti-dm.c
@@ -37,6 +37,8 @@
 #define IRQSTATUS_CLR		0x30
 #define IRQWAKEEN		0x34
 #define TCLR			0x38
+#define		TCLR_START		BIT(0)	/* Start=1 */
+#define		TCLR_AUTO_RELOAD	BIT(1)	/* Auto reload */
 #define TCRR			0x3C
 #define TLDR			0x40
 #define TTGR			0x44
@@ -76,7 +78,7 @@ int omap_dmtimer_init(void __iomem *mmio_start, unsigned clk_speed)
 	dmtimer_cs.mult = clocksource_hz2mult(clk_speed, dmtimer_cs.shift);
 
 	/* Enable counter */
-	writel(0x3, base + TCLR);
+	writel(TCLR_START | TCLR_AUTO_RELOAD, base + TCLR);
 
 	return init_clock(&dmtimer_cs);
 }
-- 
2.39.5




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

* [PATCH 2/2] clocksource: timer-ti-dm: adapt omap_dmtimer_init parameter type to usage
  2025-04-29 13:25 [PATCH 1/2] clocksource: timer-ti-dm: replace magic constant with descriptive macros Ahmad Fatoum
@ 2025-04-29 13:25 ` Ahmad Fatoum
  2025-04-29 15:04 ` [PATCH 1/2] clocksource: timer-ti-dm: replace magic constant with descriptive macros Sascha Hauer
  1 sibling, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2025-04-29 13:25 UTC (permalink / raw)
  To: barebox; +Cc: Daniel Lezcano, Ahmad Fatoum

The clk_speed argument is used as input to clocksource_hz2mult() which
has a u32 as parameter. While u32 and unsigned are equivalent in
barebox, it's still a good idea to differentiate between "normal"-sized
integers and integers that are explicitly meant to be exactly 32-bit.

No functional change.

Suggested-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/clocksource/timer-ti-dm.c | 2 +-
 include/mach/omap/am33xx-clock.h  | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/clocksource/timer-ti-dm.c b/drivers/clocksource/timer-ti-dm.c
index 572ea2fdc945..7fa159723b11 100644
--- a/drivers/clocksource/timer-ti-dm.c
+++ b/drivers/clocksource/timer-ti-dm.c
@@ -71,7 +71,7 @@ struct omap_dmtimer_data {
 	int (*get_clock)(struct device *dev);
 };
 
-int omap_dmtimer_init(void __iomem *mmio_start, unsigned clk_speed)
+int omap_dmtimer_init(void __iomem *mmio_start, u32 clk_speed)
 {
 	base = mmio_start;
 
diff --git a/include/mach/omap/am33xx-clock.h b/include/mach/omap/am33xx-clock.h
index b064337ac4f8..8dbe6efe863c 100644
--- a/include/mach/omap/am33xx-clock.h
+++ b/include/mach/omap/am33xx-clock.h
@@ -191,7 +191,6 @@ void am33xx_pll_init(int mpupll_M, int ddrpll_M);
 void am33xx_enable_ddr_clocks(void);
 int am33xx_get_osc_clock(void);
 
-int omap_dmtimer_init(void __iomem *mmio_start,
-		      unsigned clk_speed);
+int omap_dmtimer_init(void __iomem *mmio_start, u32 clk_speed);
 
 #endif  /* endif _AM33XX_CLOCKS_H_ */
-- 
2.39.5




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

* Re: [PATCH 1/2] clocksource: timer-ti-dm: replace magic constant with descriptive macros
  2025-04-29 13:25 [PATCH 1/2] clocksource: timer-ti-dm: replace magic constant with descriptive macros Ahmad Fatoum
  2025-04-29 13:25 ` [PATCH 2/2] clocksource: timer-ti-dm: adapt omap_dmtimer_init parameter type to usage Ahmad Fatoum
@ 2025-04-29 15:04 ` Sascha Hauer
  2025-04-29 19:46   ` Daniel Lezcano
  1 sibling, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2025-04-29 15:04 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum; +Cc: Daniel Lezcano


On Tue, 29 Apr 2025 15:25:49 +0200, Ahmad Fatoum wrote:
> This improves readability a bit, but introduces no functional change.
> 
> 

Applied, thanks!

[1/2] clocksource: timer-ti-dm: replace magic constant with descriptive macros
      https://git.pengutronix.de/cgit/barebox/commit/?id=008ef5feae46 (link may not be stable)
[2/2] clocksource: timer-ti-dm: adapt omap_dmtimer_init parameter type to usage
      https://git.pengutronix.de/cgit/barebox/commit/?id=c762dd5beeb2 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




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

* Re: [PATCH 1/2] clocksource: timer-ti-dm: replace magic constant with descriptive macros
  2025-04-29 15:04 ` [PATCH 1/2] clocksource: timer-ti-dm: replace magic constant with descriptive macros Sascha Hauer
@ 2025-04-29 19:46   ` Daniel Lezcano
  2025-04-29 21:49     ` Ahmad Fatoum
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Lezcano @ 2025-04-29 19:46 UTC (permalink / raw)
  To: Sascha Hauer, barebox, Ahmad Fatoum

On 29/04/2025 17:04, Sascha Hauer wrote:
> 
> On Tue, 29 Apr 2025 15:25:49 +0200, Ahmad Fatoum wrote:
>> This improves readability a bit, but introduces no functional change.
>>
>>
> 
> Applied, thanks!

I'm a bit confused, can you explain why it is applied ? Is that an 
official tree ?


> [1/2] clocksource: timer-ti-dm: replace magic constant with descriptive macros
>        https://git.pengutronix.de/cgit/barebox/commit/?id=008ef5feae46 (link may not be stable)
> [2/2] clocksource: timer-ti-dm: adapt omap_dmtimer_init parameter type to usage
>        https://git.pengutronix.de/cgit/barebox/commit/?id=c762dd5beeb2 (link may not be stable)
> 
> Best regards,


-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog



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

* Re: [PATCH 1/2] clocksource: timer-ti-dm: replace magic constant with descriptive macros
  2025-04-29 19:46   ` Daniel Lezcano
@ 2025-04-29 21:49     ` Ahmad Fatoum
  0 siblings, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2025-04-29 21:49 UTC (permalink / raw)
  To: Daniel Lezcano, Sascha Hauer, barebox

Hello Daniel,

On 29.04.25 21:46, Daniel Lezcano wrote:
> On 29/04/2025 17:04, Sascha Hauer wrote:
>>
>> On Tue, 29 Apr 2025 15:25:49 +0200, Ahmad Fatoum wrote:
>>> This improves readability a bit, but introduces no functional change.
>>>
>>>
>>
>> Applied, thanks!
> 
> I'm a bit confused, can you explain why it is applied ? Is that an official tree ?

It's the official tree for the barebox bootloader.

These two patches as well as my original patch that you replied to were
sent to the barebox mailing list. Thanks for your input by the way.

Thanks to ARM architected timers, clocksource support in barebox doesn't
see much activity nowadays and my patches are the first submitted since lore.kernel.org
started indexing the barebox mailing list last year. Did your lei filter perhaps
match against my patch thinking they are kernel patches? :-)

Cheers,
Ahmad

> 
> 
>> [1/2] clocksource: timer-ti-dm: replace magic constant with descriptive macros
>>        https://git.pengutronix.de/cgit/barebox/commit/?id=008ef5feae46 (link may not be stable)
>> [2/2] clocksource: timer-ti-dm: adapt omap_dmtimer_init parameter type to usage
>>        https://git.pengutronix.de/cgit/barebox/commit/?id=c762dd5beeb2 (link may not be stable)
>>
>> Best regards,
> 
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



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

end of thread, other threads:[~2025-04-29 21:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-29 13:25 [PATCH 1/2] clocksource: timer-ti-dm: replace magic constant with descriptive macros Ahmad Fatoum
2025-04-29 13:25 ` [PATCH 2/2] clocksource: timer-ti-dm: adapt omap_dmtimer_init parameter type to usage Ahmad Fatoum
2025-04-29 15:04 ` [PATCH 1/2] clocksource: timer-ti-dm: replace magic constant with descriptive macros Sascha Hauer
2025-04-29 19:46   ` Daniel Lezcano
2025-04-29 21:49     ` Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox