diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2018-12-11 15:00:43 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-12-20 08:50:49 +0100 |
commit | 51b4a313e16c9fd76f392787d757c6f24ba5d3de (patch) | |
tree | fae3dc50826c3e9bc69b8c9b973ee61531e4812c /arch/arm/mach-omap | |
parent | ac3f5c7e7cffe682202b68a6645979fa327212f7 (diff) | |
download | barebox-51b4a313e16c9fd76f392787d757c6f24ba5d3de.tar.gz |
ARM: omap: dmtimer: Turn into a driver
Turn OMAP dmtimer 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/Kconfig | 5 | ||||
-rw-r--r-- | arch/arm/mach-omap/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-omap/am33xx_generic.c | 5 | ||||
-rw-r--r-- | arch/arm/mach-omap/dmtimer.c | 98 |
4 files changed, 5 insertions, 104 deletions
diff --git a/arch/arm/mach-omap/Kconfig b/arch/arm/mach-omap/Kconfig index c451cf0d47..5ab01439f0 100644 --- a/arch/arm/mach-omap/Kconfig +++ b/arch/arm/mach-omap/Kconfig @@ -43,7 +43,7 @@ config ARCH_AM33XX select CPU_V7 select GENERIC_GPIO select OFTREE - select OMAP_CLOCK_SOURCE_DMTIMER + select CLOCKSOURCE_TI_DM select ARM_USE_COMPRESSED_DTB help Say Y here if you are using Texas Instrument's AM33xx based platform @@ -52,9 +52,6 @@ config ARCH_AM33XX config OMAP_CLOCK_SOURCE_S32K bool -config OMAP_CLOCK_SOURCE_DMTIMER - 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 a84e94ed7d..4ce8e10587 100644 --- a/arch/arm/mach-omap/Makefile +++ b/arch/arm/mach-omap/Makefile @@ -18,7 +18,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_OMAP_CLOCK_SOURCE_DMTIMER) += dmtimer.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/am33xx_generic.c b/arch/arm/mach-omap/am33xx_generic.c index 513746248e..c446431537 100644 --- a/arch/arm/mach-omap/am33xx_generic.c +++ b/arch/arm/mach-omap/am33xx_generic.c @@ -256,7 +256,10 @@ int am33xx_init(void) int am33xx_devices_init(void) { - return am33xx_gpio_init(); + am33xx_gpio_init(); + add_generic_device("omap-dmtimer", 0, NULL, AM33XX_DMTIMER2_BASE, 0x400, + IORESOURCE_MEM, NULL); + return 0; } /* UART Defines */ diff --git a/arch/arm/mach-omap/dmtimer.c b/arch/arm/mach-omap/dmtimer.c deleted file mode 100644 index e223b8cc8f..0000000000 --- a/arch/arm/mach-omap/dmtimer.c +++ /dev/null @@ -1,98 +0,0 @@ -/** - * @file - * @brief Support DMTimer counter - * - * FileName: arch/arm/mach-omap/dmtimer.c - */ -/* - * This File is based on arch/arm/mach-omap/s32k_clksource.c - * (C) Copyright 2008 - * Texas Instruments, <www.ti.com> - * Nishanth Menon <x0nishan@ti.com> - * - * (C) Copyright 2012 Phytec Messtechnik GmbH - * Author: Teresa Gámez <t.gamez@phytec.de> - * (C) Copyright 2015 Phytec Messtechnik GmbH - * Author: Daniel Schultz <d.schultz@phytec.de> - * - * 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 <clock.h> -#include <init.h> -#include <io.h> -#include <mach/am33xx-silicon.h> -#include <mach/am33xx-clock.h> - -#include <stdio.h> - -#define CLK_RC32K 32768 - -#define TIDR 0x0 -#define TIOCP_CFG 0x10 -#define IRQ_EOI 0x20 -#define IRQSTATUS_RAW 0x24 -#define IRQSTATUS 0x28 -#define IRQSTATUS_SET 0x2c -#define IRQSTATUS_CLR 0x30 -#define IRQWAKEEN 0x34 -#define TCLR 0x38 -#define TCRR 0x3C -#define TLDR 0x40 -#define TTGR 0x44 -#define TWPS 0x48 -#define TMAR 0x4C -#define TCAR1 0x50 -#define TSICR 0x54 -#define TCAR2 0x58 - -static void *base = (void *)AM33XX_DMTIMER2_BASE; - -/** - * @brief Provide a simple counter read - * - * @return DMTimer counter - */ -static uint64_t dmtimer_read(void) -{ - return readl(base + TCRR); -} - -static struct clocksource dmtimer_cs = { - .read = dmtimer_read, - .mask = CLOCKSOURCE_MASK(32), - .shift = 10, -}; - -/** - * @brief Initialize the Clock - * - * Enable dmtimer. - * - * @return result of @ref init_clock - */ -static int dmtimer_init(void) -{ - u64 clk_speed; - - clk_speed = am33xx_get_osc_clock(); - clk_speed *= 1000; - dmtimer_cs.mult = clocksource_hz2mult(clk_speed, dmtimer_cs.shift); - - /* Enable counter */ - writel(0x3, base + TCLR); - - return init_clock(&dmtimer_cs); -} - -/* Run me at boot time */ -core_initcall(dmtimer_init); |