[U-Boot] [PATCH 5/7] drivers: i2c: mxc: Solve the compiler error when using i2c dm mode

Heiko Schocher hs at denx.de
Fri May 24 04:58:16 UTC 2019


Hello Chuanhua Han,

Am 23.05.2019 um 11:22 schrieb Chuanhua Han:
> This patch solved the following compilation error:
> 
> 1.Remove the definition of CONFIG_SYS_I2C to solve the following
> compilation issue:
> In file included from include/config.h:8:0,
>                   from include/common.h:20:
> include/config_fallbacks.h:51:4: error: #error "Cannot define
> CONFIG_SYS_I2C when CONFIG_DM_I2C is used"
>   #  error "Cannot define CONFIG_SYS_I2C when CONFIG_DM_I2C is used"
>      ^~~~~
> In file included from include/config.h:8:0,
>                   from include/common.h:20:
> include/config_fallbacks.h:51:4: error: #error "Cannot define
> CONFIG_SYS_I2C when CONFIG_DM_I2C is used"
>   #  error "Cannot define CONFIG_SYS_I2C when CONFIG_DM_I2C is used"
>      ^~~~~

Shouldn't this patch merged with the patch, which introduces DM_I2C?

Else you break git bisect..

> 2.Remove the definition of CONFIG_SYS_I2C_EARLY_INIT to solve the
> following compilation issue:
> board/freescale/lx2160a/lx2160a.c: In function 'board_early_init_f':
> board/freescale/lx2160a/lx2160a.c:108:2: warning: implicit declaration
> of function 'i2c_early_init_f'; did you mean 'arch_early_init_r'?
> [-Wimplicit-function-declaration]
>    i2c_early_init_f();
>    ^~~~~~~~~~~~~~~~
>    arch_early_init_r
> 
> 3.Move the enable_i2c_clk function definition to resolve the following
> compilation issues:
>    drivers/i2c/mxc_i2c.c: In function 'mxc_i2c_probe':
>    drivers/i2c/mxc_i2c.c:824:8: warning: implicit declaration of function
> 'enable_i2c_clk';
>    did you mean 'enable_irq_wake'? [-Wimplicit-function-declaration]
>    ret = enable_i2c_clk(1, bus->seq);
>          ^~~~~~~~~~~~~~
>          enable_irq_wake
> 
> Signed-off-by: Chuanhua Han <chuanhua.han at nxp.com>
> ---
>   arch/arm/include/asm/arch-fsl-layerscape/config.h |  2 --

Hmm... this is a "common" file ... have you checked, if this change
does not break other boards?

>   drivers/i2c/mxc_i2c.c                             | 15 ++++++++-------

please in a seperate patch, thanks!

>   2 files changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/arm/include/asm/arch-fsl-layerscape/config.h b/arch/arm/include/asm/arch-fsl-layerscape/config.h
> index eb21c09e01..5f87499980 100644
> --- a/arch/arm/include/asm/arch-fsl-layerscape/config.h
> +++ b/arch/arm/include/asm/arch-fsl-layerscape/config.h
> @@ -178,8 +178,6 @@
>   #elif defined(CONFIG_ARCH_LX2160A)
>   #define TZPC_BASE				0x02200000
>   #define TZPCDECPROT_0_SET_BASE			(TZPC_BASE + 0x804)
> -#define CONFIG_SYS_I2C
> -#define CONFIG_SYS_I2C_EARLY_INIT
>   #define SRDS_MAX_LANES  8
>   #ifndef L1_CACHE_BYTES
>   #define L1_CACHE_SHIFT		6
> diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c
> index f3811eb0c5..241367bac8 100644
> --- a/drivers/i2c/mxc_i2c.c
> +++ b/drivers/i2c/mxc_i2c.c
> @@ -558,6 +558,14 @@ static int i2c_read_data(struct mxc_i2c_bus *i2c_bus, uchar chip, uchar *buf,
>   	return 0;
>   }
>   
> +int __enable_i2c_clk(unsigned char enable, unsigned int i2c_num)
> +{
> +	return 1;
> +}
> +
> +int enable_i2c_clk(unsigned char enable, unsigned int i2c_num)
> +	__attribute__((weak, alias("__enable_i2c_clk")));
> +
>   #ifndef CONFIG_DM_I2C
>   /*
>    * Read data from I2C device
> @@ -723,13 +731,6 @@ static int mxc_i2c_probe(struct i2c_adapter *adap, uint8_t chip)
>   	return bus_i2c_write(i2c_get_base(adap), chip, 0, 0, NULL, 0);
>   }
>   
> -int __enable_i2c_clk(unsigned char enable, unsigned i2c_num)
> -{
> -	return 1;
> -}
> -int enable_i2c_clk(unsigned char enable, unsigned i2c_num)
> -	__attribute__((weak, alias("__enable_i2c_clk")));
> -
>   void bus_i2c_init(int index, int speed, int unused,
>   		  int (*idle_bus_fn)(void *p), void *idle_bus_data)
>   {
> 

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de


More information about the U-Boot mailing list