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/04/25 03:45:27 UTC

[nuttx] 02/04: drivers/net, include/nuttx/net: Add AR8031 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

commit 8c89052fb304c549881d737efbf1b53ffefc8a87
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Mon Apr 17 10:27:03 2023 +0900

    drivers/net, include/nuttx/net: Add AR8031 PHY
    
    Summary:
    - This commit adds AR8031 PHY definitions
    
    Impact:
    - None
    
    Testing:
    - Tested with sabre-6quad:netnsh_ar8031 (will be added later)
    
    Signed-off-by: Masayuki Ishikawa <Ma...@jp.sony.com>
---
 drivers/net/Kconfig     |  3 +++
 include/nuttx/net/mii.h | 15 +++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index f7be17a327..3924d3913d 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -414,6 +414,9 @@ config ETH0_PHY_NONE
 config ETH0_PHY_AM79C874
 	bool "AMD Am79C874 PHY"
 
+config ETH0_PHY_AR8031
+	bool "Atheros AR8031 PHY"
+
 config ETH0_PHY_KS8721
 	bool "Micrel KS8721 PHY"
 
diff --git a/include/nuttx/net/mii.h b/include/nuttx/net/mii.h
index 029f91b3a5..59504522c7 100644
--- a/include/nuttx/net/mii.h
+++ b/include/nuttx/net/mii.h
@@ -59,6 +59,10 @@
  * abilities
  */
 
+/* AR8031: */
+
+#define MII_AR8031_PSSR              0x11      /* Phy-Specific Status Register */
+
 /* National Semiconductor DP83840: 0x07-0x11, 0x14, 0x1a, 0x1d-0x1f
  * reserved
  */
@@ -841,6 +845,17 @@
 #define MII_DP83848C_FHF_INT_EN       (1 << 1)  /* Enable Interrupt on False Carrier Counter Register half-full event. */
 #define MII_DP83848C_RHF_INT_EN       (1 << 0)  /* Enable Interrupt on Receive Error Counter Register half-full event. */
 
+/* Atheros AR8031 MII ID1/2 register bits */
+
+#define MII_PHYID1_AR8031            0x004d     /* ID1 value for AR8031 */
+#define MII_PHYID2_AR8031            0xd074     /* ID2 value for AR8031 */
+
+#define MII_AR8031_PSSR_SPEEDMASK    (3 << 14)  /* Bit 14-15: Speed */
+#define MII_AR8031_PSSR_10MBPS       (0 << 14)
+#define MII_AR8031_PSSR_100MBPS      (1 << 14)
+#define MII_AR8031_PSSR_1000MBPS     (2 << 14)
+#define MII_AR8031_PSSR_DUPLEX       (1 << 13)  /* Bit 13:  Full duplex mode */
+
 /****************************************************************************
  * Type Definitions
  ****************************************************************************/