devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Gabriel L. Somlo" <gsomlo@gmail.com>
To: Joel Stanley <joel@jms.id.au>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	devicetree <devicetree@vger.kernel.org>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	linux-mmc <linux-mmc@vger.kernel.org>,
	Karol Gugala <kgugala@antmicro.com>,
	Mateusz Holenko <mholenko@antmicro.com>,
	Kamil Rakoczy <krakoczy@antmicro.com>,
	mdudek@internships.antmicro.com,
	Paul Mackerras <paulus@ozlabs.org>,
	Stafford Horne <shorne@gmail.com>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	david.abdurachmanov@sifive.com,
	Florent Kermarrec <florent@enjoy-digital.fr>
Subject: Re: [PATCH v1 3/3] mmc: Add driver for LiteX's LiteSDCard interface
Date: Tue, 7 Dec 2021 13:51:25 -0500	[thread overview]
Message-ID: <Ya+tLfsaPd/EFppJ@errol.ini.cmu.edu> (raw)
In-Reply-To: <CACPK8Xeg2UoAqp55R+UrRLFJqerc1Kqrubh3BiEpSon+Q6bGyQ@mail.gmail.com>

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@gmail.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

  reply	other threads:[~2021-12-07 18:51 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-03 23:41 [PATCH v1 0/3] mmc: Add LiteSDCard mmc driver Gabriel Somlo
2021-12-03 23:41 ` [PATCH v1 1/3] MAINTAINERS: co-maintain LiteX platform Gabriel Somlo
2021-12-03 23:41 ` [PATCH v1 2/3] dt-bindings: mmc: Add bindings for LiteSDCard Gabriel Somlo
2021-12-06  9:38   ` Geert Uytterhoeven
2021-12-06 12:35     ` Gabriel L. Somlo
2021-12-03 23:41 ` [PATCH v1 3/3] mmc: Add driver for LiteX's LiteSDCard interface Gabriel Somlo
2021-12-04  0:20   ` Randy Dunlap
2021-12-04  0:33     ` Gabriel L. Somlo
2021-12-04  4:41   ` kernel test robot
2021-12-04  7:29   ` Stafford Horne
2021-12-05 21:39   ` Stafford Horne
2021-12-05 22:55     ` Gabriel L. Somlo
2021-12-06 10:53   ` Joel Stanley
2021-12-06 12:16     ` Geert Uytterhoeven
2021-12-06 23:51       ` Joel Stanley
2021-12-07  0:53         ` Gabriel L. Somlo
2021-12-07  8:01         ` Geert Uytterhoeven
2021-12-07  1:23     ` Gabriel L. Somlo
2021-12-07  2:46       ` Joel Stanley
2021-12-07 18:51         ` Gabriel L. Somlo [this message]
2021-12-08 16:46     ` Gabriel L. Somlo

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=Ya+tLfsaPd/EFppJ@errol.ini.cmu.edu \
    --to=gsomlo@gmail.com \
    --cc=david.abdurachmanov@sifive.com \
    --cc=devicetree@vger.kernel.org \
    --cc=florent@enjoy-digital.fr \
    --cc=geert@linux-m68k.org \
    --cc=joel@jms.id.au \
    --cc=kgugala@antmicro.com \
    --cc=krakoczy@antmicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=mdudek@internships.antmicro.com \
    --cc=mholenko@antmicro.com \
    --cc=paulus@ozlabs.org \
    --cc=robh+dt@kernel.org \
    --cc=shorne@gmail.com \
    --cc=ulf.hansson@linaro.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).