bcm53xx: make bgmac work
[openwrt/svn-archive/archive.git] / target / linux / bcm53xx / patches-3.10 / 202-bgmac-make-bgmac-work-on-systems-without-nvram.patch
1 bgmac: make bgmac work on systems without nvram
2
3 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
4 ---
5 drivers/net/ethernet/broadcom/bgmac.c | 4 ++++
6 1 file changed, 4 insertions(+)
7
8 --- a/drivers/net/ethernet/broadcom/Kconfig
9 +++ b/drivers/net/ethernet/broadcom/Kconfig
10 @@ -132,7 +132,7 @@ config BNX2X_SRIOV
11
12 config BGMAC
13 tristate "BCMA bus GBit core support"
14 - depends on BCMA_HOST_SOC && HAS_DMA && BCM47XX
15 + depends on BCMA_HOST_SOC && HAS_DMA
16 select PHYLIB
17 ---help---
18 This driver supports GBit MAC and BCM4706 GBit MAC cores on BCMA bus.
19 --- a/drivers/net/ethernet/broadcom/bgmac.c
20 +++ b/drivers/net/ethernet/broadcom/bgmac.c
21 @@ -17,7 +17,11 @@
22 #include <linux/interrupt.h>
23 #include <linux/dma-mapping.h>
24 #include <linux/platform_data/b53.h>
25 +#ifdef CONFIG_BCM47XX
26 #include <bcm47xx_nvram.h>
27 +#else
28 +#define bcm47xx_nvram_getenv(a, b, c) -1
29 +#endif
30
31 static const struct bcma_device_id bgmac_bcma_tbl[] = {
32 BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_4706_MAC_GBIT, BCMA_ANY_REV, BCMA_ANY_CLASS),
33 @@ -1490,7 +1494,7 @@ static int bgmac_probe(struct bcma_devic
34 int err;
35
36 /* We don't support 2nd, 3rd, ... units, SPROM has to be adjusted */
37 - if (core->core_unit > 1) {
38 + if (core->core_unit > 0) {
39 pr_err("Unsupported core_unit %d\n", core->core_unit);
40 return -ENOTSUPP;
41 }
42 @@ -1528,8 +1532,7 @@ static int bgmac_probe(struct bcma_devic
43 }
44 bgmac->cmn = core->bus->drv_gmac_cmn.core;
45
46 - bgmac->phyaddr = core->core_unit ? sprom->et1phyaddr :
47 - sprom->et0phyaddr;
48 + bgmac->phyaddr = 30;
49 bgmac->phyaddr &= BGMAC_PHY_MASK;
50 if (bgmac->phyaddr == BGMAC_PHY_MASK) {
51 bgmac_err(bgmac, "No PHY found\n");
52 @@ -1579,8 +1582,7 @@ static int bgmac_probe(struct bcma_devic
53 /* TODO: reset the external phy. Specs are needed */
54 bgmac_phy_reset(bgmac);
55
56 - bgmac->has_robosw = !!(core->bus->sprom.boardflags_lo &
57 - BGMAC_BFL_ENETROBO);
58 + bgmac->has_robosw = 1;
59 if (bgmac->has_robosw)
60 bgmac_warn(bgmac, "Support for Roboswitch not implemented\n");
61