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/interrupt.h>
10 #include <linux/dma-mapping.h>
11 +#include <linux/platform_data/b53.h>
12 #include <bcm47xx_nvram.h>
14 static const struct bcma_device_id bgmac_bcma_tbl[] = {
15 @@ -1405,6 +1406,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 @@ -1521,6 +1533,16 @@ static int bgmac_probe(struct bcma_devic
37 + if (core->id.id != BCMA_CHIP_ID_BCM4707 &&
38 + core->id.id != BCMA_CHIP_ID_BCM53018 &&
39 + !bgmac_b53_pdata.regs) {
40 + bgmac_b53_pdata.regs = ioremap_nocache(0x18007000, 0x1000);
42 + err = platform_device_register(&bgmac_b53_dev);
44 + bgmac->b53_device = &bgmac_b53_dev;
47 err = register_netdev(bgmac->net_dev);
49 bgmac_err(bgmac, "Cannot register net device\n");
50 @@ -1549,6 +1571,10 @@ static void bgmac_remove(struct bcma_dev
52 struct bgmac *bgmac = bcma_get_drvdata(core);
54 + if (bgmac->b53_device)
55 + platform_device_unregister(&bgmac_b53_dev);
56 + bgmac->b53_device = NULL;
58 netif_napi_del(&bgmac->napi);
59 unregister_netdev(bgmac->net_dev);
60 bgmac_mii_unregister(bgmac);
61 --- a/drivers/net/ethernet/broadcom/bgmac.h
62 +++ b/drivers/net/ethernet/broadcom/bgmac.h
63 @@ -457,6 +457,9 @@ struct bgmac {
68 + /* platform device for associated switch */
69 + struct platform_device *b53_device;
72 static inline u32 bgmac_read(struct bgmac *bgmac, u16 offset)