[U-Boot] [PATCH 3/3] arm: Add support for jadecpu board based on MB86R01 SoC

Wolfgang Denk wd at denx.de
Thu Apr 22 14:51:32 CEST 2010


Dear Matthias Weisser,

In message <1271932257-14618-4-git-send-email-weisserm at arcor.de> you wrote:
> This patch adds support for the jadecpu board using the
> MB86R01 'Jade' SoC from Fujitsu.
> 
> Signed-off-by: Matthias Weisser <weisserm at arcor.de>
> ---
>  MAINTAINERS                          |    4 +
>  MAKEALL                              |    1 +
>  Makefile                             |    3 +
>  board/syteco/jadecpu/Makefile        |   55 +++++++
>  board/syteco/jadecpu/config.mk       |    1 +
>  board/syteco/jadecpu/jadecpu.c       |  198 ++++++++++++++++++++++++
>  board/syteco/jadecpu/lowlevel_init.S |  279 ++++++++++++++++++++++++++++++++++
>  common/serial.c                      |    3 +-
>  include/configs/jadecpu.h            |  189 +++++++++++++++++++++++
>  include/serial.h                     |    3 +-
>  tools/Makefile                       |    3 +
>  tools/logos/syteco.bmp               |  Bin 0 -> 11414 bytes
>  12 files changed, 737 insertions(+), 2 deletions(-)
>  create mode 100644 board/syteco/jadecpu/Makefile
>  create mode 100644 board/syteco/jadecpu/config.mk
>  create mode 100644 board/syteco/jadecpu/jadecpu.c
>  create mode 100644 board/syteco/jadecpu/lowlevel_init.S
>  create mode 100644 include/configs/jadecpu.h
>  create mode 100644 tools/logos/syteco.bmp
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 04c8730..ac0ed62 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -776,6 +776,10 @@ Prafulla Wadaskar <prafulla at marvell.com>
>  	rd6281a		ARM926EJS (Kirkwood SoC)
>  	sheevaplug	ARM926EJS (Kirkwood SoC)
>  
> +Matthias Weisser <matthias.weisser at graf-syteco.de>
> +
> +	jadecpu		ARM926EJS (MB86R01 SoC)
> +
>  Richard Woodruff <r-woodruff2 at ti.com>
>  
>  	omap2420h4	ARM1136EJS
> diff --git a/MAKEALL b/MAKEALL
> index fb1f7a3..5ee9678 100755
> --- a/MAKEALL
> +++ b/MAKEALL
> @@ -561,6 +561,7 @@ LIST_ARM9="			\
>  	edb9315			\
>  	edb9315a		\
>  	imx27lite		\
> +	jadecpu			\
>  	lpd7a400		\
>  	mv88f6281gtw_ge		\
>  	mx1ads			\
> diff --git a/Makefile b/Makefile
> index 0381c81..4fdd216 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2834,6 +2834,9 @@ CPU9260_config	:	unconfig
>  	@echo "#define CONFIG_$(@:_config=) 1" >$(obj)include/config.h
>  	@$(MKCONFIG) -a cpu9260 arm arm926ejs cpu9260 eukrea at91
>  
> +jadecpu_config	:	unconfig
> +	@$(MKCONFIG) $(@:_config=) arm arm926ejs jadecpu syteco mb86r0x
> +
>  meesc_config	:	unconfig
>  	@$(MKCONFIG) $(@:_config=) arm arm926ejs meesc esd at91
>  
> diff --git a/board/syteco/jadecpu/Makefile b/board/syteco/jadecpu/Makefile
> new file mode 100644
> index 0000000..87d2234
> --- /dev/null
> +++ b/board/syteco/jadecpu/Makefile
> @@ -0,0 +1,55 @@
> +#
> +# (C) Copyright 2003-2008
> +# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
> +#
> +# (C) Copyright 2008
> +# Stelian Pop <stelian.pop at leadtechdesign.com>
> +# Lead Tech Design <www.leadtechdesign.com>
> +#
> +# See file CREDITS for list of people who contributed to this
> +# project.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation; either version 2 of
> +# the License, or (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write to the Free Software
> +# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> +# MA 02111-1307 USA
> +#
> +
> +include $(TOPDIR)/config.mk
> +
> +LIB	= $(obj)lib$(BOARD).a
> +
> +COBJS-y	+= jadecpu.o
> +SOBJS	:= lowlevel_init.o
> +
> +SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
> +OBJS	:= $(addprefix $(obj),$(COBJS-y))
> +SOBJS	:= $(addprefix $(obj),$(SOBJS))
> +
> +$(LIB):	$(obj).depend $(OBJS) $(SOBJS)
> +	$(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
> +
> +clean:
> +	rm -f $(SOBJS) $(OBJS)
> +
> +distclean:	clean
> +	rm -f $(LIB) core *.bak $(obj).depend
> +
> +#########################################################################
> +
> +# defines $(obj).depend target
> +include $(SRCTREE)/rules.mk
> +
> +sinclude $(obj).depend
> +
> +#########################################################################
> diff --git a/board/syteco/jadecpu/config.mk b/board/syteco/jadecpu/config.mk
> new file mode 100644
> index 0000000..c661f0b
> --- /dev/null
> +++ b/board/syteco/jadecpu/config.mk
> @@ -0,0 +1 @@
> +TEXT_BASE = 0x46000000
> diff --git a/board/syteco/jadecpu/jadecpu.c b/board/syteco/jadecpu/jadecpu.c
> new file mode 100644
> index 0000000..ecc6742
> --- /dev/null
> +++ b/board/syteco/jadecpu/jadecpu.c
> @@ -0,0 +1,198 @@
> +/*
> + * (c) 2010 Graf-Syteco, Matthias Weisser
> + * <weisserm at arcor.de>
> + *
> + * (C) Copyright 2007, mycable GmbH
> + * Carsten Schneider <cs at mycable.de>, Alexander Bigga <ab at mycable.de>
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> + * MA 02111-1307 USA
> + */
> +
> +#include <common.h>
> +#include <netdev.h>
> +#include <asm/io.h>
> +#include <asm/arch/mb86r0x.h>
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +#if defined(CONFIG_SHOW_BOOT_PROGRESS)
> +void show_boot_progress(int progress)
> +{
> +	printf("Boot reached stage %d\n", progress);
> +}
> +#endif
> +
> +/*
> + * Miscellaneous platform dependent initialisations
> + */
> +int board_init(void)
> +{
> +	struct mb86r0x_ccnt * ccnt = (struct mb86r0x_ccnt *)
> +					MB86R0x_CCNT_PHYS_BASE;
> +
> +	/* We select mode 0 for group 2 and mode 1 for group 4 */
> +	writel(0x00000010, &ccnt->cmux_md);
> +
> +	gd->flags = 0;
> +	gd->bd->bi_arch_number = MACH_TYPE_JADECPU;
> +	gd->bd->bi_boot_params = PHYS_SDRAM + PHYS_SDRAM_SIZE - 0x10000;
> +
> +	icache_enable();
> +
> +	return 0;
> +}
> +
> +int board_late_init(void)
> +{
> +	struct mb86r0x_gpio *gpio = (struct mb86r0x_gpio *)
> +					MB86R0x_GPIO_PHYS_BASE;
> +	struct mb86r0x_pwm *pwm;
> +	uint32_t in_word;
> +	const char *e;
> +	const char *s;
> +
> +#ifdef CONFIG_VIDEO_MB86R0xGDC
> +	/* Check if we have valid display settings and turn on power if so */
> +	/* Display 0 */
> +	if (getenv("gs_dsp_0_param") || getenv("videomode")) {
> +		writel(readl(&gpio->gpdr2) | (1 << 3), &gpio->gpdr2);
> +
> +		e = getenv("gs_dsp_0_pwm");
> +		if (e != NULL) {
> +			uint32_t freq, init;
> +
> +			freq = 0;
> +			init = 0;
> +
> +			s = strchr(e, 'f');
> +			if (s != NULL)
> +				freq = simple_strtol(s + 2, NULL, 0);
> +
> +			s = strchr(e, 'i');
> +			if (s != NULL)
> +				init = simple_strtol(s + 2, NULL, 0);
> +
> +			if (freq > 0) {
> +				pwm = (struct mb86r0x_pwm *)
> +					MB86R0x_PWM0_PHYS_BASE;
> +
> +				writel(CONFIG_MB86R0x_IOCLK / 1000 / freq,
> +					&pwm->bcr);
> +				writel(1002, &pwm->tpr);
> +				writel(1, &pwm->pr);
> +				writel(init * 10 + 1, &pwm->dr);
> +				writel(1, &pwm->cr);
> +				writel(1, &pwm->sr);
> +			}
> +		}
> +	}
> +	writel(readl(&gpio->gpddr2) | (1 << 3), &gpio->gpddr2);
> +
> +	/* Display 1 */
> +	if (getenv("gs_dsp_1_param")) {
> +		writel(readl(&gpio->gpdr2) | (1 << 4), &gpio->gpdr2);
> +
> +		e = getenv("gs_dsp_1_pwm");
> +		if (e != NULL) {
> +			uint32_t freq, init;
> +
> +			freq = 0;
> +			init = 0;
> +
> +			s = strchr(e, 'f');
> +			if (s != NULL)
> +				freq = simple_strtol(s + 2, NULL, 0);
> +
> +			s = strchr(e, 'i');
> +			if (s != NULL)
> +				init = simple_strtol(s + 2, NULL, 0);
> +
> +			if (freq > 0) {
> +				pwm = (struct mb86r0x_pwm *)
> +					MB86R0x_PWM1_PHYS_BASE;
> +
> +				writel(CONFIG_MB86R0x_IOCLK / 1000 / freq,
> +					&pwm->bcr);
> +				writel(1002, &pwm->tpr);
> +				writel(1, &pwm->pr);
> +				writel(init * 10 + 1, &pwm->dr);
> +				writel(1, &pwm->cr);
> +				writel(1, &pwm->sr);

Instead of repeating the code, use a function with an argument.

> +	if ((in_word & 0xC0) == 0xC0) {
> +		setenv("stdin", "serial");
> +		setenv("stdout", "serial");
> +		setenv("stderr", "serial");
> +		setenv("bootdelay", "10");
> +	} else if ((in_word & 0xC0) != 0) {
> +		setenv("stdout", "vga");
> +		setenv("bootcmd", "mw.l 0x40000000 0 1024; usb start;"
> +			"fatls usb 0; fatload usb 0 0x40000000 mcq5resq.bin;"
> +			"bootelf 0x40000000; bootelf 0x10080000");
> +		setenv("bootdelay", "5");

I consider such mandatory settings of behaviour-critical variables as
"bootcmd" and "bootdelay" bad style.  I recommend to use oither
variables instead, and to use these as defaults, so the user still has
a choice to define his own "bootcmd" which does not get overwritten at
each boot.

> diff --git a/common/serial.c b/common/serial.c
> index 5f9ffd7..3cc4d23 100644
> --- a/common/serial.c
> +++ b/common/serial.c
> @@ -41,7 +41,8 @@ struct serial_device *__default_serial_console (void)
>  #elif defined(CONFIG_405GP) || defined(CONFIG_405CR) || defined(CONFIG_440) \
>     || defined(CONFIG_405EP) || defined(CONFIG_405EZ) || defined(CONFIG_405EX) \
>     || defined(CONFIG_MPC5xxx) || defined(CONFIG_MPC83xx) \
> -   || defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
> +   || defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx) \
> +   || defined(CONFIG_MB86R0x)

Please keep list sorted.

...
> +#define CONFIG_MB86R0x
> +#define CONFIG_MB86R0x_IOCLK		(41164767)
> +#define CONFIG_SYS_HZ			(CONFIG_MB86R0x_IOCLK / 16)

NAK.  CONFIG_SYS_HZ must always be 1000.

> diff --git a/include/serial.h b/include/serial.h
> index f2638ec..8802193 100644
> --- a/include/serial.h
> +++ b/include/serial.h
> @@ -25,7 +25,8 @@ extern struct serial_device * default_serial_console (void);
>  #if defined(CONFIG_405GP) || defined(CONFIG_405CR) || defined(CONFIG_440) || \
>      defined(CONFIG_405EP) || defined(CONFIG_405EZ) || defined(CONFIG_405EX) || \
>      defined(CONFIG_MPC5xxx) || defined(CONFIG_MPC83xx) || \
> -    defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
> +    defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx) || \
> +    defined(CONFIG_MB86R0x)

Please keep list sorted.

>  extern struct serial_device serial0_device;
>  extern struct serial_device serial1_device;
>  #if defined(CONFIG_SYS_NS16550_SERIAL)
> diff --git a/tools/Makefile b/tools/Makefile
> index 749d994..b2e73b2 100644
> --- a/tools/Makefile
> +++ b/tools/Makefile
> @@ -118,6 +118,9 @@ endif
>  ifeq ($(VENDOR),ronetix)
>  LOGO_BMP= logos/ronetix.bmp
>  endif
> +ifeq ($(VENDOR),syteco)
> +LOGO_BMP= logos/syteco.bmp
> +endif

Please keep list sorted.


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
Program maintenance is an entropy-increasing process,  and  even  its
most skilfull execution only delays the subsidence of the system into
unfixable obsolescence.       - Fred Brooks, "The Mythical Man Month"


More information about the U-Boot mailing list