net: stmmac: report active PHY interface
Subsystems (4)
PATCH 1/1 net: stmmac: report active PHY interface
Report the active PHY interface from the point of view of the dwmac hardware to the kernel log, where the core supports reading this.
---
I recently sent this to aid some debug for socfpga folks, but I think printing the active PHY interface as read from the HW feature registers is useful information about the state of the driver, particularly for debugging reported issues.
drivers/net/ethernet/stmicro/stmmac/common.h | 6 +++ .../ethernet/stmicro/stmmac/dwmac1000_dma.c | 2 + .../net/ethernet/stmicro/stmmac/dwmac4_dma.c | 2 + .../net/ethernet/stmicro/stmmac/dwxgmac2.h | 1 + .../ethernet/stmicro/stmmac/dwxgmac2_dma.c | 1 + .../net/ethernet/stmicro/stmmac/stmmac_main.c | 52 +++++++++++++++++++ 6 files changed, 64 insertions(+)
drivers/net/ethernet/stmicro/stmmac/common.h +6 -0
@@ -323,6 +323,10 @@ struct stmmac_safety_stats {#define PHY_INTF_SEL_SMII 6#define PHY_INTF_SEL_REVMII 7 +/* XGMAC uses a different encoding - from the AgileX5 documentation */ +#define PHY_INTF_GMII 0 +#define PHY_INTF_RGMII 1 +/* MSI defines */ #define STMMAC_MSI_VEC_MAX 32
@@ -512,6 +516,8 @@ struct dma_features {unsigned int dbgmem;/* Number of Policing Counters */ unsigned int pcsel; +/* Active PHY interface, PHY_INTF_SEL_xxx */ +u8 actphyif; };/* RX Buffer size must be multiple of 4/8/16 bytes */
drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c +2 -0
@@ -239,6 +239,8 @@ static int dwmac1000_get_hw_feature(void __iomem *ioaddr,/* Alternate (enhanced) DESC mode */ dma_cap->enh_desc = (hw_cap &DMA_HW_FEAT_ENHDESSEL ) >>24 ; + dma_cap->actphyif =FIELD_GET (DMA_HW_FEAT_ACTPHYIF , hw_cap); +return 0 ; }
drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c +2 -0
@@ -382,6 +382,8 @@ static int dwmac4_get_hw_feature(void __iomem *ioaddr, dma_cap->vlins = (hw_cap &GMAC_HW_FEAT_SAVLANINS ) >>27 ; dma_cap->arpoffsel = (hw_cap &GMAC_HW_FEAT_ARPOFFSEL ) >>9 ; + dma_cap->actphyif =FIELD_GET (DMA_HW_FEAT_ACTPHYIF , hw_cap); +/* MAC HW feature1 */ hw_cap =readl (ioaddr +GMAC_HW_FEATURE1 ); dma_cap->l3l4fnum = (hw_cap &GMAC_HW_FEAT_L3L4FNUM ) >>27 ;
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +1 -0
@@ -107,6 +107,7 @@#define XGMAC_HWFEAT_VXN BIT(29)#define XGMAC_HWFEAT_SAVLANINS BIT(27)#define XGMAC_HWFEAT_TSSTSSEL GENMASK(26, 25) +#define XGMAC_HWFEAT_PHYSEL GENMASK(24, 23)#define XGMAC_HWFEAT_ADDMACADRSEL GENMASK(22, 18)#define XGMAC_HWFEAT_RXCOESEL BIT(16)#define XGMAC_HWFEAT_TXCOESEL BIT(14)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +1 -0
@@ -364,6 +364,7 @@ static int dwxgmac2_get_hw_feature(void __iomem *ioaddr, dma_cap->vxn = (hw_cap &XGMAC_HWFEAT_VXN ) >>29 ; dma_cap->vlins = (hw_cap &XGMAC_HWFEAT_SAVLANINS ) >>27 ; dma_cap->tssrc = (hw_cap &XGMAC_HWFEAT_TSSTSSEL ) >>25 ; + dma_cap->actphyif =FIELD_GET (XGMAC_HWFEAT_PHYSEL , hw_cap); dma_cap->multi_addr = (hw_cap &XGMAC_HWFEAT_ADDMACADRSEL ) >>18 ; dma_cap->rx_coe = (hw_cap &XGMAC_HWFEAT_RXCOESEL ) >>16 ; dma_cap->tx_coe = (hw_cap &XGMAC_HWFEAT_TXCOESEL ) >>14 ;
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +52 -0
70 lines not on this page · raw message
Signature · 1 line
2.47.3
kernel test robot
build botkernel test robot noticed the following build warnings:
Hi Russell,
kernel test robot noticed the following build warnings:
[auto build test WARNING on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Russell-King-Oracle/net-stmmac-report-active-PHY-interface/20260126-201908 base: net-next/main patch link: https://lore.kernel.org/r/E1vkLXO-00000005uxQ-31ZV%40rmk-PC.armlinux.org.uk patch subject: [PATCH net-next] net: stmmac: report active PHY interface config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20260127/[email protected]/config) compiler: m68k-linux-gcc (GCC) 15.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260127/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/net/ethernet/stmicro/stmmac/dwmac-thead.c:41:10: warning: 'PHY_INTF_RGMII' redefined
41 | #define PHY_INTF_RGMII FIELD_PREP(PHY_INTF_MASK, 1)
| ^~~~~~~~~~~~~~ In file included from drivers/net/ethernet/stmicro/stmmac/stmmac.h:20,
from drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h:12,
from drivers/net/ethernet/stmicro/stmmac/dwmac-thead.c:17:
drivers/net/ethernet/stmicro/stmmac/common.h:328:9: note: this is the location of the previous definition
328 | #define PHY_INTF_RGMII 1
| ^~~~~~~~~~~~~~
vim +/PHY_INTF_RGMII +41 drivers/net/ethernet/stmicro/stmmac/dwmac-thead.c
33a1a01e3afa72 Jisheng Zhang 2024-11-03 18 33a1a01e3afa72 Jisheng Zhang 2024-11-03 19 #define GMAC_CLK_EN 0x00 33a1a01e3afa72 Jisheng Zhang 2024-11-03 20 #define GMAC_TX_CLK_EN BIT(1) 33a1a01e3afa72 Jisheng Zhang 2024-11-03 21 #define GMAC_TX_CLK_N_EN BIT(2) 33a1a01e3afa72 Jisheng Zhang 2024-11-03 22 #define GMAC_TX_CLK_OUT_EN BIT(3) 33a1a01e3afa72 Jisheng Zhang 2024-11-03 23 #define GMAC_RX_CLK_EN BIT(4) 33a1a01e3afa72 Jisheng Zhang 2024-11-03 24 #define GMAC_RX_CLK_N_EN BIT(5) 33a1a01e3afa72 Jisheng Zhang 2024-11-03 25 #define GMAC_EPHY_REF_CLK_EN BIT(6) 33a1a01e3afa72 Jisheng Zhang 2024-11-03 26 #define GMAC_RXCLK_DELAY_CTRL 0x04 33a1a01e3afa72 Jisheng Zhang 2024-11-03 27 #define GMAC_RXCLK_BYPASS BIT(15) 33a1a01e3afa72 Jisheng Zhang 2024-11-03 28 #define GMAC_RXCLK_INVERT BIT(14) 33a1a01e3afa72 Jisheng Zhang 2024-11-03 29 #define GMAC_RXCLK_DELAY GENMASK(4, 0) 33a1a01e3afa72 Jisheng Zhang 2024-11-03 30 #define GMAC_TXCLK_DELAY_CTRL 0x08 33a1a01e3afa72 Jisheng Zhang 2024-11-03 31 #define GMAC_TXCLK_BYPASS BIT(15) 33a1a01e3afa72 Jisheng Zhang 2024-11-03 32 #define GMAC_TXCLK_INVERT BIT(14) 33a1a01e3afa72 Jisheng Zhang 2024-11-03 33 #define GMAC_TXCLK_DELAY GENMASK(4, 0) 33a1a01e3afa72 Jisheng Zhang 2024-11-03 34 #define GMAC_PLLCLK_DIV 0x0c 33a1a01e3afa72 Jisheng Zhang 2024-11-03 35 #define GMAC_PLLCLK_DIV_EN BIT(31) 33a1a01e3afa72 Jisheng Zhang 2024-11-03 36 #define GMAC_PLLCLK_DIV_NUM GENMASK(7, 0) 33a1a01e3afa72 Jisheng Zhang 2024-11-03 37 #define GMAC_GTXCLK_SEL 0x18 33a1a01e3afa72 Jisheng Zhang 2024-11-03 38 #define GMAC_GTXCLK_SEL_PLL BIT(0) 33a1a01e3afa72 Jisheng Zhang 2024-11-03 39 #define GMAC_INTF_CTRL 0x1c 33a1a01e3afa72 Jisheng Zhang 2024-11-03 40 #define PHY_INTF_MASK BIT(0) 33a1a01e3afa72 Jisheng Zhang 2024-11-03 @41 #define PHY_INTF_RGMII FIELD_PREP(PHY_INTF_MASK, 1) 33a1a01e3afa72 Jisheng Zhang 2024-11-03 42 #define PHY_INTF_MII_GMII FIELD_PREP(PHY_INTF_MASK, 0) 33a1a01e3afa72 Jisheng Zhang 2024-11-03 43 #define GMAC_TXCLK_OEN 0x20 33a1a01e3afa72 Jisheng Zhang 2024-11-03 44 #define TXCLK_DIR_MASK BIT(0) 33a1a01e3afa72 Jisheng Zhang 2024-11-03 45 #define TXCLK_DIR_OUTPUT FIELD_PREP(TXCLK_DIR_MASK, 0) 33a1a01e3afa72 Jisheng Zhang 2024-11-03 46 #define TXCLK_DIR_INPUT FIELD_PREP(TXCLK_DIR_MASK, 1)
33a1a01e3afa72 Jisheng Zhang 2024-11-03 47
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botkernel test robot noticed the following build warnings:
Hi Russell,
kernel test robot noticed the following build warnings:
[auto build test WARNING on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Russell-King-Oracle/net-stmmac-report-active-PHY-interface/20260126-201908 base: net-next/main patch link: https://lore.kernel.org/r/E1vkLXO-00000005uxQ-31ZV%40rmk-PC.armlinux.org.uk patch subject: [PATCH net-next] net: stmmac: report active PHY interface config: riscv-defconfig (https://download.01.org/0day-ci/archive/20260127/[email protected]/config) compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 9b8addffa70cee5b2acc5454712d9cf78ce45710) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260127/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/net/ethernet/stmicro/stmmac/dwmac-thead.c:41:10: warning: 'PHY_INTF_RGMII' macro redefined [-Wmacro-redefined]
41 | #define PHY_INTF_RGMII FIELD_PREP(PHY_INTF_MASK, 1)
| ^ drivers/net/ethernet/stmicro/stmmac/common.h:328:9: note: previous definition is here
328 | #define PHY_INTF_RGMII 1
| ^
1 warning generated.
vim +/PHY_INTF_RGMII +41 drivers/net/ethernet/stmicro/stmmac/dwmac-thead.c
33a1a01e3afa724 Jisheng Zhang 2024-11-03 18 33a1a01e3afa724 Jisheng Zhang 2024-11-03 19 #define GMAC_CLK_EN 0x00 33a1a01e3afa724 Jisheng Zhang 2024-11-03 20 #define GMAC_TX_CLK_EN BIT(1) 33a1a01e3afa724 Jisheng Zhang 2024-11-03 21 #define GMAC_TX_CLK_N_EN BIT(2) 33a1a01e3afa724 Jisheng Zhang 2024-11-03 22 #define GMAC_TX_CLK_OUT_EN BIT(3) 33a1a01e3afa724 Jisheng Zhang 2024-11-03 23 #define GMAC_RX_CLK_EN BIT(4) 33a1a01e3afa724 Jisheng Zhang 2024-11-03 24 #define GMAC_RX_CLK_N_EN BIT(5) 33a1a01e3afa724 Jisheng Zhang 2024-11-03 25 #define GMAC_EPHY_REF_CLK_EN BIT(6) 33a1a01e3afa724 Jisheng Zhang 2024-11-03 26 #define GMAC_RXCLK_DELAY_CTRL 0x04 33a1a01e3afa724 Jisheng Zhang 2024-11-03 27 #define GMAC_RXCLK_BYPASS BIT(15) 33a1a01e3afa724 Jisheng Zhang 2024-11-03 28 #define GMAC_RXCLK_INVERT BIT(14) 33a1a01e3afa724 Jisheng Zhang 2024-11-03 29 #define GMAC_RXCLK_DELAY GENMASK(4, 0) 33a1a01e3afa724 Jisheng Zhang 2024-11-03 30 #define GMAC_TXCLK_DELAY_CTRL 0x08 33a1a01e3afa724 Jisheng Zhang 2024-11-03 31 #define GMAC_TXCLK_BYPASS BIT(15) 33a1a01e3afa724 Jisheng Zhang 2024-11-03 32 #define GMAC_TXCLK_INVERT BIT(14) 33a1a01e3afa724 Jisheng Zhang 2024-11-03 33 #define GMAC_TXCLK_DELAY GENMASK(4, 0) 33a1a01e3afa724 Jisheng Zhang 2024-11-03 34 #define GMAC_PLLCLK_DIV 0x0c 33a1a01e3afa724 Jisheng Zhang 2024-11-03 35 #define GMAC_PLLCLK_DIV_EN BIT(31) 33a1a01e3afa724 Jisheng Zhang 2024-11-03 36 #define GMAC_PLLCLK_DIV_NUM GENMASK(7, 0) 33a1a01e3afa724 Jisheng Zhang 2024-11-03 37 #define GMAC_GTXCLK_SEL 0x18 33a1a01e3afa724 Jisheng Zhang 2024-11-03 38 #define GMAC_GTXCLK_SEL_PLL BIT(0) 33a1a01e3afa724 Jisheng Zhang 2024-11-03 39 #define GMAC_INTF_CTRL 0x1c 33a1a01e3afa724 Jisheng Zhang 2024-11-03 40 #define PHY_INTF_MASK BIT(0) 33a1a01e3afa724 Jisheng Zhang 2024-11-03 @41 #define PHY_INTF_RGMII FIELD_PREP(PHY_INTF_MASK, 1) 33a1a01e3afa724 Jisheng Zhang 2024-11-03 42 #define PHY_INTF_MII_GMII FIELD_PREP(PHY_INTF_MASK, 0) 33a1a01e3afa724 Jisheng Zhang 2024-11-03 43 #define GMAC_TXCLK_OEN 0x20 33a1a01e3afa724 Jisheng Zhang 2024-11-03 44 #define TXCLK_DIR_MASK BIT(0) 33a1a01e3afa724 Jisheng Zhang 2024-11-03 45 #define TXCLK_DIR_OUTPUT FIELD_PREP(TXCLK_DIR_MASK, 0) 33a1a01e3afa724 Jisheng Zhang 2024-11-03 46 #define TXCLK_DIR_INPUT FIELD_PREP(TXCLK_DIR_MASK, 1)
33a1a01e3afa724 Jisheng Zhang 2024-11-03 47
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki