All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] Updates for common omap code for next merge window
@ 2009-03-04 21:47 Tony Lindgren
  2009-03-04 21:48 ` [PATCH 1/7] ARM: OMAP: Export dmtimer functions Tony Lindgren
                   ` (7 more replies)
  0 siblings, 8 replies; 24+ messages in thread
From: Tony Lindgren @ 2009-03-04 21:47 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-omap

Hi,

This series contains updates for common omap code. Still to come
is a series of omap3 specific patches during this week.

Regards,

Tony

---

Felipe Balbi (1):
      ARM: OMAP: get rid of OMAP_TAG_USB

Jarkko Nikula (3):
      ARM: OMAP: Add method to register additional I2C busses on the command line
      ARM: OMAP: Add command line option for I2C bus speed
      ARM: OMAP: Add documentation for function omap_register_i2c_bus

Santosh Shilimkar (2):
      ARM: OMAP: Dispatch only relevant DMA interrupts
      ARM: OMAP: Get available DMA channels from cmdline

Timo Kokkonen (1):
      ARM: OMAP: Export dmtimer functions


 arch/arm/mach-omap1/board-ams-delta.c   |    2 -
 arch/arm/mach-omap1/board-generic.c     |    5 +
 arch/arm/mach-omap1/board-h2.c          |    2 -
 arch/arm/mach-omap1/board-h3.c          |    2 -
 arch/arm/mach-omap1/board-innovator.c   |    5 +
 arch/arm/mach-omap1/board-nokia770.c    |    9 ---
 arch/arm/mach-omap1/board-osk.c         |    2 -
 arch/arm/mach-omap1/board-palmte.c      |    2 -
 arch/arm/mach-omap1/board-palmtt.c      |    2 -
 arch/arm/mach-omap1/board-palmz71.c     |    2 -
 arch/arm/mach-omap1/board-sx1.c         |    2 -
 arch/arm/mach-omap1/board-voiceblue.c   |    2 -
 arch/arm/mach-omap2/board-apollon.c     |    2 -
 arch/arm/mach-omap2/board-h4.c          |   34 ++++++++++
 arch/arm/plat-omap/dma.c                |   24 +++++++
 arch/arm/plat-omap/dmtimer.c            |   26 ++++++++
 arch/arm/plat-omap/i2c.c                |  104 +++++++++++++++++++++++++++----
 arch/arm/plat-omap/include/mach/board.h |    1 
 arch/arm/plat-omap/include/mach/usb.h   |    2 +
 arch/arm/plat-omap/usb.c                |   25 +------
 20 files changed, 192 insertions(+), 63 deletions(-)

-- 
Signature

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 1/7] ARM: OMAP: Export dmtimer functions
  2009-03-04 21:47 [PATCH 0/7] Updates for common omap code for next merge window Tony Lindgren
@ 2009-03-04 21:48 ` Tony Lindgren
  2009-03-04 21:49 ` [PATCH 2/7] ARM: OMAP: Add documentation for function omap_register_i2c_bus Tony Lindgren
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 24+ messages in thread
From: Tony Lindgren @ 2009-03-04 21:48 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: Timo Kokkonen, linux-omap

From: Timo Kokkonen <timo.t.kokkonen@nokia.com>

Make the dmtimer function symbols available so modules can take use of
them.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/plat-omap/dmtimer.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index e4f0ce0..bfd4757 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -33,6 +33,7 @@
 #include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/io.h>
+#include <linux/module.h>
 #include <mach/hardware.h>
 #include <mach/dmtimer.h>
 #include <mach/irqs.h>
@@ -362,6 +363,7 @@ struct omap_dm_timer *omap_dm_timer_request(void)
 
 	return timer;
 }
+EXPORT_SYMBOL_GPL(omap_dm_timer_request);
 
 struct omap_dm_timer *omap_dm_timer_request_specific(int id)
 {
@@ -385,6 +387,7 @@ struct omap_dm_timer *omap_dm_timer_request_specific(int id)
 
 	return timer;
 }
+EXPORT_SYMBOL_GPL(omap_dm_timer_request_specific);
 
 void omap_dm_timer_free(struct omap_dm_timer *timer)
 {
@@ -395,6 +398,7 @@ void omap_dm_timer_free(struct omap_dm_timer *timer)
 	WARN_ON(!timer->reserved);
 	timer->reserved = 0;
 }
+EXPORT_SYMBOL_GPL(omap_dm_timer_free);
 
 void omap_dm_timer_enable(struct omap_dm_timer *timer)
 {
@@ -406,6 +410,7 @@ void omap_dm_timer_enable(struct omap_dm_timer *timer)
 
 	timer->enabled = 1;
 }
+EXPORT_SYMBOL_GPL(omap_dm_timer_enable);
 
 void omap_dm_timer_disable(struct omap_dm_timer *timer)
 {
@@ -417,11 +422,13 @@ void omap_dm_timer_disable(struct omap_dm_timer *timer)
 
 	timer->enabled = 0;
 }
+EXPORT_SYMBOL_GPL(omap_dm_timer_disable);
 
 int omap_dm_timer_get_irq(struct omap_dm_timer *timer)
 {
 	return timer->irq;
 }
+EXPORT_SYMBOL_GPL(omap_dm_timer_get_irq);
 
 #if defined(CONFIG_ARCH_OMAP1)
 
@@ -452,6 +459,7 @@ __u32 omap_dm_timer_modify_idlect_mask(__u32 inputmask)
 
 	return inputmask;
 }
+EXPORT_SYMBOL_GPL(omap_dm_timer_modify_idlect_mask);
 
 #elif defined(CONFIG_ARCH_OMAP2) || defined (CONFIG_ARCH_OMAP3)
 
@@ -459,6 +467,7 @@ struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer)
 {
 	return timer->fclk;
 }
+EXPORT_SYMBOL_GPL(omap_dm_timer_get_fclk);
 
 __u32 omap_dm_timer_modify_idlect_mask(__u32 inputmask)
 {
@@ -466,6 +475,7 @@ __u32 omap_dm_timer_modify_idlect_mask(__u32 inputmask)
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(omap_dm_timer_modify_idlect_mask);
 
 #endif
 
@@ -473,6 +483,7 @@ void omap_dm_timer_trigger(struct omap_dm_timer *timer)
 {
 	omap_dm_timer_write_reg(timer, OMAP_TIMER_TRIGGER_REG, 0);
 }
+EXPORT_SYMBOL_GPL(omap_dm_timer_trigger);
 
 void omap_dm_timer_start(struct omap_dm_timer *timer)
 {
@@ -484,6 +495,7 @@ void omap_dm_timer_start(struct omap_dm_timer *timer)
 		omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
 	}
 }
+EXPORT_SYMBOL_GPL(omap_dm_timer_start);
 
 void omap_dm_timer_stop(struct omap_dm_timer *timer)
 {
@@ -495,6 +507,7 @@ void omap_dm_timer_stop(struct omap_dm_timer *timer)
 		omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
 	}
 }
+EXPORT_SYMBOL_GPL(omap_dm_timer_stop);
 
 #ifdef CONFIG_ARCH_OMAP1
 
@@ -507,6 +520,7 @@ void omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
 	l |= source << n;
 	omap_writel(l, MOD_CONF_CTRL_1);
 }
+EXPORT_SYMBOL_GPL(omap_dm_timer_set_source);
 
 #else
 
@@ -523,6 +537,7 @@ void omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
 	 * cause an abort. */
 	__delay(150000);
 }
+EXPORT_SYMBOL_GPL(omap_dm_timer_set_source);
 
 #endif
 
@@ -541,6 +556,7 @@ void omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload,
 
 	omap_dm_timer_write_reg(timer, OMAP_TIMER_TRIGGER_REG, 0);
 }
+EXPORT_SYMBOL_GPL(omap_dm_timer_set_load);
 
 /* Optimized set_load which removes costly spin wait in timer_start */
 void omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload,
@@ -560,6 +576,7 @@ void omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload,
 	omap_dm_timer_write_reg(timer, OMAP_TIMER_COUNTER_REG, load);
 	omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
 }
+EXPORT_SYMBOL_GPL(omap_dm_timer_set_load_start);
 
 void omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable,
 			     unsigned int match)
@@ -574,6 +591,7 @@ void omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable,
 	omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
 	omap_dm_timer_write_reg(timer, OMAP_TIMER_MATCH_REG, match);
 }
+EXPORT_SYMBOL_GPL(omap_dm_timer_set_match);
 
 void omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on,
 			   int toggle, int trigger)
@@ -590,6 +608,7 @@ void omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on,
 	l |= trigger << 10;
 	omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
 }
+EXPORT_SYMBOL_GPL(omap_dm_timer_set_pwm);
 
 void omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler)
 {
@@ -603,6 +622,7 @@ void omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler)
 	}
 	omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
 }
+EXPORT_SYMBOL_GPL(omap_dm_timer_set_prescaler);
 
 void omap_dm_timer_set_int_enable(struct omap_dm_timer *timer,
 				  unsigned int value)
@@ -610,6 +630,7 @@ void omap_dm_timer_set_int_enable(struct omap_dm_timer *timer,
 	omap_dm_timer_write_reg(timer, OMAP_TIMER_INT_EN_REG, value);
 	omap_dm_timer_write_reg(timer, OMAP_TIMER_WAKEUP_EN_REG, value);
 }
+EXPORT_SYMBOL_GPL(omap_dm_timer_set_int_enable);
 
 unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer)
 {
@@ -619,11 +640,13 @@ unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer)
 
 	return l;
 }
+EXPORT_SYMBOL_GPL(omap_dm_timer_read_status);
 
 void omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value)
 {
 	omap_dm_timer_write_reg(timer, OMAP_TIMER_STAT_REG, value);
 }
+EXPORT_SYMBOL_GPL(omap_dm_timer_write_status);
 
 unsigned int omap_dm_timer_read_counter(struct omap_dm_timer *timer)
 {
@@ -633,11 +656,13 @@ unsigned int omap_dm_timer_read_counter(struct omap_dm_timer *timer)
 
 	return l;
 }
+EXPORT_SYMBOL_GPL(omap_dm_timer_read_counter);
 
 void omap_dm_timer_write_counter(struct omap_dm_timer *timer, unsigned int value)
 {
 	omap_dm_timer_write_reg(timer, OMAP_TIMER_COUNTER_REG, value);
 }
+EXPORT_SYMBOL_GPL(omap_dm_timer_write_counter);
 
 int omap_dm_timers_active(void)
 {
@@ -658,6 +683,7 @@ int omap_dm_timers_active(void)
 	}
 	return 0;
 }
+EXPORT_SYMBOL_GPL(omap_dm_timers_active);
 
 int __init omap_dm_timer_init(void)
 {


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 2/7] ARM: OMAP: Add documentation for function omap_register_i2c_bus
  2009-03-04 21:47 [PATCH 0/7] Updates for common omap code for next merge window Tony Lindgren
  2009-03-04 21:48 ` [PATCH 1/7] ARM: OMAP: Export dmtimer functions Tony Lindgren
@ 2009-03-04 21:49 ` Tony Lindgren
  2009-03-04 21:51 ` [PATCH 3/7] ARM: OMAP: Add command line option for I2C bus speed Tony Lindgren
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 24+ messages in thread
From: Tony Lindgren @ 2009-03-04 21:49 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-omap, Jarkko Nikula

From: Jarkko Nikula <jarkko.nikula@nokia.com>

Signed-off-by: Jarkko Nikula <jarkko.nikula@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/plat-omap/i2c.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
index 467531e..3e95954 100644
--- a/arch/arm/plat-omap/i2c.c
+++ b/arch/arm/plat-omap/i2c.c
@@ -119,6 +119,15 @@ static void __init omap_i2c_mux_pins(int bus)
 	omap_cfg_reg(scl);
 }
 
+/**
+ * omap_register_i2c_bus - register I2C bus with device descriptors
+ * @bus_id: bus id counting from number 1
+ * @clkrate: clock rate of the bus in kHz
+ * @info: pointer into I2C device descriptor table or NULL
+ * @len: number of descriptors in the table
+ *
+ * Returns 0 on success or an error code.
+ */
 int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
 			  struct i2c_board_info const *info,
 			  unsigned len)


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 3/7] ARM: OMAP: Add command line option for I2C bus speed
  2009-03-04 21:47 [PATCH 0/7] Updates for common omap code for next merge window Tony Lindgren
  2009-03-04 21:48 ` [PATCH 1/7] ARM: OMAP: Export dmtimer functions Tony Lindgren
  2009-03-04 21:49 ` [PATCH 2/7] ARM: OMAP: Add documentation for function omap_register_i2c_bus Tony Lindgren
@ 2009-03-04 21:51 ` Tony Lindgren
  2009-03-05 16:20   ` Tony Lindgren
  2009-03-04 21:52 ` [PATCH 4/7] ARM: OMAP: Add method to register additional I2C busses on the command line Tony Lindgren
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 24+ messages in thread
From: Tony Lindgren @ 2009-03-04 21:51 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-omap, Jarkko Nikula

From: Jarkko Nikula <jarkko.nikula@nokia.com>

This patch adds a new command line option "i2c_bus=bus_id,clkrate" into
I2C bus registration helper. Purpose of the option is to override the
default board specific bus speed which is supplied by the
omap_register_i2c_bus.

The default bus speed is typically set to speed of slowest I2C chip on the
bus and overriding allow to use some experimental configurations or updated
chip versions without any kernel modifications.

Signed-off-by: Jarkko Nikula <jarkko.nikula@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/plat-omap/i2c.c |   54 +++++++++++++++++++++++++++++++++++++---------
 1 files changed, 44 insertions(+), 10 deletions(-)

diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
index 3e95954..aa70e43 100644
--- a/arch/arm/plat-omap/i2c.c
+++ b/arch/arm/plat-omap/i2c.c
@@ -119,6 +119,46 @@ static void __init omap_i2c_mux_pins(int bus)
 	omap_cfg_reg(scl);
 }
 
+static int __init omap_i2c_nr_ports(void)
+{
+	int ports = 0;
+
+	if (cpu_class_is_omap1())
+		ports = 1;
+	else if (cpu_is_omap24xx())
+		ports = 2;
+	else if (cpu_is_omap34xx())
+		ports = 3;
+
+	return ports;
+}
+
+/**
+ * omap_i2c_bus_setup - Process command line options for the I2C bus speed
+ * @str: String of options
+ *
+ * This function allow to override the default I2C bus speed for given I2C
+ * bus with a command line option.
+ *
+ * Format: i2c_bus=bus_id,clkrate (in kHz)
+ *
+ * Returns 1 on success, 0 otherwise.
+ */
+static int __init omap_i2c_bus_setup(char *str)
+{
+	int ports;
+	int ints[3];
+
+	ports = omap_i2c_nr_ports();
+	get_options(str, 3, ints);
+	if (ints[0] < 2 || ints[1] < 1 || ints[1] > ports)
+		return 0;
+	i2c_rate[ints[1] - 1] = ints[2];
+
+	return 1;
+}
+__setup("i2c_bus=", omap_i2c_bus_setup);
+
 /**
  * omap_register_i2c_bus - register I2C bus with device descriptors
  * @bus_id: bus id counting from number 1
@@ -132,19 +172,12 @@ int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
 			  struct i2c_board_info const *info,
 			  unsigned len)
 {
-	int ports, err;
+	int err;
 	struct platform_device *pdev;
 	struct resource *res;
 	resource_size_t base, irq;
 
-	if (cpu_class_is_omap1())
-		ports = 1;
-	else if (cpu_is_omap24xx())
-		ports = 2;
-	else if (cpu_is_omap34xx())
-		ports = 3;
-
-	BUG_ON(bus_id < 1 || bus_id > ports);
+	BUG_ON(bus_id < 1 || bus_id > omap_i2c_nr_ports());
 
 	if (info) {
 		err = i2c_register_board_info(bus_id, info, len);
@@ -153,7 +186,8 @@ int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
 	}
 
 	pdev = &omap_i2c_devices[bus_id - 1];
-	*(u32 *)pdev->dev.platform_data = clkrate;
+	if (i2c_rate[bus_id - 1] == 0)
+		i2c_rate[bus_id - 1] = clkrate;
 
 	if (bus_id == 1) {
 		res = pdev->resource;


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 4/7] ARM: OMAP: Add method to register additional I2C busses on the command line
  2009-03-04 21:47 [PATCH 0/7] Updates for common omap code for next merge window Tony Lindgren
                   ` (2 preceding siblings ...)
  2009-03-04 21:51 ` [PATCH 3/7] ARM: OMAP: Add command line option for I2C bus speed Tony Lindgren
@ 2009-03-04 21:52 ` Tony Lindgren
  2009-03-04 21:53 ` [PATCH 5/7] ARM: OMAP: Get available DMA channels from cmdline Tony Lindgren
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 24+ messages in thread
From: Tony Lindgren @ 2009-03-04 21:52 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-omap, Jarkko Nikula

From: Jarkko Nikula <jarkko.nikula@nokia.com>

This patch extends command line option "i2c_bus=bus_id,clkrate" so that
it allow to register additional I2C busses that are not registered with
omap_register_i2c_bus from board initialization code.

Purpose of this is to register additional board busses which are routed
to external connectors only without any on board I2C devices.

Signed-off-by: Jarkko Nikula <jarkko.nikula@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/plat-omap/i2c.c |   73 +++++++++++++++++++++++++++++++++-------------
 1 files changed, 52 insertions(+), 21 deletions(-)

diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
index aa70e43..a303071 100644
--- a/arch/arm/plat-omap/i2c.c
+++ b/arch/arm/plat-omap/i2c.c
@@ -98,6 +98,8 @@ static const int omap34xx_pins[][2] = {
 static const int omap34xx_pins[][2] = {};
 #endif
 
+#define OMAP_I2C_CMDLINE_SETUP	(BIT(31))
+
 static void __init omap_i2c_mux_pins(int bus)
 {
 	int scl, sda;
@@ -133,6 +135,31 @@ static int __init omap_i2c_nr_ports(void)
 	return ports;
 }
 
+static int __init omap_i2c_add_bus(int bus_id)
+{
+	struct platform_device *pdev;
+	struct resource *res;
+	resource_size_t base, irq;
+
+	pdev = &omap_i2c_devices[bus_id - 1];
+	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;
+	}
+
+	omap_i2c_mux_pins(bus_id - 1);
+	return platform_device_register(pdev);
+}
+
 /**
  * omap_i2c_bus_setup - Process command line options for the I2C bus speed
  * @str: String of options
@@ -154,11 +181,33 @@ static int __init omap_i2c_bus_setup(char *str)
 	if (ints[0] < 2 || ints[1] < 1 || ints[1] > ports)
 		return 0;
 	i2c_rate[ints[1] - 1] = ints[2];
+	i2c_rate[ints[1] - 1] |= OMAP_I2C_CMDLINE_SETUP;
 
 	return 1;
 }
 __setup("i2c_bus=", omap_i2c_bus_setup);
 
+/*
+ * Register busses defined in command line but that are not registered with
+ * omap_register_i2c_bus from board initialization code.
+ */
+static int __init omap_register_i2c_bus_cmdline(void)
+{
+	int i, err = 0;
+
+	for (i = 0; i < ARRAY_SIZE(i2c_rate); i++)
+		if (i2c_rate[i] & OMAP_I2C_CMDLINE_SETUP) {
+			i2c_rate[i] &= ~OMAP_I2C_CMDLINE_SETUP;
+			err = omap_i2c_add_bus(i + 1);
+			if (err)
+				goto out;
+		}
+
+out:
+	return err;
+}
+subsys_initcall(omap_register_i2c_bus_cmdline);
+
 /**
  * omap_register_i2c_bus - register I2C bus with device descriptors
  * @bus_id: bus id counting from number 1
@@ -173,9 +222,6 @@ int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
 			  unsigned len)
 {
 	int err;
-	struct platform_device *pdev;
-	struct resource *res;
-	resource_size_t base, irq;
 
 	BUG_ON(bus_id < 1 || bus_id > omap_i2c_nr_ports());
 
@@ -185,24 +231,9 @@ int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
 			return err;
 	}
 
-	pdev = &omap_i2c_devices[bus_id - 1];
-	if (i2c_rate[bus_id - 1] == 0)
+	if (!i2c_rate[bus_id - 1])
 		i2c_rate[bus_id - 1] = clkrate;
+	i2c_rate[bus_id - 1] &= ~OMAP_I2C_CMDLINE_SETUP;
 
-	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;
-	}
-
-	omap_i2c_mux_pins(bus_id - 1);
-	return platform_device_register(pdev);
+	return omap_i2c_add_bus(bus_id);
 }


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 5/7] ARM: OMAP: Get available DMA channels from cmdline
  2009-03-04 21:47 [PATCH 0/7] Updates for common omap code for next merge window Tony Lindgren
                   ` (3 preceding siblings ...)
  2009-03-04 21:52 ` [PATCH 4/7] ARM: OMAP: Add method to register additional I2C busses on the command line Tony Lindgren
@ 2009-03-04 21:53 ` Tony Lindgren
  2009-03-04 21:54 ` [PATCH 6/7] ARM: OMAP: Dispatch only relevant DMA interrupts Tony Lindgren
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 24+ messages in thread
From: Tony Lindgren @ 2009-03-04 21:53 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: Nishant Kamat, linux-omap, Santosh Shilimkar

From: Santosh Shilimkar <santosh.shilimkar@ti.com>

This patch set up a cmdline option for omap dma for masking the
available channels. It is needed since the OMAP DMA is a system wide
resource and can be used by another software apart from the kernel.

To reserve the omap SDMA channels for kernel dma usage, use cmdline
bootarg "omap_dma_reserve_ch=". The valid range is 1 to 32.

Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: Nishant Kamat <nskamat@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/plat-omap/dma.c |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index 47ec77a..eca43bb 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -123,6 +123,7 @@ static struct dma_link_info *dma_linked_lch;
 
 static int dma_lch_count;
 static int dma_chan_count;
+static int omap_dma_reserve_channels;
 
 static spinlock_t dma_chan_lock;
 static struct omap_dma_lch *dma_chan;
@@ -2321,6 +2322,10 @@ static int __init omap_init_dma(void)
 		return -ENODEV;
 	}
 
+	if (cpu_class_is_omap2() && omap_dma_reserve_channels
+			&& (omap_dma_reserve_channels <= dma_lch_count))
+		dma_lch_count = omap_dma_reserve_channels;
+
 	dma_chan = kzalloc(sizeof(struct omap_dma_lch) * dma_lch_count,
 				GFP_KERNEL);
 	if (!dma_chan)
@@ -2371,7 +2376,7 @@ static int __init omap_init_dma(void)
 		u8 revision = dma_read(REVISION) & 0xff;
 		printk(KERN_INFO "OMAP DMA hardware revision %d.%d\n",
 		       revision >> 4, revision & 0xf);
-		dma_chan_count = OMAP_DMA4_LOGICAL_DMA_CH_COUNT;
+		dma_chan_count = dma_lch_count;
 	} else {
 		dma_chan_count = 0;
 		return 0;
@@ -2437,4 +2442,17 @@ static int __init omap_init_dma(void)
 
 arch_initcall(omap_init_dma);
 
+/*
+ * Reserve the omap SDMA channels using cmdline bootarg
+ * "omap_dma_reserve_ch=". The valid range is 1 to 32
+ */
+static int __init omap_dma_cmdline_reserve_ch(char *str)
+{
+	if (get_option(&str, &omap_dma_reserve_channels) != 1)
+		omap_dma_reserve_channels = 0;
+	return 1;
+}
+
+__setup("omap_dma_reserve_ch=", omap_dma_cmdline_reserve_ch);
+
 


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 6/7] ARM: OMAP: Dispatch only relevant DMA interrupts
  2009-03-04 21:47 [PATCH 0/7] Updates for common omap code for next merge window Tony Lindgren
                   ` (4 preceding siblings ...)
  2009-03-04 21:53 ` [PATCH 5/7] ARM: OMAP: Get available DMA channels from cmdline Tony Lindgren
@ 2009-03-04 21:54 ` Tony Lindgren
  2009-03-04 21:56 ` [PATCH 7/7] ARM: OMAP: get rid of OMAP_TAG_USB Tony Lindgren
  2009-03-16 17:31 ` [PATCH 0/7] Updates for common omap code for next merge window Tony Lindgren
  7 siblings, 0 replies; 24+ messages in thread
From: Tony Lindgren @ 2009-03-04 21:54 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: Nishant Kamat, linux-omap, Santosh Shilimkar

From: Santosh Shilimkar <santosh.shilimkar@ti.com>

This fixes the spurious interrupt issue on a DMA channel.

In OMAP sDMA, contrast to the SDMA.DMA4_CSRi registers, the
SDMA.DMA4_IRQSTATUS_Lj registers are updated regardless of
the corresponding bits in the SDMA.DMA4_IRQENABLE_Lj registers.
Since there are four sDMA interrupt lines and if more than one
line is actively used by two concurrently running sDMA softwares
modules,then the spurious interrupt can be observed on the other
lines.

Fix in this patch will only dispatch the relevant and enabled
interrupts on a particular line thus perevting spurious IRQ.

Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: Nishant Kamat <nskamat@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/plat-omap/dma.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index eca43bb..c46e5a4 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -1901,7 +1901,7 @@ static int omap2_dma_handle_ch(int ch)
 /* STATUS register count is from 1-32 while our is 0-31 */
 static irqreturn_t omap2_dma_irq_handler(int irq, void *dev_id)
 {
-	u32 val;
+	u32 val, enable_reg;
 	int i;
 
 	val = dma_read(IRQSTATUS_L0);
@@ -1910,6 +1910,8 @@ static irqreturn_t omap2_dma_irq_handler(int irq, void *dev_id)
 			printk(KERN_WARNING "Spurious DMA IRQ\n");
 		return IRQ_HANDLED;
 	}
+	enable_reg = dma_read(IRQENABLE_L0);
+	val &= enable_reg; /* Dispatch only relevant interrupts */
 	for (i = 0; i < dma_lch_count && val != 0; i++) {
 		if (val & 1)
 			omap2_dma_handle_ch(i);


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 7/7] ARM: OMAP: get rid of OMAP_TAG_USB
  2009-03-04 21:47 [PATCH 0/7] Updates for common omap code for next merge window Tony Lindgren
                   ` (5 preceding siblings ...)
  2009-03-04 21:54 ` [PATCH 6/7] ARM: OMAP: Dispatch only relevant DMA interrupts Tony Lindgren
@ 2009-03-04 21:56 ` Tony Lindgren
  2009-03-11 16:31   ` [PATCH 7/7] ARM: OMAP: get rid of OMAP_TAG_USB, v2 Tony Lindgren
  2009-03-16 17:31 ` [PATCH 0/7] Updates for common omap code for next merge window Tony Lindgren
  7 siblings, 1 reply; 24+ messages in thread
From: Tony Lindgren @ 2009-03-04 21:56 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: Felipe Balbi, linux-omap

From: Felipe Balbi <felipe.balbi@nokia.com>

OMAP_TAGS should vanish soon since they're not generic arm tags.
Most of them can be converted to a platform_data or parsed
from a command line like e.g. serial tag.

For OMAP_TAG_USB we just let boards call omap_usb_init()
passing a pointer to omap_usb_config.

Patch updated by Tony for mainline, basically make
n770 and h4 compile.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap1/board-ams-delta.c   |    2 +-
 arch/arm/mach-omap1/board-generic.c     |    5 ++---
 arch/arm/mach-omap1/board-h2.c          |    2 +-
 arch/arm/mach-omap1/board-h3.c          |    2 +-
 arch/arm/mach-omap1/board-innovator.c   |    5 ++---
 arch/arm/mach-omap1/board-nokia770.c    |    9 +-------
 arch/arm/mach-omap1/board-osk.c         |    2 +-
 arch/arm/mach-omap1/board-palmte.c      |    2 +-
 arch/arm/mach-omap1/board-palmtt.c      |    2 +-
 arch/arm/mach-omap1/board-palmz71.c     |    2 +-
 arch/arm/mach-omap1/board-sx1.c         |    2 +-
 arch/arm/mach-omap1/board-voiceblue.c   |    2 +-
 arch/arm/mach-omap2/board-apollon.c     |    2 +-
 arch/arm/mach-omap2/board-h4.c          |   34 +++++++++++++++++++++++++++++++
 arch/arm/plat-omap/include/mach/board.h |    1 -
 arch/arm/plat-omap/include/mach/usb.h   |    2 ++
 arch/arm/plat-omap/usb.c                |   25 ++++-------------------
 17 files changed, 55 insertions(+), 46 deletions(-)

diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index 2e61839..8b40aac 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -175,7 +175,6 @@ static struct omap_usb_config ams_delta_usb_config __initdata = {
 static struct omap_board_config_kernel ams_delta_config[] = {
 	{ OMAP_TAG_LCD,		&ams_delta_lcd_config },
 	{ OMAP_TAG_UART,	&ams_delta_uart_config },
-	{ OMAP_TAG_USB,		&ams_delta_usb_config },
 };
 
 static struct resource ams_delta_kp_resources[] = {
@@ -232,6 +231,7 @@ static void __init ams_delta_init(void)
 	/* Clear latch2 (NAND, LCD, modem enable) */
 	ams_delta_latch2_write(~0, 0);
 
+	omap_usb_init(&ams_delta_usb_config);
 	platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices));
 }
 
diff --git a/arch/arm/mach-omap1/board-generic.c b/arch/arm/mach-omap1/board-generic.c
index 7d26702..e724940 100644
--- a/arch/arm/mach-omap1/board-generic.c
+++ b/arch/arm/mach-omap1/board-generic.c
@@ -62,7 +62,6 @@ static struct omap_uart_config generic_uart_config __initdata = {
 };
 
 static struct omap_board_config_kernel generic_config[] __initdata = {
-	{ OMAP_TAG_USB,		NULL },
 	{ OMAP_TAG_UART,	&generic_uart_config },
 };
 
@@ -70,12 +69,12 @@ static void __init omap_generic_init(void)
 {
 #ifdef CONFIG_ARCH_OMAP15XX
 	if (cpu_is_omap15xx()) {
-		generic_config[0].data = &generic1510_usb_config;
+		omap_usb_init(&generic1510_usb_config);
 	}
 #endif
 #if defined(CONFIG_ARCH_OMAP16XX)
 	if (!cpu_is_omap1510()) {
-		generic_config[0].data = &generic1610_usb_config;
+		omap_usb_init(&generic1610_usb_config);
 	}
 #endif
 
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index 0d784a7..9f3b392 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -364,7 +364,6 @@ static struct omap_lcd_config h2_lcd_config __initdata = {
 };
 
 static struct omap_board_config_kernel h2_config[] __initdata = {
-	{ OMAP_TAG_USB,		&h2_usb_config },
 	{ OMAP_TAG_UART,	&h2_uart_config },
 	{ OMAP_TAG_LCD,		&h2_lcd_config },
 };
@@ -413,6 +412,7 @@ static void __init h2_init(void)
 	omap_serial_init();
 	omap_register_i2c_bus(1, 100, h2_i2c_board_info,
 			      ARRAY_SIZE(h2_i2c_board_info));
+	omap_usb_init(&h2_usb_config);
 	h2_mmc_init();
 }
 
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index bf08b6a..a3c513d 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -418,7 +418,6 @@ static struct omap_lcd_config h3_lcd_config __initdata = {
 };
 
 static struct omap_board_config_kernel h3_config[] __initdata = {
-	{ OMAP_TAG_USB,		&h3_usb_config },
 	{ OMAP_TAG_UART,	&h3_uart_config },
 	{ OMAP_TAG_LCD,		&h3_lcd_config },
 };
@@ -472,6 +471,7 @@ static void __init h3_init(void)
 	omap_serial_init();
 	omap_register_i2c_bus(1, 100, h3_i2c_board_info,
 			      ARRAY_SIZE(h3_i2c_board_info));
+	omap_usb_init(&h3_usb_config);
 	h3_mmc_init();
 }
 
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index 071cd02..ed7ee07 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -370,7 +370,6 @@ static struct omap_uart_config innovator_uart_config __initdata = {
 };
 
 static struct omap_board_config_kernel innovator_config[] = {
-	{ OMAP_TAG_USB,         NULL },
 	{ OMAP_TAG_LCD,		NULL },
 	{ OMAP_TAG_UART,	&innovator_uart_config },
 };
@@ -392,13 +391,13 @@ static void __init innovator_init(void)
 
 #ifdef CONFIG_ARCH_OMAP15XX
 	if (cpu_is_omap1510()) {
-		innovator_config[0].data = &innovator1510_usb_config;
+		omap_usb_init(&innovator1510_usb_config);
 		innovator_config[1].data = &innovator1510_lcd_config;
 	}
 #endif
 #ifdef CONFIG_ARCH_OMAP16XX
 	if (cpu_is_omap1610()) {
-		innovator_config[0].data = &h2_usb_config;
+		omap_usb_init(&h2_usb_config);
 		innovator_config[1].data = &innovator1610_lcd_config;
 	}
 #endif
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index af51e0b..7bc7a3c 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -233,10 +233,6 @@ static inline void nokia770_mmc_init(void)
 }
 #endif
 
-static struct omap_board_config_kernel nokia770_config[] __initdata = {
-	{ OMAP_TAG_USB,		NULL },
-};
-
 #if	defined(CONFIG_OMAP_DSP)
 /*
  * audio power control
@@ -371,19 +367,16 @@ static __init int omap_dsp_init(void)
 
 static void __init omap_nokia770_init(void)
 {
-	nokia770_config[0].data = &nokia770_usb_config;
-
 	platform_add_devices(nokia770_devices, ARRAY_SIZE(nokia770_devices));
 	spi_register_board_info(nokia770_spi_board_info,
 				ARRAY_SIZE(nokia770_spi_board_info));
-	omap_board_config = nokia770_config;
-	omap_board_config_size = ARRAY_SIZE(nokia770_config);
 	omap_gpio_init();
 	omap_serial_init();
 	omap_register_i2c_bus(1, 100, NULL, 0);
 	omap_dsp_init();
 	ads7846_dev_init();
 	mipid_dev_init();
+	omap_usb_init(&nokia770_usb_config);
 	nokia770_mmc_init();
 }
 
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index 1a16ecb..99913ac 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -290,7 +290,6 @@ static struct omap_lcd_config osk_lcd_config __initdata = {
 #endif
 
 static struct omap_board_config_kernel osk_config[] __initdata = {
-	{ OMAP_TAG_USB,           &osk_usb_config },
 	{ OMAP_TAG_UART,		&osk_uart_config },
 #ifdef	CONFIG_OMAP_OSK_MISTRAL
 	{ OMAP_TAG_LCD,			&osk_lcd_config },
@@ -510,6 +509,7 @@ static void __init osk_mistral_init(void)
 	i2c_register_board_info(1, mistral_i2c_board_info,
 			ARRAY_SIZE(mistral_i2c_board_info));
 
+	omap_usb_init(&osk_usb_config);
 	platform_add_devices(mistral_devices, ARRAY_SIZE(mistral_devices));
 }
 #else
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
index 99f2b43..b2d3a36 100644
--- a/arch/arm/mach-omap1/board-palmte.c
+++ b/arch/arm/mach-omap1/board-palmte.c
@@ -286,7 +286,6 @@ static void palmte_get_power_status(struct apm_power_info *info, int *battery)
 #endif
 
 static struct omap_board_config_kernel palmte_config[] __initdata = {
-	{ OMAP_TAG_USB,		&palmte_usb_config },
 	{ OMAP_TAG_LCD,		&palmte_lcd_config },
 	{ OMAP_TAG_UART,	&palmte_uart_config },
 };
@@ -341,6 +340,7 @@ static void __init omap_palmte_init(void)
 	spi_register_board_info(palmte_spi_info, ARRAY_SIZE(palmte_spi_info));
 	palmte_misc_gpio_setup();
 	omap_serial_init();
+	omap_usb_init(&palmte_usb_config);
 	omap_register_i2c_bus(1, 100, NULL, 0);
 }
 
diff --git a/arch/arm/mach-omap1/board-palmtt.c b/arch/arm/mach-omap1/board-palmtt.c
index 1cbc127..90795bf 100644
--- a/arch/arm/mach-omap1/board-palmtt.c
+++ b/arch/arm/mach-omap1/board-palmtt.c
@@ -272,7 +272,6 @@ static struct omap_uart_config palmtt_uart_config __initdata = {
 };
 
 static struct omap_board_config_kernel palmtt_config[] __initdata = {
-	{ OMAP_TAG_USB,		&palmtt_usb_config	},
 	{ OMAP_TAG_LCD,		&palmtt_lcd_config	},
 	{ OMAP_TAG_UART,	&palmtt_uart_config	},
 };
@@ -297,6 +296,7 @@ static void __init omap_palmtt_init(void)
 
 	spi_register_board_info(palmtt_boardinfo,ARRAY_SIZE(palmtt_boardinfo));
 	omap_serial_init();
+	omap_usb_init(&palmtt_usb_config);
 	omap_register_i2c_bus(1, 100, NULL, 0);
 }
 
diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c
index baf5efb..89b50e8 100644
--- a/arch/arm/mach-omap1/board-palmz71.c
+++ b/arch/arm/mach-omap1/board-palmz71.c
@@ -239,7 +239,6 @@ static struct omap_uart_config palmz71_uart_config __initdata = {
 };
 
 static struct omap_board_config_kernel palmz71_config[] __initdata = {
-	{OMAP_TAG_USB,	&palmz71_usb_config},
 	{OMAP_TAG_LCD,	&palmz71_lcd_config},
 	{OMAP_TAG_UART,	&palmz71_uart_config},
 };
@@ -313,6 +312,7 @@ omap_palmz71_init(void)
 
 	spi_register_board_info(palmz71_boardinfo,
 				ARRAY_SIZE(palmz71_boardinfo));
+	omap_usb_init(&palmz71_usb_config);
 	omap_serial_init();
 	omap_register_i2c_bus(1, 100, NULL, 0);
 	palmz71_gpio_setup(0);
diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c
index 28c76a1..7d6f0b7 100644
--- a/arch/arm/mach-omap1/board-sx1.c
+++ b/arch/arm/mach-omap1/board-sx1.c
@@ -373,7 +373,6 @@ static struct omap_uart_config sx1_uart_config __initdata = {
 };
 
 static struct omap_board_config_kernel sx1_config[] __initdata = {
-	{ OMAP_TAG_USB,	&sx1_usb_config },
 	{ OMAP_TAG_LCD,	&sx1_lcd_config },
 	{ OMAP_TAG_UART,	&sx1_uart_config },
 };
@@ -388,6 +387,7 @@ static void __init omap_sx1_init(void)
 	omap_board_config_size = ARRAY_SIZE(sx1_config);
 	omap_serial_init();
 	omap_register_i2c_bus(1, 100, NULL, 0);
+	omap_usb_init(&sx1_usb_config);
 	sx1_mmc_init();
 
 	/* turn on USB power */
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index a765354..98275e0 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -145,7 +145,6 @@ static struct omap_uart_config voiceblue_uart_config __initdata = {
 };
 
 static struct omap_board_config_kernel voiceblue_config[] = {
-	{ OMAP_TAG_USB,  &voiceblue_usb_config },
 	{ OMAP_TAG_UART, &voiceblue_uart_config },
 };
 
@@ -185,6 +184,7 @@ static void __init voiceblue_init(void)
 	omap_board_config = voiceblue_config;
 	omap_board_config_size = ARRAY_SIZE(voiceblue_config);
 	omap_serial_init();
+	omap_usb_init(&voiceblue_usb_config);
 	omap_register_i2c_bus(1, 100, NULL, 0);
 
 	/* There is a good chance board is going up, so enable power LED
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
index 0a7b24b..30e7049 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -272,7 +272,6 @@ static struct omap_lcd_config apollon_lcd_config __initdata = {
 
 static struct omap_board_config_kernel apollon_config[] = {
 	{ OMAP_TAG_UART,	&apollon_uart_config },
-	{ OMAP_TAG_USB,		&apollon_usb_config },
 	{ OMAP_TAG_LCD,		&apollon_lcd_config },
 };
 
@@ -299,6 +298,7 @@ static void __init apollon_usb_init(void)
 	omap_cfg_reg(P21_242X_GPIO12);
 	gpio_request(12, "USB suspend");
 	gpio_direction_output(12, 0);
+	omap_usb_init(&apollon_usb_config);
 }
 
 static void __init omap_apollon_init(void)
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index 5e9b146..ff51c0f 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -377,6 +377,39 @@ static struct omap_lcd_config h4_lcd_config __initdata = {
 	.ctrl_name	= "internal",
 };
 
+static struct omap_usb_config h4_usb_config __initdata = {
+#ifdef	CONFIG_MACH_OMAP2_H4_USB1
+	/* NOTE:  usb1 could also be used with 3 wire signaling */
+	.pins[1]	= 4,
+#endif
+
+#ifdef	CONFIG_MACH_OMAP_H4_OTG
+	/* S1.10 ON -- USB OTG port
+	 * usb0 switched to Mini-AB port and isp1301 transceiver;
+	 * S2.POS3 = OFF, S2.POS4 = ON ... to allow battery charging
+	 */
+	.otg		= 1,
+	.pins[0]	= 4,
+#ifdef	CONFIG_USB_GADGET_OMAP
+	/* use OTG cable, or standard A-to-MiniB */
+	.hmc_mode	= 0x14,	/* 0:dev/otg 1:host 2:disable */
+#elif	defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
+	/* use OTG cable, or NONSTANDARD (B-to-MiniB) */
+	.hmc_mode	= 0x11,	/* 0:host 1:host 2:disable */
+#endif	/* XX */
+
+#else
+	/* S1.10 OFF -- usb "download port"
+	 * usb0 switched to Mini-B port and isp1105 transceiver;
+	 * S2.POS3 = ON, S2.POS4 = OFF ... to enable battery charging
+	 */
+	.register_dev	= 1,
+	.pins[0]	= 3,
+/*	.hmc_mode	= 0x14,*/	/* 0:dev 1:host 2:disable */
+	.hmc_mode	= 0x00,		/* 0:dev|otg 1:disable 2:disable */
+#endif
+};
+
 static struct omap_board_config_kernel h4_config[] = {
 	{ OMAP_TAG_UART,	&h4_uart_config },
 	{ OMAP_TAG_LCD,		&h4_lcd_config },
@@ -428,6 +461,7 @@ static void __init omap_h4_init(void)
 	platform_add_devices(h4_devices, ARRAY_SIZE(h4_devices));
 	omap_board_config = h4_config;
 	omap_board_config_size = ARRAY_SIZE(h4_config);
+	omap_usb_init(&h4_usb_config);
 	omap_serial_init();
 }
 
diff --git a/arch/arm/plat-omap/include/mach/board.h b/arch/arm/plat-omap/include/mach/board.h
index 9466772..5e857f8 100644
--- a/arch/arm/plat-omap/include/mach/board.h
+++ b/arch/arm/plat-omap/include/mach/board.h
@@ -17,7 +17,6 @@
 /* Different peripheral ids */
 #define OMAP_TAG_CLOCK		0x4f01
 #define OMAP_TAG_SERIAL_CONSOLE 0x4f03
-#define OMAP_TAG_USB		0x4f04
 #define OMAP_TAG_LCD		0x4f05
 #define OMAP_TAG_GPIO_SWITCH	0x4f06
 #define OMAP_TAG_UART		0x4f07
diff --git a/arch/arm/plat-omap/include/mach/usb.h b/arch/arm/plat-omap/include/mach/usb.h
index a56a610..e033e51 100644
--- a/arch/arm/plat-omap/include/mach/usb.h
+++ b/arch/arm/plat-omap/include/mach/usb.h
@@ -29,6 +29,8 @@
 
 #endif
 
+void omap_usb_init(struct omap_usb_config *pdata);
+
 /*-------------------------------------------------------------------------*/
 
 /*
diff --git a/arch/arm/plat-omap/usb.c b/arch/arm/plat-omap/usb.c
index e278de6..509f2ed 100644
--- a/arch/arm/plat-omap/usb.c
+++ b/arch/arm/plat-omap/usb.c
@@ -729,30 +729,13 @@ static inline void omap_1510_usb_init(struct omap_usb_config *config) {}
 
 /*-------------------------------------------------------------------------*/
 
-static struct omap_usb_config platform_data;
-
-static int __init
-omap_usb_init(void)
+void __init omap_usb_init(struct omap_usb_config *pdata)
 {
-	const struct omap_usb_config *config;
-
-	config = omap_get_config(OMAP_TAG_USB, struct omap_usb_config);
-	if (config == NULL) {
-		printk(KERN_ERR "USB: No board-specific "
-				"platform config found\n");
-		return -ENODEV;
-	}
-	platform_data = *config;
-
 	if (cpu_is_omap730() || cpu_is_omap16xx() || cpu_is_omap24xx())
-		omap_otg_init(&platform_data);
+		omap_otg_init(pdata);
 	else if (cpu_is_omap15xx())
-		omap_1510_usb_init(&platform_data);
-	else {
+		omap_1510_usb_init(pdata);
+	else
 		printk(KERN_ERR "USB: No init for your chip yet\n");
-		return -ENODEV;
-	}
-	return 0;
 }
 
-subsys_initcall(omap_usb_init);


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 3/7] ARM: OMAP: Add command line option for I2C bus speed
  2009-03-04 21:51 ` [PATCH 3/7] ARM: OMAP: Add command line option for I2C bus speed Tony Lindgren
@ 2009-03-05 16:20   ` Tony Lindgren
  2009-03-05 19:37     ` Felipe Balbi
  2009-03-06  7:13     ` Jarkko Nikula
  0 siblings, 2 replies; 24+ messages in thread
From: Tony Lindgren @ 2009-03-05 16:20 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-omap, Jarkko Nikula

* Tony Lindgren <tony@atomide.com> [090304 13:51]:
> From: Jarkko Nikula <jarkko.nikula@nokia.com>
> 
> This patch adds a new command line option "i2c_bus=bus_id,clkrate" into
> I2C bus registration helper. Purpose of the option is to override the
> default board specific bus speed which is supplied by the
> omap_register_i2c_bus.
> 
> The default bus speed is typically set to speed of slowest I2C chip on the
> bus and overriding allow to use some experimental configurations or updated
> chip versions without any kernel modifications.

Jarkko, this should also be in Documentation/kernel-parameters.txt. Can
you please reply with a patch for that, and I'll fold it into this
patch?

Also, maybe it should be called omap_i2c_bus instead of i2c_bus?

Regards,

Tony
 
> Signed-off-by: Jarkko Nikula <jarkko.nikula@nokia.com>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  arch/arm/plat-omap/i2c.c |   54 +++++++++++++++++++++++++++++++++++++---------
>  1 files changed, 44 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
> index 3e95954..aa70e43 100644
> --- a/arch/arm/plat-omap/i2c.c
> +++ b/arch/arm/plat-omap/i2c.c
> @@ -119,6 +119,46 @@ static void __init omap_i2c_mux_pins(int bus)
>  	omap_cfg_reg(scl);
>  }
>  
> +static int __init omap_i2c_nr_ports(void)
> +{
> +	int ports = 0;
> +
> +	if (cpu_class_is_omap1())
> +		ports = 1;
> +	else if (cpu_is_omap24xx())
> +		ports = 2;
> +	else if (cpu_is_omap34xx())
> +		ports = 3;
> +
> +	return ports;
> +}
> +
> +/**
> + * omap_i2c_bus_setup - Process command line options for the I2C bus speed
> + * @str: String of options
> + *
> + * This function allow to override the default I2C bus speed for given I2C
> + * bus with a command line option.
> + *
> + * Format: i2c_bus=bus_id,clkrate (in kHz)
> + *
> + * Returns 1 on success, 0 otherwise.
> + */
> +static int __init omap_i2c_bus_setup(char *str)
> +{
> +	int ports;
> +	int ints[3];
> +
> +	ports = omap_i2c_nr_ports();
> +	get_options(str, 3, ints);
> +	if (ints[0] < 2 || ints[1] < 1 || ints[1] > ports)
> +		return 0;
> +	i2c_rate[ints[1] - 1] = ints[2];
> +
> +	return 1;
> +}
> +__setup("i2c_bus=", omap_i2c_bus_setup);
> +
>  /**
>   * omap_register_i2c_bus - register I2C bus with device descriptors
>   * @bus_id: bus id counting from number 1
> @@ -132,19 +172,12 @@ int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
>  			  struct i2c_board_info const *info,
>  			  unsigned len)
>  {
> -	int ports, err;
> +	int err;
>  	struct platform_device *pdev;
>  	struct resource *res;
>  	resource_size_t base, irq;
>  
> -	if (cpu_class_is_omap1())
> -		ports = 1;
> -	else if (cpu_is_omap24xx())
> -		ports = 2;
> -	else if (cpu_is_omap34xx())
> -		ports = 3;
> -
> -	BUG_ON(bus_id < 1 || bus_id > ports);
> +	BUG_ON(bus_id < 1 || bus_id > omap_i2c_nr_ports());
>  
>  	if (info) {
>  		err = i2c_register_board_info(bus_id, info, len);
> @@ -153,7 +186,8 @@ int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
>  	}
>  
>  	pdev = &omap_i2c_devices[bus_id - 1];
> -	*(u32 *)pdev->dev.platform_data = clkrate;
> +	if (i2c_rate[bus_id - 1] == 0)
> +		i2c_rate[bus_id - 1] = clkrate;
>  
>  	if (bus_id == 1) {
>  		res = pdev->resource;
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 3/7] ARM: OMAP: Add command line option for I2C bus speed
  2009-03-05 16:20   ` Tony Lindgren
@ 2009-03-05 19:37     ` Felipe Balbi
  2009-03-06  7:13     ` Jarkko Nikula
  1 sibling, 0 replies; 24+ messages in thread
From: Felipe Balbi @ 2009-03-05 19:37 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-arm-kernel, linux-omap, Jarkko Nikula

On Thu, Mar 05, 2009 at 08:20:43AM -0800, Tony Lindgren wrote:
> Also, maybe it should be called omap_i2c_bus instead of i2c_bus?

or maybe not, then other archs would have the opportunity to setup their
own function to handle i2c_bus= cmdline without having to add a brand
new <arch>_i2c_bus one ;-)

-- 
balbi

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 3/7] ARM: OMAP: Add command line option for I2C bus speed
  2009-03-05 16:20   ` Tony Lindgren
  2009-03-05 19:37     ` Felipe Balbi
@ 2009-03-06  7:13     ` Jarkko Nikula
  2009-03-06 16:13       ` Tony Lindgren
  1 sibling, 1 reply; 24+ messages in thread
From: Jarkko Nikula @ 2009-03-06  7:13 UTC (permalink / raw)
  To: ext Tony Lindgren; +Cc: linux-arm-kernel, linux-omap

On Thu, 5 Mar 2009 17:20:43 +0100
ext Tony Lindgren <tony@atomide.com> wrote:

> Jarkko, this should also be in Documentation/kernel-parameters.txt.
> Can you please reply with a patch for that, and I'll fold it into this
> patch?
> 
Ah, good, will do it over weekend - early next week. Probably better to
handle as a separate patch for easier merging with
kernel-parameters.txt?

> Also, maybe it should be called omap_i2c_bus instead of i2c_bus?
> 
I had similar thought as Felipe that it looks more generic this way.
But don't know now immediately would multibuild will work? Was that
your concern? E.g.

__setup("i2c_bus=", arm_xxx_i2c_bus_setup);
__setup("i2c_bus=", omap_i2c_bus_setup);


Jarkko

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 3/7] ARM: OMAP: Add command line option for I2C bus speed
  2009-03-06  7:13     ` Jarkko Nikula
@ 2009-03-06 16:13       ` Tony Lindgren
       [not found]         ` <20090306161349.GC32353-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
  2009-03-18 19:30         ` [PATCH 3/7] " Russell King - ARM Linux
  0 siblings, 2 replies; 24+ messages in thread
From: Tony Lindgren @ 2009-03-06 16:13 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: linux-arm-kernel, linux-omap

* Jarkko Nikula <jarkko.nikula@nokia.com> [090305 23:12]:
> On Thu, 5 Mar 2009 17:20:43 +0100
> ext Tony Lindgren <tony@atomide.com> wrote:
> 
> > Jarkko, this should also be in Documentation/kernel-parameters.txt.
> > Can you please reply with a patch for that, and I'll fold it into this
> > patch?
> > 
> Ah, good, will do it over weekend - early next week. Probably better to
> handle as a separate patch for easier merging with
> kernel-parameters.txt?

I think they should get merged as a single patch.
 
> > Also, maybe it should be called omap_i2c_bus instead of i2c_bus?
> > 
> I had similar thought as Felipe that it looks more generic this way.
> But don't know now immediately would multibuild will work? Was that
> your concern? E.g.
> 
> __setup("i2c_bus=", arm_xxx_i2c_bus_setup);
> __setup("i2c_bus=", omap_i2c_bus_setup);

Well is it generic enough to work for everybody? And if so, we should
run it by the LKML and the linux-i2c lists.

Any comments from other ARM platforms?

Regards,

Tony

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [2.6.29-rc7][take #2][PATCH 0/3] ARM: OMAP: Add command line option for I2C bus speed
       [not found]         ` <20090306161349.GC32353-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
@ 2009-03-10  8:47           ` Jarkko Nikula
       [not found]             ` <1236674831-3637-1-git-send-email-jarkko.nikula-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 24+ messages in thread
From: Jarkko Nikula @ 2009-03-10  8:47 UTC (permalink / raw)
  To: linux-omap-u79uwXL29TY76Z2rM5mHXA; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA

Hi

These patches are for linux-omap but we want to wide discussion also to
linux-i2c is the new command line option "i2c_bus=bus_id,clkrate" generic
enough to be used for other architectures as well in the future. Patches
are generated on top of mainline 2.6.29-rc7.

Purpose of this command line option is to both allow to override the default
board specific bus speed (patch 2) and register additional busses that
are not registered from board initialization code (patch 3).

Example for patch 2 would be the case where some on board component is upgraded
and which allows to use e.g. higher clock rate on the bus without other major
board changes.

Patch 3 can have more practical use however. E.g. second I2C bus on TI
BeagleBoard doesn't have on board components and thus it is not registered
by default with omap_register_i2c_bus. This bus is routed to expansion pin
header so with this patch it is able to register dynamically when needed.

These patches are previously discussed in these threads:

http://marc.info/?l=linux-omap&m=123635604511892&w=2
http://marc.info/?l=linux-omap&m=123661915517228&w=2


-- 
Jarkko

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [2.6.29-rc7][take #2][PATCH 1/3] ARM: OMAP: Add documentation for function omap_register_i2c_bus
       [not found]             ` <1236674831-3637-1-git-send-email-jarkko.nikula-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
@ 2009-03-10  8:47               ` Jarkko Nikula
  2009-03-10  8:47                 ` [2.6.29-rc7][take #2][PATCH 2/3] ARM: OMAP: Add command line option for I2C bus speed Jarkko Nikula
  0 siblings, 1 reply; 24+ messages in thread
From: Jarkko Nikula @ 2009-03-10  8:47 UTC (permalink / raw)
  To: linux-omap-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, Jarkko Nikula

Signed-off-by: Jarkko Nikula <jarkko.nikula-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
---
 arch/arm/plat-omap/i2c.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
index 467531e..3e95954 100644
--- a/arch/arm/plat-omap/i2c.c
+++ b/arch/arm/plat-omap/i2c.c
@@ -119,6 +119,15 @@ static void __init omap_i2c_mux_pins(int bus)
 	omap_cfg_reg(scl);
 }
 
+/**
+ * omap_register_i2c_bus - register I2C bus with device descriptors
+ * @bus_id: bus id counting from number 1
+ * @clkrate: clock rate of the bus in kHz
+ * @info: pointer into I2C device descriptor table or NULL
+ * @len: number of descriptors in the table
+ *
+ * Returns 0 on success or an error code.
+ */
 int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
 			  struct i2c_board_info const *info,
 			  unsigned len)
-- 
1.6.1.3

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [2.6.29-rc7][take #2][PATCH 2/3] ARM: OMAP: Add command line option for I2C bus speed
  2009-03-10  8:47               ` [2.6.29-rc7][take #2][PATCH 1/3] ARM: OMAP: Add documentation for function omap_register_i2c_bus Jarkko Nikula
@ 2009-03-10  8:47                 ` Jarkko Nikula
       [not found]                   ` <1236674831-3637-3-git-send-email-jarkko.nikula-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 24+ messages in thread
From: Jarkko Nikula @ 2009-03-10  8:47 UTC (permalink / raw)
  To: linux-omap; +Cc: linux-i2c, Jarkko Nikula

This patch adds a new command line option "i2c_bus=bus_id,clkrate" into
I2C bus registration helper. Purpose of the option is to override the
default board specific bus speed which is supplied by the
omap_register_i2c_bus.

The default bus speed is typically set to speed of slowest I2C chip on the
bus and overriding allow to use some experimental configurations or updated
chip versions without any kernel modifications.

Signed-off-by: Jarkko Nikula <jarkko.nikula@nokia.com>
---
 Documentation/kernel-parameters.txt |    4 ++
 arch/arm/plat-omap/i2c.c            |   54 ++++++++++++++++++++++++++++------
 2 files changed, 48 insertions(+), 10 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 54f21a5..d775076 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -830,6 +830,10 @@ and is between 256 and 4096 characters. It is defined in the file
 	hvc_iucv=	[S390] Number of z/VM IUCV hypervisor console (HVC)
 			       terminal devices. Valid values: 0..8
 
+	i2c_bus=	[HW] Override the default board specific I2C bus speed
+			     Format:
+			     <bus_id>,<clkrate>
+
 	i8042.debug	[HW] Toggle i8042 debug mode
 	i8042.direct	[HW] Put keyboard port into non-translated mode
 	i8042.dumbkbd	[HW] Pretend that controller can only read data from
diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
index 3e95954..aa70e43 100644
--- a/arch/arm/plat-omap/i2c.c
+++ b/arch/arm/plat-omap/i2c.c
@@ -119,6 +119,46 @@ static void __init omap_i2c_mux_pins(int bus)
 	omap_cfg_reg(scl);
 }
 
+static int __init omap_i2c_nr_ports(void)
+{
+	int ports = 0;
+
+	if (cpu_class_is_omap1())
+		ports = 1;
+	else if (cpu_is_omap24xx())
+		ports = 2;
+	else if (cpu_is_omap34xx())
+		ports = 3;
+
+	return ports;
+}
+
+/**
+ * omap_i2c_bus_setup - Process command line options for the I2C bus speed
+ * @str: String of options
+ *
+ * This function allow to override the default I2C bus speed for given I2C
+ * bus with a command line option.
+ *
+ * Format: i2c_bus=bus_id,clkrate (in kHz)
+ *
+ * Returns 1 on success, 0 otherwise.
+ */
+static int __init omap_i2c_bus_setup(char *str)
+{
+	int ports;
+	int ints[3];
+
+	ports = omap_i2c_nr_ports();
+	get_options(str, 3, ints);
+	if (ints[0] < 2 || ints[1] < 1 || ints[1] > ports)
+		return 0;
+	i2c_rate[ints[1] - 1] = ints[2];
+
+	return 1;
+}
+__setup("i2c_bus=", omap_i2c_bus_setup);
+
 /**
  * omap_register_i2c_bus - register I2C bus with device descriptors
  * @bus_id: bus id counting from number 1
@@ -132,19 +172,12 @@ int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
 			  struct i2c_board_info const *info,
 			  unsigned len)
 {
-	int ports, err;
+	int err;
 	struct platform_device *pdev;
 	struct resource *res;
 	resource_size_t base, irq;
 
-	if (cpu_class_is_omap1())
-		ports = 1;
-	else if (cpu_is_omap24xx())
-		ports = 2;
-	else if (cpu_is_omap34xx())
-		ports = 3;
-
-	BUG_ON(bus_id < 1 || bus_id > ports);
+	BUG_ON(bus_id < 1 || bus_id > omap_i2c_nr_ports());
 
 	if (info) {
 		err = i2c_register_board_info(bus_id, info, len);
@@ -153,7 +186,8 @@ int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
 	}
 
 	pdev = &omap_i2c_devices[bus_id - 1];
-	*(u32 *)pdev->dev.platform_data = clkrate;
+	if (i2c_rate[bus_id - 1] == 0)
+		i2c_rate[bus_id - 1] = clkrate;
 
 	if (bus_id == 1) {
 		res = pdev->resource;
-- 
1.6.1.3


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [2.6.29-rc7][take #2][PATCH 3/3] ARM: OMAP: Add method to register additional I2C busses on the command line
       [not found]                   ` <1236674831-3637-3-git-send-email-jarkko.nikula-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
@ 2009-03-10  8:47                     ` Jarkko Nikula
  2009-03-16 17:29                     ` [2.6.29-rc7][take #2][PATCH 2/3] ARM: OMAP: Add command line option for I2C bus speed Tony Lindgren
  1 sibling, 0 replies; 24+ messages in thread
From: Jarkko Nikula @ 2009-03-10  8:47 UTC (permalink / raw)
  To: linux-omap-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, Jarkko Nikula

This patch extends command line option "i2c_bus=bus_id,clkrate" so that
it allow to register additional I2C busses that are not registered with
omap_register_i2c_bus from board initialization code.

Purpose of this is to register additional board busses which are routed
to external connectors only without any on board I2C devices.

Signed-off-by: Jarkko Nikula <jarkko.nikula-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
---
 Documentation/kernel-parameters.txt |    2 +
 arch/arm/plat-omap/i2c.c            |   73 +++++++++++++++++++++++++----------
 2 files changed, 54 insertions(+), 21 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index d775076..ef9827f 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -831,6 +831,8 @@ and is between 256 and 4096 characters. It is defined in the file
 			       terminal devices. Valid values: 0..8
 
 	i2c_bus=	[HW] Override the default board specific I2C bus speed
+			     or register an additional I2C bus that is not
+			     registered from board initialization code.
 			     Format:
 			     <bus_id>,<clkrate>
 
diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
index aa70e43..a303071 100644
--- a/arch/arm/plat-omap/i2c.c
+++ b/arch/arm/plat-omap/i2c.c
@@ -98,6 +98,8 @@ static const int omap34xx_pins[][2] = {
 static const int omap34xx_pins[][2] = {};
 #endif
 
+#define OMAP_I2C_CMDLINE_SETUP	(BIT(31))
+
 static void __init omap_i2c_mux_pins(int bus)
 {
 	int scl, sda;
@@ -133,6 +135,31 @@ static int __init omap_i2c_nr_ports(void)
 	return ports;
 }
 
+static int __init omap_i2c_add_bus(int bus_id)
+{
+	struct platform_device *pdev;
+	struct resource *res;
+	resource_size_t base, irq;
+
+	pdev = &omap_i2c_devices[bus_id - 1];
+	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;
+	}
+
+	omap_i2c_mux_pins(bus_id - 1);
+	return platform_device_register(pdev);
+}
+
 /**
  * omap_i2c_bus_setup - Process command line options for the I2C bus speed
  * @str: String of options
@@ -154,11 +181,33 @@ static int __init omap_i2c_bus_setup(char *str)
 	if (ints[0] < 2 || ints[1] < 1 || ints[1] > ports)
 		return 0;
 	i2c_rate[ints[1] - 1] = ints[2];
+	i2c_rate[ints[1] - 1] |= OMAP_I2C_CMDLINE_SETUP;
 
 	return 1;
 }
 __setup("i2c_bus=", omap_i2c_bus_setup);
 
+/*
+ * Register busses defined in command line but that are not registered with
+ * omap_register_i2c_bus from board initialization code.
+ */
+static int __init omap_register_i2c_bus_cmdline(void)
+{
+	int i, err = 0;
+
+	for (i = 0; i < ARRAY_SIZE(i2c_rate); i++)
+		if (i2c_rate[i] & OMAP_I2C_CMDLINE_SETUP) {
+			i2c_rate[i] &= ~OMAP_I2C_CMDLINE_SETUP;
+			err = omap_i2c_add_bus(i + 1);
+			if (err)
+				goto out;
+		}
+
+out:
+	return err;
+}
+subsys_initcall(omap_register_i2c_bus_cmdline);
+
 /**
  * omap_register_i2c_bus - register I2C bus with device descriptors
  * @bus_id: bus id counting from number 1
@@ -173,9 +222,6 @@ int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
 			  unsigned len)
 {
 	int err;
-	struct platform_device *pdev;
-	struct resource *res;
-	resource_size_t base, irq;
 
 	BUG_ON(bus_id < 1 || bus_id > omap_i2c_nr_ports());
 
@@ -185,24 +231,9 @@ int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
 			return err;
 	}
 
-	pdev = &omap_i2c_devices[bus_id - 1];
-	if (i2c_rate[bus_id - 1] == 0)
+	if (!i2c_rate[bus_id - 1])
 		i2c_rate[bus_id - 1] = clkrate;
+	i2c_rate[bus_id - 1] &= ~OMAP_I2C_CMDLINE_SETUP;
 
-	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;
-	}
-
-	omap_i2c_mux_pins(bus_id - 1);
-	return platform_device_register(pdev);
+	return omap_i2c_add_bus(bus_id);
 }
-- 
1.6.1.3

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 7/7] ARM: OMAP: get rid of OMAP_TAG_USB, v2
  2009-03-04 21:56 ` [PATCH 7/7] ARM: OMAP: get rid of OMAP_TAG_USB Tony Lindgren
@ 2009-03-11 16:31   ` Tony Lindgren
  0 siblings, 0 replies; 24+ messages in thread
From: Tony Lindgren @ 2009-03-11 16:31 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: Felipe Balbi, linux-omap, David Brownell

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

* Tony Lindgren <tony@atomide.com> [090304 13:56]:
> From: Felipe Balbi <felipe.balbi@nokia.com>
> 
> OMAP_TAGS should vanish soon since they're not generic arm tags.
> Most of them can be converted to a platform_data or parsed
> from a command line like e.g. serial tag.
> 
> For OMAP_TAG_USB we just let boards call omap_usb_init()
> passing a pointer to omap_usb_config.
> 
> Patch updated by Tony for mainline, basically make
> n770 and h4 compile.

Here's this one updated with a fix for OSK from Dave.

Tony

[-- Attachment #2: tag-usb-v2.patch --]
[-- Type: text/x-diff, Size: 14769 bytes --]

>From 124fbfcb94e989916c5862c5d9bcbd281c09cdfa Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.balbi@nokia.com>
Date: Wed, 4 Mar 2009 10:54:44 -0800
Subject: [PATCH] ARM: OMAP: get rid of OMAP_TAG_USB, v2

OMAP_TAGS should vanish soon since they're not generic arm tags.
Most of them can be converted to a platform_data or parsed
from a command line like e.g. serial tag.

For OMAP_TAG_USB we just let boards call omap_usb_init()
passing a pointer to omap_usb_config.

Patch updated by Tony for mainline, basically make
n770 and h4 compile. Also folded in a fix for OSK
by David Brownell <dbrownell@users.sourceforge.net>.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>

diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index 2e61839..8b40aac 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -175,7 +175,6 @@ static struct omap_usb_config ams_delta_usb_config __initdata = {
 static struct omap_board_config_kernel ams_delta_config[] = {
 	{ OMAP_TAG_LCD,		&ams_delta_lcd_config },
 	{ OMAP_TAG_UART,	&ams_delta_uart_config },
-	{ OMAP_TAG_USB,		&ams_delta_usb_config },
 };
 
 static struct resource ams_delta_kp_resources[] = {
@@ -232,6 +231,7 @@ static void __init ams_delta_init(void)
 	/* Clear latch2 (NAND, LCD, modem enable) */
 	ams_delta_latch2_write(~0, 0);
 
+	omap_usb_init(&ams_delta_usb_config);
 	platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices));
 }
 
diff --git a/arch/arm/mach-omap1/board-generic.c b/arch/arm/mach-omap1/board-generic.c
index 7d26702..e724940 100644
--- a/arch/arm/mach-omap1/board-generic.c
+++ b/arch/arm/mach-omap1/board-generic.c
@@ -62,7 +62,6 @@ static struct omap_uart_config generic_uart_config __initdata = {
 };
 
 static struct omap_board_config_kernel generic_config[] __initdata = {
-	{ OMAP_TAG_USB,		NULL },
 	{ OMAP_TAG_UART,	&generic_uart_config },
 };
 
@@ -70,12 +69,12 @@ static void __init omap_generic_init(void)
 {
 #ifdef CONFIG_ARCH_OMAP15XX
 	if (cpu_is_omap15xx()) {
-		generic_config[0].data = &generic1510_usb_config;
+		omap_usb_init(&generic1510_usb_config);
 	}
 #endif
 #if defined(CONFIG_ARCH_OMAP16XX)
 	if (!cpu_is_omap1510()) {
-		generic_config[0].data = &generic1610_usb_config;
+		omap_usb_init(&generic1610_usb_config);
 	}
 #endif
 
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index 0d784a7..9f3b392 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -364,7 +364,6 @@ static struct omap_lcd_config h2_lcd_config __initdata = {
 };
 
 static struct omap_board_config_kernel h2_config[] __initdata = {
-	{ OMAP_TAG_USB,		&h2_usb_config },
 	{ OMAP_TAG_UART,	&h2_uart_config },
 	{ OMAP_TAG_LCD,		&h2_lcd_config },
 };
@@ -413,6 +412,7 @@ static void __init h2_init(void)
 	omap_serial_init();
 	omap_register_i2c_bus(1, 100, h2_i2c_board_info,
 			      ARRAY_SIZE(h2_i2c_board_info));
+	omap_usb_init(&h2_usb_config);
 	h2_mmc_init();
 }
 
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index bf08b6a..a3c513d 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -418,7 +418,6 @@ static struct omap_lcd_config h3_lcd_config __initdata = {
 };
 
 static struct omap_board_config_kernel h3_config[] __initdata = {
-	{ OMAP_TAG_USB,		&h3_usb_config },
 	{ OMAP_TAG_UART,	&h3_uart_config },
 	{ OMAP_TAG_LCD,		&h3_lcd_config },
 };
@@ -472,6 +471,7 @@ static void __init h3_init(void)
 	omap_serial_init();
 	omap_register_i2c_bus(1, 100, h3_i2c_board_info,
 			      ARRAY_SIZE(h3_i2c_board_info));
+	omap_usb_init(&h3_usb_config);
 	h3_mmc_init();
 }
 
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index 071cd02..ed7ee07 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -370,7 +370,6 @@ static struct omap_uart_config innovator_uart_config __initdata = {
 };
 
 static struct omap_board_config_kernel innovator_config[] = {
-	{ OMAP_TAG_USB,         NULL },
 	{ OMAP_TAG_LCD,		NULL },
 	{ OMAP_TAG_UART,	&innovator_uart_config },
 };
@@ -392,13 +391,13 @@ static void __init innovator_init(void)
 
 #ifdef CONFIG_ARCH_OMAP15XX
 	if (cpu_is_omap1510()) {
-		innovator_config[0].data = &innovator1510_usb_config;
+		omap_usb_init(&innovator1510_usb_config);
 		innovator_config[1].data = &innovator1510_lcd_config;
 	}
 #endif
 #ifdef CONFIG_ARCH_OMAP16XX
 	if (cpu_is_omap1610()) {
-		innovator_config[0].data = &h2_usb_config;
+		omap_usb_init(&h2_usb_config);
 		innovator_config[1].data = &innovator1610_lcd_config;
 	}
 #endif
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index af51e0b..7bc7a3c 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -233,10 +233,6 @@ static inline void nokia770_mmc_init(void)
 }
 #endif
 
-static struct omap_board_config_kernel nokia770_config[] __initdata = {
-	{ OMAP_TAG_USB,		NULL },
-};
-
 #if	defined(CONFIG_OMAP_DSP)
 /*
  * audio power control
@@ -371,19 +367,16 @@ static __init int omap_dsp_init(void)
 
 static void __init omap_nokia770_init(void)
 {
-	nokia770_config[0].data = &nokia770_usb_config;
-
 	platform_add_devices(nokia770_devices, ARRAY_SIZE(nokia770_devices));
 	spi_register_board_info(nokia770_spi_board_info,
 				ARRAY_SIZE(nokia770_spi_board_info));
-	omap_board_config = nokia770_config;
-	omap_board_config_size = ARRAY_SIZE(nokia770_config);
 	omap_gpio_init();
 	omap_serial_init();
 	omap_register_i2c_bus(1, 100, NULL, 0);
 	omap_dsp_init();
 	ads7846_dev_init();
 	mipid_dev_init();
+	omap_usb_init(&nokia770_usb_config);
 	nokia770_mmc_init();
 }
 
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index 1a16ecb..e5ebc9d 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -290,7 +290,6 @@ static struct omap_lcd_config osk_lcd_config __initdata = {
 #endif
 
 static struct omap_board_config_kernel osk_config[] __initdata = {
-	{ OMAP_TAG_USB,           &osk_usb_config },
 	{ OMAP_TAG_UART,		&osk_uart_config },
 #ifdef	CONFIG_OMAP_OSK_MISTRAL
 	{ OMAP_TAG_LCD,			&osk_lcd_config },
@@ -541,6 +540,8 @@ static void __init osk_init(void)
 	l |= (3 << 1);
 	omap_writel(l, USB_TRANSCEIVER_CTRL);
 
+	omap_usb_init(&osk_usb_config);
+
 	/* irq for tps65010 chip */
 	/* bootloader effectively does:  omap_cfg_reg(U19_1610_MPUIO1); */
 	if (gpio_request(OMAP_MPUIO(1), "tps65010") == 0)
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
index 99f2b43..b2d3a36 100644
--- a/arch/arm/mach-omap1/board-palmte.c
+++ b/arch/arm/mach-omap1/board-palmte.c
@@ -286,7 +286,6 @@ static void palmte_get_power_status(struct apm_power_info *info, int *battery)
 #endif
 
 static struct omap_board_config_kernel palmte_config[] __initdata = {
-	{ OMAP_TAG_USB,		&palmte_usb_config },
 	{ OMAP_TAG_LCD,		&palmte_lcd_config },
 	{ OMAP_TAG_UART,	&palmte_uart_config },
 };
@@ -341,6 +340,7 @@ static void __init omap_palmte_init(void)
 	spi_register_board_info(palmte_spi_info, ARRAY_SIZE(palmte_spi_info));
 	palmte_misc_gpio_setup();
 	omap_serial_init();
+	omap_usb_init(&palmte_usb_config);
 	omap_register_i2c_bus(1, 100, NULL, 0);
 }
 
diff --git a/arch/arm/mach-omap1/board-palmtt.c b/arch/arm/mach-omap1/board-palmtt.c
index 1cbc127..90795bf 100644
--- a/arch/arm/mach-omap1/board-palmtt.c
+++ b/arch/arm/mach-omap1/board-palmtt.c
@@ -272,7 +272,6 @@ static struct omap_uart_config palmtt_uart_config __initdata = {
 };
 
 static struct omap_board_config_kernel palmtt_config[] __initdata = {
-	{ OMAP_TAG_USB,		&palmtt_usb_config	},
 	{ OMAP_TAG_LCD,		&palmtt_lcd_config	},
 	{ OMAP_TAG_UART,	&palmtt_uart_config	},
 };
@@ -297,6 +296,7 @@ static void __init omap_palmtt_init(void)
 
 	spi_register_board_info(palmtt_boardinfo,ARRAY_SIZE(palmtt_boardinfo));
 	omap_serial_init();
+	omap_usb_init(&palmtt_usb_config);
 	omap_register_i2c_bus(1, 100, NULL, 0);
 }
 
diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c
index baf5efb..89b50e8 100644
--- a/arch/arm/mach-omap1/board-palmz71.c
+++ b/arch/arm/mach-omap1/board-palmz71.c
@@ -239,7 +239,6 @@ static struct omap_uart_config palmz71_uart_config __initdata = {
 };
 
 static struct omap_board_config_kernel palmz71_config[] __initdata = {
-	{OMAP_TAG_USB,	&palmz71_usb_config},
 	{OMAP_TAG_LCD,	&palmz71_lcd_config},
 	{OMAP_TAG_UART,	&palmz71_uart_config},
 };
@@ -313,6 +312,7 @@ omap_palmz71_init(void)
 
 	spi_register_board_info(palmz71_boardinfo,
 				ARRAY_SIZE(palmz71_boardinfo));
+	omap_usb_init(&palmz71_usb_config);
 	omap_serial_init();
 	omap_register_i2c_bus(1, 100, NULL, 0);
 	palmz71_gpio_setup(0);
diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c
index 28c76a1..7d6f0b7 100644
--- a/arch/arm/mach-omap1/board-sx1.c
+++ b/arch/arm/mach-omap1/board-sx1.c
@@ -373,7 +373,6 @@ static struct omap_uart_config sx1_uart_config __initdata = {
 };
 
 static struct omap_board_config_kernel sx1_config[] __initdata = {
-	{ OMAP_TAG_USB,	&sx1_usb_config },
 	{ OMAP_TAG_LCD,	&sx1_lcd_config },
 	{ OMAP_TAG_UART,	&sx1_uart_config },
 };
@@ -388,6 +387,7 @@ static void __init omap_sx1_init(void)
 	omap_board_config_size = ARRAY_SIZE(sx1_config);
 	omap_serial_init();
 	omap_register_i2c_bus(1, 100, NULL, 0);
+	omap_usb_init(&sx1_usb_config);
 	sx1_mmc_init();
 
 	/* turn on USB power */
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index a765354..98275e0 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -145,7 +145,6 @@ static struct omap_uart_config voiceblue_uart_config __initdata = {
 };
 
 static struct omap_board_config_kernel voiceblue_config[] = {
-	{ OMAP_TAG_USB,  &voiceblue_usb_config },
 	{ OMAP_TAG_UART, &voiceblue_uart_config },
 };
 
@@ -185,6 +184,7 @@ static void __init voiceblue_init(void)
 	omap_board_config = voiceblue_config;
 	omap_board_config_size = ARRAY_SIZE(voiceblue_config);
 	omap_serial_init();
+	omap_usb_init(&voiceblue_usb_config);
 	omap_register_i2c_bus(1, 100, NULL, 0);
 
 	/* There is a good chance board is going up, so enable power LED
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
index 0a7b24b..30e7049 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -272,7 +272,6 @@ static struct omap_lcd_config apollon_lcd_config __initdata = {
 
 static struct omap_board_config_kernel apollon_config[] = {
 	{ OMAP_TAG_UART,	&apollon_uart_config },
-	{ OMAP_TAG_USB,		&apollon_usb_config },
 	{ OMAP_TAG_LCD,		&apollon_lcd_config },
 };
 
@@ -299,6 +298,7 @@ static void __init apollon_usb_init(void)
 	omap_cfg_reg(P21_242X_GPIO12);
 	gpio_request(12, "USB suspend");
 	gpio_direction_output(12, 0);
+	omap_usb_init(&apollon_usb_config);
 }
 
 static void __init omap_apollon_init(void)
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index 5e9b146..ff51c0f 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -377,6 +377,39 @@ static struct omap_lcd_config h4_lcd_config __initdata = {
 	.ctrl_name	= "internal",
 };
 
+static struct omap_usb_config h4_usb_config __initdata = {
+#ifdef	CONFIG_MACH_OMAP2_H4_USB1
+	/* NOTE:  usb1 could also be used with 3 wire signaling */
+	.pins[1]	= 4,
+#endif
+
+#ifdef	CONFIG_MACH_OMAP_H4_OTG
+	/* S1.10 ON -- USB OTG port
+	 * usb0 switched to Mini-AB port and isp1301 transceiver;
+	 * S2.POS3 = OFF, S2.POS4 = ON ... to allow battery charging
+	 */
+	.otg		= 1,
+	.pins[0]	= 4,
+#ifdef	CONFIG_USB_GADGET_OMAP
+	/* use OTG cable, or standard A-to-MiniB */
+	.hmc_mode	= 0x14,	/* 0:dev/otg 1:host 2:disable */
+#elif	defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
+	/* use OTG cable, or NONSTANDARD (B-to-MiniB) */
+	.hmc_mode	= 0x11,	/* 0:host 1:host 2:disable */
+#endif	/* XX */
+
+#else
+	/* S1.10 OFF -- usb "download port"
+	 * usb0 switched to Mini-B port and isp1105 transceiver;
+	 * S2.POS3 = ON, S2.POS4 = OFF ... to enable battery charging
+	 */
+	.register_dev	= 1,
+	.pins[0]	= 3,
+/*	.hmc_mode	= 0x14,*/	/* 0:dev 1:host 2:disable */
+	.hmc_mode	= 0x00,		/* 0:dev|otg 1:disable 2:disable */
+#endif
+};
+
 static struct omap_board_config_kernel h4_config[] = {
 	{ OMAP_TAG_UART,	&h4_uart_config },
 	{ OMAP_TAG_LCD,		&h4_lcd_config },
@@ -428,6 +461,7 @@ static void __init omap_h4_init(void)
 	platform_add_devices(h4_devices, ARRAY_SIZE(h4_devices));
 	omap_board_config = h4_config;
 	omap_board_config_size = ARRAY_SIZE(h4_config);
+	omap_usb_init(&h4_usb_config);
 	omap_serial_init();
 }
 
diff --git a/arch/arm/plat-omap/include/mach/board.h b/arch/arm/plat-omap/include/mach/board.h
index 9466772..5e857f8 100644
--- a/arch/arm/plat-omap/include/mach/board.h
+++ b/arch/arm/plat-omap/include/mach/board.h
@@ -17,7 +17,6 @@
 /* Different peripheral ids */
 #define OMAP_TAG_CLOCK		0x4f01
 #define OMAP_TAG_SERIAL_CONSOLE 0x4f03
-#define OMAP_TAG_USB		0x4f04
 #define OMAP_TAG_LCD		0x4f05
 #define OMAP_TAG_GPIO_SWITCH	0x4f06
 #define OMAP_TAG_UART		0x4f07
diff --git a/arch/arm/plat-omap/include/mach/usb.h b/arch/arm/plat-omap/include/mach/usb.h
index a56a610..e033e51 100644
--- a/arch/arm/plat-omap/include/mach/usb.h
+++ b/arch/arm/plat-omap/include/mach/usb.h
@@ -29,6 +29,8 @@
 
 #endif
 
+void omap_usb_init(struct omap_usb_config *pdata);
+
 /*-------------------------------------------------------------------------*/
 
 /*
diff --git a/arch/arm/plat-omap/usb.c b/arch/arm/plat-omap/usb.c
index e278de6..509f2ed 100644
--- a/arch/arm/plat-omap/usb.c
+++ b/arch/arm/plat-omap/usb.c
@@ -729,30 +729,13 @@ static inline void omap_1510_usb_init(struct omap_usb_config *config) {}
 
 /*-------------------------------------------------------------------------*/
 
-static struct omap_usb_config platform_data;
-
-static int __init
-omap_usb_init(void)
+void __init omap_usb_init(struct omap_usb_config *pdata)
 {
-	const struct omap_usb_config *config;
-
-	config = omap_get_config(OMAP_TAG_USB, struct omap_usb_config);
-	if (config == NULL) {
-		printk(KERN_ERR "USB: No board-specific "
-				"platform config found\n");
-		return -ENODEV;
-	}
-	platform_data = *config;
-
 	if (cpu_is_omap730() || cpu_is_omap16xx() || cpu_is_omap24xx())
-		omap_otg_init(&platform_data);
+		omap_otg_init(pdata);
 	else if (cpu_is_omap15xx())
-		omap_1510_usb_init(&platform_data);
-	else {
+		omap_1510_usb_init(pdata);
+	else
 		printk(KERN_ERR "USB: No init for your chip yet\n");
-		return -ENODEV;
-	}
-	return 0;
 }
 
-subsys_initcall(omap_usb_init);

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [2.6.29-rc7][take #2][PATCH 2/3] ARM: OMAP: Add command line option for I2C bus speed
       [not found]                   ` <1236674831-3637-3-git-send-email-jarkko.nikula-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
  2009-03-10  8:47                     ` [2.6.29-rc7][take #2][PATCH 3/3] ARM: OMAP: Add method to register additional I2C busses on the command line Jarkko Nikula
@ 2009-03-16 17:29                     ` Tony Lindgren
       [not found]                       ` <20090316172908.GA19229-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
  1 sibling, 1 reply; 24+ messages in thread
From: Tony Lindgren @ 2009-03-16 17:29 UTC (permalink / raw)
  To: Jarkko Nikula
  Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA, linux-i2c-u79uwXL29TY76Z2rM5mHXA

* Jarkko Nikula <jarkko.nikula-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org> [090310 01:47]:
> This patch adds a new command line option "i2c_bus=bus_id,clkrate" into
> I2C bus registration helper. Purpose of the option is to override the
> default board specific bus speed which is supplied by the
> omap_register_i2c_bus.
> 
> The default bus speed is typically set to speed of slowest I2C chip on the
> bus and overriding allow to use some experimental configurations or updated
> chip versions without any kernel modifications.

Thanks for updating this. I've updated my omap-upstream series with your
patches #2 and #3, looks like #1 did not need updating.

Regards,

Tony
 
> Signed-off-by: Jarkko Nikula <jarkko.nikula-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
> ---
>  Documentation/kernel-parameters.txt |    4 ++
>  arch/arm/plat-omap/i2c.c            |   54 ++++++++++++++++++++++++++++------
>  2 files changed, 48 insertions(+), 10 deletions(-)
> 
> diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
> index 54f21a5..d775076 100644
> --- a/Documentation/kernel-parameters.txt
> +++ b/Documentation/kernel-parameters.txt
> @@ -830,6 +830,10 @@ and is between 256 and 4096 characters. It is defined in the file
>  	hvc_iucv=	[S390] Number of z/VM IUCV hypervisor console (HVC)
>  			       terminal devices. Valid values: 0..8
>  
> +	i2c_bus=	[HW] Override the default board specific I2C bus speed
> +			     Format:
> +			     <bus_id>,<clkrate>
> +
>  	i8042.debug	[HW] Toggle i8042 debug mode
>  	i8042.direct	[HW] Put keyboard port into non-translated mode
>  	i8042.dumbkbd	[HW] Pretend that controller can only read data from
> diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
> index 3e95954..aa70e43 100644
> --- a/arch/arm/plat-omap/i2c.c
> +++ b/arch/arm/plat-omap/i2c.c
> @@ -119,6 +119,46 @@ static void __init omap_i2c_mux_pins(int bus)
>  	omap_cfg_reg(scl);
>  }
>  
> +static int __init omap_i2c_nr_ports(void)
> +{
> +	int ports = 0;
> +
> +	if (cpu_class_is_omap1())
> +		ports = 1;
> +	else if (cpu_is_omap24xx())
> +		ports = 2;
> +	else if (cpu_is_omap34xx())
> +		ports = 3;
> +
> +	return ports;
> +}
> +
> +/**
> + * omap_i2c_bus_setup - Process command line options for the I2C bus speed
> + * @str: String of options
> + *
> + * This function allow to override the default I2C bus speed for given I2C
> + * bus with a command line option.
> + *
> + * Format: i2c_bus=bus_id,clkrate (in kHz)
> + *
> + * Returns 1 on success, 0 otherwise.
> + */
> +static int __init omap_i2c_bus_setup(char *str)
> +{
> +	int ports;
> +	int ints[3];
> +
> +	ports = omap_i2c_nr_ports();
> +	get_options(str, 3, ints);
> +	if (ints[0] < 2 || ints[1] < 1 || ints[1] > ports)
> +		return 0;
> +	i2c_rate[ints[1] - 1] = ints[2];
> +
> +	return 1;
> +}
> +__setup("i2c_bus=", omap_i2c_bus_setup);
> +
>  /**
>   * omap_register_i2c_bus - register I2C bus with device descriptors
>   * @bus_id: bus id counting from number 1
> @@ -132,19 +172,12 @@ int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
>  			  struct i2c_board_info const *info,
>  			  unsigned len)
>  {
> -	int ports, err;
> +	int err;
>  	struct platform_device *pdev;
>  	struct resource *res;
>  	resource_size_t base, irq;
>  
> -	if (cpu_class_is_omap1())
> -		ports = 1;
> -	else if (cpu_is_omap24xx())
> -		ports = 2;
> -	else if (cpu_is_omap34xx())
> -		ports = 3;
> -
> -	BUG_ON(bus_id < 1 || bus_id > ports);
> +	BUG_ON(bus_id < 1 || bus_id > omap_i2c_nr_ports());
>  
>  	if (info) {
>  		err = i2c_register_board_info(bus_id, info, len);
> @@ -153,7 +186,8 @@ int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
>  	}
>  
>  	pdev = &omap_i2c_devices[bus_id - 1];
> -	*(u32 *)pdev->dev.platform_data = clkrate;
> +	if (i2c_rate[bus_id - 1] == 0)
> +		i2c_rate[bus_id - 1] = clkrate;
>  
>  	if (bus_id == 1) {
>  		res = pdev->resource;
> -- 
> 1.6.1.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 0/7] Updates for common omap code for next merge window
  2009-03-04 21:47 [PATCH 0/7] Updates for common omap code for next merge window Tony Lindgren
                   ` (6 preceding siblings ...)
  2009-03-04 21:56 ` [PATCH 7/7] ARM: OMAP: get rid of OMAP_TAG_USB Tony Lindgren
@ 2009-03-16 17:31 ` Tony Lindgren
  7 siblings, 0 replies; 24+ messages in thread
From: Tony Lindgren @ 2009-03-16 17:31 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-omap

* Tony Lindgren <tony@atomide.com> [090304 13:48]:
> Hi,
> 
> This series contains updates for common omap code. Still to come
> is a series of omap3 specific patches during this week.

I've added this series to my for-next queue to wait for the merge
window to start.

> Regards,
> 
> Tony
> 
> ---
> 
> Felipe Balbi (1):
>       ARM: OMAP: get rid of OMAP_TAG_USB
> 
> Jarkko Nikula (3):
>       ARM: OMAP: Add method to register additional I2C busses on the command line
>       ARM: OMAP: Add command line option for I2C bus speed
>       ARM: OMAP: Add documentation for function omap_register_i2c_bus
> 
> Santosh Shilimkar (2):
>       ARM: OMAP: Dispatch only relevant DMA interrupts
>       ARM: OMAP: Get available DMA channels from cmdline
> 
> Timo Kokkonen (1):
>       ARM: OMAP: Export dmtimer functions
> 
> 
>  arch/arm/mach-omap1/board-ams-delta.c   |    2 -
>  arch/arm/mach-omap1/board-generic.c     |    5 +
>  arch/arm/mach-omap1/board-h2.c          |    2 -
>  arch/arm/mach-omap1/board-h3.c          |    2 -
>  arch/arm/mach-omap1/board-innovator.c   |    5 +
>  arch/arm/mach-omap1/board-nokia770.c    |    9 ---
>  arch/arm/mach-omap1/board-osk.c         |    2 -
>  arch/arm/mach-omap1/board-palmte.c      |    2 -
>  arch/arm/mach-omap1/board-palmtt.c      |    2 -
>  arch/arm/mach-omap1/board-palmz71.c     |    2 -
>  arch/arm/mach-omap1/board-sx1.c         |    2 -
>  arch/arm/mach-omap1/board-voiceblue.c   |    2 -
>  arch/arm/mach-omap2/board-apollon.c     |    2 -
>  arch/arm/mach-omap2/board-h4.c          |   34 ++++++++++
>  arch/arm/plat-omap/dma.c                |   24 +++++++
>  arch/arm/plat-omap/dmtimer.c            |   26 ++++++++
>  arch/arm/plat-omap/i2c.c                |  104 +++++++++++++++++++++++++++----
>  arch/arm/plat-omap/include/mach/board.h |    1 
>  arch/arm/plat-omap/include/mach/usb.h   |    2 +
>  arch/arm/plat-omap/usb.c                |   25 +------
>  20 files changed, 192 insertions(+), 63 deletions(-)
> 
> -- 
> Signature
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [2.6.29-rc7][take #2][PATCH 2/3] ARM: OMAP: Add command line option for I2C bus speed
       [not found]                       ` <20090316172908.GA19229-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
@ 2009-03-17  8:24                         ` Jarkko Nikula
  0 siblings, 0 replies; 24+ messages in thread
From: Jarkko Nikula @ 2009-03-17  8:24 UTC (permalink / raw)
  To: ext Tony Lindgren
  Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA, linux-i2c-u79uwXL29TY76Z2rM5mHXA

On Mon, 16 Mar 2009 18:29:08 +0100
ext Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> wrote:

> * Jarkko Nikula <jarkko.nikula-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org> [090310 01:47]:
> > This patch adds a new command line option "i2c_bus=bus_id,clkrate"
> > into I2C bus registration helper. Purpose of the option is to
> > override the default board specific bus speed which is supplied by
> > the omap_register_i2c_bus.
> > 
> > The default bus speed is typically set to speed of slowest I2C chip
> > on the bus and overriding allow to use some experimental
> > configurations or updated chip versions without any kernel
> > modifications.
> 
> Thanks for updating this. I've updated my omap-upstream series with
> your patches #2 and #3, looks like #1 did not need updating.
> 
Yep, no changes in #1 and it can go anyway as it since it only adds a
bit documentation to the arch/arm/plat-omap/i2c.c.

However we haven't received any comments to the patches #2 and #3
adding new command line option "i2c_bus=bus_id,clkrate" so let's see do
they go :-)


Jarkko

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 3/7] ARM: OMAP: Add command line option for I2C bus speed
  2009-03-06 16:13       ` Tony Lindgren
       [not found]         ` <20090306161349.GC32353-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
@ 2009-03-18 19:30         ` Russell King - ARM Linux
  2009-03-19 11:22           ` Jarkko Nikula
  1 sibling, 1 reply; 24+ messages in thread
From: Russell King - ARM Linux @ 2009-03-18 19:30 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Jarkko Nikula, linux-arm-kernel, linux-omap

On Fri, Mar 06, 2009 at 08:13:50AM -0800, Tony Lindgren wrote:
> * Jarkko Nikula <jarkko.nikula@nokia.com> [090305 23:12]:
> > On Thu, 5 Mar 2009 17:20:43 +0100
> > ext Tony Lindgren <tony@atomide.com> wrote:
> > 
> > > Jarkko, this should also be in Documentation/kernel-parameters.txt.
> > > Can you please reply with a patch for that, and I'll fold it into this
> > > patch?
> > > 
> > Ah, good, will do it over weekend - early next week. Probably better to
> > handle as a separate patch for easier merging with
> > kernel-parameters.txt?
> 
> I think they should get merged as a single patch.
>  
> > > Also, maybe it should be called omap_i2c_bus instead of i2c_bus?
> > > 
> > I had similar thought as Felipe that it looks more generic this way.
> > But don't know now immediately would multibuild will work? Was that
> > your concern? E.g.
> > 
> > __setup("i2c_bus=", arm_xxx_i2c_bus_setup);
> > __setup("i2c_bus=", omap_i2c_bus_setup);
> 
> Well is it generic enough to work for everybody? And if so, we should
> run it by the LKML and the linux-i2c lists.

Any comments from the I2C list?

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 3/7] ARM: OMAP: Add command line option for I2C bus speed
  2009-03-18 19:30         ` [PATCH 3/7] " Russell King - ARM Linux
@ 2009-03-19 11:22           ` Jarkko Nikula
  0 siblings, 0 replies; 24+ messages in thread
From: Jarkko Nikula @ 2009-03-19 11:22 UTC (permalink / raw)
  To: ext Russell King - ARM Linux; +Cc: Tony Lindgren, linux-arm-kernel, linux-omap

On Wed, 18 Mar 2009 20:30:45 +0100
ext Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:

> > > I had similar thought as Felipe that it looks more generic this
> > > way. But don't know now immediately would multibuild will work?
> > > Was that your concern? E.g.
> > > 
> > > __setup("i2c_bus=", arm_xxx_i2c_bus_setup);
> > > __setup("i2c_bus=", omap_i2c_bus_setup);
> > 
> > Well is it generic enough to work for everybody? And if so, we
> > should run it by the LKML and the linux-i2c lists.
> 
> Any comments from the I2C list?
>
Unfortunately not. Are there some conference or why the list have been
so idle recently?

http://marc.info/?l=linux-i2c&r=1&b=200903&w=2


Jarkko

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [2.6.29-rc7][take #2][PATCH 0/3] ARM: OMAP: Add command line option for I2C bus speed
  2009-03-09 13:45 [2.6.29-rc7][take #2][PATCH 0/3] ARM: OMAP: Add command line option for I2C bus speed Jarkko Nikula
@ 2009-03-09 17:19 ` Tony Lindgren
  0 siblings, 0 replies; 24+ messages in thread
From: Tony Lindgren @ 2009-03-09 17:19 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: linux-omap

* Jarkko Nikula <jarkko.nikula@nokia.com> [090309 06:46]:
> Hi
> 
> Tony, I added kernel-parameters.txt change to the patches 2 and 3. Otherwise
> set is the same than currently in linux-omap. Set is generated on top of
> mainline version 2.6.29-rc7. Earlier discussion was
> 
> http://marc.info/?l=linux-omap&m=123635604511892&w=2

Thanks, they look OK to me. Can you please reply to that earlier thread
with these updated patches, and add linux-i2c@vger.kernel.org to Cc?
Then the I2C people can give their comments on the cmdline option.

Regards,

Tony

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [2.6.29-rc7][take #2][PATCH 0/3] ARM: OMAP: Add command line option for I2C bus speed
@ 2009-03-09 13:45 Jarkko Nikula
  2009-03-09 17:19 ` Tony Lindgren
  0 siblings, 1 reply; 24+ messages in thread
From: Jarkko Nikula @ 2009-03-09 13:45 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren

Hi

Tony, I added kernel-parameters.txt change to the patches 2 and 3. Otherwise
set is the same than currently in linux-omap. Set is generated on top of
mainline version 2.6.29-rc7. Earlier discussion was

http://marc.info/?l=linux-omap&m=123635604511892&w=2


-- 
Jarkko

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2009-03-19 11:22 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-04 21:47 [PATCH 0/7] Updates for common omap code for next merge window Tony Lindgren
2009-03-04 21:48 ` [PATCH 1/7] ARM: OMAP: Export dmtimer functions Tony Lindgren
2009-03-04 21:49 ` [PATCH 2/7] ARM: OMAP: Add documentation for function omap_register_i2c_bus Tony Lindgren
2009-03-04 21:51 ` [PATCH 3/7] ARM: OMAP: Add command line option for I2C bus speed Tony Lindgren
2009-03-05 16:20   ` Tony Lindgren
2009-03-05 19:37     ` Felipe Balbi
2009-03-06  7:13     ` Jarkko Nikula
2009-03-06 16:13       ` Tony Lindgren
     [not found]         ` <20090306161349.GC32353-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2009-03-10  8:47           ` [2.6.29-rc7][take #2][PATCH 0/3] " Jarkko Nikula
     [not found]             ` <1236674831-3637-1-git-send-email-jarkko.nikula-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2009-03-10  8:47               ` [2.6.29-rc7][take #2][PATCH 1/3] ARM: OMAP: Add documentation for function omap_register_i2c_bus Jarkko Nikula
2009-03-10  8:47                 ` [2.6.29-rc7][take #2][PATCH 2/3] ARM: OMAP: Add command line option for I2C bus speed Jarkko Nikula
     [not found]                   ` <1236674831-3637-3-git-send-email-jarkko.nikula-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2009-03-10  8:47                     ` [2.6.29-rc7][take #2][PATCH 3/3] ARM: OMAP: Add method to register additional I2C busses on the command line Jarkko Nikula
2009-03-16 17:29                     ` [2.6.29-rc7][take #2][PATCH 2/3] ARM: OMAP: Add command line option for I2C bus speed Tony Lindgren
     [not found]                       ` <20090316172908.GA19229-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2009-03-17  8:24                         ` Jarkko Nikula
2009-03-18 19:30         ` [PATCH 3/7] " Russell King - ARM Linux
2009-03-19 11:22           ` Jarkko Nikula
2009-03-04 21:52 ` [PATCH 4/7] ARM: OMAP: Add method to register additional I2C busses on the command line Tony Lindgren
2009-03-04 21:53 ` [PATCH 5/7] ARM: OMAP: Get available DMA channels from cmdline Tony Lindgren
2009-03-04 21:54 ` [PATCH 6/7] ARM: OMAP: Dispatch only relevant DMA interrupts Tony Lindgren
2009-03-04 21:56 ` [PATCH 7/7] ARM: OMAP: get rid of OMAP_TAG_USB Tony Lindgren
2009-03-11 16:31   ` [PATCH 7/7] ARM: OMAP: get rid of OMAP_TAG_USB, v2 Tony Lindgren
2009-03-16 17:31 ` [PATCH 0/7] Updates for common omap code for next merge window Tony Lindgren
2009-03-09 13:45 [2.6.29-rc7][take #2][PATCH 0/3] ARM: OMAP: Add command line option for I2C bus speed Jarkko Nikula
2009-03-09 17:19 ` Tony Lindgren

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.