78154707e7e3d905eb1aedf149125f17e8c77be7
[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 @@ -1438,7 +1442,7 @@ static int bgmac_probe(struct bcma_devic
35         int err;
36  
37         /* We don't support 2nd, 3rd, ... units, SPROM has to be adjusted */
38 -       if (core->core_unit > 1) {
39 +       if (core->core_unit > 0) {
40                 pr_err("Unsupported core_unit %d\n", core->core_unit);
41                 return -ENOTSUPP;
42         }
43 @@ -1473,8 +1477,7 @@ static int bgmac_probe(struct bcma_devic
44         }
45         bgmac->cmn = core->bus->drv_gmac_cmn.core;
46  
47 -       bgmac->phyaddr = core->core_unit ? sprom->et1phyaddr :
48 -                        sprom->et0phyaddr;
49 +       bgmac->phyaddr = BGMAC_PHY_NOREGS; // core->core_unit ? sprom->et1phyaddr : sprom->et0phyaddr;
50         bgmac->phyaddr &= BGMAC_PHY_MASK;
51         if (bgmac->phyaddr == BGMAC_PHY_MASK) {
52                 bgmac_err(bgmac, "No PHY found\n");
53 @@ -1526,8 +1529,7 @@ static int bgmac_probe(struct bcma_devic
54         /* TODO: reset the external phy. Specs are needed */
55         bgmac_phy_reset(bgmac);
56  
57 -       bgmac->has_robosw = !!(core->bus->sprom.boardflags_lo &
58 -                              BGMAC_BFL_ENETROBO);
59 +       bgmac->has_robosw = 1;
60         if (bgmac->has_robosw)
61                 bgmac_warn(bgmac, "Support for Roboswitch not implemented\n");
62  
63 --- a/drivers/net/phy/phy_device.c
64 +++ b/drivers/net/phy/phy_device.c
65 @@ -814,7 +814,7 @@ int genphy_update_link(struct phy_device
66                 return status;
67  
68         if ((status & BMSR_LSTATUS) == 0)
69 -               phydev->link = 0;
70 +               phydev->link = 1;
71         else
72                 phydev->link = 1;
73