All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/9 v3] 83xx, i2c: add mux support for fsl_i2c
Date: Tue, 24 Feb 2009 08:00:55 +0100	[thread overview]
Message-ID: <49A39B27.8010208@denx.de> (raw)
In-Reply-To: <20090223163548.7bcc21b6.kim.phillips@freescale.com>

Hello Kim,

Kim Phillips wrote:
> On Thu, 19 Feb 2009 17:24:09 +0100
> Heiko Schocher <hs@denx.de> wrote:
> 
>> @@ -369,6 +370,23 @@ i2c_probe(uchar chip)
>>
>>  int i2c_set_bus_num(unsigned int bus)
>>  {
>> +#if defined(CONFIG_I2C_MUX)
>> +	if (bus < CONFIG_SYS_MAX_I2C_BUS) {
>> +		i2c_bus_num = bus;
>> +	} else {
> 
> [1]
> 
>> +		int	ret;
>> +
>> +		ret = i2x_mux_select_mux(bus);
>> +		if (ret == 0) {
>> +			/* with CONFIG_I2C_MUX only I2C Controller 1
>> +			 * is usable
>> +			 */
>> +			i2c_bus_num = 0;
>> +			i2c_bus_num_mux = bus;
>> +		} else
>> +			return ret;
>> +	}
> 
> how about
> 
> ret = i2x_...
> if (ret)
> 	return ret;
> /* with...
> 
>> +#else
>>  #ifdef CONFIG_SYS_I2C2_OFFSET
>>  	if (bus > 1) {
>>  #else
>> @@ -378,7 +396,7 @@ int i2c_set_bus_num(unsigned int bus)
>>  	}
>>
>>  	i2c_bus_num = bus;
>> -
>> +#endif
> 
> reuse code and moved the ifdef up, then [1] would just be:

Ok.

> if (bus >= CONFIG_SYS_MAX_I2C_BUS) {
> 
>>  	return 0;
>>  }
>>
>> @@ -396,7 +414,11 @@ int i2c_set_bus_speed(unsigned int speed)
>>
>>  unsigned int i2c_get_bus_num(void)
>>  {
>> +#if defined(CONFIG_I2C_MUX)
>> +	return i2c_bus_num_mux;
>> +#else
>>  	return i2c_bus_num;
>> +#endif
>>  }
> 
> I don't get this mux variant - why aren't we reusing i2c_bus_num in the
> mux case?

Good question, have to think about it.

bye
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

  reply	other threads:[~2009-02-24  7:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-19 16:24 [U-Boot] [PATCH 4/9 v3] 83xx, i2c: add mux support for fsl_i2c Heiko Schocher
2009-02-23 22:35 ` Kim Phillips
2009-02-24  7:00   ` Heiko Schocher [this message]
2009-02-24  7:53   ` Heiko Schocher
2009-02-25  0:08     ` Kim Phillips
2009-02-25  8:00       ` Heiko Schocher
2009-02-26  1:20         ` Timur Tabi
2009-02-26  7:05           ` Heiko Schocher
2009-02-26  1:31         ` Kim Phillips
2009-02-26  7:09           ` Heiko Schocher
2009-02-23 22:43 ` Kim Phillips
2009-02-24  1:49 ` Timur Tabi
2009-02-24  7:54   ` Heiko Schocher

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=49A39B27.8010208@denx.de \
    --to=hs@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

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

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