Re: [PATCH] mmc: bcm2835: DMA mapping improvements

Ulf Hansson <[email protected]> Mon, 13 Jul 2026 15:07:28 +0200
Newsgroups org.kernel.vger.linux-mmc
Message-ID <CAPx+jO9Xv0PSu+kKg_DCtfFKx5ChnJs0C49jFvuCVAyjjW0AsA@mail.gmail.com>
On Mon, Jul 13, 2026 at 2:37 PM John Garry <[email protected]> wrote:
>
> On 13/07/2026 13:19, Robin Murphy wrote:
> > On 13/07/2026 12:25 pm, Ulf Hansson wrote:
> > [...]
> >>> @@ -1281,10 +1279,8 @@ static int bcm2835_add_host(struct
> >>> bcm2835_host *host)
> >>>
> >>>          if (!host->dma_chan_rxtx) {
> >>>                  dev_warn(dev, "unable to initialise DMA channel.
> >>> Falling back to PIO\n");
> >>> -               host->use_dma = false;
> >>> +               host->dma_dev = NULL;
> >>>          } else {
> >>> -               host->use_dma = true;
> >>> -
> >>>                  host->dma_cfg_tx.src_addr_width =
> >>> DMA_SLAVE_BUSWIDTH_4_BYTES;
> >>>                  host->dma_cfg_tx.dst_addr_width =
> >>> DMA_SLAVE_BUSWIDTH_4_BYTES;
> >>>                  host->dma_cfg_tx.direction = DMA_MEM_TO_DEV;
> >>> @@ -1300,12 +1296,18 @@ static int bcm2835_add_host(struct
> >>> bcm2835_host *host)
> >>>                  if (dmaengine_slave_config(host->dma_chan_rxtx,
> >>>                                             &host->dma_cfg_tx) != 0 ||
> >>>                      dmaengine_slave_config(host->dma_chan_rxtx,
> >>> -                                          &host->dma_cfg_rx) != 0)
> >>> -                       host->use_dma = false;
> >>> +                                          &host->dma_cfg_rx) != 0) {
> >
> > Hang on, doesn't this whole if condition need to be inverted? It's true
> > upon dma config _failure_, thanks to the original use_dma logic being a
> > bit backwards here.

Robin, thanks for catching this!

>
> Ah, yes, my mistake. It should be:
>
> if (!dmaengine_slave_config(..., &host->dma_cfg_tx) &&
>      !dmaengine_slave_config(..., &host->dma_cfg_rx))
>         dma_dev =
>
> And I don't think that the first dmaengine_slave_config() needs to be
> undone in case of failure for the second call.
>
> Ulf, how to handle a fix? should I send an update on top of this patch?

I have dropped the $subject patch from my next branch, so please
submit a new version.

>
> thanks
>
>

Kind regards
Uffe