public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: linux-omap-open-source@linux.omap.com
Subject: Re: [PATCH 1/3] ARM: OMAP: Add helper module for board specific I2C bus registration
Date: Fri, 2 Nov 2007 09:22:04 -0700	[thread overview]
Message-ID: <200711020922.04241.david-b@pacbell.net> (raw)
In-Reply-To: <1194011191-29395-2-git-send-email-jarkko.nikula@nokia.com>

On Friday 02 November 2007, jarkko.nikula@nokia.com wrote:
> +#define NUM_RESOURCES	(sizeof(i2c_resources) / sizeof(*i2c_resources))

This is ARRAY_SIZE yes?


> +
> +/*
> + * FIXME: This is mostly helper function for those boards that don't do
> + * I2C pin muxing by themself

So what's to FIX?  I'd think that it should be able to handle
all the pinmux options.  Are there cases where boards NEED to
mux the pins themselves?  (Like, a choice of ballout for either
of the I2C signals on a given bus.)

This ought to be fully board-independant code...


> + */
> +static void omap_i2c_mux_pins(int bus_id)
> +{
> +	switch (bus_id) {
> +	case 1:
> +		if (cpu_class_is_omap1()) {
> +			omap_cfg_reg(I2C_SCL);
> +			omap_cfg_reg(I2C_SDA);
> +		} else if (machine_is_omap_h4()) {

What about other OMAP2 boards wanting to use bus 1?

> +			omap_cfg_reg(M19_24XX_I2C1_SCL);
> +			omap_cfg_reg(L15_24XX_I2C1_SDA);
> +		}
> +		break;
> +	case 2:
> +		if (cpu_is_omap24xx() && !machine_is_omap_h4()) {
> +			omap_cfg_reg(J15_24XX_I2C2_SCL);
> +			omap_cfg_reg(H19_24XX_I2C2_SDA);

Again, this shouldn't have board-specific code.  If a given
board is going to use bus #2, the only way it shouldn't be
set up here is if there's a nonstandard ballout option (on
the order of, either J15 or X2 for 24XX_I2C2_SCL).


> +		}
> +		break;
> +	}
> +}
> +
> +void omap_register_i2c_bus(int bus_id, u32 clkrate)
> +{

Consider passing the i2c_board_info in here too, so that
boards can just say "configure this bus at N kHz, with
these devices".  Not that having two I2C init calls in
each board's init logic unreasonable, but if you're going
to clean up the I2C init logic then this would be another
thing to clean up.  And it'd help get rid of potential
errors, by grouping all the related items together.

- Dave

  reply	other threads:[~2007-11-02 16:22 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-02 13:46 [PATCH/RFC 0/3] I2C bus registration helper jarkko.nikula
2007-11-02 13:46 ` [PATCH 1/3] ARM: OMAP: Add helper module for board specific I2C bus registration jarkko.nikula
2007-11-02 16:22   ` David Brownell [this message]
2007-11-05  8:19     ` Jarkko Nikula
2007-11-06  8:26       ` David Brownell
2007-11-06 10:53         ` Jarkko Nikula
2007-11-06 12:51           ` Tony Lindgren
2007-11-02 13:46 ` [PATCH 2/3] ARM: OMAP: Use I2C bus registration helper jarkko.nikula
2007-11-02 16:27   ` David Brownell
2007-11-05  8:26     ` Jarkko Nikula
2007-11-05  9:56       ` David Brownell
2007-11-02 13:46 ` [PATCH 3/3] ARM: OMAP: N800: " jarkko.nikula
2007-11-05 13:15 ` [PATCH/RFC 0/3 rev 2] " Jarkko Nikula
2007-11-05 13:15 ` [PATCH 1/3] ARM: OMAP: Add helper module for board specific I2C bus registration Jarkko Nikula
2007-11-05 13:15 ` [PATCH 2/3] ARM: OMAP: Use I2C bus registration helper Jarkko Nikula
2007-11-05 13:15 ` [PATCH 3/3] ARM: OMAP: N800: " Jarkko Nikula
  -- strict thread matches above, loose matches on Subject: below --
2007-11-07 10:54 [PATCH/RFC 0/3 rev 3] " Jarkko Nikula
2007-11-07 10:54 ` [PATCH 1/3] ARM: OMAP: Add helper module for board specific I2C bus registration 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=200711020922.04241.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=linux-omap-open-source@linux.omap.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox