diff options
author | Thierry Reding <treding@nvidia.com> | 2017-03-10 17:34:58 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-03-12 23:35:20 -0700 |
commit | 11fbf811c8e8a11529214a494eab25e21ca86739 (patch) | |
tree | 003e80bff73a58ebd9ff3f144a3a1f068842c49b /drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | |
parent | 937071c171ff3656e196c965c5179ba3f9f6a2fc (diff) | |
download | linux-11fbf811c8e8a11529214a494eab25e21ca86739.tar.bz2 |
net: stmmac: Parse FIFO sizes from feature registers
New version of this core encode the FIFO sizes in one of the feature
registers. Use these sizes as default, but still allow device tree to
override them for backwards compatibility.
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c')
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c index f97b0d5d9987..55270933bae1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c @@ -294,6 +294,11 @@ static void dwmac4_get_hw_feature(void __iomem *ioaddr, hw_cap = readl(ioaddr + GMAC_HW_FEATURE1); dma_cap->av = (hw_cap & GMAC_HW_FEAT_AVSEL) >> 20; dma_cap->tsoen = (hw_cap & GMAC_HW_TSOEN) >> 18; + /* RX and TX FIFO sizes are encoded as log2(n / 128). Undo that by + * shifting and store the sizes in bytes. + */ + dma_cap->tx_fifo_size = 128 << ((hw_cap & GMAC_HW_TXFIFOSIZE) >> 6); + dma_cap->rx_fifo_size = 128 << ((hw_cap & GMAC_HW_RXFIFOSIZE) >> 0); /* MAC HW feature2 */ hw_cap = readl(ioaddr + GMAC_HW_FEATURE2); /* TX and RX number of channels */ |