You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/12/04 08:37:50 UTC
(nuttx) branch master updated: arch/arm/samv7/sam_emac: Implement errata workaround for KSZ8061 PHY
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new a3cd8f921a arch/arm/samv7/sam_emac: Implement errata workaround for KSZ8061 PHY
a3cd8f921a is described below
commit a3cd8f921a8cdc153a2e6baae61782ba1b12324c
Author: Petro Karashchenko <pe...@gmail.com>
AuthorDate: Sun Dec 3 23:31:25 2023 +0100
arch/arm/samv7/sam_emac: Implement errata workaround for KSZ8061 PHY
Signed-off-by: Petro Karashchenko <pe...@gmail.com>
---
arch/arm/src/samv7/sam_emac.c | 31 +++++++++++++++++++++++++++++++
include/nuttx/net/mii.h | 1 +
2 files changed, 32 insertions(+)
diff --git a/arch/arm/src/samv7/sam_emac.c b/arch/arm/src/samv7/sam_emac.c
index 9a8fe99c9e..00caae8ade 100644
--- a/arch/arm/src/samv7/sam_emac.c
+++ b/arch/arm/src/samv7/sam_emac.c
@@ -3751,6 +3751,37 @@ static int sam_autonegotiate(struct sam_emac_s *priv)
goto errout;
}
+ if (priv->phytype == SAMV7_PHY_KSZ8061)
+ {
+ ret = sam_phywrite(priv, priv->phyaddr, MII_MMDCONTROL, 0x0001);
+ if (ret < 0)
+ {
+ nerr("ERROR: Failed to write MMDCONTROL\n");
+ goto errout;
+ }
+
+ ret = sam_phywrite(priv, priv->phyaddr, MII_MMDADDRDATA, 0x0002);
+ if (ret < 0)
+ {
+ nerr("ERROR: Failed to write MMDADDRDATA\n");
+ goto errout;
+ }
+
+ ret = sam_phywrite(priv, priv->phyaddr, MII_MMDCONTROL, 0x4001);
+ if (ret < 0)
+ {
+ nerr("ERROR: Failed to write MMDCONTROL\n");
+ goto errout;
+ }
+
+ ret = sam_phywrite(priv, priv->phyaddr, MII_MMDADDRDATA, 0xb61a);
+ if (ret < 0)
+ {
+ nerr("ERROR: Failed to write MMDADDRDATA\n");
+ goto errout;
+ }
+ }
+
/* Restart Auto_negotiation */
mcr |= MII_MCR_ANRESTART;
diff --git a/include/nuttx/net/mii.h b/include/nuttx/net/mii.h
index 1125c73ef8..623610cc26 100644
--- a/include/nuttx/net/mii.h
+++ b/include/nuttx/net/mii.h
@@ -53,6 +53,7 @@
#define MII_PSECONTROL 0x0b /* PSE control register */
#define MII_PSESTATUS 0x0c /* PSE status register */
#define MII_MMDCONTROL 0x0d /* MMD access control register */
+#define MII_MMDADDRDATA 0x0e /* MMD access address data register */
#define MII_ESTATUS 0x0f /* Extended status register */
/* Extended Registers: Registers 16-31 may be used for vendor specific