aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/broadcom-wl/patches/007-use-glue-driver.patch
blob: a30dcc4edf372fdba4644b19e635187b46ef777f (plain)
1
2
3
4
5
6
7
8
9pre { line-height: 125%; margin: 0; }
td.linenos pre { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
span.linenos { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
td.linenos pre.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight { background: #ffffff; }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/*  GRT replacements for GNAT rts.
    Copyright (C) 2002, 2003, 2004, 2005 Tristan Gingold.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    
--- 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,11 @@ wl_module_init(void)
 	return 0;
 
 error_pci:
-	ssb_driver_unregister(&wl_ssb_driver);
+#if defined(CONFIG_SSB) || defined(CONFIG_BCMA)
+	wl_glue_unregister();
+	wl_glue_set_attach_callback(NULL);
+	wl_glue_set_remove_callback(NULL);
+#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */
 	return error;
 }
 
@@ -1099,9 +1074,11 @@ 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();
+	wl_glue_set_attach_callback(NULL);
+	wl_glue_set_remove_callback(NULL);
+#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