Linux SPI subsystem development
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@nxp.com>
To: Greg Ungerer <gerg@kernel.org>
Cc: linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org,
	arnd@kernel.org, Greg Ungerer <gerg@linux-m68k.org>,
	dmaengine@vger.kernel.org, linux-can@vger.kernel.org,
	linux-spi@vger.kernel.org, olteanv@gmail.com,
	adureghello@baylibre.com
Subject: Re: [RFC 4/4] m68k: coldfire: fix non-standard readX()/writeX() functions
Date: Wed, 6 May 2026 12:14:25 -0400	[thread overview]
Message-ID: <afto4fL0CVVNtHDQ@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20260506142644.3234270-8-gerg@kernel.org>

On Thu, May 07, 2026 at 12:26:48AM +1000, Greg Ungerer wrote:
> From: Greg Ungerer <gerg@linux-m68k.org>
>
> Remove the local ColdFire definitions of readb()/readw()/readl() and
> writeb()/writew()/writel() and use the asm-generic versions of them.
>
> The implementation of the readX()/writeX() family of IO access functions
> is non-standard on ColdFire platforms. They either return big-endian (that
> is native endian) data, or on platforms with PCI bus support check the
> supplied address and return either big or little endian data based on that
> check. This is non-standard, they are expected to always return
> little-endian byte ordered data. Unfortunately this behavior also means
> that ioreadX()/iowroteX() and their big-endian counter parts
> ioreadXbe()/iowriteXbe() are currently broken because they are implemented
> using the readX()/writeX() functions.
>
> The change to use the asm-generic versions of readX()/writeX() itself is
> quite strait forward, just remove the ColdFire local versions of them.  But
> this of course has implications for any remaining drivers that use any of
> these IO access functions. A number of drivers can be independently fixed,
> before this final fix to readX()/writeX() for ColdFire. A small number of
> drivers cannot easily be independently fixed and remain in a working
> state. Those drivers are fixed here as well:
>
> drivers/dma/mcf-edma-main.c
>   Supports big-endian access by setting the big-endian flag of
>   the drivers struct fsl_edma_engine. But locally should be using
>   ioread32be() and iowrite32be() instead of ioread32() and iowrite32().
>
> drivers/net/can/flexcan/flexcan-core.c
>   Setting the driver quirks flag for big-endian access will force
>   driver to use correct access functions.
>
> drivers/spi/spi-fsl-dspi.c
>   Setting the regmap format_endian flags to use native endian will
>   force driver to use appropriate big or little endian access on
>   whatever platform it is built for.
>
> These drivers have only been compile tested.
>
> Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
> ---
>  arch/m68k/include/asm/io_no.h          | 68 +++-----------------------
>  drivers/dma/mcf-edma-main.c            | 14 +++---

Suppose it is correct, but I have not such platform to test it. it should
be correct if disassembly code is the same at access register.

Frank

>

  reply	other threads:[~2026-05-06 16:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260506142644.3234270-2-gerg@kernel.org>
2026-05-06 14:26 ` [RFC 4/4] m68k: coldfire: fix non-standard readX()/writeX() functions Greg Ungerer
2026-05-06 16:14   ` Frank Li [this message]
2026-05-06 19:12   ` Arnd Bergmann
2026-05-07 12:43     ` Greg Ungerer
2026-05-07 12:59       ` Arnd Bergmann
2026-05-07 13:30   ` Marc Kleine-Budde
2026-05-07 14:33     ` Greg Ungerer

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=afto4fL0CVVNtHDQ@lizhi-Precision-Tower-5810 \
    --to=frank.li@nxp.com \
    --cc=adureghello@baylibre.com \
    --cc=arnd@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=gerg@kernel.org \
    --cc=gerg@linux-m68k.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=olteanv@gmail.com \
    /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