openwrt/target/linux/layerscape/patches-5.4/701-net-0036-sdk-dpa-use-netdev-dev-for-DMA-mapping.patch
Yangbo Lu cddd459140 layerscape: add patches-5.4
Add patches for linux-5.4. The patches are from NXP LSDK-20.04 release
which was tagged LSDK-20.04-V5.4.
https://source.codeaurora.org/external/qoriq/qoriq-components/linux/

For boards LS1021A-IOT, and Traverse-LS1043 which are not involved in
LSDK, port the dts patches from 4.14.

The patches are sorted into the following categories:
  301-arch-xxxx
  302-dts-xxxx
  303-core-xxxx
  701-net-xxxx
  801-audio-xxxx
  802-can-xxxx
  803-clock-xxxx
  804-crypto-xxxx
  805-display-xxxx
  806-dma-xxxx
  807-gpio-xxxx
  808-i2c-xxxx
  809-jailhouse-xxxx
  810-keys-xxxx
  811-kvm-xxxx
  812-pcie-xxxx
  813-pm-xxxx
  814-qe-xxxx
  815-sata-xxxx
  816-sdhc-xxxx
  817-spi-xxxx
  818-thermal-xxxx
  819-uart-xxxx
  820-usb-xxxx
  821-vfio-xxxx

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2020-05-07 12:53:06 +02:00

122 lines
3.9 KiB
Diff

From e1ae30545347709590bab5f4a3c27e7f639c6ead Mon Sep 17 00:00:00 2001
From: Madalin Bucur <madalin.bucur@nxp.com>
Date: Wed, 18 Oct 2017 19:36:59 +0300
Subject: [PATCH] sdk: dpa: use netdev dev for DMA mapping
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
---
drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.c | 2 +-
.../ethernet/freescale/sdk_dpaa/dpaa_eth_base.c | 2 +-
.../ethernet/freescale/sdk_dpaa/dpaa_eth_common.c | 35 ++++------------------
.../ethernet/freescale/sdk_dpaa/dpaa_eth_common.h | 2 +-
4 files changed, 9 insertions(+), 32 deletions(-)
--- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.c
@@ -875,7 +875,7 @@ static int dpa_priv_bp_create(struct net
for (i = 0; i < count; i++) {
int err;
- err = dpa_bp_alloc(&dpa_bp[i]);
+ err = dpa_bp_alloc(&dpa_bp[i], net_dev->dev.parent);
if (err < 0) {
dpa_bp_free(priv);
priv->dpa_bp = NULL;
--- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_base.c
+++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_base.c
@@ -176,7 +176,7 @@ int dpa_bp_create(struct net_device *net
for (i = 0; i < count; i++) {
int err;
- err = dpa_bp_alloc(&dpa_bp[i]);
+ err = dpa_bp_alloc(&dpa_bp[i], net_dev->dev.parent);
if (err < 0) {
dpa_bp_free(priv);
priv->dpa_bp = NULL;
--- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_common.c
+++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_common.c
@@ -686,11 +686,10 @@ void dpa_set_buffers_layout(struct mac_d
EXPORT_SYMBOL(dpa_set_buffers_layout);
int __attribute__((nonnull))
-dpa_bp_alloc(struct dpa_bp *dpa_bp)
+dpa_bp_alloc(struct dpa_bp *dpa_bp, struct device *dev)
{
int err;
struct bman_pool_params bp_params;
- struct platform_device *pdev;
if (dpa_bp->size == 0 || dpa_bp->config_count == 0) {
pr_err("Buffer pool is not properly initialized! Missing size or initial number of buffers");
@@ -723,44 +722,25 @@ dpa_bp_alloc(struct dpa_bp *dpa_bp)
dpa_bp->bpid = (uint8_t)bman_get_params(dpa_bp->pool)->bpid;
- pdev = platform_device_register_simple("dpaa_eth_bpool",
- dpa_bp->bpid, NULL, 0);
- if (IS_ERR(pdev)) {
- pr_err("platform_device_register_simple() failed\n");
- err = PTR_ERR(pdev);
- goto pdev_register_failed;
- }
- {
- struct dma_map_ops *ops = get_dma_ops(&pdev->dev);
- ops->dma_supported = NULL;
- }
- err = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(40));
+ err = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(40));
if (err) {
pr_err("dma_coerce_mask_and_coherent() failed\n");
- goto pdev_mask_failed;
+ goto bman_free_pool;
}
-#ifdef CONFIG_FMAN_ARM
- /* force coherency */
- pdev->dev.archdata.dma_coherent = true;
- arch_setup_dma_ops(&pdev->dev, 0, 0, NULL, true);
-#endif
- dpa_bp->dev = &pdev->dev;
+ dpa_bp->dev = dev;
if (dpa_bp->seed_cb) {
err = dpa_bp->seed_cb(dpa_bp);
if (err)
- goto pool_seed_failed;
+ goto bman_free_pool;
}
dpa_bpid2pool_map(dpa_bp->bpid, dpa_bp);
return 0;
-pool_seed_failed:
-pdev_mask_failed:
- platform_device_unregister(pdev);
-pdev_register_failed:
+bman_free_pool:
bman_free_pool(dpa_bp->pool);
return err;
@@ -822,9 +802,6 @@ _dpa_bp_free(struct dpa_bp *dpa_bp)
dpa_bp_array[bp->bpid] = NULL;
bman_free_pool(bp->pool);
-
- if (bp->dev)
- platform_device_unregister(to_platform_device(bp->dev));
}
void __cold __attribute__((nonnull))
--- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_common.h
+++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_common.h
@@ -163,7 +163,7 @@ void dpa_set_rx_mode(struct net_device *
void dpa_set_buffers_layout(struct mac_device *mac_dev,
struct dpa_buffer_layout_s *layout);
int __attribute__((nonnull))
-dpa_bp_alloc(struct dpa_bp *dpa_bp);
+dpa_bp_alloc(struct dpa_bp *dpa_bp, struct device *dev);
void __cold __attribute__((nonnull))
dpa_bp_free(struct dpa_priv_s *priv);
struct dpa_bp *dpa_bpid2pool(int bpid);