007-use-glue-driver.patch 5.2 KB

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