From: Sascha Hauer <s.hauer@pengutronix.de>
To: Krzysztof Halasa <khc@pm.waw.pl>
Cc: barebox@lists.infradead.org
Subject: Re: RFC: Fix big endian MMIO primitives.
Date: Sun, 6 May 2012 19:43:34 +0200 [thread overview]
Message-ID: <20120506174334.GW4141@pengutronix.de> (raw)
In-Reply-To: <m3wr4qmhwq.fsf@intrepid.localdomain>
On Sat, May 05, 2012 at 11:34:13PM +0200, Krzysztof Halasa wrote:
> cpu_read*() and cpu_wrire*() are precisely equal to __raw_read*() and
> __raw_write*().
>
> Striving for correctness we can replace all those __raw_*() with cpu_*()
> as that's exactly what the former ones do. Also we can change read*()
> and write*() into explicit leXX_*(). Both changes could affect porting
> from Linux, though.
Maybe we should rather use the __raw_* variants in the cfi driver aswell
which is the only user of the functions below. For some reason I
believed that the __raw_* variants also do little endian accesses which
is wrong.
I don't like the naming of the __raw_* variants very much as the
underscores and 'raw' suggests that these are internal functions which
one should rather not use, but in fact these are the correct functions
in most SoC (non PCI) drivers. Anyway, since Linux has this functions we
should use them aswell, everything else probably leads to more
confusion.
Sascha
>
> Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
>
> diff --git a/include/io.h b/include/io.h
> index 39b5e61..8d885de 100644
> --- a/include/io.h
> +++ b/include/io.h
> @@ -4,20 +4,11 @@
> #include <asm/io.h>
>
> /* cpu_read/cpu_write: cpu native io accessors */
> -#if __BYTE_ORDER == __BIG_ENDIAN
> -#define cpu_readb(a) readb(a)
> -#define cpu_readw(a) in_be16(a)
> -#define cpu_readl(a) in_be32(a)
> -#define cpu_writeb(v, a) writeb((v), (a))
> -#define cpu_writew(v, a) out_be16((a), (v))
> -#define cpu_writel(v, a) out_be32((a), (v))
> -#else
> -#define cpu_readb(a) readb(a)
> -#define cpu_readw(a) readw(a)
> -#define cpu_readl(a) readl(a)
> -#define cpu_writeb(v, a) writeb((v), (a))
> -#define cpu_writew(v, a) writew((v), (a))
> -#define cpu_writel(v, a) writel((v), (a))
> -#endif
> +#define cpu_readb(a) __raw_readb(a)
> +#define cpu_readw(a) __raw_readw(a)
> +#define cpu_readl(a) __raw_readl(a)
> +#define cpu_writeb(v, a) __raw_writeb((v), (a))
> +#define cpu_writew(v, a) __raw_writew((v), (a))
> +#define cpu_writel(v, a) __raw_writel((v), (a))
>
> #endif /* __IO_H */
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2012-05-06 17:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-05 21:34 Krzysztof Halasa
2012-05-06 17:43 ` Sascha Hauer [this message]
2012-05-06 18:01 ` Krzysztof Halasa
2012-05-06 18:13 ` Sascha Hauer
2012-05-07 7:51 ` Sascha Hauer
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=20120506174334.GW4141@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=khc@pm.waw.pl \
/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