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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. @@ -1538,6 +1539,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. @@ -1664,6 +1676,16 @@ 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 ((ci->id == BCMA_CHIP_ID_BCM4707 ||
  33. + ci->id == BCMA_CHIP_ID_BCM53018) &&
  34. + !bgmac_b53_pdata.regs) {
  35. + bgmac_b53_pdata.regs = ioremap_nocache(0x18007000, 0x1000);
  36. +
  37. + err = platform_device_register(&bgmac_b53_dev);
  38. + if (!err)
  39. + bgmac->b53_device = &bgmac_b53_dev;
  40. + }
  41. +
  42. err = register_netdev(bgmac->net_dev);
  43. if (err) {
  44. bgmac_err(bgmac, "Cannot register net device\n");
  45. @@ -1690,6 +1712,10 @@ static void bgmac_remove(struct bcma_dev
  46. {
  47. struct bgmac *bgmac = bcma_get_drvdata(core);
  48. + if (bgmac->b53_device)
  49. + platform_device_unregister(&bgmac_b53_dev);
  50. + bgmac->b53_device = NULL;
  51. +
  52. unregister_netdev(bgmac->net_dev);
  53. bgmac_mii_unregister(bgmac);
  54. netif_napi_del(&bgmac->napi);
  55. --- a/drivers/net/ethernet/broadcom/bgmac.h
  56. +++ b/drivers/net/ethernet/broadcom/bgmac.h
  57. @@ -462,6 +462,9 @@ struct bgmac {
  58. bool has_robosw;
  59. bool loopback;
  60. +
  61. + /* platform device for associated switch */
  62. + struct platform_device *b53_device;
  63. };
  64. static inline u32 bgmac_read(struct bgmac *bgmac, u16 offset)