Dear Marek,

In message <1352766871-892-4-git-send-email-ma...@denx.de> you wrote:
> This patch pulls out the I2C speed setup from the i2c_init() call
> and implements the bus configuration lookup table with register
> values that needs to be programmed into the I2C IP to run at
> particular speed.
> 
> This patch is a first step towards implementing run-time I2C bus
> speed configuration for the MXS I2C IP.

Thanks.

> +static struct mxs_i2c_speed_table {
> +     uint32_t        speed;
> +     uint32_t        timing0;
> +     uint32_t        timing1;
> +} mxs_i2c_tbl[] = {
> +     {
> +             100000,
> +             (0x0078 << I2C_TIMING0_HIGH_COUNT_OFFSET) |
> +             (0x0030 << I2C_TIMING0_RCV_COUNT_OFFSET),
> +             (0x0080 << I2C_TIMING1_LOW_COUNT_OFFSET) |
> +             (0x0030 << I2C_TIMING1_XMIT_COUNT_OFFSET)
> +     },
> +     {
> +             400000,
> +             (0x000f << I2C_TIMING0_HIGH_COUNT_OFFSET) |
> +             (0x0007 << I2C_TIMING0_RCV_COUNT_OFFSET),
> +             (0x001f << I2C_TIMING1_LOW_COUNT_OFFSET) |
> +             (0x000f << I2C_TIMING1_XMIT_COUNT_OFFSET),
> +     }
> +};

Do we really need such a compile-time initialized table which will
have to include all possible I2C speeds anybody is ever going to use
on any board?

And if board XXX wants to use a funny I2C clock, we have to add yet
another entry to this common file?   Such a solution does not scale.

Can we not rather calculate these register values for any arbitrary
I2C clock given?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Microsoft Compatibility:
     your old Windows 3.11 application crash exactly as the new ones.
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to