uboot-sunxi: t113: refresh patches to fix clock issues
[openwrt/staging/wigyori.git] / package / boot / uboot-sunxi / patches / 4001-net-sunxi_emac-Switch-to-new-U-Boot-PHY-API.patch
1 From b68b48654248dedb7127631003a206cbfe7c5a2c Mon Sep 17 00:00:00 2001
2 From: Marek Vasut <marek.vasut+renesas@mailbox.org>
3 Date: Wed, 31 May 2023 00:51:24 +0200
4 Subject: [PATCH 4001/4044] net: sunxi_emac: Switch to new U-Boot PHY API
5
6 Use new U-Boot phy_connect() API which also supports fixed PHYs.
7
8 Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
9 Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
10 ---
11 drivers/net/sunxi_emac.c | 7 +++----
12 1 file changed, 3 insertions(+), 4 deletions(-)
13
14 diff --git a/drivers/net/sunxi_emac.c b/drivers/net/sunxi_emac.c
15 index ad9e1abd16..4c90d4b498 100644
16 --- a/drivers/net/sunxi_emac.c
17 +++ b/drivers/net/sunxi_emac.c
18 @@ -248,10 +248,10 @@ static int emac_mdio_write(struct mii_dev *bus, int addr, int devad, int reg,
19
20 static int sunxi_emac_init_phy(struct emac_eth_dev *priv, void *dev)
21 {
22 - int ret, mask = 0xffffffff;
23 + int ret, mask = -1;
24
25 #ifdef CONFIG_PHY_ADDR
26 - mask = 1 << CONFIG_PHY_ADDR;
27 + mask = CONFIG_PHY_ADDR;
28 #endif
29
30 priv->bus = mdio_alloc();
31 @@ -269,11 +269,10 @@ static int sunxi_emac_init_phy(struct emac_eth_dev *priv, void *dev)
32 if (ret)
33 return ret;
34
35 - priv->phydev = phy_find_by_mask(priv->bus, mask);
36 + priv->phydev = phy_connect(priv->bus, mask, dev, PHY_INTERFACE_MODE_MII);
37 if (!priv->phydev)
38 return -ENODEV;
39
40 - phy_connect_dev(priv->phydev, dev, PHY_INTERFACE_MODE_MII);
41 phy_config(priv->phydev);
42
43 return 0;
44 --
45 2.20.1
46