diff mbox series

[U-Boot] net: designware: use 'phy_connect' instead of open coded

Message ID 20190715195305.6064-1-simon.k.r.goldschmidt@gmail.com
State Accepted
Commit 5dce9df0e9936b6d7443574f07ca7fab690a06d7
Delegated to: Joe Hershberger
Headers show
Series [U-Boot] net: designware: use 'phy_connect' instead of open coded | expand

Commit Message

Simon Goldschmidt July 15, 2019, 7:53 p.m. UTC
Using 'phy_connect' instead of 'phy_find_by_mask' and 'phy_connect_dev'
both deduplicates code and adds support for 'fixed-link'.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
---

 drivers/net/designware.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Joe Hershberger July 22, 2019, 11:28 p.m. UTC | #1
On Mon, Jul 15, 2019 at 2:53 PM Simon Goldschmidt
<simon.k.r.goldschmidt@gmail.com> wrote:
>
> Using 'phy_connect' instead of 'phy_find_by_mask' and 'phy_connect_dev'
> both deduplicates code and adds support for 'fixed-link'.
>
> Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Joe Hershberger July 25, 2019, 6:41 p.m. UTC | #2
Hi Simon,

https://patchwork.ozlabs.org/patch/1132238/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe
diff mbox series

Patch

diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index 2c5d9560c5..e08f459cf4 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -480,18 +480,16 @@  static int _dw_free_pkt(struct dw_eth_dev *priv)
 static int dw_phy_init(struct dw_eth_dev *priv, void *dev)
 {
 	struct phy_device *phydev;
-	int mask = 0xffffffff, ret;
+	int phy_addr = -1, ret;
 
 #ifdef CONFIG_PHY_ADDR
-	mask = 1 << CONFIG_PHY_ADDR;
+	phy_addr = CONFIG_PHY_ADDR;
 #endif
 
-	phydev = phy_find_by_mask(priv->bus, mask, priv->interface);
+	phydev = phy_connect(priv->bus, phy_addr, dev, priv->interface);
 	if (!phydev)
 		return -ENODEV;
 
-	phy_connect_dev(phydev, dev);
-
 	phydev->supported &= PHY_GBIT_FEATURES;
 	if (priv->max_speed) {
 		ret = phy_set_supported(phydev, priv->max_speed);