public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Michael Jones <michael.jones@matrix-vision.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 6/7] ARMV7: OMAP: I2C driver: Write more than 1 byte at a time in i2c_write
Date: Wed, 27 Jul 2011 09:42:07 +0200	[thread overview]
Message-ID: <4E2FC14F.6080907@matrix-vision.de> (raw)
In-Reply-To: <4E2FAB26.6060208@denx.de>

Hi Heiko,

Thanks for the review.

On 07/27/2011 08:07 AM, Heiko Schocher wrote:
> 
> Hello Michael,
> 
> Sorry for the long delay...
> 
> Michael Jones wrote:
>> This allows the EEPROM layer to send a single i2c write command
>> per page, and wait CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS between
>> i2c write commands.
>>
>> Signed-off-by: Michael Jones <michael.jones@matrix-vision.de>
>> ---
>> Changes for v2:
>>   - None. Resubmitting to include custodian in cc:
>>
>>  drivers/i2c/omap24xx_i2c.c |  134 ++++++++++++++++++-------------------------
>>  1 files changed, 56 insertions(+), 78 deletions(-)
>>
>> diff --git a/drivers/i2c/omap24xx_i2c.c b/drivers/i2c/omap24xx_i2c.c
>> index 966ffc4..4ae03bc 100644
>> --- a/drivers/i2c/omap24xx_i2c.c
>> +++ b/drivers/i2c/omap24xx_i2c.c
> [...]
>> @@ -372,26 +301,75 @@ int i2c_read (uchar chip, uint addr, int alen, uchar * buffer, int len)
>>  int i2c_write (uchar chip, uint addr, int alen, uchar * buffer, int len)
>>  {
>>  	int i;
>> +	u16 status;
>> +	int i2c_error = 0;
>>  
>>  	if (alen > 1) {
>> -		printf ("I2C read: addr len %d not supported\n", alen);
>> +		printf("I2C write: addr len %d not supported\n", alen);
>>  		return 1;
>>  	}
>>  
>>  	if (addr + len > 256) {
>> -		printf ("I2C read: address out of range\n");
>> +		printf("I2C write: address 0x%x + 0x%x out of range\n");
>>  		return 1;
>>  	}
>>  
>> +	/* wait until bus not busy */
>> +	wait_for_bb();
>> +
>> +	/* start address phase - will write regoffset + len bytes data */
>> +	/* TODO consider case when !CONFIG_OMAP243X/34XX/44XX */
> 
> Do we have this usecase?

I don't know, I assumed so, as there is the following #ifdef in the part
I removed:

#if defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX) || \
defined(CONFIG_OMAP44XX)
#else
/* there is code here that I didn't consider when replacing it. */
#endif

> 
>> +	writew(alen+len, &i2c_base->cnt);
> 
> please change to "alen + len"

OK. I thought checkpatch.pl would've found that.

> 
>> +	/* set slave address */
>> +	writew(chip, &i2c_base->sa);
>> +	/* stop bit needed here */
>> +	writew(I2C_CON_EN | I2C_CON_MST | I2C_CON_STT | I2C_CON_TRX |
>> +		I2C_CON_STP, &i2c_base->con);
>> +
>> +	/* Send address byte */
>> +	status = wait_for_pin();
>> +
>> +	if (status == 0 || status & I2C_STAT_NACK) {
>> +		i2c_error = 1;
>> +		printf("%s:%d error status=0x%x\n", __func__, __LINE__, status);
> 
> Can you change this printf to output some more info, instead __func__, __LINE__?

OK, I will make these more informative. Do you not want __func__ to be
in the output? I originally put __LINE__ in as well because the strings
were otherwise identical, so I'm fine with getting rid of that once the
messages are unique.

[snip]

> 
> bye,
> Heiko

Question about cosmetics: the README says "In sources originating from
U-Boot a style  corresponding to "Lindent -pcs" (adding spaces before
parameters to function calls) is actually used." Currently this is not
uniform in this file, because checkpatch.pl doesn't like the spaces
between function names and '(' (and neither do I). Are there supposed to
be such spaces in U-Boot code? Or can we uniformly remove them in this file?

-Michael

MATRIX VISION GmbH, Talstrasse 16, DE-71570 Oppenweiler
Registergericht: Amtsgericht Stuttgart, HRB 271090
Geschaeftsfuehrer: Gerhard Thullner, Werner Armingeon, Uwe Furtner, Erhard Meier

  reply	other threads:[~2011-07-27  7:42 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-15  9:09 [U-Boot] [PATCH 0/7] OMAP3: Add support for mvBlueLYNX-X Michael Jones
2011-07-15  9:09 ` [U-Boot] [PATCH 1/7] fpga: add #define for Altera Cyclone EP3C5 Michael Jones
2011-07-28 14:46   ` Wolfgang Denk
2011-07-15  9:09 ` [U-Boot] [PATCH 2/7] fpga: support FPP Cyclone configuration Michael Jones
2011-07-28 14:47   ` Wolfgang Denk
2011-07-15  9:09 ` [U-Boot] [PATCH 3/7] ARMV7: OMAP3: Add 37xx ESx revision numbers Michael Jones
2011-07-18 14:36   ` [U-Boot] [PATCH v2 " Michael Jones
2011-07-15  9:09 ` [U-Boot] [PATCH 4/7] mmc: rescan fails on empty slot Michael Jones
2011-07-18 14:40   ` [U-Boot] [PATCH v2 " Michael Jones
2011-08-17  2:15     ` Andy Fleming
2011-08-17  2:30       ` Andy Fleming
2011-08-17  7:46         ` Michael Jones
2011-07-19  2:06   ` [U-Boot] [PATCH " Jaehoon Chung
2011-07-20  8:51     ` Michael Jones
2011-07-20  9:52       ` Jaehoon Chung
2011-07-15  9:09 ` [U-Boot] [PATCH 5/7] mv_common.c: don't compile reset_environment if ENV_IS_NOWHERE Michael Jones
2011-07-18 14:45   ` [U-Boot] [PATCH v2 " Michael Jones
2011-07-28 14:49     ` Wolfgang Denk
2011-07-18 17:39   ` [U-Boot] [PATCH " Mike Frysinger
2011-07-15  9:09 ` [U-Boot] [PATCH 6/7] ARMV7: OMAP: I2C driver: Write more than 1 byte at a time in i2c_write Michael Jones
2011-07-18 14:58   ` [U-Boot] [PATCH v2 " Michael Jones
2011-07-27  6:07     ` Heiko Schocher
2011-07-27  7:42       ` Michael Jones [this message]
2011-07-27  7:53         ` Heiko Schocher
2011-07-27 12:41           ` [U-Boot] [PATCH v3] " Michael Jones
2011-07-27 12:41             ` [U-Boot] [PATCH] ARMV7: OMAP: I2C driver: cosmetic: make checkpatch-compatible Michael Jones
2011-08-01  9:12             ` [U-Boot] [PATCH v3] ARMV7: OMAP: I2C driver: Write more than 1 byte at a time in i2c_write Heiko Schocher
2011-08-01 10:14               ` [U-Boot] [PATCH v4] " Michael Jones
2011-08-02  6:37                 ` Heiko Schocher
2011-09-04 17:59                   ` Paulraj, Sandeep
2011-09-05  5:34                     ` Heiko Schocher
2011-07-27 21:00         ` [U-Boot] [PATCH v2 6/7] " Wolfgang Denk
2011-07-15  9:09 ` [U-Boot] [PATCH 7/7] OMAP3: mvblx: Initial support for mvBlueLYNX-X Michael Jones
2011-07-18 15:00   ` [U-Boot] [PATCH v2 " Michael Jones
2011-07-27  9:57     ` Igor Grinberg
2011-08-04 13:46     ` [U-Boot] [PATCH v3] " Michael Jones
2011-10-06 22:06       ` Wolfgang Denk
2011-08-17  8:55 ` [U-Boot] [PATCH v4] " Michael Jones
2011-10-06 21:51   ` Wolfgang Denk
2011-10-07  9:06     ` Michael Jones
2011-10-09 19:59       ` Wolfgang Denk
2011-10-05 15:08 ` [U-Boot] [PATCH v5] " Michael Jones
2011-10-10 15:08   ` [U-Boot] [PATCH v6] " Michael Jones
2011-10-18 17:31   ` [U-Boot] [PATCH v5] " Tom Rini
2011-10-19  8:16     ` Michael Jones
2011-10-20 11:37     ` [U-Boot] [PATCH] mv_common.c: get rid of 'defined but not used' warning Michael Jones
2011-10-20 11:48       ` Andre Schwarz
2011-12-03 12:32       ` Anatolij Gustschin

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=4E2FC14F.6080907@matrix-vision.de \
    --to=michael.jones@matrix-vision.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox