[PATCH v2 1/5] ARM: SPMP8000: Add machine base files
Russell King - ARM Linux
linux at arm.linux.org.uk
Fri Oct 21 18:54:05 EDT 2011
On Wed, Oct 19, 2011 at 09:15:35PM +0200, Arnd Bergmann wrote:
> > +#define SERIAL_BASE ((volatile unsigned char *)SPMP8000_UARTC0_BASE)
>
> drop this, then
>
> > +static void putc(const char c)
> > +{
> > + volatile unsigned char *base = SERIAL_BASE;
>
> make this a "unsigned char __iomem *".
>
> > + int i;
> > +
> > + for (i = 0; i < 0x1000; i++) {
> > + if (base[UART_LSR << 2] & UART_LSR_THRE)
> > + break;
> > + barrier();
> > + }
> > +
> > + base[UART_TX << 2] = c;
> > +}
>
> and use readb_relaxed/writeb_relaxed to do the access. You should
> never just dereference volatile pointers to do an MMIO access.
Note that uncompress.h isn't part of the kernel proper, and so the
MMIO accessors may not work (depends whether the arch out-of-lines
them.) Moreover, as the MMU is setup with 1:1 mappings, arguably
it's not IOMEM anyway.
More information about the linux-arm-kernel
mailing list