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
8 #include <linux/phy_fixed.h>
9 #include <linux/interrupt.h>
10 #include <linux/dma-mapping.h>
11 +#include <linux/platform_data/b53.h>
12 #include <linux/bcm47xx_nvram.h>
14 static const struct bcma_device_id bgmac_bcma_tbl[] = {
15 @@ -1545,6 +1546,17 @@ static void bgmac_mii_unregister(struct
16 mdiobus_free(mii_bus);
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 @@ -1687,6 +1699,14 @@ static int bgmac_probe(struct bcma_devic
34 net_dev->hw_features = net_dev->features;
35 net_dev->vlan_features = net_dev->features;
37 + if (bgmac_is_bcm4707_family(bgmac) && !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 bgmac_err(bgmac, "Cannot register net device\n");
48 @@ -1713,6 +1733,10 @@ static void bgmac_remove(struct bcma_dev
50 struct bgmac *bgmac = bcma_get_drvdata(core);
52 + if (bgmac->b53_device)
53 + platform_device_unregister(&bgmac_b53_dev);
54 + bgmac->b53_device = NULL;
56 unregister_netdev(bgmac->net_dev);
57 bgmac_mii_unregister(bgmac);
58 netif_napi_del(&bgmac->napi);
59 --- a/drivers/net/ethernet/broadcom/bgmac.h
60 +++ b/drivers/net/ethernet/broadcom/bgmac.h
61 @@ -463,6 +463,9 @@ struct bgmac {
66 + /* platform device for associated switch */
67 + struct platform_device *b53_device;
70 static inline u32 bgmac_read(struct bgmac *bgmac, u16 offset)