diff options
author | Ramon Fried | 2019-07-16 22:04:35 +0300 |
---|---|---|
committer | Joe Hershberger | 2019-07-25 13:13:30 -0500 |
commit | ed3c64f1acc958a7ee1a97f23acda13105f89443 (patch) | |
tree | e2094e38decfa1fd513bc09384827ef6f1bc2133 /drivers | |
parent | 5a1899f9fcf46cc61f095408b17952d29e76cde5 (diff) |
net: macb: add dma_burst_length config
GEM support higher DMA burst writes/reads than the default (4).
add configuration structure with dma burst length so it could be
applied later to DMA configuration.
Signed-off-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Tested-by: Anup Patel <anup.patel@wdc.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/macb.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index cf76270ad82..dc6aa6deda8 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -82,6 +82,7 @@ struct macb_dma_desc { struct macb_device { void *regs; + unsigned int dma_burst_length; unsigned int rx_tail; unsigned int tx_head; @@ -118,6 +119,11 @@ struct macb_device { phy_interface_t phy_interface; #endif }; + +struct macb_config { + unsigned int dma_burst_length; +}; + #ifndef CONFIG_DM_ETH #define to_macb(_nd) container_of(_nd, struct macb_device, netdev) #endif @@ -1135,8 +1141,13 @@ static int macb_enable_clk(struct udevice *dev) } #endif +static const struct macb_config default_gem_config = { + .dma_burst_length = 16, +}; + static int macb_eth_probe(struct udevice *dev) { + const struct macb_config *macb_config; struct eth_pdata *pdata = dev_get_platdata(dev); struct macb_device *macb = dev_get_priv(dev); const char *phy_mode; @@ -1153,6 +1164,11 @@ static int macb_eth_probe(struct udevice *dev) macb->regs = (void *)pdata->iobase; + macb_config = (struct macb_config *)dev_get_driver_data(dev); + if (!macb_config) + macb_config = &default_gem_config; + + macb->dma_burst_length = macb_config->dma_burst_length; #ifdef CONFIG_CLK ret = macb_enable_clk(dev); if (ret) @@ -1213,12 +1229,16 @@ static int macb_eth_ofdata_to_platdata(struct udevice *dev) return macb_late_eth_ofdata_to_platdata(dev); } +static const struct macb_config sama5d4_config = { + .dma_burst_length = 4, +}; + static const struct udevice_id macb_eth_ids[] = { { .compatible = "cdns,macb" }, { .compatible = "cdns,at91sam9260-macb" }, { .compatible = "atmel,sama5d2-gem" }, { .compatible = "atmel,sama5d3-gem" }, - { .compatible = "atmel,sama5d4-gem" }, + { .compatible = "atmel,sama5d4-gem", .data = (ulong)&sama5d4_config }, { .compatible = "cdns,zynq-gem" }, { } }; |