[U-Boot] [POWERPC v2] mgsuvd: fix compiler warning when using soft_i2c driver
Wolfgang Denk
wd at denx.de
Fri Oct 17 11:22:32 CEST 2008
Dear Heiko Schocher,
In message <48F8558A.4080902 at denx.de> you wrote:
> Signed-off-by: Heiko Schocher <hs at denx.de>
> ---
> This Patch replaces the Patch:
>
> http://lists.denx.de/pipermail/u-boot/2008-October/041890.html
> [U-Boot] [POWERPC] mgsuvd: fix compiler warning when using soft_i2c driver
>
> board/keymile/common/common.c | 3 ++-
> board/keymile/mgsuvd/mgsuvd.c | 12 +-----------
> drivers/i2c/soft_i2c.c | 4 ++++
> include/configs/mgsuvd.h | 26 +++++++++++++++++---------
> 4 files changed, 24 insertions(+), 21 deletions(-)
...
> @@ -400,7 +401,7 @@ static void set_scl (int state)
>
> static int get_sda (void)
> {
> - return i2c_soft_read_pin ();
> + return I2C_READ;
Only single space needed here.
> index 7a80dad..32b636f 100644
> --- a/include/configs/mgsuvd.h
> +++ b/include/configs/mgsuvd.h
> @@ -346,8 +346,10 @@
> /*
> * Software (bit-bang) I2C driver configuration
> */
> -#define I2C_BASE_DIR (CONFIG_SYS_PIGGY_BASE + 0x04)
> -#define I2C_BASE_PORT (CONFIG_SYS_PIGGY_BASE + 0x09)
> +#define I2C_BASE_DIR (volatile unsigned short __iomem *) \
> + (CONFIG_SYS_PIGGY_BASE + 0x04)
> +#define I2C_BASE_PORT (volatile unsigned char __iomem *) \
> + (CONFIG_SYS_PIGGY_BASE + 0x09)
Why do you add the funny casts here? These ar enot needed when using
the accessor functions.
Also, if you need them, you must place a pair of "(...)" around the
whole expression.
> -#define I2C_READ i2c_soft_read_pin ()
> +#define I2C_READ ((in_8(I2C_BASE_PORT) & SDA_BIT) == SDA_BIT)
For this, no such cast as above is needed.
> #define I2C_SDA(bit) if(bit) { \
> - *(unsigned short *)(I2C_BASE_DIR) &= ~SDA_CONF; \
> + out_be16(I2C_BASE_DIR, \
> + in_be16(I2C_BASE_DIR) & ~SDA_CONF); \
Ditto.
> } \
> else { \
Make this
} else {
please.
> } \
> else { \
Ditto.
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: wd at denx.de
Don't hit a man when he's down - kick him; it's easier.
More information about the U-Boot
mailing list