projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>
[oweals/u-boot.git]
/
drivers
/
net
/
ravb.c
diff --git
a/drivers/net/ravb.c
b/drivers/net/ravb.c
index dc743e113dec6f41a69ae6490f17aa5ca41c7708..bd30cba940b29e531cab5a1cb4cc64125c3a1024 100644
(file)
--- a/
drivers/net/ravb.c
+++ b/
drivers/net/ravb.c
@@
-222,8
+222,8
@@
static int ravb_reset(struct udevice *dev)
writel(CCC_OPC_CONFIG, eth->iobase + RAVB_REG_CCC);
/* Check the operating mode is changed to the config mode. */
writel(CCC_OPC_CONFIG, eth->iobase + RAVB_REG_CCC);
/* Check the operating mode is changed to the config mode. */
- return wait_for_bit
(dev->name, (void *)
eth->iobase + RAVB_REG_CSR,
- CSR_OPS_CONFIG, true, 100, true);
+ return wait_for_bit
_le32(
eth->iobase + RAVB_REG_CSR,
+
CSR_OPS_CONFIG, true, 100, true);
}
static void ravb_base_desc_init(struct ravb_priv *eth)
}
static void ravb_base_desc_init(struct ravb_priv *eth)
@@
-399,7
+399,7
@@
static int ravb_dmac_init(struct udevice *dev)
static int ravb_config(struct udevice *dev)
{
struct ravb_priv *eth = dev_get_priv(dev);
static int ravb_config(struct udevice *dev)
{
struct ravb_priv *eth = dev_get_priv(dev);
- struct phy_device *phy;
+ struct phy_device *phy
= eth->phydev
;
u32 mask = ECMR_CHG_DM | ECMR_RE | ECMR_TE;
int ret;
u32 mask = ECMR_CHG_DM | ECMR_RE | ECMR_TE;
int ret;
@@
-410,13
+410,6
@@
static int ravb_config(struct udevice *dev)
ravb_mac_init(eth);
ravb_write_hwaddr(dev);
ravb_mac_init(eth);
ravb_write_hwaddr(dev);
- /* Configure phy */
- ret = ravb_phy_config(dev);
- if (ret)
- return ret;
-
- phy = eth->phydev;
-
ret = phy_startup(phy);
if (ret)
return ret;
ret = phy_startup(phy);
if (ret)
return ret;
@@
-438,15
+431,11
@@
static int ravb_config(struct udevice *dev)
return 0;
}
return 0;
}
-int ravb_start(struct udevice *dev)
+
static
int ravb_start(struct udevice *dev)
{
struct ravb_priv *eth = dev_get_priv(dev);
int ret;
{
struct ravb_priv *eth = dev_get_priv(dev);
int ret;
- ret = clk_enable(ð->clk);
- if (ret)
- return ret;
-
ret = ravb_reset(dev);
if (ret)
goto err;
ret = ravb_reset(dev);
if (ret)
goto err;
@@
-473,8
+462,8
@@
static void ravb_stop(struct udevice *dev)
{
struct ravb_priv *eth = dev_get_priv(dev);
{
struct ravb_priv *eth = dev_get_priv(dev);
+ phy_shutdown(eth->phydev);
ravb_reset(dev);
ravb_reset(dev);
- clk_disable(ð->clk);
}
static int ravb_probe(struct udevice *dev)
}
static int ravb_probe(struct udevice *dev)
@@
-512,8
+501,23
@@
static int ravb_probe(struct udevice *dev)
eth->bus = miiphy_get_dev_by_name(dev->name);
eth->bus = miiphy_get_dev_by_name(dev->name);
+ /* Bring up PHY */
+ ret = clk_enable(ð->clk);
+ if (ret)
+ goto err_mdio_register;
+
+ ret = ravb_reset(dev);
+ if (ret)
+ goto err_mdio_reset;
+
+ ret = ravb_phy_config(dev);
+ if (ret)
+ goto err_mdio_reset;
+
return 0;
return 0;
+err_mdio_reset:
+ clk_disable(ð->clk);
err_mdio_register:
mdio_free(mdiodev);
err_mdio_alloc:
err_mdio_register:
mdio_free(mdiodev);
err_mdio_alloc:
@@
-525,6
+529,8
@@
static int ravb_remove(struct udevice *dev)
{
struct ravb_priv *eth = dev_get_priv(dev);
{
struct ravb_priv *eth = dev_get_priv(dev);
+ clk_disable(ð->clk);
+
free(eth->phydev);
mdio_unregister(eth->bus);
mdio_free(eth->bus);
free(eth->phydev);
mdio_unregister(eth->bus);
mdio_free(eth->bus);