Message ID | 1294129662-680-5-git-send-email-r64343@freescale.com |
---|---|
State | Accepted |
Delegated to: | Stefano Babic |
Headers | show |
On 01/04/2011 09:27 AM, Jason Liu wrote: > 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" > > Changes for v3: > -address the comments from Albert, change #ifdef to #if defined() > for the sake of homogeneity > --- > drivers/i2c/mxc_i2c.c | 21 ++++++++++++++++++--- > 1 files changed, 18 insertions(+), 3 deletions(-) Applied to u-boot-imx, thanks. Best regards, Stefano Babic
Dear Stefano Babic, In message <4D2D78B1.9090305@denx.de> you wrote: > On 01/04/2011 09:27 AM, Jason Liu wrote: > > 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" > > > > Changes for v3: > > -address the comments from Albert, change #ifdef to #if defined() > > for the sake of homogeneity > > --- > > drivers/i2c/mxc_i2c.c | 21 ++++++++++++++++++--- > > 1 files changed, 18 insertions(+), 3 deletions(-) > > Applied to u-boot-imx, thanks. Please wait for the ACK from the I2C custodian first. Best regards, Wolfgang Denk
Hello Wolfgang, Wolfgang Denk schrieb: > In message <4D2D78B1.9090305@denx.de> you wrote: >> On 01/04/2011 09:27 AM, Jason Liu wrote: >>> 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" >>> >>> Changes for v3: >>> -address the comments from Albert, change #ifdef to #if defined() >>> for the sake of homogeneity >>> --- >>> drivers/i2c/mxc_i2c.c | 21 ++++++++++++++++++--- >>> 1 files changed, 18 insertions(+), 3 deletions(-) >> Applied to u-boot-imx, thanks. > > Please wait for the ACK from the I2C custodian first. Uh, I thought I acked it, but couldn;t find such an EMail, so: Acked-by: Heiko Schocher <hs@denx.de> bye, Heiko
On Tuesday, January 04, 2011 09:27:39 AM Jason Liu wrote: > This patch add I2C support for Freescale MX53 processor > > Signed-off-by: Jason Liu <r64343@freescale.com> > -- SNIP -- > > +#if defined(CONFIG_MX31) > + 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); Jason, this here is incorrect, I CCed you with my "rework of i2c_mxc" patch where this is fixed, as well as the driver is more stable (at least for me on imx51). The correct source here should be MXC_IPG_CLK. Cheers > +#endif > > for (i = 0; i < 0x1f; i++) > if (freq / div[i] <= speed)
diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c old mode 100644 new mode 100755 index 8e10fbb..1ebec14 --- a/drivers/i2c/mxc_i2c.c +++ b/drivers/i2c/mxc_i2c.c @@ -26,8 +26,14 @@ #if defined(CONFIG_HARD_I2C) +#if defined(CONFIG_MX31) #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 @@ -47,7 +53,7 @@ #define I2SR_IIF (1 << 1) #define I2SR_RX_NO_AK (1 << 0) -#ifdef CONFIG_SYS_I2C_MX31_PORT1 +#if defined(CONFIG_SYS_I2C_MX31_PORT1) #define I2C_BASE 0x43f80000 #define I2C_CLK_OFFSET 26 #elif defined (CONFIG_SYS_I2C_MX31_PORT2) @@ -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; +#if defined(CONFIG_MX31) + 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)
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" Changes for v3: -address the comments from Albert, change #ifdef to #if defined() for the sake of homogeneity --- drivers/i2c/mxc_i2c.c | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-)