[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YBFkRGMlcyPGKKNT@aptenodytes>
Date: Wed, 27 Jan 2021 14:01:56 +0100
From: Paul Kocialkowski <paul.kocialkowski@...tlin.com>
To: devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org
Cc: Rob Herring <robh+dt@...nel.org>,
Frank Rowand <frowand.list@...il.com>,
Maxime Ripard <mripard@...nel.org>,
Chen-Yu Tsai <wens@...e.org>,
Jernej Skrabec <jernej.skrabec@...l.net>,
Daniel Vetter <daniel.vetter@...ll.ch>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH 1/2] of: device: Allow DMA range map to be set before
of_dma_configure_id
Hi,
On Fri 15 Jan 21, 18:58, Paul Kocialkowski wrote:
> A mechanism was recently introduced for the sunxi architecture where
> the DMA offset for specific devices (under the MBUS) is set by a common
> driver (sunxi_mbus). This driver calls dma_direct_set_offset to set
> the device's dma_range_map manually.
>
> However this information was overwritten by of_dma_configure_id, which
> obtains the map from of_dma_get_range (or keeps it NULL when it fails
> and the force_dma argument is true, which is the case for platform
> devices).
>
> As a result, the dma_range_map was always overwritten and the mechanism
> could not correctly take effect.
>
> This adds a check to ensure that no previous DMA range map is
> overwritten and prints a warning when the map was already set while
> also being available from dt. In this case, the map that was already
> set is kept.
FYI this patch has been superseded by the following:
https://patchwork.kernel.org/project/linux-mediatek/patch/20210119105203.15530-1-yong.wu@mediatek.com/
Paul
> Fixes: b4bdc4fbf8d0 ("soc: sunxi: Deal with the MBUS DMA offsets in a central place")
> Signed-off-by: Paul Kocialkowski <paul.kocialkowski@...tlin.com>
> ---
> drivers/of/device.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/of/device.c b/drivers/of/device.c
> index aedfaaafd3e7..db1b8634c2c7 100644
> --- a/drivers/of/device.c
> +++ b/drivers/of/device.c
> @@ -181,7 +181,14 @@ int of_dma_configure_id(struct device *dev, struct device_node *np,
>
> arch_setup_dma_ops(dev, dma_start, size, iommu, coherent);
>
> - dev->dma_range_map = map;
> + if (!dev->dma_range_map) {
> + dev->dma_range_map = map;
> + } else if (map) {
> + dev_warn(dev,
> + "DMA range map was already set, ignoring range map from dt\n");
> + kfree(map);
> + }
> +
> return 0;
> }
> EXPORT_SYMBOL_GPL(of_dma_configure_id);
> --
> 2.30.0
>
--
Paul Kocialkowski, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists