Commit f119cc98 authored by Fugang Duan's avatar Fugang Duan Committed by David S. Miller

net: stmmac: overwrite the dma_cap.addr64 according to HW design

The current IP register MAC_HW_Feature1[ADDR64] only defines
32/40/64 bit width, but some SOCs support others like i.MX8MP
support 34 bits but it maps to 40 bits width in MAC_HW_Feature1[ADDR64].
So overwrite dma_cap.addr64 according to HW real design.

Fixes: 94abdad6 ("net: ethernet: dwmac: add ethernet glue logic for NXP imx8 chip")
Signed-off-by: default avatarFugang Duan <fugang.duan@nxp.com>
Signed-off-by: default avatarJoakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5f585913
...@@ -246,13 +246,7 @@ static int imx_dwmac_probe(struct platform_device *pdev) ...@@ -246,13 +246,7 @@ static int imx_dwmac_probe(struct platform_device *pdev)
goto err_parse_dt; goto err_parse_dt;
} }
ret = dma_set_mask_and_coherent(&pdev->dev, plat_dat->addr64 = dwmac->ops->addr_width;
DMA_BIT_MASK(dwmac->ops->addr_width));
if (ret) {
dev_err(&pdev->dev, "DMA mask set failed\n");
goto err_dma_mask;
}
plat_dat->init = imx_dwmac_init; plat_dat->init = imx_dwmac_init;
plat_dat->exit = imx_dwmac_exit; plat_dat->exit = imx_dwmac_exit;
plat_dat->fix_mac_speed = imx_dwmac_fix_speed; plat_dat->fix_mac_speed = imx_dwmac_fix_speed;
...@@ -272,7 +266,6 @@ static int imx_dwmac_probe(struct platform_device *pdev) ...@@ -272,7 +266,6 @@ static int imx_dwmac_probe(struct platform_device *pdev)
err_dwmac_init: err_dwmac_init:
err_drv_probe: err_drv_probe:
imx_dwmac_exit(pdev, plat_dat->bsp_priv); imx_dwmac_exit(pdev, plat_dat->bsp_priv);
err_dma_mask:
err_parse_dt: err_parse_dt:
err_match_data: err_match_data:
stmmac_remove_config_dt(pdev, plat_dat); stmmac_remove_config_dt(pdev, plat_dat);
......
...@@ -4945,6 +4945,14 @@ int stmmac_dvr_probe(struct device *device, ...@@ -4945,6 +4945,14 @@ int stmmac_dvr_probe(struct device *device,
dev_info(priv->device, "SPH feature enabled\n"); dev_info(priv->device, "SPH feature enabled\n");
} }
/* The current IP register MAC_HW_Feature1[ADDR64] only define
* 32/40/64 bit width, but some SOC support others like i.MX8MP
* support 34 bits but it map to 40 bits width in MAC_HW_Feature1[ADDR64].
* So overwrite dma_cap.addr64 according to HW real design.
*/
if (priv->plat->addr64)
priv->dma_cap.addr64 = priv->plat->addr64;
if (priv->dma_cap.addr64) { if (priv->dma_cap.addr64) {
ret = dma_set_mask_and_coherent(device, ret = dma_set_mask_and_coherent(device,
DMA_BIT_MASK(priv->dma_cap.addr64)); DMA_BIT_MASK(priv->dma_cap.addr64));
......
...@@ -170,6 +170,7 @@ struct plat_stmmacenet_data { ...@@ -170,6 +170,7 @@ struct plat_stmmacenet_data {
int unicast_filter_entries; int unicast_filter_entries;
int tx_fifo_size; int tx_fifo_size;
int rx_fifo_size; int rx_fifo_size;
u32 addr64;
u32 rx_queues_to_use; u32 rx_queues_to_use;
u32 tx_queues_to_use; u32 tx_queues_to_use;
u8 rx_sched_algorithm; u8 rx_sched_algorithm;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment