Skip to contentSkip to conversation

Subject: [PATCH v3] mx27ads: add support for iMX27ADS board from Freescale

U-Boot Alan Carvalho de Assis 3 participants 4 messages Sep 15, 2009 – Sep 22, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

This patch adds support to iMX27ADS development board. This board has 128MB RAM, 32MB NOR Flash and 128MB NAND Flash. Currently only booting from NOR is supported.

---
 MAINTAINERS                             |    3 +
 MAKEALL                                 |    1 +
 Makefile                                |    3 +
 board/freescale/mx27ads/Makefile        |   51 ++++++++
 board/freescale/mx27ads/config.mk       |    1 +
 board/freescale/mx27ads/lowlevel_init.S |  127 +++++++++++++++++++
 board/freescale/mx27ads/mx27ads.c       |   93 ++++++++++++++
 board/freescale/mx27ads/u-boot.lds      |   56 +++++++++
 include/configs/mx27ads.h               |  202 +++++++++++++++++++++++++++++++
 9 files changed, 537 insertions(+), 0 deletions(-)
 create mode 100644 board/freescale/mx27ads/Makefile
 create mode 100644 board/freescale/mx27ads/config.mk
 create mode 100644 board/freescale/mx27ads/lowlevel_init.S
 create mode 100644 board/freescale/mx27ads/mx27ads.c
 create mode 100644 board/freescale/mx27ads/u-boot.lds
 create mode 100644 include/configs/mx27ads.h
MAINTAINERS +3 -0
index e9db278..7ff3160 100644
@@ -512,6 +512,9 @@ Unknown / orphaned boards:
 #	Board		CPU						#
 #########################################################################
 
+Alan Carvalho de Assis <[email protected]>
+	mx27ads		i.MX27
+
 Rowel Atienza <[email protected]>
 
 	armadillo	ARM720T
MAKEALL +1 -0
index f0ed8ea..56b4446 100755
@@ -525,6 +525,7 @@ LIST_ARM9="			\
 	mv88f6281gtw_ge		\
 	mx1ads			\
 	mx1fs2			\
+	mx27ads			\
 	netstar			\
 	nhk8815			\
 	nhk8815_onenand		\
Makefile +3 -0
index 9764cea..4f2dcef 100644
@@ -2965,6 +2965,9 @@ davinci_dm365evm_config :	unconfig
 imx27lite_config:	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm926ejs imx27lite logicpd mx27
 
+mx27ads_config :	unconfig
+	@$(MKCONFIG) $(@:_config=) arm arm926ejs mx27ads freescale mx27
+
 lpd7a400_config \
 lpd7a404_config:	unconfig
 	@$(MKCONFIG) $(@:_config=) arm lh7a40x lpd7a40x
board/freescale/mx27ads/Makefile new file +51 -0

51 lines not on this page · raw message

(quoted diff) +0 -0

b/board/freescale/mx27ads/config.mk
new file mode 100644
index 0000000..a2e7768

board/freescale/mx27ads/config.mk new file +1 -0
@@ -0,0 +1 @@
+TEXT_BASE = 0xA7F00000
(quoted diff) +0 -0

b/board/freescale/mx27ads/lowlevel_init.S
new file mode 100644
index 0000000..dc62a93

board/freescale/mx27ads/lowlevel_init.S new file +127 -0

127 lines not on this page · raw message

(quoted diff) +0 -0

b/board/freescale/mx27ads/mx27ads.c
new file mode 100644
index 0000000..4def923

board/freescale/mx27ads/mx27ads.c new file +93 -0

93 lines not on this page · raw message

(quoted diff) +0 -0

b/board/freescale/mx27ads/u-boot.lds
new file mode 100644
index 0000000..f66f20e

board/freescale/mx27ads/u-boot.lds new file +56 -0

56 lines not on this page · raw message

include/configs/mx27ads.h new file +202 -0

202 lines not on this page · raw message

Signature · 1 line
1.6.0.4
#1 lore raw

Dear Alan Carvalho de Assis,

2009/9/16 Alan Carvalho de Assis <[email protected]>

Quoted 182 lines

This patch adds support to iMX27ADS development board. This board has 128MB RAM, 32MB NOR Flash and 128MB NAND Flash. Currently only booting from NOR is supported.

---
 MAINTAINERS                             |    3 +
 MAKEALL                                 |    1 +
 Makefile                                |    3 +
 board/freescale/mx27ads/Makefile        |   51 ++++++++
 board/freescale/mx27ads/config.mk       |    1 +
 board/freescale/mx27ads/lowlevel_init.S |  127 +++++++++++++++++++
 board/freescale/mx27ads/mx27ads.c       |   93 ++++++++++++++
 board/freescale/mx27ads/u-boot.lds      |   56 +++++++++
 include/configs/mx27ads.h               |  202
+++++++++++++++++++++++++++++++
 9 files changed, 537 insertions(+), 0 deletions(-)
 create mode 100644 board/freescale/mx27ads/Makefile
 create mode 100644 board/freescale/mx27ads/config.mk
 create mode 100644 board/freescale/mx27ads/lowlevel_init.S
 create mode 100644 board/freescale/mx27ads/mx27ads.c
 create mode 100644 board/freescale/mx27ads/u-boot.lds
 create mode 100644 include/configs/mx27ads.h
MAINTAINERS +3 -0
index e9db278..7ff3160 100644
@@ -512,6 +512,9 @@ Unknown / orphaned boards:
 #      Board           CPU                                             #
 #########################################################################
 
+Alan Carvalho de Assis <[email protected]>
+       mx27ads         i.MX27
+
 Rowel Atienza <[email protected]>
 
       armadillo       ARM720T
MAKEALL +1 -0
index f0ed8ea..56b4446 100755
@@ -525,6 +525,7 @@ LIST_ARM9="                 \
       mv88f6281gtw_ge         \
       mx1ads                  \
       mx1fs2                  \
+       mx27ads                 \
       netstar                 \
       nhk8815                 \
       nhk8815_onenand         \
Makefile +3 -0
index 9764cea..4f2dcef 100644
@@ -2965,6 +2965,9 @@ davinci_dm365evm_config : unconfig
 imx27lite_config:      unconfig
       @$(MKCONFIG) $(@:_config=) arm arm926ejs imx27lite logicpd mx27
 
+mx27ads_config :       unconfig
+       @$(MKCONFIG) $(@:_config=) arm arm926ejs mx27ads freescale mx27
+
 lpd7a400_config \
 lpd7a404_config:       unconfig
       @$(MKCONFIG) $(@:_config=) arm lh7a40x lpd7a40x
board/freescale/mx27ads/Makefile new file +51 -0
new file mode 100644
index 0000000..d142a9e
@@ -0,0 +1,51 @@
+#
+# (C) Copyright 2000-2004
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# 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  := mx27ads.o
+SOBJS  := lowlevel_init.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+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
+
+#########################################################################
+
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
+
board/freescale/mx27ads/config.mk new file +1 -0
new file mode 100644
index 0000000..a2e7768
@@ -0,0 +1 @@
+TEXT_BASE = 0xA7F00000
board/freescale/mx27ads/lowlevel_init.S new file +45 -0
new file mode 100644
index 0000000..dc62a93
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2008, Guennadi Liakhovetski <[email protected]>
+ *
+ * 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
+ */
+
+/*
+ * For clock initialization, see chapter 3 of the "MCIMX27 Multimedia
+ * Applications Processor Reference Manual, Rev. 0.2".
+ *
+ */
+
+#include <config.h>
+#include <asm/macro.h>
+#include <asm/arch/imx-regs.h>
+#include <asm/arch/asm-offsets.h>
+
+.macro sdram_init
+       /*
+        * DDR on CSD0
+        */
+       write32 0xD8001010, 0x00000008
+       write32 0x10027828, 0x55555555
+       write32 0x10027830, 0x55555555
+       write32 0x10027834, 0x55555555
+       write32 0x10027838, 0x00005005
+       write32 0x1002783C, 0x15555555
+       write32 0xD8001010, 0x00000004
+       write32 0xD8001004, 0x006ac73a
+       write32 0xD8001000, 0x92100000
+       write32 0xA0000F00, 0x00000000
+       write32 0xD8001000, 0xA2100000

board/freescale/mx27ads/lowlevel_init.S line 55

Quoted 10 lines
board/freescale/mx27ads/lowlevel_init.S new file +10 -0
+       write32 0xA0000F00, 0x00000000
+       write32 0xA0000F00, 0x00000000
+       write32 0xA0000F00, 0x00000000
+       write32 0xA0000F00, 0x00000000
+       write32 0xD8001000, 0xA2200000
+       write32 0xA0000F00, 0x00000000
+       write32 0xA0000F00, 0x00000000
+       write32 0xA0000F00, 0x00000000
+       write32 0xA0000F00, 0x00000000
+       write32 0xD8001000, 0xb2100000

+ ldr r0, =0xA0000033

board/freescale/mx27ads/lowlevel_init.S line 62

Quoted 6 lines
board/freescale/mx27ads/lowlevel_init.S new file +6 -0
+       mov             r1, #0xda
+       strb            r1, [r0]
+       ldr             r0, =0xA1000000
+       mov             r1, #0xff
+       strb            r1, [r0]
+       write32 0xD8001000, 0x82226080

Please use the friendly register definition.

Quoted 1 line

+.endm

Quoted 27 lines
board/freescale/mx27ads/lowlevel_init.S new file +20 -0
+
+.globl lowlevel_init
+lowlevel_init:
+
+       mov     r10, lr
+
+       /* ahb lite ip interface */
+       write32 AIPI1_PSR0, 0x20040304
+       write32 AIPI1_PSR1, 0xDFFBFCFB
+       write32 AIPI2_PSR0, 0x00000000
+       write32 AIPI2_PSR1, 0xFFFFFFFF
+
+       /* disable mpll/spll */
+       ldr r0, =CSCR
+       ldr r1, [r0]
+       bic r1, r1, #0x03
+       str r1, [r0]
+
+       /*
+        * pll clock initialization - see section 3.4.3 of the i.MX27

manual

board/freescale/mx27ads/lowlevel_init.S new file +6 -0
+        *
+        * FIXME: Using the 399*2 MHz values from table 3-8 doens't work
+        *        with 1.2 V core voltage! Find out if this is
+        *        documented somewhere.
+        */
+       write32 MPCTL0, 0x1EF15D5       /* MPLL = 199.5*2 MHz
Quoted 4 lines

*/
+ write32 SPCTL0, 0x043A1C09 /* SPLL = FIXME (needs review)
*/

I will check the setting in another mail.

Quoted 7 lines
board/freescale/mx27ads/lowlevel_init.S new file +6 -0
+
+       /*
+        * ARM clock = (399 MHz / 2) / (ARM divider = 1) = 200 MHz
+        * AHB clock = (399 MHz / 3) / (AHB divider = 2) = 66.5 MHz
+        * System clock (HCLK) = 133 MHz
+        */

board/freescale/mx27ads/lowlevel_init.S line 106

Quoted 10 lines
board/freescale/mx27ads/lowlevel_init.S new file +10 -0
+       write32 CSCR, (0x33F08107 | CSCR_MPLL_RESTART | CSCR_SPLL_RESTART)
+
+       /* add some delay here */
+       mov r1, #0x1000
+1:     subs r1, r1, #0x1
+       bne 1b
+
+       /* clock gating enable */
+       write32 0x10027818, 0x00050f08
+

ditto

Quoted 8 lines
board/freescale/mx27ads/lowlevel_init.S new file +4 -0
+       /* peripheral clock divider */
+       write32 PCDR0, 0x120470C3       /* FIXME
 */
+       write32 PCDR1, 0x03030303       /* PERDIV1=08 @133 MHz
 */
+                                       /* PERDIV1=04 @266 MHz
 */

board/freescale/mx27ads/lowlevel_init.S line 120

Quoted 10 lines
board/freescale/mx27ads/lowlevel_init.S new file +10 -0
+
+       /* Configure PCCR0 and PCCR1*/
+       write32 PCCR0, 0xFFFFFFFF
+       write32 PCCR1, 0xFFFFFFFC
+
+       /* skip sdram initialization if we run from ram */
+       cmp     pc, #0xa0000000
+       bls     1f
+       cmp     pc, #0xc0000000
+       bhi     1f

Please use the definitions of ddr area.

Quoted 52 lines
board/freescale/mx27ads/lowlevel_init.S new file +7 -0
+
+       mov     pc,r10
+1:
+       sdram_init
+
+       mov     pc,r10
+
board/freescale/mx27ads/mx27ads.c new file +34 -0
new file mode 100644
index 0000000..4def923
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2007 Sascha Hauer, Pengutronix
+ * Copyright (C) 2008,2009 Eric Jarrige <[email protected]>
+ * Copyright (C) 2009 Ilya Yanok <[email protected]>
+ * Copyright (C) 2009 Alan Carvalho de Assis <[email protected]>
+ *
+ * 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 <asm/io.h>
+#include <asm/macro.h>
+#include <asm/arch/imx-regs.h>
+
+# define __REG(x)      (*((volatile u32 *)(x)))
+
+#define IMX_CS4_BASE   0xD4000000
+#define CS4U __REG(IMX_WEIM_BASE + 0x40) /* Chip Select 4 Upper Register
 */
+#define CS4L __REG(IMX_WEIM_BASE + 0x44) /* Chip Select 4 Lower Register
 */
+#define CS4A __REG(IMX_WEIM_BASE + 0x48) /* Chip Select 4 Addition

Register */

board/freescale/mx27ads/mx27ads.c line 43

Quoted 9 lines
board/freescale/mx27ads/mx27ads.c new file +9 -0
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int board_init(void)
+{
+       struct gpio_regs *regs = (struct gpio_regs *)IMX_GPIO_BASE;
+
+       gd->bd->bi_arch_number = MACH_TYPE_MX27ADS;
+       gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;

move bi_boot_params to dram_init.

Quoted 225 lines
board/freescale/mx27ads/mx27ads.c new file +7 -0
+
+#ifdef CONFIG_MXC_UART
+       mx27_uart_init_pins();
+#endif
+#ifdef CONFIG_FEC_MXC
+       mx27_fec_init_pins();
+       imx_gpio_mode((GPIO_PORTC | GPIO_OUT | GPIO_PUEN | GPIO_GPIO |

31));

board/freescale/mx27ads/mx27ads.c new file +27 -0
+       writel(readl(&regs->port[PORTC].dr) | (1 << 31),
+                               &regs->port[PORTC].dr);
+
+       /* Configure CPLD on CS4 */
+       CS4U = 0x0000DCF6;
+       CS4L = 0x444A4541;
+       CS4A = 0x44443302;
+
+       /* Select FEC data through data path */
+       writew(0x0020, IMX_CS4_BASE + 0x10);
+
+       /* Enable CPLD FEC data path */
+       writew(0x0010, IMX_CS4_BASE + 0x14);
+#endif
+#ifdef CONFIG_MXC_MMC
+       mx27_sd2_init_pins();
+#endif
+
+       return 0;
+}
+
+int dram_init(void)
+{
+
+#if CONFIG_NR_DRAM_BANKS > 0
+       gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
+       gd->bd->bi_dram[0].size = get_ram_size((volatile void

*)PHYS_SDRAM_1,

board/freescale/mx27ads/mx27ads.c new file +5 -0
+                       PHYS_SDRAM_1_SIZE);
+#endif
+#if CONFIG_NR_DRAM_BANKS > 1
+       gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
+       gd->bd->bi_dram[1].size = get_ram_size((volatile void

*)PHYS_SDRAM_2,

board/freescale/mx27ads/mx27ads.c new file +11 -0
+                       PHYS_SDRAM_2_SIZE);
+#endif
+
+       return 0;
+}
+
+int checkboard(void)
+{
+       printf("Freescale i.MX27ADS\n");
+       return 0;
+}
board/freescale/mx27ads/u-boot.lds new file +56 -0
new file mode 100644
index 0000000..f66f20e
@@ -0,0 +1,56 @@
+/*
+ * (C) Copyright 2007
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ *
+ * 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
+ */
+
+OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
+OUTPUT_ARCH(arm)
+ENTRY(_start)
+SECTIONS
+{
+       . = 0x00000000;
+
+       . = ALIGN(4);
+       .text      :
+       {
+               cpu/arm926ejs/start.o   (.text)
+               *(.text)
+       }
+
+       . = ALIGN(4);
+       .rodata : { *(.rodata) }
+
+       . = ALIGN(4);
+       .data : { *(.data) }
+
+       . = ALIGN(4);
+       .got : { *(.got) }
+
+       __u_boot_cmd_start = .;
+       .u_boot_cmd : { *(.u_boot_cmd) }
+       __u_boot_cmd_end = .;
+
+       . = ALIGN(4);
+       __bss_start = .;
+       .bss : { *(.bss) }
+       _end = .;
+}
+
include/configs/mx27ads.h new file +34 -0
new file mode 100644
index 0000000..3360d76
@@ -0,0 +1,202 @@
+/*
+ * Copyright (C) 2009 Ilya Yanok <[email protected]>
+ *
+ * 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_IMX27ADS
+#define CONFIG_MX27_CLK32      32768           /* OSC32K frequency */
+#define CONFIG_SYS_HZ          1000
+
+#define CONFIG_DISPLAY_CPUINFO
+
+#define CONFIG_CMDLINE_TAG             1       /* enable passing of ATAGs

*/

include/configs/mx27ads.h new file +14 -0
+#define CONFIG_SETUP_MEMORY_TAGS       1
+#define CONFIG_INITRD_TAG              1
+
+/*=============*/
+/* Memory Info */
+/*=============*/
+/* malloc() len */
+#define CONFIG_SYS_MALLOC_LEN          (0x10000 + 256*1024)
+/* reserved for initial data */
+#define CONFIG_SYS_GBL_DATA_SIZE       128
+/* memtest start address */
+#define CONFIG_SYS_MEMTEST_START       0xA0000000
+#define CONFIG_SYS_MEMTEST_END         0xA1000000      /* 16MB RAM test */
+#define CONFIG_NR_DRAM_BANKS   1               /* we have 1 bank of DRAM

*/

include/configs/mx27ads.h new file +11 -0
+#define CONFIG_STACKSIZE       (256*1024)      /* regular stack */
+#define PHYS_SDRAM_1           0xA0000000      /* DDR Start */
+#define PHYS_SDRAM_1_SIZE      0x08000000      /* DDR size 128MB */
+
+/*====================*/
+/* Serial Driver info */
+/*====================*/
+#define CONFIG_MXC_UART
+#define CONFIG_SYS_MX27_UART1
+#define CONFIG_CONS_INDEX      1               /* use UART0 for console */
+#define CONFIG_BAUDRATE                115200          /* Default baud

rate */
+#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200
}

include/configs/mx27ads.h new file +13 -0
+
+/*=====================*/
+/* Flash & Environment */
+/*=====================*/
+
+#define CONFIG_ENV_IS_IN_FLASH
+#define CONFIG_FLASH_CFI_DRIVER
+#define CONFIG_FLASH_CFI_MTD
+#define CONFIG_SYS_FLASH_CFI
+
+/* Use hardware sector protection */
+#define CONFIG_SYS_FLASH_PROTECTION            1
+#define CONFIG_SYS_MAX_FLASH_BANKS     1       /* max number of flash

banks */
+#define CONFIG_SYS_FLASH_SECT_SZ 0x2000 /* 8KB sect size Intel
Flash */

include/configs/mx27ads.h new file +12 -0
+/* end of flash */
+#define CONFIG_ENV_OFFSET              (PHYS_FLASH_SIZE - 0x20000)
+/* CS2 Base address */
+#define PHYS_FLASH_1                   0xc0000000
+/* Flash Base for U-Boot */
+#define CONFIG_SYS_FLASH_BASE          PHYS_FLASH_1
+/* Flash size 32MB */
+#define PHYS_FLASH_SIZE                        0x2000000
+#define CONFIG_SYS_MAX_FLASH_SECT      (PHYS_FLASH_SIZE / \
+               CONFIG_SYS_FLASH_SECT_SZ)
+#define CONFIG_SYS_MONITOR_BASE                CONFIG_SYS_FLASH_BASE
+#define CONFIG_SYS_MONITOR_LEN         0x40000         /* Reserve 256KiB

*/
+#define CONFIG_ENV_SECT_SIZE 0x10000 /* Env sector Size
*/

include/configs/mx27ads.h new file +3 -0
+#define CONFIG_ENV_SIZE                CONFIG_ENV_SECT_SIZE
+/* Address and size of Redundant Environment Sector    */
+#define CONFIG_ENV_OFFSET_REDUND       (CONFIG_ENV_OFFSET +

CONFIG_ENV_SIZE)

include/configs/mx27ads.h new file +3 -0
+#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
+
+/*

include/configs/mx27ads.h line 103

Quoted 10 lines
include/configs/mx27ads.h new file +10 -0
+ * Ethernet
+ */
+#define CONFIG_FEC_MXC
+#define CONFIG_FEC_MXC_PHYADDR 0x1f
+#define CONFIG_MII
+#define CONFIG_NET_MULTI
+
+/*#define CONFIG_DRIVER_CS8900    1
+#define CS8900_BASE             0xD4020300
+#define CS8900_BUS16            1*/

Remove commented code.

Quoted 110 lines
include/configs/mx27ads.h new file +29 -0
+#define CONFIG_ETHADDR 02:80:ad:20:31:e8
+
+/*
+ * NAND
+ */
+#define CONFIG_NAND_MXC
+#define CONFIG_MXC_NAND_REGS_BASE      0xd8000000
+#define CONFIG_SYS_MAX_NAND_DEVICE     1
+#define CONFIG_SYS_NAND_BASE           0xd8000000
+#define CONFIG_JFFS2_NAND
+#define CONFIG_MXC_NAND_HWECC
+
+/*
+ * SD/MMC
+ */
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_MXC_MMC
+#define CONFIG_MXC_MCI_REGS_BASE       0x10014000
+#define CONFIG_DOS_PARTITION
+
+/*
+ * MTD partitions
+ */
+#define CONFIG_MTD_DEVICE
+#define CONFIG_CMD_MTDPARTS
+#define MTDIDS_DEFAULT         "nor0=physmap-flash.0"
+#define MTDPARTS_DEFAULT       \
+

"mtdparts=physmap-flash.0:256k(U-Boot),3968k(kernel),28416k(user),64k(env1),64k(env2)"

include/configs/mx27ads.h new file +5 -0
+
+/*==============================*/
+/* U-Boot general configuration */
+/*==============================*/
+#define CONFIG_BOOTFILE                "uImage"        /* Boot file name

*/

include/configs/mx27ads.h new file +31 -0
+#define CONFIG_SYS_PROMPT      "=> "   /* Monitor Command Prompt */
+#define CONFIG_SYS_CBSIZE      1024    /* Console I/O Buffer Size  */
+/* Print buffer sz */
+#define CONFIG_SYS_PBSIZE      (CONFIG_SYS_CBSIZE + \
+               sizeof(CONFIG_SYS_PROMPT) + 16)
+#define CONFIG_SYS_MAXARGS     16      /* max number of command args */
+/* Boot Argument Buffer Size */
+#define CONFIG_SYS_BARGSIZE    CONFIG_SYS_CBSIZE
+#define CONFIG_CMDLINE_EDITING
+#define CONFIG_SYS_LONGHELP
+
+/*=================*/
+/* U-Boot commands */
+/*=================*/
+#include <config_cmd_default.h>
+#define CONFIG_CMD_ASKENV
+#define CONFIG_CMD_BDI
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_DIAG
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_JFFS2
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_NAND
+#define CONFIG_CMD_NET
+#define CONFIG_CMD_NFS
+#define CONFIG_CMD_PING
+
+#define CONFIG_BOOTDELAY       5
+
+#define CONFIG_LOADADDR                0xa0800000      /* loadaddr env var

*/

include/configs/mx27ads.h new file +34 -1
+#define CONFIG_SYS_LOAD_ADDR           CONFIG_LOADADDR
+
+#define xstr(s)        str(s)
+#define str(s) #s
+
+#define        CONFIG_EXTRA_ENV_SETTINGS
    \
+       "netdev=eth0\0"                                                 \
+       "nfsargs=setenv bootargs root=/dev/nfs rw "                     \
+               "nfsroot=${serverip}:${rootpath}\0"                     \
+       "ramargs=setenv bootargs root=/dev/ram rw\0"                    \
+       "addip=setenv bootargs ${bootargs} "                            \
+               "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}"      \
+               ":${hostname}:${netdev}:off panic=1\0"                  \
+       "addtty=setenv bootargs ${bootargs}"                            \
+               " console=ttymxc0,${baudrate}\0"                        \
+       "addmtd=setenv bootargs ${bootargs} ${mtdparts}\0"              \
+       "addmisc=setenv bootargs ${bootargs}\0"                         \
+       "u-boot=imx27/u-boot.bin\0"                                     \
+       "kernel_addr_r=a0800000\0"                                      \
+       "hostname=imx27\0"                                              \
+       "bootfile=imx27/uImage\0"                                       \
+       "rootpath=/opt/eldk-4.2-arm/arm\0"                              \
+       "net_nfs=tftp ${kernel_addr_r} ${bootfile};"                    \
+               "run nfsargs addip addtty addmtd addmisc;"              \
+               "bootm\0"                                               \
+       "bootcmd=run net_nfs\0"                                 \
+       "load=tftp ${loadaddr} ${u-boot}\0"                             \
+       "update=protect off " xstr(CONFIG_SYS_MONITOR_BASE)             \
+               " +${filesize};era " xstr(CONFIG_SYS_MONITOR_BASE)      \
+               " +${filesize};cp.b ${fileaddr} "                       \
+               xstr(CONFIG_SYS_MONITOR_BASE) " ${filesize}\0"          \
+       "upd=run load update\0"                                         \
+
+#endif /* __CONFIG_H */
--

1.6.0.4
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#2 lore raw

Hi Fred,

Thank you for your fast reply, please see my comments below:

Quoted 30 lines · Fred Fan

Dear Alan Carvalho de Assis,

2009/9/16 Alan Carvalho de Assis <[email protected]>

Quoted 14 lines
board/freescale/mx27ads/lowlevel_init.S new file +14 -0
+       /*
+        * DDR on CSD0
+        */
+       write32 0xD8001010, 0x00000008
+       write32 0x10027828, 0x55555555
+       write32 0x10027830, 0x55555555
+       write32 0x10027834, 0x55555555
+       write32 0x10027838, 0x00005005
+       write32 0x1002783C, 0x15555555
+       write32 0xD8001010, 0x00000004
+       write32 0xD8001004, 0x006ac73a
+       write32 0xD8001000, 0x92100000
+       write32 0xA0000F00, 0x00000000
+       write32 0xD8001000, 0xA2100000

board/freescale/mx27ads/lowlevel_init.S line 55

Quoted 10 lines
board/freescale/mx27ads/lowlevel_init.S new file +10 -0
+       write32 0xA0000F00, 0x00000000
+       write32 0xA0000F00, 0x00000000
+       write32 0xA0000F00, 0x00000000
+       write32 0xA0000F00, 0x00000000
+       write32 0xD8001000, 0xA2200000
+       write32 0xA0000F00, 0x00000000
+       write32 0xA0000F00, 0x00000000
+       write32 0xA0000F00, 0x00000000
+       write32 0xA0000F00, 0x00000000
+       write32 0xD8001000, 0xb2100000

+ ldr r0, =0xA0000033

Quoted 8 lines

board/freescale/mx27ads/lowlevel_init.S line 62

Quoted 6 lines
board/freescale/mx27ads/lowlevel_init.S new file +6 -0
+       mov             r1, #0xda
+       strb            r1, [r0]
+       ldr             r0, =0xA1000000
+       mov             r1, #0xff
+       strb            r1, [r0]
+       write32 0xD8001000, 0x82226080

Please use the friendly register definition.

I based on U-Boot-v2 start-up code.
Where should I place these registers definition? (could be in include/asm-arm/arch-mx27/imx-regs.h ?)

Quoted 10 lines
Quoted 10 lines
board/freescale/mx27ads/lowlevel_init.S new file +6 -0
+        *
+        * FIXME: Using the 399*2 MHz values from table 3-8 doens't work
+        *        with 1.2 V core voltage! Find out if this is
+        *        documented somewhere.
+        */
+       write32 MPCTL0, 0x1EF15D5       /* MPLL = 199.5*2 MHz

*/
+ write32 SPCTL0, 0x043A1C09 /* SPLL = FIXME (needs review)
*/

Quoted 2 lines

I will check the setting in another mail.

Sure, I will wait for it.

Quoted 6 lines

board/freescale/mx27ads/lowlevel_init.S line 106

Quoted 4 lines
board/freescale/mx27ads/lowlevel_init.S new file +3 -0
+       /* clock gating enable */
+       write32 0x10027818, 0x00050f08
+

ditto

ACK

Quoted 9 lines

board/freescale/mx27ads/lowlevel_init.S line 120

Quoted 7 lines
board/freescale/mx27ads/lowlevel_init.S new file +6 -0
+
+       /* skip sdram initialization if we run from ram */
+       cmp     pc, #0xa0000000
+       bls     1f
+       cmp     pc, #0xc0000000
+       bhi     1f

Please use the definitions of ddr area.

Ok

Quoted 9 lines

board/freescale/mx27ads/mx27ads.c line 43

Quoted 7 lines
board/freescale/mx27ads/mx27ads.c new file +6 -0
+int board_init(void)
+{
+       struct gpio_regs *regs = (struct gpio_regs *)IMX_GPIO_BASE;
+
+       gd->bd->bi_arch_number = MACH_TYPE_MX27ADS;
+       gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;

move bi_boot_params to dram_init.

Ok

Quoted 5 lines
Quoted 5 lines
include/configs/mx27ads.h new file +5 -0
+/*
+ * Ethernet
+ */
+#define CONFIG_FEC_MXC
+#define CONFIG_FEC_MXC_PHYADDR 0x1f
Quoted 9 lines

include/configs/mx27ads.h line 103

Quoted 7 lines
include/configs/mx27ads.h new file +6 -0
+#define CONFIG_MII
+#define CONFIG_NET_MULTI
+
+/*#define CONFIG_DRIVER_CS8900    1
+#define CS8900_BASE             0xD4020300
+#define CS8900_BUS16            1*/

Remove commented code.

I will active this commented lines, I think it just need another ETHADDR to work.

Quoted 1 line
Quoted 1 line

+#define CONFIG_ETHADDR 02:80:ad:20:31:e8

Thank you Fred, I am glad to see more Freescale guys helping open-source projects.

Best Regards,

Alan

#3 lore raw
In reply to Alan Carvalho de Assis

Dear Alan Carvalho de Assis,

Quoted 5 lines · In message <[email protected]> you…

This patch adds support to iMX27ADS development board. This board has 128MB RAM, 32MB NOR Flash and 128MB NAND Flash. Currently only booting from NOR is supported.

I will try and mention only the issues not yet covered.

...

Makefile davinci_dm365evm_config : unconfig · line 2972

Quoted 11 lines
Makefile +3 -0
@@ -2965,6 +2965,9 @@ davinci_dm365evm_config :	unconfig
 imx27lite_config:	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm926ejs imx27lite logicpd mx27
 
+mx27ads_config :	unconfig
+	@$(MKCONFIG) $(@:_config=) arm arm926ejs mx27ads freescale mx27
+
 lpd7a400_config \
 lpd7a404_config:	unconfig

Please keep list sorted.

Quoted 5 lines
board/freescale/mx27ads/Makefile new file +0 -0
new file mode 100644
index 0000000..d142a9e

...

board/freescale/mx27ads/Makefile

Quoted 2 lines
board/freescale/mx27ads/Makefile new file +2 -0
+#########################################################################
+

Please don;t add trailing empty lines.

Quoted 6 lines
board/freescale/mx27ads/config.mk new file +0 -0
new file mode 100644
index 0000000..a2e7768

...

Quoted 5 lines

+/*
+ * For clock initialization, see chapter 3 of the "MCIMX27 Multimedia
+ * Applications Processor Reference Manual, Rev. 0.2".
+ *
+ */

Please don't add random empty comment lines.

...

Quoted 9 lines
board/freescale/mx27ads/config.mk new file +9 -0
+	write32 0xA0000F00, 0x00000000
+	write32 0xD8001000, 0xb2100000
+	ldr		r0, =0xA0000033
+	mov		r1, #0xda
+	strb		r1, [r0]
+	ldr		r0, =0xA1000000
+	mov		r1, #0xff
+	strb		r1, [r0]
+	write32 0xD8001000, 0x82226080

...

Quoted 1 line
board/freescale/mx27ads/config.mk new file +1 -0
+	mov	r10, lr

...

board/freescale/mx27ads/config.mk

Quoted 4 lines
board/freescale/mx27ads/config.mk new file +4 -0
+	ldr r0, =CSCR
+	ldr r1, [r0]
+	bic r1, r1, #0x03
+	str r1, [r0]

Please use a consistent style for indentation. I suggest you use the insn name followed by a single TAB character followed by args.

Quoted 2 lines

+++ b/board/freescale/mx27ads/mx27ads.c

board/freescale/mx27ads/config.mk new file +0 -0
@@ -0,0 +1,93 @@

...
...

board/freescale/mx27ads/config.mk

Quoted 6 lines
board/freescale/mx27ads/config.mk new file +6 -0
+# define __REG(x)      (*((volatile u32 *)(x)))
+
+#define IMX_CS4_BASE   0xD4000000
+#define CS4U __REG(IMX_WEIM_BASE + 0x40) /* Chip Select 4 Upper Register    */
+#define CS4L __REG(IMX_WEIM_BASE + 0x44) /* Chip Select 4 Lower Register    */
+#define CS4A __REG(IMX_WEIM_BASE + 0x48) /* Chip Select 4 Addition Register */

Please use proper I/O accessors. Direct register accesses like here are forbidden. Also, you probably want to define a C structure describing the register map.

...

board/freescale/mx27ads/config.mk

Quoted 4 lines
board/freescale/mx27ads/config.mk new file +4 -0
+	/* Configure CPLD on CS4 */
+	CS4U = 0x0000DCF6;
+	CS4L = 0x444A4541;
+	CS4A = 0x44443302;

Please never use suchmagic numbers in the code. Provide some #defines for these, together with sufficient comments to explain what the numbers mean.

board/freescale/mx27ads/config.mk

Quoted 5 lines
board/freescale/mx27ads/config.mk new file +5 -0
+	/* Select FEC data through data path */
+	writew(0x0020, IMX_CS4_BASE + 0x10);
+
+	/* Enable CPLD FEC data path */
+	writew(0x0010, IMX_CS4_BASE + 0x14);

Please use C structs for the register mapping; do not use base address plus offsets.

board/freescale/mx27ads/config.mk

Quoted 3 lines
board/freescale/mx27ads/config.mk new file +3 -0
+int dram_init(void)
+{
+

No empty line here.

board/freescale/mx27ads/config.mk

Quoted 5 lines
board/freescale/mx27ads/config.mk new file +5 -0
+#if CONFIG_NR_DRAM_BANKS > 0
+	gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
+	gd->bd->bi_dram[0].size = get_ram_size((volatile void *)PHYS_SDRAM_1,
+			PHYS_SDRAM_1_SIZE);
+#endif

Um... is CONFIG_NR_DRAM_BANKS <= 0 any configuration that is supposed to work?

board/freescale/mx27ads/config.mk

Quoted 7 lines
board/freescale/mx27ads/config.mk new file +7 -0
+#if CONFIG_NR_DRAM_BANKS > 1
+	gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
+	gd->bd->bi_dram[1].size = get_ram_size((volatile void *)PHYS_SDRAM_2,
+			PHYS_SDRAM_2_SIZE);
+#endif
+
+	return 0;

You unconditionally return OK< even in case of memory errors? This seems wrong to me.

board/freescale/mx27ads/u-boot.lds

Quoted 6 lines
board/freescale/mx27ads/u-boot.lds new file +0 -0
new file mode 100644
index 0000000..f66f20e

Does this board need a private linke rscript? Why cannot you use the common script in cpu/arm926ejs/u-boot.lds ?

Quoted 5 lines
include/configs/mx27ads.h new file +0 -0
new file mode 100644
index 0000000..3360d76

...

include/configs/mx27ads.h line 47

Quoted 3 lines
include/configs/mx27ads.h new file +3 -0
+/* memtest start address */
+#define CONFIG_SYS_MEMTEST_START	0xA0000000
+#define CONFIG_SYS_MEMTEST_END		0xA1000000	/* 16MB RAM test */

Did you ever test this? Overwriting low memory where exception vectors and such is located is probably a bad idea.

...

Quoted 7 lines
include/configs/mx27ads.h new file +7 -0
+/* Use hardware sector protection */
+#define CONFIG_SYS_FLASH_PROTECTION		1
+#define CONFIG_SYS_MAX_FLASH_BANKS	1	/* max number of flash banks */
+#define CONFIG_SYS_FLASH_SECT_SZ	0x2000	/* 8KB sect size Intel Flash */
+/* end of flash */
+#define CONFIG_ENV_OFFSET		(PHYS_FLASH_SIZE - 0x20000)
+/* CS2 Base address */

include/configs/mx27ads.h line 87

Quoted 10 lines
include/configs/mx27ads.h new file +10 -0
+#define PHYS_FLASH_1			0xc0000000
+/* Flash Base for U-Boot */
+#define CONFIG_SYS_FLASH_BASE		PHYS_FLASH_1
+/* Flash size 32MB */
+#define PHYS_FLASH_SIZE			0x2000000
+#define CONFIG_SYS_MAX_FLASH_SECT	(PHYS_FLASH_SIZE / \
+		CONFIG_SYS_FLASH_SECT_SZ)
+#define CONFIG_SYS_MONITOR_BASE		CONFIG_SYS_FLASH_BASE
+#define CONFIG_SYS_MONITOR_LEN		0x40000		/* Reserve 256KiB */
+#define CONFIG_ENV_SECT_SIZE		0x10000		/* Env sector Size */

This looks strange to me. Above you state "8KB sect size", but here you set a sector size of 64 kB ?

include/configs/mx27ads.h line 104

Quoted 4 lines
include/configs/mx27ads.h new file +4 -0
+/*#define CONFIG_DRIVER_CS8900    1
+#define CS8900_BASE             0xD4020300
+#define CS8900_BUS16            1*/
+#define CONFIG_ETHADDR	02:80:ad:20:31:e8

Drop that. We don't allow setting a fixed MAC address for all boards.

include/configs/mx27ads.h line 132

Quoted 2 lines
include/configs/mx27ads.h new file +2 -0
+#define MTDPARTS_DEFAULT	\
+	"mtdparts=physmap-flash.0:256k(U-Boot),3968k(kernel),28416k(user),64k(env1),64k(env2)"

Line too long (please check all files).

Best regards,

Wolfgang Denk

Signature · 6 lines
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
One essential to success is that you desire be an all-obsessing  one,
your thoughts and aims be co-ordinated, and your energy be concentra-
ted and applied without letup.