public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Angelo Dureghello <angelo@sysam.it>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	Greg Ungerer <gerg@linux-m68k.org>,
	Logan Gunthorpe <logang@deltatee.com>,
	linux-m68k <linux-m68k@lists.linux-m68k.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] m68k: io: Fix io{read,write}{16,32}be() for Coldfire peripherals
Date: Sat, 11 May 2019 12:55:39 +0200	[thread overview]
Message-ID: <20190511105539.GA20920@jerusalem> (raw)
In-Reply-To: <CAK8P3a1NbjYAGCTq2RUfqEX1OgppEV5mKmBJ0t=JiFF13zSytg@mail.gmail.com>

Hi,

On Mon, Apr 29, 2019 at 02:39:47PM +0200, Arnd Bergmann wrote:
> On Mon, Apr 29, 2019 at 10:19 AM Geert Uytterhoeven
> <geert@linux-m68k.org> wrote:
> >
> > The generic definitions of mmio_{read,write}{16,32}be() in lib/iomap.c
> > assume that the {read,write}[wl]() I/O accessors always use little
> > endian accesses, and swap the result.
> >
> > However, the Coldfire versions of the {read,write}[wl]() I/O accessors are
> > special, in that they use native big endian instead of little endian for
> > accesses to the on-SoC peripheral block, thus violating the assumption.
> >
> > Fix this by providing our own variants, using the raw accessors,
> > reinstating the old behavior.  This is fine on m68k, as no special
> > barriers are needed, and also avoids swapping data twice.
> >
> > Reported-by: Angelo Dureghello <angelo@sysam.it>
> > Fixes: aecc787c06f4300f ("iomap: Use non-raw io functions for io{read|write}XXbe")
> > Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> > ---
> > This can be reverted later, after this oddity of the Coldfire I/O
> > support has been fixed, and drivers have been updated.
> > ---
> >  arch/m68k/include/asm/io.h | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/arch/m68k/include/asm/io.h b/arch/m68k/include/asm/io.h
> > index aabe6420ead2a599..d47e7384681ab1cd 100644
> > --- a/arch/m68k/include/asm/io.h
> > +++ b/arch/m68k/include/asm/io.h
> > @@ -8,6 +8,12 @@
> >  #include <asm/io_mm.h>
> >  #endif
> >
> > +#define mmio_read16be(addr)            __raw_readw(addr)
> > +#define mmio_read32be(addr)            __raw_readl(addr)
> > +
> > +#define mmio_write16be(val, port)      __raw_writew((val), (port))
> > +#define mmio_write32be(val, port)      __raw_writel((val), (port))
> > +
> >  #include <asm-generic/io.h>
> 
> This looks correct to me, but there are two points that stick out to me:
> 
> - why do you only do this for mmio and not for pio?
> - why do you even use the generic_iomap wrappers rather than
>   the trivial asm-generic versions of those functions?
> 
>        Arnd

At least i applied it and it works properly, dspi / dma drivers are
back working.

Thanks, 

Regards
Angelo

  reply	other threads:[~2019-05-11 11:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-29  8:19 [PATCH] m68k: io: Fix io{read,write}{16,32}be() for Coldfire peripherals Geert Uytterhoeven
2019-04-29 12:39 ` Arnd Bergmann
2019-05-11 10:55   ` Angelo Dureghello [this message]
2019-06-14 14:49   ` Geert Uytterhoeven
2019-06-17 20:23     ` Arnd Bergmann
2019-06-03 12:26 ` Angelo Dureghello
2019-06-04  7:18   ` Greg Ungerer
2019-06-04  7:34     ` Geert Uytterhoeven
2019-06-05 12:52       ` 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=20190511105539.GA20920@jerusalem \
    --to=angelo@sysam.it \
    --cc=arnd@arndb.de \
    --cc=geert@linux-m68k.org \
    --cc=gerg@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=logang@deltatee.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