From: Hein Tibosch <hein_tibosch@yahoo.es>
To: Arnd Bergmann <arnd.bergmann@linaro.org>
Cc: Viresh Kumar <viresh.kumar@linaro.org>,
Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>,
Nicolas Ferre <nicolas.ferre@atmel.com>,
Havard Skinnemoen <havard@skinnemoen.net>,
"ludovic.desroches" <ludovic.desroches@atmel.com>,
linux-kernel@vger.kernel.org,
spear-devel <spear-devel@list.st.com>
Subject: Re: [PATCH] Fixes for dw_dmac and atmel-mci for AP700x
Date: Tue, 21 Aug 2012 22:24:11 +0800 [thread overview]
Message-ID: <50339A0B.6080803@yahoo.es> (raw)
In-Reply-To: <201208210905.52145.arnd.bergmann@linaro.org>
On 8/21/2012 5:05 PM, Arnd Bergmann wrote:
> It should be easy to tell from the object code whether this happened
> or not. If it did, then we can investigate why gcc did that, otherwise
> something else caused the strange byte swap.
>
> The safe way to define the readl() function in asm/io.h is to
> use an inline assembly that prevents the access from getting split,
> but avr32 just uses a pointer dereference here.
>
> I think I just found the answer elsewhere in
> arch/avr32/mach-at32ap/include/mach/io.h, which defines
>
> # define __mem_ioswabl(a, x) swahb32(x)
>
> and that apparently does the halfword swap when CONFIG_AP700X_16_BIT_SMC
> is set. This explains why Havard said it's wrong to use readl on
> internal deviceson avr32, but unfortunately that rule conflicts with how
> we define the accessors on ARM.
I already thought the 16-bit swap might be related to the 16-bit SMC
configuration. SMC will fetch each u32 word in 2 different 16-bit banks
of SDRAM.
In a meanwhile I tried dw_dmac using iowrite32be/ioread32be, and it worked
equally well! Which isn't surprising because for AVR32 they were defined as:
#define iowrite32be(v,p) __raw_writel(v, p)
#define ioread32be(p) ((unsigned int)__raw_readl(p))
The 'relaxed' versions won't work because:
#define readl_relaxed readl
The object code confirms what was expected:
u32 val = ioread32be (((unsigned*)0x100)); /* Same as __raw_readl */
ld.w r8,pc[256]
iowrite32be (val, ((unsigned*)0x104)); /* same as __raw_writel */
st.w pc[260],r8
val = readl (((unsigned*)0x108)); /* __raw_readl + swahb32 */
ld.w r8,pc[264]
lsl r9,r8,0x10 /* 16-bit swap */
or r9,r9,r8>>0x10
writel (val, ((unsigned*)0x10C)); /* swahb32 + __raw_writel */
lsl r8,r9,0x10 /* 16-bit swap */
or r8,r8,r9>>0x10
st.w pc[268],r8
Hein
next prev parent reply other threads:[~2012-08-21 15:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <502BC31E.4070200@yahoo.es>
[not found] ` <502BDD0E.4030106@yahoo.es>
[not found] ` <502CA8FC.7090705@atmel.com>
[not found] ` <502CB89B.4070302@yahoo.es>
[not found] ` <502CC326.8020605@atmel.com>
[not found] ` <502CC6A0.3050603@atmel.com>
[not found] ` <502F52E7.9050804@yahoo.es>
[not found] ` <CACiLriS-GZg24TJqJGQ=P04n-Zk3FdHtGgh5VeqGcCMHG6TnMw@mail.gmail.com>
[not found] ` <50310F10.2080701@yahoo.es>
2012-08-21 4:42 ` [PATCH] Fixes for dw_dmac and atmel-mci for AP700x viresh kumar
2012-08-21 6:12 ` Hein Tibosch
[not found] ` <CAKohponN16krs-WWw6Abh1fLPO3+iYndTaxsPDfeXCoS9OHufQ@mail.gmail.com>
2012-08-21 7:32 ` Hein Tibosch
[not found] ` <CAKohpomMPeewDBVxVR=g-op7E53rqt-AZgOdyoib6W+5QsLOOA@mail.gmail.com>
2012-08-21 8:34 ` Arnd Bergmann
[not found] ` <CAKohpokhM5WkUK6ww8Neu+fx554+-4uBCsNzBxB9q5rcqSf6cw@mail.gmail.com>
2012-08-21 8:47 ` Arnd Bergmann
[not found] ` <CAKohpokoeSLBtLdh8hr4GKv8VOxzK8Vq5SoqLE3yC-TDyjYA9w@mail.gmail.com>
2012-08-21 9:05 ` Arnd Bergmann
2012-08-21 14:24 ` Hein Tibosch [this message]
2012-08-21 7:44 ` Arnd Bergmann
[not found] ` <CAKohpo=DyQajiE-DmpMiv=gVOVOep1OEECVuw83D2u4VJisEsw@mail.gmail.com>
2012-08-21 8:31 ` Arnd Bergmann
2012-08-21 14:15 ` Havard Skinnemoen
2012-08-23 3:47 ` Hein Tibosch
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=50339A0B.6080803@yahoo.es \
--to=hein_tibosch@yahoo.es \
--cc=arnd.bergmann@linaro.org \
--cc=hans-christian.egtvedt@atmel.com \
--cc=havard@skinnemoen.net \
--cc=linux-kernel@vger.kernel.org \
--cc=ludovic.desroches@atmel.com \
--cc=nicolas.ferre@atmel.com \
--cc=spear-devel@list.st.com \
--cc=viresh.kumar@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.