mediatek: Add support for Xiaomi Redmi Router AX6S
[openwrt/openwrt.git] / target / linux / layerscape / patches-5.4 / 701-net-0092-dpaa_eth-base-dma-mappings-on-the-fman-rx-port.patch
1 From 13296e938da191216395952cf49ddda96e67359c Mon Sep 17 00:00:00 2001
2 From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
3 Date: Thu, 5 Apr 2018 12:37:57 +0300
4 Subject: [PATCH] dpaa_eth: base dma mappings on the fman rx port
5
6 The dma transactions initiator is the rx fman port so that's the device
7 that the dma mappings should be done. Previously the mappings were done
8 through the MAC device which makes no sense because it's neither dma-able
9 nor connected in any way to smmu.
10
11 Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
12 Acked-by: Madalin Bucur <madalin.bucur@nxp.com>
13 ---
14 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 18 +++++++++---------
15 1 file changed, 9 insertions(+), 9 deletions(-)
16
17 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
18 +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
19 @@ -2978,8 +2978,15 @@ static int dpaa_eth_probe(struct platfor
20 return -ENODEV;
21 }
22
23 + mac_dev = dpaa_mac_dev_get(pdev);
24 + if (IS_ERR(mac_dev)) {
25 + dev_err(&pdev->dev, "dpaa_mac_dev_get() failed\n");
26 + err = PTR_ERR(mac_dev);
27 + goto probe_err;
28 + }
29 +
30 /* device used for DMA mapping */
31 - dev = pdev->dev.parent;
32 + dev = fman_port_get_device(mac_dev->port[RX]);
33 err = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(40));
34 if (err) {
35 dev_err(dev, "dma_coerce_mask_and_coherent() failed\n");
36 @@ -3004,13 +3011,6 @@ static int dpaa_eth_probe(struct platfor
37
38 priv->msg_enable = netif_msg_init(debug, DPAA_MSG_DEFAULT);
39
40 - mac_dev = dpaa_mac_dev_get(pdev);
41 - if (IS_ERR(mac_dev)) {
42 - dev_err(dev, "dpaa_mac_dev_get() failed\n");
43 - err = PTR_ERR(mac_dev);
44 - goto free_netdev;
45 - }
46 -
47 /* If fsl_fm_max_frm is set to a higher value than the all-common 1500,
48 * we choose conservatively and let the user explicitly set a higher
49 * MTU via ifconfig. Otherwise, the user may end up with different MTUs
50 @@ -3146,9 +3146,9 @@ delete_egress_cgr:
51 qman_release_cgrid(priv->cgr_data.cgr.cgrid);
52 free_dpaa_bps:
53 dpaa_bps_free(priv);
54 -free_netdev:
55 dev_set_drvdata(dev, NULL);
56 free_netdev(net_dev);
57 +probe_err:
58
59 return err;
60 }