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

2010-03-04 Thread Wolfgang Denk
Dear Heiko Schocher,

In message <4b8f5d65.4070...@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)
>   ®s->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 000..555278a
> --- /dev/null
> +++ b/include/configs/magnesium.h
> @@ -0,0 +1,260 @@
> +/*
> + * Copyright (C) 2010 Heiko Schocher 
> + *
> + * 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: w...@denx.de
The only person who always got his work done by Friday
 was Robinson Crusoe.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2010-03-04 Thread Stefano Babic
Heiko Schocher 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.
> 

Heiko,

I have only a little comment.

>  int checkboard(void)
>  {
> +#if defined(CONFIG_MAGNESIUM)
> + printf("LogicPD magnesium\n");

I think we can use puts here instead printf.

> +#else
>   printf("LogicPD imx27lite\n");
> +#endif
>   return 0;
>  }

It is a pity to add a nasty ifdef only to print out the name of the
board. What do you think if we put the board name in the config file
with a CONFIG_ option (the same for imx27lite.h, of course), removing
the #ifdef ?

Best regards,
Stefano

-- 
=
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2010-03-03 Thread Heiko Schocher
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.

Signed-off-by: Heiko Schocher 
---
against current git://git.denx.de/u-boot-imx.git

 MAINTAINERS |4 +
 MAKEALL |1 +
 Makefile|3 +
 board/logicpd/imx27lite/imx27lite.c |   19 +++
 include/configs/magnesium.h |  260 +++
 5 files changed, 287 insertions(+), 0 deletions(-)
 create mode 100644 include/configs/magnesium.h

diff --git a/MAINTAINERS b/MAINTAINERS
index d6f78de..a381ec4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -724,6 +724,10 @@ Jens Scharsig 

eb_cpux9k2  ARM920T (AT91RM9200 SoC)

+Heiko Schocher 
+
+   magnesium   i.MX27
+
 Robert Schwebel 

csb226  xscale
diff --git a/MAKEALL b/MAKEALL
index 6e432ba..2b39d91 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -565,6 +565,7 @@ LIST_ARM9=" \
edb9315a\
imx27lite   \
lpd7a400\
+   magnesium   \
mv88f6281gtw_ge \
mx1ads  \
mx1fs2  \
diff --git a/Makefile b/Makefile
index ee5b896..7c68115 100644
--- a/Makefile
+++ b/Makefile
@@ -2966,6 +2966,9 @@ lpd7a400_config \
 lpd7a404_config:   unconfig
@$(MKCONFIG) $(@:_config=) arm lh7a40x lpd7a40x

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

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

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)
®s->port[PORTC].dr);
 #endif
 #ifdef CONFIG_MXC_MMC
+#if defined(CONFIG_MAGNESIUM)
+   mx27_sd1_init_pins();
+#else
mx27_sd2_init_pins();
 #endif
+#endif

+#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
return 0;
 }

@@ -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;
 }
diff --git a/include/configs/magnesium.h b/include/configs/magnesium.h
new file mode 100644
index 000..555278a
--- /dev/null
+++ b/include/configs/magnesium.h
@@ -0,0 +1,260 @@
+/*
+ * Copyright (C) 2010 Heiko Schocher 
+ *
+ * based from:
+ * Copyright (C) 2009 Ilya Yanok 
+ *
+ * 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
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+/*
+ * SoC Configuration
+ */
+#define CONFIG_ARM926EJS   /* arm926ejs CPU core */
+#define CONFIG_MX27
+#define CONFIG_MAGNESIUM
+#define CONFIG_MX27_CLK32  32768   /* OSC32K frequency */
+#define CONFIG_SYS_HZ  1000
+#define CONFIG_HOSTNAMEmagnesium
+
+#define CONFIG_DISPLAY_CPUINFO
+
+#define CONFIG_CMDLINE_TAG 1   /* enable passing of ATAGs */
+#define CONFIG_SETUP_MEMORY_TAGS   1
+#define CONFIG_INITRD_TAG  1
+
+/*
+ * Lowlevel configuration
+ */
+#define SDRAM_ESDCFG_REGISTER_VAL(cas) \
+   (ESDCFG_TRC(10) |   \
+   ESDCFG_TRCD(3) |\
+   ESDCFG_TCAS(cas) |  \
+   ESDCFG_TRRD(1) |\
+   ESDCFG_TRAS(5) |\
+   ESDCFG_TWR |\
+   ESDCFG_TMRD(2) |\
+