x86, mrst: share APB timer code with other platforms
Subsystems (2)
PATCH v4 1/1 x86, mrst: share APB timer code with other platforms
The APB timers are an IP block from Synopsys (DesignWare APB timers) and are also found in other systems including ARM SoC's. This patch adds functions for creating clock_event_devices and clocksources from APB timers but does not do the resource allocation. This is handled in a higher layer to allow the timers to be created from multiple methods such as platform_devices.
Changes since v3:
- Add dw_apb_clocksource_unregister()
- Move kerneldoc to the implementation file
Changes since v2:
- Make eoi() for clock_event_device optional for x86 where eoi is handled in firmware.
Changes since v1:
- Use the correct timer for clocksource on x86
- Select the correct timer rating for x86
- Restore freerunning timer behaviour for oneshot event devices
- Reenable event irq correctly for hotplug
--- arch/x86/Kconfig | 1 + arch/x86/include/asm/apb_timer.h | 22 +-- arch/x86/kernel/apb_timer.c | 409 ++++++------------------------------ drivers/clocksource/Kconfig | 3 + drivers/clocksource/Makefile | 1 + drivers/clocksource/dw_apb_timer.c | 401 +++++++++++++++++++++++++++++++++++ include/linux/dw_apb_timer.h | 56 +++++ 7 files changed, 533 insertions(+), 360 deletions(-) create mode 100644 drivers/clocksource/dw_apb_timer.c create mode 100644 include/linux/dw_apb_timer.h
arch/x86/Kconfig +1 -0
@@ -617,6 +617,7 @@ config HPET_EMULATE_RTC config APB_TIMER def_bool y if MRST prompt "Langwell APB Timer Support" if X86_MRST + select DW_APB_TIMER help APB timer is the replacement for 8254, HPET on X86 MID platforms. The APBT provides a stable time base on SMP
arch/x86/include/asm/apb_timer.h +2 -20
@@ -18,24 +18,6 @@#ifdef CONFIG_APB_TIMER -/* Langwell DW APB timer registers */ -#define APBTMR_N_LOAD_COUNT 0x00 -#define APBTMR_N_CURRENT_VALUE 0x04 -#define APBTMR_N_CONTROL 0x08 -#define APBTMR_N_EOI 0x0c -#define APBTMR_N_INT_STATUS 0x10 - -#define APBTMRS_INT_STATUS 0xa0 -#define APBTMRS_EOI 0xa4 -#define APBTMRS_RAW_INT_STATUS 0xa8 -#define APBTMRS_COMP_VERSION 0xac -#define APBTMRS_REG_SIZE 0x14 - -/* register bits */ -#define APBTMR_CONTROL_ENABLE (1<<0) -#define APBTMR_CONTROL_MODE_PERIODIC (1<<1)/*1: periodic 0:free running */ -#define APBTMR_CONTROL_INT (1<<2) -/* default memory mapped register base */ #define LNW_SCU_ADDR 0xFF100000#define LNW_EXT_TIMER_OFFSET 0x1B800
@@ -43,8 +25,8 @@#define LNW_EXT_TIMER_PGOFFSET 0x800/* APBT clock speed range from PCLK to fabric base, 25-100MHz */ -#define APBT_MAX_FREQ 50 -#define APBT_MIN_FREQ 1 +#define APBT_MAX_FREQ 50000000 +#define APBT_MIN_FREQ 1000000#define APBT_MMAP_SIZE 1024#define APBT_DEV_USED 1
arch/x86/kernel/apb_timer.c +69 -340
609 lines not on this page · raw message
drivers/clocksource/Kconfig +3 -0
@@ -3,3 +3,6 @@ config CLKSRC_I8253 config CLKSRC_MMIO bool + +config DW_APB_TIMER + bool
drivers/clocksource/Makefile +1 -0
@@ -8,3 +8,4 @@ obj-$(CONFIG_SH_TIMER_MTU2) += sh_mtu2.o obj-$(CONFIG_SH_TIMER_TMU) += sh_tmu.o obj-$(CONFIG_CLKSRC_I8253) += i8253.o obj-$(CONFIG_CLKSRC_MMIO) += mmio.o +obj-$(CONFIG_DW_APB_TIMER) += dw_apb_timer.o
drivers/clocksource/dw_apb_timer.c new file +401 -0
401 lines not on this page · raw message
include/linux/dw_apb_timer.h new file +56 -0
56 lines not on this page · raw message
Signature · 1 line
1.7.4.1
Quoted 19 lines · Jamie Iles
The APB timers are an IP block from Synopsys (DesignWare APB timers) and are also found in other systems including ARM SoC's. This patch adds functions for creating
clock_event_devicesand clocksources from APB timers but does not do the resource allocation. This is handled in a higher layer to allow the timers to be created from multiple methods such asplatform_devices.Changes since v3:
- Adddw_apb_clocksource_unregister()
- Move kerneldoc to the implementation file
Changes since v2:
- Makeeoi()forclock_event_deviceoptional for x86 where eoi is handled in firmware.
Changes since v1:
- Use the correct timer for clocksource on x86
- Select the correct timer rating for x86
- Restore freerunning timer behaviour for oneshot event devices
- Reenable event irq correctly for hotplug
Quoted 7 lines
Cc John Stultz <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>Cc "H. Peter Anvin" <[email protected]>Cc Jacob Pan <[email protected]>Signed-off-by Jamie Iles <[email protected]>---
Ping?
Jamie
Quoted 28 lines · Jamie Iles
Quoted 19 lines · Jamie Iles
The APB timers are an IP block from Synopsys (DesignWare APB timers) and are also found in other systems including ARM SoC's. This patch adds functions for creating
clock_event_devicesand clocksources from APB timers but does not do the resource allocation. This is handled in a higher layer to allow the timers to be created from multiple methods such asplatform_devices.Changes since v3:
- Adddw_apb_clocksource_unregister()
- Move kerneldoc to the implementation file
Changes since v2:
- Makeeoi()forclock_event_deviceoptional for x86 where eoi is handled in firmware.
Changes since v1:
- Use the correct timer for clocksource on x86
- Select the correct timer rating for x86
- Restore freerunning timer behaviour for oneshot event devices
- Reenable event irq correctly for hotplugQuoted 7 lines
Cc John Stultz <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>Cc "H. Peter Anvin" <[email protected]>Cc Jacob Pan <[email protected]>Signed-off-by Jamie Iles <[email protected]>---
Quoted 1 line
Ping?
Sorry for being slow here. Looks ok to me, so I've queued this for 3.1.
thanks
-john