From: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> To: Jarkko Nikula <jarkko.nikula-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org> Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Subject: Re: [2.6.29-rc7][take #2][PATCH 2/3] ARM: OMAP: Add command line option for I2C bus speed Date: Mon, 16 Mar 2009 10:29:08 -0700 [thread overview] Message-ID: <20090316172908.GA19229@atomide.com> (raw) In-Reply-To: <1236674831-3637-3-git-send-email-jarkko.nikula-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org> * 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
next prev parent reply other threads:[~2009-03-16 17:29 UTC|newest] Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top 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 ` Tony Lindgren [this message] [not found] ` <20090316172908.GA19229-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> 2009-03-17 8:24 ` [2.6.29-rc7][take #2][PATCH 2/3] ARM: OMAP: Add command line option for I2C bus speed 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 13:45 ` [2.6.29-rc7][take #2][PATCH 2/3] " Jarkko Nikula
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20090316172908.GA19229@atomide.com \ --to=tony-4v6ys6ai5vpbdgjk7y7tuq@public.gmane.org \ --cc=jarkko.nikula-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org \ --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --subject='Re: [2.6.29-rc7][take #2][PATCH 2/3] ARM: OMAP: Add command line option for I2C bus speed' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
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.