1 Register switch connected to srab
3 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
5 --- a/drivers/net/ethernet/broadcom/bgmac.c
6 +++ b/drivers/net/ethernet/broadcom/bgmac.c
9 #include <linux/bcma/bcma.h>
10 #include <linux/etherdevice.h>
11 +#include <linux/platform_data/b53.h>
12 #include <linux/bcm47xx_nvram.h>
15 @@ -1387,6 +1388,17 @@ static const struct ethtool_ops bgmac_et
16 .set_link_ksettings = phy_ethtool_set_link_ksettings,
19 +static struct b53_platform_data bgmac_b53_pdata = {
22 +static struct platform_device bgmac_b53_dev = {
23 + .name = "b53-srab-switch",
26 + .platform_data = &bgmac_b53_pdata,
30 /**************************************************
32 **************************************************/
33 @@ -1533,6 +1545,14 @@ int bgmac_enet_probe(struct bgmac *bgmac
34 net_dev->hw_features = net_dev->features;
35 net_dev->vlan_features = net_dev->features;
37 + if ((bgmac->feature_flags & BGMAC_FEAT_SRAB) && !bgmac_b53_pdata.regs) {
38 + bgmac_b53_pdata.regs = ioremap_nocache(0x18007000, 0x1000);
40 + err = platform_device_register(&bgmac_b53_dev);
42 + bgmac->b53_device = &bgmac_b53_dev;
45 err = register_netdev(bgmac->net_dev);
47 dev_err(bgmac->dev, "Cannot register net device\n");
48 @@ -1555,6 +1575,10 @@ EXPORT_SYMBOL_GPL(bgmac_enet_probe);
50 void bgmac_enet_remove(struct bgmac *bgmac)
52 + if (bgmac->b53_device)
53 + platform_device_unregister(&bgmac_b53_dev);
54 + bgmac->b53_device = NULL;
56 unregister_netdev(bgmac->net_dev);
57 phy_disconnect(bgmac->net_dev->phydev);
58 netif_napi_del(&bgmac->napi);
59 --- a/drivers/net/ethernet/broadcom/bgmac.h
60 +++ b/drivers/net/ethernet/broadcom/bgmac.h
62 #define BGMAC_FEAT_CC4_IF_SW_TYPE BIT(17)
63 #define BGMAC_FEAT_CC4_IF_SW_TYPE_RGMII BIT(18)
64 #define BGMAC_FEAT_CC7_IF_TYPE_RGMII BIT(19)
65 +#define BGMAC_FEAT_SRAB BIT(20)
67 struct bgmac_slot_info {
69 @@ -513,6 +514,9 @@ struct bgmac {
70 u32 (*get_bus_clock)(struct bgmac *bgmac);
71 void (*cmn_maskset32)(struct bgmac *bgmac, u16 offset, u32 mask,
74 + /* platform device for associated switch */
75 + struct platform_device *b53_device;
78 struct bgmac *bgmac_alloc(struct device *dev);
79 --- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
80 +++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
81 @@ -230,6 +230,7 @@ static int bgmac_probe(struct bcma_devic
82 bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
83 bgmac->feature_flags |= BGMAC_FEAT_NO_RESET;
84 bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500;
85 + bgmac->feature_flags |= BGMAC_FEAT_SRAB;
87 case BCMA_CHIP_ID_BCM53573:
88 bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;