[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ya+tLfsaPd/EFppJ@errol.ini.cmu.edu>
Date: Tue, 7 Dec 2021 13:51:25 -0500
From: "Gabriel L. Somlo" <gsomlo@...il.com>
To: Joel Stanley <joel@....id.au>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Rob Herring <robh+dt@...nel.org>,
devicetree <devicetree@...r.kernel.org>,
Ulf Hansson <ulf.hansson@...aro.org>,
linux-mmc <linux-mmc@...r.kernel.org>,
Karol Gugala <kgugala@...micro.com>,
Mateusz Holenko <mholenko@...micro.com>,
Kamil Rakoczy <krakoczy@...micro.com>,
mdudek@...ernships.antmicro.com,
Paul Mackerras <paulus@...abs.org>,
Stafford Horne <shorne@...il.com>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
david.abdurachmanov@...ive.com,
Florent Kermarrec <florent@...oy-digital.fr>
Subject: Re: [PATCH v1 3/3] mmc: Add driver for LiteX's LiteSDCard interface
Hi Joel,
On Tue, Dec 07, 2021 at 02:46:03AM +0000, Joel Stanley wrote:
> On Tue, 7 Dec 2021 at 01:23, Gabriel L. Somlo <gsomlo@...il.com> wrote:
> > > > [...]
> > > > +
> > > > + ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
> > >
> > > Is this going to be true on all platforms? How do we handle those
> > > where it's not true?
> >
> > I'll need to do a bit of digging here, unless anyone has ideas ready
> > to go...
>
> I'm not an expert either, so let's consult the docs:
>
> Documentation/core-api/dma-api-howto.rst
>
> This suggests we should be using dma_set_mask_and_coherent?
>
> But we're setting the mask to 32, which is the default, so perhaps we
> don't need this call at all?
>
> (I was thinking of the microwatt soc, which is a 64 bit soc but the
> peripherals are on a 32 bit bus, and some of the devices are behind a
> smaller bus again. But I think we're ok, as the DMA wishbone is
> 32-bit).
So I did a bit of digging, and as it turns out the LiteX DMA base
registers are 64-bit wide, which I think means that they can
essentially do `xlen` bits of DMA addressing, at least when used
as part of a LiteX SoC (no idea what additional quirks occur if/when
LiteSDCard, or any other 64-bit-DMA-capable LiteX IP block would be
used as a standalone component in a different system).
Does this mean that, depending on maybe CONFIG_ARCH_DMA_ADDR_T_64BIT
or something similar, we should actually set DMA_BIT_MASK(64)? Maybe
something like:
#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
if (ret)
goto err;
#endif
Leave it to the default 32 unless we're on a 64-bit-DMA capable
system, in which case it's safe to assume we need the above setting?
What do you think, does that make sense?
Thanks,
--Gabriel
Powered by blists - more mailing lists