From: Grygorii Strashko <grygorii.strashko@ti.com>
To: Taras Kondratiuk <taras.kondratiuk@linaro.org>,
Wolfram Sang <wsa@the-dreams.de>
Cc: <davinci-linux-open-source@linux.davincidsp.com>,
<linaro-kernel@lists.linaro.org>, <patches@linaro.org>,
Kevin Hilman <khilman@deeprootsystems.com>,
<linux-kernel@vger.kernel.org>,
Santosh Shilimkar <santosh.shilimkar@ti.com>,
<linux-i2c@vger.kernel.org>, <linaro-networking@linaro.org>
Subject: Re: [PATCH] i2c: davinci: raw read and write endian fix
Date: Thu, 21 Nov 2013 19:05:26 +0200 [thread overview]
Message-ID: <528E3D56.5010908@ti.com> (raw)
In-Reply-To: <1384971824-7707-1-git-send-email-taras.kondratiuk@linaro.org>
On 11/20/2013 08:23 PM, Taras Kondratiuk wrote:
> I2C IP block expect LE data, but CPU may operate in BE mode.
> Need to use endian neutral functions to read/write h/w registers.
> I.e instead of __raw_read[lw] and __raw_write[lw] functions code
> need to use read[lw]_relaxed and write[lw]_relaxed functions.
> If the first simply reads/writes register, the second will byteswap
> it if host operates in BE mode.
>
> Changes are trivial sed like replacement of __raw_xxx functions
> with xxx_relaxed variant.
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
>
> Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
> ---
> Based on Linus' master tip (b4789b8).
> Tested on Keystone2 EVM.
>
> drivers/i2c/busses/i2c-davinci.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
> index 132369f..a629447 100644
> --- a/drivers/i2c/busses/i2c-davinci.c
> +++ b/drivers/i2c/busses/i2c-davinci.c
> @@ -125,12 +125,12 @@ static struct davinci_i2c_platform_data davinci_i2c_platform_data_default = {
> static inline void davinci_i2c_write_reg(struct davinci_i2c_dev *i2c_dev,
> int reg, u16 val)
> {
> - __raw_writew(val, i2c_dev->base + reg);
> + writew_relaxed(val, i2c_dev->base + reg);
> }
>
> static inline u16 davinci_i2c_read_reg(struct davinci_i2c_dev *i2c_dev, int reg)
> {
> - return __raw_readw(i2c_dev->base + reg);
> + return readw_relaxed(i2c_dev->base + reg);
> }
>
> /* Generate a pulse on the i2c clock pin. */
>
next prev parent reply other threads:[~2013-11-21 17:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-20 18:23 Taras Kondratiuk
2013-11-21 17:05 ` Grygorii Strashko [this message]
2013-11-26 12:39 ` Wolfram Sang
2013-11-27 18:29 ` Wolfram Sang
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=528E3D56.5010908@ti.com \
--to=grygorii.strashko@ti.com \
--cc=davinci-linux-open-source@linux.davincidsp.com \
--cc=khilman@deeprootsystems.com \
--cc=linaro-kernel@lists.linaro.org \
--cc=linaro-networking@linaro.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@linaro.org \
--cc=santosh.shilimkar@ti.com \
--cc=taras.kondratiuk@linaro.org \
--cc=wsa@the-dreams.de \
/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
all inboxes | Powered by JetHome®