diff options
| author | Marcin Juszkiewicz <hrw@openedhand.com> | 2007-10-29 11:00:19 +0000 |
|---|---|---|
| committer | Marcin Juszkiewicz <hrw@openedhand.com> | 2007-10-29 11:00:19 +0000 |
| commit | 70abc059ebae6bd18399c0361d348f415a3f631a (patch) | |
| tree | 86ae8bf44d64d40603b5bca6774eac7f1aaa3ce5 | |
| parent | ce1e498f5d3a46642b6bb14c14ebae2a52f732a4 (diff) | |
| download | openembedded-core-70abc059ebae6bd18399c0361d348f415a3f631a.tar.gz openembedded-core-70abc059ebae6bd18399c0361d348f415a3f631a.tar.bz2 openembedded-core-70abc059ebae6bd18399c0361d348f415a3f631a.zip | |
u-boot: import OpenMoko uboot from OE
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@3014 311d38ba-8fff-0310-9ca6-ca027cbcb966
63 files changed, 26669 insertions, 77 deletions
diff --git a/meta/packages/uboot/u-boot-mkimage-gta01-native_svn.bb b/meta/packages/uboot/u-boot-mkimage-gta01-native_svn.bb deleted file mode 100644 index 7c10d653bc..0000000000 --- a/meta/packages/uboot/u-boot-mkimage-gta01-native_svn.bb +++ /dev/null @@ -1,18 +0,0 @@ -require uboot-gta01_svn.bb - -PROVIDES = "" -TARGET_LDFLAGS = "" - -do_compile () { - chmod +x board/neo1973/gta01/split_by_variant.sh - oe_runmake gta01bv3_config - oe_runmake clean - oe_runmake tools -} - -do_deploy () { - install -m 0755 tools/mkimage ${STAGING_BINDIR_NATIVE}/uboot-mkimage -} - -do_deploy[dirs] = "${S}" -addtask deploy before do_package after do_install diff --git a/meta/packages/uboot/u-boot-mkimage-openmoko-native/bbt-create-optional.patch b/meta/packages/uboot/u-boot-mkimage-openmoko-native/bbt-create-optional.patch new file mode 100644 index 0000000000..d7a2a872e5 --- /dev/null +++ b/meta/packages/uboot/u-boot-mkimage-openmoko-native/bbt-create-optional.patch @@ -0,0 +1,52 @@ +This patch makes creation of the BBT optional for the s3c24x0 platform. +It adds: + +- a new platform-independent NAND-wide flag NAND_DONT_CREATE_BBT +- one user of this flag, namely s3c24x0 + +Experimental. + +- Werner Almesberger <werner@openmoko.org> + + +Index: u-boot/cpu/arm920t/s3c24x0/nand.c +=================================================================== +--- u-boot.orig/cpu/arm920t/s3c24x0/nand.c 2007-02-16 23:53:29.000000000 +0100 ++++ u-boot/cpu/arm920t/s3c24x0/nand.c 2007-02-16 23:53:54.000000000 +0100 +@@ -169,7 +169,7 @@ + + nand->eccmode = NAND_ECC_SOFT; + #ifdef CONFIG_S3C2410_NAND_BBT +- nand->options = NAND_USE_FLASH_BBT; ++ nand->options = NAND_USE_FLASH_BBT | NAND_DONT_CREATE_BBT; + #else + nand->options = 0; + #endif +Index: u-boot/drivers/nand/nand_bbt.c +=================================================================== +--- u-boot.orig/drivers/nand/nand_bbt.c 2007-02-16 23:53:36.000000000 +0100 ++++ u-boot/drivers/nand/nand_bbt.c 2007-02-16 23:53:54.000000000 +0100 +@@ -678,7 +678,8 @@ + } + create: + /* Create the bad block table by scanning the device ? */ +- if (!(td->options & NAND_BBT_CREATE)) ++ if (!(td->options & NAND_BBT_CREATE) || ++ (this->options & NAND_DONT_CREATE_BBT)) + continue; + + /* Create the table in memory by scanning the chip(s) */ +Index: u-boot/include/linux/mtd/nand.h +=================================================================== +--- u-boot.orig/include/linux/mtd/nand.h 2007-02-16 23:53:08.000000000 +0100 ++++ u-boot/include/linux/mtd/nand.h 2007-02-16 23:53:54.000000000 +0100 +@@ -187,7 +187,8 @@ + * This can only work if we have the ecc bytes directly behind the + * data bytes. Applies for DOC and AG-AND Renesas HW Reed Solomon generators */ + #define NAND_HWECC_SYNDROME 0x00020000 +- ++/* Do not create an BBT if none is found. Overrides NAND_BBT_CREATE. */ ++#define NAND_DONT_CREATE_BBT 0x00040000 + + /* Options set by nand scan */ + /* Nand scan has allocated oob_buf */ diff --git a/meta/packages/uboot/u-boot-mkimage-openmoko-native/bbt-scan-second.patch b/meta/packages/uboot/u-boot-mkimage-openmoko-native/bbt-scan-second.patch new file mode 100644 index 0000000000..37b2807908 --- /dev/null +++ b/meta/packages/uboot/u-boot-mkimage-openmoko-native/bbt-scan-second.patch @@ -0,0 +1,69 @@ +Scan also the second OOB page for bad block information. + +board/neo1973/gta01/nand.c (board_nand_init): added board-specific badblock + pattern which sets NAND_BBT_SCAN2NDPAGE +drivers/nand/nand_base.c (nand_block_bad): also consider the second page in a + block if NAND_BBT_SCAN2NDPAGE is set + +- Werner Almesberger <werner@openmoko.org> + +Index: u-boot/board/neo1973/gta01/nand.c +=================================================================== +--- u-boot.orig/board/neo1973/gta01/nand.c ++++ u-boot/board/neo1973/gta01/nand.c +@@ -113,9 +113,23 @@ + } + + ++/* Derived from drivers/nand/nand_bbt.c:smallpage_flashbased */ ++ ++static uint8_t scan_ff_pattern[] = { 0xff, 0xff }; ++ ++static struct nand_bbt_descr badblock_pattern = { ++ .options = ++ NAND_BBT_SCANEMPTY | NAND_BBT_SCANALLPAGES | NAND_BBT_SCAN2NDPAGE, ++ .offs = 5, ++ .len = 1, ++ .pattern = scan_ff_pattern ++}; ++ ++ + int board_nand_init(struct nand_chip *nand) + { + nand->read_otp = samsung_nand_read_otp; + nand->write_otp = samsung_nand_write_otp; ++ nand->badblock_pattern = &badblock_pattern; + return s3c24x0_nand_init(nand); + } +Index: u-boot/drivers/nand/nand_base.c +=================================================================== +--- u-boot.orig/drivers/nand/nand_base.c ++++ u-boot/drivers/nand/nand_base.c +@@ -421,7 +421,7 @@ + * + * Check, if the block is bad. + */ +-static int nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip) ++static int nand_block_bad_page(struct mtd_info *mtd, loff_t ofs, int getchip) + { + int page, chipnr, res = 0; + struct nand_chip *this = mtd->priv; +@@ -460,6 +460,18 @@ + return res; + } + ++static int nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip) ++{ ++ struct nand_chip *this = mtd->priv; ++ ++ if (nand_block_bad_page(mtd, ofs, getchip)) ++ return 1; ++ if (this->badblock_pattern->options & NAND_BBT_SCAN2NDPAGE && ++ nand_block_bad_page(mtd, ofs+(1 << this->page_shift), getchip)) ++ return 1; ++ return 0; ++} ++ + /** + * nand_default_block_markbad - [DEFAULT] mark a block bad + * @mtd: MTD device structure diff --git a/meta/packages/uboot/u-boot-mkimage-openmoko-native/boot-from-ram-and-nand.patch b/meta/packages/uboot/u-boot-mkimage-openmoko-native/boot-from-ram-and-nand.patch new file mode 100644 index 0000000000..fa0de39ab7 --- /dev/null +++ b/meta/packages/uboot/u-boot-mkimage-openmoko-native/boot-from-ram-and-nand.patch @@ -0,0 +1,98 @@ +Auto-detect whether we're booting from RAM or NAND, and act accordingly. This +allows us to use the same u-boot binary for all boot modes. + +include/configs/neo1973.h: introduced new config option + CONFIG_LL_INIT_NAND_ONLY to perform low-level initialization only when + booting from NAND +include/configs/neo1973.h: got rid of BUILD_FOR_RAM +cpu/arm920t/start.S: detect if we need to boot from NAND at run time (i.e., if + we're running at address 0) + +- Werner Almesberger <werner@openmoko.org> + +Index: u-boot/cpu/arm920t/start.S +=================================================================== +--- u-boot.orig/cpu/arm920t/start.S ++++ u-boot/cpu/arm920t/start.S +@@ -157,18 +157,26 @@ + str r1, [r0] + #endif /* CONFIG_S3C2400 || CONFIG_S3C2410 */ + +- /* +- * we do sys-critical inits only at reboot, +- * not when booting from ram! +- */ + #ifndef CONFIG_SKIP_LOWLEVEL_INIT ++#ifndef CONFIG_LL_INIT_NAND_ONLY + bl cpu_init_crit + #endif ++#endif + + #ifndef CONFIG_SKIP_RELOCATE_UBOOT +-#ifndef CONFIG_S3C2410_NAND_BOOT +-relocate: /* relocate U-Boot to RAM */ + adr r0, _start /* r0 <- current position of code */ ++ ++#ifdef CONFIG_S3C2410_NAND_BOOT ++ /* are we running from NAND ? */ ++#define BWSCON 0x48000000 ++ ldr r1, =BWSCON /* Z = CPU booted from NAND */ ++ ldr r1, [r1] ++ tst r1, #6 /* BWSCON[2:1] = OM[1:0] */ ++ teqeq r0, #0 /* Z &= running at address 0 */ ++ beq nand_load ++#endif /* CONFIG_S3C2410_NAND_BOOT */ ++ ++relocate: /* relocate U-Boot to RAM */ + ldr r1, _TEXT_BASE /* test if we run from flash or RAM */ + cmp r0, r1 /* don't reloc during debug */ + beq done_relocate +@@ -188,10 +196,13 @@ + ldr pc, _done_relocate /* jump to relocated code */ + _done_relocate: + .word done_relocate +-done_relocate: +-#else /* NAND_BOOT */ +-relocate: +-copy_myself: ++ ++#ifdef CONFIG_S3C2410_NAND_BOOT ++nand_load: ++#if !defined(CONFIG_SKIP_LOWLEVEL_INIT) && defined(CONFIG_LL_INIT_NAND_ONLY) ++ bl cpu_init_crit ++#endif ++ + /* mov r10, lr */ + + @ reset NAND +@@ -275,7 +286,8 @@ + #endif + 1: b 1b + done_nand_read: +-#endif /* NAND_BOOT */ ++#endif /* CONFIG_S3C2410_NAND_BOOT */ ++done_relocate: + #endif /* CONFIG_SKIP_RELOCATE_UBOOT */ + + /* Set up the stack */ +Index: u-boot/include/configs/neo1973_gta01.h +=================================================================== +--- u-boot.orig/include/configs/neo1973_gta01.h ++++ u-boot/include/configs/neo1973_gta01.h +@@ -26,14 +26,10 @@ + #ifndef __CONFIG_H + #define __CONFIG_H + +-#if defined(BUILD_FOR_RAM) +-/* If we want to start u-boot from inside RAM */ +-#define CONFIG_SKIP_LOWLEVEL_INIT 1 +-#else +-/* we want to start u-boot directly from within NAND flash */ ++/* we want to be able to start u-boot directly from within NAND flash */ ++#define CONFIG_LL_INIT_NAND_ONLY + #define CONFIG_S3C2410_NAND_BOOT 1 + #define CONFIG_S3C2410_NAND_SKIP_BAD 1 +-#endif + + #define CFG_UBOOT_SIZE 0x40000 /* size of u-boot, for NAND loading */ + diff --git a/meta/packages/uboot/u-boot-mkimage-openmoko-native/boot-from-ram-reloc.patch b/meta/packages/uboot/u-boot-mkimage-openmoko-native/boot-from-ram-reloc.patch new file mode 100644 index 0000000000..53a3e05c67 --- /dev/null +++ b/meta/packages/uboot/u-boot-mkimage-openmoko-native/boot-from-ram-reloc.patch @@ -0,0 +1,62 @@ +This patch allows us to boot from anywhere in RAM. It mainly sets the stage +for later patches. The only real changes here is the better handling of already +cached code (e.g., if we were started by a previous instance of u-boot), and +that we drop CONFIG_SKIP_RELOCATE_UBOOT from neo1973.h + +cpu/arm920t/start.S: if not relocating, instead of going straight to + stack_setup, jump to done_relocate, which may perform other setup tasks +cpu/arm920t/start.S: after relocating, flush the cache and jump to the new code +include/configs/neo1973.h: remove CONFIG_SKIP_RELOCATE_UBOOT + +- Werner Almesberger <werner@openmoko.org> + +Index: u-boot/cpu/arm920t/start.S +=================================================================== +--- u-boot.orig/cpu/arm920t/start.S ++++ u-boot/cpu/arm920t/start.S +@@ -171,7 +171,7 @@ relocate: /* relocate U-Boot to RAM + adr r0, _start /* r0 <- current position of code */ + ldr r1, _TEXT_BASE /* test if we run from flash or RAM */ + cmp r0, r1 /* don't reloc during debug */ +- beq stack_setup ++ beq done_relocate + + ldr r2, _armboot_start + ldr r3, _bss_start +@@ -181,8 +181,14 @@ relocate: /* relocate U-Boot to RAM + copy_loop: + ldmia r0!, {r3-r10} /* copy from source address [r0] */ + stmia r1!, {r3-r10} /* copy to target address [r1] */ +- cmp r0, r2 /* until source end addreee [r2] */ ++ cmp r0, r2 /* until source end address [r2] */ + ble copy_loop ++ mov r0, #0 /* flush v3/v4 cache */ ++ mcr p15, 0, r0, c7, c7, 0 ++ ldr pc, _done_relocate /* jump to relocated code */ ++_done_relocate: ++ .word done_relocate ++done_relocate: + #else /* NAND_BOOT */ + relocate: + copy_myself: +@@ -270,7 +276,7 @@ notmatch: + 1: b 1b + done_nand_read: + #endif /* NAND_BOOT */ +-#endif /* CONFIG_SKIP_RELOCATE_UBOOT */ ++#endif /* CONFIG_SKIP_RELOCATE_UBOOT */ + + /* Set up the stack */ + stack_setup: +Index: u-boot/include/configs/neo1973_gta01.h +=================================================================== +--- u-boot.orig/include/configs/neo1973_gta01.h ++++ u-boot/include/configs/neo1973_gta01.h +@@ -28,7 +28,6 @@ + + #if defined(BUILD_FOR_RAM) + /* If we want to start u-boot from inside RAM */ +-#define CONFIG_SKIP_RELOCATE_UBOOT 1 + #define CONFIG_SKIP_LOWLEVEL_INIT 1 + #else + /* we want to start u-boot directly from within NAND flash */ diff --git a/meta/packages/uboot/u-boot-mkimage-openmoko-native/boot-menu.patch b/meta/packages/uboot/u-boot-mkimage-openmoko-native/boot-menu.patch new file mode 100644 index 0000000000..352967ae06 --- /dev/null +++ b/meta/packages/uboot/u-boot-mkimage-openmoko-native/boot-menu.patch @@ -0,0 +1,769 @@ +board/neo1973/bootmenu.c: simple configurable boot menu +board/neo1973/neo1973.c (neo1973_new_second): return 1 if a new second has + started since the last call +board/neo1973/neo1973.c (neo1973_on_key_pressed): return 1 if the $POWER key is + pressed +board/neo1973/neo1973.c (board_late_init): make use of neo1973_new_second and + neo1973_on_key_pressed +board/neo1973/neo1973.h: added function prototypes +u-boot/board/neo1973/neo1973.c (board_late_init): enter the boot menu when + "AUX" was pressed at least half the time +u-boot/board/neo1973/neo1973.c (board_late_init): minor code cleanup +u-boot/common/console.c, include/console.h: added "console_poll_hook" to be + called when waiting for console in put in "getc" and "tstc" +board/neo1973/neo1973.c (board_late_init): poll for the boot menu also on RAM + boot, reset, or unknown cause +board/neo1973/neo1973.c (board_late_init): don't look for the power key if + woken up by the charger +board/neo1973/neo1973.h, board/neo1973/neo1973.c, board/neo1973/bootmenu.c: + renamed neo1973_911_key_pressed to neo1973_aux_key_pressed + +- Werner Almesberger <werner@openmoko.org> + +Index: u-boot/board/neo1973/common/bootmenu.c +=================================================================== +--- /dev/null ++++ u-boot/board/neo1973/common/bootmenu.c +@@ -0,0 +1,120 @@ ++/* ++ * bootmenu.c - Boot menu ++ * ++ * Copyright (C) 2006-2007 by OpenMoko, Inc. ++ * Written by Werner Almesberger <werner@openmoko.org> ++ * All Rights Reserved ++ * ++ * 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., ++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ++ */ ++ ++ ++#include <common.h> ++#include <environment.h> ++#include <bootmenu.h> ++#include <asm/atomic.h> ++ ++#ifdef CONFIG_USBD_DFU ++#include "usbdcore.h" ++#include "usb_dfu.h" ++#endif ++ ++#include "neo1973.h" ++ ++ ++#define DEBOUNCE_LOOPS 1000 /* wild guess */ ++ ++ ++static int debounce(int (*fn)(void), int *last) ++{ ++ int on, i; ++ ++again: ++ on = fn(); ++ if (on != *last) ++ for (i = DEBOUNCE_LOOPS; i; i--) ++ if (on != fn()) ++ goto again; ++ *last = on; ++ return on; ++} ++ ++ ++static int aux_key(void *user) ++{ ++ static int last_aux = -1; ++ ++ return debounce(neo1973_aux_key_pressed, &last_aux); ++} ++ ++ ++static int on_key(void *user) ++{ ++ static int last_on = -1; ++ ++ return debounce(neo1973_on_key_pressed, &last_on); ++} ++ ++ ++static void factory_reset(void *user) ++{ ++ default_env(); ++ run_command("dynpart", 0); ++ run_command("bootd", 0); ++} ++ ++ ++static int seconds(void *user) ++{ ++ return neo1973_new_second(); ++} ++ ++ ++static int system_idle(void) ++{ ++#ifdef CONFIG_USBD_DFU |
