Re: [PATCH 1/7] m68k: coldfire: create IO access functions for internal registers
Geert Uytterhoeven <[email protected]>
| Newsgroups | org.kernel.vger.linux-m68k |
|---|---|
| Message-ID | <CAMuHMdVDMnxkF+eKwtSoBt7g_5sqY_O4zLT_icD9zTNuS8ou0Q@mail.gmail.com> |
Hi Greg, On Thu, 30 Apr 2026 at 07:23, Greg Ungerer <[email protected]> wrote: > From: Greg Ungerer <[email protected]> > > The internal peripheral registers contained in all varieties of ColdFire > SoCs require simple big endian access ranging in sizes from 8, 16 and 32 > bit. Currently there is a mixture of IO access methods used across the > various CPU support code, some using readx/writex and some using the > simpler __raw_readx/__raw_writew. > > The readx/writex use cases are particularly kludgy in that they contain > code to differentiate internal register access and other general attached > peripheral register access - say on a PCI bus. In effect this means that > the readx/writex family for ColdFire is non-standard. This ultimately > ends up causing problems with definitions of other IO access support > functions like ioreadx/ioreadxbe/iowritex/iowritexbe which in the > generic case are defined in terms of readx/writex. > > Create a set of internal only register access methods to ultimately > replace all internal register access code. The new access functions > mirror the existing readx/writex family but using the preferred 8/16/32 > suffixes. > > Signed-off-by: Greg Ungerer <[email protected]> Thanks for your patch! > --- 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 > +#endif /* CONFIG_COLDFIRE */ > + > #if defined(CONFIG_PCI) > /* > * Support for PCI bus access uses the asm-generic access functions. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds