Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1495527

Re: [PATCH 01/14] dma: sun6i-dma: Add burst case of 4

From Maxime Ripard <maxime.ripard@free-electrons.com>
Newsgroups linux.kernel
Subject Re: [PATCH 01/14] dma: sun6i-dma: Add burst case of 4
Date 2016-10-04 19:00 +0200
Message-ID <soBeq-5lJ-13@gated-at.bofh.it> (permalink)
References <souwh-SP-1@gated-at.bofh.it> <souwh-SP-5@gated-at.bofh.it> <sovsl-1wy-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Tue, Oct 04, 2016 at 12:40:11PM +0200, Jean-Francois Moine wrote:
> On Tue,  4 Oct 2016 11:46:14 +0200
> Mylène Josserand <mylene.josserand@free-electrons.com> wrote:
> 
> > Add the case of a burst of 4 which is handled by the SoC.
> > 
> > Signed-off-by: Mylène Josserand <mylene.josserand@free-electrons.com>
> > ---
> >  drivers/dma/sun6i-dma.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
> > index 8346199..0485204 100644
> > --- a/drivers/dma/sun6i-dma.c
> > +++ b/drivers/dma/sun6i-dma.c
> > @@ -240,6 +240,8 @@ static inline s8 convert_burst(u32 maxburst)
> >  	switch (maxburst) {
> >  	case 1:
> >  		return 0;
> > +	case 4:
> > +		return 1;
> >  	case 8:
> >  		return 2;
> >  	default:
> > -- 
> > 2.9.3
> 
> This patch has already been rejected by Maxime in the threads
> 	http://www.spinics.net/lists/dmaengine/msg08610.html
> and
> 	http://www.spinics.net/lists/dmaengine/msg08719.html
> 
> I hope you will find the way he wants for this maxburst to be added.

I was talking about something along these lines (not tested):

-------8<---------
diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
index 83461994e418..573ac4608293 100644
--- a/drivers/dma/sun6i-dma.c
+++ b/drivers/dma/sun6i-dma.c
@@ -240,6 +240,8 @@ static inline s8 convert_burst(u32 maxburst)
 	switch (maxburst) {
 	case 1:
 		return 0;
+	case 4:
+		return 1;
 	case 8:
 		return 2;
 	default:
@@ -1110,11 +1112,19 @@ static int sun6i_dma_probe(struct platform_device *pdev)
 	sdc->slave.dst_addr_widths		= BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) |
 						  BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) |
 						  BIT(DMA_SLAVE_BUSWIDTH_4_BYTES);
+	sdc->slave.dst_bursts			= BIT(1) | BIT(8);
+	sdc->slave.src_bursts			= BIT(1) | BIT(8);
 	sdc->slave.directions			= BIT(DMA_DEV_TO_MEM) |
 						  BIT(DMA_MEM_TO_DEV);
 	sdc->slave.residue_granularity		= DMA_RESIDUE_GRANULARITY_BURST;
 	sdc->slave.dev = &pdev->dev;
 
+	if (of_device_is_compatible(pdev->dev.of_node,
+				    "allwinner,sun8i-h3-dma")) {
+		sdc->slave.dst_bursts |= BIT(4);
+		sdc->slave.src_bursts |= BIT(4);
+	}
+
 	sdc->pchans = devm_kcalloc(&pdev->dev, sdc->cfg->nr_max_channels,
 				   sizeof(struct sun6i_pchan), GFP_KERNEL);
 	if (!sdc->pchans)
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index cc535a478bae..f7bbec24bb58 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -673,6 +673,8 @@ struct dma_filter {
  * 	each type of direction, the dma controller should fill (1 <<
  * 	<TYPE>) and same should be checked by controller as well
  * @max_burst: max burst capability per-transfer
+ * @dst_bursts: bitfield of the available burst sizes for the destination
+ * @src_bursts: bitfield of the available burst sizes for the source
  * @residue_granularity: granularity of the transfer residue reported
  *	by tx_status
  * @device_alloc_chan_resources: allocate resources and return the
@@ -800,6 +802,14 @@ struct dma_device {
 static inline int dmaengine_slave_config(struct dma_chan *chan,
 					  struct dma_slave_config *config)
 {
+	if (config->src_maxburst && config->device->src_bursts &&
+	    !(BIT(config->src_maxburst) & config->device->src_bursts))
+		return -EINVAL;
+
+	if (config->dst_maxburst && config->device->dst_bursts &&
+	    !(BIT(config->dst_maxburst) & config->device->dst_bursts))
+		return -EINVAL;
+
 	if (chan->device->device_config)
 		return chan->device->device_config(chan, config);
-------8<------------ 

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/14] ASoc: sunxi: Add Allwinner A33 codec driver Mylène Josserand          <mylene.josserand@free-electrons.com> - 2016-10-04 11:50 +0200
  [PATCH 08/14] dt-bindings: sound: Add sun8i analog codec documentation Mylène Josserand          <mylene.josserand@free-electrons.com> - 2016-10-04 11:50 +0200
    Re: [PATCH 08/14] dt-bindings: sound: Add sun8i analog codec  documentation Mark Brown <broonie@kernel.org> - 2016-10-04 12:40 +0200
    Re: [PATCH 08/14] dt-bindings: sound: Add sun8i analog codec  documentation Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-10-04 18:30 +0200
      Re: [PATCH 08/14] dt-bindings: sound: Add sun8i analog codec documentation Chen-Yu Tsai <wens@csie.org> - 2016-10-05 05:10 +0200
        Re: [PATCH 08/14] dt-bindings: sound: Add sun8i analog codec  documentation Mylene Josserand <mylene.josserand@free-electrons.com> - 2016-10-05 14:10 +0200
  [PATCH 11/14] ARM: dts: sun8i: Add analog codec on prcm node Mylène Josserand          <mylene.josserand@free-electrons.com> - 2016-10-04 11:50 +0200
  [PATCH 01/14] dma: sun6i-dma: Add burst case of 4 Mylène Josserand          <mylene.josserand@free-electrons.com> - 2016-10-04 11:50 +0200
    Re: [PATCH 01/14] dma: sun6i-dma: Add burst case of 4 Jean-Francois Moine <moinejf@free.fr> - 2016-10-04 12:50 +0200
      Re: [PATCH 01/14] dma: sun6i-dma: Add burst case of 4 Thomas Petazzoni <thomas.petazzoni@free-electrons.com> - 2016-10-04 14:20 +0200
        Re: [PATCH 01/14] dma: sun6i-dma: Add burst case of 4 Jean-Francois Moine <moinejf@free.fr> - 2016-10-04 15:50 +0200
          Re: [PATCH 01/14] dma: sun6i-dma: Add burst case of 4 Vinod Koul <vinod.koul@intel.com> - 2016-10-04 17:40 +0200
      Re: [PATCH 01/14] dma: sun6i-dma: Add burst case of 4 Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-10-04 19:00 +0200
  [PATCH 13/14] ARM: dts: sun8i: parrot: Enable audio nodes Mylène Josserand          <mylene.josserand@free-electrons.com> - 2016-10-04 11:50 +0200
  [PATCH 10/14] dt-bindings: sound: Add sun8i audio card documentation Mylène Josserand          <mylene.josserand@free-electrons.com> - 2016-10-04 11:50 +0200
    Re: [PATCH 10/14] dt-bindings: sound: Add sun8i audio card  documentation Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-10-04 18:40 +0200
  [PATCH 12/14] ARM: dts: sun8i: Add audio codec, dai and card for A33 Mylène Josserand          <mylene.josserand@free-electrons.com> - 2016-10-04 11:50 +0200
  [PATCH 03/14] ASoC: sun4i-i2s: Add apb reset Mylène Josserand          <mylene.josserand@free-electrons.com> - 2016-10-04 11:50 +0200
    Re: [PATCH 03/14] ASoC: sun4i-i2s: Add apb reset Thomas Petazzoni <thomas.petazzoni@free-electrons.com> - 2016-10-04 14:20 +0200
      Re: [PATCH 03/14] ASoC: sun4i-i2s: Add apb reset Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-10-04 17:50 +0200
        Re: [PATCH 03/14] ASoC: sun4i-i2s: Add apb reset Mylene Josserand <mylene.josserand@free-electrons.com> - 2016-10-05 11:50 +0200
    Re: [PATCH 03/14] ASoC: sun4i-i2s: Add apb reset Code Kipper <codekipper@gmail.com> - 2016-10-04 14:30 +0200
  [PATCH 02/14] clk: ccu-sun8i-a33: Add CLK_SET_RATE_PARENT to ac-dig Mylène Josserand          <mylene.josserand@free-electrons.com> - 2016-10-04 12:00 +0200
    Re: [PATCH 02/14] clk: ccu-sun8i-a33: Add CLK_SET_RATE_PARENT to  ac-dig Thomas Petazzoni <thomas.petazzoni@free-electrons.com> - 2016-10-04 14:20 +0200
      Re: [PATCH 02/14] clk: ccu-sun8i-a33: Add CLK_SET_RATE_PARENT to  ac-dig Mylene Josserand <mylene.josserand@free-electrons.com> - 2016-10-05 11:40 +0200
  [PATCH 05/14] mfd: sun6i-prcm: Add sun8i analog codec as subnode Mylène Josserand          <mylene.josserand@free-electrons.com> - 2016-10-04 12:00 +0200
    Re: [PATCH 05/14] mfd: sun6i-prcm: Add sun8i analog codec as  subnode Jean-Francois Moine <moinejf@free.fr> - 2016-10-04 13:00 +0200
  [PATCH 04/14] ASoC: Add sun8i analog codec driver Mylène Josserand          <mylene.josserand@free-electrons.com> - 2016-10-04 12:00 +0200
    Re: [PATCH 04/14] ASoC: Add sun8i analog codec driver Code Kipper <codekipper@gmail.com> - 2016-10-04 12:30 +0200
      Re: [PATCH 04/14] ASoC: Add sun8i analog codec driver Chen-Yu Tsai <wens@csie.org> - 2016-10-04 13:00 +0200
  [PATCH 07/14] ASoC: Add sun8i audio card Mylène Josserand          <mylene.josserand@free-electrons.com> - 2016-10-04 12:00 +0200
    Re: [PATCH 07/14] ASoC: Add sun8i audio card Code Kipper <codekipper@gmail.com> - 2016-10-04 12:20 +0200
      Re: [PATCH 07/14] ASoC: Add sun8i audio card Chen-Yu Tsai <wens@csie.org> - 2016-10-04 13:10 +0200
    Re: [PATCH 07/14] ASoC: Add sun8i audio card Thomas Petazzoni <thomas.petazzoni@free-electrons.com> - 2016-10-04 14:30 +0200
    Re: [PATCH 07/14] ASoC: Add sun8i audio card Code Kipper <codekipper@gmail.com> - 2016-10-05 08:10 +0200
      Re: [PATCH 07/14] ASoC: Add sun8i audio card Jean-Francois Moine <moinejf@free.fr> - 2016-10-05 12:10 +0200
  [PATCH 06/14] ASoC: Add sun8i digital audio codec Mylène Josserand          <mylene.josserand@free-electrons.com> - 2016-10-04 12:00 +0200
    Re: [PATCH 06/14] ASoC: Add sun8i digital audio codec Thomas Petazzoni <thomas.petazzoni@free-electrons.com> - 2016-10-04 14:50 +0200
      Re: [PATCH 06/14] ASoC: Add sun8i digital audio codec Mark Brown <broonie@kernel.org> - 2016-10-04 15:10 +0200
        Re: [PATCH 06/14] ASoC: Add sun8i digital audio codec Thomas Petazzoni <thomas.petazzoni@free-electrons.com> - 2016-10-04 15:20 +0200
      Re: [PATCH 06/14] ASoC: Add sun8i digital audio codec Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-10-04 18:20 +0200
      Re: [PATCH 06/14] ASoC: Add sun8i digital audio codec Mylene Josserand <mylene.josserand@free-electrons.com> - 2016-10-05 14:00 +0200
    Re: [PATCH 06/14] ASoC: Add sun8i digital audio codec Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-10-04 18:20 +0200
      Re: [PATCH 06/14] ASoC: Add sun8i digital audio codec Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-10-06 20:30 +0200
  [PATCH 09/14] dt-bindings: sound: Add sun8i codec documentation Mylène Josserand          <mylene.josserand@free-electrons.com> - 2016-10-04 12:00 +0200
    Re: [PATCH 09/14] dt-bindings: sound: Add sun8i codec documentation Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-10-04 18:30 +0200

csiph-web