linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
To: Stefan Wahren <wahrenst@gmx.net>, Christoph Hellwig <hch@lst.de>
Cc: Eric Anholt <eric@anholt.net>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Ray Jui <rjui@broadcom.com>,
	Scott Branden <sbranden@broadcom.com>,
	Matthias Brugger <mbrugger@suse.com>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	bcm-kernel-feedback-list@broadcom.com,
	linux-arm-kernel@lists.infradead.org,
	linux-rpi-kernel@lists.infradead.org, linux-gpio@vger.kernel.org,
	linux-mmc@vger.kernel.org
Subject: Re: [PATCH 00/18] ARM: Add minimal Raspberry Pi 4 support
Date: Thu, 25 Jul 2019 10:22:40 +0200	[thread overview]
Message-ID: <c642de0a85d67f7f758735f1bba083156cca0ddb.camel@suse.de> (raw)
In-Reply-To: <5f9b11f54c66fd0487837f7e58af3adf7f86635f.camel@suse.de>

[-- Attachment #1: Type: text/plain, Size: 3455 bytes --]

> > > Any thoughts on this?
> > > 
> > > diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig
> > > index 5e5f1fabc3d4..3db8deed83a6 100644
> > > --- a/arch/arm/mach-bcm/Kconfig
> > > +++ b/arch/arm/mach-bcm/Kconfig
> > > @@ -168,6 +168,7 @@ config ARCH_BCM2835
> > >         select PINCTRL
> > >         select PINCTRL_BCM2835
> > >         select MFD_CORE
> > > +       select DMABOUNCE
> > >         help
> > >           This enables support for the Broadcom BCM2835 and BCM2836 SoCs.
> > >           This SoC is used in the Raspberry Pi and Roku 2 devices.
> > > diff --git a/arch/arm/mach-bcm/board_bcm2835.c b/arch/arm/mach-
> > > bcm/board_bcm2835.c
> > > index c09cf25596af..be788849c4bb 100644
> > > --- a/arch/arm/mach-bcm/board_bcm2835.c
> > > +++ b/arch/arm/mach-bcm/board_bcm2835.c
> > > @@ -3,6 +3,8 @@
> > >   * Copyright (C) 2010 Broadcom
> > >   */
> > > 
> > > +#include <linux/device.h>
> > > +#include <linux/dma-mapping.h>
> > >  #include <linux/init.h>
> > >  #include <linux/irqchip.h>
> > >  #include <linux/of_address.h>
> > > @@ -24,8 +26,37 @@ static const char * const bcm2835_compat[] = {
> > >         NULL
> > >  };
> > > 
> > > +static int bcm2835_needs_bounce(struct device *dev, dma_addr_t dma_addr,
> > > size_t size)
> > > +{
> > > +       /*
> > > +        * The accepted dma addresses are [0xc0000000, 0xffffffff] which
> > > map
> > > to
> > > +        * ram's [0x00000000, 0x3fffffff].
> > > +        */
> > > +       return dma_addr < 3ULL * SZ_1G;
> > > +}
> > > +
> > > +/*
> > > + * Setup DMA mask to 1GB on devices hanging from soc interconnect
> > > + */
> > > +static int bcm2835_platform_notify(struct device *dev)
> > > +{
> > > +       if (dev->parent && !strcmp("soc", dev_name(dev->parent))) {
> > > +               dev->dma_mask = &dev->coherent_dma_mask;
> > > +               dev->coherent_dma_mask = DMA_BIT_MASK(30); /* 1GB */
> > Shouldn't this come from the device tree?
> 
> Yes, actually I could use the 'dma-ranges' parsing code I suggested on the
> arm64 RFC. The same goes with 'dma_zone_size = SZ_1G', it ideally should be
> calculated based on the device-tree.
> 
> The way I see it I'm not sure it's worth the effort, in arm64 we have no
> choice
> as there are no board files. But here we seem to be the only ones with this
> specific DMA addressing constraint, so fixing it in arm/common doesn't seem
> like it's going to benefit anyone else. Let's see how the arm arch maintainers
> react though.
> 
> There is one catch though. I missed it earlier as I was excited to see the
> board boot, but some devices are failing to set their DMA masks:
> 
> [    1.989576] dwc2 fe980000.usb: can't set coherent DMA mask: -5
> 
> It seems that other users of dmabounce also implement their own
> dma_supported(). I have to look into it.

Sadly it seems there are some limitations in dmabounce I didn't take into
account earlier. Among other things it can't deal with HighMem out of the box
and even when trying to adapt it to our needs, fails to do so as it allocates
using GFP_ATOMIC, which rules out using the CMA when allocating coherent
memory. Sorry for the noise, I got carried away too soon.

I did a dirty hack hooking up dma-direct/swiotlb to the board. It seems to be
working fine after some tweaks in arm's dma_capable(). That said I want to test
it further before sending anything ;).


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2019-07-25  8:22 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-22  5:54 [PATCH 00/18] ARM: Add minimal Raspberry Pi 4 support Stefan Wahren
2019-07-22  5:54 ` [PATCH 01/18] ARM: bcm283x: Reduce register ranges for UART, SPI and I2C Stefan Wahren
2019-07-24 20:01   ` Stefan Wahren
2019-07-22  5:54 ` [PATCH 02/18] ARM: bcm2835: DMA can only address 1GB Stefan Wahren
2019-07-22  5:54 ` [PATCH 03/18] ARM: dts: bcm283x: Move BCM2835/6/7 specific to bcm2835-common.dtsi Stefan Wahren
2019-07-22 17:54   ` Eric Anholt
2019-07-22  5:54 ` [PATCH 04/18] ARM: dts: bcm283x: Define MMC interfaces at board level Stefan Wahren
2019-08-12 21:03   ` Stefan Wahren
2019-07-22  5:54 ` [PATCH 05/18] ARM: dts: bcm283x: Define memory " Stefan Wahren
2019-08-12 21:02   ` Stefan Wahren
2019-07-22  5:54 ` [PATCH 06/18] dt-bindings: bcm2835-cprman: Add bcm2711 support Stefan Wahren
2019-07-22  5:54 ` [PATCH 07/18] clk: bcm2835: Introduce SoC specific clock registration Stefan Wahren
2019-07-22 10:30   ` Matthias Brugger
2019-08-11 20:43   ` Stefan Wahren
2019-07-22  5:54 ` [PATCH 08/18] clk: bcm2835: Add BCM2711_CLOCK_EMMC2 support Stefan Wahren
2019-07-22 10:30   ` Matthias Brugger
2019-07-22  5:54 ` [PATCH 09/18] dt-bindings: sdhci-iproc: Add brcm,bcm2711-emmc2 Stefan Wahren
2019-07-22 10:31   ` Matthias Brugger
2019-07-24 14:08   ` Ulf Hansson
2019-07-22 11:26 ` [PATCH 00/18] ARM: Add minimal Raspberry Pi 4 support Matthias Brugger
2019-07-22 13:18 ` Nicolas Saenz Julienne
2019-07-22 18:10   ` Stefan Wahren
2019-07-23  9:34     ` Christoph Hellwig
2019-07-23 13:32       ` Nicolas Saenz Julienne
2019-07-23 14:33         ` Christoph Hellwig
2019-07-23 16:26         ` Stefan Wahren
2019-07-23 17:33           ` Nicolas Saenz Julienne
2019-07-23 21:30             ` Stefan Wahren
2019-07-24  2:53             ` Chen-Yu Tsai
2019-07-24  8:37               ` Nicolas Saenz Julienne
2019-07-25  8:22             ` Nicolas Saenz Julienne [this message]
2019-07-25 22:09               ` Stefan Wahren
2019-07-22 18:01 ` Eric Anholt
2019-07-28 11:22 ` Stefan Wahren
2019-08-05  9:33   ` Linus Walleij

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=c642de0a85d67f7f758735f1bba083156cca0ddb.camel@suse.de \
    --to=nsaenzjulienne@suse.de \
    --cc=adrian.hunter@intel.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=eric@anholt.net \
    --cc=f.fainelli@gmail.com \
    --cc=hch@lst.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=mbrugger@suse.com \
    --cc=mturquette@baylibre.com \
    --cc=rjui@broadcom.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=sbranden@broadcom.com \
    --cc=ulf.hansson@linaro.org \
    --cc=wahrenst@gmx.net \
    /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).