summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2012-07-12 08:23:58 +0200
committerWolfgang Denk <wd@denx.de>2012-07-12 08:23:58 +0200
commit0878222fed3fafbfd0b1f2e5a6b2da90a81e910d (patch)
treef88ba4ad1c5f06e6a772d5062c526d8153a71678 /drivers/net
parent0b15d51ed07db4c318d9c6b02b394ba5a3bc4296 (diff)
parent154177e14a141468374f438ed3096ab097b79976 (diff)
Merge branch 'next' of git://git.denx.de/u-boot-net into next
* 'next' of git://git.denx.de/u-boot-net: net: Inline the new eth_setenv_enetaddr_by_index function net: allow setting env enetaddr from net device setting net/designware: Consecutive writes to the same register to be avoided CACHE: net: asix: Fix asix driver to work with data cache on net: phy: micrel: make ksz9021 phy accessible net: abort network initialization if the PHY driver fails phylib: phy_startup() should return an error code on failure net: tftp: fix type of block arg to store_block Signed-off-by: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/designware.c4
-rw-r--r--drivers/net/fec_mxc.c8
-rw-r--r--drivers/net/fm/eth.c9
-rw-r--r--drivers/net/phy/micrel.c15
-rw-r--r--drivers/net/phy/phy.c5
-rw-r--r--drivers/net/sh_eth.c6
-rw-r--r--drivers/net/tsec.c8
-rw-r--r--drivers/net/xilinx_axi_emac.c6
-rw-r--r--drivers/net/xilinx_ll_temac.c8
9 files changed, 58 insertions, 11 deletions
diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index 326d550c1f..bf21a08bdf 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -171,8 +171,8 @@ static int dw_eth_init(struct eth_device *dev, bd_t *bis)
writel(FIXEDBURST | PRIORXTX_41 | BURST_16,
&dma_p->busmode);
- writel(FLUSHTXFIFO | readl(&dma_p->opmode), &dma_p->opmode);
- writel(STOREFORWARD | TXSECONDFRAME, &dma_p->opmode);
+ writel(readl(&dma_p->opmode) | FLUSHTXFIFO | STOREFORWARD |
+ TXSECONDFRAME, &dma_p->opmode);
conf = FRAMEBURSTENABLE | DISABLERXOWN;
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index eee41d7c8b..5700552189 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -510,7 +510,13 @@ static int fec_open(struct eth_device *edev)
fec_eth_phy_config(edev);
if (fec->phydev) {
/* Start up the PHY */
- phy_startup(fec->phydev);
+ int ret = phy_startup(fec->phydev);
+
+ if (ret) {
+ printf("Could not initialize PHY %s\n",
+ fec->phydev->dev->name);
+ return ret;
+ }
speed = fec->phydev->speed;
} else {
speed = _100BASET;
diff --git a/drivers/net/fm/eth.c b/drivers/net/fm/eth.c
index f34f4db6b6..2b616adb6e 100644
--- a/drivers/net/fm/eth.c
+++ b/drivers/net/fm/eth.c
@@ -363,6 +363,9 @@ static int fm_eth_open(struct eth_device *dev, bd_t *bd)
{
struct fm_eth *fm_eth;
struct fsl_enet_mac *mac;
+#ifdef CONFIG_PHYLIB
+ int ret;
+#endif
fm_eth = (struct fm_eth *)dev->priv;
mac = fm_eth->mac;
@@ -384,7 +387,11 @@ static int fm_eth_open(struct eth_device *dev, bd_t *bd)
fmc_tx_port_graceful_stop_disable(fm_eth);
#ifdef CONFIG_PHYLIB
- phy_startup(fm_eth->phydev);
+ ret = phy_startup(fm_eth->phydev);
+ if (ret) {
+ printf("%s: Could not initialize\n", fm_eth->phydev->dev->name);
+ return ret;
+ }
#else
fm_eth->phydev->speed = SPEED_1000;
fm_eth->phydev->link = 1;
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index e3043dfa20..30f3264897 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -35,6 +35,12 @@ static struct phy_driver KSZ804_driver = {
.shutdown = &genphy_shutdown,
};
+#ifndef CONFIG_PHY_MICREL_KSZ9021
+/*
+ * I can't believe Micrel used the exact same part number
+ * for the KSZ9021
+ * Shame Micrel, Shame!!!!!
+ */
static struct phy_driver KS8721_driver = {
.name = "Micrel KS8721BL",
.uid = 0x221610,
@@ -44,7 +50,9 @@ static struct phy_driver KS8721_driver = {
.startup = &genphy_startup,
.shutdown = &genphy_shutdown,
};
+#endif
+#ifdef CONFIG_PHY_MICREL_KSZ9021
/* ksz9021 PHY Registers */
#define MII_KSZ9021_EXTENDED_CTRL 0x0b
#define MII_KSZ9021_EXTENDED_DATAW 0x0c
@@ -127,12 +135,15 @@ static struct phy_driver ksz9021_driver = {
.startup = &ksz9021_startup,
.shutdown = &genphy_shutdown,
};
+#endif
int phy_micrel_init(void)
{
phy_register(&KSZ804_driver);
- phy_register(&KS8721_driver);
+#ifdef CONFIG_PHY_MICREL_KSZ9021
phy_register(&ksz9021_driver);
-
+#else
+ phy_register(&KS8721_driver);
+#endif
return 0;
}
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 7d327f766a..baef60f827 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -723,10 +723,13 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr,
return phydev;
}
+/*
+ * Start the PHY. Returns 0 on success, or a negative error code.
+ */
int phy_startup(struct phy_device *phydev)
{
if (phydev->drv->startup)
- phydev->drv->startup(phydev);
+ return phydev->drv->startup(phydev);
return 0;
}
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index bb57e4d53a..268d88428c 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -415,7 +415,11 @@ static int sh_eth_config(struct sh_eth_dev *eth, bd_t *bd)
goto err_phy_cfg;
}
phy = port_info->phydev;
- phy_startup(phy);
+ ret = phy_startup(phy);
+ if (ret) {
+ printf(SHETHER_NAME ": phy startup failure\n");
+ return ret;
+ }
val = 0;
diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index 3c1c8f0799..f5e314b9ee 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -480,6 +480,7 @@ static int tsec_init(struct eth_device *dev, bd_t * bd)
int i;
struct tsec_private *priv = (struct tsec_private *)dev->priv;
tsec_t *regs = priv->regs;
+ int ret;
/* Make sure the controller is stopped */
tsec_halt(dev);
@@ -511,7 +512,12 @@ static int tsec_init(struct eth_device *dev, bd_t * bd)
startup_tsec(dev);
/* Start up the PHY */
- phy_startup(priv->phydev);
+ ret = phy_startup(priv->phydev);
+ if (ret) {
+ printf("Could not initialize PHY %s\n",
+ priv->phydev->dev->name);
+ return ret;
+ }
adjust_link(priv, priv->phydev);
diff --git a/drivers/net/xilinx_axi_emac.c b/drivers/net/xilinx_axi_emac.c
index 7854a04cae..d77714440a 100644
--- a/drivers/net/xilinx_axi_emac.c
+++ b/drivers/net/xilinx_axi_emac.c
@@ -272,7 +272,11 @@ static int setup_phy(struct eth_device *dev)
phydev->advertising = phydev->supported;
priv->phydev = phydev;
phy_config(phydev);
- phy_startup(phydev);
+ if (phy_startup(phydev)) {
+ printf("axiemac: could not initialize PHY %s\n",
+ phydev->dev->name);
+ return 0;
+ }
switch (phydev->speed) {
case 1000:
diff --git a/drivers/net/xilinx_ll_temac.c b/drivers/net/xilinx_ll_temac.c
index 27dafc15c0..b67153bec8 100644
--- a/drivers/net/xilinx_ll_temac.c
+++ b/drivers/net/xilinx_ll_temac.c
@@ -232,6 +232,7 @@ static void ll_temac_halt(struct eth_device *dev)
static int ll_temac_init(struct eth_device *dev, bd_t *bis)
{
struct ll_temac *ll_temac = dev->priv;
+ int ret;
printf("%s: Xilinx XPS LocalLink Tri-Mode Ether MAC #%d at 0x%08X.\n",
dev->name, dev->index, dev->iobase);
@@ -240,7 +241,12 @@ static int ll_temac_init(struct eth_device *dev, bd_t *bis)
return -1;
/* Start up the PHY */
- phy_startup(ll_temac->phydev);
+ ret = phy_startup(ll_temac->phydev);
+ if (ret) {
+ printf("%s: Could not initialize PHY %s\n",
+ dev->name, ll_temac->phydev->dev->name);
+ return ret;
+ }
if (!ll_temac_adjust_link(dev)) {
ll_temac_halt(dev);