Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1293407

[PATCH v2 1/8] irq: bcm2836: Fix initialization of the LOCAL_IRQ_CNT*IRQ timers

From Eric Anholt <eric@anholt.net>
Newsgroups linux.kernel
Subject [PATCH v2 1/8] irq: bcm2836: Fix initialization of the LOCAL_IRQ_CNT*IRQ timers
Date 2015-12-17 01:00 +0100
Message-ID <qGu9c-8tX-9@gated-at.bofh.it> (permalink)
References <qGu9c-8tX-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The irqchip's register area includes the the setup for the timer's
scaling factors, and for the platform we want a fixed configuration of
these registers.

Signed-off-by: Eric Anholt <eric@anholt.net>
---
 drivers/irqchip/irq-bcm2836.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/drivers/irqchip/irq-bcm2836.c b/drivers/irqchip/irq-bcm2836.c
index f687082..6ec125e 100644
--- a/drivers/irqchip/irq-bcm2836.c
+++ b/drivers/irqchip/irq-bcm2836.c
@@ -21,6 +21,9 @@
 #include <linux/irqdomain.h>
 #include <asm/exception.h>
 
+#define LOCAL_CONTROL			0x000
+#define LOCAL_PRESCALER			0x008
+
 /*
  * The low 2 bits identify the CPU that the GPU IRQ goes to, and the
  * next 2 bits identify the CPU that the GPU FIQ goes to.
@@ -237,6 +240,27 @@ bcm2836_arm_irqchip_smp_init(void)
 #endif
 }
 
+/*
+ * The LOCAL_IRQ_CNT* timer firings are based off of the external
+ * oscillator with some scaling.  The firmware sets up CNTFRQ to
+ * report 19.2Mhz, but doesn't set up the scaling registers.
+ */
+static void bcm2835_init_local_timer_frequency(void)
+{
+	/*
+	 * Set the timer to source from the 19.2Mhz crystal clock (bit
+	 * 8 unset), and only increment by 1 instead of 2 (bit 9
+	 * unset).
+	 */
+	writel(0, intc.base + LOCAL_CONTROL);
+
+	/*
+	 * Set the timer prescaler to 1:1 (timer freq = input freq *
+	 * 2**31 / prescaler)
+	 */
+	writel(0x80000000, intc.base + LOCAL_PRESCALER);
+}
+
 static int __init bcm2836_arm_irqchip_l1_intc_of_init(struct device_node *node,
 						      struct device_node *parent)
 {
@@ -246,6 +270,8 @@ static int __init bcm2836_arm_irqchip_l1_intc_of_init(struct device_node *node,
 			node->full_name);
 	}
 
+	bcm2835_init_local_timer_frequency();
+
 	intc.domain = irq_domain_add_linear(node, LAST_IRQ + 1,
 					    &bcm2836_arm_irqchip_intc_ops,
 					    NULL);
-- 
2.6.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/8] Raspberry Pi 2 support. Eric Anholt <eric@anholt.net> - 2015-12-17 01:00 +0100
  [PATCH v2 8/8] ARM: bcm2835: Add Kconfig support for bcm2836 Eric Anholt <eric@anholt.net> - 2015-12-17 01:00 +0100
    Re: [PATCH v2 8/8] ARM: bcm2835: Add Kconfig support for bcm2836 Eric Anholt <eric@anholt.net> - 2015-12-26 23:40 +0100
  [PATCH v2 5/8] ARM: bcm2835: Move the CPU/peripheral include out of common RPi DT. Eric Anholt <eric@anholt.net> - 2015-12-17 01:00 +0100
  [PATCH v2 1/8] irq: bcm2836: Fix initialization of the LOCAL_IRQ_CNT*IRQ timers Eric Anholt <eric@anholt.net> - 2015-12-17 01:00 +0100
  [PATCH v2 3/8] dt-bindings: Add root properties for Raspberry Pi 2 Eric Anholt <eric@anholt.net> - 2015-12-17 01:00 +0100
    Re: [PATCH v2 3/8] dt-bindings: Add root properties for Raspberry Pi  2 Rob Herring <robh@kernel.org> - 2015-12-19 05:20 +0100
  [PATCH v2 2/8] irq: bcm2836: Add SMP support for the 2836 Eric Anholt <eric@anholt.net> - 2015-12-17 01:00 +0100
    Re: [PATCH v2 2/8] irq: bcm2836: Add SMP support for the 2836 Baruch Siach <baruch@tkos.co.il> - 2015-12-17 06:30 +0100
  [PATCH v2 6/8] ARM: bcm2835: Add devicetree for bcm2836 and Raspberry Pi 2 B Eric Anholt <eric@anholt.net> - 2015-12-17 01:00 +0100
    Re: [PATCH v2 6/8] ARM: bcm2835: Add devicetree for bcm2836 and  Raspberry Pi 2 B Alexander Aring <alex.aring@gmail.com> - 2015-12-22 11:20 +0100
  [PATCH v2 7/8] ARM: bcm2835: Add a compat string for bcm2836 machine probe Eric Anholt <eric@anholt.net> - 2015-12-17 01:00 +0100
  Re: [PATCH v2 0/8] Raspberry Pi 2 support. Arnd Bergmann <arnd@arndb.de> - 2015-12-17 01:10 +0100
    Re: [PATCH v2 0/8] Raspberry Pi 2 support. Eric Anholt <eric@anholt.net> - 2015-12-17 01:40 +0100
      Re: [PATCH v2 0/8] Raspberry Pi 2 support. Stefan Wahren <stefan.wahren@i2se.com> - 2015-12-17 10:00 +0100
        Re: [PATCH v2 0/8] Raspberry Pi 2 support. Arnd Bergmann <arnd@arndb.de> - 2015-12-17 11:30 +0100
  Re: [PATCH v2 0/8] Raspberry Pi 2 support. Alexander Aring <alex.aring@gmail.com> - 2015-12-18 11:10 +0100
    Re: [PATCH v2 0/8] Raspberry Pi 2 support. Alexander Aring <alex.aring@gmail.com> - 2015-12-18 12:00 +0100
    Re: [PATCH v2 0/8] Raspberry Pi 2 support. Alexander Aring <alex.aring@gmail.com> - 2015-12-20 23:20 +0100
      Re: [PATCH v2 0/8] Raspberry Pi 2 support. Eric Anholt <eric@anholt.net> - 2015-12-22 00:10 +0100
        Re: [PATCH v2 0/8] Raspberry Pi 2 support. Alexander Aring <alex.aring@gmail.com> - 2015-12-22 15:30 +0100
          Re: [PATCH v2 0/8] Raspberry Pi 2 support. Eric Anholt <eric@anholt.net> - 2015-12-22 20:10 +0100
            Re: [PATCH v2 0/8] Raspberry Pi 2 support. Noralf Trønnes <noralf@tronnes.org> - 2015-12-26 22:50 +0100
      Re: [PATCH v2 0/8] Raspberry Pi 2 support. Arnd Bergmann <arnd@arndb.de> - 2015-12-22 00:20 +0100
        Re: [PATCH v2 0/8] Raspberry Pi 2 support. Alexander Aring <alex.aring@gmail.com> - 2015-12-22 15:30 +0100
          Re: [PATCH v2 0/8] Raspberry Pi 2 support. Arnd Bergmann <arnd@arndb.de> - 2015-12-22 22:30 +0100
            Re: [PATCH v2 0/8] Raspberry Pi 2 support. Eric Anholt <eric@anholt.net> - 2015-12-25 01:10 +0100

csiph-web