[U-Boot] [PATCH 2/2] arm, i.mx27: add support for magnesium board from LogicPD

Wolfgang Denk
2010-03-04T12:40:53Z

Dear Heiko Schocher,

In message <4B8F5D65.4070405@denx.de> you wrote:
> This patch adds support for the magnesium board from LogicPD.
> This board uses i.MX27 SoC and has 8MB NOR flash, 128MB NAND
> flash, FEC ethernet controller integrated into i.MX27.

The magnesium board is NOT developed by nor manufactured by LogicPD.

>
> +magnesium_config: unconfig
> + @$(MKCONFIG) $(@:_config=) arm arm926ejs imx27lite logicpd mx27

Do we need a separate make target? Can we not add this to the
imx27lite target, as you share the code anyway?

> diff --git a/board/logicpd/imx27lite/imx27lite.c b/board/logicpd/imx27lite/imx27lite.c
> index 63375d5..0c7041a 100644
> --- a/board/logicpd/imx27lite/imx27lite.c
> +++ b/board/logicpd/imx27lite/imx27lite.c
> @@ -29,6 +29,10 @@ DECLARE_GLOBAL_DATA_PTR;
> int board_init (void)
> {
> struct gpio_regs *regs = (struct gpio_regs *)IMX_GPIO_BASE;
> +#if defined(CONFIG_MAGNESIUM)
> + struct system_control_regs *sc_regs =
> + (struct system_control_regs *)IMX_SYSTEM_CTL_BASE;
> +#endif

See below.

> gd->bd->bi_arch_number = MACH_TYPE_IMX27LITE;
> gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
> @@ -43,9 +47,20 @@ int board_init (void)
> &regs->port[PORTC].dr);
> #endif
> #ifdef CONFIG_MXC_MMC
> +#if defined(CONFIG_MAGNESIUM)
> + mx27_sd1_init_pins();
> +#else
> mx27_sd2_init_pins();
> #endif
> +#endif

This is actually note a feature that depends on the board name, right?
See below.

> +#if defined(CONFIG_MAGNESIUM)
> + /*
> + * set in FMCR NF_FMS Bit(5) to 1
> + * (NAND Flash with 2 Kbyte page size)
> + */
> + writel(readl(&sc_regs->fmcr) | (1 << 5), &sc_regs->fmcr);
> +#endif

Same here. Other boards that might reuse this code might or might not
wan this,too. To avoid long listes of "#if defined(BOARD_THIS) ||
defined(BOARD_THAT) || defined(BOARD_OTHER) || .." we should introduce
a feature specific #define here - if it's really needed.

In this specific case, CONFIG_SYS_NAND_LARGEPAGE might do the job?

> @@ -68,6 +83,10 @@ int dram_init (void)
>
> int checkboard(void)
> {
> +#if defined(CONFIG_MAGNESIUM)
> + printf("LogicPD magnesium\n");
> +#else
> printf("LogicPD imx27lite\n");
> +#endif
> return 0;

As Stefano already mentioned: don't add sich an #ifdef here. Define
the board name in the board config file instead (and switch to using a
puts()).

> diff --git a/include/configs/magnesium.h b/include/configs/magnesium.h
> new file mode 100644
> index 0000000..555278a
> --- /dev/null
> +++ b/include/configs/magnesium.h
> @@ -0,0 +1,260 @@
> +/*
> + * Copyright (C) 2010 Heiko Schocher <hs@denx.de>
> + *
> + * based from:

"based on" or "derived from".

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
The only person who always got his work done by Friday
was Robinson Crusoe.