* [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 13:45 ` [2.6.29-rc7][take #2][PATCH 1/3] ARM: OMAP: Add documentation for function omap_register_i2c_bus Jarkko Nikula ` (3 more replies) 0 siblings, 4 replies; 8+ 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] 8+ messages in thread
* [2.6.29-rc7][take #2][PATCH 1/3] ARM: OMAP: Add documentation for function omap_register_i2c_bus 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 13:45 ` Jarkko Nikula 2009-03-09 13:45 ` [2.6.29-rc7][take #2][PATCH 2/3] ARM: OMAP: Add command line option for I2C bus speed Jarkko Nikula ` (2 subsequent siblings) 3 siblings, 0 replies; 8+ messages in thread From: Jarkko Nikula @ 2009-03-09 13:45 UTC (permalink / raw) To: linux-omap; +Cc: Tony Lindgren, Jarkko Nikula Signed-off-by: Jarkko Nikula <jarkko.nikula@nokia.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) -- 1.6.1.3 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [2.6.29-rc7][take #2][PATCH 2/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 13:45 ` [2.6.29-rc7][take #2][PATCH 1/3] ARM: OMAP: Add documentation for function omap_register_i2c_bus Jarkko Nikula @ 2009-03-09 13:45 ` Jarkko Nikula 2009-03-09 13:45 ` [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-09 17:19 ` [2.6.29-rc7][take #2][PATCH 0/3] ARM: OMAP: Add command line option for I2C bus speed Tony Lindgren 3 siblings, 0 replies; 8+ messages in thread From: Jarkko Nikula @ 2009-03-09 13:45 UTC (permalink / raw) To: linux-omap; +Cc: Tony Lindgren, 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 related [flat|nested] 8+ 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 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 13:45 ` [2.6.29-rc7][take #2][PATCH 1/3] ARM: OMAP: Add documentation for function omap_register_i2c_bus Jarkko Nikula 2009-03-09 13:45 ` [2.6.29-rc7][take #2][PATCH 2/3] ARM: OMAP: Add command line option for I2C bus speed Jarkko Nikula @ 2009-03-09 13:45 ` Jarkko Nikula 2009-03-09 17:19 ` [2.6.29-rc7][take #2][PATCH 0/3] ARM: OMAP: Add command line option for I2C bus speed Tony Lindgren 3 siblings, 0 replies; 8+ messages in thread From: Jarkko Nikula @ 2009-03-09 13:45 UTC (permalink / raw) To: linux-omap; +Cc: Tony Lindgren, 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@nokia.com> --- 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 related [flat|nested] 8+ 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 ` (2 preceding siblings ...) 2009-03-09 13:45 ` [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-09 17:19 ` Tony Lindgren 3 siblings, 0 replies; 8+ 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] 8+ messages in thread
* Re: [PATCH 3/7] ARM: OMAP: Add command line option for I2C bus speed @ 2009-03-06 16:13 Tony Lindgren 2009-03-10 8:47 ` [2.6.29-rc7][take #2][PATCH 0/3] " Jarkko Nikula 0 siblings, 1 reply; 8+ 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] 8+ messages in thread
* [2.6.29-rc7][take #2][PATCH 0/3] ARM: OMAP: Add command line option for I2C bus speed @ 2009-03-10 8:47 ` Jarkko Nikula 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 0 siblings, 1 reply; 8+ 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] 8+ messages in thread
* [2.6.29-rc7][take #2][PATCH 1/3] ARM: OMAP: Add documentation for function omap_register_i2c_bus @ 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; 8+ 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 related [flat|nested] 8+ 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; 8+ 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 related [flat|nested] 8+ messages in thread
[parent not found: <1236674831-3637-3-git-send-email-jarkko.nikula-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>]
* 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-16 17:29 ` Tony Lindgren [not found] ` <20090316172908.GA19229-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> 0 siblings, 1 reply; 8+ 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] 8+ messages in thread
[parent not found: <20090316172908.GA19229-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>]
* 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; 8+ 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] 8+ messages in thread
end of thread, other threads:[~2009-03-17 8:24 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 13:45 ` [2.6.29-rc7][take #2][PATCH 1/3] ARM: OMAP: Add documentation for function omap_register_i2c_bus Jarkko Nikula 2009-03-09 13:45 ` [2.6.29-rc7][take #2][PATCH 2/3] ARM: OMAP: Add command line option for I2C bus speed Jarkko Nikula 2009-03-09 13:45 ` [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-09 17:19 ` [2.6.29-rc7][take #2][PATCH 0/3] ARM: OMAP: Add command line option for I2C bus speed Tony Lindgren -- strict thread matches above, loose matches on Subject: below -- 2009-03-06 16:13 [PATCH 3/7] " Tony Lindgren 2009-03-10 8:47 ` [2.6.29-rc7][take #2][PATCH 0/3] " Jarkko Nikula 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-16 17:29 ` Tony Lindgren [not found] ` <20090316172908.GA19229-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> 2009-03-17 8:24 ` Jarkko Nikula
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.