Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751349AbdIAGEt (ORCPT ); Fri, 1 Sep 2017 02:04:49 -0400 Received: from mail.free-electrons.com ([62.4.15.54]:40356 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750965AbdIAGEr (ORCPT ); Fri, 1 Sep 2017 02:04:47 -0400 Date: Fri, 1 Sep 2017 08:04:45 +0200 From: Maxime Ripard To: Andre Przywara Cc: Stefan =?iso-8859-1?Q?Br=FCns?= , linux-sunxi@googlegroups.com, Chen-Yu Tsai , devicetree@vger.kernel.org, dmaengine@vger.kernel.org, Vinod Koul , Rob Herring , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] dmaengine: sun6i: Add support for Allwinner A64 Message-ID: <20170901060445.vboici7qxfkztp3s@flea> References: <20170830233609.13855-4-stefan.bruens@rwth-aachen.de> <20170901003135.10058-1-andre.przywara@arm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="vpmdrrlv5hiemtst" Content-Disposition: inline In-Reply-To: <20170901003135.10058-1-andre.przywara@arm.com> User-Agent: NeoMutt/20170714 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3880 Lines: 105 --vpmdrrlv5hiemtst Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 01, 2017 at 01:31:35AM +0100, Andre Przywara wrote: > Hi, >=20 > On 31/08/17 00:36, Stefan Br=FCns wrote: > > The A64 SoC has the same dma engine as the H3 (sun8i), with a > > reduced amount of physical channels. Add the proper config data > > and compatible string to support it. >=20 > ... >=20 > > diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c > > index 5f4eee4513e5..6a17c5d63582 100644 > > --- a/drivers/dma/sun6i-dma.c > > +++ b/drivers/dma/sun6i-dma.c > > @@ -1068,6 +1068,12 @@ static struct sun6i_dma_config sun8i_h3_dma_cfg = =3D { > > .nr_max_vchans =3D 34, > > .dmac_variant =3D DMAC_VARIANT_H3, > > }; > > + > > +static struct sun6i_dma_config sun50i_a64_dma_cfg =3D { > > + .nr_max_channels =3D 8, > > + .nr_max_requests =3D 27, > > + .nr_max_vchans =3D 38, > > + .dmac_variant =3D DMAC_VARIANT_H3, > > }; > > =20 > > static const struct of_device_id sun6i_dma_match[] =3D { > > @@ -1075,6 +1081,7 @@ static const struct of_device_id sun6i_dma_match[= ] =3D { > > { .compatible =3D "allwinner,sun8i-a23-dma", .data =3D &sun8i_a23_dma= _cfg }, > > { .compatible =3D "allwinner,sun8i-a83t-dma", .data =3D &sun8i_a83t_d= ma_cfg }, > > { .compatible =3D "allwinner,sun8i-h3-dma", .data =3D &sun8i_h3_dma_c= fg }, > > + { .compatible =3D "allwinner,sun50i-a64-dma", .data =3D &sun50i_a64_d= ma_cfg }, > > { /* sentinel */ } > > }; > > MODULE_DEVICE_TABLE(of, sun6i_dma_match); >=20 > I was wondering if should use the opportunity to expose those values as > DT properties instead of hard-wiring them to a compatible string in the > driver every time we add support for a new SoC? > We could introduce a new compatible string (say: "allwinner,sunxi-dma"), > then describe properties for the number of channels and requests and > vchans and parse those from the DT at probe time. > With this we might be able to support future SoCs without Linux *driver* > changes, by just providing the right DT. This would have worked already > for instance for the A83T support, which just changed those values. >=20 > For instance with this quick patch below (just compile tested, and without > your refactoring). > The DT node would then read something like: > dma: dma-controller@01c02000 { > compatible =3D "allwinner,sun50i-a64-dma", > "allwinner,sunxi-dma"; > reg =3D <0x01c02000 0x1000>; > interrupts =3D ; > clocks =3D <&ccu CLK_BUS_DMA>; > resets =3D <&ccu RST_BUS_DMA>; > #dma-cells =3D <1>; > allwinner,max_channels =3D <8>; > allwinner,max_requests =3D <27>; > allwinner,max_vchans =3D <38>; > }; We're still going to need a different compatible anyway, so it's not really like it would change anything. Maxime --=20 Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com --vpmdrrlv5hiemtst Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBAgAGBQJZqPh9AAoJEBx+YmzsjxAgdsIP/jNnKflxaeLhDEL3k/HXbxMv FELEKhYj/ezV9Idd3/vKics9EnIc6O5xjdTycYhnYtbgcQcCY6LgKvwRs1cL3f5M 16al3yYQUeEfFjiW6ml53mh5jFa1YwbgW2IkAsQ29TbL+8hJEfWKP41AXRhN2UR/ oPTOXvQu40Ec6etz0EjhERe8HhDaQeV75H7BS5h2VvojYlDvnIm+vXx0ZA2r1hP2 q1mRc93K8DAXfZiShSJKPdnq6p/SkO0hGviqDLzeepvwXvUwiUwTZ/Q0I5Rcl00+ +bXrRLLcu0HFG2lbJi5d9gTJ6hEu/XJvtlbr9Ap6JACawU5+dcRVB4qsbuDkYZS5 OsIG/HHTzGL6psOiN9PeGt8pPwNnsFK4F+B4V9dKvnrRZkIRzP0VXES28tk1ipX9 Te1pRN5+zPaGUmgz0WokErX+8YaaWS6BQRbef0gKTd55IjgSdSPYQCm7deUD3t4O JOv28sPSxWJ57QRwBNb5U7PThwvsCVdfVIvrfcRTcfv7pwGrL9cOswr0Ben4GmCh 0ZyJ7MGnmppbMakqDK35sHpYwQX7PuU11GKR0m34qxGzfDAS1w7riKkC3zC3QF28 MYJICzi5hfleQEdP/mjKWn9CwrVWHUAzSB9XWKpjuP0ixMObgaBrdxSdYt/19YR1 QA9QJnzIqTCoZnYaOgLF =gUmU -----END PGP SIGNATURE----- --vpmdrrlv5hiemtst--