From 5bdf244dd77ce68130772bedd90df930a8c5d200 Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Tue, 15 Jun 2010 15:22:48 +0900 Subject: [PATCH] mmc_ipl: initial commit Signed-off-by: Minkyu Kang --- Makefile | 23 +++- arch/arm/cpu/arm_cortexa8/start.S | 4 +- build.sh | 38 +++++-- mmc_ipl/board/samsung/universal/.gitignore | 2 + mmc_ipl/board/samsung/universal/Makefile | 125 +++++++++++++++++++++ mmc_ipl/board/samsung/universal/bl1.img | Bin 0 -> 4096 bytes mmc_ipl/board/samsung/universal/checksum.c | 146 +++++++++++++++++++++++++ mmc_ipl/board/samsung/universal/u-boot-mmc.lds | 53 +++++++++ mmc_ipl/board/samsung/universal/universal.c | 30 +++++ mmc_ipl/mmc.c | 40 +++++++ mmc_ipl/mmc_boot.c | 50 +++++++++ mmc_ipl/mmc_ipl.h | 29 +++++ 12 files changed, 526 insertions(+), 14 deletions(-) create mode 100644 mmc_ipl/board/samsung/universal/.gitignore create mode 100644 mmc_ipl/board/samsung/universal/Makefile create mode 100644 mmc_ipl/board/samsung/universal/bl1.img create mode 100644 mmc_ipl/board/samsung/universal/checksum.c create mode 100644 mmc_ipl/board/samsung/universal/u-boot-mmc.lds create mode 100644 mmc_ipl/board/samsung/universal/universal.c create mode 100644 mmc_ipl/mmc.c create mode 100644 mmc_ipl/mmc_boot.c create mode 100644 mmc_ipl/mmc_ipl.h diff --git a/Makefile b/Makefile index 7a65236..a007de1 100644 --- a/Makefile +++ b/Makefile @@ -282,6 +282,12 @@ U_BOOT_ONENAND = $(obj)u-boot-onenand.bin ONENAND_BIN ?= $(obj)onenand_ipl/onenand-ipl-2k.bin endif +ifeq ($(CONFIG_MMC_U_BOOT),y) +MMC_IPL = mmc_ipl +U_BOOT_MMC = $(obj)u-boot-mmc.bin +MMC_BIN ?= $(obj)mmc_ipl/mmc-ipl-16k.bin +endif + ifeq ($(CONFIG_RECOVERY_U_BOOT),y) RECOVERY_BLOCK = recovery U_BOOT_RECOVERY = $(obj)u-boot-recovery.bin @@ -296,7 +302,7 @@ __LIBS := $(subst $(obj),,$(LIBS)) $(subst $(obj),,$(LIBBOARD)) ######################################################################### # Always append ALL so that arch config.mk's can add custom ones -ALL += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map $(U_BOOT_NAND) $(U_BOOT_ONENAND) $(U_BOOT_RECOVERY) +ALL += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map $(U_BOOT_NAND) $(U_BOOT_ONENAND) $(U_BOOT_MMC) $(U_BOOT_RECOVERY) all: $(ALL) @@ -386,6 +392,12 @@ $(ONENAND_IPL): $(TIMESTAMP_FILE) $(VERSION_FILE) $(obj)include/autoconf.mk $(U_BOOT_ONENAND): $(ONENAND_IPL) $(obj)u-boot.bin cat $(ONENAND_BIN) $(obj)u-boot.bin > $(obj)u-boot-onenand.bin +$(MMC_IPL): $(TIMESTAMP_FILE) $(VERSION_FILE) $(obj)include/autoconf.mk + $(MAKE) -C mmc_ipl/board/$(BOARDDIR) all + +$(U_BOOT_MMC): $(MMC_IPL) $(obj)u-boot.bin + cat $(MMC_BIN) $(obj)u-boot.bin > $(obj)u-boot-mmc.bin + $(RECOVERY_BLOCK): $(TIMESTAMP_FILE) $(VERSION_FILE) $(obj)include/autoconf.mk $(ONENAND_IPL) $(MAKE) -C recovery all @@ -3211,6 +3223,11 @@ s5pc1xx_universal_config: unconfig @echo "ONENAND_BIN = $(obj)onenand_ipl/onenand-ipl-16k.bin" >> $(obj)include/config.mk @echo "CONFIG_RECOVERY_U_BOOT = y" >> $(obj)include/config.mk +#s5pc1xx_universal_config: unconfig +# @echo "#define CONFIG_MMC_U_BOOT" > $(obj)include/config.h +# @$(MKCONFIG) $(@:_config=) arm arm_cortexa8 universal samsung s5pc1xx +# @echo "CONFIG_MMC_U_BOOT = y" >> $(obj)include/config.mk + s5pc1xx_p1p2_config: unconfig @echo "#define CONFIG_ONENAND_U_BOOT" > $(obj)include/config.h @$(MKCONFIG) $(@:_config=) arm arm_cortexa8 p1p2 samsung s5pc1xx @@ -3742,6 +3759,9 @@ clean: @rm -f $(obj)onenand_ipl/onenand-{ipl,ipl.bin,ipl.map} @rm -f $(ONENAND_BIN) @rm -f $(obj)onenand_ipl/u-boot.lds + @rm -f $(obj)mmc_ipl/mmc-{ipl,ipl.bin,ipl.map} + @rm -f $(MMC_BIN) + @rm -f $(obj)mmc_ipl/u-boot.lds @rm -f $(obj)recovery/{recovery,recovery.map} @rm -f $(TIMESTAMP_FILE) $(VERSION_FILE) @find $(OBJTREE) -type f \ @@ -3764,6 +3784,7 @@ clobber: clean @rm -f $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm @[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name "*" -type l -print | xargs rm -f @[ ! -d $(obj)onenand_ipl ] || find $(obj)onenand_ipl -name "*" -type l -print | xargs rm -f + @[ ! -d $(obj)mmc_ipl ] || find $(obj)mmc_ipl -name "*" -type l -print | xargs rm -f @[ ! -d $(obj)recovery ] || find $(obj)recovery -name "*" -type l -print | xargs rm -f @[ ! -d $(obj)api_examples ] || find $(obj)api_examples -name "*" -type l -print | xargs rm -f diff --git a/arch/arm/cpu/arm_cortexa8/start.S b/arch/arm/cpu/arm_cortexa8/start.S index 0d6fb77..98089a0 100644 --- a/arch/arm/cpu/arm_cortexa8/start.S +++ b/arch/arm/cpu/arm_cortexa8/start.S @@ -193,8 +193,10 @@ clbss_l: ldr pc, _start_armboot @ jump to C code -#if defined(CONFIG_PRELOADER) +#if defined(CONFIG_ONENAND_IPL) _start_armboot: .word start_oneboot +#elif defined(CONFIG_MMC_IPL) +_start_armboot: .word start_mmcboot #elif defined(CONFIG_RECOVERY_BLOCK) _start_armboot: .word start_recovery_boot #else diff --git a/build.sh b/build.sh index 766ea78..a4e458f 100755 --- a/build.sh +++ b/build.sh @@ -42,38 +42,52 @@ check_users() fi } +check_ipl() +{ + if [ "$1" = "mmc" ]; then + IPL="mmc" + else + IPL="onenand" + fi +} + build_uboot() { - make ARCH=arm CROSS_COMPILE="$CCACHE $CROSS_COMPILER" $JOBS $* + make ARCH=arm CROSS_COMPILE="$CCACHE $CROSS_COMPILER" $JOBS } make_evt_image() { - cat onenand_ipl/onenand-ipl-16k-evt0.bin u-boot.bin > u-boot-onenand-evt0.bin - cat onenand_ipl/onenand-ipl-16k-fused.bin u-boot.bin > u-boot-onenand-evt1-fused.bin + cat "$IPL"_ipl/"$IPL"-ipl-16k-evt0.bin u-boot.bin > u-boot-"$IPL"-evt0.bin + cat "$IPL"_ipl/"$IPL"-ipl-16k-fused.bin u-boot.bin > u-boot-"$IPL"-evt1-fused.bin # To distinguish previous u-boot-onenand.bin, it uses the evt1 suffix - cp u-boot-onenand.bin u-boot-onenand-evt1.bin + cp u-boot-"$IPL".bin u-boot-"$IPL"-evt1.bin } make_recovery_image() { - cat recovery/recovery-evt0.bin u-boot.bin > u-boot-recovery-evt0.bin - cat recovery/recovery-fused.bin u-boot.bin > u-boot-recovery-evt1-fused.bin - cp u-boot-recovery.bin u-boot-recovery-evt1.bin + if [ "$IPL" != "mmc" ]; then + cat recovery/recovery-evt0.bin u-boot.bin > u-boot-recovery-evt0.bin + cat recovery/recovery-fused.bin u-boot.bin > u-boot-recovery-evt1-fused.bin + cp u-boot-recovery.bin u-boot-recovery-evt1.bin + fi } check_ccache check_users +check_ipl $1 -build_uboot $* +build_uboot make_evt_image make_recovery_image -size=`ls -al u-boot-onenand.bin | awk -F' ' '{printf $5}'` -if [ "$size" -ge "262144" ]; then - echo "u-boot-onenand.bin execced the 256KiB 262144 -> $size" - exit +if [ "$IPL" != "mmc" ]; then + size=`ls -al u-boot-onenand.bin | awk -F' ' '{printf $5}'` + if [ "$size" -ge "262144" ]; then + echo "u-boot-onenand.bin execced the 256KiB 262144 -> $size" + exit + fi fi if [ "$USER" = "kmpark" ]; then diff --git a/mmc_ipl/board/samsung/universal/.gitignore b/mmc_ipl/board/samsung/universal/.gitignore new file mode 100644 index 0000000..62fe7ae --- /dev/null +++ b/mmc_ipl/board/samsung/universal/.gitignore @@ -0,0 +1,2 @@ +checksum +header.bin diff --git a/mmc_ipl/board/samsung/universal/Makefile b/mmc_ipl/board/samsung/universal/Makefile new file mode 100644 index 0000000..2b6d2c2 --- /dev/null +++ b/mmc_ipl/board/samsung/universal/Makefile @@ -0,0 +1,125 @@ +# +# Samsung Universal(S5PC100/S5PC110) board MMC IPL +# +# Copyright (C) 2009 Samsung Electronics +# Minkyu Kang +# Kyungmin Park +# +# 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 +# S5PC100 loads at 0x34000 +# S5PC110 loads at 0x30000 (EVT0) +# S5PC110 loads at 0x20010 (EVT1) +# Now it uses the S5PC100 as default +# If you use the S5PC110, the load address is relocated at start.S +# XXX Never set it S5PC110 it don't relocate it +# FIXME BL1 header uses 16 bytes at S5PC110 EVT1 +TEXT_BASE = 0xD0034000 +TEXT_BASE16K_EVT0 = 0xD0038000 +TEXT_BASE16K_EVT1 = 0xD0037ff0 +TEXT_BASE16K_EVT1_SEC = 0xD0037000 + +LDSCRIPT= $(TOPDIR)/mmc_ipl/board/$(BOARDDIR)/u-boot-mmc.lds +LDFLAGS = -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS) +AFLAGS += -DCONFIG_PRELOADER -DCONFIG_MMC_IPL -g -UTEXT_BASE -DTEXT_BASE=$(TEXT_BASE) +CFLAGS += -DCONFIG_PRELOADER -DCONFIG_MMC_IPL -g -D__HAVE_ARCH_MEMCPY32 +OBJCFLAGS += --gap-fill=0x00 + +SOBJS := lowlevel_init.o mem_setup.o +SOBJS += start.o _memcpy32.o +SOBJS += cache.o +COBJS += mmc.o +COBJS += mmc_boot.o +COBJS += universal.o + +SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c)) +OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) +__OBJS := $(SOBJS) $(COBJS) +LNDIR := $(OBJTREE)/mmc_ipl/board/$(BOARDDIR) + +mmcobj := $(OBJTREE)/mmc_ipl/ + +ALL = $(mmcobj)mmc-ipl $(mmcobj)mmc-ipl.bin $(mmcobj)mmc-ipl-16k-evt0.bin $(mmcobj)mmc-ipl-16k-evt1.bin $(mmcobj)mmc-ipl-fused.bin + +all: $(obj).depend $(ALL) + +$(mmcobj)mmc-ipl-16k-evt0.bin: $(mmcobj)mmc-ipl checksum + $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(TEXT_BASE16K_EVT0) -O binary $< $@ + $(mmcobj)/board/$(BOARDDIR)/checksum $@ 0 + +$(mmcobj)mmc-ipl-16k-evt1.bin: $(mmcobj)mmc-ipl checksum + $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(TEXT_BASE16K_EVT1) -O binary $< $@ + $(mmcobj)/board/$(BOARDDIR)/checksum $@ 1 + cat $(mmcobj)/board/$(BOARDDIR)/header.bin $@ > $(mmcobj)mmc-ipl-16k.bin + +$(mmcobj)mmc-ipl-fused.bin: $(mmcobj)mmc-ipl checksum + $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(TEXT_BASE16K_EVT1_SEC) -O binary $< $@ + cat $(mmcobj)/board/$(BOARDDIR)/bl1.img $@ > $(mmcobj)mmc-ipl-16k-fused.bin + +$(mmcobj)mmc-ipl.bin: $(mmcobj)mmc-ipl + $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@ + +$(mmcobj)mmc-ipl: $(OBJS) + cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \ + -Map $@.map -o $@ + +checksum: checksum.c + $(HOSTCC) -o $@ $< + +# create symbolic links from common files + +# from cpu directory +$(obj)start.S: + @rm -f $@ + ln -s $(SRCTREE)/$(CPUDIR)/start.S $@ + +# from SoC directory +$(obj)cache.S: + @rm -f $@ + ln -s $(SRCTREE)/$(CPUDIR)/$(SOC)/cache.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 lib_arm +$(obj)_memcpy32.S: + ln -sf $(SRCTREE)/arch/$(ARCH)/lib/_memcpy32.S $@ + +# from mmc_ipl directory +$(obj)mmc_ipl.h: + @rm -f $@ + ln -s $(SRCTREE)/mmc_ipl/mmc_ipl.h $@ + +$(obj)mmc_boot.c: $(obj)mmc_ipl.h + @rm -f $@ + ln -s $(SRCTREE)/mmc_ipl/mmc_boot.c $@ + +$(obj)mmc.c: $(obj)mmc_ipl.h + @rm -f $@ + ln -s $(SRCTREE)/mmc_ipl/mmc.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 mmc_boot.c mmc.c + +######################################################################### diff --git a/mmc_ipl/board/samsung/universal/bl1.img b/mmc_ipl/board/samsung/universal/bl1.img new file mode 100644 index 0000000000000000000000000000000000000000..3c4c3dcf020d9fe850cc9526b98e1a079028c809 GIT binary patch literal 4096 zcmeHJe@s<%6hHU!_;pda!joPv$_GP-g!xeXv7+_L3S1?xdLvs-&`~y*${*HPv2|4@ z_=9{pNOTg{q-;tJi^@#x<vP~fqc`2$+WHH&x9>UU zd(Qcu^Ep2*BooPrV&{d=V<==HiX#dRgu}P}IjPwo*=yuFa5^^|*?hV-8)AH_E`-#v z0-r>ZNY+67PJo#LD=QA3)Rh>xH6R6IhGFA6jnhhIyjZxr> zK&OM2K^K5_fVP5mg3bbM1Dy@J&Ehq>EQ&Ue;L>c?X2WM$3Hv64$gL+5*=3VPUUsWV zBPP4eqzSZyoc%kI2Vx+vssn~#qOh%pec)aaAQ!xAwG4Vu?+=F`Y>R0&4&dFk)Mi5< zcfbZ80+r}vajLkZHm{*LRXvFmKRN3_yEMh|lvWM>O5A@fP#-C3fM_1SB~?H+A9q!; zD-8-cbjE8ha49ln9^5;_Qvz=GEqIMim);{vs-BJecH}FNM~@%G+@r_hi~)}vr39Q@ zi^QSRE>x)ceaMYWp1|9|TTH!JQ*MFW3VEE#$AL$i1mjIU9{ecqNhY5JJ^{RB@)CH) zFd4i^w9SSSIOfQZd&Op>%k{}xmJzJD*B==p=;~wXG!t98GqMetAW`*k% z!c3n9KfM14{hR~5dwJer<4*ARpx3#scJ9qqQ{QLVG}xQIh+g8q^{S)vcrJJ*UW2|5 zwJrCdhmUN>%qo7K6A$F=kSh+CR>V41uaP!d(Jmr~;WJZ!yX>f#IWB9|d+D8ZT4>|J zULwDrDq=d7*JC;>OY&35A$IPikAIPIl3(^`W@Z8|(AZI-(#hwj4fE+ntSa^rNhvbIm_-J?|1#XL&>> ztQ(TWnljcAp@TlXsl&Pg_78f*E=cqAF*wPk@{SAcW1N6lqb1Yd3R;k>HSZ%s{W=YO zB~Y~n-GGQWyc`bicfdwWn#a4~rjHfFe7p);yp0du73_m^6A=&hT_g_vHbmmcGJVwF zB94fUP&4WR?71%eE?^F9H?R+ncW~}`7I}|VLdJW5_c3s@li5RMkjFaJfb0McvZ^;O zAIfA#3x8@ z?0nP*@rj5jRzfruX84emfky-_aLX)K>=+VDPCgu32bSG^I3ILjS%S~cE? z1uprfP9^V&8r~Ble?lm*z}6XAORjZ)&~e|Q(DdD({q$wGXHxBs3DU_Umo{uJ$;-MF zdhUl~>n85$s3`3}+_AbaWzFTnUE}OY88_~qcs2iYan2vfIs0yWi~n(`;o6d>hhMSe Y*KC{7KWkFi)wLHy<-g#+`wsv922#{u@Bjb+ literal 0 HcmV?d00001 diff --git a/mmc_ipl/board/samsung/universal/checksum.c b/mmc_ipl/board/samsung/universal/checksum.c new file mode 100644 index 0000000..22c75e5 --- /dev/null +++ b/mmc_ipl/board/samsung/universal/checksum.c @@ -0,0 +1,146 @@ +#include +#include +#include +#include +#include +#include +#include + +#ifndef SZ_8K +#define SZ_8K 0x2000 +#endif +#ifndef SZ_14K +#define SZ_14K 0x3800 +#endif + +#define PAGE_SIZE 0x800 +/* + * For 2KiB page OneNAND + * +------+------+------+------+ + * | 2KiB | 2KiB | 2KiB | 2KiB | + * +------+------+------+------+ + */ +#define CHECKSUM_8K (SZ_8K - 0x4) +/* + * For 4KiB page OneNAND + * +----------------+----------------+----------------+----------------+ + * | 2KiB, reserved | 2KiB, reserved | 2KiB, reserved | 2KiB, reserved | + * +----------------+----------------+----------------+----------------+ + */ +#define CHECKSUM_16K (SZ_14K - 0x4) + +int main(int argc, char *argv[]) +{ + int ret; + int i, j; + char buf; + int fd; + int fd0; + unsigned int sum = 0; + struct stat stat; + off_t size; + unsigned int header[4]; + int evt; + + if (argc != 3) + evt = 0; + else + evt = atoi(argv[2]); + + fd = open(argv[1], O_RDWR); + + if (fd < 0) { + printf("open err: %s\n", argv[1]); + return 1; + } + + ret = fstat(fd, &stat); + if (ret < 0) { + perror("fstat"); + return 1; + } + + if (stat.st_size > SZ_8K) + size = CHECKSUM_16K; + else + size = CHECKSUM_8K; + + for (i = 0; i < size; i++) { + /* evt1 doesn't have reserved area */ + if (evt == 0) { + /* if reserved area, skip the checksum */ + if (stat.st_size > SZ_8K) { + if (i % PAGE_SIZE == 0) { + int res; + char tbuf[PAGE_SIZE]; + + res = i / PAGE_SIZE; + if (res % 2) { + i += PAGE_SIZE; + /* + * if 1st page's reverved area, + * copy the data to 2nd page + */ + if (res == 1) { + ret = read(fd, &tbuf, + PAGE_SIZE); + ret = write(fd, tbuf, + PAGE_SIZE); + } + lseek(fd, i, SEEK_SET); + } + } + } + } + + ret = read(fd, &buf, 1); + + if (ret < 0) { + perror("read"); + return 1; + } + + sum += (buf & 0xFF); + +#if 0 + if (i % 16 == 0) + printf("%04x: ", i); + printf("%02x ", buf & 0xFF); + if (i % 16 == 15) + printf("\n"); +#endif + } + + if (evt == 0) + ret = write(fd, &sum, 4); + + if (ret < 0) + printf("read err: %s\n", ret); + + close(fd); + + printf("checksum = %x\n", sum); + + if (evt == 1) { + fd0 = open("header.bin", O_RDWR | O_CREAT | O_TRUNC, + S_IRUSR | S_IWUSR); + + if (fd0 < 0) { + printf("open err: header.bin\n"); + return 1; + } + + if (size == CHECKSUM_16K) + header[0] = 0x4000; + else + header[0] = 0x2000; + header[1] = 0; + header[2] = sum; + header[3] = 0; + + ret = write(fd0, header, 16); + close(fd0); + } + + return 0; +} diff --git a/mmc_ipl/board/samsung/universal/u-boot-mmc.lds b/mmc_ipl/board/samsung/universal/u-boot-mmc.lds new file mode 100644 index 0000000..559f9f2 --- /dev/null +++ b/mmc_ipl/board/samsung/universal/u-boot-mmc.lds @@ -0,0 +1,53 @@ +/* + * (C) Copyright 2005-2008 Samsung Electronics + * Kyungmin Park + * + * 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 = .; +} diff --git a/mmc_ipl/board/samsung/universal/universal.c b/mmc_ipl/board/samsung/universal/universal.c new file mode 100644 index 0000000..73457b9 --- /dev/null +++ b/mmc_ipl/board/samsung/universal/universal.c @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2010 Samsung Electronics + * Minkyu Kang + * + * 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 + +int board_mmc_init(void) +{ + /* settings for mmc */ + return 0; +} diff --git a/mmc_ipl/mmc.c b/mmc_ipl/mmc.c new file mode 100644 index 0000000..84acf67 --- /dev/null +++ b/mmc_ipl/mmc.c @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2010 Samsung Electronics + * + * 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 + */ + +static int __board_mmc_init(void) +{ + return 0; +} + +int board_mmc_init(void) __attribute__((weak, alias("__board_mmc_init"))); + +int mmc_init(void) +{ + if (board_mmc_init) + return 1; + + return 0; +} + +void mmc_read_block(unsigned char *buf) +{ +} diff --git a/mmc_ipl/mmc_boot.c b/mmc_ipl/mmc_boot.c new file mode 100644 index 0000000..0bfe66e --- /dev/null +++ b/mmc_ipl/mmc_boot.c @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2010 Samsung Electronics + * Minkyu Kang + * + * Derived from onenand_ipl + * + * 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 +#include "mmc_ipl.h" + +typedef int (init_fnc_t)(void); + +void start_mmcboot(void) +{ + uchar *buf; + + if (mmc_init()) + hang(); + + buf = (uchar *)CONFIG_SYS_BOOT_ADDR; + + mmc_read_block(buf); + + ((init_fnc_t *)CONFIG_SYS_BOOT_ADDR)(); + + /* should never come here */ +} + +void hang(void) +{ + for (;;); +} diff --git a/mmc_ipl/mmc_ipl.h b/mmc_ipl/mmc_ipl.h new file mode 100644 index 0000000..e300a25 --- /dev/null +++ b/mmc_ipl/mmc_ipl.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2010 Samsung Electronics + * + * 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 + */ + +#ifndef _MMC_IPL_H +#define _MMC_IPL_H + +extern int mmc_init(void); +extern void mmc_read_block(unsigned char *buf); + +#endif -- 2.7.4