bcm53xx: update the ethernet core hacks
[openwrt/openwrt.git] / target / linux / bcm53xx / patches-3.10 / 202-bgmac-make-bgmac-work-on-systems-without-nvram.patch
1 These are some hackish patches to make the Ethernet driver work somehow
2 on this arm core.
3 The flash driver is not working, so we removed the nvram reading, this
4 should be changed after we have a flash driver.
5 The mdelay(1) is a ugly workaround for this arm chip, this seams to be a dma problem.
6
7 The PHY says it is not connected by default, just ignore it.
8
9 --- a/drivers/net/ethernet/broadcom/Kconfig
10 +++ b/drivers/net/ethernet/broadcom/Kconfig
11 @@ -132,7 +132,7 @@ config BNX2X_SRIOV
12
13 config BGMAC
14 tristate "BCMA bus GBit core support"
15 - depends on BCMA_HOST_SOC && HAS_DMA && BCM47XX
16 + depends on BCMA_HOST_SOC && HAS_DMA
17 select PHYLIB
18 ---help---
19 This driver supports GBit MAC and BCM4706 GBit MAC cores on BCMA bus.
20 --- a/drivers/net/ethernet/broadcom/bgmac.c
21 +++ b/drivers/net/ethernet/broadcom/bgmac.c
22 @@ -17,7 +17,11 @@
23 #include <linux/interrupt.h>
24 #include <linux/dma-mapping.h>
25 #include <linux/platform_data/b53.h>
26 +#ifdef CONFIG_BCM47XX
27 #include <bcm47xx_nvram.h>
28 +#else
29 +#define bcm47xx_nvram_getenv(a, b, c) -1
30 +#endif
31
32 static const struct bcma_device_id bgmac_bcma_tbl[] = {
33 BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_4706_MAC_GBIT, BCMA_ANY_REV, BCMA_ANY_CLASS),
34 @@ -165,6 +169,10 @@ static netdev_tx_t bgmac_dma_tx_add(stru
35
36 netdev_sent_queue(net_dev, skb->len);
37
38 + if (bgmac->core->bus->chipinfo.id == BCMA_CHIP_ID_BCM4707 ||
39 + bgmac->core->bus->chipinfo.id == BCMA_CHIP_ID_BCM53018)
40 + mdelay(1);
41 +
42 wmb();
43
44 /* Increase ring->end to point empty slot. We tell hardware the first
45 @@ -1438,7 +1446,7 @@ static int bgmac_probe(struct bcma_devic
46 int err;
47
48 /* We don't support 2nd, 3rd, ... units, SPROM has to be adjusted */
49 - if (core->core_unit > 1) {
50 + if (core->core_unit > 0) {
51 pr_err("Unsupported core_unit %d\n", core->core_unit);
52 return -ENOTSUPP;
53 }
54 @@ -1534,8 +1542,7 @@ static int bgmac_probe(struct bcma_devic
55 /* TODO: reset the external phy. Specs are needed */
56 bgmac_phy_reset(bgmac);
57
58 - bgmac->has_robosw = !!(core->bus->sprom.boardflags_lo &
59 - BGMAC_BFL_ENETROBO);
60 + bgmac->has_robosw = 1;
61 if (bgmac->has_robosw)
62 bgmac_warn(bgmac, "Support for Roboswitch not implemented\n");
63
64 --- a/drivers/net/phy/phy_device.c
65 +++ b/drivers/net/phy/phy_device.c
66 @@ -814,7 +814,7 @@ int genphy_update_link(struct phy_device
67 return status;
68
69 if ((status & BMSR_LSTATUS) == 0)
70 - phydev->link = 0;
71 + phydev->link = 1;
72 else
73 phydev->link = 1;
74