773-bgmac-add-srab-switch.patch 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. Register switch connected to srab
  2. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  3. --- a/drivers/net/ethernet/broadcom/bgmac.c
  4. +++ b/drivers/net/ethernet/broadcom/bgmac.c
  5. @@ -17,6 +17,7 @@
  6. #include <linux/phy_fixed.h>
  7. #include <linux/interrupt.h>
  8. #include <linux/dma-mapping.h>
  9. +#include <linux/platform_data/b53.h>
  10. #include <linux/bcm47xx_nvram.h>
  11. static const struct bcma_device_id bgmac_bcma_tbl[] = {
  12. @@ -1683,6 +1684,17 @@ static void bgmac_mii_unregister(struct
  13. mdiobus_free(mii_bus);
  14. }
  15. +static struct b53_platform_data bgmac_b53_pdata = {
  16. +};
  17. +
  18. +static struct platform_device bgmac_b53_dev = {
  19. + .name = "b53-srab-switch",
  20. + .id = -1,
  21. + .dev = {
  22. + .platform_data = &bgmac_b53_pdata,
  23. + },
  24. +};
  25. +
  26. /**************************************************
  27. * BCMA bus ops
  28. **************************************************/
  29. @@ -1828,6 +1840,14 @@ static int bgmac_probe(struct bcma_devic
  30. net_dev->hw_features = net_dev->features;
  31. net_dev->vlan_features = net_dev->features;
  32. + if (bgmac_is_bcm4707_family(bgmac) && !bgmac_b53_pdata.regs) {
  33. + bgmac_b53_pdata.regs = ioremap_nocache(0x18007000, 0x1000);
  34. +
  35. + err = platform_device_register(&bgmac_b53_dev);
  36. + if (!err)
  37. + bgmac->b53_device = &bgmac_b53_dev;
  38. + }
  39. +
  40. err = register_netdev(bgmac->net_dev);
  41. if (err) {
  42. bgmac_err(bgmac, "Cannot register net device\n");
  43. @@ -1854,6 +1874,10 @@ static void bgmac_remove(struct bcma_dev
  44. {
  45. struct bgmac *bgmac = bcma_get_drvdata(core);
  46. + if (bgmac->b53_device)
  47. + platform_device_unregister(&bgmac_b53_dev);
  48. + bgmac->b53_device = NULL;
  49. +
  50. unregister_netdev(bgmac->net_dev);
  51. bgmac_mii_unregister(bgmac);
  52. netif_napi_del(&bgmac->napi);
  53. --- a/drivers/net/ethernet/broadcom/bgmac.h
  54. +++ b/drivers/net/ethernet/broadcom/bgmac.h
  55. @@ -463,6 +463,9 @@ struct bgmac {
  56. bool has_robosw;
  57. bool loopback;
  58. +
  59. + /* platform device for associated switch */
  60. + struct platform_device *b53_device;
  61. };
  62. static inline u32 bgmac_read(struct bgmac *bgmac, u16 offset)