[U-Boot] [PATCH 4/5] mxc_i2c: add support for MX53 processor

Jason Liu liu.h.jason at gmail.com
Fri Dec 17 04:28:48 CET 2010


Hi, Heiko

2010/12/16 Heiko Schocher <hs at denx.de>:
> Hello Jason,
>
> Jason Liu wrote:
>> This patch add I2C support for Freescale MX53 processor
>>
>> Signed-off-by: Jason Liu <r64343 at freescale.com>
>> ---
>>  drivers/i2c/mxc_i2c.c |   18 +++++++++++++-----
>>  1 files changed, 13 insertions(+), 5 deletions(-)
>>  mode change 100644 => 100755 drivers/i2c/mxc_i2c.c
>>
>> diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c
>> old mode 100644
>> new mode 100755
>> index 8e10fbb..f9f32cc
>> --- a/drivers/i2c/mxc_i2c.c
>> +++ b/drivers/i2c/mxc_i2c.c
>> @@ -24,10 +24,11 @@
>>
>>  #include <common.h>
>>
>> -#if defined(CONFIG_HARD_I2C)
>> +#if defined(CONFIG_MX53)
>> +#include <asm/arch/clock.h>
>> +#endif
>>
>> -#include <asm/arch/mx31.h>
>> -#include <asm/arch/mx31-regs.h>
>
> Why do you delete this includes? That will break mx31 boards.
> Please add instead a

As I think there is no need to include it? Am I wrong?
I see the only one board to use MXC_I2C is phycore, but it will build error,

board.c: In function '__dram_init_banksize':
board.c:233: error: 'CONFIG_SYS_SDRAM_BASE' undeclared (first use in
this function)
board.c:233: error: (Each undeclared identifier is reported only once
board.c:233: error: for each function it appears in.)
board.c: In function 'board_init_f':
board.c:279: error: 'CONFIG_SYS_INIT_SP_ADDR' undeclared (first use in
this function)
board.c:312: error: 'CONFIG_SYS_SDRAM_BASE' undeclared (first use in
this function)
make[1]: *** [board.o] Error 1
make[1]: Leaving directory
`/home/r64343/work_space/u-boot-upstream/u-boot/arch/arm/lib'
make: *** [arch/arm/lib/libarm.o] Error 2

>
> #if defined(CONFIG_MX31) around it
>
>> +#if defined(CONFIG_HARD_I2C)
>
> Why you move this define here?
>
>>  #define IADR 0x00
>>  #define IFDR 0x04
>> @@ -56,8 +57,10 @@
>>  #elif defined (CONFIG_SYS_I2C_MX31_PORT3)
>>  #define I2C_BASE     0x43f84000
>>  #define I2C_CLK_OFFSET       30
>> +#elif defined(CONFIG_SYS_I2C_PORT)
>> +#define I2C_BASE CONFIG_SYS_I2C_PORT
>>  #else
>> -#error "define CONFIG_SYS_I2C_MX31_PORTx to use the mx31 I2C driver"
>> +#error "define CONFIG_SYS_I2C_PORT to use the I2C driver"
>
> This error message will be not correct on mx31 based boards,
> as they have to define CONFIG_SYS_I2C_MX31_PORTx, please correct.
>
>>  #endif
>>
>>  #ifdef DEBUG
>> @@ -72,11 +75,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
>> +     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)
>
> bye,
> Heiko
> --
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>


More information about the U-Boot mailing list