[U-Boot] [PATCH 2/2] Add Nomadik board "usb-s8815" by Calao vendor

Wolfgang Denk wd at denx.de
Tue Jan 19 00:32:18 CET 2010


Dear Alessandro Rubini,

In message <f34ac6eeba7c2771468e8f7b08d1cdc9bdb04fe6.1263851321.git.rubini at unipv.it> you wrote:
> Signed-off-by: Alessandro Rubini <rubini at gnudd.com>
> Cc: Gregory Hermant <gregory.hermant at calao-systems.com>
> ---
>  MAINTAINERS                                        |    4 +
>  Makefile                                           |    4 +
>  board/{st/nhk8815 => calao/usb-s8815}/Makefile     |    3 +-
>  board/{st/nhk8815 => calao/usb-s8815}/config.mk    |    0
>  board/{st/nhk8815 => calao/usb-s8815}/lcd.c        |   34 +------
>  board/{st/nhk8815 => calao/usb-s8815}/platform.S   |    0
>  .../nhk8815.c => calao/usb-s8815/usb-s8815.c}      |   40 +--------
>  include/configs/{nhk8815.h => usb-s8815.h}         |   98 ++++----------------
>  8 files changed, 36 insertions(+), 147 deletions(-)
>  copy board/{st/nhk8815 => calao/usb-s8815}/Makefile (96%)
>  copy board/{st/nhk8815 => calao/usb-s8815}/config.mk (100%)
>  copy board/{st/nhk8815 => calao/usb-s8815}/lcd.c (68%)
>  copy board/{st/nhk8815 => calao/usb-s8815}/platform.S (100%)
>  copy board/{st/nhk8815/nhk8815.c => calao/usb-s8815/usb-s8815.c} (67%)
>  copy include/configs/{nhk8815.h => usb-s8815.h} (61%)

I don't like to see such heavy copying of code.  This is a clear
indication that we should factor out the common parts ; Actually
differences are so small that common code can be used completely, and
no separate board directories are needed.

Note that many of the existing diffrences can be avoided easily and
without need for #ifdef's:

> index d3acb48..744da67 100644
> --- a/board/st/nhk8815/lcd.c
> +++ b/board/calao/usb-s8815/lcd.c
> @@ -1,5 +1,5 @@
>  /*
> - * board/st/nhk8815/lcd.c: use amba clcd and STMPE2401 for backlight/reset
> + * board/calao/usb-s8815/lcd.c: use amba clcd and STMPE2401 for backlight/reset

No need to include the file name in the comment.

>  /* Horribly, these are precomputed registers */
> -struct clcd_config nhk8815_clcd_config = {
> +struct clcd_config s8815_clcd_config = {

Use a common name, then this...

>  	.address =	(struct clcd_registers *)NOMADIK_CLCDC_BASE,
>  	.tim0 =		0xd52600c4,	/* horizontal timings */
>  	.tim1 =		0x220a01df,	/* vertical timings */
> @@ -53,36 +53,14 @@ vidinfo_t panel_info = {
>  	.vl_col =	800,
>  	.vl_row =	480,
>  	.vl_bpix =	CLCD_BPIX_VAL,
> -	.priv =		&nhk8815_clcd_config,
> +	.priv =		&s8815_clcd_config,

...and this diff will go away.

> -	gd->bd->bi_arch_number = MACH_TYPE_NOMADIK;
> +	gd->bd->bi_arch_number = MACH_TYPE_USB_S8815;

Set the current MACH_TYPE in the board config file, and use this
setting here.

etc. etc.


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
Forty two.


More information about the U-Boot mailing list