mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 2/9] clocksource: ti-dm: make available in PBL
Date: Tue, 22 Apr 2025 07:26:28 +0200	[thread overview]
Message-ID: <20250422052635.3423961-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20250422052635.3423961-1-a.fatoum@pengutronix.de>

Now that there's clocksource framework support in PBL, let's make
available the first clocksource driver for use by OMAP HSMMC.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/mach-omap/Kconfig        |  1 +
 drivers/clocksource/Makefile      |  2 +-
 drivers/clocksource/timer-ti-dm.c | 19 +++++++++++++------
 include/mach/omap/am33xx-clock.h  |  3 +++
 4 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-omap/Kconfig b/arch/arm/mach-omap/Kconfig
index 6c4e9d748d61..e7a9b331125d 100644
--- a/arch/arm/mach-omap/Kconfig
+++ b/arch/arm/mach-omap/Kconfig
@@ -40,6 +40,7 @@ config ARCH_AM33XX
 	select CPU_V7
 	select GENERIC_GPIO
 	select CLOCKSOURCE_TI_DM
+	select PBL_CLOCKSOURCE
 	help
 	  Say Y here if you are using Texas Instrument's AM33xx based platform
 
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index eceaa990d43d..dff825565072 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -20,7 +20,7 @@ endif
 obj-$(CONFIG_CLOCKSOURCE_ARM_GLOBAL_TIMER) += arm_global_timer.o
 obj-$(CONFIG_CLOCKSOURCE_IMX_GPT) += timer-imx-gpt.o
 obj-$(CONFIG_CLOCKSOURCE_DW_APB_TIMER) += dw_apb_timer.o
-obj-$(CONFIG_CLOCKSOURCE_TI_DM) += timer-ti-dm.o
+obj-pbl-$(CONFIG_CLOCKSOURCE_TI_DM) += timer-ti-dm.o
 obj-$(CONFIG_CLOCKSOURCE_TI_32K) += timer-ti-32k.o
 obj-$(CONFIG_CLINT_TIMER) += timer-clint.o
 obj-$(CONFIG_RISCV_TIMER) += timer-riscv.o
diff --git a/drivers/clocksource/timer-ti-dm.c b/drivers/clocksource/timer-ti-dm.c
index eb658402f58d..1090b96a0e94 100644
--- a/drivers/clocksource/timer-ti-dm.c
+++ b/drivers/clocksource/timer-ti-dm.c
@@ -69,6 +69,18 @@ struct omap_dmtimer_data {
 	int (*get_clock)(struct device *dev);
 };
 
+int omap_dmtimer_init(void __iomem *mmio_start, unsigned clk_speed)
+{
+	base = mmio_start;
+
+	dmtimer_cs.mult = clocksource_hz2mult(clk_speed, dmtimer_cs.shift);
+
+	/* Enable counter */
+	writel(0x3, base + TCLR);
+
+	return init_clock(&dmtimer_cs);
+}
+
 static int omap_dmtimer_probe(struct device *dev)
 {
 	struct resource *iores;
@@ -90,12 +102,7 @@ static int omap_dmtimer_probe(struct device *dev)
 	if (clk_speed < 0)
 		return clk_speed;
 
-	dmtimer_cs.mult = clocksource_hz2mult(clk_speed, dmtimer_cs.shift);
-
-	/* Enable counter */
-	writel(0x3, base + TCLR);
-
-	return init_clock(&dmtimer_cs);
+	return omap_dmtimer_init(IOMEM(iores->start), clk_speed);
 }
 
 static int am335x_get_clock(struct device *dev)
diff --git a/include/mach/omap/am33xx-clock.h b/include/mach/omap/am33xx-clock.h
index af47a0f3e77a..b064337ac4f8 100644
--- a/include/mach/omap/am33xx-clock.h
+++ b/include/mach/omap/am33xx-clock.h
@@ -191,4 +191,7 @@ 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);
+
 #endif  /* endif _AM33XX_CLOCKS_H_ */
-- 
2.39.5




  parent reply	other threads:[~2025-04-22  5:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-22  5:26 [PATCH 0/9] ARM: OMAP: beaglebone: add PBL SD xload support Ahmad Fatoum
2025-04-22  5:26 ` [PATCH 1/9] clocksource: make available in PBL Ahmad Fatoum
2025-04-22  5:26 ` Ahmad Fatoum [this message]
2025-04-22  5:26 ` [PATCH 3/9] mci: move mci_setup_cmd definition into header Ahmad Fatoum
2025-04-22  5:26 ` [PATCH 4/9] mci: add common PBL helper for chainloading after BootROM initialization Ahmad Fatoum
2025-04-22  5:26 ` [PATCH 5/9] mci: pbl: add autodetection of BootROM-initialized standard capacity cards Ahmad Fatoum
2025-04-22  5:26 ` [PATCH 6/9] mci: omap_hsmmc: split out common code Ahmad Fatoum
2025-04-22  5:26 ` [PATCH 7/9] ARM: OMAP: add am33xx_hsmmc_start_image for PBL Ahmad Fatoum
2025-04-22  5:26 ` [PATCH 8/9] mci: omap_hsmmc: add xload implementation " Ahmad Fatoum
2025-04-22  5:26 ` [PATCH 9/9] ARM: OMAP: beaglebone: add PBL SD xload support Ahmad Fatoum
2025-04-22 10:55 ` [PATCH 0/9] " Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250422052635.3423961-3-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox