[U-Boot] [PATCH 2/2] fsl_i2c: add workaround for the erratum I2C A004447

Scott Wood scottwood at freescale.com
Fri Jul 26 18:26:43 CEST 2013


On 07/26/2013 04:39:03 AM, Chunhe Lan wrote:
> diff --git a/arch/powerpc/include/asm/processor.h  
> b/arch/powerpc/include/asm/processor.h
> index 56b22d8..156acba 100644
> --- a/arch/powerpc/include/asm/processor.h
> +++ b/arch/powerpc/include/asm/processor.h
> @@ -1073,6 +1073,8 @@
>  #define IS_SVR_REV(svr, maj, min) \
>  	((SVR_MAJ(svr) == maj) && (SVR_MIN(svr) == min))
> 
> +#define FIT_SVR_REV(svr, version)	((svr & 0xff) <= version)

I don't understand how you get "FIT" from "<=".  Why can't the caller  
do <= by itself?

Why does SVR_REV return the low 16 bits rather than the low 8 bits?

Could we try to synchronize what U-Boot does with this Linux patch:
http://patchwork.ozlabs.org/patch/259598/

> diff --git a/drivers/i2c/fsl_i2c.c b/drivers/i2c/fsl_i2c.c
> index ef0004d..694247c 100644
> --- a/drivers/i2c/fsl_i2c.c
> +++ b/drivers/i2c/fsl_i2c.c
> @@ -227,6 +227,15 @@ static int i2c_fixup(const struct fsl_i2c *dev)
>  	const unsigned long long timeout =  
> usec2ticks(CONFIG_I2C_MBB_TIMEOUT);
>  	unsigned long long timeval = 0;
>  	int ret = -1;
> +	unsigned int flags = 0;
> +
> +#ifdef CONFIG_SYS_FSL_ERRATUM_I2C_A004447
> +	unsigned int svr = get_svr();
> +	if ((SVR_SOC_VER(svr) == SVR_8548 && IS_SVR_REV(svr, 3, 1)) ||
> +	    (SVR_SOC_VER(svr) == SVR_P1010 && IS_SVR_REV(svr, 1, 0)) ||
> +	     FIT_SVR_REV(svr, CONFIG_SYS_FSL_A004447_VERSION))
> +		flags = I2C_CR_BIT6;
> +#endif

Why can't P1010 use CONFIG_SYS_FSL_A004447_VERSION?

-Scott


More information about the U-Boot mailing list