s5p6442: smdk6442: support onenand_ipl compile
authorJoonyoung Shim <jy0922.shim@samsung.com>
Wed, 13 Jan 2010 11:15:52 +0000 (20:15 +0900)
committerJoonyoung Shim <jy0922.shim@samsung.com>
Wed, 13 Jan 2010 11:15:52 +0000 (20:15 +0900)
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Makefile
board/samsung/smdk6442/mem_setup.S
cpu/arm1176/start.S
onenand_ipl/board/samsung/smdk6442/Makefile [new file with mode: 0644]
onenand_ipl/board/samsung/smdk6442/u-boot-onenand.lds [new file with mode: 0644]
onenand_ipl/samsung_read.c

index 5c0b984..304232f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3296,7 +3296,10 @@ smdk6400_config  :       unconfig
        @echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk
 
 smdk6442_config:       unconfig
+       @echo "#define CONFIG_ONENAND_U_BOOT" > $(obj)include/config.h
        @$(MKCONFIG) $(@:_config=) arm arm1176 smdk6442 samsung s5p64xx
+       @echo "CONFIG_ONENAND_U_BOOT = y" >> $(obj)include/config.mk
+       @echo "ONENAND_BIN = $(obj)onenand_ipl/onenand-ipl-16k.bin" >> $(obj)include/config.mk
 
 #========================================================================
 # i386
index 741d894..92a6886 100644 (file)
@@ -28,7 +28,7 @@
 
        .globl mem_ctrl_asm_init
 mem_ctrl_asm_init:
-       ldr     r6, =S5P5442_DMC_BASE                   @ 0xE6000000
+       ldr     r6, =S5P6442_DMC_BASE                   @ 0xE6000000
 
        /* DLL parameter setting */
        ldr     r1, =0x00141408
index cdb2c93..4c85c3f 100644 (file)
@@ -53,7 +53,7 @@
 
 .globl _start
 _start: b      reset
-#ifndef CONFIG_NAND_SPL
+#if !defined(CONFIG_NAND_SPL) && !defined(CONFIG_ONENAND_IPL)
        ldr     pc, _undefined_instruction
        ldr     pc, _software_interrupt
        ldr     pc, _prefetch_abort
@@ -156,7 +156,7 @@ cpu_init_crit:
         * When booting from NAND - it has definitely been a reset, so, no need
         * to flush caches and disable the MMU
         */
-#ifndef CONFIG_NAND_SPL
+#if !defined(CONFIG_NAND_SPL) && !defined(CONFIG_ONENAND_IPL)
        /*
         * flush v4 I/D caches
         */
@@ -264,8 +264,13 @@ clbss_l:
 #ifndef CONFIG_NAND_SPL
        ldr     pc, _start_armboot
 
+#ifdef CONFIG_ONENAND_IPL
+_start_armboot:
+       .word start_oneboot
+#else
 _start_armboot:
        .word start_armboot
+#endif
 #else
        b       nand_boot
 /*     .word nand_boot*/
@@ -276,7 +281,7 @@ _mmu_table_base:
        .word mmu_table
 #endif
 
-#ifndef CONFIG_NAND_SPL
+#if !defined(CONFIG_NAND_SPL) && !defined(CONFIG_ONENAND_IPL)
 /*
  * we assume that cache operation is done before. (eg. cleanup_before_linux())
  * actually, we don't need to do anything about cache if not use d-cache in
diff --git a/onenand_ipl/board/samsung/smdk6442/Makefile b/onenand_ipl/board/samsung/smdk6442/Makefile
new file mode 100644 (file)
index 0000000..02d8ef1
--- /dev/null
@@ -0,0 +1,95 @@
+#
+#  Samsung SMDK6442(S5P6442) board OneNAND IPL
+#
+#  Copyright (C) 2009 Samsung Electronics
+#  Minkyu Kang <mk7.kang@samsung.com>
+#
+# 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.
+#
+
+include $(TOPDIR)/config.mk
+TEXT_BASE = 0xD0021800
+TEXT_BASE16K = 0xD0025800
+
+LDSCRIPT= $(TOPDIR)/onenand_ipl/board/$(BOARDDIR)/u-boot-onenand.lds
+LDFLAGS        = -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS)
+AFLAGS += -DCONFIG_ONENAND_IPL -g
+CFLAGS += -DCONFIG_ONENAND_IPL -g
+OBJCFLAGS += --gap-fill=0x00
+
+SOBJS  := lowlevel_init.o mem_setup.o
+SOBJS  += start.o
+COBJS  += onenand_read.o samsung_read.o
+COBJS  += onenand_boot.o
+
+SRCS   := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
+OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS))
+__OBJS := $(SOBJS) $(COBJS)
+LNDIR  := $(OBJTREE)/onenand_ipl/board/$(BOARDDIR)
+
+onenandobj     := $(OBJTREE)/onenand_ipl/
+
+ALL    = $(onenandobj)onenand-ipl $(onenandobj)onenand-ipl.bin $(onenandobj)onenand-ipl-16k.bin
+
+all:   $(obj).depend $(ALL)
+
+$(onenandobj)onenand-ipl-16k.bin:      $(onenandobj)onenand-ipl
+       $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(TEXT_BASE16K) -O binary $< $@
+
+$(onenandobj)onenand-ipl.bin:  $(onenandobj)onenand-ipl
+       $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
+
+$(onenandobj)onenand-ipl:      $(OBJS)
+       cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \
+               -Map $@.map -o $@
+
+# create symbolic links from common files
+
+# from cpu directory
+$(obj)start.S:
+       @rm -f $@
+       ln -s $(SRCTREE)/cpu/$(CPU)/start.S $@
+
+$(obj)mem_setup.S:
+       ln -sf $(SRCTREE)/board/$(BOARDDIR)/mem_setup.S $@
+
+$(obj)lowlevel_init.S:
+       ln -sf $(SRCTREE)/board/$(BOARDDIR)/lowlevel_init.S $@
+
+# from onenand_ipl directory
+$(obj)onenand_ipl.h:
+       @rm -f $@
+       ln -s $(SRCTREE)/onenand_ipl/onenand_ipl.h $@
+
+$(obj)onenand_boot.c:  $(obj)onenand_ipl.h
+       @rm -f $@
+       ln -s $(SRCTREE)/onenand_ipl/onenand_boot.c $@
+
+$(obj)onenand_read.c:  $(obj)onenand_ipl.h
+       @rm -f $@
+       ln -s $(SRCTREE)/onenand_ipl/onenand_read.c $@
+
+$(obj)samsung_read.c:  $(obj)onenand_ipl.h
+       @rm -f $@
+       ln -s $(SRCTREE)/onenand_ipl/samsung_read.c $@
+
+#########################################################################
+
+$(obj)%.o:     $(obj)%.S
+       $(CC) $(AFLAGS) -c -o $@ $<
+
+$(obj)%.o:     $(obj)$.c
+       $(CC) $(CFLAGS) -c -o $@ $<
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+clean:
+       rm onenand_boot.c onenand_read.c
+
+#########################################################################
diff --git a/onenand_ipl/board/samsung/smdk6442/u-boot-onenand.lds b/onenand_ipl/board/samsung/smdk6442/u-boot-onenand.lds
new file mode 100644 (file)
index 0000000..559f9f2
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * (C) Copyright 2005-2008 Samsung Electronics
+ * Kyungmin Park <kyungmin.park@samsung.com>
+ *
+ * Derived from X-loader
+ *
+ * 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      :
+       {
+         start.o       (.text)
+         *(.text)
+       }
+
+       . = ALIGN(4);
+       .rodata : { *(.rodata) }
+
+       . = ALIGN(4);
+       .data : { *(.data) }
+
+       . = ALIGN(4);
+       .got : { *(.got) }
+
+       . = ALIGN(4);
+       __bss_start = .;
+       .bss : { *(.bss) }
+       _end = .;
+}
index 16ab192..1bb70c8 100644 (file)
@@ -52,7 +52,8 @@ static int s5pc100_onenand_read_page(ulong block, ulong page,
 
 int onenand_board_init(int *page_is_4KiB, int *page)
 {
-       if ((readl(0xE0000000) & 0x00FFF000) == 0x00110000)
+       if (((readl(0xE0000000) & 0x00FFF000) == 0x00110000) ||
+                       ((readl(0xE0000000) & 0xFFFFF000) == 0x36442000))
                return ONENAND_USE_GENERIC;
 
        onenand_read_page = s5pc100_onenand_read_page;