Root/target/linux/brcm-2.4/patches/009-wrt54g3g_pcmcia.patch

1--- a/drivers/pcmcia/yenta.c
2+++ b/drivers/pcmcia/yenta.c
3@@ -543,6 +543,9 @@ static unsigned int yenta_probe_irq(pci_
4      * Probe for usable interrupts using the force
5      * register to generate bogus card status events.
6      */
7+
8+#ifndef CONFIG_BCM947XX
9+ /* WRT54G3G does not like this */
10     cb_writel(socket, CB_SOCKET_EVENT, -1);
11     cb_writel(socket, CB_SOCKET_MASK, CB_CSTSMASK);
12     exca_writeb(socket, I365_CSCINT, 0);
13@@ -557,7 +560,8 @@ static unsigned int yenta_probe_irq(pci_
14     }
15     cb_writel(socket, CB_SOCKET_MASK, 0);
16     exca_writeb(socket, I365_CSCINT, 0);
17-
18+#endif
19+
20     mask = probe_irq_mask(val) & 0xffff;
21 
22     bridge_ctrl &= ~CB_BRIDGE_INTR;
23@@ -578,6 +582,12 @@ static void yenta_get_socket_capabilitie
24     socket->cap.cb_dev = socket->dev;
25     socket->cap.bus = NULL;
26 
27+#ifdef CONFIG_BCM947XX
28+ /* irq mask probing is broken for the WRT54G3G */
29+ if (socket->cap.irq_mask == 0)
30+ socket->cap.irq_mask = 0x6f8;
31+#endif
32+
33     printk(KERN_INFO "Yenta ISA IRQ mask 0x%04x, PCI irq %d\n",
34            socket->cap.irq_mask, socket->cb_irq);
35 }
36@@ -609,6 +619,15 @@ static void yenta_open_bh(void * data)
37     printk(KERN_INFO "Socket status: %08x\n",
38            cb_readl(socket, CB_SOCKET_STATE));
39 
40+ /* Generate an interrupt on card insert/remove */
41+ config_writew(socket, CB_SOCKET_MASK, CB_CSTSMASK | CB_CDMASK);
42+
43+ /* Set up Multifunction Routing Status Register */
44+ config_writew(socket, 0x8C, 0x1000 /* MFUNC3 to GPIO3 */ | 0x2 /* MFUNC0 to INTA */);
45+
46+ /* Switch interrupts to parallelized */
47+ config_writeb(socket, 0x92, 0x64);
48+
49     /* Register it with the pcmcia layer.. */
50     cardbus_register(socket);
51 
52@@ -731,7 +750,7 @@ static void yenta_allocate_res(pci_socke
53 {
54     struct pci_bus *bus;
55     struct resource *root, *res;
56- u32 start, end;
57+ u32 start = 0, end = 0;
58     u32 align, size, min, max;
59     unsigned offset;
60     unsigned mask;
61@@ -750,6 +769,15 @@ static void yenta_allocate_res(pci_socke
62     res->end = 0;
63     root = pci_find_parent_resource(socket->dev, res);
64 
65+#ifdef CONFIG_BCM947XX
66+ /* default mem resources are completely fscked up on the wrt54g3g */
67+ /* bypass the entire resource allocation stuff below and just set it statically */
68+ if (type & IORESOURCE_MEM) {
69+ res->start = 0x40004000;
70+ res->end = res->start + 0x3fff;
71+ }
72+
73+#else
74     if (!root)
75         return;
76 
77@@ -794,6 +822,7 @@ static void yenta_allocate_res(pci_socke
78         res->start = res->end = 0;
79         return;
80     }
81+#endif
82 
83     config_writel(socket, offset, res->start);
84     config_writel(socket, offset+4, res->end);
85

Archive Download this file



interactive