From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98CEEC433E0 for ; Wed, 27 Jan 2021 13:03:09 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 58D492079A for ; Wed, 27 Jan 2021 13:03:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 58D492079A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1RtJD+85ZY5zFnPyVKtDhtsLiNjWcLML9YkuRYO9JAw=; b=Ggf/ximHu+WAkrIsiM41+gEFt E3VBiuc7lFIB4llstlWU8vjHjzR/THO6N58SKwA5yON4Df2BOpGVnj0WF6sKTUXxQy/vOLVam3uEH B2oEYIY8kX+LyPVxtAGyz5FRUNmNz2woTQxn/F9gCYsVL2vaY961wqWLo9yQLEEFKJgauExwmXuvt KtA2YUcj6L9vSY9DiolAvTMcukAE9mMoZ6PtM145RPDn4lC+FA+gqIdxTiLH7me1buSU+r7tfecUZ AJ5CZ6jszWrGTnFrFbUehGN1UvCAog63qiH8auYdhuy5ahU18IalF2XY+nbpibK3hq3Ro8v4O5DzQ 9ByWRNiqw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l4kSR-0004Gv-8v; Wed, 27 Jan 2021 13:02:03 +0000 Received: from relay11.mail.gandi.net ([217.70.178.231]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l4kSO-0004Fk-NO for linux-arm-kernel@lists.infradead.org; Wed, 27 Jan 2021 13:02:01 +0000 Received: from aptenodytes (196.109.29.93.rev.sfr.net [93.29.109.196]) (Authenticated sender: paul.kocialkowski@bootlin.com) by relay11.mail.gandi.net (Postfix) with ESMTPSA id E0F3910000F; Wed, 27 Jan 2021 13:01:56 +0000 (UTC) Date: Wed, 27 Jan 2021 14:01:56 +0100 From: Paul Kocialkowski To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 1/2] of: device: Allow DMA range map to be set before of_dma_configure_id Message-ID: References: <20210115175831.1184260-1-paul.kocialkowski@bootlin.com> MIME-Version: 1.0 In-Reply-To: <20210115175831.1184260-1-paul.kocialkowski@bootlin.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210127_080200_953054_90459D4E X-CRM114-Status: GOOD ( 25.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jernej Skrabec , Daniel Vetter , Maxime Ripard , Chen-Yu Tsai , Rob Herring , Thomas Petazzoni , Frank Rowand Content-Type: multipart/mixed; boundary="===============1495664814514371166==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============1495664814514371166== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Y50gX4HMZh5UW8il" Content-Disposition: inline --Y50gX4HMZh5UW8il Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. >=20 > 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). >=20 > As a result, the dma_range_map was always overwritten and the mechanism > could not correctly take effect. >=20 > 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.15= 530-1-yong.wu@mediatek.com/ Paul > Fixes: b4bdc4fbf8d0 ("soc: sunxi: Deal with the MBUS DMA offsets in a cen= tral place") > Signed-off-by: Paul Kocialkowski > --- > drivers/of/device.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) >=20 > 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 d= evice_node *np, > =20 > arch_setup_dma_ops(dev, dma_start, size, iommu, coherent); > =20 > - dev->dma_range_map =3D map; > + if (!dev->dma_range_map) { > + dev->dma_range_map =3D 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); > --=20 > 2.30.0 >=20 --=20 Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com --Y50gX4HMZh5UW8il Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEJZpWjZeIetVBefti3cLmz3+fv9EFAmARZEQACgkQ3cLmz3+f v9GJ4Af/addS8U7AjGXOW//0Aerp8AOTyKd8dlzqnoFR9K3CmoS6UDRBy6Ha5gG5 AQa+JC44HwACPrON49EBdI6spbf2VeuODIL7eM9LWYPEgjM6BWwMA+tIwF2deWMM KU7LYJP91VG3vSeb9n4YfbHDmWMbtbV8GS/Pka7qQbx/L0DZ20HvGqh+YVEhk2tm 3NRVlwWEvrMYRSeaxmdjMM5FSysuJYT3TdymPqgwwkDo8wsXOrXpflU+lkZl/6r2 XxstkhAm9ff79Le01DqYz43n+oDlIhIWaaxzpz12j+TJvyRwu6igIOC8PbsA3aeW Ze0sW5qbbX6jU3K/SM4qfXgYQxR1aA== =HeCq -----END PGP SIGNATURE----- --Y50gX4HMZh5UW8il-- --===============1495664814514371166== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============1495664814514371166==--