mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-29 23:53:32 +00:00
bgmac: support up to 3 cores (devices) on a bus
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> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
395250e483
commit
538e456319
1 changed files with 23 additions and 5 deletions
|
@ -1549,11 +1549,20 @@ static int bgmac_probe(struct bcma_device *core)
|
||||||
struct net_device *net_dev;
|
struct net_device *net_dev;
|
||||||
struct bgmac *bgmac;
|
struct bgmac *bgmac;
|
||||||
struct ssb_sprom *sprom = &core->bus->sprom;
|
struct ssb_sprom *sprom = &core->bus->sprom;
|
||||||
u8 *mac = core->core_unit ? sprom->et1mac : sprom->et0mac;
|
u8 *mac;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
/* We don't support 2nd, 3rd, ... units, SPROM has to be adjusted */
|
switch (core->core_unit) {
|
||||||
if (core->core_unit > 1) {
|
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);
|
pr_err("Unsupported core_unit %d\n", core->core_unit);
|
||||||
return -ENOTSUPP;
|
return -ENOTSUPP;
|
||||||
}
|
}
|
||||||
|
@ -1588,8 +1597,17 @@ static int bgmac_probe(struct bcma_device *core)
|
||||||
}
|
}
|
||||||
bgmac->cmn = core->bus->drv_gmac_cmn.core;
|
bgmac->cmn = core->bus->drv_gmac_cmn.core;
|
||||||
|
|
||||||
bgmac->phyaddr = core->core_unit ? sprom->et1phyaddr :
|
switch (core->core_unit) {
|
||||||
sprom->et0phyaddr;
|
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;
|
bgmac->phyaddr &= BGMAC_PHY_MASK;
|
||||||
if (bgmac->phyaddr == BGMAC_PHY_MASK) {
|
if (bgmac->phyaddr == BGMAC_PHY_MASK) {
|
||||||
bgmac_err(bgmac, "No PHY found\n");
|
bgmac_err(bgmac, "No PHY found\n");
|
||||||
|
|
Loading…
Reference in a new issue