[U-Boot] [PATCH 1/2] net: macb: Fixed reading MII_LPA register

If macb is gem and is gigabit capable, lpa value is not read from the right register(MII_LPA) and is read from MII_STAT1000. This patch fixes reading of the lpa value.
Signed-off-by: Radu Pirea radu_nicolae.pirea@upb.ro --- drivers/net/macb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 72614164e9..3632650983 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -570,7 +570,7 @@ static int macb_phy_init(struct macb_device *macb, const char *name)
/* First check for GMAC and that it is GiB capable */ if (gem_is_gigabit_capable(macb)) { - lpa = macb_mdio_read(macb, MII_STAT1000); + lpa = macb_mdio_read(macb, MII_LPA);
if (lpa & (LPA_1000FULL | LPA_1000HALF)) { duplex = ((lpa & LPA_1000FULL) ? 1 : 0);

Macb can be used with Xilinx PCS/PMA PHY in fpga which is a 1000-baseX phy(lpa 0x41e0). This patch adds checks for LPA_1000XFULL and LPA_1000XHALF bits.
Signed-off-by: Radu Pirea radu_nicolae.pirea@upb.ro --- drivers/net/macb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 3632650983..476ecc0ca9 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -572,8 +572,10 @@ static int macb_phy_init(struct macb_device *macb, const char *name) if (gem_is_gigabit_capable(macb)) { lpa = macb_mdio_read(macb, MII_LPA);
- if (lpa & (LPA_1000FULL | LPA_1000HALF)) { - duplex = ((lpa & LPA_1000FULL) ? 1 : 0); + if (lpa & (LPA_1000FULL | LPA_1000HALF | LPA_1000XFULL | + LPA_1000XHALF)) { + duplex = ((lpa & (LPA_1000FULL | LPA_1000XFULL)) ? + 1 : 0);
printf("%s: link up, 1000Mbps %s-duplex (lpa: 0x%04x)\n", name,

On Fri, Jun 7, 2019 at 8:48 AM Radu Pirea radu_nicolae.pirea@upb.ro wrote:
Macb can be used with Xilinx PCS/PMA PHY in fpga which is a 1000-baseX phy(lpa 0x41e0). This patch adds checks for LPA_1000XFULL and LPA_1000XHALF bits.
Signed-off-by: Radu Pirea radu_nicolae.pirea@upb.ro
Acked-by: Joe Hershberger joe.hershberger@ni.com

Hi Radu,
https://patchwork.ozlabs.org/patch/1111832/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git
Thanks! -Joe

On Fri, Jun 7, 2019 at 8:48 AM Radu Pirea radu_nicolae.pirea@upb.ro wrote:
If macb is gem and is gigabit capable, lpa value is not read from the right register(MII_LPA) and is read from MII_STAT1000. This patch fixes reading of the lpa value.
Signed-off-by: Radu Pirea radu_nicolae.pirea@upb.ro
Acked-by: Joe Hershberger joe.hershberger@ni.com

Hi Radu,
https://patchwork.ozlabs.org/patch/1111831/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git
Thanks! -Joe
participants (2)
-
Joe Hershberger
-
Radu Pirea