All of lore.kernel.org
 help / color / mirror / Atom feed
From: Albert ARIBAUD <albert.aribaud@free.fr>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 2/3] mxc_i2c: add support for MX53 processor
Date: Wed, 22 Dec 2010 19:07:12 +0100	[thread overview]
Message-ID: <4D123E50.7030001@free.fr> (raw)
In-Reply-To: <1293024212-4858-2-git-send-email-r64343@freescale.com>

Le 22/12/2010 14:23, Jason Liu a ?crit :
> This patch add I2C support for Freescale MX53 processor
>
> Signed-off-by: Jason Liu<r64343@freescale.com>
>
> ---
> Changes for v2:
> -address the comments of Heiko, add #if defined(CONFIG_MX31)
>   to avoid break MX31 build. Move CONFIG_HARD_I2C to the top
>   of the file and fix the error message from:
> 	 #error "define CONFIG_SYS_I2C_PORT to use the I2C driver"
>   to      #error "define CONFIG_SYS_I2C_MXxx_PORTx to use the I2C driver"
> ---
>   drivers/i2c/mxc_i2c.c |   19 +++++++++++++++++--
>   1 files changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c
> old mode 100644
> new mode 100755
> index 8e10fbb..95d27ae
> --- a/drivers/i2c/mxc_i2c.c
> +++ b/drivers/i2c/mxc_i2c.c
> @@ -26,8 +26,14 @@
>
>   #if defined(CONFIG_HARD_I2C)
>
> +#ifdef CONFIG_MX31

Can you make this an #if defined() like all others you are adding here?

>   #include<asm/arch/mx31.h>
>   #include<asm/arch/mx31-regs.h>
> +#endif
> +
> +#if defined(CONFIG_MX53)
> +#include<asm/arch/clock.h>
> +#endif
>
>   #define IADR	0x00
>   #define IFDR	0x04
> @@ -56,8 +62,12 @@
>   #elif defined (CONFIG_SYS_I2C_MX31_PORT3)
>   #define I2C_BASE	0x43f84000
>   #define I2C_CLK_OFFSET	30
> +#elif defined(CONFIG_SYS_I2C_MX53_PORT1)
> +#define I2C_BASE        I2C1_BASE_ADDR
> +#elif defined(CONFIG_SYS_I2C_MX53_PORT2)
> +#define I2C_BASE        I2C2_BASE_ADDR
>   #else
> -#error "define CONFIG_SYS_I2C_MX31_PORTx to use the mx31 I2C driver"
> +#error "define CONFIG_SYS_I2C_MXxx_PORTx to use the I2C driver"
>   #endif
>
>   #ifdef DEBUG
> @@ -72,11 +82,16 @@ static u16 div[] = { 30, 32, 36, 42, 48, 52, 60, 72, 80, 88, 104, 128, 144,
>
>   void i2c_init(int speed, int unused)
>   {
> -	int freq = mx31_get_ipg_clk();
> +	int freq;
>   	int i;
>
> +#ifdef CONFIG_MX31

Ditto, for the sake of homogeneity.

> +	freq = mx31_get_ipg_clk();
>   	/* start the required I2C clock */
>   	__REG(CCM_CGR0) = __REG(CCM_CGR0) | (3<<  I2C_CLK_OFFSET);
> +#else
> +	freq = mxc_get_clock(MXC_IPG_PERCLK);
> +#endif
>
>   	for (i = 0; i<  0x1f; i++)
>   		if (freq / div[i]<= speed)


Amicalement,
-- 
Albert.

  reply	other threads:[~2010-12-22 18:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-22 13:23 [U-Boot] [PATCH v2 1/3] MX5: Add initial support for MX53 processor Jason Liu
2010-12-22 13:23 ` [U-Boot] [PATCH v2 2/3] mxc_i2c: add " Jason Liu
2010-12-22 18:07   ` Albert ARIBAUD [this message]
2010-12-23  2:30     ` Jason Liu
2010-12-22 13:23 ` [U-Boot] [PATCH v2 3/3] MX5:MX53: add initial support for MX53EVK board Jason Liu
2010-12-27 10:25   ` Stefano Babic
2010-12-28  7:45     ` Jason Liu
2010-12-28  8:13       ` Stefano Babic
2010-12-27 10:06 ` [U-Boot] [PATCH v2 1/3] MX5: Add initial support for MX53 processor Stefano Babic
2010-12-28  8:12   ` Jason Liu
2010-12-28  8:31     ` Stefano Babic
2010-12-28  8:36       ` Jason Liu
2011-01-09 23:03 ` Wolfgang Denk
2011-01-10  1:24   ` Jason Liu

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=4D123E50.7030001@free.fr \
    --to=albert.aribaud@free.fr \
    --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.