mgsuvd: fix compiler warning when using soft_i2c driver
following patch solves the compiler warning for the mgsuvd board, using the soft_i2c driver:
[hs at pollux u-boot]$ ./MAKEALL mgsuvd
Configuring for mgsuvd board...soft_i2c.c: In function 'write_byte':
soft_i2c.c:209: warning: implicit declaration of function 'i2c_soft_read_pin'
text data bss dec hex filename
174608 9712 28436 212756 33f14 ./u-boot
[hs at pollux u-boot]$
--- drivers/i2c/soft_i2c.c | 2 ++ include/configs/mgsuvd.h | 1 + include/i2c.h | 4 ++++ 3 files changed, 7 insertions(+), 0 deletions(-)
drivers/i2c/soft_i2c.c +2 -0
@@ -41,6 +41,8 @@#endif #include <i2c.h> +CONFIG_I2C_SOFT_EXTERN +/* #define DEBUG_I2C */ #ifdef DEBUG_I2C
include/configs/mgsuvd.h +1 -0
@@ -356,6 +356,7 @@#define I2C_ACTIVE do {} while (0)#define I2C_TRISTATE do {} while (0) +#define CONFIG_I2C_SOFT_EXTERN extern int i2c_soft_read_pin (void);#define I2C_READ i2c_soft_read_pin ()#define I2C_SDA (bit) if(bit) { \ *(unsigned short *)(I2C_BASE_DIR) &= ~SDA_CONF; \
include/i2c.h +4 -0
@@ -76,6 +76,10 @@# define I2C_SOFT_DECLARATIONS # endif #endif + +#ifndef CONFIG_I2C_SOFT_EXTERN +#define CONFIG_I2C_SOFT_EXTERN +#endif /* * Initialization, must be called once on start up, may be called * repeatedly to change the speed and slave addresses.
Signature · 5 lines
1.5.6.1 -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Dear Heiko Schocher,
Quoted 48 lines · In message <[email protected]> you wrote:
following patch solves the compiler warning for the mgsuvd board, using the
soft_i2cdriver:[hs at pollux u-boot]$ ./MAKEALL mgsuvd
Configuring for mgsuvd board...soft_i2c.c: In function 'write_byte':
soft_i2c.c:209: warning: implicit declaration of function 'i2c_soft_read_pin'
text data bss dec hex filename
174608 9712 28436 212756 33f14 ./u-boot
[hs at pollux u-boot]$Signed-off-by Heiko Schocher <[email protected]>--- drivers/i2c/soft_i2c.c | 2 ++ include/configs/mgsuvd.h | 1 + include/i2c.h | 4 ++++ 3 files changed, 7 insertions(+), 0 deletions(-)drivers/i2c/soft_i2c.c +2
-0@@ -41,6 +41,8 @@#endif #include <i2c.h> +CONFIG_I2C_SOFT_EXTERN +/* #define DEBUG_I2C */ #ifdef DEBUG_I2Cinclude/configs/mgsuvd.h +1
-0@@ -356,6 +356,7 @@#define I2C_ACTIVE do {} while (0)#define I2C_TRISTATE do {} while (0) +#define CONFIG_I2C_SOFT_EXTERN extern int i2c_soft_read_pin (void);#define I2C_READ i2c_soft_read_pin ()#define I2C_SDA (bit) if(bit) { \ *(unsigned short *)(I2C_BASE_DIR) &= ~SDA_CONF; \include/i2c.h +0
-0
include/i2c.h line 85
Quoted 10 lines
include/i2c.h +4
-0@@ -76,6 +76,10 @@# define I2C_SOFT_DECLARATIONS # endif #endif + +#ifndef CONFIG_I2C_SOFT_EXTERN +#define CONFIG_I2C_SOFT_EXTERN +#endif /* * Initialization, must be called once on start up, may be called * repeatedly to change the speed and slave addresses.
NAK. This is really ugly.
Please make i2c_soft_read_pin () an inline function so it's sufficient to change the I2C_READ definition in include/configs/mgsuvd.h
Umm... while we are at it - there is a lot of code in
"board/keymile/mgsuvd/mgsuvd.c" that needs to be cleaned up:
24 #if 0
25 #define DEBUG
26 #endif
Please remove.
167 memory_data[0] = cpu_to_be32(bd->bi_memstart);
168 memory_data[1] = cpu_to_be32(bd->bi_memsize);
169
170 nodeoffset = fdt_path_offset (blob, "/memory");
171 if (nodeoffset >= 0) {
172 ret = fdt_setprop(blob, nodeoffset, "reg", memory_data,
173 sizeof(memory_data));
Indentation is wrong here.
177 }
178 else {
make this "} else {"
180 printf("ft_blob_update(): cannot find /memory node "
181 "err:%s\n", fdt_strerror(nodeoffset));
Indentation.
187 if (nodeoffset >= 0) {
188 ret = fdt_setprop(blob, nodeoffset, "ranges", flash_data,
189 sizeof(flash_data));
190 if (ret < 0)
191 printf("ft_blob_update(): cannot set /localbus/ranges "
192 "property err:%s\n", fdt_strerror(ret));
193 }
194 else {
Bad indentation and "} else {" again.
202 if (nodeoffset >= 0) {
203 ret = fdt_setprop(blob, nodeoffset, "brg-frequency", brg_data,
204 sizeof(brg_data));
205 if (ret < 0)
206 printf("ft_blob_update(): cannot set /soc/cpm/brg-frequency "
207 "property err:%s\n", fdt_strerror(ret));
208 }
209 else {
Bad indentation and "} else {" again.
Oops. This is the third time you repeat the same code? And yet another time follows below? Please turn this into a function.
Best regards,
Wolfgang Denk
Signature · 4 lines
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: [email protected] I often quote myself; it adds spice to my conversation. - G. B. Shaw