All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: linux-arm-kernel@lists.infradead.org
Cc: linux-omap@vger.kernel.org
Subject: Re: [PATCH 01/13] omap: Fix i2c platform init code for omap4
Date: Tue, 18 May 2010 17:15:33 -0700	[thread overview]
Message-ID: <20100519001533.GY5818@atomide.com> (raw)
In-Reply-To: <20100518024243.21705.45209.stgit@baageli.muru.com>

[-- Attachment #1: Type: text/plain, Size: 515 bytes --]

* Tony Lindgren <tony@atomide.com> [100517 19:37]:
> Add separate omap_i2c_add_bus functions for mach-omap1
> and mach-omap2. Make the mach-omap2 init set the interrupt
> dynamically to support.
> 
> This is needed to add support for omap4 in a way that
> works with multi-omap builds. This will eventually get
> fixed with the omap hwmods.

Looks like these first two patches cause a self-created merge
conflict with Ben's i2c branch. Reposting the first two patches
rebased on what's in for-next.

Regards,

Tony

[-- Attachment #2: omap-i2c-multiboot.patch --]
[-- Type: text/x-diff, Size: 2971 bytes --]

From: Tony Lindgren <tony@atomide.com>
Date: Tue, 18 May 2010 16:19:15 -0700
Subject: [PATCH] omap: Fix i2c platform init code for omap4

Add separate omap_i2c_add_bus functions for mach-omap1
and mach-omap2. Make the mach-omap2 init set the interrupt
dynamically to support.

This is needed to add support for omap4 in a way that
works with multi-omap builds. This will eventually get
fixed in a generic way with the omap hwmods.

Signed-off-by: Tony Lindgren <tony@atomide.com>

diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
index f044b59..78d1cea 100644
--- a/arch/arm/plat-omap/i2c.c
+++ b/arch/arm/plat-omap/i2c.c
@@ -100,33 +100,44 @@ static int __init omap_i2c_nr_ports(void)
 	return ports;
 }
 
-static int __init omap_i2c_add_bus(int bus_id)
+/* Shared between omap2 and 3 */
+static resource_size_t omap2_i2c_irq[3] __initdata = {
+	INT_24XX_I2C1_IRQ,
+	INT_24XX_I2C2_IRQ,
+	INT_34XX_I2C3_IRQ,
+};
+
+static inline int omap1_i2c_add_bus(struct platform_device *pdev, int bus_id)
 {
-	struct platform_device *pdev;
 	struct omap_i2c_bus_platform_data *pd;
 	struct resource *res;
-	resource_size_t base, irq;
 
-	pdev = &omap_i2c_devices[bus_id - 1];
 	pd = pdev->dev.platform_data;
+	res = pdev->resource;
+	res[0].start = OMAP1_I2C_BASE;
+	res[0].end = res[0].start + OMAP_I2C_SIZE;
+	res[1].start = INT_I2C;
+	omap1_i2c_mux_pins(bus_id);
+
+	return platform_device_register(pdev);
+}
+
+static inline int omap2_i2c_add_bus(struct platform_device *pdev, int bus_id)
+{
+	struct resource *res;
+	resource_size_t *irq;
+
+	res = pdev->resource;
+
+	irq = omap2_i2c_irq;
+
 	if (bus_id == 1) {
-		res = pdev->resource;
-		if (cpu_class_is_omap1()) {
-			base = OMAP1_I2C_BASE;
-			irq = INT_I2C;
-		} else {
-			base = OMAP2_I2C_BASE1;
-			irq = INT_24XX_I2C1_IRQ;
-		}
-		res[0].start = base;
-		res[0].end = base + OMAP_I2C_SIZE;
-		res[1].start = irq;
+		res[0].start = OMAP2_I2C_BASE1;
+		res[0].end = res[0].start + OMAP_I2C_SIZE;
 	}
 
-	if (cpu_class_is_omap1())
-		omap1_i2c_mux_pins(bus_id);
-	if (cpu_class_is_omap2())
-		omap2_i2c_mux_pins(bus_id);
+	res[1].start = irq[bus_id - 1];
+	omap2_i2c_mux_pins(bus_id);
 
 	/*
 	 * When waiting for completion of a i2c transfer, we need to
@@ -134,12 +145,28 @@ static int __init omap_i2c_add_bus(int bus_id)
 	 * ensure quick enough wakeup from idle, when transfer
 	 * completes.
 	 */
-	if (cpu_is_omap34xx())
+	if (cpu_is_omap34xx()) {
+		struct omap_i2c_bus_platform_data *pd;
+
+		pd = pdev->dev.platform_data;
 		pd->set_mpu_wkup_lat = omap_pm_set_max_mpu_wakeup_lat;
+	}
 
 	return platform_device_register(pdev);
 }
 
+static int __init omap_i2c_add_bus(int bus_id)
+{
+	struct platform_device *pdev;
+
+	pdev = &omap_i2c_devices[bus_id - 1];
+
+	if (cpu_class_is_omap1())
+		return omap1_i2c_add_bus(pdev, bus_id);
+	else
+		return omap2_i2c_add_bus(pdev, bus_id);
+}
+
 /**
  * omap_i2c_bus_setup - Process command line options for the I2C bus speed
  * @str: String of options

WARNING: multiple messages have this Message-ID (diff)
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 01/13] omap: Fix i2c platform init code for omap4
Date: Tue, 18 May 2010 17:15:33 -0700	[thread overview]
Message-ID: <20100519001533.GY5818@atomide.com> (raw)
In-Reply-To: <20100518024243.21705.45209.stgit@baageli.muru.com>

* Tony Lindgren <tony@atomide.com> [100517 19:37]:
> Add separate omap_i2c_add_bus functions for mach-omap1
> and mach-omap2. Make the mach-omap2 init set the interrupt
> dynamically to support.
> 
> This is needed to add support for omap4 in a way that
> works with multi-omap builds. This will eventually get
> fixed with the omap hwmods.

Looks like these first two patches cause a self-created merge
conflict with Ben's i2c branch. Reposting the first two patches
rebased on what's in for-next.

Regards,

Tony
-------------- next part --------------
A non-text attachment was scrubbed...
Name: omap-i2c-multiboot.patch
Type: text/x-diff
Size: 2971 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100518/1de7ff10/attachment-0001.bin>

  reply	other threads:[~2010-05-19  0:15 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-18  2:42 [PATCH 00/13] More omap platform init code for 2.6.35 merge window Tony Lindgren
2010-05-18  2:42 ` Tony Lindgren
2010-05-18  2:42 ` [PATCH 01/13] omap: Fix i2c platform init code for omap4 Tony Lindgren
2010-05-18  2:42   ` Tony Lindgren
2010-05-19  0:15   ` Tony Lindgren [this message]
2010-05-19  0:15     ` Tony Lindgren
2010-05-18  2:42 ` [PATCH 02/13] omap4: Add support for i2c init Tony Lindgren
2010-05-18  2:42   ` Tony Lindgren
2010-05-19  0:16   ` Tony Lindgren
2010-05-19  0:16     ` Tony Lindgren
2010-05-18  2:42 ` [PATCH 03/13] omap4: Add i2c board support on omap4430 sdp platform Tony Lindgren
2010-05-18  2:42   ` Tony Lindgren
2010-05-18  2:42 ` [PATCH 04/13] omap4: add i2c1 peripherals data Tony Lindgren
2010-05-18  2:42   ` Tony Lindgren
2010-05-18  2:42 ` [PATCH 05/13] omap4: Enable RTC and regulator support Tony Lindgren
2010-05-18  2:42   ` Tony Lindgren
2010-05-18  2:42 ` [PATCH 06/13] omap4: Adds Dummy Interface clock's for MMC controllers Tony Lindgren
2010-05-18  2:42   ` Tony Lindgren
2010-05-18  2:43 ` [PATCH 07/13] omap4: Adding hsmmc support to board file Tony Lindgren
2010-05-18  2:43   ` Tony Lindgren
2010-05-18  2:43 ` [PATCH 08/13] omap4: Adding PBIAS Configuration for MMC1 Controller Tony Lindgren
2010-05-18  2:43   ` Tony Lindgren
2010-05-18  2:43 ` [PATCH 09/13] omap4: Enable HSMMC support Tony Lindgren
2010-05-18  2:43   ` Tony Lindgren
2010-05-18  2:43 ` [PATCH 10/13] omap3: Add support for OMAP3Stalker boards Tony Lindgren
2010-05-18  2:43   ` Tony Lindgren
2010-05-18  2:43 ` [PATCH 11/13] omap3: Add OMAP3 Stalker board LK-S defconfig Tony Lindgren
2010-05-18  2:43   ` Tony Lindgren
2010-05-18  2:43 ` [PATCH 12/13] omap3: update omap3_defconfig Tony Lindgren
2010-05-18  2:43   ` Tony Lindgren
2010-05-18  2:43 ` [PATCH 13/13] omap3: Add stalker board to omap3_defconfig Tony Lindgren
2010-05-18  2:43   ` Tony Lindgren

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=20100519001533.GY5818@atomide.com \
    --to=tony@atomide.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.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.