007-use-glue-driver.patch 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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,9 @@ 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. +#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */
  108. return error;
  109. }
  110. @@ -1099,9 +1072,9 @@ wl_module_exit(void)
  111. #ifdef CONFIG_PCI
  112. pci_unregister_driver(&wl_pci_driver);
  113. #endif /* CONFIG_PCI */
  114. -#ifdef CONFIG_SSB
  115. - ssb_driver_unregister(&wl_ssb_driver);
  116. -#endif /* CONFIG_SSB */
  117. +#if defined(CONFIG_SSB) || defined(CONFIG_BCMA)
  118. + wl_glue_unregister();
  119. +#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */
  120. }
  121. module_init(wl_module_init);
  122. --- a/driver/linux_osl.c
  123. +++ b/driver/linux_osl.c
  124. @@ -25,9 +25,9 @@
  125. #include <asm/paccess.h>
  126. #endif /* mips */
  127. #include <pcicfg.h>
  128. -#ifdef CONFIG_SSB
  129. -#include <linux/ssb/ssb.h>
  130. -#endif
  131. +#if defined(CONFIG_SSB) || defined(CONFIG_BCMA)
  132. +#include <wl_glue.h>
  133. +#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */
  134. #define PCI_CFG_RETRY 10
  135. @@ -370,15 +370,17 @@ osl_dma_consistent_align(void)
  136. static struct device *
  137. osl_get_dmadev(osl_t *osh)
  138. {
  139. -#ifdef CONFIG_SSB
  140. +#if defined(CONFIG_SSB) || defined(CONFIG_BCMA)
  141. if (osh->bustype == SI_BUS) {
  142. - /* This can be SiliconBackplane emulated as pci with Broadcom or
  143. - * ssb device. Less harmful is to check for pci_bus_type and if
  144. - * no match then assume we got ssb */
  145. + /* This can be SiliconBackplane emulated as pci with Broadcom,
  146. + * ssb or bcma device. Less harmful is to check for pci_bus_type and if
  147. + * no match then assume we got either ssb or bcma */
  148. if (((struct pci_dev *)osh->pdev)->dev.bus != &pci_bus_type)
  149. - return ((struct ssb_device *)osh->pdev)->dma_dev;
  150. + {
  151. + return wl_glue_get_dmadev(osh->pdev);
  152. + }
  153. }
  154. -#endif
  155. +#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */
  156. return &((struct pci_dev *)osh->pdev)->dev;
  157. }
  158. --- a/driver/Makefile
  159. +++ b/driver/Makefile
  160. @@ -1,7 +1,7 @@
  161. BUILD_TYPE=wl_apsta
  162. include $(src)/$(BUILD_TYPE)/buildflags.mk
  163. -EXTRA_CFLAGS += -I$(src)/include -I$(src) -DBCMDRIVER $(WLFLAGS)
  164. +EXTRA_CFLAGS += -I$(src)/include -I$(src) -I$(realpath $(src)/../glue) -DBCMDRIVER $(WLFLAGS)
  165. 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