--- zzzz-none-000/linux-5.4.213/drivers/net/ethernet/broadcom/bgmac.c 2022-09-15 10:04:56.000000000 +0000 +++ alder-5690pro-762/linux-5.4.213/drivers/net/ethernet/broadcom/bgmac.c 2024-08-14 09:02:07.000000000 +0000 @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -1407,6 +1408,17 @@ .set_link_ksettings = phy_ethtool_set_link_ksettings, }; +static struct b53_platform_data bgmac_b53_pdata = { +}; + +static struct platform_device bgmac_b53_dev = { + .name = "b53-srab-switch", + .id = -1, + .dev = { + .platform_data = &bgmac_b53_pdata, + }, +}; + /************************************************** * MII **************************************************/ @@ -1538,6 +1550,14 @@ net_dev->hw_features = net_dev->features; net_dev->vlan_features = net_dev->features; + if ((bgmac->feature_flags & BGMAC_FEAT_SRAB) && !bgmac_b53_pdata.regs) { + bgmac_b53_pdata.regs = ioremap_nocache(0x18007000, 0x1000); + + err = platform_device_register(&bgmac_b53_dev); + if (!err) + bgmac->b53_device = &bgmac_b53_dev; + } + err = register_netdev(bgmac->net_dev); if (err) { dev_err(bgmac->dev, "Cannot register net device\n"); @@ -1560,6 +1580,10 @@ void bgmac_enet_remove(struct bgmac *bgmac) { + if (bgmac->b53_device) + platform_device_unregister(&bgmac_b53_dev); + bgmac->b53_device = NULL; + unregister_netdev(bgmac->net_dev); phy_disconnect(bgmac->net_dev->phydev); netif_napi_del(&bgmac->napi);