mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 02:53:36 +02:00
Merge branch 'net-stmmac-report-active-phy-interface'
Russell King says: ==================== net: stmmac: report active phy interface The original patch needs dwmac-thead fixed so the PHY_INTF* definitions do not clash. ==================== Link: https://patch.msgid.link/aXnpTy6XckPGcmg0@shell.armlinux.org.uk Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
08d8ba524c
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -37,9 +37,9 @@
|
|||
#define GMAC_GTXCLK_SEL 0x18
|
||||
#define GMAC_GTXCLK_SEL_PLL BIT(0)
|
||||
#define GMAC_INTF_CTRL 0x1c
|
||||
#define PHY_INTF_MASK BIT(0)
|
||||
#define PHY_INTF_RGMII FIELD_PREP(PHY_INTF_MASK, 1)
|
||||
#define PHY_INTF_MII_GMII FIELD_PREP(PHY_INTF_MASK, 0)
|
||||
#define GMAC_INTF_MASK BIT(0)
|
||||
#define GMAC_INTF_RGMII FIELD_PREP(GMAC_INTF_MASK, 1)
|
||||
#define GMAC_INTF_MII_GMII FIELD_PREP(GMAC_INTF_MASK, 0)
|
||||
#define GMAC_TXCLK_OEN 0x20
|
||||
#define TXCLK_DIR_MASK BIT(0)
|
||||
#define TXCLK_DIR_OUTPUT FIELD_PREP(TXCLK_DIR_MASK, 0)
|
||||
|
|
@ -58,13 +58,13 @@ static int thead_dwmac_set_phy_if(struct plat_stmmacenet_data *plat)
|
|||
|
||||
switch (plat->phy_interface) {
|
||||
case PHY_INTERFACE_MODE_MII:
|
||||
phyif = PHY_INTF_MII_GMII;
|
||||
phyif = GMAC_INTF_MII_GMII;
|
||||
break;
|
||||
case PHY_INTERFACE_MODE_RGMII:
|
||||
case PHY_INTERFACE_MODE_RGMII_ID:
|
||||
case PHY_INTERFACE_MODE_RGMII_TXID:
|
||||
case PHY_INTERFACE_MODE_RGMII_RXID:
|
||||
phyif = PHY_INTF_RGMII;
|
||||
phyif = GMAC_INTF_RGMII;
|
||||
break;
|
||||
default:
|
||||
dev_err(dwmac->dev, "unsupported phy interface %s\n",
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -127,6 +127,22 @@ static unsigned int chain_mode;
|
|||
module_param(chain_mode, int, 0444);
|
||||
MODULE_PARM_DESC(chain_mode, "To use chain instead of ring mode");
|
||||
|
||||
static const char *stmmac_dwmac_actphyif[8] = {
|
||||
[PHY_INTF_SEL_GMII_MII] = "GMII/MII",
|
||||
[PHY_INTF_SEL_RGMII] = "RGMII",
|
||||
[PHY_INTF_SEL_SGMII] = "SGMII",
|
||||
[PHY_INTF_SEL_TBI] = "TBI",
|
||||
[PHY_INTF_SEL_RMII] = "RMII",
|
||||
[PHY_INTF_SEL_RTBI] = "RTBI",
|
||||
[PHY_INTF_SEL_SMII] = "SMII",
|
||||
[PHY_INTF_SEL_REVMII] = "REVMII",
|
||||
};
|
||||
|
||||
static const char *stmmac_dwxgmac_phyif[4] = {
|
||||
[PHY_INTF_GMII] = "GMII",
|
||||
[PHY_INTF_RGMII] = "RGMII",
|
||||
};
|
||||
|
||||
static irqreturn_t stmmac_interrupt(int irq, void *dev_id);
|
||||
/* For MSI interrupts handling */
|
||||
static irqreturn_t stmmac_mac_interrupt(int irq, void *dev_id);
|
||||
|
|
@ -7270,6 +7286,40 @@ static void stmmac_service_task(struct work_struct *work)
|
|||
clear_bit(STMMAC_SERVICE_SCHED, &priv->state);
|
||||
}
|
||||
|
||||
static void stmmac_print_actphyif(struct stmmac_priv *priv)
|
||||
{
|
||||
const char **phyif_table;
|
||||
const char *actphyif_str;
|
||||
size_t phyif_table_size;
|
||||
|
||||
switch (priv->plat->core_type) {
|
||||
case DWMAC_CORE_MAC100:
|
||||
return;
|
||||
|
||||
case DWMAC_CORE_GMAC:
|
||||
case DWMAC_CORE_GMAC4:
|
||||
phyif_table = stmmac_dwmac_actphyif;
|
||||
phyif_table_size = ARRAY_SIZE(stmmac_dwmac_actphyif);
|
||||
break;
|
||||
|
||||
case DWMAC_CORE_XGMAC:
|
||||
phyif_table = stmmac_dwxgmac_phyif;
|
||||
phyif_table_size = ARRAY_SIZE(stmmac_dwxgmac_phyif);
|
||||
break;
|
||||
}
|
||||
|
||||
if (priv->dma_cap.actphyif < phyif_table_size)
|
||||
actphyif_str = phyif_table[priv->dma_cap.actphyif];
|
||||
else
|
||||
actphyif_str = NULL;
|
||||
|
||||
if (!actphyif_str)
|
||||
actphyif_str = "unknown";
|
||||
|
||||
dev_info(priv->device, "Active PHY interface: %s (%u)\n",
|
||||
actphyif_str, priv->dma_cap.actphyif);
|
||||
}
|
||||
|
||||
/**
|
||||
* stmmac_hw_init - Init the MAC device
|
||||
* @priv: driver private structure
|
||||
|
|
@ -7326,6 +7376,7 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
|
|||
else if (priv->dma_cap.rx_coe_type1)
|
||||
priv->plat->rx_coe = STMMAC_RX_COE_TYPE1;
|
||||
|
||||
stmmac_print_actphyif(priv);
|
||||
} else {
|
||||
dev_info(priv->device, "No HW DMA feature register supported\n");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user