mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-25 08:21:14 +00:00
f5919b65d4
Patch generation process: - rebase rpi/rpi-4.14.y on v4.14.89 from linux-stable - git format-patch v4.14.89 Patches skipped during rebase: - lan78xx: Read MAC address from DT if present - lan78xx: Enable LEDs and auto-negotiation - Revert "softirq: Let ksoftirqd do its job" - sc16is7xx: Fix for multi-channel stall - lan78xx: Ignore DT MAC address if already valid - lan78xx: Simple patch to prevent some crashes - tcp_write_queue_purge clears all the SKBs in the write queue - Revert "lan78xx: Simple patch to prevent some crashes" - lan78xx: Connect phy early - Arm: mm: ftrace: Only set text back to ro after kernel has been marked ro - Revert "Revert "softirq: Let ksoftirqd do its job"" - ASoC: cs4265: SOC_SINGLE register value error fix - Revert "ASoC: cs4265: SOC_SINGLE register value error fix" - Revert "net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends" - Revert "Revert "net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends"" Patches dropped after rebase: - net: Add non-mainline source for rtl8192cu wlan - net: Fix rtl8192cu build errors on other platforms - brcm: adds support for BCM43341 wifi - brcmfmac: Mute expected startup 'errors' - ARM64: Fix build break for RTL8187/RTL8192CU wifi - ARM64: Enable RTL8187/RTL8192CU wifi in build config - This is the driver for Sony CXD2880 DVB-T2/T tuner + demodulator - brcmfmac: add CLM download support - brcmfmac: request_firmware_direct is quieter - Sets the BCDC priority to constant 0 - brcmfmac: Disable ARP offloading when promiscuous - brcmfmac: Avoid possible out-of-bounds read - brcmfmac: Delete redundant length check - net: rtl8192cu: Normalize indentation - net: rtl8192cu: Fix implicit fallthrough warnings - Revert "Sets the BCDC priority to constant 0" - media: cxd2880: Bump to match 4.18.y version - media: cxd2880-spi: Bump to match 4.18.y version - Revert "mm: alloc_contig: re-allow CMA to compact FS pages" - Revert "Revert "mm: alloc_contig: re-allow CMA to compact FS pages"" - cxd2880: CXD2880_SPI_DRV should select DVB_CXD2880 with MEDIA_SUBDRV_AUTOSELECT - 950-0421-HID-hid-bigbenff-driver-for-BigBen-Interactive-PS3OF.patch - 950-0453-Add-hid-bigbenff-to-list-of-have_special_driver-for-.patch Make I2C built-in instead of modular as in upstream defconfig; also the easiest way to get MFD_ARIZONA enabled, which is required by kmod-sound-soc-rpi-cirrus. Add missing compatible strings from 4.9/960-add-rasbperrypi-compatible.patch, using upstream names for compute modules. Add extra patch to enable the LEDs on lan78xx. Compile-tested: bcm2708, bcm2709, bcm2710 (with CONFIG_ALL_KMODS=y) Runtime-tested: bcm2708, bcm2710 Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
165 lines
4.4 KiB
Diff
165 lines
4.4 KiB
Diff
From 61f87edd9a522d70d979f679d11849d1dc20cedb Mon Sep 17 00:00:00 2001
|
|
From: Phil Elwell <phil@raspberrypi.org>
|
|
Date: Thu, 23 Mar 2017 16:34:46 +0000
|
|
Subject: [PATCH 108/454] bcm2835-aux: Add aux interrupt controller
|
|
|
|
The AUX block has a shared interrupt line with a register indicating
|
|
which devices have active IRQs. Expose this as a nested interrupt
|
|
controller to avoid sharing problems.
|
|
|
|
See: https://github.com/raspberrypi/linux/issues/1484
|
|
https://github.com/raspberrypi/linux/issues/1573
|
|
|
|
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
|
|
---
|
|
drivers/clk/bcm/clk-bcm2835-aux.c | 120 ++++++++++++++++++++++++++++++
|
|
1 file changed, 120 insertions(+)
|
|
|
|
--- a/drivers/clk/bcm/clk-bcm2835-aux.c
|
|
+++ b/drivers/clk/bcm/clk-bcm2835-aux.c
|
|
@@ -17,17 +17,107 @@
|
|
#include <linux/clk/bcm2835.h>
|
|
#include <linux/module.h>
|
|
#include <linux/platform_device.h>
|
|
+#include <linux/interrupt.h>
|
|
+#include <linux/irqdomain.h>
|
|
+#include <linux/of_irq.h>
|
|
#include <dt-bindings/clock/bcm2835-aux.h>
|
|
|
|
#define BCM2835_AUXIRQ 0x00
|
|
#define BCM2835_AUXENB 0x04
|
|
|
|
+#define BCM2835_AUXIRQ_NUM_IRQS 3
|
|
+
|
|
+#define BCM2835_AUXIRQ_UART_IRQ 0
|
|
+#define BCM2835_AUXIRQ_SPI1_IRQ 1
|
|
+#define BCM2835_AUXIRQ_SPI2_IRQ 2
|
|
+
|
|
+#define BCM2835_AUXIRQ_UART_MASK 0x01
|
|
+#define BCM2835_AUXIRQ_SPI1_MASK 0x02
|
|
+#define BCM2835_AUXIRQ_SPI2_MASK 0x04
|
|
+
|
|
+#define BCM2835_AUXIRQ_ALL_MASK \
|
|
+ (BCM2835_AUXIRQ_UART_MASK | \
|
|
+ BCM2835_AUXIRQ_SPI1_MASK | \
|
|
+ BCM2835_AUXIRQ_SPI2_MASK)
|
|
+
|
|
+struct auxirq_state {
|
|
+ void __iomem *status;
|
|
+ u32 enables;
|
|
+ struct irq_domain *domain;
|
|
+ struct regmap *local_regmap;
|
|
+};
|
|
+
|
|
+static struct auxirq_state auxirq __read_mostly;
|
|
+
|
|
+static irqreturn_t bcm2835_auxirq_handler(int irq, void *dev_id)
|
|
+{
|
|
+ u32 stat = readl_relaxed(auxirq.status);
|
|
+ u32 masked = stat & auxirq.enables;
|
|
+
|
|
+ if (masked & BCM2835_AUXIRQ_UART_MASK)
|
|
+ generic_handle_irq(irq_linear_revmap(auxirq.domain,
|
|
+ BCM2835_AUXIRQ_UART_IRQ));
|
|
+
|
|
+ if (masked & BCM2835_AUXIRQ_SPI1_MASK)
|
|
+ generic_handle_irq(irq_linear_revmap(auxirq.domain,
|
|
+ BCM2835_AUXIRQ_SPI1_IRQ));
|
|
+
|
|
+ if (masked & BCM2835_AUXIRQ_SPI2_MASK)
|
|
+ generic_handle_irq(irq_linear_revmap(auxirq.domain,
|
|
+ BCM2835_AUXIRQ_SPI2_IRQ));
|
|
+
|
|
+ return (masked & BCM2835_AUXIRQ_ALL_MASK) ? IRQ_HANDLED : IRQ_NONE;
|
|
+}
|
|
+
|
|
+static int bcm2835_auxirq_xlate(struct irq_domain *d,
|
|
+ struct device_node *ctrlr,
|
|
+ const u32 *intspec, unsigned int intsize,
|
|
+ unsigned long *out_hwirq,
|
|
+ unsigned int *out_type)
|
|
+{
|
|
+ if (WARN_ON(intsize != 1))
|
|
+ return -EINVAL;
|
|
+
|
|
+ if (WARN_ON(intspec[0] >= BCM2835_AUXIRQ_NUM_IRQS))
|
|
+ return -EINVAL;
|
|
+
|
|
+ *out_hwirq = intspec[0];
|
|
+ *out_type = IRQ_TYPE_NONE;
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+static void bcm2835_auxirq_mask(struct irq_data *data)
|
|
+{
|
|
+ irq_hw_number_t hwirq = irqd_to_hwirq(data);
|
|
+
|
|
+ auxirq.enables &= ~(1 << hwirq);
|
|
+}
|
|
+
|
|
+static void bcm2835_auxirq_unmask(struct irq_data *data)
|
|
+{
|
|
+ irq_hw_number_t hwirq = irqd_to_hwirq(data);
|
|
+
|
|
+ auxirq.enables |= (1 << hwirq);
|
|
+}
|
|
+
|
|
+static struct irq_chip bcm2835_auxirq_chip = {
|
|
+ .name = "bcm2835-auxirq",
|
|
+ .irq_mask = bcm2835_auxirq_mask,
|
|
+ .irq_unmask = bcm2835_auxirq_unmask,
|
|
+};
|
|
+
|
|
+static const struct irq_domain_ops bcm2835_auxirq_ops = {
|
|
+ .xlate = bcm2835_auxirq_xlate//irq_domain_xlate_onecell
|
|
+};
|
|
+
|
|
static int bcm2835_aux_clk_probe(struct platform_device *pdev)
|
|
{
|
|
struct device *dev = &pdev->dev;
|
|
+ struct device_node *node = dev->of_node;
|
|
struct clk_hw_onecell_data *onecell;
|
|
const char *parent;
|
|
struct clk *parent_clk;
|
|
+ int parent_irq;
|
|
struct resource *res;
|
|
void __iomem *reg, *gate;
|
|
|
|
@@ -41,6 +131,36 @@ static int bcm2835_aux_clk_probe(struct
|
|
if (IS_ERR(reg))
|
|
return PTR_ERR(reg);
|
|
|
|
+ parent_irq = irq_of_parse_and_map(node, 0);
|
|
+ if (parent_irq) {
|
|
+ int ret;
|
|
+ int i;
|
|
+
|
|
+ /* Manage the AUX irq as well */
|
|
+ auxirq.status = reg + BCM2835_AUXIRQ;
|
|
+ auxirq.domain = irq_domain_add_linear(node,
|
|
+ BCM2835_AUXIRQ_NUM_IRQS,
|
|
+ &bcm2835_auxirq_ops,
|
|
+ NULL);
|
|
+ if (!auxirq.domain)
|
|
+ return -ENXIO;
|
|
+
|
|
+ for (i = 0; i < BCM2835_AUXIRQ_NUM_IRQS; i++) {
|
|
+ unsigned int irq = irq_create_mapping(auxirq.domain, i);
|
|
+
|
|
+ if (irq == 0)
|
|
+ return -ENXIO;
|
|
+
|
|
+ irq_set_chip_and_handler(irq, &bcm2835_auxirq_chip,
|
|
+ handle_level_irq);
|
|
+ }
|
|
+
|
|
+ ret = devm_request_irq(dev, parent_irq, bcm2835_auxirq_handler,
|
|
+ 0, "bcm2835-auxirq", NULL);
|
|
+ if (ret)
|
|
+ return ret;
|
|
+ }
|
|
+
|
|
onecell = devm_kmalloc(dev, sizeof(*onecell) + sizeof(*onecell->hws) *
|
|
BCM2835_AUX_CLOCK_COUNT, GFP_KERNEL);
|
|
if (!onecell)
|