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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. @@ -11,6 +11,7 @@
  6. #include <linux/bcma/bcma.h>
  7. #include <linux/etherdevice.h>
  8. +#include <linux/platform_data/b53.h>
  9. #include <linux/bcm47xx_nvram.h>
  10. #include "bgmac.h"
  11. @@ -1404,6 +1405,17 @@ static const struct ethtool_ops bgmac_et
  12. .get_drvinfo = bgmac_get_drvinfo,
  13. };
  14. +static struct b53_platform_data bgmac_b53_pdata = {
  15. +};
  16. +
  17. +static struct platform_device bgmac_b53_dev = {
  18. + .name = "b53-srab-switch",
  19. + .id = -1,
  20. + .dev = {
  21. + .platform_data = &bgmac_b53_pdata,
  22. + },
  23. +};
  24. +
  25. /**************************************************
  26. * MII
  27. **************************************************/
  28. @@ -1550,6 +1562,14 @@ int bgmac_enet_probe(struct bgmac *bgmac
  29. net_dev->hw_features = net_dev->features;
  30. net_dev->vlan_features = net_dev->features;
  31. + if ((bgmac->feature_flags & BGMAC_FEAT_SRAB) && !bgmac_b53_pdata.regs) {
  32. + bgmac_b53_pdata.regs = ioremap_nocache(0x18007000, 0x1000);
  33. +
  34. + err = platform_device_register(&bgmac_b53_dev);
  35. + if (!err)
  36. + bgmac->b53_device = &bgmac_b53_dev;
  37. + }
  38. +
  39. err = register_netdev(bgmac->net_dev);
  40. if (err) {
  41. dev_err(bgmac->dev, "Cannot register net device\n");
  42. @@ -1572,6 +1592,10 @@ EXPORT_SYMBOL_GPL(bgmac_enet_probe);
  43. void bgmac_enet_remove(struct bgmac *bgmac)
  44. {
  45. + if (bgmac->b53_device)
  46. + platform_device_unregister(&bgmac_b53_dev);
  47. + bgmac->b53_device = NULL;
  48. +
  49. unregister_netdev(bgmac->net_dev);
  50. phy_disconnect(bgmac->net_dev->phydev);
  51. netif_napi_del(&bgmac->napi);
  52. --- a/drivers/net/ethernet/broadcom/bgmac.h
  53. +++ b/drivers/net/ethernet/broadcom/bgmac.h
  54. @@ -409,6 +409,7 @@
  55. #define BGMAC_FEAT_CC4_IF_SW_TYPE BIT(17)
  56. #define BGMAC_FEAT_CC4_IF_SW_TYPE_RGMII BIT(18)
  57. #define BGMAC_FEAT_CC7_IF_TYPE_RGMII BIT(19)
  58. +#define BGMAC_FEAT_SRAB BIT(20)
  59. struct bgmac_slot_info {
  60. union {
  61. @@ -513,6 +514,9 @@ struct bgmac {
  62. u32 (*get_bus_clock)(struct bgmac *bgmac);
  63. void (*cmn_maskset32)(struct bgmac *bgmac, u16 offset, u32 mask,
  64. u32 set);
  65. +
  66. + /* platform device for associated switch */
  67. + struct platform_device *b53_device;
  68. };
  69. struct bgmac *bgmac_alloc(struct device *dev);
  70. --- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
  71. +++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
  72. @@ -236,6 +236,7 @@ static int bgmac_probe(struct bcma_devic
  73. bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
  74. bgmac->feature_flags |= BGMAC_FEAT_NO_RESET;
  75. bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500;
  76. + bgmac->feature_flags |= BGMAC_FEAT_SRAB;
  77. break;
  78. case BCMA_CHIP_ID_BCM53573:
  79. bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;