summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-12-14 11:21:06 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2018-12-20 08:50:49 +0100
commit525dff974334878274b13419f2507c27ac7e54c6 (patch)
tree2eb094c3eaa69bb9ea172c2261a57538a5b1f16c /arch/arm/mach-omap
parent51b4a313e16c9fd76f392787d757c6f24ba5d3de (diff)
downloadbarebox-525dff974334878274b13419f2507c27ac7e54c6.tar.gz
barebox-525dff974334878274b13419f2507c27ac7e54c6.tar.xz
ARM: omap: 32ktimer: Turn into a driver
Turn OMAP 32KHz timer into a driver and move to drivers/clocksource. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-omap')
-rw-r--r--arch/arm/mach-omap/Kconfig8
-rw-r--r--arch/arm/mach-omap/Makefile1
-rw-r--r--arch/arm/mach-omap/omap3_generic.c5
-rw-r--r--arch/arm/mach-omap/omap4_generic.c5
-rw-r--r--arch/arm/mach-omap/s32k_clksource.c85
5 files changed, 10 insertions, 94 deletions
diff --git a/arch/arm/mach-omap/Kconfig b/arch/arm/mach-omap/Kconfig
index 5ab01439f0..34d37dcd7e 100644
--- a/arch/arm/mach-omap/Kconfig
+++ b/arch/arm/mach-omap/Kconfig
@@ -26,7 +26,7 @@ config ARCH_OMAP3
bool
select CPU_V7
select GENERIC_GPIO
- select OMAP_CLOCK_SOURCE_S32K
+ select CLOCKSOURCE_TI_32K
help
Say Y here if you are using Texas Instrument's OMAP343x based platform
@@ -34,7 +34,7 @@ config ARCH_OMAP4
bool
select CPU_V7
select GENERIC_GPIO
- select OMAP_CLOCK_SOURCE_S32K
+ select CLOCKSOURCE_TI_32K
help
Say Y here if you are using Texas Instrument's OMAP4 based platform
@@ -48,10 +48,6 @@ config ARCH_AM33XX
help
Say Y here if you are using Texas Instrument's AM33xx based platform
-# Blind enable all possible clocks.. think twice before you do this.
-config OMAP_CLOCK_SOURCE_S32K
- bool
-
config OMAP_GPMC
prompt "Support for GPMC configuration"
bool
diff --git a/arch/arm/mach-omap/Makefile b/arch/arm/mach-omap/Makefile
index 4ce8e10587..e6132342e1 100644
--- a/arch/arm/mach-omap/Makefile
+++ b/arch/arm/mach-omap/Makefile
@@ -17,7 +17,6 @@
#
obj-$(CONFIG_ARCH_OMAP) += syslib.o omap_devices.o omap_generic.o omap_fb.o
pbl-$(CONFIG_ARCH_OMAP) += syslib.o
-obj-$(CONFIG_OMAP_CLOCK_SOURCE_S32K) += s32k_clksource.o
obj-$(CONFIG_ARCH_OMAP3) += omap3_generic.o auxcr.o
pbl-$(CONFIG_ARCH_OMAP3) += omap3_generic.o auxcr.o
obj-$(CONFIG_ARCH_OMAP4) += omap4_generic.o omap4_clock.o
diff --git a/arch/arm/mach-omap/omap3_generic.c b/arch/arm/mach-omap/omap3_generic.c
index 02aa65d08b..3f91441d2e 100644
--- a/arch/arm/mach-omap/omap3_generic.c
+++ b/arch/arm/mach-omap/omap3_generic.c
@@ -533,6 +533,9 @@ static int omap3_gpio_init(void)
int omap3_devices_init(void)
{
- return omap3_gpio_init();
+ omap3_gpio_init();
+ add_generic_device("omap-32ktimer", 0, NULL, OMAP3_32KTIMER_BASE, 0x400,
+ IORESOURCE_MEM, NULL);
+ return 0;
}
#endif
diff --git a/arch/arm/mach-omap/omap4_generic.c b/arch/arm/mach-omap/omap4_generic.c
index a3f370df8f..c7b6e513a2 100644
--- a/arch/arm/mach-omap/omap4_generic.c
+++ b/arch/arm/mach-omap/omap4_generic.c
@@ -684,5 +684,8 @@ static int omap4_gpio_init(void)
int omap4_devices_init(void)
{
- return omap4_gpio_init();
+ omap4_gpio_init();
+ add_generic_device("omap-32ktimer", 0, NULL, OMAP44XX_32KTIMER_BASE, 0x400,
+ IORESOURCE_MEM, NULL);
+ return 0;
}
diff --git a/arch/arm/mach-omap/s32k_clksource.c b/arch/arm/mach-omap/s32k_clksource.c
deleted file mode 100644
index 7def8b1807..0000000000
--- a/arch/arm/mach-omap/s32k_clksource.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * @file
- * @brief Provide @ref clocksource functionality for OMAP
- *
- * @ref clocksource provides a neat architecture. all we do is
- * To loop in with Sync 32Khz clock ticking away at 32768hz on OMAP.
- * Sync 32Khz clock is an always ON clock.
- *
- * (C) Copyright 2008
- * Texas Instruments, <www.ti.com>
- * Nishanth Menon <x0nishan@ti.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#include <common.h>
-#include <clock.h>
-#include <init.h>
-#include <io.h>
-#include <mach/omap3-silicon.h>
-#include <mach/omap4-silicon.h>
-#include <mach/clocks.h>
-#include <mach/timers.h>
-#include <mach/sys_info.h>
-#include <mach/syslib.h>
-
-/** Sync 32Khz Timer registers */
-#define S32K_CR 0x10
-#define S32K_FREQUENCY 32768
-
-static void __iomem *timerbase;
-
-/**
- * @brief Provide a simple clock read
- *
- * Nothing is simpler.. read direct from clock and provide it
- * to the caller.
- *
- * @return S32K clock counter
- */
-static uint64_t s32k_clocksource_read(void)
-{
- return readl(timerbase + S32K_CR);
-}
-
-/* A bit obvious isn't it? */
-static struct clocksource s32k_cs = {
- .read = s32k_clocksource_read,
- .mask = CLOCKSOURCE_MASK(32),
- .shift = 10,
-};
-
-/**
- * @brief Initialize the Clock
- *
- * There is nothing to do on OMAP as SYNC32K clock is
- * always on, and we do a simple data structure initialization.
- * 32K clock gives 32768 ticks a seconds
- *
- * @return result of @ref init_clock
- */
-static int s32k_clocksource_init(void)
-{
- if (IS_ENABLED(CONFIG_ARCH_OMAP3))
- timerbase = (void *)OMAP3_32KTIMER_BASE;
- else if (IS_ENABLED(CONFIG_ARCH_OMAP4))
- timerbase = (void *)OMAP44XX_32KTIMER_BASE;
- else
- BUG();
-
- s32k_cs.mult = clocksource_hz2mult(S32K_FREQUENCY, s32k_cs.shift);
-
- return init_clock(&s32k_cs);
-}
-
-/* Run me at boot time */
-core_initcall(s32k_clocksource_init);