From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 11/12] ARM: versatile: Use existing clocksource driver
Date: Tue, 2 May 2023 11:14:18 +0200 [thread overview]
Message-ID: <20230502091419.2551228-12-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20230502091419.2551228-1-s.hauer@pengutronix.de>
We already have a SP804 driver in drivers/clocksource/. Use that instead
of the open coded arch clocksource.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/Kconfig | 2 ++
arch/arm/mach-versatile/core.c | 60 ----------------------------------
2 files changed, 2 insertions(+), 60 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index ef3adbbe9d..1d2734975a 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -275,6 +275,8 @@ config ARCH_VERSATILE
bool "ARM Versatile boards (ARM926EJ-S)"
depends on 32BIT
select GPIOLIB
+ select ARM_AMBA
+ select AMBA_SP804
select HAVE_CLK
select HAS_DEBUG_LL
select COMMON_CLK
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 74af8c0804..b0124b700c 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -35,69 +35,10 @@
#include <linux/amba/bus.h>
#include <io.h>
-#include <asm/hardware/arm_timer.h>
#include <asm/armlinux.h>
#include <mach/versatile/platform.h>
-
-/* 1Mhz / 256 */
-#define TIMER_FREQ (1000000/256)
-
-#define TIMER0_BASE (VERSATILE_TIMER0_1_BASE)
-#define TIMER1_BASE ((VERSATILE_TIMER0_1_BASE) + 0x20)
-#define TIMER2_BASE (VERSATILE_TIMER2_3_BASE)
-#define TIMER3_BASE ((VERSATILE_TIMER2_3_BASE) + 0x20)
-
-static uint64_t vpb_clocksource_read(void)
-{
- return ~readl(TIMER0_BASE + TIMER_VALUE);
-}
-
-static struct clocksource vpb_cs = {
- .read = vpb_clocksource_read,
- .mask = CLOCKSOURCE_MASK(32),
- .shift = 10,
- .priority = 80,
-};
-
-/* From Linux v2.6.35
- * arch/arm/mach-versatile/core.c */
-static void versatile_timer_init (void)
-{
- u32 val;
-
- /*
- * set clock frequency:
- * VERSATILE_REFCLK is 32KHz
- * VERSATILE_TIMCLK is 1MHz
- */
-
- val = readl(VERSATILE_SCTL_BASE);
- val |= (VERSATILE_TIMCLK << VERSATILE_TIMER1_EnSel);
- writel(val, VERSATILE_SCTL_BASE);
-
- /*
- * Disable all timers, just to be sure.
- */
-
- writel(0, TIMER0_BASE + TIMER_CTRL);
- writel(0, TIMER1_BASE + TIMER_CTRL);
- writel(0, TIMER2_BASE + TIMER_CTRL);
- writel(0, TIMER3_BASE + TIMER_CTRL);
-
- writel(TIMER_CTRL_32BIT | TIMER_CTRL_ENABLE | TIMER_CTRL_DIV256,
- TIMER0_BASE + TIMER_CTRL);
-}
-
-static int vpb_clocksource_init(void)
-{
- versatile_timer_init();
- vpb_cs.mult = clocksource_hz2mult(TIMER_FREQ, vpb_cs.shift);
-
- return init_clock(&vpb_cs);
-}
-
static void __noreturn versatile_reset_soc(struct restart_handler *rst)
{
u32 val;
@@ -118,7 +59,6 @@ static int versatile_init(void)
!of_machine_is_compatible("arm,versatile-ab"))
return 0;
- vpb_clocksource_init();
restart_handler_register_fn("soc", versatile_reset_soc);
return 0;
}
--
2.39.2
next prev parent reply other threads:[~2023-05-02 9:15 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-02 9:14 [PATCH 00/12] ARM Versatile updates Sascha Hauer
2023-05-02 9:14 ` [PATCH 01/12] ARM: versatile: Enable CONFIG_RELOCATABLE Sascha Hauer
2023-05-02 9:14 ` [PATCH 02/12] ARM: versatile: Use common clk framework Sascha Hauer
2023-05-02 9:14 ` [PATCH 03/12] ARM: versatile: drop platform code to register UART Sascha Hauer
2023-05-02 9:14 ` [PATCH 04/12] ARM: versatile: drop platform code to register GPIOs Sascha Hauer
2023-05-02 9:14 ` [PATCH 05/12] ARM: versatile: Use flash from device tree Sascha Hauer
2023-05-02 9:14 ` [PATCH 06/12] ARM: versatile: Use smc91c111 " Sascha Hauer
2023-05-02 9:17 ` Ahmad Fatoum
2023-05-02 11:41 ` Sascha Hauer
2023-05-02 9:14 ` [PATCH 07/12] ARM: versatile: make sure to run initcalls on versatile only Sascha Hauer
2023-05-02 9:14 ` [PATCH 08/12] ARM: versatile: simplify ARM1176 support Sascha Hauer
2023-05-02 9:14 ` [PATCH 09/12] ARM: versatile: move over to multi image support Sascha Hauer
2023-05-02 9:14 ` [PATCH 10/12] ARM: versatile: move over to multi arch support Sascha Hauer
2023-05-02 9:14 ` Sascha Hauer [this message]
2023-05-02 9:14 ` [PATCH 12/12] ARM: Merge imx_defconfig and versatilepb_defconfig into multi_v5_v6_defconfig 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=20230502091419.2551228-12-s.hauer@pengutronix.de \
--to=s.hauer@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