diff options
author | Tom Rini <trini@ti.com> | 2013-03-18 12:31:00 -0400 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2013-03-18 14:37:18 -0400 |
commit | 0ce033d2582129243aca10d3072a221386bbba44 (patch) | |
tree | 6e50a3f4eed22007549dc740d0fa647a6c8cec5b /drivers/net/cpsw.c | |
parent | b5bec88434adb52413f1bc33fa63d7642cb8fd35 (diff) | |
parent | b27673ccbd3d5435319b5c09c3e7061f559f925d (diff) | |
download | u-boot-imx-0ce033d2582129243aca10d3072a221386bbba44.zip u-boot-imx-0ce033d2582129243aca10d3072a221386bbba44.tar.gz u-boot-imx-0ce033d2582129243aca10d3072a221386bbba44.tar.bz2 |
Merge branch 'master' of git://git.denx.de/u-boot-arm
Albert's rework of the linker scripts conflicted with Simon's making
everyone use __bss_end. We also had a minor conflict over
README.scrapyard being added to in mainline and enhanced in
u-boot-arm/master with proper formatting.
Conflicts:
arch/arm/cpu/ixp/u-boot.lds
arch/arm/cpu/u-boot.lds
arch/arm/lib/Makefile
board/actux1/u-boot.lds
board/actux2/u-boot.lds
board/actux3/u-boot.lds
board/dvlhost/u-boot.lds
board/freescale/mx31ads/u-boot.lds
doc/README.scrapyard
include/configs/tegra-common.h
Build tested for all of ARM and run-time tested on am335x_evm.
Signed-off-by: Tom Rini <trini@ti.com>
Diffstat (limited to 'drivers/net/cpsw.c')
-rw-r--r-- | drivers/net/cpsw.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c index db04795..93f8417 100644 --- a/drivers/net/cpsw.c +++ b/drivers/net/cpsw.c @@ -227,6 +227,9 @@ struct cpsw_priv { struct cpsw_slave *slaves; struct phy_device *phydev; struct mii_dev *bus; + + u32 mdio_link; + u32 phy_mask; }; static inline int cpsw_ale_get_field(u32 *ale_entry, u32 start, u32 bits) @@ -598,10 +601,21 @@ static int cpsw_update_link(struct cpsw_priv *priv) for_each_slave(slave, priv) cpsw_slave_update_link(slave, priv, &link); - + priv->mdio_link = readl(&mdio_regs->link); return link; } +static int cpsw_check_link(struct cpsw_priv *priv) +{ + u32 link = 0; + + link = __raw_readl(&mdio_regs->link) & priv->phy_mask; + if ((link) && (link == priv->mdio_link)) + return 1; + + return cpsw_update_link(priv); +} + static inline u32 cpsw_get_slave_port(struct cpsw_priv *priv, u32 slave_num) { if (priv->host_port == 0) @@ -631,6 +645,8 @@ static void cpsw_slave_init(struct cpsw_slave *slave, struct cpsw_priv *priv) cpsw_ale_port_state(priv, slave_port, ALE_PORT_STATE_FORWARD); cpsw_ale_add_mcast(priv, NetBcastAddr, 1 << slave_port); + + priv->phy_mask |= 1 << slave->data->phy_id; } static struct cpdma_desc *cpdma_desc_alloc(struct cpsw_priv *priv) @@ -862,7 +878,7 @@ static int cpsw_send(struct eth_device *dev, void *packet, int length) int len; int timeout = CPDMA_TIMEOUT; - if (!cpsw_update_link(priv)) + if (!cpsw_check_link(priv)) return -EIO; flush_dcache_range((unsigned long)packet, |