Message ID | 1358426881-24117-5-git-send-email-holger.brunck@keymile.com |
---|---|
State | Superseded |
Delegated to: | Kim Phillips |
Headers | show |
On Thu, 17 Jan 2013 13:47:50 +0100 Holger Brunck <holger.brunck@keymile.com> wrote: > +int piggy_present(void) > +{ > + struct km_bec_fpga *base = > + (struct km_bec_fpga *)CONFIG_SYS_KMBEC_FPGA_BASE; > + > + return in_8(&base->bprth) & PIGGY_PRESENT; > +} this change produces two new sparse warnings: km83xx.c:137:22: warning: incorrect type in argument 1 (different address spaces) km83xx.c:137:22: expected unsigned char const volatile [noderef] <asn:2>*addr km83xx.c:137:22: got unsigned char *<noident> km83xx.c:132:5: warning: symbol 'piggy_present' was not declared. Should it be static? so make the function static, and add __iomem annotation to the assignment of 'base'. Kim
On 01/18/2013 01:23 AM, Kim Phillips wrote: > On Thu, 17 Jan 2013 13:47:50 +0100 > Holger Brunck <holger.brunck@keymile.com> wrote: > >> +int piggy_present(void) >> +{ >> + struct km_bec_fpga *base = >> + (struct km_bec_fpga *)CONFIG_SYS_KMBEC_FPGA_BASE; >> + >> + return in_8(&base->bprth) & PIGGY_PRESENT; >> +} > > this change produces two new sparse warnings: > > km83xx.c:137:22: warning: incorrect type in argument 1 (different address spaces) > km83xx.c:137:22: expected unsigned char const volatile [noderef] <asn:2>*addr > km83xx.c:137:22: got unsigned char *<noident> > km83xx.c:132:5: warning: symbol 'piggy_present' was not declared. Should it be static? > > so make the function static, and add __iomem annotation to the > assignment of 'base'. > ok will do. Just out of curiosity which compiler throws these warnings? I use powerpc-gcc (GCC) 4.7.2 and don't see them. Anyway I send a v2 for this patch. Regards Holger
On Fri, 18 Jan 2013 09:07:32 +0100 Holger Brunck <holger.brunck@keymile.com> wrote: > On 01/18/2013 01:23 AM, Kim Phillips wrote: > > On Thu, 17 Jan 2013 13:47:50 +0100 > > Holger Brunck <holger.brunck@keymile.com> wrote: > > > >> +int piggy_present(void) > >> +{ > >> + struct km_bec_fpga *base = > >> + (struct km_bec_fpga *)CONFIG_SYS_KMBEC_FPGA_BASE; > >> + > >> + return in_8(&base->bprth) & PIGGY_PRESENT; > >> +} > > > > this change produces two new sparse warnings: > > > > km83xx.c:137:22: warning: incorrect type in argument 1 (different address spaces) > > km83xx.c:137:22: expected unsigned char const volatile [noderef] <asn:2>*addr > > km83xx.c:137:22: got unsigned char *<noident> > > km83xx.c:132:5: warning: symbol 'piggy_present' was not declared. Should it be static? > > > > so make the function static, and add __iomem annotation to the > > assignment of 'base'. > > > > ok will do. Just out of curiosity which compiler throws these warnings? I use > powerpc-gcc (GCC) 4.7.2 and don't see them. it's not a compiler, it's sparse - Linus' kernel sanity checking tool. Get it from here: http://git.kernel.org/?p=devel/sparse/sparse.git;a=summary build it, add it to your path, and in u-boot, use make C=1 or ./MAKEALL -C/--check. Kim
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c index 468c755..ef93ed3 100644 --- a/board/keymile/common/common.c +++ b/board/keymile/common/common.c @@ -183,17 +183,6 @@ void i2c_init_board(void) } #endif - -#if !defined(MACH_TYPE_KM_KIRKWOOD) -int ethernet_present(void) -{ - struct km_bec_fpga *base = - (struct km_bec_fpga *)CONFIG_SYS_KMBEC_FPGA_BASE; - - return in_8(&base->bprth) & PIGGY_PRESENT; -} -#endif - int board_eth_init(bd_t *bis) { if (ethernet_present()) diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c index 67b69f6..defc885 100644 --- a/board/keymile/km82xx/km82xx.c +++ b/board/keymile/km82xx/km82xx.c @@ -385,6 +385,14 @@ void handle_mgcoge3un_reset(void) } #endif +int ethernet_present(void) +{ + struct km_bec_fpga *base = + (struct km_bec_fpga *)CONFIG_SYS_KMBEC_FPGA_BASE; + + return in_8(&base->bprth) & PIGGY_PRESENT; +} + /* * Early board initalization. */ diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c index 83a8753..26e682b 100644 --- a/board/keymile/km83xx/km83xx.c +++ b/board/keymile/km83xx/km83xx.c @@ -133,6 +133,28 @@ const uint upma_table[] = { }; #endif +int piggy_present(void) +{ + struct km_bec_fpga *base = + (struct km_bec_fpga *)CONFIG_SYS_KMBEC_FPGA_BASE; + + return in_8(&base->bprth) & PIGGY_PRESENT; +} + +#if defined(CONFIG_KMVECT1) +int ethernet_present(void) +{ + /* ethernet port connected to simple switch without piggy */ + return 1; +} +#else +int ethernet_present(void) +{ + return piggy_present(); +} +#endif + + int board_early_init_r(void) { struct km_bec_fpga *base = @@ -280,7 +302,7 @@ int checkboard(void) { puts("Board: Keymile " CONFIG_KM_BOARD_NAME); - if (ethernet_present()) + if (piggy_present()) puts(" with PIGGY."); puts("\n"); return 0;