All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Sven Peter" <sven@svenpeter.dev>
To: "Arnd Bergmann" <arnd@arndb.de>
Cc: "USB list" <linux-usb@vger.kernel.org>,
	"Felipe Balbi" <balbi@kernel.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] usb: dwc3: support 64 bit DMA in platform driver
Date: Sun, 06 Jun 2021 21:13:17 +0200	[thread overview]
Message-ID: <f321012c-8108-4797-9f24-7786c1f7d468@www.fastmail.com> (raw)
In-Reply-To: <CAK8P3a3TetrYDq0un8NT2ZPM=MSGg68Qr0gEV0Ua4Jfqoy-ErQ@mail.gmail.com>



On Sun, Jun 6, 2021, at 17:43, Arnd Bergmann wrote:
> On Sun, Jun 6, 2021 at 12:36 PM Sven Peter <sven@svenpeter.dev> wrote:
> > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> > index b6e53d8212cd..4930541a8984 100644
> > --- a/drivers/usb/dwc3/core.c
> > +++ b/drivers/usb/dwc3/core.c
> > @@ -1545,6 +1545,21 @@ static int dwc3_probe(struct platform_device *pdev)
> >
> >         dwc3_get_properties(dwc);
> >
> > +       /* Try to set 64-bit DMA first */
> > +       if (!dwc->sysdev->dma_mask)
> > +               /* Platform did not initialize dma_mask */
> > +               ret = dma_coerce_mask_and_coherent(dwc->sysdev,
> > +                                                  DMA_BIT_MASK(64));
> > +       else
> > +               ret = dma_set_mask_and_coherent(dwc->sysdev, DMA_BIT_MASK(64));
> > +
> > +       /* If seting 64-bit DMA mask fails, fall back to 32-bit DMA mask */
> > +       if (ret) {
> > +               ret = dma_set_mask_and_coherent(dwc->sysdev, DMA_BIT_MASK(32));
> > +               if (ret)
> > +                       return ret;
> > +       }
> 
> Please drop the dma_coerce_mask_and_coherent() code path as well: if
> the device is marked as non-DMA capable in the platform, it's better have
> it not be usable at all than to assume a particular bus property that may
> or may not be present on that bus.
> 
> The 32-bit mask is the default on all buses you might see a dwc3 controller
> on, so you can drop that as well, and just leave the
> dma_set_mask_and_coherent().
> 
>         Arnd
> 

Makes sense, will drop the two things for v3.

Thanks,

Sven


      reply	other threads:[~2021-06-06 19:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-06 10:36 [PATCH v2] usb: dwc3: support 64 bit DMA in platform driver Sven Peter
2021-06-06 15:43 ` Arnd Bergmann
2021-06-06 19:13   ` Sven Peter [this message]

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=f321012c-8108-4797-9f24-7786c1f7d468@www.fastmail.com \
    --to=sven@svenpeter.dev \
    --cc=arnd@arndb.de \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.