--- drivers/net/ethernet/stmicro/stmmac/dwmac5_fpe.c 2023-12-11 14:01:26.888400348 +0300 +++ drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core_fpe.c 2023-12-11 14:01:49.538644889 +0300 @@ -1,64 +1,64 @@ -#define MAC_FPE_CTRL_STS 0x00000234 -#define TRSP BIT(19) -#define TVER BIT(18) -#define RRSP BIT(17) -#define RVER BIT(16) -#define SRSP BIT(2) -#define SVER BIT(1) -#define EFPE BIT(0) - -#define GMAC_RXQ_CTRL0 0x000000a0 -#define GMAC_RXQ_CTRL1 0x000000a4 - -#define GMAC_RXQCTRL_FPRQ GENMASK(26, 24) -#define GMAC_RXQCTRL_FPRQ_SHIFT 24 - -void dwmac5_fpe_configure(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg, - u32 num_txq, u32 num_rxq, - bool enable) +#define XGMAC_FPE_CTRL_STS 0x00000280 +#define XGMAC_TRSP BIT(19) +#define XGMAC_TVER BIT(18) +#define XGMAC_RRSP BIT(17) +#define XGMAC_RVER BIT(16) +#define XGMAC_SRSP BIT(2) +#define XGMAC_SVER BIT(1) +#define XGMAC_EFPE BIT(0) + +#define XGMAC_RXQ_CTRL0 0x000000a0 +#define XGMAC_RXQ_CTRL1 0x000000a4 + +#define XGMAC_RQ GENMASK(7, 4) +#define XGMAC_RQ_SHIFT 4 + +static void dwxgmac3_fpe_configure(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg, + u32 num_txq, + u32 num_rxq, bool enable) { u32 value; if (enable) { - cfg->fpe_csr = EFPE; - value = readl(ioaddr + GMAC_RXQ_CTRL1); - value &= ~GMAC_RXQCTRL_FPRQ; - value |= (num_rxq - 1) << GMAC_RXQCTRL_FPRQ_SHIFT; - writel(value, ioaddr + GMAC_RXQ_CTRL1); + cfg->fpe_csr = XGMAC_EFPE; + value = readl(ioaddr + XGMAC_RXQ_CTRL1); + value &= ~XGMAC_RQ; + value |= (num_rxq - 1) << XGMAC_RQ_SHIFT; + writel(value, ioaddr + XGMAC_RXQ_CTRL1); } else { cfg->fpe_csr = 0; } - writel(cfg->fpe_csr, ioaddr + MAC_FPE_CTRL_STS); + writel(cfg->fpe_csr, ioaddr + XGMAC_FPE_CTRL_STS); } -int dwmac5_fpe_irq_status(void __iomem *ioaddr, struct net_device *dev) +static int dwxgmac3_fpe_irq_status(void __iomem *ioaddr, struct net_device *dev) { u32 value; int status; status = FPE_EVENT_UNKNOWN; - /* Reads from the MAC_FPE_CTRL_STS register should only be performed + /* Reads from the XGMAC_FPE_CTRL_STS register should only be performed * here, since the status flags of MAC_FPE_CTRL_STS are "clear on read" */ - value = readl(ioaddr + MAC_FPE_CTRL_STS); + value = readl(ioaddr + XGMAC_FPE_CTRL_STS); - if (value & TRSP) { + if (value & XGMAC_TRSP) { status |= FPE_EVENT_TRSP; netdev_info(dev, "FPE: Respond mPacket is transmitted\n"); } - if (value & TVER) { + if (value & XGMAC_TVER) { status |= FPE_EVENT_TVER; netdev_info(dev, "FPE: Verify mPacket is transmitted\n"); } - if (value & RRSP) { + if (value & XGMAC_RRSP) { status |= FPE_EVENT_RRSP; netdev_info(dev, "FPE: Respond mPacket is received\n"); } - if (value & RVER) { + if (value & XGMAC_RVER) { status |= FPE_EVENT_RVER; netdev_info(dev, "FPE: Verify mPacket is received\n"); } @@ -66,15 +66,15 @@ return status; } -void dwmac5_fpe_send_mpacket(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg, - enum stmmac_mpacket_type type) +static void dwxgmac3_fpe_send_mpacket(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg, + enum stmmac_mpacket_type type) { u32 value = cfg->fpe_csr; if (type == MPACKET_VERIFY) - value |= SVER; + value |= XGMAC_SVER; else if (type == MPACKET_RESPONSE) - value |= SRSP; + value |= XGMAC_SRSP; - writel(value, ioaddr + MAC_FPE_CTRL_STS); + writel(value, ioaddr + XGMAC_FPE_CTRL_STS); }