* [PATCH] bgmac: support up to 3 cores (devices) on a bus
@ 2015-08-26 15:53 Rafał Miłecki
2015-08-27 18:29 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Rafał Miłecki @ 2015-08-26 15:53 UTC (permalink / raw)
To: David S. Miller, netdev; +Cc: Hauke Mehrtens, Rafał Miłecki
Broadcom buses may have more than 1 Ethernet device. This is used e.g.
to have few interfaces connected to different switch ports. So far we
saw chipsets with only 2 devices (e.g. BCM4706) but recent ones have
up to 3 (e.g. Netgear R8000 uses 3rd interface for most of switch
traffic, lower interfaces are for some kind of offloading).
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
drivers/net/ethernet/broadcom/bgmac.c | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
index 21e3c38..d043746 100644
--- a/drivers/net/ethernet/broadcom/bgmac.c
+++ b/drivers/net/ethernet/broadcom/bgmac.c
@@ -1549,11 +1549,20 @@ static int bgmac_probe(struct bcma_device *core)
struct net_device *net_dev;
struct bgmac *bgmac;
struct ssb_sprom *sprom = &core->bus->sprom;
- u8 *mac = core->core_unit ? sprom->et1mac : sprom->et0mac;
+ u8 *mac;
int err;
- /* We don't support 2nd, 3rd, ... units, SPROM has to be adjusted */
- if (core->core_unit > 1) {
+ switch (core->core_unit) {
+ case 0:
+ mac = sprom->et0mac;
+ break;
+ case 1:
+ mac = sprom->et1mac;
+ break;
+ case 2:
+ mac = sprom->et2mac;
+ break;
+ default:
pr_err("Unsupported core_unit %d\n", core->core_unit);
return -ENOTSUPP;
}
@@ -1588,8 +1597,17 @@ static int bgmac_probe(struct bcma_device *core)
}
bgmac->cmn = core->bus->drv_gmac_cmn.core;
- bgmac->phyaddr = core->core_unit ? sprom->et1phyaddr :
- sprom->et0phyaddr;
+ switch (core->core_unit) {
+ case 0:
+ bgmac->phyaddr = sprom->et0phyaddr;
+ break;
+ case 1:
+ bgmac->phyaddr = sprom->et1phyaddr;
+ break;
+ case 2:
+ bgmac->phyaddr = sprom->et2phyaddr;
+ break;
+ }
bgmac->phyaddr &= BGMAC_PHY_MASK;
if (bgmac->phyaddr == BGMAC_PHY_MASK) {
bgmac_err(bgmac, "No PHY found\n");
--
1.8.4.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] bgmac: support up to 3 cores (devices) on a bus
2015-08-26 15:53 [PATCH] bgmac: support up to 3 cores (devices) on a bus Rafał Miłecki
@ 2015-08-27 18:29 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-08-27 18:29 UTC (permalink / raw)
To: zajec5; +Cc: netdev, hauke
From: Rafał Miłecki <zajec5@gmail.com>
Date: Wed, 26 Aug 2015 17:53:45 +0200
> Broadcom buses may have more than 1 Ethernet device. This is used e.g.
> to have few interfaces connected to different switch ports. So far we
> saw chipsets with only 2 devices (e.g. BCM4706) but recent ones have
> up to 3 (e.g. Netgear R8000 uses 3rd interface for most of switch
> traffic, lower interfaces are for some kind of offloading).
>
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Applied to net-next, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-08-27 18:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-26 15:53 [PATCH] bgmac: support up to 3 cores (devices) on a bus Rafał Miłecki
2015-08-27 18:29 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).