b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 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,11 @@ 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 | + wl_glue_set_attach_callback(NULL); |
| 119 | + wl_glue_set_remove_callback(NULL); |
| 120 | +#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */ |
| 121 | return error; |
| 122 | } |
| 123 | |
| 124 | @@ -1099,9 +1074,11 @@ wl_module_exit(void) |
| 125 | #ifdef CONFIG_PCI |
| 126 | pci_unregister_driver(&wl_pci_driver); |
| 127 | #endif /* CONFIG_PCI */ |
| 128 | -#ifdef CONFIG_SSB |
| 129 | - ssb_driver_unregister(&wl_ssb_driver); |
| 130 | -#endif /* CONFIG_SSB */ |
| 131 | +#if defined(CONFIG_SSB) || defined(CONFIG_BCMA) |
| 132 | + wl_glue_unregister(); |
| 133 | + wl_glue_set_attach_callback(NULL); |
| 134 | + wl_glue_set_remove_callback(NULL); |
| 135 | +#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */ |
| 136 | } |
| 137 | |
| 138 | module_init(wl_module_init); |
| 139 | --- a/driver/linux_osl.c |
| 140 | +++ b/driver/linux_osl.c |
| 141 | @@ -25,9 +25,9 @@ |
| 142 | #include <asm/paccess.h> |
| 143 | #endif /* mips */ |
| 144 | #include <pcicfg.h> |
| 145 | -#ifdef CONFIG_SSB |
| 146 | -#include <linux/ssb/ssb.h> |
| 147 | -#endif |
| 148 | +#if defined(CONFIG_SSB) || defined(CONFIG_BCMA) |
| 149 | +#include <wl_glue.h> |
| 150 | +#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */ |
| 151 | |
| 152 | #define PCI_CFG_RETRY 10 |
| 153 | |
| 154 | @@ -370,15 +370,17 @@ osl_dma_consistent_align(void) |
| 155 | static struct device * |
| 156 | osl_get_dmadev(osl_t *osh) |
| 157 | { |
| 158 | -#ifdef CONFIG_SSB |
| 159 | +#if defined(CONFIG_SSB) || defined(CONFIG_BCMA) |
| 160 | if (osh->bustype == SI_BUS) { |
| 161 | - /* This can be SiliconBackplane emulated as pci with Broadcom or |
| 162 | - * ssb device. Less harmful is to check for pci_bus_type and if |
| 163 | - * no match then assume we got ssb */ |
| 164 | + /* This can be SiliconBackplane emulated as pci with Broadcom, |
| 165 | + * ssb or bcma device. Less harmful is to check for pci_bus_type and if |
| 166 | + * no match then assume we got either ssb or bcma */ |
| 167 | if (((struct pci_dev *)osh->pdev)->dev.bus != &pci_bus_type) |
| 168 | - return ((struct ssb_device *)osh->pdev)->dma_dev; |
| 169 | + { |
| 170 | + return wl_glue_get_dmadev(osh->pdev); |
| 171 | + } |
| 172 | } |
| 173 | -#endif |
| 174 | +#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */ |
| 175 | return &((struct pci_dev *)osh->pdev)->dev; |
| 176 | } |
| 177 | |
| 178 | --- a/driver/Makefile |
| 179 | +++ b/driver/Makefile |
| 180 | @@ -1,7 +1,7 @@ |
| 181 | BUILD_TYPE=wl_apsta |
| 182 | include $(src)/$(BUILD_TYPE)/buildflags.mk |
| 183 | |
| 184 | -EXTRA_CFLAGS += -I$(src)/include -I$(src) -DBCMDRIVER $(WLFLAGS) |
| 185 | +EXTRA_CFLAGS += -I$(src)/include -I$(src) -I$(realpath $(src)/../glue) -DBCMDRIVER $(WLFLAGS) |
| 186 | |
| 187 | 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 |
| 188 | |