diff options
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/arm/Kconfig | 1 | ||||
| -rw-r--r-- | arch/arm/boot/dts/zynq-7000.dtsi | 45 | ||||
| -rw-r--r-- | arch/arm/boot/dts/zynq-zc702.dts | 10 | ||||
| -rw-r--r-- | arch/arm/include/asm/smp_twd.h | 8 | ||||
| -rw-r--r-- | arch/arm/kernel/smp_twd.c | 17 | ||||
| -rw-r--r-- | arch/arm/mach-highbank/highbank.c | 5 | ||||
| -rw-r--r-- | arch/arm/mach-imx/mach-imx6q.c | 5 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/timer.c | 2 | ||||
| -rw-r--r-- | arch/arm/mach-spear13xx/spear13xx.c | 4 | ||||
| -rw-r--r-- | arch/arm/mach-ux500/timer.c | 3 | ||||
| -rw-r--r-- | arch/arm/mach-vexpress/v2m.c | 6 | ||||
| -rw-r--r-- | arch/arm/mach-zynq/Kconfig | 1 | ||||
| -rw-r--r-- | arch/arm/mach-zynq/Makefile | 2 | ||||
| -rw-r--r-- | arch/arm/mach-zynq/common.c | 3 | ||||
| -rw-r--r-- | arch/arm/mach-zynq/common.h | 2 | ||||
| -rw-r--r-- | arch/arm/mach-zynq/timer.c | 324 | 
16 files changed, 27 insertions, 411 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index c6a82c74fcb..eb91022b90b 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1598,6 +1598,7 @@ config HAVE_ARM_ARCH_TIMER  config HAVE_ARM_TWD  	bool  	depends on SMP +	select CLKSRC_OF if OF  	help  	  This options enables support for the ARM timer and watchdog unit diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi index 5914b565459..51243db2e9e 100644 --- a/arch/arm/boot/dts/zynq-7000.dtsi +++ b/arch/arm/boot/dts/zynq-7000.dtsi @@ -111,56 +111,23 @@  		};  		ttc0: ttc0@f8001000 { -			#address-cells = <1>; -			#size-cells = <0>; -			compatible = "xlnx,ttc"; +			interrupt-parent = <&intc>; +			interrupts = < 0 10 4 0 11 4 0 12 4 >; +			compatible = "cdns,ttc";  			reg = <0xF8001000 0x1000>;  			clocks = <&cpu_clk 3>;  			clock-names = "cpu_1x";  			clock-ranges; - -			ttc0_0: ttc0.0 { -				status = "disabled"; -				reg = <0>; -				interrupts = <0 10 4>; -			}; -			ttc0_1: ttc0.1 { -				status = "disabled"; -				reg = <1>; -				interrupts = <0 11 4>; -			}; -			ttc0_2: ttc0.2 { -				status = "disabled"; -				reg = <2>; -				interrupts = <0 12 4>; -			};  		};  		ttc1: ttc1@f8002000 { -			#interrupt-parent = <&intc>; -			#address-cells = <1>; -			#size-cells = <0>; -			compatible = "xlnx,ttc"; +			interrupt-parent = <&intc>; +			interrupts = < 0 37 4 0 38 4 0 39 4 >; +			compatible = "cdns,ttc";  			reg = <0xF8002000 0x1000>;  			clocks = <&cpu_clk 3>;  			clock-names = "cpu_1x";  			clock-ranges; - -			ttc1_0: ttc1.0 { -				status = "disabled"; -				reg = <0>; -				interrupts = <0 37 4>; -			}; -			ttc1_1: ttc1.1 { -				status = "disabled"; -				reg = <1>; -				interrupts = <0 38 4>; -			}; -			ttc1_2: ttc1.2 { -				status = "disabled"; -				reg = <2>; -				interrupts = <0 39 4>; -			};  		};  	};  }; diff --git a/arch/arm/boot/dts/zynq-zc702.dts b/arch/arm/boot/dts/zynq-zc702.dts index c772942a399..86f44d5b026 100644 --- a/arch/arm/boot/dts/zynq-zc702.dts +++ b/arch/arm/boot/dts/zynq-zc702.dts @@ -32,13 +32,3 @@  &ps_clk {  	clock-frequency = <33333330>;  }; - -&ttc0_0 { -	status = "ok"; -	compatible = "xlnx,ttc-counter-clocksource"; -}; - -&ttc0_1 { -	status = "ok"; -	compatible = "xlnx,ttc-counter-clockevent"; -}; diff --git a/arch/arm/include/asm/smp_twd.h b/arch/arm/include/asm/smp_twd.h index 0f01f4677bd..7b2899c2f7f 100644 --- a/arch/arm/include/asm/smp_twd.h +++ b/arch/arm/include/asm/smp_twd.h @@ -34,12 +34,4 @@ struct twd_local_timer name __initdata = {	\  int twd_local_timer_register(struct twd_local_timer *); -#ifdef CONFIG_HAVE_ARM_TWD -void twd_local_timer_of_register(void); -#else -static inline void twd_local_timer_of_register(void) -{ -} -#endif -  #endif diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c index 3f256503748..90525d9d290 100644 --- a/arch/arm/kernel/smp_twd.c +++ b/arch/arm/kernel/smp_twd.c @@ -362,25 +362,13 @@ int __init twd_local_timer_register(struct twd_local_timer *tlt)  }  #ifdef CONFIG_OF -const static struct of_device_id twd_of_match[] __initconst = { -	{ .compatible = "arm,cortex-a9-twd-timer",	}, -	{ .compatible = "arm,cortex-a5-twd-timer",	}, -	{ .compatible = "arm,arm11mp-twd-timer",	}, -	{ }, -}; - -void __init twd_local_timer_of_register(void) +static void __init twd_local_timer_of_register(struct device_node *np)  { -	struct device_node *np;  	int err;  	if (!is_smp() || !setup_max_cpus)  		return; -	np = of_find_matching_node(NULL, twd_of_match); -	if (!np) -		return; -  	twd_ppi = irq_of_parse_and_map(np, 0);  	if (!twd_ppi) {  		err = -EINVAL; @@ -398,4 +386,7 @@ void __init twd_local_timer_of_register(void)  out:  	WARN(err, "twd_local_timer_of_register failed (%d)\n", err);  } +CLOCKSOURCE_OF_DECLARE(arm_twd_a9, "arm,cortex-a9-twd-timer", twd_local_timer_of_register); +CLOCKSOURCE_OF_DECLARE(arm_twd_a5, "arm,cortex-a5-twd-timer", twd_local_timer_of_register); +CLOCKSOURCE_OF_DECLARE(arm_twd_11mp, "arm,arm11mp-twd-timer", twd_local_timer_of_register);  #endif diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c index a4f9f50247d..76c1170b352 100644 --- a/arch/arm/mach-highbank/highbank.c +++ b/arch/arm/mach-highbank/highbank.c @@ -32,7 +32,6 @@  #include <asm/cacheflush.h>  #include <asm/cputype.h>  #include <asm/smp_plat.h> -#include <asm/smp_twd.h>  #include <asm/hardware/arm_timer.h>  #include <asm/hardware/timer-sp.h>  #include <asm/hardware/cache-l2x0.h> @@ -119,10 +118,10 @@ static void __init highbank_timer_init(void)  	sp804_clocksource_and_sched_clock_init(timer_base + 0x20, "timer1");  	sp804_clockevents_init(timer_base, irq, "timer0"); -	twd_local_timer_of_register(); -  	arch_timer_of_register();  	arch_timer_sched_clock_init(); + +	clocksource_of_init();  }  static void highbank_power_off(void) diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c index 9ffd103b27e..b59ddcb57c7 100644 --- a/arch/arm/mach-imx/mach-imx6q.c +++ b/arch/arm/mach-imx/mach-imx6q.c @@ -12,6 +12,7 @@  #include <linux/clk.h>  #include <linux/clkdev.h> +#include <linux/clocksource.h>  #include <linux/cpu.h>  #include <linux/delay.h>  #include <linux/export.h> @@ -28,11 +29,9 @@  #include <linux/regmap.h>  #include <linux/micrel_phy.h>  #include <linux/mfd/syscon.h> -#include <asm/smp_twd.h>  #include <asm/hardware/cache-l2x0.h>  #include <asm/mach/arch.h>  #include <asm/mach/map.h> -#include <asm/mach/time.h>  #include <asm/system_misc.h>  #include "common.h" @@ -292,7 +291,7 @@ static void __init imx6q_init_irq(void)  static void __init imx6q_timer_init(void)  {  	mx6q_clocks_init(); -	twd_local_timer_of_register(); +	clocksource_of_init();  	imx_print_silicon_rev("i.MX6Q", imx6q_revision());  } diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c index 2bdd4cf17a8..4fd80257c73 100644 --- a/arch/arm/mach-omap2/timer.c +++ b/arch/arm/mach-omap2/timer.c @@ -597,7 +597,7 @@ void __init omap4_local_timer_init(void)  		int err;  		if (of_have_populated_dt()) { -			twd_local_timer_of_register(); +			clocksource_of_init();  			return;  		} diff --git a/arch/arm/mach-spear13xx/spear13xx.c b/arch/arm/mach-spear13xx/spear13xx.c index c7d2b4a8d8c..25a10191b02 100644 --- a/arch/arm/mach-spear13xx/spear13xx.c +++ b/arch/arm/mach-spear13xx/spear13xx.c @@ -15,12 +15,12 @@  #include <linux/amba/pl022.h>  #include <linux/clk.h> +#include <linux/clocksource.h>  #include <linux/dw_dmac.h>  #include <linux/err.h>  #include <linux/of.h>  #include <asm/hardware/cache-l2x0.h>  #include <asm/mach/map.h> -#include <asm/smp_twd.h>  #include <mach/dma.h>  #include <mach/generic.h>  #include <mach/spear.h> @@ -179,5 +179,5 @@ void __init spear13xx_timer_init(void)  	clk_put(pclk);  	spear_setup_of_timer(); -	twd_local_timer_of_register(); +	clocksource_of_init();  } diff --git a/arch/arm/mach-ux500/timer.c b/arch/arm/mach-ux500/timer.c index a6af0b8732b..d07bbe7f04a 100644 --- a/arch/arm/mach-ux500/timer.c +++ b/arch/arm/mach-ux500/timer.c @@ -7,6 +7,7 @@  #include <linux/io.h>  #include <linux/errno.h>  #include <linux/clksrc-dbx500-prcmu.h> +#include <linux/clocksource.h>  #include <linux/of.h>  #include <linux/of_address.h>  #include <linux/platform_data/clocksource-nomadik-mtu.h> @@ -32,7 +33,7 @@ static void __init ux500_twd_init(void)  	twd_local_timer = &u8500_twd_local_timer;  	if (of_have_populated_dt()) -		twd_local_timer_of_register(); +		clocksource_of_init();  	else {  		err = twd_local_timer_register(twd_local_timer);  		if (err) diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c index 915683cb67d..d0ad78998cb 100644 --- a/arch/arm/mach-vexpress/v2m.c +++ b/arch/arm/mach-vexpress/v2m.c @@ -5,6 +5,7 @@  #include <linux/amba/bus.h>  #include <linux/amba/mmci.h>  #include <linux/io.h> +#include <linux/clocksource.h>  #include <linux/smp.h>  #include <linux/init.h>  #include <linux/irqchip.h> @@ -25,7 +26,6 @@  #include <asm/arch_timer.h>  #include <asm/mach-types.h>  #include <asm/sizes.h> -#include <asm/smp_twd.h>  #include <asm/mach/arch.h>  #include <asm/mach/map.h>  #include <asm/mach/time.h> @@ -435,6 +435,7 @@ static void __init v2m_dt_timer_init(void)  	vexpress_clk_of_init(); +	clocksource_of_init();  	do {  		node = of_find_compatible_node(node, NULL, "arm,sp804");  	} while (node && vexpress_get_site_by_node(node) != VEXPRESS_SITE_MB); @@ -445,8 +446,7 @@ static void __init v2m_dt_timer_init(void)  				irq_of_parse_and_map(node, 0));  	} -	if (arch_timer_of_register() != 0) -		twd_local_timer_of_register(); +	arch_timer_of_register();  	if (arch_timer_sched_clock_init() != 0)  		versatile_sched_clock_init(vexpress_get_24mhz_clock_base(), diff --git a/arch/arm/mach-zynq/Kconfig b/arch/arm/mach-zynq/Kconfig index adb6c0ea0e5..d70651e8b70 100644 --- a/arch/arm/mach-zynq/Kconfig +++ b/arch/arm/mach-zynq/Kconfig @@ -9,5 +9,6 @@ config ARCH_ZYNQ  	select MIGHT_HAVE_CACHE_L2X0  	select USE_OF  	select SPARSE_IRQ +	select CADENCE_TTC_TIMER  	help  	  Support for Xilinx Zynq ARM Cortex A9 Platform diff --git a/arch/arm/mach-zynq/Makefile b/arch/arm/mach-zynq/Makefile index 397268c1b25..320faedeb48 100644 --- a/arch/arm/mach-zynq/Makefile +++ b/arch/arm/mach-zynq/Makefile @@ -3,4 +3,4 @@  #  # Common support -obj-y				:= common.o timer.o +obj-y				:= common.o diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c index 5c898321818..68e0907de5d 100644 --- a/arch/arm/mach-zynq/common.c +++ b/arch/arm/mach-zynq/common.c @@ -20,6 +20,7 @@  #include <linux/platform_device.h>  #include <linux/clk.h>  #include <linux/clk/zynq.h> +#include <linux/clocksource.h>  #include <linux/of_address.h>  #include <linux/of_irq.h>  #include <linux/of_platform.h> @@ -77,7 +78,7 @@ static void __init xilinx_zynq_timer_init(void)  	xilinx_zynq_clocks_init(slcr); -	xttcps_timer_init(); +	clocksource_of_init();  }  /** diff --git a/arch/arm/mach-zynq/common.h b/arch/arm/mach-zynq/common.h index 8b4dbbaa01c..5050bb10bb1 100644 --- a/arch/arm/mach-zynq/common.h +++ b/arch/arm/mach-zynq/common.h @@ -17,6 +17,4 @@  #ifndef __MACH_ZYNQ_COMMON_H__  #define __MACH_ZYNQ_COMMON_H__ -void __init xttcps_timer_init(void); -  #endif diff --git a/arch/arm/mach-zynq/timer.c b/arch/arm/mach-zynq/timer.c deleted file mode 100644 index f9fbc9c1e7a..00000000000 --- a/arch/arm/mach-zynq/timer.c +++ /dev/null @@ -1,324 +0,0 @@ -/* - * This file contains driver for the Xilinx PS Timer Counter IP. - * - *  Copyright (C) 2011 Xilinx - * - * based on arch/mips/kernel/time.c timer driver - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * 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 <linux/interrupt.h> -#include <linux/clockchips.h> -#include <linux/of_address.h> -#include <linux/of_irq.h> -#include <linux/slab.h> -#include <linux/clk-provider.h> -#include "common.h" - -/* - * Timer Register Offset Definitions of Timer 1, Increment base address by 4 - * and use same offsets for Timer 2 - */ -#define XTTCPS_CLK_CNTRL_OFFSET		0x00 /* Clock Control Reg, RW */ -#define XTTCPS_CNT_CNTRL_OFFSET		0x0C /* Counter Control Reg, RW */ -#define XTTCPS_COUNT_VAL_OFFSET		0x18 /* Counter Value Reg, RO */ -#define XTTCPS_INTR_VAL_OFFSET		0x24 /* Interval Count Reg, RW */ -#define XTTCPS_ISR_OFFSET		0x54 /* Interrupt Status Reg, RO */ -#define XTTCPS_IER_OFFSET		0x60 /* Interrupt Enable Reg, RW */ - -#define XTTCPS_CNT_CNTRL_DISABLE_MASK	0x1 - -/* - * Setup the timers to use pre-scaling, using a fixed value for now that will - * work across most input frequency, but it may need to be more dynamic - */ -#define PRESCALE_EXPONENT	11	/* 2 ^ PRESCALE_EXPONENT = PRESCALE */ -#define PRESCALE		2048	/* The exponent must match this */ -#define CLK_CNTRL_PRESCALE	((PRESCALE_EXPONENT - 1) << 1) -#define CLK_CNTRL_PRESCALE_EN	1 -#define CNT_CNTRL_RESET		(1<<4) - -/** - * struct xttcps_timer - This definition defines local timer structure - * - * @base_addr:	Base address of timer - **/ -struct xttcps_timer { -	void __iomem	*base_addr; -}; - -struct xttcps_timer_clocksource { -	struct xttcps_timer	xttc; -	struct clocksource	cs; -}; - -#define to_xttcps_timer_clksrc(x) \ -		container_of(x, struct xttcps_timer_clocksource, cs) - -struct xttcps_timer_clockevent { -	struct xttcps_timer		xttc; -	struct clock_event_device	ce; -	struct clk			*clk; -}; - -#define to_xttcps_timer_clkevent(x) \ -		container_of(x, struct xttcps_timer_clockevent, ce) - -/** - * xttcps_set_interval - Set the timer interval value - * - * @timer:	Pointer to the timer instance - * @cycles:	Timer interval ticks - **/ -static void xttcps_set_interval(struct xttcps_timer *timer, -					unsigned long cycles) -{ -	u32 ctrl_reg; - -	/* Disable the counter, set the counter value  and re-enable counter */ -	ctrl_reg = __raw_readl(timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET); -	ctrl_reg |= XTTCPS_CNT_CNTRL_DISABLE_MASK; -	__raw_writel(ctrl_reg, timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET); - -	__raw_writel(cycles, timer->base_addr + XTTCPS_INTR_VAL_OFFSET); - -	/* -	 * Reset the counter (0x10) so that it starts from 0, one-shot -	 * mode makes this needed for timing to be right. -	 */ -	ctrl_reg |= CNT_CNTRL_RESET; -	ctrl_reg &= ~XTTCPS_CNT_CNTRL_DISABLE_MASK; -	__raw_writel(ctrl_reg, timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET); -} - -/** - * xttcps_clock_event_interrupt - Clock event timer interrupt handler - * - * @irq:	IRQ number of the Timer - * @dev_id:	void pointer to the xttcps_timer instance - * - * returns: Always IRQ_HANDLED - success - **/ -static irqreturn_t xttcps_clock_event_interrupt(int irq, void *dev_id) -{ -	struct xttcps_timer_clockevent *xttce = dev_id; -	struct xttcps_timer *timer = &xttce->xttc; - -	/* Acknowledge the interrupt and call event handler */ -	__raw_readl(timer->base_addr + XTTCPS_ISR_OFFSET); - -	xttce->ce.event_handler(&xttce->ce); - -	return IRQ_HANDLED; -} - -/** - * __xttc_clocksource_read - Reads the timer counter register - * - * returns: Current timer counter register value - **/ -static cycle_t __xttc_clocksource_read(struct clocksource *cs) -{ -	struct xttcps_timer *timer = &to_xttcps_timer_clksrc(cs)->xttc; - -	return (cycle_t)__raw_readl(timer->base_addr + -				XTTCPS_COUNT_VAL_OFFSET); -} - -/** - * xttcps_set_next_event - Sets the time interval for next event - * - * @cycles:	Timer interval ticks - * @evt:	Address of clock event instance - * - * returns: Always 0 - success - **/ -static int xttcps_set_next_event(unsigned long cycles, -					struct clock_event_device *evt) -{ -	struct xttcps_timer_clockevent *xttce = to_xttcps_timer_clkevent(evt); -	struct xttcps_timer *timer = &xttce->xttc; - -	xttcps_set_interval(timer, cycles); -	return 0; -} - -/** - * xttcps_set_mode - Sets the mode of timer - * - * @mode:	Mode to be set - * @evt:	Address of clock event instance - **/ -static void xttcps_set_mode(enum clock_event_mode mode, -					struct clock_event_device *evt) -{ -	struct xttcps_timer_clockevent *xttce = to_xttcps_timer_clkevent(evt); -	struct xttcps_timer *timer = &xttce->xttc; -	u32 ctrl_reg; - -	switch (mode) { -	case CLOCK_EVT_MODE_PERIODIC: -		xttcps_set_interval(timer, -				     DIV_ROUND_CLOSEST(clk_get_rate(xttce->clk), -						       PRESCALE * HZ)); -		break; -	case CLOCK_EVT_MODE_ONESHOT: -	case CLOCK_EVT_MODE_UNUSED: -	case CLOCK_EVT_MODE_SHUTDOWN: -		ctrl_reg = __raw_readl(timer->base_addr + -					XTTCPS_CNT_CNTRL_OFFSET); -		ctrl_reg |= XTTCPS_CNT_CNTRL_DISABLE_MASK; -		__raw_writel(ctrl_reg, -				timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET); -		break; -	case CLOCK_EVT_MODE_RESUME: -		ctrl_reg = __raw_readl(timer->base_addr + -					XTTCPS_CNT_CNTRL_OFFSET); -		ctrl_reg &= ~XTTCPS_CNT_CNTRL_DISABLE_MASK; -		__raw_writel(ctrl_reg, -				timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET); -		break; -	} -} - -static void __init zynq_ttc_setup_clocksource(struct device_node *np, -					     void __iomem *base) -{ -	struct xttcps_timer_clocksource *ttccs; -	struct clk *clk; -	int err; -	u32 reg; - -	ttccs = kzalloc(sizeof(*ttccs), GFP_KERNEL); -	if (WARN_ON(!ttccs)) -		return; - -	err = of_property_read_u32(np, "reg", ®); -	if (WARN_ON(err)) -		return; - -	clk = of_clk_get_by_name(np, "cpu_1x"); -	if (WARN_ON(IS_ERR(clk))) -		return; - -	err = clk_prepare_enable(clk); -	if (WARN_ON(err)) -		return; - -	ttccs->xttc.base_addr = base + reg * 4; - -	ttccs->cs.name = np->name; -	ttccs->cs.rating = 200; -	ttccs->cs.read = __xttc_clocksource_read; -	ttccs->cs.mask = CLOCKSOURCE_MASK(16); -	ttccs->cs.flags = CLOCK_SOURCE_IS_CONTINUOUS; - -	__raw_writel(0x0,  ttccs->xttc.base_addr + XTTCPS_IER_OFFSET); -	__raw_writel(CLK_CNTRL_PRESCALE | CLK_CNTRL_PRESCALE_EN, -		     ttccs->xttc.base_addr + XTTCPS_CLK_CNTRL_OFFSET); -	__raw_writel(CNT_CNTRL_RESET, -		     ttccs->xttc.base_addr + XTTCPS_CNT_CNTRL_OFFSET); - -	err = clocksource_register_hz(&ttccs->cs, clk_get_rate(clk) / PRESCALE); -	if (WARN_ON(err)) -		return; -} - -static void __init zynq_ttc_setup_clockevent(struct device_node *np, -					    void __iomem *base) -{ -	struct xttcps_timer_clockevent *ttcce; -	int err, irq; -	u32 reg; - -	ttcce = kzalloc(sizeof(*ttcce), GFP_KERNEL); -	if (WARN_ON(!ttcce)) -		return; - -	err = of_property_read_u32(np, "reg", ®); -	if (WARN_ON(err)) -		return; - -	ttcce->xttc.base_addr = base + reg * 4; - -	ttcce->clk = of_clk_get_by_name(np, "cpu_1x"); -	if (WARN_ON(IS_ERR(ttcce->clk))) -		return; - -	err = clk_prepare_enable(ttcce->clk); -	if (WARN_ON(err)) -		return; - -	irq = irq_of_parse_and_map(np, 0); -	if (WARN_ON(!irq)) -		return; - -	ttcce->ce.name = np->name; -	ttcce->ce.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; -	ttcce->ce.set_next_event = xttcps_set_next_event; -	ttcce->ce.set_mode = xttcps_set_mode; -	ttcce->ce.rating = 200; -	ttcce->ce.irq = irq; -	ttcce->ce.cpumask = cpu_possible_mask; - -	__raw_writel(0x23, ttcce->xttc.base_addr + XTTCPS_CNT_CNTRL_OFFSET); -	__raw_writel(CLK_CNTRL_PRESCALE | CLK_CNTRL_PRESCALE_EN, -		     ttcce->xttc.base_addr + XTTCPS_CLK_CNTRL_OFFSET); -	__raw_writel(0x1,  ttcce->xttc.base_addr + XTTCPS_IER_OFFSET); - -	err = request_irq(irq, xttcps_clock_event_interrupt, IRQF_TIMER, -			  np->name, ttcce); -	if (WARN_ON(err)) -		return; - -	clockevents_config_and_register(&ttcce->ce, -					clk_get_rate(ttcce->clk) / PRESCALE, -					1, 0xfffe); -} - -static const __initconst struct of_device_id zynq_ttc_match[] = { -	{ .compatible = "xlnx,ttc-counter-clocksource", -		.data = zynq_ttc_setup_clocksource, }, -	{ .compatible = "xlnx,ttc-counter-clockevent", -		.data = zynq_ttc_setup_clockevent, }, -	{} -}; - -/** - * xttcps_timer_init - Initialize the timer - * - * Initializes the timer hardware and register the clock source and clock event - * timers with Linux kernal timer framework - **/ -void __init xttcps_timer_init(void) -{ -	struct device_node *np; - -	for_each_compatible_node(np, NULL, "xlnx,ttc") { -		struct device_node *np_chld; -		void __iomem *base; - -		base = of_iomap(np, 0); -		if (WARN_ON(!base)) -			return; - -		for_each_available_child_of_node(np, np_chld) { -			int (*cb)(struct device_node *np, void __iomem *base); -			const struct of_device_id *match; - -			match = of_match_node(zynq_ttc_match, np_chld); -			if (match) { -				cb = match->data; -				cb(np_chld, base); -			} -		} -	} -}  |