From 8ecfa0e773f3aec21ab793e4f5588a2c4347ebb9 Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@openwrt.org>
Date: Mon, 18 Jan 2016 22:38:03 +0000
Subject: [PATCH] cns3xxx: fix adding twd local timers

Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 48331
---
 target/linux/cns3xxx/patches-3.18/025-smp_support.patch   | 2 +-
 target/linux/cns3xxx/patches-3.18/040-fiq_support.patch   | 2 +-
 target/linux/cns3xxx/patches-3.18/045-twd_base.patch      | 6 ++----
 target/linux/cns3xxx/patches-3.18/090-timers.patch        | 8 ++++----
 target/linux/cns3xxx/patches-3.18/095-gpio_support.patch  | 2 +-
 .../cns3xxx/patches-3.18/097-l2x0_cmdline_disable.patch   | 4 ++--
 6 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/target/linux/cns3xxx/patches-3.18/025-smp_support.patch b/target/linux/cns3xxx/patches-3.18/025-smp_support.patch
index 418c065a97..2a9d997a50 100644
--- a/target/linux/cns3xxx/patches-3.18/025-smp_support.patch
+++ b/target/linux/cns3xxx/patches-3.18/025-smp_support.patch
@@ -13,7 +13,7 @@
  	select ARM_GIC
  	select PCI_DOMAINS if PCI
 +	select HAVE_ARM_SCU if SMP
-+	select HAVE_ARM_TWD if LOCAL_TIMERS
++	select HAVE_ARM_TWD
 +	select HAVE_SMP
  	help
  	  Support for Cavium Networks CNS3XXX platform.
diff --git a/target/linux/cns3xxx/patches-3.18/040-fiq_support.patch b/target/linux/cns3xxx/patches-3.18/040-fiq_support.patch
index 4f09a36f14..16774a6a3e 100644
--- a/target/linux/cns3xxx/patches-3.18/040-fiq_support.patch
+++ b/target/linux/cns3xxx/patches-3.18/040-fiq_support.patch
@@ -2,7 +2,7 @@
 +++ b/arch/arm/mach-cns3xxx/Kconfig
 @@ -5,6 +5,7 @@ menuconfig ARCH_CNS3XXX
  	select HAVE_ARM_SCU if SMP
- 	select HAVE_ARM_TWD if LOCAL_TIMERS
+ 	select HAVE_ARM_TWD
  	select HAVE_SMP
 +	select FIQ
  	help
diff --git a/target/linux/cns3xxx/patches-3.18/045-twd_base.patch b/target/linux/cns3xxx/patches-3.18/045-twd_base.patch
index f61b8ed3b4..a265f9ca8b 100644
--- a/target/linux/cns3xxx/patches-3.18/045-twd_base.patch
+++ b/target/linux/cns3xxx/patches-3.18/045-twd_base.patch
@@ -17,25 +17,23 @@
  static struct map_desc cns3xxx_io_desc[] __initdata = {
  	{
  		.virtual	= CNS3XXX_TC11MP_SCU_BASE_VIRT,
-@@ -191,6 +194,17 @@ static struct irqaction cns3xxx_timer_ir
+@@ -191,6 +194,15 @@ static struct irqaction cns3xxx_timer_ir
  	.handler	= cns3xxx_timer_interrupt,
  };
  
 +static void __init cns3xxx_init_twd(void)
 +{
-+#ifdef CONFIG_LOCAL_TIMERS
 +	static DEFINE_TWD_LOCAL_TIMER(cns3xx_twd_local_timer,
 +		CNS3XXX_TC11MP_TWD_BASE,
 +		IRQ_LOCALTIMER);
 +
 +	twd_local_timer_register(&cns3xx_twd_local_timer);
-+#endif
 +}
 +
  /*
   * Set up the clock source and clock events devices
   */
-@@ -244,6 +258,7 @@ static void __init __cns3xxx_timer_init(
+@@ -244,6 +256,7 @@ static void __init __cns3xxx_timer_init(
  	setup_irq(timer_irq, &cns3xxx_timer_irq);
  
  	cns3xxx_clockevents_init(timer_irq);
diff --git a/target/linux/cns3xxx/patches-3.18/090-timers.patch b/target/linux/cns3xxx/patches-3.18/090-timers.patch
index a884021384..0bf686d22f 100644
--- a/target/linux/cns3xxx/patches-3.18/090-timers.patch
+++ b/target/linux/cns3xxx/patches-3.18/090-timers.patch
@@ -24,8 +24,8 @@
  	.cpumask	= cpu_all_mask,
  };
  
-@@ -215,6 +216,35 @@ static void __init cns3xxx_init_twd(void
- #endif
+@@ -213,6 +214,35 @@ static void __init cns3xxx_init_twd(void
+ 	twd_local_timer_register(&cns3xx_twd_local_timer);
  }
  
 +static cycle_t cns3xxx_get_cycles(struct clocksource *cs)
@@ -60,7 +60,7 @@
  /*
   * Set up the clock source and clock events devices
   */
-@@ -232,13 +262,12 @@ static void __init __cns3xxx_timer_init(
+@@ -230,13 +260,12 @@ static void __init __cns3xxx_timer_init(
  	/* stop free running timer3 */
  	writel(0, cns3xxx_tmr1 + TIMER_FREERUN_CONTROL_OFFSET);
  
@@ -77,7 +77,7 @@
  	/* mask irq, non-mask timer1 overflow */
  	irq_mask = readl(cns3xxx_tmr1 + TIMER1_2_INTERRUPT_MASK_OFFSET);
  	irq_mask &= ~(1 << 2);
-@@ -250,23 +279,9 @@ static void __init __cns3xxx_timer_init(
+@@ -248,23 +277,9 @@ static void __init __cns3xxx_timer_init(
  	val |= (1 << 9);
  	writel(val, cns3xxx_tmr1 + TIMER1_2_CONTROL_OFFSET);
  
diff --git a/target/linux/cns3xxx/patches-3.18/095-gpio_support.patch b/target/linux/cns3xxx/patches-3.18/095-gpio_support.patch
index a6ce177493..79a937a606 100644
--- a/target/linux/cns3xxx/patches-3.18/095-gpio_support.patch
+++ b/target/linux/cns3xxx/patches-3.18/095-gpio_support.patch
@@ -21,7 +21,7 @@
 +	select GENERIC_IRQ_CHIP
  	select PCI_DOMAINS if PCI
  	select HAVE_ARM_SCU if SMP
- 	select HAVE_ARM_TWD if LOCAL_TIMERS
+ 	select HAVE_ARM_TWD
 --- a/arch/arm/mach-cns3xxx/Makefile
 +++ b/arch/arm/mach-cns3xxx/Makefile
 @@ -1,7 +1,7 @@
diff --git a/target/linux/cns3xxx/patches-3.18/097-l2x0_cmdline_disable.patch b/target/linux/cns3xxx/patches-3.18/097-l2x0_cmdline_disable.patch
index f575348cba..da49e20604 100644
--- a/target/linux/cns3xxx/patches-3.18/097-l2x0_cmdline_disable.patch
+++ b/target/linux/cns3xxx/patches-3.18/097-l2x0_cmdline_disable.patch
@@ -1,6 +1,6 @@
 --- a/arch/arm/mach-cns3xxx/core.c
 +++ b/arch/arm/mach-cns3xxx/core.c
-@@ -305,13 +305,26 @@ void __init cns3xxx_timer_init(void)
+@@ -303,13 +303,26 @@ void __init cns3xxx_timer_init(void)
  
  #ifdef CONFIG_CACHE_L2X0
  
@@ -30,7 +30,7 @@
  
  	/*
  	 * Tag RAM Control register
-@@ -341,7 +354,10 @@ void __init cns3xxx_l2x0_init(void)
+@@ -339,7 +352,10 @@ void __init cns3xxx_l2x0_init(void)
  
  	/* 32 KiB, 8-way, parity disable */
  	l2x0_init(base, 0x00500000, 0xfe0f0fff);
-- 
2.30.2