1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-12-27 06:54:15 +02:00
openwrt-xburst/package/broadcom-wl/patches/007-use-glue-driver.patch

185 lines
5.0 KiB
Diff
Raw Normal View History

--- a/driver/wl_linux.c
+++ b/driver/wl_linux.c
@@ -85,10 +85,9 @@ typedef void wlc_hw_info_t;
#include <bcmjtag.h>
#endif /* BCMJTAG */
-
-#ifdef CONFIG_SSB
-#include <linux/ssb/ssb.h>
-#endif
+#if defined(CONFIG_SSB) || defined(CONFIG_BCMA)
+#include <wl_glue.h>
+#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */
/* Linux wireless extension support */
#ifdef CONFIG_WIRELESS_EXT
@@ -997,62 +996,32 @@ static struct pci_driver wl_pci_driver =
#endif /* CONFIG_PCI */
#endif
+#ifdef BCMJTAG
+static bcmjtag_driver_t wl_jtag_driver = {
+ wl_jtag_probe,
+ wl_jtag_detach,
+ wl_jtag_poll,
+ };
+#endif /* BCMJTAG */
-static int wl_ssb_probe(struct ssb_device *dev, const struct ssb_device_id *id)
+#if defined(CONFIG_SSB) || defined(CONFIG_BCMA)
+static void * glue_attach_cb(u16 vendor, u16 device,
+ ulong mmio, void *dev, u32 irq)
{
- wl_info_t *wl;
- void *mmio;
-
- if (dev->bus->bustype != SSB_BUSTYPE_SSB) {
- printk("Attaching to SSB behind PCI is not supported. Please remove the b43 ssb bridge\n");
- return -EINVAL;
- }
-
- mmio = (void *) 0x18000000 + dev->core_index * 0x1000;
- wl = wl_attach(id->vendor, id->coreid, (ulong) mmio, SI_BUS, dev, dev->irq);
- if (!wl) {
- printk("wl_attach failed\n");
- return -ENODEV;
- }
-
- ssb_set_drvdata(dev, wl);
-
- return 0;
+ return wl_attach(vendor, device, mmio, SI_BUS, dev, irq);
}
-static void wl_ssb_remove(struct ssb_device *dev)
+static void glue_remove_cb(void *wldev)
{
- wl_info_t *wl = (wl_info_t *) ssb_get_drvdata(dev);
+ wl_info_t *wl = (wl_info_t *)wldev;
WL_LOCK(wl);
WL_APSTA_UPDN(("wl%d (%s): wl_remove() -> wl_down()\n", wl->pub->unit, wl->dev->name));
wl_down(wl);
WL_UNLOCK(wl);
wl_free(wl);
- ssb_set_drvdata(dev, NULL);
}
-
-static const struct ssb_device_id wl_ssb_tbl[] = {
- SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, SSB_ANY_REV),
- SSB_DEVTABLE_END
-};
-
-#ifdef CONFIG_SSB
-static struct ssb_driver wl_ssb_driver = {
- .name = KBUILD_MODNAME,
- .id_table = wl_ssb_tbl,
- .probe = wl_ssb_probe,
- .remove = wl_ssb_remove,
-};
-#endif
-
-#ifdef BCMJTAG
-static bcmjtag_driver_t wl_jtag_driver = {
- wl_jtag_probe,
- wl_jtag_detach,
- wl_jtag_poll,
- };
-#endif /* BCMJTAG */
+#endif/* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */
/**
@@ -1067,11 +1036,13 @@ wl_module_init(void)
{
int error = -ENODEV;
-#ifdef CONFIG_SSB
- error = ssb_driver_register(&wl_ssb_driver);
+#if defined(CONFIG_SSB) || defined(CONFIG_BCMA)
+ wl_glue_set_attach_callback(&glue_attach_cb);
+ wl_glue_set_remove_callback(&glue_remove_cb);
+ error = wl_glue_register();
if (error)
return error;
-#endif /* CONFIG_SSB */
+#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */
#ifdef CONFIG_PCI
error = pci_register_driver(&wl_pci_driver);
@@ -1082,7 +1053,9 @@ wl_module_init(void)
return 0;
error_pci:
- ssb_driver_unregister(&wl_ssb_driver);
+#if defined(CONFIG_SSB) || defined(CONFIG_BCMA)
+ wl_glue_unregister();
+#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */
return error;
}
@@ -1099,9 +1072,9 @@ wl_module_exit(void)
#ifdef CONFIG_PCI
pci_unregister_driver(&wl_pci_driver);
#endif /* CONFIG_PCI */
-#ifdef CONFIG_SSB
- ssb_driver_unregister(&wl_ssb_driver);
-#endif /* CONFIG_SSB */
+#if defined(CONFIG_SSB) || defined(CONFIG_BCMA)
+ wl_glue_unregister();
+#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */
}
module_init(wl_module_init);
--- a/driver/linux_osl.c
+++ b/driver/linux_osl.c
@@ -25,9 +25,9 @@
#include <asm/paccess.h>
#endif /* mips */
#include <pcicfg.h>
-#ifdef CONFIG_SSB
-#include <linux/ssb/ssb.h>
-#endif
+#if defined(CONFIG_SSB) || defined(CONFIG_BCMA)
+#include <wl_glue.h>
+#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */
#define PCI_CFG_RETRY 10
@@ -370,15 +370,17 @@ osl_dma_consistent_align(void)
static struct device *
osl_get_dmadev(osl_t *osh)
{
-#ifdef CONFIG_SSB
+#if defined(CONFIG_SSB) || defined(CONFIG_BCMA)
if (osh->bustype == SI_BUS) {
- /* This can be SiliconBackplane emulated as pci with Broadcom or
- * ssb device. Less harmful is to check for pci_bus_type and if
- * no match then assume we got ssb */
+ /* This can be SiliconBackplane emulated as pci with Broadcom,
+ * ssb or bcma device. Less harmful is to check for pci_bus_type and if
+ * no match then assume we got either ssb or bcma */
if (((struct pci_dev *)osh->pdev)->dev.bus != &pci_bus_type)
- return ((struct ssb_device *)osh->pdev)->dma_dev;
+ {
+ return wl_glue_get_dmadev(osh->pdev);
+ }
}
-#endif
+#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */
return &((struct pci_dev *)osh->pdev)->dev;
}
--- a/driver/Makefile
+++ b/driver/Makefile
@@ -1,7 +1,7 @@
BUILD_TYPE=wl_apsta
include $(src)/$(BUILD_TYPE)/buildflags.mk
-EXTRA_CFLAGS += -I$(src)/include -I$(src) -DBCMDRIVER $(WLFLAGS)
+EXTRA_CFLAGS += -I$(src)/include -I$(src) -I$(realpath $(src)/../glue) -DBCMDRIVER $(WLFLAGS)
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