brcm47xx: add kernel 4.14 support
[openwrt/openwrt.git] / target / linux / brcm47xx / patches-4.14 / 940-bcm47xx-yenta.patch
diff --git a/target/linux/brcm47xx/patches-4.14/940-bcm47xx-yenta.patch b/target/linux/brcm47xx/patches-4.14/940-bcm47xx-yenta.patch
new file mode 100644 (file)
index 0000000..00a44d6
--- /dev/null
@@ -0,0 +1,46 @@
+--- a/drivers/pcmcia/yenta_socket.c
++++ b/drivers/pcmcia/yenta_socket.c
+@@ -919,6 +919,8 @@ static unsigned int yenta_probe_irq(stru
+        * Probe for usable interrupts using the force
+        * register to generate bogus card status events.
+        */
++#ifndef CONFIG_BCM47XX
++      /* WRT54G3G does not like this */
+       cb_writel(socket, CB_SOCKET_EVENT, -1);
+       cb_writel(socket, CB_SOCKET_MASK, CB_CSTSMASK);
+       reg = exca_readb(socket, I365_CSCINT);
+@@ -934,6 +936,7 @@ static unsigned int yenta_probe_irq(stru
+       }
+       cb_writel(socket, CB_SOCKET_MASK, 0);
+       exca_writeb(socket, I365_CSCINT, reg);
++#endif
+       mask = probe_irq_mask(val) & 0xffff;
+@@ -1018,6 +1021,10 @@ static void yenta_get_socket_capabilitie
+       else
+               socket->socket.irq_mask = 0;
++      /* irq mask probing is broken for the WRT54G3G */
++      if (socket->socket.irq_mask == 0)
++              socket->socket.irq_mask = 0x6f8;
++
+       dev_info(&socket->dev->dev, "ISA IRQ mask 0x%04x, PCI irq %d\n",
+                socket->socket.irq_mask, socket->cb_irq);
+ }
+@@ -1250,6 +1257,15 @@ static int yenta_probe(struct pci_dev *d
+       dev_info(&dev->dev, "Socket status: %08x\n",
+                cb_readl(socket, CB_SOCKET_STATE));
++      /* Generate an interrupt on card insert/remove */
++      config_writew(socket, CB_SOCKET_MASK, CB_CSTSMASK | CB_CDMASK);
++
++      /* Set up Multifunction Routing Status Register */
++      config_writew(socket, 0x8C, 0x1000 /* MFUNC3 to GPIO3 */ | 0x2 /* MFUNC0 to INTA */);
++
++      /* Switch interrupts to parallelized */
++      config_writeb(socket, 0x92, 0x64);
++
+       yenta_fixup_parent_bridge(dev->subordinate);
+       /* Register it with the pcmcia layer.. */