Skip to content

Commit

Permalink
net: stmmac: Add HW descriptor prefetch setting for DWMAC Core 5.20 o…
Browse files Browse the repository at this point in the history
…nwards

DWMAC Core 5.20 onwards supports HW descriptor prefetching.
Additionally, it also depends on platform specific RTL configuration.
This capability could be enabled by setting DMA_Mode bit-19 (DCHE).

So, to enable this cability, platform must set plat->dma_cfg->dche = true
and the DWMAC core version must be 5.20 onwards. Else, this capability
wouldn`t be configured

Signed-off-by: Mohammad Athari Bin Ismail <mohammad.athari.ismail@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Mohammad Athari Bin Ismail authored and David S. Miller committed Apr 22, 2021
1 parent 79ebfb1 commit 96874c6
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions drivers/net/ethernet/stmicro/stmmac/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#define DWMAC_CORE_4_10 0x41
#define DWMAC_CORE_5_00 0x50
#define DWMAC_CORE_5_10 0x51
#define DWMAC_CORE_5_20 0x52
#define DWXGMAC_CORE_2_10 0x21
#define DWXLGMAC_CORE_2_00 0x20

Expand Down
10 changes: 8 additions & 2 deletions drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,18 @@ static void dwmac4_dma_init(void __iomem *ioaddr,

writel(value, ioaddr + DMA_SYS_BUS_MODE);

value = readl(ioaddr + DMA_BUS_MODE);

if (dma_cfg->multi_msi_en) {
value = readl(ioaddr + DMA_BUS_MODE);
value &= ~DMA_BUS_MODE_INTM_MASK;
value |= (DMA_BUS_MODE_INTM_MODE1 << DMA_BUS_MODE_INTM_SHIFT);
writel(value, ioaddr + DMA_BUS_MODE);
}

if (dma_cfg->dche)
value |= DMA_BUS_MODE_DCHE;

writel(value, ioaddr + DMA_BUS_MODE);

}

static void _dwmac4_dump_dma_regs(void __iomem *ioaddr, u32 channel,
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#define DMA_TBS_CTRL 0x00001050

/* DMA Bus Mode bitmap */
#define DMA_BUS_MODE_DCHE BIT(19)
#define DMA_BUS_MODE_INTM_MASK GENMASK(17, 16)
#define DMA_BUS_MODE_INTM_SHIFT 16
#define DMA_BUS_MODE_INTM_MODE1 0x1
Expand Down
5 changes: 5 additions & 0 deletions drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6849,6 +6849,11 @@ int stmmac_dvr_probe(struct device *device,
if (ret)
goto error_hw_init;

/* Only DWMAC core version 5.20 onwards supports HW descriptor prefetch.
*/
if (priv->synopsys_id < DWMAC_CORE_5_20)
priv->plat->dma_cfg->dche = false;

stmmac_check_ether_addr(priv);

ndev->netdev_ops = &stmmac_netdev_ops;
Expand Down
1 change: 1 addition & 0 deletions include/linux/stmmac.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ struct stmmac_dma_cfg {
bool aal;
bool eame;
bool multi_msi_en;
bool dche;
};

#define AXI_BLEN 7
Expand Down

0 comments on commit 96874c6

Please sign in to comment.