linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: rajeev kumar
	<rajeevkumar.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Kamal Dasu <kdasu.kdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>,
	Gregory Fong
	<gregory.0xf0-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [V2 1/2] i2c: brcmstb: Add Broadcom settop SoC i2c controller driver
Date: Fri, 17 Apr 2015 10:12:10 -0700	[thread overview]
Message-ID: <55313EEA.8040103@gmail.com> (raw)
In-Reply-To: <CAA7nrtjyVXkMYTL8AWMMp1peZ0TGMwYtYhRxrTrBH3kyZzi1tw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On 16/04/15 22:52, rajeev kumar wrote:

>>>> +#define bsc_readl(_dev, reg)                                           \
>>>> +       __bsc_readl(_dev, offsetof(struct bsc_regs, reg))
>>>> +
> 
> use readl/writel

This peripheral is used on chips that can run in either little or
big-endian, and in both cases, this is a board-level strap that dictates
the entire endianess of the system, such that on-chip peripherals should
always be accessed in the host (native) endianess.

readl/writel introduce an implicit endian conversion for kernels
compiled in big-endian, that we do not want here. Depending on the
architecture, there is also an additional barrier that is not needed,
since the underlying bus serving this peripheral (GISB) does not
re-order transactions, and writes are not posted.

A better abstraction however could be something like this:

#ifdef CONFIG_CPU_BIG_ENDIAN
#define __bsc_readl(_dev, reg)	ioread32be(...)
#else
#define __bsc_readl(_dev, reg)	ioread32(...)
#endif

Such that we preserve the host endianess access, but we clearly identify
the differences in running in a big or little endian configuration?
-- 
Florian

      parent reply	other threads:[~2015-04-17 17:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-02 20:01 [V2 1/2] i2c: brcmstb: Add Broadcom settop SoC i2c controller driver Kamal Dasu
     [not found] ` <1428004866-13543-1-git-send-email-kdasu.kdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-04-02 20:01   ` [V2 2/2] dt-bindings: i2c: Add i2c-brcmstb dt bindings Kamal Dasu
2015-04-14 13:47   ` [V2 1/2] i2c: brcmstb: Add Broadcom settop SoC i2c controller driver Wolfram Sang
2015-04-14 20:39     ` Ray Jui
     [not found]       ` <552D7AF5.7040005-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2015-04-15  7:50         ` Wolfram Sang
2015-04-15  7:51           ` Ray Jui
2015-04-16 15:32         ` Kamal Dasu
2015-04-15  7:21   ` rajeev kumar
     [not found]     ` <CAA7nrtjWUZOBQiTr0YrZFmLOoAttyJ5gMxb+hR7jnz1HC51Buw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-15  7:53       ` Wolfram Sang
2015-04-16 16:10       ` Kamal Dasu
     [not found]         ` <CAC=U0a3OXKBSUeRnbsXZ2J7snhRzhGAFctvzjwg=o90w59oNHg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-17  5:52           ` rajeev kumar
     [not found]             ` <CAA7nrtjyVXkMYTL8AWMMp1peZ0TGMwYtYhRxrTrBH3kyZzi1tw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-17  6:56               ` rajeev kumar
2015-04-17 17:12               ` Florian Fainelli [this message]

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=55313EEA.8040103@gmail.com \
    --to=f.fainelli-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=gregory.0xf0-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=kdasu.kdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=rajeevkumar.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).