From: Andreas Larsson <andreas@gaisler.com>
To: Peter Korsgaard <jacmet@sunsite.dk>
Cc: linux-i2c@vger.kernel.org, Jean Delvare <khali@linux-fr.org>,
Ben Dooks <ben-linux@fluff.org>,
Wolfram Sang <w.sang@pengutronix.de>,
Grant Likely <grant.likely@secretlab.ca>,
Rob Herring <rob.herring@calxeda.com>,
linux-kernel@vger.kernel.org,
devicetree-discuss@lists.ozlabs.org, software@gaisler.com
Subject: Re: [PATCH 2/2] i2c: i2c-ocores: Add support for the GRLIB port of the controller and custom getreg and setreg functions
Date: Wed, 24 Oct 2012 11:05:10 +0200 [thread overview]
Message-ID: <5087AF46.1070707@gaisler.com> (raw)
In-Reply-To: <87sj95lywu.fsf@macbook.be.48ers.dk>
On 10/23/2012 10:24 PM, Peter Korsgaard wrote:
>>>>>> "Andreas" == Andreas Larsson <andreas@gaisler.com> writes:
> [...]
> Andreas> +/* Read and write functions for the GRLIB port of the controller. Registers are
> Andreas> + * 32-bit big endian and the PRELOW and PREHIGH registers are merged into one
> Andreas> + * register. The subsequent registers has their offset decreased accordingly. */
> Andreas> +static u8 oc_getreg_grlib(struct ocores_i2c *i2c, int reg)
> Andreas> +{
> Andreas> + u32 rd;
> Andreas> + int rreg = reg;
> Andreas> + if (reg != OCI2C_PRELOW)
> Andreas> + rreg--;
> Andreas> + rd = ioread32be(i2c->base + (rreg << i2c->reg_shift));
> Andreas> + if (reg == OCI2C_PREHIGH)
> Andreas> + return (u8)rd >> 8;
> Andreas> + else
> Andreas> + return (u8)rd;
> Andreas> +}
> Andreas> +
> Andreas> +static void oc_setreg_grlib(struct ocores_i2c *i2c, int reg, u8 value)
> Andreas> +{
> Andreas> + u32 curr, wr;
> Andreas> + int rreg = reg;
> Andreas> + if (reg != OCI2C_PRELOW)
> Andreas> + rreg--;
> Andreas> + if (reg == OCI2C_PRELOW || reg == OCI2C_PREHIGH) {
> Andreas> + curr = ioread32be(i2c->base + (rreg << i2c->reg_shift));
> Andreas> + if (reg == OCI2C_PRELOW)
> Andreas> + wr = (curr & 0xff00) | value;
> Andreas> + else
> Andreas> + wr = (((u32)value) << 8) | (curr & 0xff);
> Andreas> + } else {
> Andreas> + wr = value;
> Andreas> + }
> Andreas> + iowrite32be(wr, i2c->base + (rreg << i2c->reg_shift));
>
> Are all platforms using i2c-ocores guaranteed to provide ioread32be /
> iowrite32be or should we stick an #ifdef CONFIG_SPARC around it?
As far as I can see, after digging around, the only platforms that have
ioread/write32, but not ioread/write32be are frv and mn10300. Do you
know if those platforms are using i2c-ocores?
Cheers,
Andreas Larsson
next prev parent reply other threads:[~2012-10-24 9:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-23 15:03 [PATCH 0/2] i2c: i2c-ocores: Add support for sparc, custom set and get functions, and the GRLIB port of the controller Andreas Larsson
2012-10-23 15:03 ` Andreas Larsson
[not found] ` <1351004637-11049-1-git-send-email-andreas-FkzTOoA/JUlBDgjK7y7TUQ@public.gmane.org>
2012-10-23 15:03 ` [PATCH 1/2] i2c: i2c-ocores: Add irq support for sparc Andreas Larsson
2012-10-23 15:03 ` Andreas Larsson
[not found] ` <1351004637-11049-2-git-send-email-andreas-FkzTOoA/JUlBDgjK7y7TUQ@public.gmane.org>
2012-10-23 20:13 ` Peter Korsgaard
2012-10-23 20:13 ` Peter Korsgaard
[not found] ` <87wqyhlzfv.fsf-uXGAPMMVk8amE9MCos8gUmSdvHPH+/yF@public.gmane.org>
2012-10-24 9:05 ` Andreas Larsson
2012-10-24 9:05 ` Andreas Larsson
2012-10-23 15:03 ` [PATCH 2/2] i2c: i2c-ocores: Add support for the GRLIB port of the controller and custom getreg and setreg functions Andreas Larsson
2012-10-23 15:03 ` Andreas Larsson
2012-10-23 20:24 ` Peter Korsgaard
2012-10-24 9:05 ` Andreas Larsson [this message]
[not found] ` <5087AF46.1070707-FkzTOoA/JUlBDgjK7y7TUQ@public.gmane.org>
2012-10-24 11:48 ` Peter Korsgaard
2012-10-24 11:48 ` Peter Korsgaard
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=5087AF46.1070707@gaisler.com \
--to=andreas@gaisler.com \
--cc=ben-linux@fluff.org \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=grant.likely@secretlab.ca \
--cc=jacmet@sunsite.dk \
--cc=khali@linux-fr.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rob.herring@calxeda.com \
--cc=software@gaisler.com \
--cc=w.sang@pengutronix.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 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.