}
#ifdef CONFIG_BOARD_LATE_INIT
+static char *bootmodeascii[16] = {
+ "BOOT", "reserved", "reserved", "reserved",
+ "RUN", "reserved", "reserved", "reserved",
+ "reserved", "reserved", "reserved", "reserved",
+ "PME", "reserved", "reserved", "DIAG",
+};
+
int board_late_init(void)
{
- if (0 == gpio_get_value(REPSWITCH)) {
- env_set("bootcmd", "run netconsole");
- }
+ unsigned char bmode = 0;
+ ulong bootcount = 0;
+
+ bootcount = bootcount_load() & 0xF;
+
+ if (gpio_get_value(REPSWITCH) == 0 || bootcount == 12)
+ bmode = 12;
+ else if (bootcount > 0)
+ bmode = 0;
+ else
+ bmode = 4;
+
+ printf("Mode: %s\n", bootmodeascii[bmode & 0x0F]);
+ env_set_ulong("b_mode", bmode);
+
+ /* get sure that bootcmd isn't affected by any bootcount value */
+ env_set_ulong("bootlimit", 0);
+
return 0;
}
#endif /* CONFIG_BOARD_LATE_INIT */
/* ------------------------------------------------------------------------- */
/* memory */
#define CONFIG_SYS_MALLOC_LEN (5 * 1024 * 1024)
+#define CONFIG_SYS_BOOTM_LEN SZ_32M
/* Clock Defines */
#define V_OSCK 26000000 /* Clock output from T2 */
#define CONFIG_ENV_SIZE (64 << 10)
#ifdef CONFIG_NAND
-#define NANDARGS \
- "mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \
- "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
- "nandargs=setenv bootargs console=${console} " \
- "${optargs} " \
- "${optargs_rot} " \
- "root=mtd6 " \
- "rootfstype=jffs2\0" \
- "kernelsize=0x400000\0" \
- "nandboot=echo booting from nand ...; " \
- "run nandargs; " \
- "nand read ${loadaddr} kernel ${kernelsize}; " \
- "bootz ${loadaddr} - ${dtbaddr}\0" \
- "defboot=run nandboot\0" \
- "bootlimit=1\0" \
- "simplefb=1\0 " \
- "altbootcmd=run usbscript\0"
+#define NANDTGTS \
+"mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \
+"mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
+"cfgscr=nand read ${cfgaddr} cfgscr && source ${cfgaddr}\0" \
+"nandargs=setenv bootargs console=${console} ${optargs} ${optargs_rot} " \
+ "root=mtd6 rootfstype=jffs2 b_mode=${b_mode}\0" \
+"b_nand=nand read ${loadaddr} kernel; nand read ${dtbaddr} dtb; " \
+ "run nandargs; run cfgscr; bootz ${loadaddr} - ${dtbaddr}\0" \
+"b_tgts_std=usb0 nand net\0" \
+"b_tgts_rcy=net usb0 nand\0" \
+"b_tgts_pme=usb0 nand net\0"
#else
-#define NANDARGS ""
+#define NANDTGTS ""
#endif /* CONFIG_NAND */
+#define MMCSPI_TGTS \
+"t30args#0=setenv bootargs ${optargs_rot} ${optargs} console=${console} " \
+ "b_mode=${b_mode} root=/dev/mmcblk0p2 rootfstype=ext4\0" \
+"b_t30lgcy#0=" \
+ "load ${loaddev}:2 ${loadaddr} /boot/PPTImage.md5 && " \
+ "load ${loaddev}:2 ${loadaddr} /boot/zImage && " \
+ "load ${loaddev}:2 ${dtbaddr} /boot/am335x-ppt30.dtb || " \
+ "load ${loaddev}:1 ${dtbaddr} am335x-ppt30-legacy.dtb; "\
+ "run t30args#0; run cfgscr; bootz ${loadaddr} - ${dtbaddr}\0" \
+"t30args#1=setenv bootargs ${optargs_rot} ${optargs} console=${console} " \
+ "b_mode=${b_mode}\0" \
+"b_t30lgcy#1=" \
+ "load ${loaddev}:1 ${loadaddr} zImage && " \
+ "load ${loaddev}:1 ${dtbaddr} am335x-ppt30.dtb && " \
+ "load ${loaddev}:1 ${ramaddr} rootfsPPT30.uboot && " \
+ "run t30args#1; run cfgscr; bootz ${loadaddr} ${ramaddr} ${dtbaddr}\0" \
+"b_mmc0=load ${loaddev}:1 ${scraddr} bootscr.img && source ${scraddr}\0" \
+"b_mmc1=load ${loaddev}:1 ${scraddr} /boot/bootscr.img && source ${scraddr}\0" \
+"b_tgts_std=mmc0 mmc1 t30lgcy#0 t30lgcy#1 usb0 net\0" \
+"b_tgts_rcy=t30lgcy#1 usb0 net\0" \
+"b_tgts_pme=net usb0 mmc0 mmc1\0" \
+"loaddev=mmc 1\0"
+
#ifdef CONFIG_MMC
-#define MMCARGS \
-"dtbdev=mmc\0" \
-"dtbpart=1:1\0" \
-"mmcroot0=setenv bootargs ${optargs_rot} ${optargs} console=${console}\0" \
-"mmcroot1=setenv bootargs ${optargs_rot} ${optargs} console=${console} " \
- "root=/dev/mmcblk0p2 rootfstype=ext4\0" \
-"mmcboot0=echo booting Updatesystem from mmc (ext4-fs) ...; " \
- "setenv simplefb 1; " \
- "ext4load mmc 1:1 ${loadaddr} /${kernel}; " \
- "ext4load mmc 1:1 ${ramaddr} /${ramdisk}; " \
- "run mmcroot0; bootz ${loadaddr} ${ramaddr} ${dtbaddr};\0" \
-"mmcboot1=echo booting PPT-OS from mmc (ext4-fs) ...; " \
- "setenv simplefb 0; " \
- "ext4load mmc 1:2 ${loadaddr} /boot/${kernel}; " \
- "run mmcroot1; bootz ${loadaddr} - ${dtbaddr};\0" \
-"defboot=ext4load mmc 1:2 ${loadaddr} /boot/PPTImage.md5 && run mmcboot1; " \
- "ext4load mmc 1:1 ${dtbaddr} /$dtb && run mmcboot0; " \
- "run ramboot; run usbscript;\0" \
-"bootlimit=1\0" \
-"altbootcmd=mmc dev 1; run mmcboot0;\0" \
-"upduboot=dhcp; " \
- "tftp ${loadaddr} MLO && mmc write ${loadaddr} 100 100; " \
- "tftp ${loadaddr} u-boot.img && mmc write ${loadaddr} 300 400;\0"
+#define MMCTGTS \
+MMCSPI_TGTS \
+"cfgscr=mmc dev 1; mmc read ${cfgaddr} 200 80; source ${cfgaddr}\0"
#else
-#define MMCARGS ""
+#define MMCTGTS ""
#endif /* CONFIG_MMC */
+#ifdef CONFIG_SPI
+#define SPITGTS \
+MMCSPI_TGTS \
+"cfgscr=sf probe; sf read ${cfgaddr} 0xC0000 10000; source ${cfgaddr}\0"
+#else
+#define SPITGTS ""
+#endif /* CONFIG_SPI */
+
+#define LOAD_OFFSET(x) 0x8##x
+
#ifndef CONFIG_SPL_BUILD
#define CONFIG_EXTRA_ENV_SETTINGS \
BUR_COMMON_ENV \
"verify=no\0" \
"autoload=0\0" \
-"dtb=bur-ppt-ts30.dtb\0" \
-"dtbaddr=0x80100000\0" \
-"loadaddr=0x80200000\0" \
-"ramaddr=0x80A00000\0" \
-"kernel=zImage\0" \
-"ramdisk=rootfs.cpio.uboot\0" \
+"scraddr=" __stringify(LOAD_OFFSET(0000000)) "\0" \
+"cfgaddr=" __stringify(LOAD_OFFSET(0020000)) "\0" \
+"dtbaddr=" __stringify(LOAD_OFFSET(0040000)) "\0" \
+"loadaddr=" __stringify(LOAD_OFFSET(0100000)) "\0" \
+"ramaddr=" __stringify(LOAD_OFFSET(2000000)) "\0" \
"console=ttyO0,115200n8\0" \
"optargs=consoleblank=0 quiet panic=2\0" \
-"nfsroot=/tftpboot/tseries/rootfs-small\0" \
-"nfsopts=nolock\0" \
-"ramargs=setenv bootargs ${optargs} console=${console} root=/dev/ram0\0" \
-"netargs=setenv bootargs console=${console} " \
- "${optargs} " \
- "root=/dev/nfs " \
- "nfsroot=${serverip}:${nfsroot},${nfsopts} rw " \
- "ip=dhcp\0" \
-"netboot=echo Booting from network ...; " \
- "dhcp; " \
- "tftp ${loadaddr} ${kernel}; " \
- "tftp ${dtbaddr} ${dtb}; " \
- "run netargs; " \
- "bootz ${loadaddr} - ${dtbaddr}\0" \
-"ramboot=echo Booting from network into RAM ...; "\
- "if dhcp; then; " \
- "tftp ${loadaddr} ${kernel}; " \
- "tftp ${ramaddr} ${ramdisk}; " \
- "if ext4load ${dtbdev} ${dtbpart} ${dtbaddr} /${dtb}; " \
- "then; else tftp ${dtbaddr} ${dtb}; fi;" \
- "run mmcroot0; " \
- "bootz ${loadaddr} ${ramaddr} ${dtbaddr}; fi;\0" \
-"netupdate=echo Updating UBOOT from Network (TFTP) ...; " \
- "setenv autoload 0; " \
- "dhcp && tftp 0x80000000 updateUBOOT.img && source;\0" \
-NANDARGS \
-MMCARGS
+"b_break=0\0" \
+"b_usb0=usb start && load usb 0 ${scraddr} bootscr.img && source ${scraddr}\0" \
+"b_net=tftp ${scraddr} netscript.img && source ${scraddr}\0" \
+MMCTGTS \
+SPITGTS \
+NANDTGTS \
+"b_deftgts=if test ${b_mode} = 12; then setenv b_tgts ${b_tgts_pme};" \
+" elif test ${b_mode} = 0; then setenv b_tgts ${b_tgts_rcy};" \
+" else setenv b_tgts ${b_tgts_std}; fi\0" \
+"b_default=run b_deftgts; for target in ${b_tgts};"\
+" do echo \"### booting ${target} ###\"; run b_${target};" \
+" if test ${b_break} = 1; then; exit; fi; done\0"
#endif /* !CONFIG_SPL_BUILD*/
-#define CONFIG_BOOTCOMMAND \
- "mmc dev 1; run defboot;"
-
#ifdef CONFIG_NAND
/*
* GPMC block. We support 1 device and the physical address to