ath9k: fix a few crash issues on hardware reset
[openwrt.git] / package / broadcom-wl / patches / 007-use-glue-driver.patch
1 --- a/driver/wl_linux.c
2 +++ b/driver/wl_linux.c
3 @@ -85,10 +85,9 @@ typedef void wlc_hw_info_t;
4 #include <bcmjtag.h>
5 #endif /* BCMJTAG */
6
7 -
8 -#ifdef CONFIG_SSB
9 -#include <linux/ssb/ssb.h>
10 -#endif
11 +#if defined(CONFIG_SSB) || defined(CONFIG_BCMA)
12 +#include <wl_glue.h>
13 +#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */
14
15 /* Linux wireless extension support */
16 #ifdef CONFIG_WIRELESS_EXT
17 @@ -997,62 +996,32 @@ static struct pci_driver wl_pci_driver =
18 #endif /* CONFIG_PCI */
19 #endif
20
21 +#ifdef BCMJTAG
22 +static bcmjtag_driver_t wl_jtag_driver = {
23 + wl_jtag_probe,
24 + wl_jtag_detach,
25 + wl_jtag_poll,
26 + };
27 +#endif /* BCMJTAG */
28
29 -static int wl_ssb_probe(struct ssb_device *dev, const struct ssb_device_id *id)
30 +#if defined(CONFIG_SSB) || defined(CONFIG_BCMA)
31 +static void * glue_attach_cb(u16 vendor, u16 device,
32 + ulong mmio, void *dev, u32 irq)
33 {
34 - wl_info_t *wl;
35 - void *mmio;
36 -
37 - if (dev->bus->bustype != SSB_BUSTYPE_SSB) {
38 - printk("Attaching to SSB behind PCI is not supported. Please remove the b43 ssb bridge\n");
39 - return -EINVAL;
40 - }
41 -
42 - mmio = (void *) 0x18000000 + dev->core_index * 0x1000;
43 - wl = wl_attach(id->vendor, id->coreid, (ulong) mmio, SI_BUS, dev, dev->irq);
44 - if (!wl) {
45 - printk("wl_attach failed\n");
46 - return -ENODEV;
47 - }
48 -
49 - ssb_set_drvdata(dev, wl);
50 -
51 - return 0;
52 + return wl_attach(vendor, device, mmio, SI_BUS, dev, irq);
53 }
54
55 -static void wl_ssb_remove(struct ssb_device *dev)
56 +static void glue_remove_cb(void *wldev)
57 {
58 - wl_info_t *wl = (wl_info_t *) ssb_get_drvdata(dev);
59 + wl_info_t *wl = (wl_info_t *)wldev;
60
61 WL_LOCK(wl);
62 WL_APSTA_UPDN(("wl%d (%s): wl_remove() -> wl_down()\n", wl->pub->unit, wl->dev->name));
63 wl_down(wl);
64 WL_UNLOCK(wl);
65 wl_free(wl);
66 - ssb_set_drvdata(dev, NULL);
67 }
68 -
69 -static const struct ssb_device_id wl_ssb_tbl[] = {
70 - SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, SSB_ANY_REV),
71 - SSB_DEVTABLE_END
72 -};
73 -
74 -#ifdef CONFIG_SSB
75 -static struct ssb_driver wl_ssb_driver = {
76 - .name = KBUILD_MODNAME,
77 - .id_table = wl_ssb_tbl,
78 - .probe = wl_ssb_probe,
79 - .remove = wl_ssb_remove,
80 -};
81 -#endif
82 -
83 -#ifdef BCMJTAG
84 -static bcmjtag_driver_t wl_jtag_driver = {
85 - wl_jtag_probe,
86 - wl_jtag_detach,
87 - wl_jtag_poll,
88 - };
89 -#endif /* BCMJTAG */
90 +#endif/* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */
91
92
93 /**
94 @@ -1067,11 +1036,13 @@ wl_module_init(void)
95 {
96 int error = -ENODEV;
97
98 -#ifdef CONFIG_SSB
99 - error = ssb_driver_register(&wl_ssb_driver);
100 +#if defined(CONFIG_SSB) || defined(CONFIG_BCMA)
101 + wl_glue_set_attach_callback(&glue_attach_cb);
102 + wl_glue_set_remove_callback(&glue_remove_cb);
103 + error = wl_glue_register();
104 if (error)
105 return error;
106 -#endif /* CONFIG_SSB */
107 +#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */
108
109 #ifdef CONFIG_PCI
110 error = pci_register_driver(&wl_pci_driver);
111 @@ -1082,7 +1053,9 @@ wl_module_init(void)
112 return 0;
113
114 error_pci:
115 - ssb_driver_unregister(&wl_ssb_driver);
116 +#if defined(CONFIG_SSB) || defined(CONFIG_BCMA)
117 + wl_glue_unregister();
118 +#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */
119 return error;
120 }
121
122 @@ -1099,9 +1072,9 @@ wl_module_exit(void)
123 #ifdef CONFIG_PCI
124 pci_unregister_driver(&wl_pci_driver);
125 #endif /* CONFIG_PCI */
126 -#ifdef CONFIG_SSB
127 - ssb_driver_unregister(&wl_ssb_driver);
128 -#endif /* CONFIG_SSB */
129 +#if defined(CONFIG_SSB) || defined(CONFIG_BCMA)
130 + wl_glue_unregister();
131 +#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */
132 }
133
134 module_init(wl_module_init);
135 --- a/driver/linux_osl.c
136 +++ b/driver/linux_osl.c
137 @@ -25,9 +25,9 @@
138 #include <asm/paccess.h>
139 #endif /* mips */
140 #include <pcicfg.h>
141 -#ifdef CONFIG_SSB
142 -#include <linux/ssb/ssb.h>
143 -#endif
144 +#if defined(CONFIG_SSB) || defined(CONFIG_BCMA)
145 +#include <wl_glue.h>
146 +#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */
147
148 #define PCI_CFG_RETRY 10
149
150 @@ -370,15 +370,17 @@ osl_dma_consistent_align(void)
151 static struct device *
152 osl_get_dmadev(osl_t *osh)
153 {
154 -#ifdef CONFIG_SSB
155 +#if defined(CONFIG_SSB) || defined(CONFIG_BCMA)
156 if (osh->bustype == SI_BUS) {
157 - /* This can be SiliconBackplane emulated as pci with Broadcom or
158 - * ssb device. Less harmful is to check for pci_bus_type and if
159 - * no match then assume we got ssb */
160 + /* This can be SiliconBackplane emulated as pci with Broadcom,
161 + * ssb or bcma device. Less harmful is to check for pci_bus_type and if
162 + * no match then assume we got either ssb or bcma */
163 if (((struct pci_dev *)osh->pdev)->dev.bus != &pci_bus_type)
164 - return ((struct ssb_device *)osh->pdev)->dma_dev;
165 + {
166 + return wl_glue_get_dmadev(osh->pdev);
167 + }
168 }
169 -#endif
170 +#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */
171 return &((struct pci_dev *)osh->pdev)->dev;
172 }
173
174 --- a/driver/Makefile
175 +++ b/driver/Makefile
176 @@ -1,7 +1,7 @@
177 BUILD_TYPE=wl_apsta
178 include $(src)/$(BUILD_TYPE)/buildflags.mk
179
180 -EXTRA_CFLAGS += -I$(src)/include -I$(src) -DBCMDRIVER $(WLFLAGS)
181 +EXTRA_CFLAGS += -I$(src)/include -I$(src) -I$(realpath $(src)/../glue) -DBCMDRIVER $(WLFLAGS)
182
183 wl-objs := $(BUILD_TYPE)/wl_prebuilt.o wl_iw.o wl_linux.o linux_osl.o siutils.o aiutils.o hndpmu.o bcmutils.o sbutils.o nicpci.o hnddma.o bcmsrom.o nvram_stub.o
184
This page took 0.05745 seconds and 5 git commands to generate.