bcm53xx: bgmac: add support for the 3rd core
[openwrt/svn-archive/archive.git] / target / linux / bcm53xx / patches-3.18 / 700-bgmac-add-support-for-the-3rd-bus-core-device.patch
1 From f5d5afc0b1402aae0f6a2350e43241603dbaff1e Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
3 Date: Wed, 13 May 2015 10:46:47 +0200
4 Subject: [PATCH] bgmac: add support for the 3rd bus core (device)
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 So far we were supporting up to 2 cores but recent devices (e.g. Netgear
10 R8000) may use 3rd as well. Lower ones (1st, 2nd) are usually used for
11 some offloading then.
12
13 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
14 ---
15 drivers/net/ethernet/broadcom/bgmac.c | 28 +++++++++++++++++++++++-----
16 1 file changed, 23 insertions(+), 5 deletions(-)
17
18 diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
19 index f66c416..0614cae 100644
20 --- a/drivers/net/ethernet/broadcom/bgmac.c
21 +++ b/drivers/net/ethernet/broadcom/bgmac.c
22 @@ -1561,11 +1561,20 @@ static int bgmac_probe(struct bcma_device *core)
23 struct net_device *net_dev;
24 struct bgmac *bgmac;
25 struct ssb_sprom *sprom = &core->bus->sprom;
26 - u8 *mac = core->core_unit ? sprom->et1mac : sprom->et0mac;
27 + u8 *mac;
28 int err;
29
30 - /* We don't support 2nd, 3rd, ... units, SPROM has to be adjusted */
31 - if (core->core_unit > 1) {
32 + switch (core->core_unit) {
33 + case 0:
34 + mac = sprom->et0mac;
35 + break;
36 + case 1:
37 + mac = sprom->et1mac;
38 + break;
39 + case 2:
40 + mac = sprom->et2mac;
41 + break;
42 + default:
43 pr_err("Unsupported core_unit %d\n", core->core_unit);
44 return -ENOTSUPP;
45 }
46 @@ -1600,8 +1609,17 @@ static int bgmac_probe(struct bcma_device *core)
47 }
48 bgmac->cmn = core->bus->drv_gmac_cmn.core;
49
50 - bgmac->phyaddr = core->core_unit ? sprom->et1phyaddr :
51 - sprom->et0phyaddr;
52 + switch (core->core_unit) {
53 + case 0:
54 + bgmac->phyaddr = sprom->et0phyaddr;
55 + break;
56 + case 1:
57 + bgmac->phyaddr = sprom->et1phyaddr;
58 + break;
59 + case 2:
60 + bgmac->phyaddr = sprom->et2phyaddr;
61 + break;
62 + }
63 bgmac->phyaddr &= BGMAC_PHY_MASK;
64 if (bgmac->phyaddr == BGMAC_PHY_MASK) {
65 bgmac_err(bgmac, "No PHY found\n");
66 --
67 1.8.4.5
68