devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org
To: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
	Lee Jones <lee-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Eric Anholt <eric-WhKQ6XTQaPysTnJN9+BGXg@public.gmane.org>,
	Russell King <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>,
	Dan Williams
	<dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Cc: Martin Sperl <kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
Subject: [PATCH 0/3] dmaengine: bcm2835: support dma channel 11 to 14
Date: Thu, 17 Mar 2016 15:24:30 +0000	[thread overview]
Message-ID: <1458228273-15591-1-git-send-email-kernel@martin.sperl.org> (raw)

From: Martin Sperl <kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>

Right now the dma engine officially supports dma channel 11 and 12.
But the use of dma channel 12 immediately stalls the system.

The reason is that the interrupt assigned right now to dma channel 11
is actually a shared interrupt for dma channels 11 to 12.
So whenever the dma channel 12, 13 or 14 is used, it triggers the interrupt
for dma 11 which only clears the interrupt flag for dma channel 11.
This results in the interrupt 11 is triggered all the time.

On top the requesting dma channel12 (and the corresponding irq) triggers
an immeditate stall of the system, because for the 12th interrupt
any dma channel will trigger also this interrupt - even if the dma channel
is controlled by the firmware.

As the description in the default device-tree is (for the above reasons)
wrong a new means had to get devised that allows correct representation
of the mapping between interrupts and dma channels.

For this the existing (but unused) device-tree property "interrupt-names"
is used to define the mapping.

Implementing shared interrupts is another necessity when using dma channel
11 to 14, so it is a part of this patch.

This patchset requires: [PATCH 0/8 v4] bcm2835 DMA slave support
to be applied.

Tested playing BigBuckBunny on:
* fb-tft device (fb_st7735r)
  - via spi-bcm2835 using slave_sg dma
* I2S Hifiberry DAC (snd_soc_hifiberry_dac)
  - via bcm2835-i2s using cyclic dma
(with a few pending patches to make i2s work propperly)

Interrupt statistics after playing Big Buck Bunny:
root@raspcm:~# cat /proc/interrupts
           CPU0
 17:          0  ARMCTRL-level   1 Edge      2000b880.mailbox
 27:      47685  ARMCTRL-level  35 Edge      timer
 33:    6042130  ARMCTRL-level  41 Edge      20980000.usb, dwc2_hsotg:usb1
 40:      13250  ARMCTRL-level  48 Edge      DMA IRQ
 42:      13250  ARMCTRL-level  50 Edge      DMA IRQ
 44:      19087  ARMCTRL-level  52 Edge      DMA IRQ
 45:          0  ARMCTRL-level  53 Edge      DMA IRQ
 73:          0  ARMCTRL-level  81 Edge      20200000.gpio:bank0
 74:          0  ARMCTRL-level  82 Edge      20200000.gpio:bank1
 77:          0  ARMCTRL-level  85 Edge      20205000.i2c, 20804000.i2c, 20805000.i2c
 78:          0  ARMCTRL-level  86 Edge      20204000.spi
 81:        708  ARMCTRL-level  89 Edge      uart-pl011
 86:     277629  ARMCTRL-level  94 Edge      mmc0
Err:          0

Tested also with the following property set:
  brcm,dma-channel-mask = <0x7800>;
which results in only dma channels 11-14 being available
and thus all using the single shared irq.

Interrupt statistics for this case:
           CPU0
 17:          0  ARMCTRL-level   1 Edge      2000b880.mailbox
 27:      46843  ARMCTRL-level  35 Edge      timer
 33:    5412801  ARMCTRL-level  41 Edge      20980000.usb, dwc2_hsotg:usb1
 51:      45502  ARMCTRL-level  59 Edge      DMA IRQ, DMA IRQ, DMA IRQ, DMA IRQ
 73:          0  ARMCTRL-level  81 Edge      20200000.gpio:bank0
 74:          0  ARMCTRL-level  82 Edge      20200000.gpio:bank1
 77:          0  ARMCTRL-level  85 Edge      20205000.i2c, 20804000.i2c, 20805000.i2c
 78:          0  ARMCTRL-level  86 Edge      20204000.spi
 81:        706  ARMCTRL-level  89 Edge      uart-pl011
 86:     297235  ARMCTRL-level  94 Edge      mmc0
Err:          0

Note that support for more interrupts than irq 0 to 14
is not implemented (and this value is also hard-coded).

Allowing dma channel 15 to get controlled well would require
further extensive changes to the device-tree (separate register region).

Also as mentioned above dma-channel 15 is used by the firmware
and is - for all practical purposes - not available to
the kernel.

Only when this situation changes a valid effort can get made.

One major concern here is the fact that we have no dedicated interrupt
for dma channel 15. There is only the "catch all" interrupt, which - as
mentioned above - also triggers for dma channels used by the firmware,
which leads to an unnecessary amount of interrupts and can result
in system lockups...

The only potential usage would be for dma transfers where we do
not need an interrupt, but that may require further changes
to the dmaengine and more to support correctly.

One such "candidate" for the use of dma channel 15 could be
the tx-dma of spi-bcm2835, as for this specifically we only need
to get the interrupt when the rx-dma finishes, but that is a
very special case.

Avoiding the interrupt for the spi-tx-dma is still something that
could get investigated in a different patch-set.

Martin Sperl (3):
  dt/bindings: bcm2835: add interrupt-names property
  dmaengine: bcm2835: use platform_get_irq_byname
  ARM: bcm2835: add interrupt-names and apply correct mapping

 .../devicetree/bindings/dma/brcm,bcm2835-dma.txt   | 24 +++++++
 arch/arm/boot/dts/bcm283x.dtsi                     | 22 ++++++-
 drivers/dma/bcm2835-dma.c                          | 77 ++++++++++++++++++----
 3 files changed, 108 insertions(+), 15 deletions(-)

--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2016-03-17 15:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-17 15:24 kernel-TqfNSX0MhmxHKSADF0wUEw [this message]
     [not found] ` <1458228273-15591-1-git-send-email-kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
2016-03-17 15:24   ` [PATCH 1/3] dt/bindings: bcm2835: add interrupt-names property kernel-TqfNSX0MhmxHKSADF0wUEw
     [not found]     ` <1458228273-15591-2-git-send-email-kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
2016-03-20  0:17       ` Rob Herring
2016-03-17 15:24   ` [PATCH 2/3] dmaengine: bcm2835: use platform_get_irq_byname kernel-TqfNSX0MhmxHKSADF0wUEw
2016-03-17 15:24   ` [PATCH 3/3] ARM: bcm2835: add interrupt-names and apply correct mapping kernel-TqfNSX0MhmxHKSADF0wUEw
2016-04-05 17:03   ` [PATCH 0/3] dmaengine: bcm2835: support dma channel 11 to 14 Vinod Koul
     [not found]     ` <20160405170336.GB5392-bQVUxfxUtC13uc1i7fC1zK2pdiUAq4bhAL8bYrjMMd8@public.gmane.org>
2016-04-08 18:37       ` Eric Anholt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1458228273-15591-1-git-send-email-kernel@martin.sperl.org \
    --to=kernel-tqfnsx0mhmxhksadf0wuew@public.gmane.org \
    --cc=dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=eric-WhKQ6XTQaPysTnJN9+BGXg@public.gmane.org \
    --cc=lee-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
    --cc=linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
    --cc=vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).