public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] sh: i2c: Add support I2C controller of SH7734
Date: Mon, 06 Feb 2012 07:52:00 +0100	[thread overview]
Message-ID: <4F2F7890.4080002@denx.de> (raw)
In-Reply-To: <1328254404-2737-1-git-send-email-nobuhiro.iwamatsu.yj@renesas.com>

Hello Nobuhiro,

Nobuhiro Iwamatsu wrote:
> Renesas SH7734 has two I2C interfaceis.
> This supports these I2C.
> 
> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
> ---
>  drivers/i2c/Makefile        |    1 +
>  drivers/i2c/sh_sh7734_i2c.c |  468 +++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 469 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/i2c/sh_sh7734_i2c.c

[...]
> diff --git a/drivers/i2c/sh_sh7734_i2c.c b/drivers/i2c/sh_sh7734_i2c.c
> new file mode 100644
> index 0000000..6c514b4
> --- /dev/null
> +++ b/drivers/i2c/sh_sh7734_i2c.c
> @@ -0,0 +1,468 @@

[...]
> +static void sh_i2c_send_stop(struct sh_i2c *base)
> +{
> +	writeb(readb(&base->iccr2) & ~(SH_I2C_ICCR2_BBSY | SH_I2C_ICCR2_SCP),
> +		&base->iccr2);

Please use clrbits_*

[...]
> +static int check_tend(struct sh_i2c *base, int stop)
> +{
> +	int i, ret = 1;
> +
> +	for (i = 0 ; i < IRQ_WAIT ; i++) {
> +		if (SH_I2C_ICSR_TEND & readb(&base->icsr)) {
> +			ret = 0;
> +			break;
> +		}
> +		udelay(10);
> +	}
> +
> +	if (stop) {
> +		u8 data;
> +
> +		writeb(readb(&base->icsr) & ~SH_I2C_ICSR_STOP, &base->icsr);
> +
> +		sh_i2c_send_stop(base);
> +	}
> +
> +	writeb(readb(&base->icsr) & ~SH_I2C_ICSR_TEND, &base->icsr);

here too... please check globally.

[...]
> +#ifdef CONFIG_I2C_MULTI_BUS
> +static unsigned int current_bus;
> +
> +/**

wrong comment style.

[...]
> +/**

here too.

> + * i2c_get_bus_num - returns index of active I2C bus
> + */
> +unsigned int i2c_get_bus_num(void)
[...]
> +int i2c_read(u8 chip, u32 addr, int alen, u8 *buffer, int len)
> +{
> +	int i = 0;

new line please.

> +	for (i = 0 ; i < len ; i++)
> +		buffer[i] = i2c_raw_read(base, chip, addr + i);
[...]

Beside of this minor comments patch looks good, thanks!

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

  reply	other threads:[~2012-02-06  6:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-03  7:33 [U-Boot] [PATCH] sh: i2c: Add support I2C controller of SH7734 Nobuhiro Iwamatsu
2012-02-06  6:52 ` Heiko Schocher [this message]
2012-02-15  7:33   ` Nobuhiro Iwamatsu
  -- strict thread matches above, loose matches on Subject: below --
2012-02-22  1:13 Nobuhiro Iwamatsu
2012-02-22  4:25 ` Mike Frysinger
2012-02-22 13:53   ` Marek Vasut
2012-02-22 16:38     ` Mike Frysinger
2012-03-01  2:44   ` Nobuhiro Iwamatsu
2012-03-02  3:56 Nobuhiro Iwamatsu
2012-03-02  4:37 ` Mike Frysinger
2012-04-24  9:11 ` 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=4F2F7890.4080002@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox