2
0

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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. From 3cb240533ab787899dc7f17aa7d6c5b4810e2e58 Mon Sep 17 00:00:00 2001
  2. From: Hauke Mehrtens <[email protected]>
  3. Date: Fri, 7 Jul 2017 17:26:01 +0200
  4. Subject: bcm53xx: bgmac: use srab switch driver
  5. use the srab switch driver on these SoCs.
  6. Signed-off-by: Hauke Mehrtens <[email protected]>
  7. ---
  8. drivers/net/ethernet/broadcom/bgmac-bcma.c | 1 +
  9. drivers/net/ethernet/broadcom/bgmac.c | 24 ++++++++++++++++++++++++
  10. drivers/net/ethernet/broadcom/bgmac.h | 4 ++++
  11. 3 files changed, 29 insertions(+)
  12. --- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
  13. +++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
  14. @@ -280,6 +280,7 @@ static int bgmac_probe(struct bcma_devic
  15. bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
  16. bgmac->feature_flags |= BGMAC_FEAT_NO_RESET;
  17. bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500;
  18. + bgmac->feature_flags |= BGMAC_FEAT_SRAB;
  19. break;
  20. default:
  21. bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
  22. --- a/drivers/net/ethernet/broadcom/bgmac.c
  23. +++ b/drivers/net/ethernet/broadcom/bgmac.c
  24. @@ -12,6 +12,7 @@
  25. #include <linux/bcma/bcma.h>
  26. #include <linux/etherdevice.h>
  27. #include <linux/interrupt.h>
  28. +#include <linux/platform_data/b53.h>
  29. #include <linux/bcm47xx_nvram.h>
  30. #include <linux/phy.h>
  31. #include <linux/phy_fixed.h>
  32. @@ -1408,6 +1409,17 @@ static const struct ethtool_ops bgmac_et
  33. .set_link_ksettings = phy_ethtool_set_link_ksettings,
  34. };
  35. +static struct b53_platform_data bgmac_b53_pdata = {
  36. +};
  37. +
  38. +static struct platform_device bgmac_b53_dev = {
  39. + .name = "b53-srab-switch",
  40. + .id = -1,
  41. + .dev = {
  42. + .platform_data = &bgmac_b53_pdata,
  43. + },
  44. +};
  45. +
  46. /**************************************************
  47. * MII
  48. **************************************************/
  49. @@ -1546,6 +1558,14 @@ int bgmac_enet_probe(struct bgmac *bgmac
  50. bgmac->in_init = false;
  51. + if ((bgmac->feature_flags & BGMAC_FEAT_SRAB) && !bgmac_b53_pdata.regs) {
  52. + bgmac_b53_pdata.regs = ioremap(0x18007000, 0x1000);
  53. +
  54. + err = platform_device_register(&bgmac_b53_dev);
  55. + if (!err)
  56. + bgmac->b53_device = &bgmac_b53_dev;
  57. + }
  58. +
  59. err = register_netdev(bgmac->net_dev);
  60. if (err) {
  61. dev_err(bgmac->dev, "Cannot register net device\n");
  62. @@ -1568,6 +1588,10 @@ EXPORT_SYMBOL_GPL(bgmac_enet_probe);
  63. void bgmac_enet_remove(struct bgmac *bgmac)
  64. {
  65. + if (bgmac->b53_device)
  66. + platform_device_unregister(&bgmac_b53_dev);
  67. + bgmac->b53_device = NULL;
  68. +
  69. unregister_netdev(bgmac->net_dev);
  70. phy_disconnect(bgmac->net_dev->phydev);
  71. netif_napi_del(&bgmac->napi);
  72. --- a/drivers/net/ethernet/broadcom/bgmac.h
  73. +++ b/drivers/net/ethernet/broadcom/bgmac.h
  74. @@ -390,6 +390,7 @@
  75. #define BGMAC_FEAT_CC4_IF_SW_TYPE_RGMII BIT(18)
  76. #define BGMAC_FEAT_CC7_IF_TYPE_RGMII BIT(19)
  77. #define BGMAC_FEAT_IDM_MASK BIT(20)
  78. +#define BGMAC_FEAT_SRAB BIT(21)
  79. struct bgmac_slot_info {
  80. union {
  81. @@ -497,6 +498,9 @@ struct bgmac {
  82. void (*cmn_maskset32)(struct bgmac *bgmac, u16 offset, u32 mask,
  83. u32 set);
  84. int (*phy_connect)(struct bgmac *bgmac);
  85. +
  86. + /* platform device for associated switch */
  87. + struct platform_device *b53_device;
  88. };
  89. struct bgmac *bgmac_alloc(struct device *dev);