public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Valentin Korenblit" <vkorenblit@sequans.com>,
	linux-mtd@lists.infradead.org
Cc: "Miquel Raynal" <miquel.raynal@bootlin.com>, ye.xingchen@zte.com.cn
Subject: Re: [PATCH v2] mtd: rawnand: cadence: support 64-bit slave dma interface
Date: Mon, 17 Oct 2022 20:56:49 +0200	[thread overview]
Message-ID: <55aede4b-e364-4366-8261-bd461f542b16@app.fastmail.com> (raw)
In-Reply-To: <20221017152640.32362-1-vkorenblit@sequans.com>

On Mon, Oct 17, 2022, at 5:26 PM, Valentin Korenblit wrote:
> 32-bit accesses on 64-bit sdma trigger sdma_err in intr_status register.
>
> Check dma capabilities before reading/writing from/to sdma interface.
>
> Link to discussion:
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org/thread/3NMACGIM5NDUBPXRT5RTBZON6LQE5A3B/
>
> Signed-off-by: Valentin Korenblit <vkorenblit@sequans.com>

Seems reasonable overall based on the discussion so far.

Minor comments:

> Changes v1 -> v2:
> 	- Replaced ioread64_rep by cadence_nand_readsq (suggested by Arnd)
> 	- Replaced iowrite64_rep by cadence_nand_writesq (suggested by Arnd)
> 	- Do not try to access 64-bit sdma if __raw_readq/__raw_writeq are not defined


> +static inline void cadence_nand_readsq(struct cdns_nand_ctrl 
> *cdns_ctrl,
> +				       void *buffer, unsigned int count)
> +{
> +#ifdef __raw_readq
> +	const volatile void __iomem *addr = cdns_ctrl->io.virt;
> +
> +        if (count) {
> +                u64 *buf = buffer;
> +
> +                do {
> +                        u64 x = __raw_readq(addr);
> +                        *buf++ = x;
> +                } while (--count);
> +        }

While this is correct, I suppose you don't actually need that
loop any more, since architectures that have __raw_readq()
should also also have ioread64_rep() or readsq(). We actually
just had a few issues with that in another context, but I think
starting with 6.1-rc1 you should be able to rely on that ;-)

> +#else
> +	dev_err(cdns_ctrl->dev,
> +		"cannot read 64-bit sdma on !64-bit architectures");
> +#endif

It would be nice to print an error at probe time and fail attaching
the device rather than waiting for the first transfer to continue
with incorrect data.

      Arnd

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

      reply	other threads:[~2022-10-17 18:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-17 15:26 [PATCH v2] mtd: rawnand: cadence: support 64-bit slave dma interface Valentin Korenblit
2022-10-17 18:56 ` Arnd Bergmann [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=55aede4b-e364-4366-8261-bd461f542b16@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=vkorenblit@sequans.com \
    --cc=ye.xingchen@zte.com.cn \
    /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