* [U-Boot] [PATCH] net: mvgbe: Fix build error with CONFIG_PHYLIB
@ 2016-10-31 21:48 Chris Packham
2016-11-01 20:23 ` Joe Hershberger
2016-11-07 17:31 ` [U-Boot] " Joe Hershberger
0 siblings, 2 replies; 3+ messages in thread
From: Chris Packham @ 2016-10-31 21:48 UTC (permalink / raw)
To: u-boot
Commit 5a49f17481bb ("net: mii: Use spatch to update miiphy_register")
updated the mvgbe implementation of smi_reg_read/smi_reg_write. Prior to
that change mvgbe_phy_read and mvgbe_phy_write where used as wrappers to
satisfy the phylib APIs. Because these functions weren't updated in that
commit build errors where triggered when CONFIG_PHYLIB was enabled.
Fix these build errors by removing mvgbe_phy_read and mvgbe_phy_write
and using smi_reg_read/smi_reg_write directly.
Signed-off-by: Chris Packham <judge.packham@gmail.com>
---
Looking at this closer it actually appears that the mvgbe driver has 2
places where a mii_dev is created. The first in mvgbe_phylib_init()
which is triggered when CONFIG_PHYLIB is enabled (this is where I
first noticed the build error), the second in mvgbe_initialize() which
is triggered when CONFIG_MII or CONFIG_CMD_MII is enabled.
I think this could do with some more cleaning up. But perhaps the build
error should be fixed first and then we can tackle the cleanup.
drivers/net/mvgbe.c | 25 +++----------------------
1 file changed, 3 insertions(+), 22 deletions(-)
diff --git a/drivers/net/mvgbe.c b/drivers/net/mvgbe.c
index c784cdcae265..f833efbe6779 100644
--- a/drivers/net/mvgbe.c
+++ b/drivers/net/mvgbe.c
@@ -177,25 +177,6 @@ static int smi_reg_write(struct mii_dev *bus, int phy_adr, int devad,
}
#endif
-#if defined(CONFIG_PHYLIB)
-int mvgbe_phy_read(struct mii_dev *bus, int phy_addr, int dev_addr,
- int reg_addr)
-{
- u16 data;
- int ret;
- ret = smi_reg_read(bus->name, phy_addr, reg_addr, &data);
- if (ret)
- return ret;
- return data;
-}
-
-int mvgbe_phy_write(struct mii_dev *bus, int phy_addr, int dev_addr,
- int reg_addr, u16 data)
-{
- return smi_reg_write(bus->name, phy_addr, reg_addr, data);
-}
-#endif
-
/* Stop and checks all queues */
static void stop_queue(u32 * qreg)
{
@@ -676,8 +657,8 @@ int mvgbe_phylib_init(struct eth_device *dev, int phyid)
printf("mdio_alloc failed\n");
return -ENOMEM;
}
- bus->read = mvgbe_phy_read;
- bus->write = mvgbe_phy_write;
+ bus->read = smi_reg_read;
+ bus->write = smi_reg_write;
strcpy(bus->name, dev->name);
ret = mdio_register(bus);
@@ -688,7 +669,7 @@ int mvgbe_phylib_init(struct eth_device *dev, int phyid)
}
/* Set phy address of the port */
- mvgbe_phy_write(bus, MV_PHY_ADR_REQUEST, 0, MV_PHY_ADR_REQUEST, phyid);
+ smi_reg_write(bus, MV_PHY_ADR_REQUEST, 0, MV_PHY_ADR_REQUEST, phyid);
phydev = phy_connect(bus, phyid, dev, PHY_INTERFACE_MODE_RGMII);
if (!phydev) {
--
2.10.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] net: mvgbe: Fix build error with CONFIG_PHYLIB
2016-10-31 21:48 [U-Boot] [PATCH] net: mvgbe: Fix build error with CONFIG_PHYLIB Chris Packham
@ 2016-11-01 20:23 ` Joe Hershberger
2016-11-07 17:31 ` [U-Boot] " Joe Hershberger
1 sibling, 0 replies; 3+ messages in thread
From: Joe Hershberger @ 2016-11-01 20:23 UTC (permalink / raw)
To: u-boot
On Mon, Oct 31, 2016 at 4:48 PM, Chris Packham <judge.packham@gmail.com> wrote:
> Commit 5a49f17481bb ("net: mii: Use spatch to update miiphy_register")
> updated the mvgbe implementation of smi_reg_read/smi_reg_write. Prior to
> that change mvgbe_phy_read and mvgbe_phy_write where used as wrappers to
> satisfy the phylib APIs. Because these functions weren't updated in that
> commit build errors where triggered when CONFIG_PHYLIB was enabled.
>
> Fix these build errors by removing mvgbe_phy_read and mvgbe_phy_write
> and using smi_reg_read/smi_reg_write directly.
>
> Signed-off-by: Chris Packham <judge.packham@gmail.com>
> ---
> Looking at this closer it actually appears that the mvgbe driver has 2
> places where a mii_dev is created. The first in mvgbe_phylib_init()
> which is triggered when CONFIG_PHYLIB is enabled (this is where I
> first noticed the build error), the second in mvgbe_initialize() which
> is triggered when CONFIG_MII or CONFIG_CMD_MII is enabled.
>
> I think this could do with some more cleaning up. But perhaps the build
> error should be fixed first and then we can tackle the cleanup.
I agree - I'll pull this fix as is.
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] net: mvgbe: Fix build error with CONFIG_PHYLIB
2016-10-31 21:48 [U-Boot] [PATCH] net: mvgbe: Fix build error with CONFIG_PHYLIB Chris Packham
2016-11-01 20:23 ` Joe Hershberger
@ 2016-11-07 17:31 ` Joe Hershberger
1 sibling, 0 replies; 3+ messages in thread
From: Joe Hershberger @ 2016-11-07 17:31 UTC (permalink / raw)
To: u-boot
Hi Chris,
https://patchwork.ozlabs.org/patch/689658/ was applied to u-boot-net.git.
Thanks!
-Joe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-11-07 17:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-31 21:48 [U-Boot] [PATCH] net: mvgbe: Fix build error with CONFIG_PHYLIB Chris Packham
2016-11-01 20:23 ` Joe Hershberger
2016-11-07 17:31 ` [U-Boot] " Joe Hershberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox