From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932205AbcKHS4T (ORCPT ); Tue, 8 Nov 2016 13:56:19 -0500 Received: from up.free-electrons.com ([163.172.77.33]:55724 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751389AbcKHSyp (ORCPT ); Tue, 8 Nov 2016 13:54:45 -0500 Date: Tue, 8 Nov 2016 19:54:42 +0100 From: Maxime Ripard To: Hao Zhang Cc: wens@csie.org, dan.j.williams@intel.com, vinod.koul@intel.com, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v3 3/3] ARM: dmaengine: sun6i: share the dma driver with sun50i Message-ID: <20161108185442.oyywmgrvmqomnqe6@lukather> References: <20161107182840.GA3711@arx12> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ajsdpbfll27zdq3x" Content-Disposition: inline In-Reply-To: <20161107182840.GA3711@arx12> User-Agent: Mutt/1.6.2-neo (2016-08-21) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --ajsdpbfll27zdq3x Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 08, 2016 at 02:28:40AM +0800, Hao Zhang wrote: > According to the datasheet, the dma of A64 support 8/16/32/64 bits > so, we can add the condition of device compatible in convert_buswidth > function and other place to determine the device whether is for A64, > and then accept the 8 bytes bus width to it. >=20 > Signed-off-by: Hao Zhang > --- > drivers/dma/sun6i-dma.c | 43 +++++++++++++++++++++++++++++++++---------- > 1 file changed, 33 insertions(+), 10 deletions(-) >=20 > diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c > index 8346199..8a95a1a 100644 > --- a/drivers/dma/sun6i-dma.c > +++ b/drivers/dma/sun6i-dma.c > @@ -247,13 +247,17 @@ static inline s8 convert_burst(u32 maxburst) > } > } > =20 > -static inline s8 convert_buswidth(enum dma_slave_buswidth addr_width) > +static inline s8 convert_buswidth(enum dma_slave_buswidth addr_width, > + struct sun6i_dma_dev *sdev) > { > - if ((addr_width < DMA_SLAVE_BUSWIDTH_1_BYTE) || > - (addr_width > DMA_SLAVE_BUSWIDTH_4_BYTES)) > + if (((addr_width >=3D DMA_SLAVE_BUSWIDTH_1_BYTE) && > + (addr_width <=3D DMA_SLAVE_BUSWIDTH_4_BYTES)) || > + ((addr_width =3D=3D DMA_SLAVE_BUSWIDTH_8_BYTES) && > + (of_device_is_compatible(sdev->slave.dev->of_node, > + "allwinner,sun50i-a64-dma")))) > + return addr_width >> 1; > + else Just like for the burst (https://lkml.org/lkml/2016/10/4/367) I think this should be taken care of in the the framework's dmaengine_slave_config function. This is quite easy to do in the width case, since you just have to test whether what has been set in the dma_device has support for the burst give in the configuration. Maxime --=20 Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com --ajsdpbfll27zdq3x Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCAAGBQJYIh9uAAoJEBx+YmzsjxAgk00P/jZQghFqa/cOg2MJcqzufksc W3FIVUogBr1ntY1YAtPrCb5heauQoAlbFgm7NmsmUwgoEn5CadLdG/1Nt1F9Rg3a mpNN6N63pFXsS/Q3UG5zXWeR1vCK0Rnj7/25O7sERSnW325FGwEU8MDaLxLjlwa0 G+Fr/o/DyqoYqc+Sr0WUMt45SOo/1ANwwh3EbE2AN40LWhahZzOmdUlho4vSPbbA K98rCcYxl6sLS6NW/PeGXhJH9jCywQnppZdc/+nCmLgkDP6gAOq7hTirEWZ8E0o/ 87Vmw6F+geqDzuLg27dLNMrovNIdOuRcTiWx/IyUXP14HvecNcbOuEuP6YithFh+ KyEj5+V1cqqZj4IU0KxA1CrhOpsEstlnGGoVR/K8DRtnTU9bAMCuYPR4AJYPd5pW w8qfHEPQQSj4tzdbwHVJX+iGiTEMvqJrSdjDLvyxtQsy/0FWHJqmH1OMFak+3h/S Vj5jL9N8wQoILCTIop7aKh0SyXiPXfoudzde9W5oyvjMfNh7XX5gQpOa4uaVzZlU OWOBB2wJQX27zV7iWlwbFSGnUAvnsZMoapU9Wz1ikUJtnijBAxU4ZpnVbncnOPrJ L+tLlvHCqxWGs4ZkUHnmLeTA49Flcs0DbbjJKsjndUinvUZfOx4dGwnpI9DDG8++ giNhBIilspmYGw7JPr9c =0joe -----END PGP SIGNATURE----- --ajsdpbfll27zdq3x--