lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 17 Dec 2015 17:55:02 +0200
From:	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:	Måns Rullgård <mans@...sr.com>
Cc:	Tejun Heo <tj@...nel.org>, linux-ide@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find
 dma channel

On Thu, 2015-12-17 at 15:13 +0000, Måns Rullgård wrote:
> Andy Shevchenko <andriy.shevchenko@...ux.intel.com> writes:
> 
> > On Tue, 2015-12-15 at 23:34 +0000, Måns Rullgård wrote:
> > > Mans Rullgard <mans@...sr.com> writes:
> > > 
> > > > Currently this driver only works with a DesignWare DMA engine
> > > > which
> > > > it
> > > > registers manually using the second "reg" address range and
> > > > interrupt
> > > > number from the DT node.
> > > > 
> > > > This patch makes the driver instead use the "dmas" property if
> > > > present,
> > > > otherwise optionally falling back on the old way so existing
> > > > device
> > > > trees can continue to work.
> > > > 
> > > > With this change, there is no longer any reason to depend on
> > > > the
> > > > 460EX
> > > > machine type so drop that from Kconfig.
> > > > 
> > > > Signed-off-by: Mans Rullgard <mans@...sr.com>
> > > > ---
> > > >  drivers/ata/Kconfig          |  10 ++-
> > > >  drivers/ata/sata_dwc_460ex.c | 192
> > > > +++++++++++++++++++++++++++--
> > > > --------------
> > > >  2 files changed, 131 insertions(+), 71 deletions(-)
> > > 
> > > The corresponding patch for the canyonlands devicetree looks
> > > something
> > > like this.  I don't have any such hardware or even a manual, so I
> > > don't
> > > know what values to use for the various required DT properties of
> > > the
> > > DMA controller node, nor can I test it.  The SATA driver works
> > > with a
> > > different DMA controller on a Sigma Designs chip.
> > > 
> > > diff --git a/arch/powerpc/boot/dts/canyonlands.dts
> > > b/arch/powerpc/boot/dts/canyonlands.dts
> > > index 3dc75de..959f36e 100644
> > > --- a/arch/powerpc/boot/dts/canyonlands.dts
> > > +++ b/arch/powerpc/boot/dts/canyonlands.dts
> > > @@ -190,12 +190,22 @@
> > >  					 /* DMA */ 0x2 &UIC0 0xc
> > > 0x4>;
> > >  		};
> > >  
> > > +		DMA0: dma@...d0800 {
> > > +			compatible = "snps,dma-spear1340";
> > > +			reg = <4 0xbffd0800 0x400>;
> > > +			interrupt-parent = <&UIC3>;
> > > +			interrupts = <0x5 0x4>;
> > > +			#dma-cells = <3>;
> > > +			/* required properties here */
> > 
> > You have to move the master assignments and other custom dw_dmac
> > properties. Maybe at some point I will fix that in dw/platform.c.
> > 
> > > +		};
> 
> The current sata_dwc driver calls dw_dma_probe() with null pdata
> which
> causes the dw_dma driver to auto-detect most parameters.  It looks
> like
> simply omitting those properties here results in the same thing,
> although in this case dw_dma_parse_dt() leaves a devm-allocated pdata
> struct adrift.  Deferring the allocation of that and changing the DT
> binding doc to make these properties optional for auto-detect-capable
> hardware should just work.  

Yeah, I would like to allow autoconfiguration in case of DT as well and
translate it to use unified device property API.


> Something like this:

If it works for you, please, submit as a patch. Thanks.

> 
> diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c
> index 68a4815..f90c465 100644
> --- a/drivers/dma/dw/platform.c
> +++ b/drivers/dma/dw/platform.c
> @@ -103,18 +103,21 @@ dw_dma_parse_dt(struct platform_device *pdev)
>  	struct device_node *np = pdev->dev.of_node;
>  	struct dw_dma_platform_data *pdata;
>  	u32 tmp, arr[DW_DMA_MAX_NR_MASTERS];
> +	u32 nr_channels;
>  
>  	if (!np) {
>  		dev_err(&pdev->dev, "Missing DT data\n");
>  		return NULL;
>  	}
>  
> +	if (of_property_read_u32(np, "dma-channels", nr_channels))
> +		return NULL;
> +
>  	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata),
> GFP_KERNEL);
>  	if (!pdata)
>  		return NULL;
>  
> -	if (of_property_read_u32(np, "dma-channels", &pdata-
> >nr_channels))
> -		return NULL;
> +	pdata->nr_channels = nr_channels;
>  
>  	if (of_property_read_bool(np, "is_private"))
>  		pdata->is_private = true;
> 
> 

-- 
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Intel Finland Oy

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ