Move the call to stmmac_axi_blen_to_mask() out of the individual
MAC version drivers into the main code in stmmac_init_dma_engine(),
passing the resulting value through a new member, axi_blen_regval,
in the struct stmmac_axi structure.
There is now no need for stmmac_axi_blen_to_dma_mask() to use
u32p_replace_bits(), so use FIELD_PREP() instead.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1vLfLW-0000000FMb1-0zKV@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
* set). Note that the UNDEF bit is readonly, and is the inverse of
* Bus Mode bit 16.
*/
- stmmac_axi_blen_to_mask(&value, axi->axi_blen,
- ARRAY_SIZE(axi->axi_blen));
+ value = (value & ~DMA_AXI_BLEN_MASK) | axi->axi_blen_regval;
writel(value, ioaddr + DMA_AXI_BUS_MODE);
}
* set). Note that the UNDEF bit is readonly, and is the inverse of
* Bus Mode bit 16.
*/
- stmmac_axi_blen_to_mask(&value, axi->axi_blen,
- ARRAY_SIZE(axi->axi_blen));
+ value = (value & ~DMA_AXI_BLEN_MASK) | axi->axi_blen_regval;
writel(value, ioaddr + DMA_SYS_BUS_MODE);
}
* set). Note that the UNDEF bit is readonly, and is the inverse of
* Bus Mode bit 16.
*/
- stmmac_axi_blen_to_mask(&value, axi->axi_blen,
- ARRAY_SIZE(axi->axi_blen));
+ value = (value & ~DMA_AXI_BLEN_MASK) | axi->axi_blen_regval;
writel(value, ioaddr + XGMAC_DMA_SYSBUS_MODE);
writel(XGMAC_TDPS, ioaddr + XGMAC_TX_EDMA_CTRL);
val |= burst >> 2;
}
- u32p_replace_bits(regval, val, DMA_AXI_BLEN_MASK);
+ *regval = FIELD_PREP(DMA_AXI_BLEN_MASK, val);
}
/**
/* DMA Configuration */
stmmac_dma_init(priv, priv->ioaddr, priv->plat->dma_cfg);
- if (priv->plat->axi)
+ if (priv->plat->axi) {
+ /* Encode the AXI burst length to a register value */
+ stmmac_axi_blen_to_mask(&priv->plat->axi->axi_blen_regval,
+ priv->plat->axi->axi_blen, AXI_BLEN);
stmmac_axi(priv, priv->ioaddr, priv->plat->axi);
+ }
/* DMA CSR Channel configuration */
for (chan = 0; chan < dma_csr_ch; chan++) {
u32 axi_wr_osr_lmt;
u32 axi_rd_osr_lmt;
bool axi_kbbe;
+ u32 axi_blen_regval;
u32 axi_blen[AXI_BLEN];
bool axi_fb;
bool axi_mb;