From: Tony Lindgren <tony@atomide.com>
To: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: linux-omap@vger.kernel.org, ben@fluff.org.uk,
sameo@linux.intel.com, lrg@slimlogic.co.uk, paul@pwsan.com,
Syed Rafiuddin <rafiuddin.syed@ti.com>,
Ben Dooks <ben-linux@fluff.org>
Subject: Re: [PATCH 16/24] omap4: Add i2c support on omap4 platform
Date: Tue, 16 Feb 2010 10:50:50 -0800 [thread overview]
Message-ID: <20100216185050.GN21755@atomide.com> (raw)
In-Reply-To: <1266335895-32741-16-git-send-email-santosh.shilimkar@ti.com>
* Santosh Shilimkar <santosh.shilimkar@ti.com> [100216 07:55]:
> This patch is rebased version of earlier post to add I2C
> driver support to OMAP4 platform. On OMAP4, all
> I2C register address offsets are changed from OMAP1/2/3 I2C.
> In order to not have #ifdef's at various places in code,
> as well as to support multi-OMAP build, an array is created
> to hold the register addresses with it's offset.
>
> This patch was submitted, reviewed and acked on mailing list
> already. For more details refer below link
> http://www.mail-archive.com/linux-i2c@vger.kernel.org/msg02281.html
>
> This version updated on top of 16 bit support added as part of
> the commit "8bb209278e555a626f9637e844fe4c1b90e849f6"
>
> Signed-off-by: Syed Rafiuddin <rafiuddin.syed@ti.com>
> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Acked-by: Kevin Hilman <khilman@deeprootsystems.com>
> CC: Tony Lindgren <tony@atomide.com>
> CC: Ben Dooks <ben-linux@fluff.org>
> ---
> arch/arm/plat-omap/i2c.c | 17 ++++-
> drivers/i2c/busses/i2c-omap.c | 148 ++++++++++++++++++++++++++++++++---------
> 2 files changed, 131 insertions(+), 34 deletions(-)
>
> diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
> index 96d2781..f18d757 100644
> --- a/arch/arm/plat-omap/i2c.c
> +++ b/arch/arm/plat-omap/i2c.c
> @@ -53,9 +53,15 @@ static struct resource i2c_resources[][2] = {
> #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
> { I2C_RESOURCE_BUILDER(OMAP2_I2C_BASE2, INT_24XX_I2C2_IRQ) },
> #endif
> +#if defined(CONFIG_ARCH_OMAP4)
> + { I2C_RESOURCE_BUILDER(OMAP2_I2C_BASE2, INT_44XX_I2C2_IRQ) },
> +#endif
> #if defined(CONFIG_ARCH_OMAP3)
> { I2C_RESOURCE_BUILDER(OMAP2_I2C_BASE3, INT_34XX_I2C3_IRQ) },
> #endif
> +#if defined(CONFIG_ARCH_OMAP4)
> + { I2C_RESOURCE_BUILDER(OMAP2_I2C_BASE3, INT_44XX_I2C3_IRQ) },
> +#endif
> };
This is OK, but..
> #define I2C_DEV_BUILDER(bus_id, res, data) \
> @@ -72,10 +78,11 @@ static struct resource i2c_resources[][2] = {
> static u32 i2c_rate[ARRAY_SIZE(i2c_resources)];
> static struct platform_device omap_i2c_devices[] = {
> I2C_DEV_BUILDER(1, i2c_resources[0], &i2c_rate[0]),
> -#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
> +#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \
> + defined(CONFIG_ARCH_OMAP4)
> I2C_DEV_BUILDER(2, i2c_resources[1], &i2c_rate[1]),
> #endif
> -#if defined(CONFIG_ARCH_OMAP3)
> +#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
> I2C_DEV_BUILDER(3, i2c_resources[2], &i2c_rate[2]),
> #endif
> };
.. the ifdefs above can be simplified to ifdef CONFIG_ARCH_OMAP2PLUS.
That is, with the patches already queued into omap for-next.
> @@ -370,7 +434,11 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
> internal_clk = 9600;
> else
> internal_clk = 4000;
> - fclk_rate = clk_get_rate(dev->fclk) / 1000;
> + /* FIXME: Remove this once clock framework is available*/
> + if (dev->rev >= OMAP_I2C_REV_ON_4430)
> + fclk_rate = 96000;
> + else
> + fclk_rate = clk_get_rate(dev->fclk) / 1000;
>
> /* Compute prescaler divisor */
> psc = fclk_rate / internal_clk;
Sounds like this part should no longer be needed?
> *dev->buf++ = w;
> dev->buf_len--;
> - /* Data reg from 2430 is 8 bit wide */
> + /* Data reg in 2430, omap3 and
> + * omap4 is 8 bit wide
> + */
> if (!cpu_is_omap2430() &&
> - !cpu_is_omap34xx()) {
> + !cpu_is_omap34xx() &&
> + !cpu_is_omap44xx()) {
> if (dev->buf_len) {
> *dev->buf++ = w >> 8;
> dev->buf_len--;
How about change this to if (cpu_class_is_omap1() || cpu_is_omap2420())?
That way it does not need to be patched for new omaps.
> @@ -786,9 +857,12 @@ complete:
> if (dev->buf_len) {
> w = *dev->buf++;
> dev->buf_len--;
> - /* Data reg from 2430 is 8 bit wide */
> + /* Data reg in 2430, omap3 and
> + * omap4 is 8 bit wide
> + */
> if (!cpu_is_omap2430() &&
> - !cpu_is_omap34xx()) {
> + !cpu_is_omap34xx() &&
> + !cpu_is_omap44xx()) {
> if (dev->buf_len) {
> w |= *dev->buf++ << 8;
> dev->buf_len--;
Here too.
> dev->rev = omap_i2c_read_reg(dev, OMAP_I2C_REV_REG) & 0xff;
>
> - if (cpu_is_omap2430() || cpu_is_omap34xx()) {
> + if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
> u16 s;
>
> /* Set up the fifo size - Get total size */
And here too.
Regards,
Tony
next prev parent reply other threads:[~2010-02-16 18:50 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-16 15:57 [PATCH 01/24] omap 3/4: uart: fix full-fifo write abort Santosh Shilimkar
2010-02-16 15:57 ` [PATCH 02/24] omap2/3/4: ioremap omap_globals module Santosh Shilimkar
2010-02-16 15:57 ` [PATCH 03/24] omap4: sdma: Enable the idle modes on omap4 Santosh Shilimkar
2010-02-16 15:57 ` [PATCH 04/24] omap: sdma: Limit the secure reserve channel fix for omap3 Santosh Shilimkar
2010-02-16 15:57 ` [PATCH 05/24] omap4: Add needed IRQ line into irqs.h Santosh Shilimkar
2010-02-16 15:57 ` [PATCH 06/24] omap4: Fix omap_type() for omap4 Santosh Shilimkar
2010-02-16 15:57 ` [PATCH 07/24] omap 3/4: Remove overlapping mapping of L4_WKUP io space Santosh Shilimkar
2010-02-16 15:57 ` [PATCH 08/24] omap4: clocks: Make Uart driver's clock calls OMAP4 compatible Santosh Shilimkar
2010-02-16 15:58 ` [PATCH 09/24] omap4: clocks: Make mcbsp " Santosh Shilimkar
2010-02-16 15:58 ` [PATCH 10/24] omap4: clokcs: Make gpio " Santosh Shilimkar
2010-02-16 15:58 ` [PATCH 11/24] omap4: clocks: Make watchdog " Santosh Shilimkar
2010-02-16 15:58 ` [PATCH 12/24] omap4: clocks: Make dmtimer clocks " Santosh Shilimkar
2010-02-16 15:58 ` [PATCH 13/24] omap4: clocks: Remove clock hacks from timer-gp.c Santosh Shilimkar
2010-02-16 15:58 ` [PATCH 14/24] omap4: Enable WDT and McBSP support Santosh Shilimkar
2010-02-16 15:58 ` [PATCH 15/24] omap4: clocks: Convert i2c clocks data to fclks Santosh Shilimkar
2010-02-16 15:58 ` [PATCH 16/24] omap4: Add i2c support on omap4 platform Santosh Shilimkar
2010-02-16 15:58 ` [PATCH 17/24] omap4: Add i2c board support for " Santosh Shilimkar
2010-02-16 15:58 ` [PATCH 18/24] omap4: clocks: Make i2c driver's clock calls OMAP4 compatible Santosh Shilimkar
2010-02-16 15:58 ` [PATCH 19/24] twl6030: Fix vsel calculations in set/get voltage api's Santosh Shilimkar
2010-02-16 15:58 ` [PATCH 20/24] twl6030: add base addr for ID0, ID1, ID2 Santosh Shilimkar
2010-02-16 15:58 ` [PATCH 21/24] omap4: add i2c1 peripherals data Santosh Shilimkar
2010-02-16 15:58 ` [PATCH 22/24] omap4: add regulator board data for TWL6030 Santosh Shilimkar
2010-02-16 15:58 ` [PATCH 23/24] omap4: Enable RTC and regulator support Santosh Shilimkar
2010-02-16 15:58 ` [PATCH 24/24] omap4: multi-omap: Allow build to work Santosh Shilimkar
2010-02-16 16:15 ` Shilimkar, Santosh
2010-02-17 9:12 ` Gadiyar, Anand
2010-02-17 17:20 ` Tony Lindgren
2010-02-16 18:53 ` Tony Lindgren
2010-02-17 5:05 ` Shilimkar, Santosh
2010-02-16 23:30 ` Paul Walmsley
2010-02-19 11:41 ` [PATCH 20/24] twl6030: add base addr for ID0, ID1, ID2 Samuel Ortiz
2010-02-19 22:33 ` Tony Lindgren
2010-02-16 23:22 ` [PATCH 18/24] omap4: clocks: Make i2c driver's clock calls OMAP4 compatible Paul Walmsley
2010-02-16 18:50 ` Tony Lindgren [this message]
2010-02-17 5:04 ` [PATCH 16/24] omap4: Add i2c support on omap4 platform Shilimkar, Santosh
2010-02-16 23:21 ` Paul Walmsley
2010-02-17 5:23 ` Shilimkar, Santosh
2010-02-16 23:22 ` [PATCH 15/24] omap4: clocks: Convert i2c clocks data to fclks Paul Walmsley
2010-02-16 18:42 ` [PATCH 14/24] omap4: Enable WDT and McBSP support Tony Lindgren
2010-02-16 18:41 ` [PATCH 13/24] omap4: clocks: Remove clock hacks from timer-gp.c Tony Lindgren
2010-02-17 5:02 ` Shilimkar, Santosh
2010-02-17 17:21 ` Tony Lindgren
2010-02-16 22:57 ` [PATCH 11/24] omap4: clocks: Make watchdog driver's clock calls OMAP4 compatible Paul Walmsley
2010-02-16 22:34 ` [PATCH 09/24] omap4: clocks: Make mcbsp " Paul Walmsley
2010-02-16 18:38 ` [PATCH 08/24] omap4: clocks: Make Uart " Tony Lindgren
2010-02-16 22:32 ` Paul Walmsley
2010-02-16 22:08 ` [PATCH 05/24] omap4: Add needed IRQ line into irqs.h Paul Walmsley
2010-02-17 5:01 ` Shilimkar, Santosh
2010-02-17 5:32 ` Paul Walmsley
2010-02-17 5:51 ` Shilimkar, Santosh
2010-02-17 6:02 ` Shilimkar, Santosh
2010-02-17 6:45 ` Paul Walmsley
2010-02-17 7:25 ` Shilimkar, Santosh
2010-02-17 7:32 ` Paul Walmsley
2010-02-17 7:36 ` Shilimkar, Santosh
2010-02-16 22:04 ` [PATCH 02/24] omap2/3/4: ioremap omap_globals module Paul Walmsley
2010-02-17 5:30 ` Shilimkar, Santosh
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=20100216185050.GN21755@atomide.com \
--to=tony@atomide.com \
--cc=ben-linux@fluff.org \
--cc=ben@fluff.org.uk \
--cc=linux-omap@vger.kernel.org \
--cc=lrg@slimlogic.co.uk \
--cc=paul@pwsan.com \
--cc=rafiuddin.syed@ti.com \
--cc=sameo@linux.intel.com \
--cc=santosh.shilimkar@ti.com \
/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