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