public inbox for linux-m68k@lists.linux-m68k.org
 help / color / mirror / Atom feed
From: Greg Ungerer <gerg@linux-m68k.org>
To: Arnd Bergmann <arnd@kernel.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org, Greg Ungerer <gerg@kernel.org>
Subject: Re: [PATCH 1/7] m68k: coldfire: create IO access functions for internal registers
Date: Thu, 30 Apr 2026 21:10:41 +1000	[thread overview]
Message-ID: <00c4920e-46a7-4e60-af0a-a2aec7d2699f@linux-m68k.org> (raw)
In-Reply-To: <b7bac366-f9f5-408b-9359-ae6a4c8cab44@app.fastmail.com>

Hi Arnd, Geert,

On 30/4/26 17:20, Arnd Bergmann wrote:
> On Thu, Apr 30, 2026, at 09:13, Geert Uytterhoeven wrote:
>> On Thu, 30 Apr 2026 at 07:23, Greg Ungerer <gerg@linux-m68k.org> wrote:
>>> --- a/arch/m68k/include/asm/io_no.h
>>> +++ b/arch/m68k/include/asm/io_no.h
>>> @@ -107,6 +107,22 @@ static inline void writel(u32 value, volatile void __iomem *addr)
>>>
>>>   #endif /* IOMEMBASE */
>>>
>>> +#if defined(CONFIG_COLDFIRE)
>>> +/*
>>> + * The ColdFire internal peripheral registers are big-endian, so you
>>> + * cannot use the conventional little-endian readb/readw/readl and
>>> + * writeb/writew/writel access functions. Define a family of access
>>> + * functions to give correct endian access that can be used by all
>>> + * architecture code.
>>> + */
>>> +#define mcf_read8      __raw_readb
>>> +#define mcf_read16     __raw_readw
>>> +#define mcf_read32     __raw_readl
>>> +#define mcf_write8     __raw_writeb
>>> +#define mcf_write16    __raw_writew
>>> +#define mcf_write32    __raw_writel
>>
>> Why not call them io{read,write}{8,16be,32be}(), like parisc, powerpc,
>> and sparc, do?  Sparc seems to be the closest match:
>> https://elixir.bootlin.com/linux/v7.0.1/source/arch/sparc/include/asm/io_64.h#L439
> 
> I think that would be the right choice for introducing these from
> scratch, but we can't easily change the existing code in small steps,
> for two reasons:
> 
> - the asm-generic/io.h already provides ioread32be() etc functions,
>    and these are used today on some of the coldfire drivers, but by
>    accident these have little-endian semantics (since readl() is
>    big-endian here), and at least one driver relies on it being that
>    way.
> 
> - readl32be() really wants an 'void __iomem *' pointer, and we should
>    not have architectures that do something different here. The coldfire
>    __raw_readl() accepts both pointer and integer (phys_addr_t etc)
>    addresses at the moment, and the arch/m68k/coldfire code for nommu
>    targets uses that. Changing these to use ioremap() and pass pointers
>    would be a much bigger change.

Yes, exactly. I steered clear of reusing anything that already existed.
Especially since the existing broken ones are actually used in drivers.

Regards
Greg


  reply	other threads:[~2026-04-30 11:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-30  5:19 m68k: coldfire: create internal register access defines Greg Ungerer
2026-04-30  5:19 ` [PATCH 1/7] m68k: coldfire: create IO access functions for internal registers Greg Ungerer
2026-04-30  7:13   ` Geert Uytterhoeven
2026-04-30  7:20     ` Arnd Bergmann
2026-04-30 11:10       ` Greg Ungerer [this message]
2026-04-30  5:19 ` [PATCH 2/7] m68k: coldfire: use ColdFire specific IO access in headers Greg Ungerer
2026-04-30  5:19 ` [PATCH 3/7] m68k: coldfire: use ColdFire specifc IO access in interrupt code Greg Ungerer
2026-04-30  5:19 ` [PATCH 4/7] m68k: coldfire: use ColdFire specifc IO access in timer code Greg Ungerer
2026-04-30  5:19 ` [PATCH 5/7] m68k: coldfire: rename timer register access defines Greg Ungerer
2026-04-30  5:19 ` [PATCH 6/7] m68k: coldfire: use ColdFire specifc IO access in system code Greg Ungerer
2026-04-30  5:19 ` [PATCH 7/7] m68k: coldfire: use ColdFire specifc IO access in SoC code Greg Ungerer
2026-04-30  7:39 ` m68k: coldfire: create internal register access defines Arnd Bergmann
2026-04-30 11:22   ` Greg Ungerer
2026-04-30 11:37     ` Arnd Bergmann

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=00c4920e-46a7-4e60-af0a-a2aec7d2699f@linux-m68k.org \
    --to=gerg@linux-m68k.org \
    --cc=arnd@kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=gerg@kernel.org \
    --cc=linux-m68k@lists.linux-m68k.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