summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorNobuhiro Iwamatsu <iwamatsu@nigauri.org>2007-09-23 01:29:43 +0900
committerNobuhiro Iwamatsu <iwamatsu@nigauri.org>2007-09-23 01:29:43 +0900
commitb8685affe614ccf5f4ec66252b30e2e524d18948 (patch)
tree05bc55b8a4a0451e6500f1f52651d81c0f48f012 /common
parent69df3c4da0c93017cceb25a366e794570bd0ed98 (diff)
parent66dcad3a9a53e0766d90e0084123bd8529522fb0 (diff)
downloadu-boot-imx-b8685affe614ccf5f4ec66252b30e2e524d18948.zip
u-boot-imx-b8685affe614ccf5f4ec66252b30e2e524d18948.tar.gz
u-boot-imx-b8685affe614ccf5f4ec66252b30e2e524d18948.tar.bz2
Merge git://www.denx.de/git/u-boot
Conflicts: CREDITS
Diffstat (limited to 'common')
-rw-r--r--common/Makefile6
-rw-r--r--common/bedbug.c4
-rw-r--r--common/cmd_autoscript.c14
-rw-r--r--common/cmd_bdinfo.c75
-rw-r--r--common/cmd_bedbug.c4
-rw-r--r--common/cmd_bmp.c4
-rw-r--r--common/cmd_bootm.c351
-rw-r--r--common/cmd_cache.c4
-rw-r--r--common/cmd_console.c4
-rw-r--r--common/cmd_date.c4
-rw-r--r--common/cmd_dcr.c4
-rw-r--r--common/cmd_diag.c4
-rw-r--r--common/cmd_display.c4
-rw-r--r--common/cmd_doc.c30
-rw-r--r--common/cmd_dtt.c4
-rw-r--r--common/cmd_eeprom.c15
-rw-r--r--common/cmd_elf.c6
-rw-r--r--common/cmd_ext2.c6
-rw-r--r--common/cmd_fat.c4
-rw-r--r--common/cmd_fdc.c16
-rw-r--r--common/cmd_fdos.c4
-rw-r--r--common/cmd_fdt.c619
-rw-r--r--common/cmd_flash.c20
-rw-r--r--common/cmd_fpga.c6
-rw-r--r--common/cmd_i2c.c18
-rw-r--r--common/cmd_ide.c118
-rw-r--r--common/cmd_immap.c4
-rw-r--r--common/cmd_itest.c4
-rw-r--r--common/cmd_jffs2.c16
-rw-r--r--common/cmd_load.c42
-rw-r--r--common/cmd_log.c120
-rw-r--r--common/cmd_mem.c21
-rw-r--r--common/cmd_mfsl.c417
-rw-r--r--common/cmd_mii.c6
-rw-r--r--common/cmd_misc.c10
-rw-r--r--common/cmd_mmc.c4
-rw-r--r--common/cmd_nand.c113
-rw-r--r--common/cmd_net.c50
-rw-r--r--common/cmd_nvedit.c52
-rw-r--r--common/cmd_pci.c4
-rw-r--r--common/cmd_pcmcia.c8
-rw-r--r--common/cmd_portio.c4
-rw-r--r--common/cmd_reginfo.c7
-rw-r--r--common/cmd_reiser.c10
-rw-r--r--common/cmd_sata.c712
-rw-r--r--common/cmd_scsi.c4
-rw-r--r--common/cmd_spi.c4
-rw-r--r--common/cmd_universe.c4
-rw-r--r--common/cmd_usb.c6
-rw-r--r--common/cmd_vfd.c4
-rw-r--r--common/cmd_ximg.c4
-rw-r--r--common/command.c6
-rw-r--r--common/docecc.c4
-rw-r--r--common/env_common.c9
-rw-r--r--common/env_flash.c24
-rw-r--r--common/env_nand.c4
-rw-r--r--common/environment.c13
-rw-r--r--common/exports.c6
-rw-r--r--common/fdt_support.c102
-rw-r--r--common/flash.c10
-rw-r--r--common/hush.c4
-rw-r--r--common/kgdb.c4
-rw-r--r--common/lcd.c4
-rw-r--r--common/main.c30
-rw-r--r--common/miiphyutil.c4
-rw-r--r--common/serial.c13
-rw-r--r--common/soft_i2c.c5
-rw-r--r--common/soft_spi.c2
-rw-r--r--common/usb.c4
-rw-r--r--common/usb_kbd.c6
-rw-r--r--common/usb_storage.c4
71 files changed, 2301 insertions, 935 deletions
diff --git a/common/Makefile b/common/Makefile
index 5dfd3a8..ef7d097 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -38,8 +38,8 @@ COBJS = main.o ACEX1K.o altera.o bedbug.o circbuf.o cmd_autoscript.o \
cmd_mem.o cmd_mii.o cmd_misc.o cmd_mmc.o \
cmd_nand.o cmd_net.o cmd_nvedit.o \
cmd_pci.o cmd_pcmcia.o cmd_portio.o \
- cmd_reginfo.o cmd_reiser.o cmd_scsi.o cmd_spi.o cmd_universe.o \
- cmd_usb.o cmd_vfd.o \
+ cmd_reginfo.o cmd_reiser.o cmd_sata.o cmd_scsi.o cmd_spi.o \
+ cmd_universe.o cmd_usb.o cmd_vfd.o \
command.o console.o cyclon2.o devices.o dlmalloc.o docecc.o \
environment.o env_common.o \
env_nand.o env_dataflash.o env_flash.o env_eeprom.o \
@@ -50,7 +50,7 @@ COBJS = main.o ACEX1K.o altera.o bedbug.o circbuf.o cmd_autoscript.o \
memsize.o miiphybb.o miiphyutil.o \
s_record.o serial.o soft_i2c.o soft_spi.o spartan2.o spartan3.o \
usb.o usb_kbd.o usb_storage.o \
- virtex2.o xilinx.o crc16.o xyzModem.o cmd_mac.o
+ virtex2.o xilinx.o crc16.o xyzModem.o cmd_mac.o cmd_mfsl.o
SRCS := $(AOBJS:.o=.S) $(COBJS:.o=.c)
OBJS := $(addprefix $(obj),$(AOBJS) $(COBJS))
diff --git a/common/bedbug.c b/common/bedbug.c
index 6966de7..3bf1fc3 100644
--- a/common/bedbug.c
+++ b/common/bedbug.c
@@ -2,7 +2,7 @@
#include <common.h>
-#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)
+#if defined(CONFIG_CMD_BEDBUG)
#include <linux/ctype.h>
#include <bedbug/bedbug.h>
@@ -1253,4 +1253,4 @@ int find_next_address (unsigned char *nextaddr, int step_over,
* purpose.
*/
-#endif /* CONFIG_COMMANDS & CFG_CMD_BEDBUG */
+#endif
diff --git a/common/cmd_autoscript.c b/common/cmd_autoscript.c
index e325302..a6038a6 100644
--- a/common/cmd_autoscript.c
+++ b/common/cmd_autoscript.c
@@ -47,8 +47,7 @@
#include <hush.h>
#endif
-#if defined(CONFIG_AUTOSCRIPT) || \
- (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT )
+#if defined(CONFIG_AUTOSCRIPT) || defined(CONFIG_CMD_AUTOSCRIPT)
extern image_header_t header; /* from cmd_bootm.c */
int
@@ -150,9 +149,10 @@ autoscript (ulong addr)
return rcode;
}
-#endif /* CONFIG_AUTOSCRIPT || CFG_CMD_AUTOSCRIPT */
+#endif
+
/**************************************************/
-#if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT)
+#if defined(CONFIG_CMD_AUTOSCRIPT)
int
do_autoscript (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
@@ -170,13 +170,13 @@ do_autoscript (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return rcode;
}
-#if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT)
+#if defined(CONFIG_CMD_AUTOSCRIPT)
U_BOOT_CMD(
autoscr, 2, 0, do_autoscript,
"autoscr - run script from memory\n",
"[addr] - run script starting at addr"
" - A valid autoscr header must be present\n"
);
-#endif /* CFG_CMD_AUTOSCRIPT */
+#endif
-#endif /* CONFIG_AUTOSCRIPT || CFG_CMD_AUTOSCRIPT */
+#endif
diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
index d97c09e..ef15a00 100644
--- a/common/cmd_bdinfo.c
+++ b/common/cmd_bdinfo.c
@@ -30,7 +30,7 @@
DECLARE_GLOBAL_DATA_PTR;
-#if (CONFIG_COMMANDS & CFG_CMD_BDI)
+#if defined(CONFIG_CMD_BDI)
static void print_num(const char *, ulong);
#ifndef CONFIG_ARM /* PowerPC and other */
@@ -167,7 +167,7 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
print_num ("sram size", (ulong)bd->bi_sramsize);
#endif
-#if defined(CFG_CMD_NET)
+#if defined(CONFIG_CMD_NET)
puts ("ethaddr =");
for (i=0; i<6; ++i) {
printf ("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]);
@@ -195,7 +195,7 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
print_num ("sram start ", (ulong)bd->bi_sramstart);
print_num ("sram size ", (ulong)bd->bi_sramsize);
#endif
-#if defined(CFG_CMD_NET)
+#if defined(CONFIG_CMD_NET)
puts ("ethaddr =");
for (i=0; i<6; ++i) {
printf ("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]);
@@ -207,6 +207,71 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return 0;
}
+#elif defined(CONFIG_M68K) /* M68K */
+static void print_str(const char *, const char *);
+
+int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+ int i;
+ bd_t *bd = gd->bd;
+ char buf[32];
+
+ print_num ("memstart", (ulong)bd->bi_memstart);
+ print_num ("memsize", (ulong)bd->bi_memsize);
+ print_num ("flashstart", (ulong)bd->bi_flashstart);
+ print_num ("flashsize", (ulong)bd->bi_flashsize);
+ print_num ("flashoffset", (ulong)bd->bi_flashoffset);
+#if defined(CFG_INIT_RAM_ADDR)
+ print_num ("sramstart", (ulong)bd->bi_sramstart);
+ print_num ("sramsize", (ulong)bd->bi_sramsize);
+#endif
+#if defined(CFG_MBAR)
+ print_num ("mbar", bd->bi_mbar_base);
+#endif
+ print_str ("busfreq", strmhz(buf, bd->bi_busfreq));
+#ifdef CONFIG_PCI
+ print_str ("pcifreq", strmhz(buf, bd->bi_pcifreq));
+#endif
+#ifdef CONFIG_EXTRA_CLOCK
+ print_str ("flbfreq", strmhz(buf, bd->bi_flbfreq));
+ print_str ("inpfreq", strmhz(buf, bd->bi_inpfreq));
+ print_str ("vcofreq", strmhz(buf, bd->bi_vcofreq));
+#endif
+#if defined(CONFIG_CMD_NET)
+ puts ("ethaddr =");
+ for (i=0; i<6; ++i) {
+ printf ("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]);
+ }
+
+#if defined(CONFIG_HAS_ETH1)
+ puts ("\neth1addr =");
+ for (i=0; i<6; ++i) {
+ printf ("%c%02X", i ? ':' : ' ', bd->bi_enet1addr[i]);
+ }
+#endif
+
+#if defined(CONFIG_HAS_ETH2)
+ puts ("\neth2addr =");
+ for (i=0; i<6; ++i) {
+ printf ("%c%02X", i ? ':' : ' ', bd->bi_enet2addr[i]);
+ }
+#endif
+
+#if defined(CONFIG_HAS_ETH3)
+ puts ("\neth3addr =");
+ for (i=0; i<6; ++i) {
+ printf ("%c%02X", i ? ':' : ' ', bd->bi_enet3addr[i]);
+ }
+#endif
+
+ puts ("\nip_addr = ");
+ print_IPaddr (bd->bi_ip_addr);
+#endif
+ printf ("\nbaudrate = %d bps\n", bd->bi_baudrate);
+
+ return 0;
+}
+
#else /* ! PPC, which leaves MIPS */
int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
@@ -270,7 +335,7 @@ static void print_num(const char *name, ulong value)
printf ("%-12s= 0x%08lX\n", name, value);
}
-#ifdef CONFIG_PPC
+#if defined(CONFIG_PPC) || defined(CONFIG_M68K)
static void print_str(const char *name, const char *str)
{
printf ("%-12s= %6s MHz\n", name, str);
@@ -285,4 +350,4 @@ U_BOOT_CMD(
"bdinfo - print Board Info structure\n",
NULL
);
-#endif /* CFG_CMD_BDI */
+#endif
diff --git a/common/cmd_bedbug.c b/common/cmd_bedbug.c
index 48086a6..1c3547a 100644
--- a/common/cmd_bedbug.c
+++ b/common/cmd_bedbug.c
@@ -13,7 +13,7 @@
DECLARE_GLOBAL_DATA_PTR;
-#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)
+#if defined(CONFIG_CMD_BEDBUG)
#ifndef MAX
#define MAX(a,b) ((a) > (b) ? (a) : (b))
@@ -413,7 +413,7 @@ int do_bedbug_rdump (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
U_BOOT_CMD (rdump, 1, 1, do_bedbug_rdump,
"rdump - Show registers.\n", " - Show registers.\n");
/* ====================================================================== */
-#endif /* CFG_CMD_BEDBUG */
+#endif
/*
diff --git a/common/cmd_bmp.c b/common/cmd_bmp.c
index ad412c8..241aa83 100644
--- a/common/cmd_bmp.c
+++ b/common/cmd_bmp.c
@@ -31,7 +31,7 @@
#include <asm/byteorder.h>
#include <malloc.h>
-#if (CONFIG_COMMANDS & CFG_CMD_BMP)
+#if defined(CONFIG_CMD_BMP)
static int bmp_info (ulong addr);
static int bmp_display (ulong addr, int x, int y);
@@ -188,4 +188,4 @@ static int bmp_display(ulong addr, int x, int y)
#endif
}
-#endif /* (CONFIG_COMMANDS & CFG_CMD_BMP) */
+#endif /* defined(CONFIG_CMD_BMP) */
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 8af0589..2fa906b 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -45,10 +45,10 @@
DECLARE_GLOBAL_DATA_PTR;
- /*cmd_boot.c*/
- extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
+/*cmd_boot.c*/
+extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
-#if (CONFIG_COMMANDS & CFG_CMD_DATE) || defined(CONFIG_TIMESTAMP)
+#if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
#include <rtc.h>
#endif
@@ -56,13 +56,6 @@ DECLARE_GLOBAL_DATA_PTR;
#include <hush.h>
#endif
-#ifdef CONFIG_SHOW_BOOT_PROGRESS
-# include <status_led.h>
-# define SHOW_BOOT_PROGRESS(arg) show_boot_progress(arg)
-#else
-# define SHOW_BOOT_PROGRESS(arg)
-#endif
-
#ifdef CFG_INIT_RAM_LOCK
#include <asm/cache.h>
#endif
@@ -89,11 +82,11 @@ int gunzip (void *, int, unsigned char *, unsigned long *);
static void *zalloc(void *, unsigned, unsigned);
static void zfree(void *, void *, unsigned);
-#if (CONFIG_COMMANDS & CFG_CMD_IMI)
+#if defined(CONFIG_CMD_IMI)
static int image_info (unsigned long addr);
#endif
-#if (CONFIG_COMMANDS & CFG_CMD_IMLS)
+#if defined(CONFIG_CMD_IMLS)
#include <flash.h>
extern flash_info_t flash_info[]; /* info for FLASH chips */
static int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
@@ -133,12 +126,12 @@ static void fixup_silent_linux (void);
#endif
static boot_os_Fcn do_bootm_netbsd;
static boot_os_Fcn do_bootm_rtems;
-#if (CONFIG_COMMANDS & CFG_CMD_ELF)
+#if defined(CONFIG_CMD_ELF)
static boot_os_Fcn do_bootm_vxworks;
static boot_os_Fcn do_bootm_qnxelf;
int do_bootvx ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[] );
int do_bootelf (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[] );
-#endif /* CFG_CMD_ELF */
+#endif
#if defined(CONFIG_ARTOS) && defined(CONFIG_PPC)
static boot_os_Fcn do_bootm_artos;
#endif
@@ -176,7 +169,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
addr = simple_strtoul(argv[1], NULL, 16);
}
- SHOW_BOOT_PROGRESS (1);
+ show_boot_progress (1);
printf ("## Booting image at %08lx ...\n", addr);
/* Copy header so we can blank CRC field for re-calculation */
@@ -200,11 +193,11 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
#endif /* __I386__ */
{
puts ("Bad Magic Number\n");
- SHOW_BOOT_PROGRESS (-1);
+ show_boot_progress (-1);
return 1;
}
}
- SHOW_BOOT_PROGRESS (2);
+ show_boot_progress (2);
data = (ulong)&header;
len = sizeof(image_header_t);
@@ -214,10 +207,10 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (crc32 (0, (uchar *)data, len) != checksum) {
puts ("Bad Header Checksum\n");
- SHOW_BOOT_PROGRESS (-2);
+ show_boot_progress (-2);
return 1;
}
- SHOW_BOOT_PROGRESS (3);
+ show_boot_progress (3);
#ifdef CONFIG_HAS_DATAFLASH
if (addr_dataflash(addr)){
@@ -238,12 +231,12 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
puts (" Verifying Checksum ... ");
if (crc32 (0, (uchar *)data, len) != ntohl(hdr->ih_dcrc)) {
printf ("Bad Data CRC\n");
- SHOW_BOOT_PROGRESS (-3);
+ show_boot_progress (-3);
return 1;
}
puts ("OK\n");
}
- SHOW_BOOT_PROGRESS (4);
+ show_boot_progress (4);
len_ptr = (ulong *)data;
@@ -274,10 +267,10 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
#endif
{
printf ("Unsupported Architecture 0x%x\n", hdr->ih_arch);
- SHOW_BOOT_PROGRESS (-4);
+ show_boot_progress (-4);
return 1;
}
- SHOW_BOOT_PROGRESS (5);
+ show_boot_progress (5);
switch (hdr->ih_type) {
case IH_TYPE_STANDALONE:
@@ -299,10 +292,10 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
data += 4;
break;
default: printf ("Wrong Image Type for %s command\n", cmdtp->name);
- SHOW_BOOT_PROGRESS (-5);
+ show_boot_progress (-5);
return 1;
}
- SHOW_BOOT_PROGRESS (6);
+ show_boot_progress (6);
/*
* We have reached the point of no return: we are going to
@@ -353,7 +346,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (gunzip ((void *)ntohl(hdr->ih_load), unc_len,
(uchar *)data, &len) != 0) {
puts ("GUNZIP ERROR - must RESET board to recover\n");
- SHOW_BOOT_PROGRESS (-6);
+ show_boot_progress (-6);
do_reset (cmdtp, flag, argc, argv);
}
break;
@@ -370,8 +363,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
CFG_MALLOC_LEN < (4096 * 1024), 0);
if (i != BZ_OK) {
printf ("BUNZIP2 ERROR %d - must RESET board to recover\n", i);
- SHOW_BOOT_PROGRESS (-6);
- udelay(100000);
+ show_boot_progress (-6);
do_reset (cmdtp, flag, argc, argv);
}
break;
@@ -380,11 +372,11 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (iflag)
enable_interrupts();
printf ("Unimplemented compression type %d\n", hdr->ih_comp);
- SHOW_BOOT_PROGRESS (-7);
+ show_boot_progress (-7);
return 1;
}
puts ("OK\n");
- SHOW_BOOT_PROGRESS (7);
+ show_boot_progress (7);
switch (hdr->ih_type) {
case IH_TYPE_STANDALONE:
@@ -411,10 +403,10 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (iflag)
enable_interrupts();
printf ("Can't boot image type %d\n", hdr->ih_type);
- SHOW_BOOT_PROGRESS (-8);
+ show_boot_progress (-8);
return 1;
}
- SHOW_BOOT_PROGRESS (8);
+ show_boot_progress (8);
switch (hdr->ih_os) {
default: /* handled by (original) Linux case */
@@ -442,7 +434,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
addr, len_ptr, verify);
break;
-#if (CONFIG_COMMANDS & CFG_CMD_ELF)
+#if defined(CONFIG_CMD_ELF)
case IH_OS_VXWORKS:
do_bootm_vxworks (cmdtp, flag, argc, argv,
addr, len_ptr, verify);
@@ -451,7 +443,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
do_bootm_qnxelf (cmdtp, flag, argc, argv,
addr, len_ptr, verify);
break;
-#endif /* CFG_CMD_ELF */
+#endif
#ifdef CONFIG_ARTOS
case IH_OS_ARTOS:
do_bootm_artos (cmdtp, flag, argc, argv,
@@ -460,7 +452,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
#endif
}
- SHOW_BOOT_PROGRESS (-9);
+ show_boot_progress (-9);
#ifdef DEBUG
puts ("\n## Control returned to monitor - resetting...\n");
do_reset (cmdtp, flag, argc, argv);
@@ -639,7 +631,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
#endif
if (argc >= 3) {
debug ("Not skipping initrd\n");
- SHOW_BOOT_PROGRESS (9);
+ show_boot_progress (9);
addr = simple_strtoul(argv[2], NULL, 16);
@@ -650,7 +642,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
if (ntohl(hdr->ih_magic) != IH_MAGIC) {
puts ("Bad Magic Number\n");
- SHOW_BOOT_PROGRESS (-10);
+ show_boot_progress (-10);
do_reset (cmdtp, flag, argc, argv);
}
@@ -662,11 +654,11 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
if (crc32 (0, (uchar *)data, len) != checksum) {
puts ("Bad Header Checksum\n");
- SHOW_BOOT_PROGRESS (-11);
+ show_boot_progress (-11);
do_reset (cmdtp, flag, argc, argv);
}
- SHOW_BOOT_PROGRESS (10);
+ show_boot_progress (10);
print_image_hdr (hdr);
@@ -699,19 +691,19 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
if (csum != ntohl(hdr->ih_dcrc)) {
puts ("Bad Data CRC\n");
- SHOW_BOOT_PROGRESS (-12);
+ show_boot_progress (-12);
do_reset (cmdtp, flag, argc, argv);
}
puts ("OK\n");
}
- SHOW_BOOT_PROGRESS (11);
+ show_boot_progress (11);
if ((hdr->ih_os != IH_OS_LINUX) ||
(hdr->ih_arch != IH_CPU_PPC) ||
(hdr->ih_type != IH_TYPE_RAMDISK) ) {
puts ("No Linux PPC Ramdisk Image\n");
- SHOW_BOOT_PROGRESS (-13);
+ show_boot_progress (-13);
do_reset (cmdtp, flag, argc, argv);
}
@@ -722,7 +714,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
u_long tail = ntohl(len_ptr[0]) % 4;
int i;
- SHOW_BOOT_PROGRESS (13);
+ show_boot_progress (13);
/* skip kernel length and terminator */
data = (ulong)(&len_ptr[2]);
@@ -741,7 +733,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
/*
* no initrd image
*/
- SHOW_BOOT_PROGRESS (14);
+ show_boot_progress (14);
len = data = 0;
}
@@ -750,59 +742,65 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
if(argc > 3) {
of_flat_tree = (char *) simple_strtoul(argv[3], NULL, 16);
hdr = (image_header_t *)of_flat_tree;
-#if defined(CONFIG_OF_LIBFDT)
- if (fdt_check_header(of_flat_tree) == 0) {
+#if defined(CONFIG_OF_FLAT_TREE)
+ if (*((ulong *)(of_flat_tree + sizeof(image_header_t))) != OF_DT_HEADER) {
#else
- if (*(ulong *)of_flat_tree == OF_DT_HEADER) {
+ if (fdt_check_header(of_flat_tree + sizeof(image_header_t)) != 0) {
#endif
#ifndef CFG_NO_FLASH
if (addr2info((ulong)of_flat_tree) != NULL)
of_data = (ulong)of_flat_tree;
#endif
} else if (ntohl(hdr->ih_magic) == IH_MAGIC) {
- printf("## Flat Device Tree Image at %08lX\n", hdr);
+ printf("## Flat Device Tree at %08lX\n", hdr);
print_image_hdr(hdr);
if ((ntohl(hdr->ih_load) < ((unsigned long)hdr + ntohl(hdr->ih_size) + sizeof(hdr))) &&
((ntohl(hdr->ih_load) + ntohl(hdr->ih_size)) > (unsigned long)hdr)) {
- printf ("ERROR: Load address overwrites Flat Device Tree uImage\n");
- return;
+ puts ("ERROR: fdt overwritten - "
+ "must RESET the board to recover.\n");
+ do_reset (cmdtp, flag, argc, argv);
}
- printf(" Verifying Checksum ... ");
+ puts (" Verifying Checksum ... ");
memmove (&header, (char *)hdr, sizeof(image_header_t));
checksum = ntohl(header.ih_hcrc);
header.ih_hcrc = 0;
if(checksum != crc32(0, (uchar *)&header, sizeof(image_header_t))) {
- printf("ERROR: Flat Device Tree header checksum is invalid\n");
- return;
+ puts ("ERROR: fdt header checksum invalid - "
+ "must RESET the board to recover.\n");
+ do_reset (cmdtp, flag, argc, argv);
}
checksum = ntohl(hdr->ih_dcrc);
addr = (ulong)((uchar *)(hdr) + sizeof(image_header_t));
if(checksum != crc32(0, (uchar *)addr, ntohl(hdr->ih_size))) {
- printf("ERROR: Flat Device Tree checksum is invalid\n");
- return;
+ puts ("ERROR: fdt checksum invalid - "
+ "must RESET the board to recover.\n");
+ do_reset (cmdtp, flag, argc, argv);
}
- printf("OK\n");
+ puts ("OK\n");
if (ntohl(hdr->ih_type) != IH_TYPE_FLATDT) {
- printf ("ERROR: uImage not Flat Device Tree type\n");
- return;
+ puts ("ERROR: uImage is not a fdt - "
+ "must RESET the board to recover.\n");
+ do_reset (cmdtp, flag, argc, argv);
}
if (ntohl(hdr->ih_comp) != IH_COMP_NONE) {
- printf("ERROR: uImage is not uncompressed\n");
- return;
+ puts ("ERROR: uImage is compressed - "
+ "must RESET the board to recover.\n");
+ do_reset (cmdtp, flag, argc, argv);
}
-#if defined(CONFIG_OF_LIBFDT)
- if (fdt_check_header(of_flat_tree + sizeof(image_header_t)) == 0) {
-#else
+#if defined(CONFIG_OF_FLAT_TREE)
if (*((ulong *)(of_flat_tree + sizeof(image_header_t))) != OF_DT_HEADER) {
+#else
+ if (fdt_check_header(of_flat_tree + sizeof(image_header_t)) != 0) {
#endif
- printf ("ERROR: uImage data is not a flat device tree\n");
- return;
+ puts ("ERROR: uImage data is not a fdt - "
+ "must RESET the board to recover.\n");
+ do_reset (cmdtp, flag, argc, argv);
}
memmove((void *)ntohl(hdr->ih_load),
@@ -810,49 +808,61 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
ntohl(hdr->ih_size));
of_flat_tree = (char *)ntohl(hdr->ih_load);
} else {
- printf ("Did not find a flat flat device tree at address %08lX\n", of_flat_tree);
- return;
+ puts ("Did not find a flat Flat Device Tree.\n"
+ "Must RESET the board to recover.\n");
+ do_reset (cmdtp, flag, argc, argv);
}
- printf (" Booting using flat device tree at 0x%x\n",
+ printf (" Booting using the fdt at 0x%x\n",
of_flat_tree);
} else if ((hdr->ih_type==IH_TYPE_MULTI) && (len_ptr[1]) && (len_ptr[2])) {
u_long tail = ntohl(len_ptr[0]) % 4;
int i;
/* skip kernel length, initrd length, and terminator */
- of_data = (ulong)(&len_ptr[3]);
+ of_flat_tree = (char *)(&len_ptr[3]);
/* skip any additional image length fields */
for (i=2; len_ptr[i]; ++i)
- of_data += 4;
+ of_flat_tree += 4;
/* add kernel length, and align */
- of_data += ntohl(len_ptr[0]);
+ of_flat_tree += ntohl(len_ptr[0]);
if (tail) {
- of_data += 4 - tail;
+ of_flat_tree += 4 - tail;
}
/* add initrd length, and align */
tail = ntohl(len_ptr[1]) % 4;
- of_data += ntohl(len_ptr[1]);
+ of_flat_tree += ntohl(len_ptr[1]);
if (tail) {
- of_data += 4 - tail;
+ of_flat_tree += 4 - tail;
}
-#if defined(CONFIG_OF_LIBFDT)
- if (fdt_check_header((void *)of_data) != 0) {
+#ifndef CFG_NO_FLASH
+ /* move the blob if it is in flash (set of_data to !null) */
+ if (addr2info ((ulong)of_flat_tree) != NULL)
+ of_data = (ulong)of_flat_tree;
+#endif
+
+
+#if defined(CONFIG_OF_FLAT_TREE)
+ if (*((ulong *)(of_flat_tree)) != OF_DT_HEADER) {
#else
- if (((struct boot_param_header *)of_data)->magic != OF_DT_HEADER) {
+ if (fdt_check_header (of_flat_tree) != 0) {
#endif
- printf ("ERROR: image is not a flat device tree\n");
- return;
+ puts ("ERROR: image is not a fdt - "
+ "must RESET the board to recover.\n");
+ do_reset (cmdtp, flag, argc, argv);
}
-#if defined(CONFIG_OF_LIBFDT)
- if (be32_to_cpu(fdt_totalsize(of_data)) != ntohl(len_ptr[2])) {
+#if defined(CONFIG_OF_FLAT_TREE)
+ if (((struct boot_param_header *)of_flat_tree)->totalsize !=
+ ntohl (len_ptr[2])) {
#else
- if (((struct boot_param_header *)of_data)->totalsize != ntohl(len_ptr[2])) {
+ if (be32_to_cpu (fdt_totalsize (of_flat_tree)) !=
+ ntohl(len_ptr[2])) {
#endif
- printf ("ERROR: flat device tree size does not agree with image\n");
- return;
+ puts ("ERROR: fdt size != image size - "
+ "must RESET the board to recover.\n");
+ do_reset (cmdtp, flag, argc, argv);
}
}
#endif
@@ -892,7 +902,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
initrd_start = nsp;
}
- SHOW_BOOT_PROGRESS (12);
+ show_boot_progress (12);
debug ("## initrd at 0x%08lX ... 0x%08lX (len=%ld=0x%lX)\n",
data, data + len - 1, len, len);
@@ -925,27 +935,26 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
initrd_end = 0;
}
- debug ("## Transferring control to Linux (at address %08lx) ...\n",
- (ulong)kernel);
-
- SHOW_BOOT_PROGRESS (15);
+#if defined(CONFIG_OF_LIBFDT)
-#if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500)
- unlock_ram_in_cache();
+#ifdef CFG_BOOTMAPSZ
+ /*
+ * The blob must be within CFG_BOOTMAPSZ,
+ * so we flag it to be copied if it is not.
+ */
+ if (of_flat_tree >= (char *)CFG_BOOTMAPSZ)
+ of_data = (ulong)of_flat_tree;
#endif
-#if defined(CONFIG_OF_LIBFDT)
/* move of_flat_tree if needed */
if (of_data) {
int err;
ulong of_start, of_len;
of_len = be32_to_cpu(fdt_totalsize(of_data));
- /* position on a 4K boundary before the initrd/kbd */
- if (initrd_start)
- of_start = initrd_start - of_len;
- else
- of_start = (ulong)kbd - of_len;
+
+ /* position on a 4K boundary before the kbd */
+ of_start = (ulong)kbd - of_len;
of_start &= ~(4096 - 1); /* align on page */
debug ("## device tree at 0x%08lX ... 0x%08lX (len=%ld=0x%lX)\n",
of_data, of_data + of_len - 1, of_len, of_len);
@@ -953,42 +962,61 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
of_flat_tree = (char *)of_start;
printf (" Loading Device Tree to %08lx, end %08lx ... ",
of_start, of_start + of_len - 1);
- err = fdt_open_into((void *)of_start, (void *)of_data, of_len);
+ err = fdt_open_into((void *)of_data, (void *)of_start, of_len);
if (err != 0) {
- printf ("libfdt: %s " __FILE__ " %d\n", fdt_strerror(err), __LINE__);
+ puts ("ERROR: fdt move failed - "
+ "must RESET the board to recover.\n");
+ do_reset (cmdtp, flag, argc, argv);
}
- /*
- * Add the chosen node if it doesn't exist, add the env and bd_t
- * if the user wants it (the logic is in the subroutines).
- */
+ puts ("OK\n");
+ }
+ /*
+ * Add the chosen node if it doesn't exist, add the env and bd_t
+ * if the user wants it (the logic is in the subroutines).
+ */
+ if (of_flat_tree) {
if (fdt_chosen(of_flat_tree, initrd_start, initrd_end, 0) < 0) {
- printf("Failed creating the /chosen node (0x%08X), aborting.\n", of_flat_tree);
- return;
+ puts ("ERROR: /chosen node create failed - "
+ "must RESET the board to recover.\n");
+ do_reset (cmdtp, flag, argc, argv);
}
#ifdef CONFIG_OF_HAS_UBOOT_ENV
if (fdt_env(of_flat_tree) < 0) {
- printf("Failed creating the /u-boot-env node, aborting.\n");
- return;
+ puts ("ERROR: /u-boot-env node create failed - "
+ "must RESET the board to recover.\n");
+ do_reset (cmdtp, flag, argc, argv);
}
#endif
#ifdef CONFIG_OF_HAS_BD_T
if (fdt_bd_t(of_flat_tree) < 0) {
- printf("Failed creating the /bd_t node, aborting.\n");
- return;
+ puts ("ERROR: /bd_t node create failed - "
+ "must RESET the board to recover.\n");
+ do_reset (cmdtp, flag, argc, argv);
}
#endif
- }
+#ifdef CONFIG_OF_BOARD_SETUP
+ /* Call the board-specific fixup routine */
+ ft_board_setup(of_flat_tree, gd->bd);
#endif
+ }
+#endif /* CONFIG_OF_LIBFDT */
#if defined(CONFIG_OF_FLAT_TREE)
+#ifdef CFG_BOOTMAPSZ
+ /*
+ * The blob must be within CFG_BOOTMAPSZ,
+ * so we flag it to be copied if it is not.
+ */
+ if (of_flat_tree >= (char *)CFG_BOOTMAPSZ)
+ of_data = (ulong)of_flat_tree;
+#endif
+
/* move of_flat_tree if needed */
if (of_data) {
ulong of_start, of_len;
of_len = ((struct boot_param_header *)of_data)->totalsize;
+
/* provide extra 8k pad */
- if (initrd_start)
- of_start = initrd_start - of_len - 8192;
- else
- of_start = (ulong)kbd - of_len - 8192;
+ of_start = (ulong)kbd - of_len - 8192;
of_start &= ~(4096 - 1); /* align on page */
debug ("## device tree at 0x%08lX ... 0x%08lX (len=%ld=0x%lX)\n",
of_data, of_data + of_len - 1, of_len, of_len);
@@ -997,9 +1025,38 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
printf (" Loading Device Tree to %08lx, end %08lx ... ",
of_start, of_start + of_len - 1);
memmove ((void *)of_start, (void *)of_data, of_len);
+ puts ("OK\n");
}
+ /*
+ * Create the /chosen node and modify the blob with board specific
+ * values as needed.
+ */
+ ft_setup(of_flat_tree, kbd, initrd_start, initrd_end);
+ /* ft_dump_blob(of_flat_tree); */
+#endif
+ debug ("## Transferring control to Linux (at address %08lx) ...\n",
+ (ulong)kernel);
+
+ show_boot_progress (15);
+
+#if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500)
+ unlock_ram_in_cache();
#endif
+#if defined(CONFIG_OF_FLAT_TREE) || defined(CONFIG_OF_LIBFDT)
+ if (of_flat_tree) { /* device tree; boot new style */
+ /*
+ * Linux Kernel Parameters (passing device tree):
+ * r3: pointer to the fdt, followed by the board info data
+ * r4: physical pointer to the kernel itself
+ * r5: NULL
+ * r6: NULL
+ * r7: NULL
+ */
+ (*kernel) ((bd_t *)of_flat_tree, (ulong)kernel, 0, 0, 0);
+ /* does not return */
+ }
+#endif
/*
* Linux Kernel Parameters (passing board info data):
* r3: ptr to board info data
@@ -1008,46 +1065,8 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
* r6: Start of command line string
* r7: End of command line string
*/
-#if defined(CONFIG_OF_FLAT_TREE) || defined(CONFIG_OF_LIBFDT)
- if (!of_flat_tree) /* no device tree; boot old style */
-#endif
- (*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end);
- /* does not return */
-
-#if defined(CONFIG_OF_FLAT_TREE) || defined(CONFIG_OF_LIBFDT)
- /*
- * Linux Kernel Parameters (passing device tree):
- * r3: ptr to OF flat tree, followed by the board info data
- * r4: physical pointer to the kernel itself
- * r5: NULL
- * r6: NULL
- * r7: NULL
- */
-#if defined(CONFIG_OF_FLAT_TREE)
- ft_setup(of_flat_tree, kbd, initrd_start, initrd_end);
- /* ft_dump_blob(of_flat_tree); */
-#endif
-#if defined(CONFIG_OF_LIBFDT)
- if (fdt_chosen(of_flat_tree, initrd_start, initrd_end, 0) < 0) {
- printf("Failed creating the /chosen node (0x%08X), aborting.\n", of_flat_tree);
- return;
- }
-#ifdef CONFIG_OF_HAS_UBOOT_ENV
- if (fdt_env(of_flat_tree) < 0) {
- printf("Failed creating the /u-boot-env node, aborting.\n");
- return;
- }
-#endif
-#ifdef CONFIG_OF_HAS_BD_T
- if (fdt_bd_t(of_flat_tree) < 0) {
- printf("Failed creating the /bd_t node, aborting.\n");
- return;
- }
-#endif
-#endif /* if defined(CONFIG_OF_LIBFDT) */
-
- (*kernel) ((bd_t *)of_flat_tree, (ulong)kernel, 0, 0, 0);
-#endif
+ (*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end);
+ /* does not return */
}
#endif /* CONFIG_PPC */
@@ -1117,7 +1136,7 @@ do_bootm_netbsd (cmd_tbl_t *cmdtp, int flag,
printf ("## Transferring control to NetBSD stage-2 loader (at address %08lx) ...\n",
(ulong)loader);
- SHOW_BOOT_PROGRESS (15);
+ show_boot_progress (15);
/*
* NetBSD Stage-2 Loader Parameters:
@@ -1221,7 +1240,7 @@ do_bootm_artos (cmd_tbl_t *cmdtp, int flag,
#endif
-#if (CONFIG_COMMANDS & CFG_CMD_BOOTD)
+#if defined(CONFIG_CMD_BOOTD)
int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
int rcode = 0;
@@ -1249,7 +1268,7 @@ U_BOOT_CMD(
#endif
-#if (CONFIG_COMMANDS & CFG_CMD_IMI)
+#if defined(CONFIG_CMD_IMI)
int do_iminfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
int arg;
@@ -1317,9 +1336,9 @@ U_BOOT_CMD(
" image contents (magic number, header and payload checksums)\n"
);
-#endif /* CFG_CMD_IMI */
+#endif
-#if (CONFIG_COMMANDS & CFG_CMD_IMLS)
+#if defined(CONFIG_CMD_IMLS)
/*-----------------------------------------------------------------------
* List all images found in flash.
*/
@@ -1375,23 +1394,23 @@ U_BOOT_CMD(
" - Prints information about all images found at sector\n"
" boundaries in flash.\n"
);
-#endif /* CFG_CMD_IMLS */
+#endif
void
print_image_hdr (image_header_t *hdr)
{
-#if (CONFIG_COMMANDS & CFG_CMD_DATE) || defined(CONFIG_TIMESTAMP)
+#if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
time_t timestamp = (time_t)ntohl(hdr->ih_time);
struct rtc_time tm;
#endif
printf (" Image Name: %.*s\n", IH_NMLEN, hdr->ih_name);
-#if (CONFIG_COMMANDS & CFG_CMD_DATE) || defined(CONFIG_TIMESTAMP)
+#if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
to_tm (timestamp, &tm);
printf (" Created: %4d-%02d-%02d %2d:%02d:%02d UTC\n",
tm.tm_year, tm.tm_mon, tm.tm_mday,
tm.tm_hour, tm.tm_min, tm.tm_sec);
-#endif /* CFG_CMD_DATE, CONFIG_TIMESTAMP */
+#endif
puts (" Image Type: "); print_type(hdr);
printf ("\n Data Size: %d Bytes = ", ntohl(hdr->ih_size));
print_size (ntohl(hdr->ih_size), "\n");
@@ -1580,7 +1599,7 @@ do_bootm_rtems (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
printf ("## Transferring control to RTEMS (at address %08lx) ...\n",
(ulong)entry_point);
- SHOW_BOOT_PROGRESS (15);
+ show_boot_progress (15);
/*
* RTEMS Parameters:
@@ -1590,7 +1609,7 @@ do_bootm_rtems (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
(*entry_point ) ( gd->bd );
}
-#if (CONFIG_COMMANDS & CFG_CMD_ELF)
+#if defined(CONFIG_CMD_ELF)
static void
do_bootm_vxworks (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
ulong addr, ulong *len_ptr, int verify)
@@ -1616,7 +1635,7 @@ do_bootm_qnxelf (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
local_args[1] = str; /* and provide it via the arguments */
do_bootelf(cmdtp, 0, 2, local_args);
}
-#endif /* CFG_CMD_ELF */
+#endif
#ifdef CONFIG_LYNXKDI
static void
diff --git a/common/cmd_cache.c b/common/cmd_cache.c
index 6c250bc..675d43f 100644
--- a/common/cmd_cache.c
+++ b/common/cmd_cache.c
@@ -27,7 +27,7 @@
#include <common.h>
#include <command.h>
-#if (CONFIG_COMMANDS & CFG_CMD_CACHE)
+#if defined(CONFIG_CMD_CACHE)
static int on_off (const char *);
@@ -109,4 +109,4 @@ U_BOOT_CMD(
" - enable or disable data (writethrough) cache\n"
);
-#endif /* CFG_CMD_CACHE */
+#endif
diff --git a/common/cmd_console.c b/common/cmd_console.c
index 1bd3709..5e0f990 100644
--- a/common/cmd_console.c
+++ b/common/cmd_console.c
@@ -28,7 +28,7 @@
#include <command.h>
#include <devices.h>
-#if (CONFIG_COMMANDS & CFG_CMD_CONSOLE)
+#if defined(CONFIG_CMD_CONSOLE)
extern void _do_coninfo (void);
int do_coninfo (cmd_tbl_t * cmd, int flag, int argc, char *argv[])
@@ -68,4 +68,4 @@ U_BOOT_CMD(
""
);
-#endif /* CFG_CMD_CONSOLE */
+#endif
diff --git a/common/cmd_date.c b/common/cmd_date.c
index 33d2e56..4a42534 100644
--- a/common/cmd_date.c
+++ b/common/cmd_date.c
@@ -31,7 +31,7 @@
DECLARE_GLOBAL_DATA_PTR;
-#if (CONFIG_COMMANDS & CFG_CMD_DATE)
+#if defined(CONFIG_CMD_DATE)
const char *weekdays[] = {
"Sun", "Mon", "Tues", "Wednes", "Thurs", "Fri", "Satur",
@@ -211,4 +211,4 @@ U_BOOT_CMD(
" - with 'reset' argument: reset the RTC\n"
);
-#endif /* CFG_CMD_DATE */
+#endif
diff --git a/common/cmd_dcr.c b/common/cmd_dcr.c
index 7221a86..12fa9db 100644
--- a/common/cmd_dcr.c
+++ b/common/cmd_dcr.c
@@ -29,7 +29,7 @@
#include <config.h>
#include <command.h>
-#if defined(CONFIG_4xx) && (CONFIG_COMMANDS & CFG_CMD_SETGETDCR)
+#if defined(CONFIG_4xx) && defined(CONFIG_CMD_SETGETDCR)
unsigned long get_dcr (unsigned short);
unsigned long set_dcr (unsigned short, unsigned long);
@@ -246,4 +246,4 @@ U_BOOT_CMD(
"adr_dcrn[.dat_dcrn] offset value - write offset to adr_dcrn, write value to dat_dcrn.\n"
);
-#endif /* CONFIG_4xx & CFG_CMD_SETGETDCR */
+#endif
diff --git a/common/cmd_diag.c b/common/cmd_diag.c
index 45c4b31..cb99b77 100644
--- a/common/cmd_diag.c
+++ b/common/cmd_diag.c
@@ -28,7 +28,7 @@
#include <command.h>
#include <post.h>
-#if (CONFIG_COMMANDS & CFG_CMD_DIAG) && defined(CONFIG_POST)
+#if defined(CONFIG_CMD_DIAG) && defined(CONFIG_POST)
int do_diag (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
{
@@ -77,4 +77,4 @@ U_BOOT_CMD(
" - run specified tests\n"
);
-#endif /* CFG_CMD_DIAG */
+#endif
diff --git a/common/cmd_display.c b/common/cmd_display.c
index abee844..d19f412 100644
--- a/common/cmd_display.c
+++ b/common/cmd_display.c
@@ -24,7 +24,7 @@
#include <common.h>
#include <command.h>
-#if (CONFIG_COMMANDS & CFG_CMD_DISPLAY)
+#if defined(CONFIG_CMD_DISPLAY)
#undef DEBUG_DISP
@@ -79,4 +79,4 @@ U_BOOT_CMD(
" - without arguments: clear dot matrix display\n"
);
-#endif /* CFG_CMD_DISPLAY */
+#endif
diff --git a/common/cmd_doc.c b/common/cmd_doc.c
index ab37516..d6d3aff 100644
--- a/common/cmd_doc.c
+++ b/common/cmd_doc.c
@@ -12,14 +12,7 @@
#include <malloc.h>
#include <asm/io.h>
-#ifdef CONFIG_SHOW_BOOT_PROGRESS
-# include <status_led.h>
-# define SHOW_BOOT_PROGRESS(arg) show_boot_progress(arg)
-#else
-# define SHOW_BOOT_PROGRESS(arg)
-#endif
-
-#if (CONFIG_COMMANDS & CFG_CMD_DOC)
+#if defined(CONFIG_CMD_DOC)
#include <linux/mtd/nftl.h>
#include <linux/mtd/doc2000.h>
@@ -216,6 +209,7 @@ int do_docboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
image_header_t *hdr;
int rcode = 0;
+ show_boot_progress (34);
switch (argc) {
case 1:
addr = CFG_LOAD_ADDR;
@@ -236,24 +230,27 @@ int do_docboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
break;
default:
printf ("Usage:\n%s\n", cmdtp->usage);
- SHOW_BOOT_PROGRESS (-1);
+ show_boot_progress (-35);
return 1;
}
+ show_boot_progress (35);
if (!boot_device) {
puts ("\n** No boot device **\n");
- SHOW_BOOT_PROGRESS (-1);
+ show_boot_progress (-36);
return 1;
}
+ show_boot_progress (36);
dev = simple_strtoul(boot_device, &ep, 16);
if ((dev >= CFG_MAX_DOC_DEVICE) ||
(doc_dev_desc[dev].ChipID == DOC_ChipID_UNKNOWN)) {
printf ("\n** Device %d not available\n", dev);
- SHOW_BOOT_PROGRESS (-1);
+ show_boot_progress (-37);
return 1;
}
+ show_boot_progress (37);
printf ("\nLoading from device %d: %s at 0x%lX (offset 0x%lX)\n",
dev, doc_dev_desc[dev].name, doc_dev_desc[dev].physadr,
@@ -262,9 +259,10 @@ int do_docboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (doc_rw (doc_dev_desc + dev, 1, offset,
SECTORSIZE, NULL, (u_char *)addr)) {
printf ("** Read error on %d\n", dev);
- SHOW_BOOT_PROGRESS (-1);
+ show_boot_progress (-38);
return 1;
}
+ show_boot_progress (38);
hdr = (image_header_t *)addr;
@@ -276,16 +274,18 @@ int do_docboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
cnt -= SECTORSIZE;
} else {
puts ("\n** Bad Magic Number **\n");
- SHOW_BOOT_PROGRESS (-1);
+ show_boot_progress (-39);
return 1;
}
+ show_boot_progress (39);
if (doc_rw (doc_dev_desc + dev, 1, offset + SECTORSIZE, cnt,
NULL, (u_char *)(addr+SECTORSIZE))) {
printf ("** Read error on %d\n", dev);
- SHOW_BOOT_PROGRESS (-1);
+ show_boot_progress (-40);
return 1;
}
+ show_boot_progress (40);
/* Loading ok, update default load address */
@@ -1608,4 +1608,4 @@ void doc_probe(unsigned long physadr)
}
}
-#endif /* (CONFIG_COMMANDS & CFG_CMD_DOC) */
+#endif
diff --git a/common/cmd_dtt.c b/common/cmd_dtt.c
index 4f7b049..8da95bf 100644
--- a/common/cmd_dtt.c
+++ b/common/cmd_dtt.c
@@ -25,7 +25,7 @@
#include <config.h>
#include <command.h>
-#if (CONFIG_COMMANDS & CFG_CMD_DTT)
+#if defined(CONFIG_CMD_DTT)
#include <dtt.h>
#include <i2c.h>
@@ -61,4 +61,4 @@ U_BOOT_CMD(
" - Read temperature from digital thermometer and thermostat.\n"
);
-#endif /* CONFIG_COMMANDS & CFG_CMD_DTT */
+#endif
diff --git a/common/cmd_eeprom.c b/common/cmd_eeprom.c
index d15a412..e5000e9 100644
--- a/common/cmd_eeprom.c
+++ b/common/cmd_eeprom.c
@@ -42,7 +42,7 @@
#include <command.h>
#include <i2c.h>
-#if (CONFIG_COMMANDS & CFG_CMD_EEPROM) || defined(CFG_ENV_IS_IN_EEPROM)
+#if defined(CFG_ENV_IS_IN_EEPROM) || defined(CONFIG_CMD_EEPROM)
extern void eeprom_init (void);
extern int eeprom_read (unsigned dev_addr, unsigned offset,
@@ -62,7 +62,7 @@ extern int eeprom_write_enable (unsigned dev_addr, int state);
/* ------------------------------------------------------------------------- */
-#if (CONFIG_COMMANDS & CFG_CMD_EEPROM)
+#if defined(CONFIG_CMD_EEPROM)
int do_eeprom ( cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
{
const char *const fmt =
@@ -110,7 +110,7 @@ int do_eeprom ( cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
printf ("Usage:\n%s\n", cmdtp->usage);
return 1;
}
-#endif /* CFG_CMD_EEPROM */
+#endif
/*-----------------------------------------------------------------------
*
@@ -121,7 +121,7 @@ int do_eeprom ( cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
* 0x00000nxx for EEPROM address selectors and page number at n.
*/
-#if (CONFIG_COMMANDS & CFG_CMD_EEPROM) || defined(CFG_ENV_IS_IN_EEPROM)
+#if defined(CFG_ENV_IS_IN_EEPROM) || defined(CONFIG_CMD_EEPROM)
#ifndef CONFIG_SPI
#if !defined(CFG_I2C_EEPROM_ADDR_LEN) || CFG_I2C_EEPROM_ADDR_LEN < 1 || CFG_I2C_EEPROM_ADDR_LEN > 2
@@ -422,10 +422,11 @@ void eeprom_init (void)
}
/*-----------------------------------------------------------------------
*/
-#endif /* CFG_CMD_EEPROM */
+#endif
+
/***************************************************/
-#if (CONFIG_COMMANDS & CFG_CMD_EEPROM)
+#if defined(CONFIG_CMD_EEPROM)
#ifdef CFG_I2C_MULTI_EEPROMS
U_BOOT_CMD(
@@ -445,4 +446,4 @@ U_BOOT_CMD(
);
#endif /* CFG_I2C_MULTI_EEPROMS */
-#endif /* CFG_CMD_EEPROM */
+#endif
diff --git a/common/cmd_elf.c b/common/cmd_elf.c
index 0e3d56f..63a5593 100644
--- a/common/cmd_elf.c
+++ b/common/cmd_elf.c
@@ -23,7 +23,7 @@
DECLARE_GLOBAL_DATA_PTR;
#endif
-#if (CONFIG_COMMANDS & CFG_CMD_ELF)
+#if defined(CONFIG_CMD_ELF)
#ifndef MAX
#define MAX(a,b) ((a) > (b) ? (a) : (b))
@@ -101,7 +101,7 @@ int do_bootvx (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
else
addr = simple_strtoul (argv[1], NULL, 16);
-#if (CONFIG_COMMANDS & CFG_CMD_NET)
+#if defined(CONFIG_CMD_NET)
/* Check to see if we need to tftp the image ourselves before starting */
if ((argc == 2) && (strcmp (argv[1], "tftp") == 0)) {
@@ -324,4 +324,4 @@ U_BOOT_CMD(
" [address] - load address of vxWorks ELF image.\n"
);
-#endif /* CFG_CMD_ELF */
+#endif
diff --git a/common/cmd_ext2.c b/common/cmd_ext2.c
index 94bd9b6..8bd2b47 100644
--- a/common/cmd_ext2.c
+++ b/common/cmd_ext2.c
@@ -35,14 +35,14 @@
#include <common.h>
#include <part.h>
-#if (CONFIG_COMMANDS & CFG_CMD_EXT2)
+#if defined(CONFIG_CMD_EXT2)
#include <config.h>
#include <command.h>
#include <image.h>
#include <linux/ctype.h>
#include <asm/byteorder.h>
#include <ext2fs.h>
-#if ((CONFIG_COMMANDS & CFG_CMD_USB) && defined(CONFIG_USB_STORAGE))
+#if defined(CONFIG_CMD_USB) && defined(CONFIG_USB_STORAGE)
#include <usb.h>
#endif
@@ -260,4 +260,4 @@ U_BOOT_CMD(
" to address 'addr' from ext2 filesystem\n"
);
-#endif /* CONFIG_COMMANDS & CFG_CMD_EXT2 */
+#endif
diff --git a/common/cmd_fat.c b/common/cmd_fat.c
index afaf299..54f0f9f 100644
--- a/common/cmd_fat.c
+++ b/common/cmd_fat.c
@@ -31,7 +31,7 @@
#include <ata.h>
#include <part.h>
-#if (CONFIG_COMMANDS & CFG_CMD_FAT)
+#if defined(CONFIG_CMD_FAT)
#undef DEBUG
@@ -324,4 +324,4 @@ void hexdump (int cnt, unsigned char *data)
}
#endif /* NOT_IMPLEMENTED_YET */
-#endif /* CFG_CMD_FAT */
+#endif
diff --git a/common/cmd_fdc.c b/common/cmd_fdc.c
index 03f4ce6..7349412 100644
--- a/common/cmd_fdc.c
+++ b/common/cmd_fdc.c
@@ -47,11 +47,11 @@
#endif
-/*#if (CONFIG_COMMANDS & CFG_CMD_DATE) */
+/*#if defined(CONFIG_CMD_DATE) */
/*#include <rtc.h> */
/*#endif */
-#if ((CONFIG_COMMANDS & CFG_CMD_FDC) || (CONFIG_COMMANDS & CFG_CMD_FDOS))
+#if defined(CONFIG_CMD_FDC) || defined(CONFIG_CMD_FDOS)
typedef struct {
@@ -707,9 +707,9 @@ int fdc_setup(int drive, FDC_COMMAND_STRUCT *pCMD, FD_GEO_STRUCT *pFG)
return TRUE;
}
-#endif /* ((CONFIG_COMMANDS & CFG_CMD_FDC)||(CONFIG_COMMANDS & CFG_CMD_FDOS))*/
+#endif
-#if (CONFIG_COMMANDS & CFG_CMD_FDOS)
+#if defined(CONFIG_CMD_FDOS)
/* Low level functions for the Floppy-DOS layer */
@@ -772,9 +772,9 @@ int fdc_fdos_read (void *buffer, int len)
return (fdc_read_data (buffer, len, pCMD, pFG));
}
-#endif /* (CONFIG_COMMANDS & CFG_CMD_FDOS) */
+#endif
-#if (CONFIG_COMMANDS & CFG_CMD_FDC)
+#if defined(CONFIG_CMD_FDC)
/****************************************************************************
* main routine do_fdcboot
*/
@@ -880,13 +880,13 @@ int do_fdcboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
-#endif /* CONFIG_COMMANDS & CFG_CMD_FDC */
+#endif
/***************************************************/
-#if (CONFIG_COMMANDS & CFG_CMD_FDC)
+#if defined(CONFIG_CMD_FDC)
U_BOOT_CMD(
fdcboot, 3, 1, do_fdcboot,
diff --git a/common/cmd_fdos.c b/common/cmd_fdos.c
index dc02b35..f9da98d 100644
--- a/common/cmd_fdos.c
+++ b/common/cmd_fdos.c
@@ -31,7 +31,7 @@
#include <command.h>
#include <fdc.h>
-#if (CONFIG_COMMANDS & CFG_CMD_FDOS)
+#if defined(CONFIG_CMD_FDOS)
/*-----------------------------------------------------------------------------
* do_fdosboot --
@@ -154,4 +154,4 @@ U_BOOT_CMD(
"[directory]\n"
);
-#endif /* CONFIG_COMMANDS & CFG_CMD_FDOS */
+#endif
diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c
index 08fe351..571b8f1 100644
--- a/common/cmd_fdt.c
+++ b/common/cmd_fdt.c
@@ -37,46 +37,32 @@
#include <fdt_support.h>
#define MAX_LEVEL 32 /* how deeply nested we will go */
-#define SCRATCHPAD 1024 /* bytes of scratchpad memory */
+#define SCRATCHPAD 1024 /* bytes of scratchpad memory */
/*
* Global data (for the gd->bd)
*/
DECLARE_GLOBAL_DATA_PTR;
-/*
- * Scratchpad memory.
- */
-static char data[SCRATCHPAD];
-
-
-/*
- * Function prototypes/declarations.
- */
static int fdt_valid(void);
-static void print_data(const void *data, int len);
-
+static int fdt_parse_prop(char *pathp, char *prop, char *newval,
+ char *data, int *len);
+static int fdt_print(char *pathp, char *prop, int depth);
/*
* Flattened Device Tree command, see the help for parameter definitions.
*/
int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
{
- char op;
-
if (argc < 2) {
printf ("Usage:\n%s\n", cmdtp->usage);
return 1;
}
- /*
- * Figure out which subcommand was given
- */
- op = argv[1][0];
/********************************************************************
* Set the address of the fdt
********************************************************************/
- if (op == 'a') {
+ if (argv[1][0] == 'a') {
/*
* Set the address [and length] of the fdt.
*/
@@ -94,7 +80,8 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
*/
len = simple_strtoul(argv[3], NULL, 16);
if (len < fdt_totalsize(fdt)) {
- printf ("New length %d < existing length %d, ignoring.\n",
+ printf ("New length %d < existing length %d, "
+ "ignoring.\n",
len, fdt_totalsize(fdt));
} else {
/*
@@ -102,7 +89,8 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
*/
err = fdt_open_into(fdt, fdt, len);
if (err != 0) {
- printf ("libfdt: %s\n", fdt_strerror(err));
+ printf ("libfdt fdt_open_into(): %s\n",
+ fdt_strerror(err));
}
}
}
@@ -110,12 +98,12 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
/********************************************************************
* Move the fdt
********************************************************************/
- } else if (op == 'm') {
+ } else if ((argv[1][0] == 'm') && (argv[1][1] == 'o')) {
struct fdt_header *newaddr;
int len;
int err;
- if (argc != 5) {
+ if (argc < 4) {
printf ("Usage:\n%s\n", cmdtp->usage);
return 1;
}
@@ -128,12 +116,22 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
return 1;
}
- newaddr = (struct fdt_header *)simple_strtoul(argv[3], NULL, 16);
- len = simple_strtoul(argv[4], NULL, 16);
- if (len < fdt_totalsize(fdt)) {
- printf ("New length %d < existing length %d, aborting.\n",
- len, fdt_totalsize(fdt));
- return 1;
+ newaddr = (struct fdt_header *)simple_strtoul(argv[3],NULL,16);
+
+ /*
+ * If the user specifies a length, use that. Otherwise use the
+ * current length.
+ */
+ if (argc <= 4) {
+ len = fdt_totalsize(fdt);
+ } else {
+ len = simple_strtoul(argv[4], NULL, 16);
+ if (len < fdt_totalsize(fdt)) {
+ printf ("New length 0x%X < existing length "
+ "0x%X, aborting.\n",
+ len, fdt_totalsize(fdt));
+ return 1;
+ }
}
/*
@@ -141,26 +139,59 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
*/
err = fdt_open_into(fdt, newaddr, len);
if (err != 0) {
- printf ("libfdt: %s\n", fdt_strerror(err));
+ printf ("libfdt fdt_open_into(): %s\n",
+ fdt_strerror(err));
return 1;
}
fdt = newaddr;
/********************************************************************
- * Set the value of a node in the fdt.
+ * Make a new node
+ ********************************************************************/
+ } else if ((argv[1][0] == 'm') && (argv[1][1] == 'k')) {
+ char *pathp; /* path */
+ char *nodep; /* new node to add */
+ int nodeoffset; /* node offset from libfdt */
+ int err;
+
+ /*
+ * Parameters: Node path, new node to be appended to the path.
+ */
+ if (argc < 4) {
+ printf ("Usage:\n%s\n", cmdtp->usage);
+ return 1;
+ }
+
+ pathp = argv[2];
+ nodep = argv[3];
+
+ nodeoffset = fdt_find_node_by_path (fdt, pathp);
+ if (nodeoffset < 0) {
+ /*
+ * Not found or something else bad happened.
+ */
+ printf ("libfdt fdt_find_node_by_path() returned %s\n",
+ fdt_strerror(nodeoffset));
+ return 1;
+ }
+ err = fdt_add_subnode(fdt, nodeoffset, nodep);
+ if (err < 0) {
+ printf ("libfdt fdt_add_subnode(): %s\n",
+ fdt_strerror(err));
+ return 1;
+ }
+
+ /********************************************************************
+ * Set the value of a property in the fdt.
********************************************************************/
- } else if (op == 's') {
+ } else if (argv[1][0] == 's') {
char *pathp; /* path */
- char *prop; /* property */
- struct fdt_property *nodep; /* node struct pointer */
+ char *prop; /* property */
char *newval; /* value from the user (as a string) */
- char *vp; /* temporary value pointer */
- char *cp; /* temporary char pointer */
int nodeoffset; /* node offset from libfdt */
- int len; /* new length of the property */
- int oldlen; /* original length of the property */
- unsigned long tmp; /* holds converted values */
- int ret; /* return value */
+ static char data[SCRATCHPAD]; /* storage for the property */
+ int len; /* new length of the property */
+ int ret; /* return value */
/*
* Parameters: Node path, property, value.
@@ -174,121 +205,38 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
prop = argv[3];
newval = argv[4];
- if (strcmp(pathp, "/") == 0) {
- nodeoffset = 0;
- } else {
- nodeoffset = fdt_path_offset (fdt, pathp);
- if (nodeoffset < 0) {
- /*
- * Not found or something else bad happened.
- */
- printf ("libfdt: %s\n", fdt_strerror(nodeoffset));
- return 1;
- }
- }
- nodep = fdt_getprop (fdt, nodeoffset, prop, &oldlen);
- if (oldlen < 0) {
- printf ("libfdt %s\n", fdt_strerror(oldlen));
- return 1;
- } else if (oldlen == 0) {
+ nodeoffset = fdt_find_node_by_path (fdt, pathp);
+ if (nodeoffset < 0) {
/*
- * The specified property has no value
+ * Not found or something else bad happened.
*/
- printf("%s has no value, cannot set one (yet).\n", prop);
+ printf ("libfdt fdt_find_node_by_path() returned %s\n",
+ fdt_strerror(nodeoffset));
return 1;
- } else {
- /*
- * Convert the new property
- */
- vp = data;
- if (*newval == '<') {
- /*
- * Bigger values than bytes.
- */
- len = 0;
- newval++;
- while ((*newval != '>') && (*newval != '\0')) {
- cp = newval;
- tmp = simple_strtoul(cp, &newval, 16);
- if ((newval - cp) <= 2) {
- *vp = tmp & 0xFF;
- vp += 1;
- len += 1;
- } else if ((newval - cp) <= 4) {
- *(uint16_t *)vp = __cpu_to_be16(tmp);
- vp += 2;
- len += 2;
- } else if ((newval - cp) <= 8) {
- *(uint32_t *)vp = __cpu_to_be32(tmp);
- vp += 4;
- len += 4;
- } else {
- printf("Sorry, I could not convert \"%s\"\n", cp);
- return 1;
- }
- while (*newval == ' ')
- newval++;
- }
- if (*newval != '>') {
- printf("Unexpected character '%c'\n", *newval);
- return 1;
- }
- } else if (*newval == '[') {
- /*
- * Byte stream. Convert the values.
- */
- len = 0;
- newval++;
- while ((*newval != ']') && (*newval != '\0')) {
- tmp = simple_strtoul(newval, &newval, 16);
- *vp++ = tmp & 0xFF;
- len++;
- while (*newval == ' ')
- newval++;
- }
- if (*newval != ']') {
- printf("Unexpected character '%c'\n", *newval);
- return 1;
- }
- } else {
- /*
- * Assume it is a string. Copy it into our data area for
- * convenience (including the terminating '\0').
- */
- len = strlen(newval) + 1;
- strcpy(data, newval);
- }
+ }
+ ret = fdt_parse_prop(pathp, prop, newval, data, &len);
+ if (ret != 0)
+ return ret;
- ret = fdt_setprop(fdt, nodeoffset, prop, data, len);
- if (ret < 0) {
- printf ("libfdt %s\n", fdt_strerror(ret));
- return 1;
- }
+ ret = fdt_setprop(fdt, nodeoffset, prop, data, len);
+ if (ret < 0) {
+ printf ("libfdt fdt_setprop(): %s\n", fdt_strerror(ret));
+ return 1;
}
/********************************************************************
* Print (recursive) / List (single level)
********************************************************************/
- } else if ((op == 'p') || (op == 'l')) {
- /*
- * Recursively print (a portion of) the fdt.
- */
- static int offstack[MAX_LEVEL];
- static char tabs[MAX_LEVEL+1] = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
+ } else if ((argv[1][0] == 'p') || (argv[1][0] == 'l')) {
int depth = MAX_LEVEL; /* how deep to print */
char *pathp; /* path */
- char *prop; /* property */
- void *nodep; /* property node pointer */
- int nodeoffset; /* node offset from libfdt */
- int nextoffset; /* next node offset from libfdt */
- uint32_t tag; /* tag */
- int len; /* length of the property */
- int level = 0; /* keep track of nesting level */
+ char *prop; /* property */
+ int ret; /* return value */
/*
* list is an alias for print, but limited to 1 level
*/
- if (op == 'l') {
+ if (argv[1][0] == 'l') {
depth = 1;
}
@@ -302,99 +250,14 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
else
prop = NULL;
- if (strcmp(pathp, "/") == 0) {
- nodeoffset = 0;
- printf("/");
- } else {
- nodeoffset = fdt_path_offset (fdt, pathp);
- if (nodeoffset < 0) {
- /*
- * Not found or something else bad happened.
- */
- printf ("libfdt %s\n", fdt_strerror(nodeoffset));
- return 1;
- }
- }
- /*
- * The user passed in a property as well as node path. Print only
- * the given property and then return.
- */
- if (prop) {
- nodep = fdt_getprop (fdt, nodeoffset, prop, &len);
- if (len == 0) {
- printf("%s %s\n", pathp, prop); /* no property value */
- return 0;
- } else if (len > 0) {
- printf("%s=", prop);
- print_data (nodep, len);
- printf("\n");
- return 0;
- } else {
- printf ("libfdt %s\n", fdt_strerror(len));
- return 1;
- }
- }
-
- /*
- * The user passed in a node path and no property, print the node
- * and all subnodes.
- */
- offstack[0] = nodeoffset;
-
- while(level >= 0) {
- tag = fdt_next_tag(fdt, nodeoffset, &nextoffset, &pathp);
- switch(tag) {
- case FDT_BEGIN_NODE:
- if(level <= depth)
- printf("%s%s {\n", &tabs[MAX_LEVEL - level], pathp);
- level++;
- offstack[level] = nodeoffset;
- if (level >= MAX_LEVEL) {
- printf("Aaaiii <splat> nested too deep.\n");
- return 1;
- }
- break;
- case FDT_END_NODE:
- level--;
- if(level <= depth)
- printf("%s};\n", &tabs[MAX_LEVEL - level]);
- if (level == 0) {
- level = -1; /* exit the loop */
- }
- break;
- case FDT_PROP:
- nodep = fdt_getprop (fdt, offstack[level], pathp, &len);
- if (len < 0) {
- printf ("libfdt %s\n", fdt_strerror(len));
- return 1;
- } else if (len == 0) {
- /* the property has no value */
- if(level <= depth)
- printf("%s%s;\n", &tabs[MAX_LEVEL - level], pathp);
- } else {
- if(level <= depth) {
- printf("%s%s=", &tabs[MAX_LEVEL - level], pathp);
- print_data (nodep, len);
- printf(";\n");
- }
- }
- break;
- case FDT_NOP:
- break;
- case FDT_END:
- return 1;
- default:
- if(level <= depth)
- printf("Unknown tag 0x%08X\n", tag);
- return 1;
- }
- nodeoffset = nextoffset;
- }
+ ret = fdt_print(pathp, prop, depth);
+ if (ret != 0)
+ return ret;
/********************************************************************
* Remove a property/node
********************************************************************/
- } else if (op == 'r') {
+ } else if (argv[1][0] == 'r') {
int nodeoffset; /* node offset from libfdt */
int err;
@@ -402,17 +265,14 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
* Get the path. The root node is an oddball, the offset
* is zero and has no name.
*/
- if (strcmp(argv[2], "/") == 0) {
- nodeoffset = 0;
- } else {
- nodeoffset = fdt_path_offset (fdt, argv[2]);
- if (nodeoffset < 0) {
- /*
- * Not found or something else bad happened.
- */
- printf ("libfdt %s\n", fdt_strerror(nodeoffset));
- return 1;
- }
+ nodeoffset = fdt_find_node_by_path (fdt, argv[2]);
+ if (nodeoffset < 0) {
+ /*
+ * Not found or something else bad happened.
+ */
+ printf ("libfdt fdt_find_node_by_path() returned %s\n",
+ fdt_strerror(nodeoffset));
+ return 1;
}
/*
* Do the delete. A fourth parameter means delete a property,
@@ -421,39 +281,40 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
if (argc > 3) {
err = fdt_delprop(fdt, nodeoffset, argv[3]);
if (err < 0) {
- printf("fdt_delprop libfdt: %s\n", fdt_strerror(err));
+ printf("libfdt fdt_delprop(): %s\n",
+ fdt_strerror(err));
return err;
}
} else {
err = fdt_del_node(fdt, nodeoffset);
if (err < 0) {
- printf("fdt_del_node libfdt: %s\n", fdt_strerror(err));
+ printf("libfdt fdt_del_node(): %s\n",
+ fdt_strerror(err));
return err;
}
}
-
- /********************************************************************
- * Create a chosen node
- ********************************************************************/
- } else if (op == 'c') {
+ }
+#ifdef CONFIG_OF_BOARD_SETUP
+ /* Call the board-specific fixup routine */
+ else if (argv[1][0] == 'b')
+ ft_board_setup(fdt, gd->bd);
+#endif
+ /* Create a chosen node */
+ else if (argv[1][0] == 'c')
fdt_chosen(fdt, 0, 0, 1);
- /********************************************************************
- * Create a u-boot-env node
- ********************************************************************/
- } else if (op == 'e') {
+#ifdef CONFIG_OF_HAS_UBOOT_ENV
+ /* Create a u-boot-env node */
+ else if (argv[1][0] == 'e')
fdt_env(fdt);
-
- /********************************************************************
- * Create a bd_t node
- ********************************************************************/
- } else if (op == 'b') {
+#endif
+#ifdef CONFIG_OF_HAS_BD_T
+ /* Create a bd_t node */
+ else if (argv[1][0] == 'b')
fdt_bd_t(fdt);
-
- /********************************************************************
- * Unrecognized command
- ********************************************************************/
- } else {
+#endif
+ else {
+ /* Unrecognized command */
printf ("Usage:\n%s\n", cmdtp->usage);
return 1;
}
@@ -461,7 +322,7 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
return 0;
}
-/********************************************************************/
+/****************************************************************************/
static int fdt_valid(void)
{
@@ -477,19 +338,21 @@ static int fdt_valid(void)
return 1; /* valid */
if (err < 0) {
- printf("libfdt: %s", fdt_strerror(err));
+ printf("libfdt fdt_check_header(): %s", fdt_strerror(err));
/*
* Be more informative on bad version.
*/
if (err == -FDT_ERR_BADVERSION) {
if (fdt_version(fdt) < FDT_FIRST_SUPPORTED_VERSION) {
printf (" - too old, fdt $d < %d",
- fdt_version(fdt), FDT_FIRST_SUPPORTED_VERSION);
+ fdt_version(fdt),
+ FDT_FIRST_SUPPORTED_VERSION);
fdt = NULL;
}
if (fdt_last_comp_version(fdt) > FDT_LAST_SUPPORTED_VERSION) {
printf (" - too new, fdt $d > %d",
- fdt_version(fdt), FDT_LAST_SUPPORTED_VERSION);
+ fdt_version(fdt),
+ FDT_LAST_SUPPORTED_VERSION);
fdt = NULL;
}
return 0;
@@ -500,13 +363,91 @@ static int fdt_valid(void)
return 1;
}
-/********************************************************************/
+/****************************************************************************/
/*
- * OF flat tree handling
- * Written by: Pantelis Antoniou <pantelis.antoniou@gmail.com>
- * Updated by: Matthew McClintock <msm@freescale.com>
- * Converted to libfdt by: Gerald Van Baren <vanbaren@cideas.com>
+ * Parse the user's input, partially heuristic. Valid formats:
+ * <00> - hex byte
+ * <0011> - hex half word (16 bits)
+ * <00112233> - hex word (32 bits)
+ * - hex double words (64 bits) are not supported, must use
+ * a byte stream instead.
+ * [00 11 22 .. nn] - byte stream
+ * "string" - If the the value doesn't start with "<" or "[", it is
+ * treated as a string. Note that the quotes are
+ * stripped by the parser before we get the string.
+ */
+static int fdt_parse_prop(char *pathp, char *prop, char *newval,
+ char *data, int *len)
+{
+ char *cp; /* temporary char pointer */
+ unsigned long tmp; /* holds converted values */
+
+ if (*newval == '<') {
+ /*
+ * Bigger values than bytes.
+ */
+ *len = 0;
+ newval++;
+ while ((*newval != '>') && (*newval != '\0')) {
+ cp = newval;
+ tmp = simple_strtoul(cp, &newval, 16);
+ if ((newval - cp) <= 2) {
+ *data = tmp & 0xFF;
+ data += 1;
+ *len += 1;
+ } else if ((newval - cp) <= 4) {
+ *(uint16_t *)data = __cpu_to_be16(tmp);
+ data += 2;
+ *len += 2;
+ } else if ((newval - cp) <= 8) {
+ *(uint32_t *)data = __cpu_to_be32(tmp);
+ data += 4;
+ *len += 4;
+ } else {
+ printf("Sorry, I could not convert \"%s\"\n",
+ cp);
+ return 1;
+ }
+ while (*newval == ' ')
+ newval++;
+ }
+ if (*newval != '>') {
+ printf("Unexpected character '%c'\n", *newval);
+ return 1;
+ }
+ } else if (*newval == '[') {
+ /*
+ * Byte stream. Convert the values.
+ */
+ *len = 0;
+ newval++;
+ while ((*newval != ']') && (*newval != '\0')) {
+ tmp = simple_strtoul(newval, &newval, 16);
+ *data++ = tmp & 0xFF;
+ *len = *len + 1;
+ while (*newval == ' ')
+ newval++;
+ }
+ if (*newval != ']') {
+ printf("Unexpected character '%c'\n", *newval);
+ return 1;
+ }
+ } else {
+ /*
+ * Assume it is a string. Copy it into our data area for
+ * convenience (including the terminating '\0').
+ */
+ *len = strlen(newval) + 1;
+ strcpy(data, newval);
+ }
+ return 0;
+}
+
+/****************************************************************************/
+
+/*
+ * Heuristic to guess if this is a string or concatenated strings.
*/
static int is_printable_string(const void *data, int len)
@@ -546,6 +487,12 @@ static int is_printable_string(const void *data, int len)
return 1;
}
+
+/*
+ * Print the property in the best format, a heuristic guess. Print as
+ * a string, concatenated strings, a byte, word, double word, or (if all
+ * else fails) it is printed as a stream of bytes.
+ */
static void print_data(const void *data, int len)
{
int j;
@@ -601,32 +548,146 @@ static void print_data(const void *data, int len)
}
}
+/****************************************************************************/
+
+/*
+ * Recursively print (a portion of) the fdt. The depth parameter
+ * determines how deeply nested the fdt is printed.
+ */
+static int fdt_print(char *pathp, char *prop, int depth)
+{
+ static int offstack[MAX_LEVEL];
+ static char tabs[MAX_LEVEL+1] =
+ "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"
+ "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
+ void *nodep; /* property node pointer */
+ int nodeoffset; /* node offset from libfdt */
+ int nextoffset; /* next node offset from libfdt */
+ uint32_t tag; /* tag */
+ int len; /* length of the property */
+ int level = 0; /* keep track of nesting level */
+
+ nodeoffset = fdt_find_node_by_path (fdt, pathp);
+ if (nodeoffset < 0) {
+ /*
+ * Not found or something else bad happened.
+ */
+ printf ("libfdt fdt_find_node_by_path() returned %s\n",
+ fdt_strerror(nodeoffset));
+ return 1;
+ }
+ /*
+ * The user passed in a property as well as node path.
+ * Print only the given property and then return.
+ */
+ if (prop) {
+ nodep = fdt_getprop (fdt, nodeoffset, prop, &len);
+ if (len == 0) {
+ /* no property value */
+ printf("%s %s\n", pathp, prop);
+ return 0;
+ } else if (len > 0) {
+ printf("%s=", prop);
+ print_data (nodep, len);
+ printf("\n");
+ return 0;
+ } else {
+ printf ("libfdt fdt_getprop(): %s\n",
+ fdt_strerror(len));
+ return 1;
+ }
+ }
+
+ /*
+ * The user passed in a node path and no property,
+ * print the node and all subnodes.
+ */
+ offstack[0] = nodeoffset;
+
+ while(level >= 0) {
+ tag = fdt_next_tag(fdt, nodeoffset, &nextoffset, &pathp);
+ switch(tag) {
+ case FDT_BEGIN_NODE:
+ if(level <= depth)
+ printf("%s%s {\n",
+ &tabs[MAX_LEVEL - level], pathp);
+ level++;
+ offstack[level] = nodeoffset;
+ if (level >= MAX_LEVEL) {
+ printf("Aaaiii <splat> nested too deep. "
+ "Aborting.\n");
+ return 1;
+ }
+ break;
+ case FDT_END_NODE:
+ level--;
+ if(level <= depth)
+ printf("%s};\n", &tabs[MAX_LEVEL - level]);
+ if (level == 0) {
+ level = -1; /* exit the loop */
+ }
+ break;
+ case FDT_PROP:
+ nodep = fdt_getprop (fdt, offstack[level], pathp, &len);
+ if (len < 0) {
+ printf ("libfdt fdt_getprop(): %s\n",
+ fdt_strerror(len));
+ return 1;
+ } else if (len == 0) {
+ /* the property has no value */
+ if(level <= depth)
+ printf("%s%s;\n",
+ &tabs[MAX_LEVEL - level],
+ pathp);
+ } else {
+ if(level <= depth) {
+ printf("%s%s=",
+ &tabs[MAX_LEVEL - level],
+ pathp);
+ print_data (nodep, len);
+ printf(";\n");
+ }
+ }
+ break;
+ case FDT_NOP:
+ break;
+ case FDT_END:
+ return 1;
+ default:
+ if(level <= depth)
+ printf("Unknown tag 0x%08X\n", tag);
+ return 1;
+ }
+ nodeoffset = nextoffset;
+ }
+ return 0;
+}
+
/********************************************************************/
U_BOOT_CMD(
fdt, 5, 0, do_fdt,
"fdt - flattened device tree utility commands\n",
"addr <addr> [<length>] - Set the fdt location to <addr>\n"
+#ifdef CONFIG_OF_BOARD_SETUP
+ "fdt boardsetup - Do board-specific set up\n"
+#endif
"fdt move <fdt> <newaddr> <length> - Copy the fdt to <addr>\n"
"fdt print <path> [<prop>] - Recursive print starting at <path>\n"
"fdt list <path> [<prop>] - Print one level starting at <path>\n"
"fdt set <path> <prop> [<val>] - Set <property> [to <val>]\n"
"fdt mknode <path> <node> - Create a new node after <path>\n"
"fdt rm <path> [<prop>] - Delete the node or <property>\n"
- "fdt chosen - Add/update the \"/chosen\" branch in the tree\n"
+ "fdt chosen - Add/update the /chosen branch in the tree\n"
#ifdef CONFIG_OF_HAS_UBOOT_ENV
- "fdt env - Add/replace the \"/u-boot-env\" branch in the tree\n"
+ "fdt env - Add/replace the /u-boot-env branch in the tree\n"
#endif
#ifdef CONFIG_OF_HAS_BD_T
- "fdt bd_t - Add/replace the \"/bd_t\" branch in the tree\n"
+ "fdt bd_t - Add/replace the /bd_t branch in the tree\n"
#endif
"Hints:\n"
- " * Set a larger length with the fdt addr command to add to the blob.\n"
- " * If the property you are setting/printing has a '#' character,\n"
- " you MUST escape it with a \\ character or quote it with \" or\n"
- " it will be ignored as a comment.\n"
- " * If the value has spaces in it, you MUST escape the spaces with\n"
- " \\ characters or quote it with \"\"\n"
+ " If the property you are setting/printing has a '#' character or spaces,\n"
+ " you MUST escape it with a \\ character or quote it with \".\n"
"Examples: fdt print / # print the whole tree\n"
" fdt print /cpus \"#address-cells\"\n"
" fdt set /cpus \"#address-cells\" \"[00 00 00 01]\"\n"
diff --git a/common/cmd_flash.c b/common/cmd_flash.c
index cb1c5bb..11c8857 100644
--- a/common/cmd_flash.c
+++ b/common/cmd_flash.c
@@ -31,9 +31,9 @@
#include <dataflash.h>
#endif
-#if (CONFIG_COMMANDS & CFG_CMD_FLASH)
+#if defined(CONFIG_CMD_FLASH)
-#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
+#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
#include <jffs2/jffs2.h>
/* parition handling routines */
@@ -311,7 +311,7 @@ int do_flerase (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
flash_info_t *info;
ulong bank, addr_first, addr_last;
int n, sect_first, sect_last;
-#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
+#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
struct mtd_device *dev;
struct part_info *part;
u8 dev_type, dev_num, pnum;
@@ -343,7 +343,7 @@ int do_flerase (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return rcode;
}
-#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
+#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
/* erase <part-id> - erase partition */
if ((argc == 2) && (id_parse(argv[1], NULL, &dev_type, &dev_num) == 0)) {
mtdparts_init();
@@ -447,7 +447,7 @@ int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
flash_info_t *info;
ulong bank, addr_first, addr_last;
int i, p, n, sect_first, sect_last;
-#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
+#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
struct mtd_device *dev;
struct part_info *part;
u8 dev_type, dev_num, pnum;
@@ -539,7 +539,7 @@ int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return rcode;
}
-#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
+#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
/* protect on/off <part-id> */
if ((argc == 3) && (id_parse(argv[2], NULL, &dev_type, &dev_num) == 0)) {
mtdparts_init();
@@ -672,7 +672,7 @@ int flash_sect_protect (int p, ulong addr_first, ulong addr_last)
/**************************************************/
-#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
+#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
# define TMP_ERASE "erase <part-id>\n - erase partition\n"
# define TMP_PROT_ON "protect on <part-id>\n - protect partition\n"
# define TMP_PROT_OFF "protect off <part-id>\n - make partition writable\n"
@@ -690,7 +690,7 @@ U_BOOT_CMD(
);
U_BOOT_CMD(
- erase, 3, 1, do_flerase,
+ erase, 3, 0, do_flerase,
"erase - erase FLASH memory\n",
"start end\n"
" - erase FLASH from addr 'start' to addr 'end'\n"
@@ -704,7 +704,7 @@ U_BOOT_CMD(
);
U_BOOT_CMD(
- protect, 4, 1, do_protect,
+ protect, 4, 0, do_protect,
"protect - enable or disable FLASH write protection\n",
"on start end\n"
" - protect FLASH from addr 'start' to addr 'end'\n"
@@ -732,4 +732,4 @@ U_BOOT_CMD(
#undef TMP_PROT_ON
#undef TMP_PROT_OFF
-#endif /* CFG_CMD_FLASH */
+#endif
diff --git a/common/cmd_fpga.c b/common/cmd_fpga.c
index 3444091..3fc4fca 100644
--- a/common/cmd_fpga.c
+++ b/common/cmd_fpga.c
@@ -27,7 +27,7 @@
*/
#include <common.h>
#include <command.h>
-#if (CONFIG_COMMANDS & CFG_CMD_NET)
+#if defined(CONFIG_CMD_NET)
#include <net.h>
#endif
#include <fpga.h>
@@ -43,7 +43,7 @@
#define PRINTF(fmt,args...)
#endif
-#if defined (CONFIG_FPGA) && ( CONFIG_COMMANDS & CFG_CMD_FPGA )
+#if defined (CONFIG_FPGA) && defined(CONFIG_CMD_FPGA)
/* Local functions */
static void fpga_usage (cmd_tbl_t * cmdtp);
@@ -321,4 +321,4 @@ U_BOOT_CMD (fpga, 6, 1, do_fpga,
"\tloadb\tLoad device from bitstream buffer (Xilinx devices only)\n"
"\tloadmk\tLoad device generated with mkimage\n"
"\tdump\tLoad device to memory buffer\n");
-#endif /* CONFIG_FPGA && CONFIG_COMMANDS & CFG_CMD_FPGA */
+#endif
diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c
index 755810d..a684a58 100644
--- a/common/cmd_i2c.c
+++ b/common/cmd_i2c.c
@@ -86,7 +86,7 @@
#include <i2c.h>
#include <asm/byteorder.h>
-#if (CONFIG_COMMANDS & CFG_CMD_I2C)
+#if defined(CONFIG_CMD_I2C)
/* Display values from last command.
@@ -657,7 +657,7 @@ int do_i2c_loop(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
* The SDRAM command is separately configured because many
* (most?) embedded boards don't use SDRAM DIMMs.
*/
-#if (CONFIG_COMMANDS & CFG_CMD_SDRAM)
+#if defined(CONFIG_CMD_SDRAM)
/*
* Syntax:
@@ -877,7 +877,7 @@ int do_sdram ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return 0;
}
-#endif /* CFG_CMD_SDRAM */
+#endif
#if defined(CONFIG_I2C_CMD_TREE)
#if defined(CONFIG_I2C_MULTI_BUS)
@@ -938,10 +938,10 @@ int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
return do_i2c_probe(cmdtp, flag, --argc, ++argv);
if (!strncmp(argv[1], "lo", 2))
return do_i2c_loop(cmdtp, flag, --argc, ++argv);
-#if (CONFIG_COMMANDS & CFG_CMD_SDRAM)
+#if defined(CONFIG_CMD_SDRAM)
if (!strncmp(argv[1], "sd", 2))
return do_sdram(cmdtp, flag, --argc, ++argv);
-#endif /* CFG_CMD_SDRAM */
+#endif
else
printf ("Usage:\n%s\n", cmdtp->usage);
return 0;
@@ -965,9 +965,9 @@ U_BOOT_CMD(
"i2c crc32 chip address[.0, .1, .2] count - compute CRC32 checksum\n"
"i2c probe - show devices on the I2C bus\n"
"i2c loop chip address[.0, .1, .2] [# of objects] - looping read of device\n"
-#if (CONFIG_COMMANDS & CFG_CMD_SDRAM)
+#if defined(CONFIG_CMD_SDRAM)
"i2c sdram chip - print SDRAM configuration information\n"
-#endif /* CFG_CMD_SDRAM */
+#endif
);
#endif /* CONFIG_I2C_CMD_TREE */
U_BOOT_CMD(
@@ -1016,7 +1016,7 @@ U_BOOT_CMD(
" - loop, reading a set of addresses\n"
);
-#if (CONFIG_COMMANDS & CFG_CMD_SDRAM)
+#if defined(CONFIG_CMD_SDRAM)
U_BOOT_CMD(
isdram, 2, 1, do_sdram,
"isdram - print SDRAM configuration information\n",
@@ -1025,4 +1025,4 @@ U_BOOT_CMD(
);
#endif
-#endif /* CFG_CMD_I2C */
+#endif
diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index ce99a41..bb064ea 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -31,6 +31,7 @@
#include <command.h>
#include <image.h>
#include <asm/byteorder.h>
+#include <asm/io.h>
#if defined(CONFIG_IDE_8xx_DIRECT) || defined(CONFIG_IDE_PCMCIA)
# include <pcmcia.h>
@@ -59,13 +60,6 @@ unsigned long mips_io_port_base = 0;
#endif
#endif
-#ifdef CONFIG_SHOW_BOOT_PROGRESS
-# include <status_led.h>
-# define SHOW_BOOT_PROGRESS(arg) show_boot_progress(arg)
-#else
-# define SHOW_BOOT_PROGRESS(arg)
-#endif
-
#ifdef CONFIG_IDE_8xx_DIRECT
DECLARE_GLOBAL_DATA_PTR;
#endif
@@ -78,7 +72,7 @@ DECLARE_GLOBAL_DATA_PTR;
# define SYNC /* nothing */
#endif
-#if (CONFIG_COMMANDS & CFG_CMD_IDE)
+#if defined(CONFIG_CMD_IDE)
#ifdef CONFIG_IDE_8xx_DIRECT
/* Timings for IDE Interface
@@ -135,8 +129,6 @@ ulong ide_bus_offset[CFG_IDE_MAXBUS] = {
};
-#define ATA_CURR_BASE(dev) (CFG_ATA_BASE_ADDR+ide_bus_offset[IDE_BUS(dev)])
-
#ifndef CONFIG_AMIGAONEG3SE
static int ide_bus_ok[CFG_IDE_MAXBUS];
#else
@@ -179,12 +171,15 @@ static uchar ide_wait (int dev, ulong t);
#define IDE_SPIN_UP_TIME_OUT 5000 /* 5 sec spin-up timeout */
-static void __inline__ ide_outb(int dev, int port, unsigned char val);
-static unsigned char __inline__ ide_inb(int dev, int port);
+void inline ide_outb(int dev, int port, unsigned char val);
+unsigned char inline ide_inb(int dev, int port);
static void input_data(int dev, ulong *sect_buf, int words);
static void output_data(int dev, ulong *sect_buf, int words);
static void ident_cpy (unsigned char *dest, unsigned char *src, unsigned int len);
+#ifndef CFG_ATA_PORT_ADDR
+#define CFG_ATA_PORT_ADDR(port) (port)
+#endif
#ifdef CONFIG_ATAPI
static void atapi_inquiry(block_dev_desc_t *dev_desc);
@@ -382,6 +377,7 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
image_header_t *hdr;
int rcode = 0;
+ show_boot_progress (41);
switch (argc) {
case 1:
addr = CFG_LOAD_ADDR;
@@ -397,44 +393,50 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
break;
default:
printf ("Usage:\n%s\n", cmdtp->usage);
- SHOW_BOOT_PROGRESS (-1);
+ show_boot_progress (-42);
return 1;
}
+ show_boot_progress (42);
if (!boot_device) {
puts ("\n** No boot device **\n");
- SHOW_BOOT_PROGRESS (-1);
+ show_boot_progress (-43);
return 1;
}
+ show_boot_progress (43);
dev = simple_strtoul(boot_device, &ep, 16);
if (ide_dev_desc[dev].type==DEV_TYPE_UNKNOWN) {
printf ("\n** Device %d not available\n", dev);
- SHOW_BOOT_PROGRESS (-1);
+ show_boot_progress (-44);
return 1;
}
+ show_boot_progress (44);
if (*ep) {
if (*ep != ':') {
puts ("\n** Invalid boot device, use `dev[:part]' **\n");
- SHOW_BOOT_PROGRESS (-1);
+ show_boot_progress (-45);
return 1;
}
part = simple_strtoul(++ep, NULL, 16);
}
+ show_boot_progress (45);
if (get_partition_info (&ide_dev_desc[dev], part, &info)) {
- SHOW_BOOT_PROGRESS (-1);
+ show_boot_progress (-46);
return 1;
}
+ show_boot_progress (46);
if ((strncmp((char *)info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
(strncmp((char *)info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)) {
printf ("\n** Invalid partition type \"%.32s\""
" (expect \"" BOOT_PART_TYPE "\")\n",
info.type);
- SHOW_BOOT_PROGRESS (-1);
+ show_boot_progress (-47);
return 1;
}
+ show_boot_progress (47);
printf ("\nLoading from IDE device %d, partition %d: "
"Name: %.32s Type: %.32s\n",
@@ -445,26 +447,29 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (ide_dev_desc[dev].block_read (dev, info.start, 1, (ulong *)addr) != 1) {
printf ("** Read error on %d:%d\n", dev, part);
- SHOW_BOOT_PROGRESS (-1);
+ show_boot_progress (-48);
return 1;
}
+ show_boot_progress (48);
hdr = (image_header_t *)addr;
if (ntohl(hdr->ih_magic) != IH_MAGIC) {
printf("\n** Bad Magic Number **\n");
- SHOW_BOOT_PROGRESS (-1);
+ show_boot_progress (-49);
return 1;
}
+ show_boot_progress (49);
checksum = ntohl(hdr->ih_hcrc);
hdr->ih_hcrc = 0;
if (crc32 (0, (uchar *)hdr, sizeof(image_header_t)) != checksum) {
puts ("\n** Bad Header Checksum **\n");
- SHOW_BOOT_PROGRESS (-2);
+ show_boot_progress (-50);
return 1;
}
+ show_boot_progress (50);
hdr->ih_hcrc = htonl(checksum); /* restore checksum for later use */
print_image_hdr (hdr);
@@ -477,9 +482,10 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (ide_dev_desc[dev].block_read (dev, info.start+1, cnt,
(ulong *)(addr+info.blksz)) != cnt) {
printf ("** Read error on %d:%d\n", dev, part);
- SHOW_BOOT_PROGRESS (-1);
+ show_boot_progress (-51);
return 1;
}
+ show_boot_progress (51);
/* Loading ok, update default load address */
@@ -514,11 +520,11 @@ void ide_init (void)
unsigned char c;
int i, bus;
#if defined(CONFIG_AMIGAONEG3SE) || defined(CONFIG_SC3)
- unsigned int ata_reset_time;
+ unsigned int ata_reset_time = ATA_RESET_TIME;
+ char *s;
#endif
#ifdef CONFIG_AMIGAONEG3SE
unsigned int max_bus_scan;
- char *s;
#endif
#ifdef CONFIG_IDE_8xx_PCCARD
extern int pcmcia_on (void);
@@ -798,45 +804,27 @@ set_pcmcia_timing (int pmode)
/* ------------------------------------------------------------------------- */
-#if defined(__PPC__) || defined(CONFIG_PXA_PCMCIA)
-static void __inline__
-ide_outb(int dev, int port, unsigned char val)
+void inline
+__ide_outb(int dev, int port, unsigned char val)
{
debug ("ide_outb (dev= %d, port= 0x%x, val= 0x%02x) : @ 0x%08lx\n",
- dev, port, val, (ATA_CURR_BASE(dev)+port));
-
- /* Ensure I/O operations complete */
- EIEIO;
- *((uchar *)(ATA_CURR_BASE(dev)+port)) = val;
-}
-#else /* ! __PPC__ */
-static void __inline__
-ide_outb(int dev, int port, unsigned char val)
-{
- outb(val, ATA_CURR_BASE(dev)+port);
+ dev, port, val, (ATA_CURR_BASE(dev)+CFG_ATA_PORT_ADDR(port)));
+ outb(val, (ATA_CURR_BASE(dev)+CFG_ATA_PORT_ADDR(port)));
}
-#endif /* __PPC__ */
+void inline ide_outb (int dev, int port, unsigned char val)
+ __attribute__((weak, alias("__ide_outb")));
-
-#if defined(__PPC__) || defined(CONFIG_PXA_PCMCIA)
-static unsigned char __inline__
-ide_inb(int dev, int port)
+unsigned char inline
+__ide_inb(int dev, int port)
{
uchar val;
- /* Ensure I/O operations complete */
- EIEIO;
- val = *((uchar *)(ATA_CURR_BASE(dev)+port));
+ val = inb((ATA_CURR_BASE(dev)+CFG_ATA_PORT_ADDR(port)));
debug ("ide_inb (dev= %d, port= 0x%x) : @ 0x%08lx -> 0x%02x\n",
- dev, port, (ATA_CURR_BASE(dev)+port), val);
- return (val);
+ dev, port, (ATA_CURR_BASE(dev)+CFG_ATA_PORT_ADDR(port)), val);
+ return val;
}
-#else /* ! __PPC__ */
-static unsigned char __inline__
-ide_inb(int dev, int port)
-{
- return inb(ATA_CURR_BASE(dev)+port);
-}
-#endif /* __PPC__ */
+unsigned char inline ide_inb(int dev, int port)
+ __attribute__((weak, alias("__ide_inb")));
#ifdef __PPC__
# ifdef CONFIG_AMIGAONEG3SE
@@ -891,6 +879,9 @@ input_swap_data(int dev, ulong *sect_buf, int words)
#ifdef __MIPS__
*dbuf++ = swab16p((u16*)pbuf);
*dbuf++ = swab16p((u16*)pbuf);
+#elif defined(CONFIG_PCS440EP)
+ *dbuf++ = *pbuf;
+ *dbuf++ = *pbuf;
#else
*dbuf++ = ld_le16(pbuf);
*dbuf++ = ld_le16(pbuf);
@@ -930,10 +921,18 @@ output_data(int dev, ulong *sect_buf, int words)
pbuf = (ushort *)(ATA_CURR_BASE(dev)+ATA_DATA_REG);
dbuf = (ushort *)sect_buf;
while (words--) {
+#if defined(CONFIG_PCS440EP)
+ /* not tested, because CF was write protected */
+ EIEIO;
+ *pbuf = ld_le16(dbuf++);
+ EIEIO;
+ *pbuf = ld_le16(dbuf++);
+#else
EIEIO;
*pbuf = *dbuf++;
EIEIO;
*pbuf = *dbuf++;
+#endif
}
#endif
}
@@ -981,10 +980,17 @@ input_data(int dev, ulong *sect_buf, int words)
debug("in input data base for read is %lx\n", (unsigned long) pbuf);
while (words--) {
+#if defined(CONFIG_PCS440EP)
+ EIEIO;
+ *dbuf++ = ld_le16(pbuf);
+ EIEIO;
+ *dbuf++ = ld_le16(pbuf);
+#else
EIEIO;
*dbuf++ = *pbuf;
EIEIO;
*dbuf++ = *pbuf;
+#endif
}
#endif
}
@@ -2080,4 +2086,4 @@ U_BOOT_CMD(
"loadAddr dev:part\n"
);
-#endif /* CONFIG_COMMANDS & CFG_CMD_IDE */
+#endif
diff --git a/common/cmd_immap.c b/common/cmd_immap.c
index fa79b45..ae95758 100644
--- a/common/cmd_immap.c
+++ b/common/cmd_immap.c
@@ -28,7 +28,7 @@
#include <common.h>
#include <command.h>
-#if (CONFIG_COMMANDS & CFG_CMD_IMMAP) && \
+#if defined(CONFIG_CMD_IMMAP) && \
(defined(CONFIG_8xx) || defined(CONFIG_8260))
#if defined(CONFIG_8xx)
@@ -720,4 +720,4 @@ U_BOOT_CMD(
);
-#endif /* CFG_CMD_IMMAP && (CONFIG_8xx || CONFIG_8260) */
+#endif
diff --git a/common/cmd_itest.c b/common/cmd_itest.c
index 8ad134f..8e20517 100644
--- a/common/cmd_itest.c
+++ b/common/cmd_itest.c
@@ -32,7 +32,7 @@
#include <config.h>
#include <command.h>
-#if (CONFIG_COMMANDS & CFG_CMD_ITEST)
+#if defined(CONFIG_CMD_ITEST)
#define EQ 0
#define NE 1
@@ -197,4 +197,4 @@ U_BOOT_CMD(
"itest\t- return true/false on integer compare\n",
"[.b, .w, .l, .s] [*]value1 <op> [*]value2\n"
);
-#endif /* CONFIG_COMMANDS & CFG_CMD_ITEST */
+#endif
diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c
index 7fd1fa3..513a226 100644
--- a/common/cmd_jffs2.c
+++ b/common/cmd_jffs2.c
@@ -94,18 +94,18 @@
#include <linux/list.h>
#include <linux/ctype.h>
-#if (CONFIG_COMMANDS & CFG_CMD_JFFS2)
+#if defined(CONFIG_CMD_JFFS2)
#include <cramfs/cramfs_fs.h>
-#if (CONFIG_COMMANDS & CFG_CMD_NAND)
+#if defined(CONFIG_CMD_NAND)
#ifdef CFG_NAND_LEGACY
#include <linux/mtd/nand_legacy.h>
#else /* !CFG_NAND_LEGACY */
#include <linux/mtd/nand.h>
#include <nand.h>
#endif /* !CFG_NAND_LEGACY */
-#endif /* (CONFIG_COMMANDS & CFG_CMD_NAND) */
+#endif
/* enable/disable debugging messages */
#define DEBUG_JFFS
#undef DEBUG_JFFS
@@ -321,7 +321,7 @@ static void current_save(void)
*/
static int part_validate_nor(struct mtdids *id, struct part_info *part)
{
-#if (CONFIG_COMMANDS & CFG_CMD_FLASH)
+#if defined(CONFIG_CMD_FLASH)
/* info for FLASH chips */
extern flash_info_t flash_info[];
flash_info_t *flash;
@@ -370,7 +370,7 @@ static int part_validate_nor(struct mtdids *id, struct part_info *part)
*/
static int part_validate_nand(struct mtdids *id, struct part_info *part)
{
-#if defined(CONFIG_JFFS2_NAND) && (CONFIG_COMMANDS & CFG_CMD_NAND)
+#if defined(CONFIG_JFFS2_NAND) && defined(CONFIG_CMD_NAND)
/* info for NAND chips */
nand_info_t *nand;
@@ -719,7 +719,7 @@ static int part_parse(const char *const partdef, const char **ret, struct part_i
static int device_validate(u8 type, u8 num, u32 *size)
{
if (type == MTD_DEV_TYPE_NOR) {
-#if (CONFIG_COMMANDS & CFG_CMD_FLASH)
+#if defined(CONFIG_CMD_FLASH)
if (num < CFG_MAX_FLASH_BANKS) {
extern flash_info_t flash_info[];
*size = flash_info[num].size;
@@ -733,7 +733,7 @@ static int device_validate(u8 type, u8 num, u32 *size)
printf("support for FLASH devices not present\n");
#endif
} else if (type == MTD_DEV_TYPE_NAND) {
-#if defined(CONFIG_JFFS2_NAND) && (CONFIG_COMMANDS & CFG_CMD_NAND)
+#if defined(CONFIG_JFFS2_NAND) && defined(CONFIG_CMD_NAND)
if (num < CFG_MAX_NAND_DEVICE) {
#ifndef CFG_NAND_LEGACY
*size = nand_info[num].size;
@@ -2192,4 +2192,4 @@ U_BOOT_CMD(
/***************************************************/
-#endif /* CFG_CMD_JFFS2 */
+#endif
diff --git a/common/cmd_load.c b/common/cmd_load.c
index f63b8e8..204c3eb 100644
--- a/common/cmd_load.c
+++ b/common/cmd_load.c
@@ -33,24 +33,24 @@
DECLARE_GLOBAL_DATA_PTR;
-#if (CONFIG_COMMANDS & CFG_CMD_LOADB)
+#if defined(CONFIG_CMD_LOADB)
static ulong load_serial_ymodem (ulong offset);
#endif
-#if (CONFIG_COMMANDS & CFG_CMD_LOADS)
+#if defined(CONFIG_CMD_LOADS)
static ulong load_serial (ulong offset);
static int read_record (char *buf, ulong len);
-# if (CONFIG_COMMANDS & CFG_CMD_SAVES)
+# if defined(CONFIG_CMD_SAVES)
static int save_serial (ulong offset, ulong size);
static int write_record (char *buf);
-# endif /* CFG_CMD_SAVES */
+#endif
static int do_echo = 1;
-#endif /* CFG_CMD_LOADS */
+#endif
/* -------------------------------------------------------------------- */
-#if (CONFIG_COMMANDS & CFG_CMD_LOADS)
+#if defined(CONFIG_CMD_LOADS)
int do_load_serial (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
ulong offset = 0;
@@ -253,7 +253,7 @@ read_record (char *buf, ulong len)
return (p - buf);
}
-#if (CONFIG_COMMANDS & CFG_CMD_SAVES)
+#if defined(CONFIG_CMD_SAVES)
int do_save_serial (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
@@ -399,13 +399,15 @@ write_record (char *buf)
}
return (0);
}
-# endif /* CFG_CMD_SAVES */
-
-#endif /* CFG_CMD_LOADS */
+# endif
+#endif
-#if (CONFIG_COMMANDS & CFG_CMD_LOADB) /* loadb command (load binary) included */
+#if defined(CONFIG_CMD_LOADB)
+/*
+ * loadb command (load binary) included
+ */
#define XON_CHAR 17
#define XOFF_CHAR 19
#define START_CHAR 0x01
@@ -1036,11 +1038,11 @@ static ulong load_serial_ymodem (ulong offset)
return offset;
}
-#endif /* CFG_CMD_LOADB */
+#endif
/* -------------------------------------------------------------------- */
-#if (CONFIG_COMMANDS & CFG_CMD_LOADS)
+#if defined(CONFIG_CMD_LOADS)
#ifdef CFG_LOADS_BAUD_CHANGE
U_BOOT_CMD(
@@ -1065,7 +1067,7 @@ U_BOOT_CMD(
*/
-#if (CONFIG_COMMANDS & CFG_CMD_SAVES)
+#if defined(CONFIG_CMD_SAVES)
#ifdef CFG_LOADS_BAUD_CHANGE
U_BOOT_CMD(
saves, 4, 0, do_save_serial,
@@ -1082,11 +1084,11 @@ U_BOOT_CMD(
" - save S-Record file over serial line with offset 'off' and size 'size'\n"
);
#endif /* CFG_LOADS_BAUD_CHANGE */
-#endif /* CFG_CMD_SAVES */
-#endif /* CFG_CMD_LOADS */
+#endif
+#endif
-#if (CONFIG_COMMANDS & CFG_CMD_LOADB)
+#if defined(CONFIG_CMD_LOADB)
U_BOOT_CMD(
loadb, 3, 0, do_load_serial_bin,
"loadb - load binary file over serial line (kermit mode)\n",
@@ -1103,11 +1105,11 @@ U_BOOT_CMD(
" with offset 'off' and baudrate 'baud'\n"
);
-#endif /* CFG_CMD_LOADB */
+#endif
/* -------------------------------------------------------------------- */
-#if (CONFIG_COMMANDS & CFG_CMD_HWFLOW)
+#if defined(CONFIG_CMD_HWFLOW)
int do_hwflow (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
extern int hwflow_onoff(int);
@@ -1133,4 +1135,4 @@ U_BOOT_CMD(
"[on|off]\n - change RTS/CTS hardware flow control over serial line\n"
);
-#endif /* CFG_CMD_HWFLOW */
+#endif
diff --git a/common/cmd_log.c b/common/cmd_log.c
index 042a403..fba8bd8 100644
--- a/common/cmd_log.c
+++ b/common/cmd_log.c
@@ -1,5 +1,5 @@
/*
- * (C) Copyright 2002
+ * (C) Copyright 2002-2007
* Detlev Zundel, DENX Software Engineering, dzu@denx.de.
*
* Code used from linux/kernel/printk.c
@@ -60,45 +60,40 @@ static char buf[1024];
/* This combination will not print messages with the default loglevel */
static unsigned console_loglevel = 3;
static unsigned default_message_loglevel = 4;
-static unsigned char *log_buf = NULL;
-static unsigned long *ext_log_size;
-static unsigned long *ext_log_start;
-static unsigned long *ext_logged_chars;
-#define log_size (*ext_log_size)
-#define log_start (*ext_log_start)
-#define logged_chars (*ext_logged_chars)
+static unsigned log_version = 1;
+static logbuff_t *log;
-/* Forced by code, eh! */
-#define LOGBUFF_MAGIC 0xc0de4ced
-
-/* The mapping used here has to be the same as in setup_ext_logbuff ()
- in linux/kernel/printk */
void logbuff_init_ptrs (void)
{
- unsigned long *ext_tag;
- unsigned long post_word;
+ unsigned long tag, post_word;
char *s;
- log_buf = (unsigned char *)(gd->bd->bi_memsize-LOGBUFF_LEN);
- ext_tag = (unsigned long *)(log_buf)-4;
- ext_log_start = (unsigned long *)(log_buf)-3;
- ext_log_size = (unsigned long *)(log_buf)-2;
- ext_logged_chars = (unsigned long *)(log_buf)-1;
+ log = (logbuff_t *)(gd->bd->bi_memsize-LOGBUFF_LEN) - 1;
+
+ /* Set up log version */
+ if ((s = getenv ("logversion")) != NULL)
+ log_version = (int)simple_strtoul (s, NULL, 10);
+
+ if (log_version == 2)
+ tag = log->v2.tag;
+ else
+ tag = log->v1.tag;
post_word = post_word_load();
#ifdef CONFIG_POST
/* The post routines have setup the word so we can simply test it */
- if (post_word_load () & POST_COLDBOOT) {
- logged_chars = log_size = log_start = 0;
- *ext_tag = LOGBUFF_MAGIC;
- }
+ if (tag != LOGBUFF_MAGIC || (post_word & POST_COLDBOOT)) {
+ logbuff_reset ();
+ }
#else
/* No post routines, so we do our own checking */
- if (post_word != LOGBUFF_MAGIC) {
- logged_chars = log_size = log_start = 0;
+ if (tag != LOGBUFF_MAGIC || post_word != LOGBUFF_MAGIC) {
+ logbuff_reset ();
post_word_store (LOGBUFF_MAGIC);
- *ext_tag = LOGBUFF_MAGIC;
- }
+ }
#endif
+ if (log_version == 2 && (long)log->v2.start > (long)log->v2.con)
+ log->v2.start = log->v2.con;
+
/* Initialize default loglevel if present */
if ((s = getenv ("loglevel")) != NULL)
console_loglevel = (int)simple_strtoul (s, NULL, 10);
@@ -106,6 +101,15 @@ void logbuff_init_ptrs (void)
gd->post_log_word |= LOGBUFF_INITIALIZED;
}
+void logbuff_reset (void)
+{
+ memset (log, 0, sizeof (logbuff_t));
+ if (log_version == 2)
+ log->v2.tag = LOGBUFF_MAGIC;
+ else
+ log->v1.tag = LOGBUFF_MAGIC;
+}
+
int drv_logbuff_init (void)
{
device_t logdev;
@@ -162,7 +166,7 @@ void logbuff_log(char *msg)
int do_log (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
char *s;
- unsigned long i;
+ unsigned long i, start, size;
if (strcmp(argv[1],"append") == 0) {
/* Log concatenation of all arguments separated by spaces */
@@ -177,21 +181,34 @@ int do_log (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
case 2:
if (strcmp(argv[1],"show") == 0) {
- for (i=0; i < (log_size&LOGBUFF_MASK); i++) {
- s = (char *)log_buf+((log_start+i)&LOGBUFF_MASK);
+ if (log_version == 2) {
+ start = log->v2.start;
+ size = log->v2.end - log->v2.start;
+ }
+ else {
+ start = log->v1.start;
+ size = log->v1.size;
+ }
+ for (i=0; i < (size&LOGBUFF_MASK); i++) {
+ s = (char *)log->buf+((start+i)&LOGBUFF_MASK);
putc (*s);
}
return 0;
} else if (strcmp(argv[1],"reset") == 0) {
- log_start = 0;
- log_size = 0;
- logged_chars = 0;
+ logbuff_reset ();
return 0;
} else if (strcmp(argv[1],"info") == 0) {
- printf ("Logbuffer at %08lx\n", (unsigned long)log_buf);
- printf ("log_start = %08lx\n", log_start);
- printf ("log_size = %08lx\n", log_size);
- printf ("logged_chars = %08lx\n", logged_chars);
+ printf ("Logbuffer at %08lx\n", (unsigned long)log->buf);
+ if (log_version == 2) {
+ printf ("log_start = %08lx\n", log->v2.start);
+ printf ("log_end = %08lx\n", log->v2.end);
+ printf ("logged_chars = %08lx\n", log->v2.chars);
+ }
+ else {
+ printf ("log_start = %08lx\n", log->v1.start);
+ printf ("log_size = %08lx\n", log->v1.size);
+ printf ("logged_chars = %08lx\n", log->v1.chars);
+ }
return 0;
}
printf ("Usage:\n%s\n", cmdtp->usage);
@@ -202,7 +219,7 @@ int do_log (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return 1;
}
}
-#if defined(CONFIG_LOGBUFFER)
+
U_BOOT_CMD(
log, 255, 1, do_log,
"log - manipulate logbuffer\n",
@@ -211,7 +228,7 @@ U_BOOT_CMD(
"log show - show contents\n"
"log append <msg> - append <msg> to the logbuffer\n"
);
-#endif /* CONFIG_LOGBUFFER */
+
static int logbuff_printk(const char *line)
{
int i;
@@ -241,13 +258,22 @@ static int logbuff_printk(const char *line)
}
line_feed = 0;
for (; p < buf_end; p++) {
- log_buf[(log_start+log_size) & LOGBUFF_MASK] = *p;
- if (log_size < LOGBUFF_LEN)
- log_size++;
- else
- log_start++;
-
- logged_chars++;
+ if (log_version == 2) {
+ log->buf[log->v2.end & LOGBUFF_MASK] = *p;
+ log->v2.end++;
+ if (log->v2.end - log->v2.start > LOGBUFF_LEN)
+ log->v2.start++;
+ log->v2.chars++;
+ }
+ else {
+ log->buf[(log->v1.start + log->v1.size) &
+ LOGBUFF_MASK] = *p;
+ if (log->v1.size < LOGBUFF_LEN)
+ log->v1.size++;
+ else
+ log->v1.start++;
+ log->v1.chars++;
+ }
if (*p == '\n') {
line_feed = 1;
break;
diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index fcbb023..a994211 100644
--- a/common/cmd_mem.c
+++ b/common/cmd_mem.c
@@ -29,18 +29,19 @@
#include <common.h>
#include <command.h>
-#if (CONFIG_COMMANDS & CFG_CMD_MMC)
+#if defined(CONFIG_CMD_MMC)
#include <mmc.h>
#endif
#ifdef CONFIG_HAS_DATAFLASH
#include <dataflash.h>
#endif
-#if (CONFIG_COMMANDS & (CFG_CMD_MEMORY | \
- CFG_CMD_I2C | \
- CFG_CMD_ITEST | \
- CFG_CMD_PCI | \
- CMD_CMD_PORTIO ) )
+#if defined(CONFIG_CMD_MEMORY) \
+ || defined(CONFIG_CMD_I2C) \
+ || defined(CONFIG_CMD_ITEST) \
+ || defined(CONFIG_CMD_PCI) \
+ || defined(CONFIG_CMD_PORTIO)
+
int cmd_get_data_size(char* arg, int default_size)
{
/* Check for a size specification .b, .w or .l.
@@ -64,7 +65,7 @@ int cmd_get_data_size(char* arg, int default_size)
}
#endif
-#if (CONFIG_COMMANDS & CFG_CMD_MEMORY)
+#if defined(CONFIG_CMD_MEMORY)
#ifdef CMD_MEM_DEBUG
#define PRINTF(fmt,args...) printf (fmt ,##args)
@@ -403,7 +404,7 @@ int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
#endif
-#if (CONFIG_COMMANDS & CFG_CMD_MMC)
+#if defined(CONFIG_CMD_MMC)
if (mmc2info(dest)) {
int rc;
@@ -1149,7 +1150,7 @@ int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
#endif /* CONFIG_CRC32_VERIFY */
/**************************************************/
-#if (CONFIG_COMMANDS & CFG_CMD_MEMORY)
+#if defined(CONFIG_CMD_MEMORY)
U_BOOT_CMD(
md, 3, 1, do_mem_md,
"md - memory display\n",
@@ -1252,4 +1253,4 @@ U_BOOT_CMD(
#endif /* CONFIG_MX_CYCLIC */
#endif
-#endif /* CFG_CMD_MEMORY */
+#endif
diff --git a/common/cmd_mfsl.c b/common/cmd_mfsl.c
new file mode 100644
index 0000000..8d4c1a3
--- /dev/null
+++ b/common/cmd_mfsl.c
@@ -0,0 +1,417 @@
+/*
+ * (C) Copyright 2007 Michal Simek
+ *
+ * Michal SIMEK <monstr@monstr.eu>
+ *
+ * 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
+ */
+
+/*
+ * Microblaze FSL support
+ */
+
+#include <common.h>
+#include <config.h>
+#include <command.h>
+
+#if defined(CONFIG_CMD_MFSL)
+#include <asm/asm.h>
+
+int do_frd (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
+{
+ unsigned int fslnum;
+ unsigned int num;
+ unsigned int blocking;
+
+ if (argc < 2) {
+ printf ("Usage:\n%s\n", cmdtp->usage);
+ return 1;
+ }
+
+ fslnum = (unsigned int)simple_strtoul (argv[1], NULL, 16);
+ blocking = (unsigned int)simple_strtoul (argv[2], NULL, 16);
+ if (fslnum < 0 || fslnum >= XILINX_FSL_NUMBER) {
+ puts ("Bad number of FSL\n");
+ printf ("Usage:\n%s\n", cmdtp->usage);
+ return 1;
+ }
+
+ switch (fslnum) {
+#if (XILINX_FSL_NUMBER > 0)
+ case 0:
+ switch (blocking) {
+ case 0: NGET (num, 0);
+ break;
+ case 1: NCGET (num, 0);
+ break;
+ case 2: GET (num, 0);
+ break;
+ case 3: CGET (num, 0);
+ break;
+ default:
+ return 2;
+ }
+ break;
+#endif
+#if (XILINX_FSL_NUMBER > 1)
+ case 1:
+ switch (blocking) {
+ case 0: NGET (num, 1);
+ break;
+ case 1: NCGET (num, 1);
+ break;
+ case 2: GET (num, 1);
+ break;
+ case 3: CGET (num, 1);
+ break;
+ default:
+ return 2;
+ }
+ break;
+#endif
+#if (XILINX_FSL_NUMBER > 2)
+ case 2:
+ switch (blocking) {
+ case 0: NGET (num, 2);
+ break;
+ case 1: NCGET (num, 2);
+ break;
+ case 2: GET (num, 2);
+ break;
+ case 3: CGET (num, 2);
+ break;
+ default:
+ return 2;
+ }
+ break;
+#endif
+#if (XILINX_FSL_NUMBER > 3)
+ case 3:
+ switch (blocking) {
+ case 0: NGET (num, 3);
+ break;
+ case 1: NCGET (num, 3);
+ break;
+ case 2: GET (num, 3);
+ break;
+ case 3: CGET (num, 3);
+ break;
+ default:
+ return 2;
+ }
+ break;
+#endif
+#if (XILINX_FSL_NUMBER > 4)
+ case 4:
+ switch (blocking) {
+ case 0: NGET (num, 4);
+ break;
+ case 1: NCGET (num, 4);
+ break;
+ case 2: GET (num, 4);
+ break;
+ case 3: CGET (num, 4);
+ break;
+ default:
+ return 2;
+ }
+ break;
+#endif
+#if (XILINX_FSL_NUMBER > 5)
+ case 5:
+ switch (blocking) {
+ case 0: NGET (num, 5);
+ break;
+ case 1: NCGET (num, 5);
+ break;
+ case 2: GET (num, 5);
+ break;
+ case 3: CGET (num, 5);
+ break;
+ default:
+ return 2;
+ }
+ break;
+#endif
+#if (XILINX_FSL_NUMBER > 6)
+ case 6:
+ switch (blocking) {
+ case 0: NGET (num, 6);
+ break;
+ case 1: NCGET (num, 6);
+ break;
+ case 2: GET (num, 6);
+ break;
+ case 3: CGET (num, 6);
+ break;
+ default:
+ return 2;
+ }
+ break;
+#endif
+#if (XILINX_FSL_NUMBER > 7)
+ case 7:
+ switch (blocking) {
+ case 0: NGET (num, 7);
+ break;
+ case 1: NCGET (num, 7);
+ break;
+ case 2: GET (num, 7);
+ break;
+ case 3: CGET (num, 7);
+ break;
+ default:
+ return 2;
+ }
+ break;
+#endif
+ default:
+ return 1;
+ }
+
+ printf ("%01x: 0x%08lx - %s %s read\n", fslnum, num,
+ blocking < 2 ? "non blocking" : "blocking",
+ ((blocking == 1) || (blocking == 3)) ? "control" : "data" );
+ return 0;
+}
+
+int do_fwr (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
+{
+ unsigned int fslnum;
+ unsigned int num;
+ unsigned int blocking;
+
+ if (argc < 3) {
+ printf ("Usage:\n%s\n", cmdtp->usage);
+ return 1;
+ }
+
+ fslnum = (unsigned int)simple_strtoul (argv[1], NULL, 16);
+ num = (unsigned int)simple_strtoul (argv[2], NULL, 16);
+ blocking = (unsigned int)simple_strtoul (argv[3], NULL, 16);
+ if (fslnum < 0 || fslnum >= XILINX_FSL_NUMBER) {
+ printf ("Bad number of FSL\nUsage:\n%s\n", cmdtp->usage);
+ return 1;
+ }
+
+ switch (fslnum) {
+#if (XILINX_FSL_NUMBER > 0)
+ case 0:
+ switch (blocking) {
+ case 0: NPUT (num, 0);
+ break;
+ case 1: NCPUT (num, 0);
+ break;
+ case 2: PUT (num, 0);
+ break;
+ case 3: CPUT (num, 0);
+ break;
+ default:
+ return 2;
+ }
+ break;
+#endif
+#if (XILINX_FSL_NUMBER > 1)
+ case 1:
+ switch (blocking) {
+ case 0: NPUT (num, 1);
+ break;
+ case 1: NCPUT (num, 1);
+ break;
+ case 2: PUT (num, 1);
+ break;
+ case 3: CPUT (num, 1);
+ break;
+ default:
+ return 2;
+ }
+ break;
+#endif
+#if (XILINX_FSL_NUMBER > 2)
+ case 2:
+ switch (blocking) {
+ case 0: NPUT (num, 2);
+ break;
+ case 1: NCPUT (num, 2);
+ break;
+ case 2: PUT (num, 2);
+ break;
+ case 3: CPUT (num, 2);
+ break;
+ default:
+ return 2;
+ }
+ break;
+#endif
+#if (XILINX_FSL_NUMBER > 3)
+ case 3:
+ switch (blocking) {
+ case 0: NPUT (num, 3);
+ break;
+ case 1: NCPUT (num, 3);
+ break;
+ case 2: PUT (num, 3);
+ break;
+ case 3: CPUT (num, 3);
+ break;
+ default:
+ return 2;
+ }
+ break;
+#endif
+#if (XILINX_FSL_NUMBER > 4)
+ case 4:
+ switch (blocking) {
+ case 0: NPUT (num, 4);
+ break;
+ case 1: NCPUT (num, 4);
+ break;
+ case 2: PUT (num, 4);
+ break;
+ case 3: CPUT (num, 4);
+ break;
+ default:
+ return 2;
+ }
+ break;
+#endif
+#if (XILINX_FSL_NUMBER > 5)
+ case 5:
+ switch (blocking) {
+ case 0: NPUT (num, 5);
+ break;
+ case 1: NCPUT (num, 5);
+ break;
+ case 2: PUT (num, 5);
+ break;
+ case 3: CPUT (num, 5);
+ break;
+ default:
+ return 2;
+ }
+ break;
+#endif
+#if (XILINX_FSL_NUMBER > 6)
+ case 6:
+ switch (blocking) {
+ case 0: NPUT (num, 6);
+ break;
+ case 1: NCPUT (num, 6);
+ break;
+ case 2: PUT (num, 6);
+ break;
+ case 3: CPUT (num, 6);
+ break;
+ default:
+ return 2;
+ }
+ break;
+#endif
+#if (XILINX_FSL_NUMBER > 7)
+ case 7:
+ switch (blocking) {
+ case 0: NPUT (num, 7);
+ break;
+ case 1: NCPUT (num, 7);
+ break;
+ case 2: PUT (num, 7);
+ break;
+ case 3: CPUT (num, 7);
+ break;
+ default:
+ return 2;
+ }
+ break;
+#endif
+ default:
+ return 1;
+ }
+
+ printf ("%01x: 0x%08lx - %s %s write\n", fslnum, num,
+ blocking < 2 ? "non blocking" : "blocking",
+ ((blocking == 1) || (blocking == 3)) ? "control" : "data" );
+ return 0;
+
+}
+
+int do_rspr (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
+{
+ unsigned int reg = 0;
+ unsigned int val = 0;
+
+ reg = (unsigned int)simple_strtoul (argv[1], NULL, 16);
+ val = (unsigned int)simple_strtoul (argv[2], NULL, 16);
+ if (argc < 1) {
+ printf ("Usage:\n%s\n", cmdtp->usage);
+ return 1;
+ }
+ switch (reg) {
+ case 0x1:
+ if (argc > 2) {
+ MTS (val, rmsr);
+ NOP;
+ MFS (val, rmsr);
+
+ } else {
+ MFS (val, rmsr);
+ }
+ puts ("MSR");
+ break;
+ case 0x3:
+ MFS (val, rear);
+ puts ("EAR");
+ break;
+ case 0x5:
+ MFS (val, resr);
+ puts ("ESR");
+ break;
+ default:
+ return 1;
+ }
+ printf (": 0x%08lx\n", val);
+ return 0;
+}
+
+/***************************************************/
+
+U_BOOT_CMD (frd, 3, 1, do_frd,
+ "frd - read data from FSL\n",
+ "- [fslnum [0|1|2|3]]\n"
+ " 0 - non blocking data read\n"
+ " 1 - non blocking control read\n"
+ " 2 - blocking data read\n"
+ " 3 - blocking control read\n");
+
+
+U_BOOT_CMD (fwr, 4, 1, do_fwr,
+ "fwr - write data to FSL\n",
+ "- [fslnum [0|1|2|3]]\n"
+ " 0 - non blocking data write\n"
+ " 1 - non blocking control write\n"
+ " 2 - blocking data write\n"
+ " 3 - blocking control write\n");
+
+U_BOOT_CMD (rspr, 3, 1, do_rspr,
+ "rmsr - read/write special purpose register\n",
+ "- reg_num [write value] read/write special purpose register\n"
+ " 0 - MSR - Machine status register\n"
+ " 1 - EAR - Exception address register\n"
+ " 2 - ESR - Exception status register\n");
+
+#endif
diff --git a/common/cmd_mii.c b/common/cmd_mii.c
index e659536..72e11d5 100644
--- a/common/cmd_mii.c
+++ b/common/cmd_mii.c
@@ -28,7 +28,7 @@
#include <common.h>
#include <command.h>
-#if (CONFIG_COMMANDS & CFG_CMD_MII)
+#if defined(CONFIG_CMD_MII)
#include <miiphy.h>
#ifdef CONFIG_TERSE_MII
@@ -438,7 +438,7 @@ int do_mii (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
int rcode = 0;
char *devname;
-#ifdef CONFIG_8xx
+#if defined(CONFIG_8xx) || defined(CONFIG_MCF532x)
mii_init ();
#endif
@@ -595,4 +595,4 @@ U_BOOT_CMD(
#endif /* CONFIG_TERSE_MII */
-#endif /* CFG_CMD_MII */
+#endif
diff --git a/common/cmd_misc.c b/common/cmd_misc.c
index 67ee9e8..c0c6b8f 100644
--- a/common/cmd_misc.c
+++ b/common/cmd_misc.c
@@ -27,7 +27,7 @@
#include <common.h>
#include <command.h>
-#if (CONFIG_COMMANDS & CFG_CMD_MISC)
+#if defined(CONFIG_CMD_MISC)
int do_sleep (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
@@ -52,7 +52,7 @@ int do_sleep (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
/* Implemented in $(CPU)/interrupts.c */
-#if (CONFIG_COMMANDS & CFG_CMD_IRQ)
+#if defined(CONFIG_CMD_IRQ)
int do_irqinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
U_BOOT_CMD(
@@ -60,13 +60,13 @@ U_BOOT_CMD(
"irqinfo - print information about IRQs\n",
NULL
);
-#endif /* CONFIG_COMMANDS & CFG_CMD_IRQ */
+#endif
U_BOOT_CMD(
- sleep , 2, 2, do_sleep,
+ sleep , 2, 1, do_sleep,
"sleep - delay execution for some time\n",
"N\n"
" - delay execution for N seconds (N is _decimal_ !!!)\n"
);
-#endif /* CFG_CMD_MISC */
+#endif
diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
index 573eb97..069c6d0 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -24,7 +24,7 @@
#include <common.h>
#include <command.h>
-#if (CONFIG_COMMANDS & CFG_CMD_MMC)
+#if defined(CONFIG_CMD_MMC)
#include <mmc.h>
@@ -43,4 +43,4 @@ U_BOOT_CMD(
NULL
);
-#endif /* CFG_CMD_MMC */
+#endif
diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index b011b5e..1fdd7a6 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -19,24 +19,16 @@
*/
#include <common.h>
-#if (CONFIG_COMMANDS & CFG_CMD_NAND)
+#if defined(CONFIG_CMD_NAND)
#include <command.h>
#include <watchdog.h>
#include <malloc.h>
#include <asm/byteorder.h>
-
-#ifdef CONFIG_SHOW_BOOT_PROGRESS
-# include <status_led.h>
-# define SHOW_BOOT_PROGRESS(arg) show_boot_progress(arg)
-#else
-# define SHOW_BOOT_PROGRESS(arg)
-#endif
-
#include <jffs2/jffs2.h>
#include <nand.h>
-#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
+#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
/* parition handling routines */
int mtdparts_init(void);
@@ -104,7 +96,7 @@ static int
arg_off_size(int argc, char *argv[], nand_info_t *nand, ulong *off, ulong *size)
{
int idx = nand_curr_device;
-#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
+#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
struct mtd_device *dev;
struct part_info *part;
u8 pnum;
@@ -152,7 +144,7 @@ arg_off_size(int argc, char *argv[], nand_info_t *nand, ulong *off, ulong *size)
*size = nand->size - *off;
}
-#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
+#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
out:
#endif
printf("device %d ", idx);
@@ -169,7 +161,11 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
ulong addr, off, size;
char *cmd, *s;
nand_info_t *nand;
+#ifdef CFG_NAND_QUIET
+ int quiet = CFG_NAND_QUIET;
+#else
int quiet = 0;
+#endif
const char *quiet_str = getenv("quiet");
/* at least two arguments please */
@@ -460,7 +456,7 @@ U_BOOT_CMD(nand, 5, 1, do_nand,
"info - show available NAND devices\n"
"nand device [dev] - show or set current device\n"
"nand read[.jffs2] - addr off|partition size\n"
- "nand write[.jffs2] - addr off|partiton size - read/write `size' bytes starting\n"
+ "nand write[.jffs2] - addr off|partition size - read/write `size' bytes starting\n"
" at offset `off' to/from memory address `addr'\n"
"nand erase [clean] [off size] - erase `size' bytes from\n"
" offset `off' (entire device if not specified)\n"
@@ -476,38 +472,68 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
ulong offset, ulong addr, char *cmd)
{
int r;
- char *ep;
+ char *ep, *s;
ulong cnt;
image_header_t *hdr;
+ int jffs2 = 0;
+
+ s = strchr(cmd, '.');
+ if (s != NULL &&
+ (!strcmp(s, ".jffs2") || !strcmp(s, ".e") || !strcmp(s, ".i")))
+ jffs2 = 1;
printf("\nLoading from %s, offset 0x%lx\n", nand->name, offset);
cnt = nand->oobblock;
- r = nand_read(nand, offset, &cnt, (u_char *) addr);
+ if (jffs2) {
+ nand_read_options_t opts;
+ memset(&opts, 0, sizeof(opts));
+ opts.buffer = (u_char*) addr;
+ opts.length = cnt;
+ opts.offset = offset;
+ opts.quiet = 1;
+ r = nand_read_opts(nand, &opts);
+ } else {
+ r = nand_read(nand, offset, &cnt, (u_char *) addr);
+ }
+
if (r) {
puts("** Read error\n");
- SHOW_BOOT_PROGRESS(-1);
+ show_boot_progress (-56);
return 1;
}
+ show_boot_progress (56);
hdr = (image_header_t *) addr;
if (ntohl(hdr->ih_magic) != IH_MAGIC) {
printf("\n** Bad Magic Number 0x%x **\n", hdr->ih_magic);
- SHOW_BOOT_PROGRESS(-1);
+ show_boot_progress (-57);
return 1;
}
+ show_boot_progress (57);
print_image_hdr(hdr);
cnt = (ntohl(hdr->ih_size) + sizeof (image_header_t));
+ if (jffs2) {
+ nand_read_options_t opts;
+ memset(&opts, 0, sizeof(opts));
+ opts.buffer = (u_char*) addr;
+ opts.length = cnt;
+ opts.offset = offset;
+ opts.quiet = 1;
+ r = nand_read_opts(nand, &opts);
+ } else {
+ r = nand_read(nand, offset, &cnt, (u_char *) addr);
+ }
- r = nand_read(nand, offset, &cnt, (u_char *) addr);
if (r) {
puts("** Read error\n");
- SHOW_BOOT_PROGRESS(-1);
+ show_boot_progress (-58);
return 1;
}
+ show_boot_progress (58);
/* Loading ok, update default load address */
@@ -534,7 +560,7 @@ int do_nandboot(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
char *boot_device = NULL;
int idx;
ulong addr, offset = 0;
-#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
+#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
struct mtd_device *dev;
struct part_info *part;
u8 pnum;
@@ -550,7 +576,7 @@ int do_nandboot(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
if (argc > 3)
goto usage;
if (argc == 3)
- addr = simple_strtoul(argv[2], NULL, 16);
+ addr = simple_strtoul(argv[1], NULL, 16);
else
addr = CFG_LOAD_ADDR;
return nand_load_image(cmdtp, &nand_info[dev->id->num],
@@ -559,6 +585,7 @@ int do_nandboot(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
}
#endif
+ show_boot_progress(52);
switch (argc) {
case 1:
addr = CFG_LOAD_ADDR;
@@ -578,36 +605,39 @@ int do_nandboot(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
offset = simple_strtoul(argv[3], NULL, 16);
break;
default:
-#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
+#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
usage:
#endif
printf("Usage:\n%s\n", cmdtp->usage);
- SHOW_BOOT_PROGRESS(-1);
+ show_boot_progress(-53);
return 1;
}
+ show_boot_progress(53);
if (!boot_device) {
puts("\n** No boot device **\n");
- SHOW_BOOT_PROGRESS(-1);
+ show_boot_progress(-54);
return 1;
}
+ show_boot_progress(54);
idx = simple_strtoul(boot_device, NULL, 16);
if (idx < 0 || idx >= CFG_MAX_NAND_DEVICE || !nand_info[idx].name) {
printf("\n** Device %d not available\n", idx);
- SHOW_BOOT_PROGRESS(-1);
+ show_boot_progress(-55);
return 1;
}
+ show_boot_progress(55);
return nand_load_image(cmdtp, &nand_info[idx], offset, addr, argv[0]);
}
U_BOOT_CMD(nboot, 4, 1, do_nandboot,
"nboot - boot from NAND device\n",
- "[partition] | [[[loadAddr] dev] offset]\n");
+ "[.jffs2] [partition] | [[[loadAddr] dev] offset]\n");
-#endif /* (CONFIG_COMMANDS & CFG_CMD_NAND) */
+#endif
#else /* CFG_NAND_LEGACY */
/*
@@ -620,14 +650,14 @@ U_BOOT_CMD(nboot, 4, 1, do_nandboot,
#include <asm/io.h>
#include <watchdog.h>
-#ifdef CONFIG_SHOW_BOOT_PROGRESS
+#ifdef CONFIG_show_boot_progress
# include <status_led.h>
-# define SHOW_BOOT_PROGRESS(arg) show_boot_progress(arg)
+# define show_boot_progress(arg) show_boot_progress(arg)
#else
-# define SHOW_BOOT_PROGRESS(arg)
+# define show_boot_progress(arg)
#endif
-#if (CONFIG_COMMANDS & CFG_CMD_NAND)
+#if defined(CONFIG_CMD_NAND)
#include <linux/mtd/nand_legacy.h>
#if 0
#include <linux/mtd/nand_ids.h>
@@ -887,6 +917,7 @@ int do_nandboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
ulong offset = 0;
image_header_t *hdr;
int rcode = 0;
+ show_boot_progress (52);
switch (argc) {
case 1:
addr = CFG_LOAD_ADDR;
@@ -907,24 +938,27 @@ int do_nandboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
break;
default:
printf ("Usage:\n%s\n", cmdtp->usage);
- SHOW_BOOT_PROGRESS (-1);
+ show_boot_progress (-53);
return 1;
}
+ show_boot_progress (53);
if (!boot_device) {
puts ("\n** No boot device **\n");
- SHOW_BOOT_PROGRESS (-1);
+ show_boot_progress (-54);
return 1;
}
+ show_boot_progress (54);
dev = simple_strtoul(boot_device, &ep, 16);
if ((dev >= CFG_MAX_NAND_DEVICE) ||
(nand_dev_desc[dev].ChipID == NAND_ChipID_UNKNOWN)) {
printf ("\n** Device %d not available\n", dev);
- SHOW_BOOT_PROGRESS (-1);
+ show_boot_progress (-55);
return 1;
}
+ show_boot_progress (55);
printf ("\nLoading from device %d: %s at 0x%lx (offset 0x%lx)\n",
dev, nand_dev_desc[dev].name, nand_dev_desc[dev].IO_ADDR,
@@ -933,9 +967,10 @@ int do_nandboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (nand_legacy_rw (nand_dev_desc + dev, NANDRW_READ, offset,
SECTORSIZE, NULL, (u_char *)addr)) {
printf ("** Read error on %d\n", dev);
- SHOW_BOOT_PROGRESS (-1);
+ show_boot_progress (-56);
return 1;
}
+ show_boot_progress (56);
hdr = (image_header_t *)addr;
@@ -947,17 +982,19 @@ int do_nandboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
cnt -= SECTORSIZE;
} else {
printf ("\n** Bad Magic Number 0x%x **\n", ntohl(hdr->ih_magic));
- SHOW_BOOT_PROGRESS (-1);
+ show_boot_progress (-57);
return 1;
}
+ show_boot_progress (57);
if (nand_legacy_rw (nand_dev_desc + dev, NANDRW_READ,
offset + SECTORSIZE, cnt, NULL,
(u_char *)(addr+SECTORSIZE))) {
printf ("** Read error on %d\n", dev);
- SHOW_BOOT_PROGRESS (-1);
+ show_boot_progress (-58);
return 1;
}
+ show_boot_progress (58);
/* Loading ok, update default load address */
@@ -985,6 +1022,6 @@ U_BOOT_CMD(
"loadAddr dev\n"
);
-#endif /* (CONFIG_COMMANDS & CFG_CMD_NAND) */
+#endif
#endif /* CFG_NAND_LEGACY */
diff --git a/common/cmd_net.c b/common/cmd_net.c
index 2cb2c5d..0715fbc 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -28,8 +28,7 @@
#include <command.h>
#include <net.h>
-#if (CONFIG_COMMANDS & CFG_CMD_NET)
-
+#if defined(CONFIG_CMD_NET)
extern int do_bootm (cmd_tbl_t *, int, int, char *[]);
@@ -68,7 +67,7 @@ U_BOOT_CMD(
"[loadAddress] [bootfilename]\n"
);
-#if (CONFIG_COMMANDS & CFG_CMD_DHCP)
+#if defined(CONFIG_CMD_DHCP)
int do_dhcp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
return netboot_common(DHCP, cmdtp, argc, argv);
@@ -79,9 +78,9 @@ U_BOOT_CMD(
"dhcp\t- invoke DHCP client to obtain IP/boot params\n",
"\n"
);
-#endif /* CFG_CMD_DHCP */
+#endif
-#if (CONFIG_COMMANDS & CFG_CMD_NFS)
+#if defined(CONFIG_CMD_NFS)
int do_nfs (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
return netboot_common(NFS, cmdtp, argc, argv);
@@ -92,7 +91,7 @@ U_BOOT_CMD(
"nfs\t- boot image via network using NFS protocol\n",
"[loadAddress] [host ip addr:bootfilename]\n"
);
-#endif /* CFG_CMD_NFS */
+#endif
static void netboot_update_env (void)
{
@@ -128,7 +127,7 @@ static void netboot_update_env (void)
ip_to_string (NetOurDNSIP, tmp);
setenv ("dnsip", tmp);
}
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS2)
+#if defined(CONFIG_BOOTP_DNS2)
if (NetOurDNS2IP) {
ip_to_string (NetOurDNS2IP, tmp);
setenv ("dnsip2", tmp);
@@ -137,13 +136,15 @@ static void netboot_update_env (void)
if (NetOurNISDomain[0])
setenv ("domain", NetOurNISDomain);
-#if (CONFIG_COMMANDS & CFG_CMD_SNTP) && (CONFIG_BOOTP_MASK & CONFIG_BOOTP_TIMEOFFSET)
+#if defined(CONFIG_CMD_SNTP) \
+ && defined(CONFIG_BOOTP_TIMEOFFSET)
if (NetTimeOffset) {
sprintf (tmp, "%d", NetTimeOffset);
setenv ("timeoffset", tmp);
}
#endif
-#if (CONFIG_COMMANDS & CFG_CMD_SNTP) && (CONFIG_BOOTP_MASK & CONFIG_BOOTP_NTPSERVER)
+#if defined(CONFIG_CMD_SNTP) \
+ && defined(CONFIG_BOOTP_NTPSERVER)
if (NetNtpServerIP) {
ip_to_string (NetNtpServerIP, tmp);
setenv ("ntpserverip", tmp);
@@ -184,18 +185,25 @@ netboot_common (proto_t proto, cmd_tbl_t *cmdtp, int argc, char *argv[])
break;
default: printf ("Usage:\n%s\n", cmdtp->usage);
+ show_boot_progress (-80);
return 1;
}
- if ((size = NetLoop(proto)) < 0)
+ show_boot_progress (80);
+ if ((size = NetLoop(proto)) < 0) {
+ show_boot_progress (-81);
return 1;
+ }
+ show_boot_progress (81);
/* NetLoop ok, update environment */
netboot_update_env();
/* done if no file was loaded (no errors though) */
- if (size == 0)
+ if (size == 0) {
+ show_boot_progress (-82);
return 0;
+ }
/* flush cache */
flush_cache(load_addr, size);
@@ -208,19 +216,25 @@ netboot_common (proto_t proto, cmd_tbl_t *cmdtp, int argc, char *argv[])
printf ("Automatic boot of image at addr 0x%08lX ...\n",
load_addr);
+ show_boot_progress (82);
rcode = do_bootm (cmdtp, 0, 1, local_args);
}
#ifdef CONFIG_AUTOSCRIPT
if (((s = getenv("autoscript")) != NULL) && (strcmp(s,"yes") == 0)) {
printf("Running autoscript at addr 0x%08lX ...\n", load_addr);
+ show_boot_progress (83);
rcode = autoscript (load_addr);
}
#endif
+ if (rcode < 0)
+ show_boot_progress (-83);
+ else
+ show_boot_progress (84);
return rcode;
}
-#if (CONFIG_COMMANDS & CFG_CMD_PING)
+#if defined(CONFIG_CMD_PING)
int do_ping (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
if (argc < 2)
@@ -247,9 +261,9 @@ U_BOOT_CMD(
"ping\t- send ICMP ECHO_REQUEST to network host\n",
"pingAddress\n"
);
-#endif /* CFG_CMD_PING */
+#endif
-#if (CONFIG_COMMANDS & CFG_CMD_CDP)
+#if defined(CONFIG_CMD_CDP)
static void cdp_update_env(void)
{
@@ -290,9 +304,9 @@ U_BOOT_CMD(
cdp, 1, 1, do_cdp,
"cdp\t- Perform CDP network configuration\n",
);
-#endif /* CFG_CMD_CDP */
+#endif
-#if (CONFIG_COMMANDS & CFG_CMD_SNTP)
+#if defined(CONFIG_CMD_SNTP)
int do_sntp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
char *toff;
@@ -328,6 +342,6 @@ U_BOOT_CMD(
"sntp\t- synchronize RTC via network\n",
"[NTP server IP]\n"
);
-#endif /* CFG_CMD_SNTP */
+#endif
-#endif /* CFG_CMD_NET */
+#endif
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 977ec5b..1db0fc3 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -46,7 +46,7 @@
#include <serial.h>
#include <linux/stddef.h>
#include <asm/byteorder.h>
-#if (CONFIG_COMMANDS & CFG_CMD_NET)
+#if defined(CONFIG_CMD_NET)
#include <net.h>
#endif
@@ -193,7 +193,12 @@ int _do_setenv (int flag, int argc, char *argv[])
* Ethernet Address and serial# can be set only once,
* ver is readonly.
*/
+#ifdef CONFIG_HAS_UID
+ /* Allow serial# forced overwrite with 0xdeaf4add flag */
+ if ( ((strcmp (name, "serial#") == 0) && (flag != 0xdeaf4add)) ||
+#else
if ( (strcmp (name, "serial#") == 0) ||
+#endif
((strcmp (name, "ethaddr") == 0)
#if defined(CONFIG_OVERWRITE_ETHADDR_ONCE) && defined(CONFIG_ETHADDR)
&& (strcmp ((char *)env_get_addr(oldval),MK_STR(CONFIG_ETHADDR)) != 0)
@@ -367,12 +372,12 @@ int _do_setenv (int flag, int argc, char *argv[])
load_addr = simple_strtoul(argv[2], NULL, 16);
return 0;
}
-#if (CONFIG_COMMANDS & CFG_CMD_NET)
+#if defined(CONFIG_CMD_NET)
if (strcmp(argv[1],"bootfile") == 0) {
copy_filename (BootFile, argv[2], sizeof(BootFile));
return 0;
}
-#endif /* CFG_CMD_NET */
+#endif
#ifdef CONFIG_AMIGAONEG3SE
if (strcmp(argv[1], "vga_fg_color") == 0 ||
@@ -397,7 +402,15 @@ void setenv (char *varname, char *varvalue)
_do_setenv (0, 3, argv);
}
-int do_setenv ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+#ifdef CONFIG_HAS_UID
+void forceenv (char *varname, char *varvalue)
+{
+ char *argv[4] = { "forceenv", varname, varvalue, NULL };
+ _do_setenv (0xdeaf4add, 3, argv);
+}
+#endif
+
+int do_setenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
if (argc < 2) {
printf ("Usage:\n%s\n", cmdtp->usage);
@@ -411,7 +424,7 @@ int do_setenv ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
* Prompt for environment variable
*/
-#if (CONFIG_COMMANDS & CFG_CMD_ASKENV)
+#if defined(CONFIG_CMD_ASKENV)
int do_askenv ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
extern char console_buffer[CFG_CBSIZE];
@@ -483,7 +496,7 @@ int do_askenv ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
/* Continue calling setenv code */
return _do_setenv (flag, len, local_args);
}
-#endif /* CFG_CMD_ASKENV */
+#endif
/************************************************************************
* Look up variable from environment,
@@ -538,11 +551,9 @@ int getenv_r (char *name, char *buf, unsigned len)
return (-1);
}
-#if defined(CFG_ENV_IS_IN_NVRAM) || defined(CFG_ENV_IS_IN_EEPROM) || \
- ((CONFIG_COMMANDS & (CFG_CMD_ENV|CFG_CMD_FLASH)) == \
- (CFG_CMD_ENV|CFG_CMD_FLASH)) || \
- ((CONFIG_COMMANDS & (CFG_CMD_ENV|CFG_CMD_NAND)) == \
- (CFG_CMD_ENV|CFG_CMD_NAND))
+#if defined(CFG_ENV_IS_IN_NVRAM) || defined(CFG_ENV_IS_IN_EEPROM) \
+ || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_FLASH)) \
+ || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_NAND))
int do_saveenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
extern char * env_name_spec;
@@ -552,7 +563,6 @@ int do_saveenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return (saveenv() ? 1 : 0);
}
-
#endif
@@ -596,20 +606,18 @@ U_BOOT_CMD(
" - delete environment variable 'name'\n"
);
-#if defined(CFG_ENV_IS_IN_NVRAM) || defined(CFG_ENV_IS_IN_EEPROM) || \
- ((CONFIG_COMMANDS & (CFG_CMD_ENV|CFG_CMD_FLASH)) == \
- (CFG_CMD_ENV|CFG_CMD_FLASH)) || \
- ((CONFIG_COMMANDS & (CFG_CMD_ENV|CFG_CMD_NAND)) == \
- (CFG_CMD_ENV|CFG_CMD_NAND))
+#if defined(CFG_ENV_IS_IN_NVRAM) || defined(CFG_ENV_IS_IN_EEPROM) \
+ || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_FLASH)) \
+ || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_NAND))
U_BOOT_CMD(
saveenv, 1, 0, do_saveenv,
"saveenv - save environment variables to persistent storage\n",
NULL
);
-#endif /* CFG_CMD_ENV */
+#endif
-#if (CONFIG_COMMANDS & CFG_CMD_ASKENV)
+#if defined(CONFIG_CMD_ASKENV)
U_BOOT_CMD(
askenv, CFG_MAXARGS, 1, do_askenv,
@@ -624,9 +632,9 @@ U_BOOT_CMD(
" - display 'message' string and get environment variable 'name'"
"from stdin (max 'size' chars)\n"
);
-#endif /* CFG_CMD_ASKENV */
+#endif
-#if (CONFIG_COMMANDS & CFG_CMD_RUN)
+#if defined(CONFIG_CMD_RUN)
int do_run (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
U_BOOT_CMD(
run, CFG_MAXARGS, 1, do_run,
@@ -634,4 +642,4 @@ U_BOOT_CMD(
"var [...]\n"
" - run the commands in the environment variable(s) 'var'\n"
);
-#endif /* CFG_CMD_RUN */
+#endif
diff --git a/common/cmd_pci.c b/common/cmd_pci.c
index 4508546..8be6da9 100644
--- a/common/cmd_pci.c
+++ b/common/cmd_pci.c
@@ -38,7 +38,7 @@
#include <asm/io.h>
#include <pci.h>
-#if (CONFIG_COMMANDS & CFG_CMD_PCI)
+#if defined(CONFIG_CMD_PCI)
extern int cmd_get_data_size(char* arg, int default_size);
@@ -565,6 +565,6 @@ U_BOOT_CMD(
" - write to CFG address\n"
);
-#endif /* (CONFIG_COMMANDS & CFG_CMD_PCI) */
+#endif
#endif /* CONFIG_PCI */
diff --git a/common/cmd_pcmcia.c b/common/cmd_pcmcia.c
index 2eb5b26..dcd07c0 100644
--- a/common/cmd_pcmcia.c
+++ b/common/cmd_pcmcia.c
@@ -61,7 +61,7 @@
/* -------------------------------------------------------------------- */
-#if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
+#if defined(CONFIG_CMD_PCMCIA)
extern int pcmcia_on (void);
extern int pcmcia_off (void);
@@ -87,19 +87,19 @@ int do_pinit (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
U_BOOT_CMD(
- pinit, 2, 1, do_pinit,
+ pinit, 2, 0, do_pinit,
"pinit - PCMCIA sub-system\n",
"on - power on PCMCIA socket\n"
"pinit off - power off PCMCIA socket\n"
);
-#endif /* CONFIG_COMMANDS & CFG_CMD_PCMCIA */
+#endif
/* -------------------------------------------------------------------- */
#undef CHECK_IDE_DEVICE
-#if (CONFIG_COMMANDS & CFG_CMD_IDE) && defined(CONFIG_IDE_8xx_PCCARD)
+#if defined(CONFIG_CMD_IDE) && defined(CONFIG_IDE_8xx_PCCARD)
#define CHECK_IDE_DEVICE
#endif
diff --git a/common/cmd_portio.c b/common/cmd_portio.c
index d2e4c4b..bfe33e3 100644
--- a/common/cmd_portio.c
+++ b/common/cmd_portio.c
@@ -30,7 +30,7 @@
#include <common.h>
#include <command.h>
-#if (CONFIG_COMMANDS & CFG_CMD_PORTIO)
+#if defined(CONFIG_CMD_PORTIO)
extern int cmd_get_data_size (char *arg, int default_size);
@@ -166,4 +166,4 @@ U_BOOT_CMD(
" - read datum from IO port\n"
);
-#endif /* CFG_CMD_PORTIO */
+#endif
diff --git a/common/cmd_reginfo.c b/common/cmd_reginfo.c
index f428f7e..17e9cd9 100644
--- a/common/cmd_reginfo.c
+++ b/common/cmd_reginfo.c
@@ -32,7 +32,8 @@
#elif defined (CONFIG_MPC5200)
#include <mpc5xxx.h>
#endif
-#if (CONFIG_COMMANDS & CFG_CMD_REGINFO)
+
+#if defined(CONFIG_CMD_REGINFO)
int do_reginfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
@@ -334,14 +335,14 @@ int do_reginfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return 0;
}
-#endif /* CONFIG_COMMANDS & CFG_CMD_REGINFO */
+#endif
/**************************************************/
#if ( defined(CONFIG_8xx) || defined(CONFIG_405GP) || \
defined(CONFIG_405EP) || defined(CONFIG_MPC5200) ) && \
- (CONFIG_COMMANDS & CFG_CMD_REGINFO)
+ defined(CONFIG_CMD_REGINFO)
U_BOOT_CMD(
reginfo, 2, 1, do_reginfo,
diff --git a/common/cmd_reiser.c b/common/cmd_reiser.c
index 09c86e6..1ba3929 100644
--- a/common/cmd_reiser.c
+++ b/common/cmd_reiser.c
@@ -28,7 +28,7 @@
*/
#include <common.h>
-#if (CONFIG_COMMANDS & CFG_CMD_REISER)
+#if defined(CONFIG_CMD_REISER)
#include <config.h>
#include <command.h>
#include <image.h>
@@ -90,7 +90,7 @@ int do_reiserls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
if (!reiserfs_mount(part_length)) {
- printf ("** Bad Reisefs partition or disk - %s %d:%d **\n", argv[1], dev, part);
+ printf ("** Bad Reiserfs partition or disk - %s %d:%d **\n", argv[1], dev, part);
return 1;
}
@@ -183,7 +183,7 @@ int do_reiserload (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return 1;
}
- if (strncmp(info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) {
+ if (strncmp((char *)info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) {
printf ("\n** Invalid partition type \"%.32s\""
" (expect \"" BOOT_PART_TYPE "\")\n",
info.type);
@@ -204,7 +204,7 @@ int do_reiserload (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
if (!reiserfs_mount(part_length)) {
- printf ("** Bad Reisefs partition or disk - %s %d:%d **\n", argv[1], dev, part);
+ printf ("** Bad Reiserfs partition or disk - %s %d:%d **\n", argv[1], dev, part);
return 1;
}
@@ -240,4 +240,4 @@ U_BOOT_CMD(
" to address 'addr' from dos filesystem\n"
);
-#endif /* CONFIG_COMMANDS & CFG_CMD_REISER */
+#endif
diff --git a/common/cmd_sata.c b/common/cmd_sata.c
new file mode 100644
index 0000000..bd4c11f
--- /dev/null
+++ b/common/cmd_sata.c
@@ -0,0 +1,712 @@
+/*
+ * Copyright (C) Procsys. All rights reserved.
+ * Author: Mushtaq Khan <mushtaq_k@procsys.com>
+ * <mushtaqk_921@yahoo.co.in>
+ *
+ *
+ * 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
+ *
+ * with the reference to libata in kernel 2.4.32
+ *
+ */
+
+/*
+ * File contains SATA read-write and other utility functions.
+ */
+#include <common.h>
+#include <asm/io.h>
+#include <pci.h>
+#include <command.h>
+#include <config.h>
+#include <ide.h>
+#include <ata.h>
+
+#ifdef CFG_SATA_SUPPORTED
+/*For debug prints set macro DEBUG_SATA to 1 */
+#define DEBUG_SATA 0
+/*Macro for SATA library specific declarations */
+#define SATA_DECL
+#include <sata.h>
+#undef SATA_DECL
+
+static u8 __inline__
+sata_inb (unsigned long ioaddr)
+{
+ return inb (ioaddr);
+}
+
+static void __inline__
+sata_outb (unsigned char val, unsigned long ioaddr)
+{
+ outb (val, ioaddr);
+}
+
+static void
+output_data (struct sata_ioports *ioaddr, ulong * sect_buf, int words)
+{
+ outsw (ioaddr->data_addr, sect_buf, words << 1);
+}
+
+static int
+input_data (struct sata_ioports *ioaddr, ulong * sect_buf, int words)
+{
+ insw (ioaddr->data_addr, sect_buf, words << 1);
+ return 0;
+}
+
+static void
+sata_cpy (unsigned char *dst, unsigned char *src, unsigned int len)
+{
+ unsigned char *end, *last;
+
+ last = dst;
+ end = src + len - 1;
+
+ /* reserve space for '\0' */
+ if (len < 2)
+ goto OUT;
+
+ /* skip leading white space */
+ while ((*src) && (src < end) && (*src == ' '))
+ ++src;
+
+ /* copy string, omitting trailing white space */
+ while ((*src) && (src < end)) {
+ *dst++ = *src;
+ if (*src++ != ' ')
+ last = dst;
+ }
+ OUT:
+ *last = '\0';
+}
+
+int
+sata_bus_softreset (int num)
+{
+ u8 dev = 0, status = 0, i;
+
+ port[num].dev_mask = 0;
+
+ for (i = 0; i < CFG_SATA_DEVS_PER_BUS; i++) {
+ if (!(sata_devchk (&port[num].ioaddr, i))) {
+ PRINTF ("dev_chk failed for dev#%d\n", i);
+ } else {
+ port[num].dev_mask |= (1 << i);
+ PRINTF ("dev_chk passed for dev#%d\n", i);
+ }
+ }
+
+ if (!(port[num].dev_mask)) {
+ printf ("no devices on port%d\n", num);
+ return 1;
+ }
+
+ dev_select (&port[num].ioaddr, dev);
+
+ port[num].ctl_reg = 0x08; /*Default value of control reg */
+ sata_outb (port[num].ctl_reg, port[num].ioaddr.ctl_addr);
+ udelay (10);
+ sata_outb (port[num].ctl_reg | ATA_SRST, port[num].ioaddr.ctl_addr);
+ udelay (10);
+ sata_outb (port[num].ctl_reg, port[num].ioaddr.ctl_addr);
+
+ /* spec mandates ">= 2ms" before checking status.
+ * We wait 150ms, because that was the magic delay used for
+ * ATAPI devices in Hale Landis's ATADRVR, for the period of time
+ * between when the ATA command register is written, and then
+ * status is checked. Because waiting for "a while" before
+ * checking status is fine, post SRST, we perform this magic
+ * delay here as well.
+ */
+ msleep (150);
+ status = sata_busy_wait (&port[num].ioaddr, ATA_BUSY, 300);
+ while ((status & ATA_BUSY)) {
+ msleep (100);
+ status = sata_busy_wait (&port[num].ioaddr, ATA_BUSY, 3);
+ }
+
+ if (status & ATA_BUSY)
+ printf ("ata%u is slow to respond,plz be patient\n", port);
+
+ while ((status & ATA_BUSY)) {
+ msleep (100);
+ status = sata_chk_status (&port[num].ioaddr);
+ }
+
+ if (status & ATA_BUSY) {
+ printf ("ata%u failed to respond : ", port);
+ printf ("bus reset failed\n");
+ return 1;
+ }
+ return 0;
+}
+
+void
+sata_identify (int num, int dev)
+{
+ u8 cmd = 0, status = 0, devno = num * CFG_SATA_DEVS_PER_BUS + dev;
+ u16 iobuf[ATA_SECT_SIZE];
+ u64 n_sectors = 0;
+ u8 mask = 0;
+
+ memset (iobuf, 0, sizeof (iobuf));
+ hd_driveid_t *iop = (hd_driveid_t *) iobuf;
+
+ if (dev == 0)
+ mask = 0x01;
+ else
+ mask = 0x02;
+
+ if (!(port[num].dev_mask & mask)) {
+ printf ("dev%d is not present on port#%d\n", dev, num);
+ return;
+ }
+
+ printf ("port=%d dev=%d\n", num, dev);
+
+ dev_select (&port[num].ioaddr, dev);
+
+ status = 0;
+ cmd = ATA_CMD_IDENT; /*Device Identify Command */
+ sata_outb (cmd, port[num].ioaddr.command_addr);
+ sata_inb (port[num].ioaddr.altstatus_addr);
+ udelay (10);
+
+ status = sata_busy_wait (&port[num].ioaddr, ATA_BUSY, 1000);
+ if (status & ATA_ERR) {
+ printf ("\ndevice not responding\n");
+ port[num].dev_mask &= ~mask;
+ return;
+ }
+
+ input_data (&port[num].ioaddr, (ulong *) iobuf, ATA_SECTORWORDS);
+
+ PRINTF ("\nata%u: dev %u cfg 49:%04x 82:%04x 83:%04x 84:%04x85:%04x"
+ "86:%04x" "87:%04x 88:%04x\n", num, dev, iobuf[49],
+ iobuf[82], iobuf[83], iobuf[84], iobuf[85], iobuf[86],
+ iobuf[87], iobuf[88]);
+
+ /* we require LBA and DMA support (bits 8 & 9 of word 49) */
+ if (!ata_id_has_dma (iobuf) || !ata_id_has_lba (iobuf)) {
+ PRINTF ("ata%u: no dma/lba\n", num);
+ }
+ ata_dump_id (iobuf);
+
+ if (ata_id_has_lba48 (iobuf)) {
+ n_sectors = ata_id_u64 (iobuf, 100);
+ } else {
+ n_sectors = ata_id_u32 (iobuf, 60);
+ }
+ PRINTF ("no. of sectors %u\n", ata_id_u64 (iobuf, 100));
+ PRINTF ("no. of sectors %u\n", ata_id_u32 (iobuf, 60));
+
+ if (n_sectors == 0) {
+ port[num].dev_mask &= ~mask;
+ return;
+ }
+
+ sata_cpy (sata_dev_desc[devno].revision, iop->fw_rev,
+ sizeof (sata_dev_desc[devno].revision));
+ sata_cpy (sata_dev_desc[devno].vendor, iop->model,
+ sizeof (sata_dev_desc[devno].vendor));
+ sata_cpy (sata_dev_desc[devno].product, iop->serial_no,
+ sizeof (sata_dev_desc[devno].product));
+ strswab (sata_dev_desc[devno].revision);
+ strswab (sata_dev_desc[devno].vendor);
+
+ if ((iop->config & 0x0080) == 0x0080) {
+ sata_dev_desc[devno].removable = 1;
+ } else {
+ sata_dev_desc[devno].removable = 0;
+ }
+
+ sata_dev_desc[devno].lba = iop->lba_capacity;
+ PRINTF ("lba=0x%x", sata_dev_desc[devno].lba);
+
+#ifdef CONFIG_LBA48
+ if (iop->command_set_2 & 0x0400) {
+ sata_dev_desc[devno].lba48 = 1;
+ lba = (unsigned long long) iop->lba48_capacity[0] |
+ ((unsigned long long) iop->lba48_capacity[1] << 16) |
+ ((unsigned long long) iop->lba48_capacity[2] << 32) |
+ ((unsigned long long) iop->lba48_capacity[3] << 48);
+ } else {
+ sata_dev_desc[devno].lba48 = 0;
+ }
+#endif
+
+ /* assuming HD */
+ sata_dev_desc[devno].type = DEV_TYPE_HARDDISK;
+ sata_dev_desc[devno].blksz = ATA_BLOCKSIZE;
+ sata_dev_desc[devno].lun = 0; /* just to fill something in... */
+}
+
+void
+set_Feature_cmd (int num, int dev)
+{
+ u8 mask = 0x00, status = 0;
+
+ if (dev == 0)
+ mask = 0x01;
+ else
+ mask = 0x02;
+
+ if (!(port[num].dev_mask & mask)) {
+ PRINTF ("dev%d is not present on port#%d\n", dev, num);
+ return;
+ }
+
+ dev_select (&port[num].ioaddr, dev);
+
+ sata_outb (SETFEATURES_XFER, port[num].ioaddr.feature_addr);
+ sata_outb (XFER_PIO_4, port[num].ioaddr.nsect_addr);
+ sata_outb (0, port[num].ioaddr.lbal_addr);
+ sata_outb (0, port[num].ioaddr.lbam_addr);
+ sata_outb (0, port[num].ioaddr.lbah_addr);
+
+ sata_outb (ATA_DEVICE_OBS, port[num].ioaddr.device_addr);
+ sata_outb (ATA_CMD_SETF, port[num].ioaddr.command_addr);
+
+ udelay (50);
+ msleep (150);
+
+ status = sata_busy_wait (&port[num].ioaddr, ATA_BUSY, 5000);
+ if ((status & (ATA_STAT_BUSY | ATA_STAT_ERR))) {
+ printf ("Error : status 0x%02x\n", status);
+ port[num].dev_mask &= ~mask;
+ }
+}
+
+void
+sata_port (struct sata_ioports *ioport)
+{
+ ioport->data_addr = ioport->cmd_addr + ATA_REG_DATA;
+ ioport->error_addr = ioport->cmd_addr + ATA_REG_ERR;
+ ioport->feature_addr = ioport->cmd_addr + ATA_REG_FEATURE;
+ ioport->nsect_addr = ioport->cmd_addr + ATA_REG_NSECT;
+ ioport->lbal_addr = ioport->cmd_addr + ATA_REG_LBAL;
+ ioport->lbam_addr = ioport->cmd_addr + ATA_REG_LBAM;
+ ioport->lbah_addr = ioport->cmd_addr + ATA_REG_LBAH;
+ ioport->device_addr = ioport->cmd_addr + ATA_REG_DEVICE;
+ ioport->status_addr = ioport->cmd_addr + ATA_REG_STATUS;
+ ioport->command_addr = ioport->cmd_addr + ATA_REG_CMD;
+}
+
+int
+sata_devchk (struct sata_ioports *ioaddr, int dev)
+{
+ u8 nsect, lbal;
+
+ dev_select (ioaddr, dev);
+
+ sata_outb (0x55, ioaddr->nsect_addr);
+ sata_outb (0xaa, ioaddr->lbal_addr);
+
+ sata_outb (0xaa, ioaddr->nsect_addr);
+ sata_outb (0x55, ioaddr->lbal_addr);
+
+ sata_outb (0x55, ioaddr->nsect_addr);
+ sata_outb (0xaa, ioaddr->lbal_addr);
+
+ nsect = sata_inb (ioaddr->nsect_addr);
+ lbal = sata_inb (ioaddr->lbal_addr);
+
+ if ((nsect == 0x55) && (lbal == 0xaa))
+ return 1; /* we found a device */
+ else
+ return 0; /* nothing found */
+}
+
+void
+dev_select (struct sata_ioports *ioaddr, int dev)
+{
+ u8 tmp = 0;
+
+ if (dev == 0)
+ tmp = ATA_DEVICE_OBS;
+ else
+ tmp = ATA_DEVICE_OBS | ATA_DEV1;
+
+ sata_outb (tmp, ioaddr->device_addr);
+ sata_inb (ioaddr->altstatus_addr);
+ udelay (5);
+}
+
+u8
+sata_busy_wait (struct sata_ioports *ioaddr, int bits, unsigned int max)
+{
+ u8 status;
+
+ do {
+ udelay (1000);
+ status = sata_chk_status (ioaddr);
+ max--;
+ } while ((status & bits) && (max > 0));
+
+ return status;
+}
+
+u8
+sata_chk_status (struct sata_ioports * ioaddr)
+{
+ return sata_inb (ioaddr->status_addr);
+}
+
+void
+msleep (int count)
+{
+ int i;
+
+ for (i = 0; i < count; i++)
+ udelay (1000);
+}
+
+ulong
+sata_read (int device, ulong blknr,lbaint_t blkcnt, void * buff)
+{
+ ulong n = 0, *buffer = (ulong *)buff;
+ u8 dev = 0, num = 0, mask = 0, status = 0;
+
+#ifdef CONFIG_LBA48
+ unsigned char lba48 = 0;
+
+ if (blknr & 0x0000fffff0000000) {
+ if (!sata_dev_desc[devno].lba48) {
+ printf ("Drive doesn't support 48-bit addressing\n");
+ return 0;
+ }
+ /* more than 28 bits used, use 48bit mode */
+ lba48 = 1;
+ }
+#endif
+ /*Port Number */
+ num = device / CFG_SATA_DEVS_PER_BUS;
+ /*dev on the port */
+ if (device >= CFG_SATA_DEVS_PER_BUS)
+ dev = device - CFG_SATA_DEVS_PER_BUS;
+ else
+ dev = device;
+
+ if (dev == 0)
+ mask = 0x01;
+ else
+ mask = 0x02;
+
+ if (!(port[num].dev_mask & mask)) {
+ printf ("dev%d is not present on port#%d\n", dev, num);
+ return 0;
+ }
+
+ /* Select device */
+ dev_select (&port[num].ioaddr, dev);
+
+ status = sata_busy_wait (&port[num].ioaddr, ATA_BUSY, 500);
+ if (status & ATA_BUSY) {
+ printf ("ata%u failed to respond\n", port[num].port_no);
+ return n;
+ }
+ while (blkcnt-- > 0) {
+ status = sata_busy_wait (&port[num].ioaddr, ATA_BUSY, 500);
+ if (status & ATA_BUSY) {
+ printf ("ata%u failed to respond\n", 0);
+ return n;
+ }
+#ifdef CONFIG_LBA48
+ if (lba48) {
+ /* write high bits */
+ sata_outb (0, port[num].ioaddr.nsect_addr);
+ sata_outb ((blknr >> 24) & 0xFF,
+ port[num].ioaddr.lbal_addr);
+ sata_outb ((blknr >> 32) & 0xFF,
+ port[num].ioaddr.lbam_addr);
+ sata_outb ((blknr >> 40) & 0xFF,
+ port[num].ioaddr.lbah_addr);
+ }
+#endif
+ sata_outb (1, port[num].ioaddr.nsect_addr);
+ sata_outb (((blknr) >> 0) & 0xFF,
+ port[num].ioaddr.lbal_addr);
+ sata_outb ((blknr >> 8) & 0xFF, port[num].ioaddr.lbam_addr);
+ sata_outb ((blknr >> 16) & 0xFF, port[num].ioaddr.lbah_addr);
+
+#ifdef CONFIG_LBA48
+ if (lba48) {
+ sata_outb (ATA_LBA, port[num].ioaddr.device_addr);
+ sata_outb (ATA_CMD_READ_EXT,
+ port[num].ioaddr.command_addr);
+ } else
+#endif
+ {
+ sata_outb (ATA_LBA | ((blknr >> 24) & 0xF),
+ port[num].ioaddr.device_addr);
+ sata_outb (ATA_CMD_READ,
+ port[num].ioaddr.command_addr);
+ }
+
+ msleep (50);
+ /*may take up to 4 sec */
+ status = sata_busy_wait (&port[num].ioaddr, ATA_BUSY, 4000);
+
+ if ((status & (ATA_STAT_DRQ | ATA_STAT_BUSY | ATA_STAT_ERR))
+ != ATA_STAT_DRQ) {
+ u8 err = 0;
+
+ printf ("Error no DRQ dev %d blk %ld: sts 0x%02x\n",
+ device, (ulong) blknr, status);
+ err = sata_inb (port[num].ioaddr.error_addr);
+ printf ("Error reg = 0x%x\n", err);
+ return (n);
+ }
+ input_data (&port[num].ioaddr, buffer, ATA_SECTORWORDS);
+ sata_inb (port[num].ioaddr.altstatus_addr);
+ udelay (50);
+
+ ++n;
+ ++blknr;
+ buffer += ATA_SECTORWORDS;
+ }
+ return n;
+}
+
+ulong
+sata_write (int device, ulong blknr,lbaint_t blkcnt, void * buff)
+{
+ ulong n = 0, *buffer = (ulong *)buff;
+ unsigned char status = 0, num = 0, dev = 0, mask = 0;
+
+#ifdef CONFIG_LBA48
+ unsigned char lba48 = 0;
+
+ if (blknr & 0x0000fffff0000000) {
+ if (!sata_dev_desc[devno].lba48) {
+ printf ("Drive doesn't support 48-bit addressing\n");
+ return 0;
+ }
+ /* more than 28 bits used, use 48bit mode */
+ lba48 = 1;
+ }
+#endif
+ /*Port Number */
+ num = device / CFG_SATA_DEVS_PER_BUS;
+ /*dev on the Port */
+ if (device >= CFG_SATA_DEVS_PER_BUS)
+ dev = device - CFG_SATA_DEVS_PER_BUS;
+ else
+ dev = device;
+
+ if (dev == 0)
+ mask = 0x01;
+ else
+ mask = 0x02;
+
+ /* Select device */
+ dev_select (&port[num].ioaddr, dev);
+
+ status = sata_busy_wait (&port[num].ioaddr, ATA_BUSY, 500);
+ if (status & ATA_BUSY) {
+ printf ("ata%u failed to respond\n", port[num].port_no);
+ return n;
+ }
+
+ while (blkcnt-- > 0) {
+ status = sata_busy_wait (&port[num].ioaddr, ATA_BUSY, 500);
+ if (status & ATA_BUSY) {
+ printf ("ata%u failed to respond\n",
+ port[num].port_no);
+ return n;
+ }
+#ifdef CONFIG_LBA48
+ if (lba48) {
+ /* write high bits */
+ sata_outb (0, port[num].ioaddr.nsect_addr);
+ sata_outb ((blknr >> 24) & 0xFF,
+ port[num].ioaddr.lbal_addr);
+ sata_outb ((blknr >> 32) & 0xFF,
+ port[num].ioaddr.lbam_addr);
+ sata_outb ((blknr >> 40) & 0xFF,
+ port[num].ioaddr.lbah_addr);
+ }
+#endif
+ sata_outb (1, port[num].ioaddr.nsect_addr);
+ sata_outb ((blknr >> 0) & 0xFF, port[num].ioaddr.lbal_addr);
+ sata_outb ((blknr >> 8) & 0xFF, port[num].ioaddr.lbam_addr);
+ sata_outb ((blknr >> 16) & 0xFF, port[num].ioaddr.lbah_addr);
+#ifdef CONFIG_LBA48
+ if (lba48) {
+ sata_outb (ATA_LBA, port[num].ioaddr.device_addr);
+ sata_outb (ATA_CMD_WRITE_EXT,
+ port[num].ioaddr.command_addr);
+ } else
+#endif
+ {
+ sata_outb (ATA_LBA | ((blknr >> 24) & 0xF),
+ port[num].ioaddr.device_addr);
+ sata_outb (ATA_CMD_WRITE,
+ port[num].ioaddr.command_addr);
+ }
+
+ msleep (50);
+ /*may take up to 4 sec */
+ status = sata_busy_wait (&port[num].ioaddr, ATA_BUSY, 4000);
+ if ((status & (ATA_STAT_DRQ | ATA_STAT_BUSY | ATA_STAT_ERR))
+ != ATA_STAT_DRQ) {
+ printf ("Error no DRQ dev %d blk %ld: sts 0x%02x\n",
+ device, (ulong) blknr, status);
+ return (n);
+ }
+
+ output_data (&port[num].ioaddr, buffer, ATA_SECTORWORDS);
+ sata_inb (port[num].ioaddr.altstatus_addr);
+ udelay (50);
+
+ ++n;
+ ++blknr;
+ buffer += ATA_SECTORWORDS;
+ }
+ return n;
+}
+
+block_dev_desc_t *sata_get_dev (int dev);
+
+block_dev_desc_t *
+sata_get_dev (int dev)
+{
+ return ((block_dev_desc_t *) & sata_dev_desc[dev]);
+}
+
+int
+do_sata (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
+{
+
+ switch (argc) {
+ case 0:
+ case 1:
+ printf ("Usage:\n%s\n", cmdtp->usage);
+ return 1;
+ case 2:
+ if (strncmp (argv[1], "init", 4) == 0) {
+ int rcode = 0;
+
+ rcode = init_sata ();
+ if (rcode)
+ printf ("Sata initialization Failed\n");
+ return rcode;
+ } else if (strncmp (argv[1], "inf", 3) == 0) {
+ int i;
+
+ putc ('\n');
+ for (i = 0; i < CFG_SATA_MAXDEVICES; ++i) {
+ /*List only known devices */
+ if (sata_dev_desc[i].type ==
+ DEV_TYPE_UNKNOWN)
+ continue;
+ printf ("sata dev %d: ", i);
+ dev_print (&sata_dev_desc[i]);
+ }
+ return 0;
+ }
+ printf ("Usage:\n%s\n", cmdtp->usage);
+ return 1;
+ case 3:
+ if (strcmp (argv[1], "dev") == 0) {
+ int dev = (int) simple_strtoul (argv[2], NULL, 10);
+
+ if (dev >= CFG_SATA_MAXDEVICES) {
+ printf ("\nSata dev %d not available\n",
+ dev);
+ return 1;
+ }
+ printf ("\nSATA dev %d: ", dev);
+ dev_print (&sata_dev_desc[dev]);
+ if (sata_dev_desc[dev].type == DEV_TYPE_UNKNOWN)
+ return 1;
+ curr_dev = dev;
+ return 0;
+ } else if (strcmp (argv[1], "part") == 0) {
+ int dev = (int) simple_strtoul (argv[2], NULL, 10);
+
+ if (dev >= CFG_SATA_MAXDEVICES) {
+ printf ("\nSata dev %d not available\n",
+ dev);
+ return 1;
+ }
+ PRINTF ("\nSATA dev %d: ", dev);
+ if (sata_dev_desc[dev].part_type !=
+ PART_TYPE_UNKNOWN) {
+ print_part (&sata_dev_desc[dev]);
+ } else {
+ printf ("\nSata dev %d partition type "
+ "unknown\n", dev);
+ return 1;
+ }
+ return 0;
+ }
+ printf ("Usage:\n%s\n", cmdtp->usage);
+ return 1;
+ default:
+ if (argc < 5) {
+ printf ("Usage:\n%s\n", cmdtp->usage);
+ return 1;
+ }
+ if (strcmp (argv[1], "read") == 0) {
+ ulong addr = simple_strtoul (argv[2], NULL, 16);
+ ulong cnt = simple_strtoul (argv[4], NULL, 16);
+ ulong n;
+ lbaint_t blk = simple_strtoul (argv[3], NULL, 16);
+
+ memset ((int *) addr, 0, cnt * 512);
+ printf ("\nSATA read: dev %d blk # %ld,"
+ "count %ld ... ", curr_dev, blk, cnt);
+ n = sata_read (curr_dev, blk, cnt, (ulong *) addr);
+ /* flush cache after read */
+ flush_cache (addr, cnt * 512);
+ printf ("%ld blocks read: %s\n", n,
+ (n == cnt) ? "OK" : "ERR");
+ if (n == cnt)
+ return 1;
+ else
+ return 0;
+ } else if (strcmp (argv[1], "write") == 0) {
+ ulong addr = simple_strtoul (argv[2], NULL, 16);
+ ulong cnt = simple_strtoul (argv[4], NULL, 16);
+ ulong n;
+ lbaint_t blk = simple_strtoul (argv[3], NULL, 16);
+
+ printf ("\nSata write: dev %d blk # %ld,"
+ "count %ld ... ", curr_dev, blk, cnt);
+ n = sata_write (curr_dev, blk, cnt, (ulong *) addr);
+ printf ("%ld blocks written: %s\n", n,
+ (n == cnt) ? "OK" : "ERR");
+ if (n == cnt)
+ return 1;
+ else
+ return 0;
+ } else {
+ printf ("Usage:\n%s\n", cmdtp->usage);
+ return 1;
+ }
+ } /*End OF SWITCH */
+}
+
+U_BOOT_CMD (sata, 5, 1, do_sata,
+ "sata init\n"
+ "sata info\n"
+ "sata part device\n"
+ "sata dev device\n"
+ "sata read addr blk# cnt\n"
+ "sata write addr blk# cnt\n", "cmd for init,rw and dev-info\n");
+
+#endif
diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
index 00b84fa..f563931 100644
--- a/common/cmd_scsi.c
+++ b/common/cmd_scsi.c
@@ -34,7 +34,7 @@
#include <image.h>
#include <pci.h>
-#if (CONFIG_COMMANDS & CFG_CMD_SCSI)
+#if defined(CONFIG_CMD_SCSI)
#ifdef CONFIG_SCSI_SYM53C8XX
#define SCSI_VEND_ID 0x1000
@@ -609,4 +609,4 @@ U_BOOT_CMD(
"loadAddr dev:part\n"
);
-#endif /* #if (CONFIG_COMMANDS & CFG_CMD_SCSI) */
+#endif
diff --git a/common/cmd_spi.c b/common/cmd_spi.c
index a6fdf7f..3118d27 100644
--- a/common/cmd_spi.c
+++ b/common/cmd_spi.c
@@ -29,7 +29,7 @@
#include <command.h>
#include <spi.h>
-#if (CONFIG_COMMANDS & CFG_CMD_SPI)
+#if defined(CONFIG_CMD_SPI)
/*-----------------------------------------------------------------------
* Definitions
@@ -140,4 +140,4 @@ U_BOOT_CMD(
"<dout> - Hexadecimal string that gets sent\n"
);
-#endif /* CFG_CMD_SPI */
+#endif
diff --git a/common/cmd_universe.c b/common/cmd_universe.c
index 8d7b6fe..8bf0b1f 100644
--- a/common/cmd_universe.c
+++ b/common/cmd_universe.c
@@ -28,7 +28,7 @@
#include <universe.h>
-#if (CONFIG_COMMANDS & CFG_CMD_UNIVERSE)
+#if defined(CONFIG_CMD_UNIVERSE)
#define PCI_VENDOR PCI_VENDOR_ID_TUNDRA
#define PCI_DEVICE PCI_DEVICE_ID_TUNDRA_CA91C042
@@ -387,4 +387,4 @@ U_BOOT_CMD(
" 03 -> D32 Data Width\n"
);
-#endif /* (CONFIG_COMMANDS & CFG_CMD_UNIVERSE) */
+#endif
diff --git a/common/cmd_usb.c b/common/cmd_usb.c
index 904df71..45e07f1 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -30,7 +30,7 @@
#include <asm/byteorder.h>
#include <part.h>
-#if (CONFIG_COMMANDS & CFG_CMD_USB)
+#if defined(CONFIG_CMD_USB)
#include <usb.h>
@@ -609,10 +609,10 @@ int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
-#endif /* (CONFIG_COMMANDS & CFG_CMD_USB) */
+#endif
-#if (CONFIG_COMMANDS & CFG_CMD_USB)
+#if defined(CONFIG_CMD_USB)
#ifdef CONFIG_USB_STORAGE
U_BOOT_CMD(
diff --git a/common/cmd_vfd.c b/common/cmd_vfd.c
index 5e623a2..29c349d 100644
--- a/common/cmd_vfd.c
+++ b/common/cmd_vfd.c
@@ -35,7 +35,7 @@
#include <common.h>
#include <command.h>
-#if (CONFIG_COMMANDS & CFG_CMD_VFD)
+#if defined(CONFIG_CMD_VFD)
#include <vfd_logo.h>
#define VFD_TEST_LOGO_BMPNR 0
@@ -73,7 +73,7 @@ U_BOOT_CMD(
"vfd ADDR\n"
" - load bitmap at address ADDR\n"
);
-#endif /* CFG_CMD_VFD */
+#endif
#ifdef CONFIG_VFD
int trab_vfd (ulong bitmap)
diff --git a/common/cmd_ximg.c b/common/cmd_ximg.c
index 8359153..52e0614 100644
--- a/common/cmd_ximg.c
+++ b/common/cmd_ximg.c
@@ -24,7 +24,7 @@
* MA 02111-1307 USA
*/
-#if (CONFIG_COMMANDS & CFG_CMD_XIMG)
+#if defined(CONFIG_CMD_XIMG)
/*
* Multi Image extract
@@ -141,4 +141,4 @@ U_BOOT_CMD(imxtract, 4, 1, do_imgextract,
"addr part [dest]\n"
" - extract <part> from image at <addr> and copy to <dest>\n");
-#endif /* CONFIG_COMMANDS & CFG_CMD_XIMG */
+#endif
diff --git a/common/command.c b/common/command.c
index e917975..af2f8cb 100644
--- a/common/command.c
+++ b/common/command.c
@@ -42,7 +42,7 @@ U_BOOT_CMD(
NULL
);
-#if (CONFIG_COMMANDS & CFG_CMD_ECHO)
+#if defined(CONFIG_CMD_ECHO)
int
do_echo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
@@ -76,7 +76,7 @@ U_BOOT_CMD(
" - echo args to console; \\c suppresses newline\n"
);
-#endif /* CFG_CMD_ECHO */
+#endif
#ifdef CFG_HUSH_PARSER
@@ -409,7 +409,7 @@ void install_auto_complete(void)
{
install_auto_complete_handler("printenv", var_complete);
install_auto_complete_handler("setenv", var_complete);
-#if (CONFIG_COMMANDS & CFG_CMD_RUN)
+#if defined(CONFIG_CMD_RUN)
install_auto_complete_handler("run", var_complete);
#endif
}
diff --git a/common/docecc.c b/common/docecc.c
index 79adb48..5daa6fc 100644
--- a/common/docecc.c
+++ b/common/docecc.c
@@ -31,7 +31,7 @@
#undef ECC_DEBUG
#undef PSYCHO_DEBUG
-#if (CONFIG_COMMANDS & CFG_CMD_DOC)
+#if defined(CONFIG_CMD_DOC)
#include <linux/mtd/doc2000.h>
@@ -514,4 +514,4 @@ int doc_decode_ecc(unsigned char sector[SECTOR_SIZE], unsigned char ecc1[6])
return nb_errors;
}
-#endif /* (CONFIG_COMMANDS & CFG_CMD_DOC) */
+#endif
diff --git a/common/env_common.c b/common/env_common.c
index eb33422..a494812 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -30,13 +30,6 @@
#include <linux/stddef.h>
#include <malloc.h>
-#ifdef CONFIG_SHOW_BOOT_PROGRESS
-# include <status_led.h>
-# define SHOW_BOOT_PROGRESS(arg) show_boot_progress(arg)
-#else
-# define SHOW_BOOT_PROGRESS(arg)
-#endif
-
DECLARE_GLOBAL_DATA_PTR;
#ifdef CONFIG_AMIGAONEG3SE
@@ -232,7 +225,7 @@ void env_relocate (void)
puts ("Using default environment\n\n");
#else
puts ("*** Warning - bad CRC, using default environment\n\n");
- SHOW_BOOT_PROGRESS (-1);
+ show_boot_progress (-60);
#endif
if (sizeof(default_environment) > ENV_SIZE)
diff --git a/common/env_flash.c b/common/env_flash.c
index 1674b30..eccfb62 100644
--- a/common/env_flash.c
+++ b/common/env_flash.c
@@ -37,10 +37,10 @@
DECLARE_GLOBAL_DATA_PTR;
-#if ((CONFIG_COMMANDS&(CFG_CMD_ENV|CFG_CMD_FLASH)) == (CFG_CMD_ENV|CFG_CMD_FLASH))
+#if defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_FLASH)
#define CMD_SAVEENV
#elif defined(CFG_ENV_ADDR_REDUND)
-#error Cannot use CFG_ENV_ADDR_REDUND without CFG_CMD_ENV & CFG_CMD_FLASH
+#error Cannot use CFG_ENV_ADDR_REDUND without CONFIG_CMD_ENV & CONFIG_CMD_FLASH
#endif
#if defined(CFG_ENV_SIZE_REDUND) && (CFG_ENV_SIZE_REDUND < CFG_ENV_SIZE)
@@ -107,13 +107,6 @@ int env_init(void)
ulong addr1 = (ulong)&(flash_addr->data);
ulong addr2 = (ulong)&(flash_addr_new->data);
-#ifdef CONFIG_OMAP2420H4
- int flash_probe(void);
-
- if(flash_probe() == 0)
- goto bad_flash;
-#endif
-
crc1_ok = (crc32(0, flash_addr->data, ENV_SIZE) == flash_addr->crc);
crc2_ok = (crc32(0, flash_addr_new->data, ENV_SIZE) == flash_addr_new->crc);
@@ -143,9 +136,6 @@ int env_init(void)
gd->env_valid = 2;
}
-#ifdef CONFIG_OMAP2420H4
-bad_flash:
-#endif
return (0);
}
@@ -259,20 +249,12 @@ Done:
int env_init(void)
{
-#ifdef CONFIG_OMAP2420H4
- int flash_probe(void);
-
- if(flash_probe() == 0)
- goto bad_flash;
-#endif
if (crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc) {
gd->env_addr = (ulong)&(env_ptr->data);
gd->env_valid = 1;
return(0);
}
-#ifdef CONFIG_OMAP2420H4
-bad_flash:
-#endif
+
gd->env_addr = (ulong)&default_environment[0];
gd->env_valid = 0;
return (0);
diff --git a/common/env_nand.c b/common/env_nand.c
index 67c4a4e..38a07f8 100644
--- a/common/env_nand.c
+++ b/common/env_nand.c
@@ -39,10 +39,10 @@
#include <malloc.h>
#include <nand.h>
-#if ((CONFIG_COMMANDS&(CFG_CMD_ENV|CFG_CMD_NAND)) == (CFG_CMD_ENV|CFG_CMD_NAND))
+#if defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_NAND)
#define CMD_SAVEENV
#elif defined(CFG_ENV_OFFSET_REDUND)
-#error Cannot use CFG_ENV_OFFSET_REDUND without CFG_CMD_ENV & CFG_CMD_NAND
+#error Cannot use CFG_ENV_OFFSET_REDUND without CONFIG_CMD_ENV & CONFIG_CMD_NAND
#endif
#if defined(CFG_ENV_SIZE_REDUND) && (CFG_ENV_SIZE_REDUND != CFG_ENV_SIZE)
diff --git a/common/environment.c b/common/environment.c
index 1d425a7..24257f7 100644
--- a/common/environment.c
+++ b/common/environment.c
@@ -51,18 +51,7 @@
* a seperate section. Note that ENV_CRC is only defined when building
* U-Boot itself.
*/
-#if (defined(CONFIG_CMI) || \
- defined(CONFIG_FADS) || \
- defined(CONFIG_HYMOD) || \
- defined(CONFIG_ICU862) || \
- defined(CONFIG_R360MPI) || \
- defined(CONFIG_TQM8xxL) || \
- defined(CONFIG_RRVISION) || \
- defined(CONFIG_TRAB) || \
- defined(CONFIG_PPCHAMELEONEVB) || \
- defined(CONFIG_M5271EVB) || \
- defined(CONFIG_IDMR) || \
- defined(CONFIG_NAND_U_BOOT)) && \
+#if (defined(CFG_USE_PPCENV) || defined(CONFIG_NAND_U_BOOT)) && \
defined(ENV_CRC) /* Environment embedded in U-Boot .ppcenv section */
/* XXX - This only works with GNU C */
# define __PPCENV__ __attribute__ ((section(".ppcenv")))
diff --git a/common/exports.c b/common/exports.c
index 0cb4396..ec4656b 100644
--- a/common/exports.c
+++ b/common/exports.c
@@ -28,12 +28,14 @@ void jumptable_init (void)
gd->jt[XF_get_timer] = (void *) get_timer;
gd->jt[XF_simple_strtoul] = (void *) simple_strtoul;
gd->jt[XF_udelay] = (void *) udelay;
+ gd->jt[XF_simple_strtol] = (void *) simple_strtol;
+ gd->jt[XF_strcmp] = (void *) strcmp;
#if defined(CONFIG_I386) || defined(CONFIG_PPC)
gd->jt[XF_install_hdlr] = (void *) irq_install_handler;
gd->jt[XF_free_hdlr] = (void *) irq_free_handler;
#endif /* I386 || PPC */
-#if (CONFIG_COMMANDS & CFG_CMD_I2C)
+#if defined(CONFIG_CMD_I2C)
gd->jt[XF_i2c_write] = (void *) i2c_write;
gd->jt[XF_i2c_read] = (void *) i2c_read;
-#endif /* CFG_CMD_I2C */
+#endif
}
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 69099c4..175d59e 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -37,21 +37,23 @@
*/
DECLARE_GLOBAL_DATA_PTR;
+/*
+ * fdt points to our working device tree.
+ */
+struct fdt_header *fdt;
/********************************************************************/
int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
{
- bd_t *bd = gd->bd;
int nodeoffset;
int err;
- u32 tmp; /* used to set 32 bit integer properties */
- char *str; /* used to set string properties */
- ulong clock;
+ u32 tmp; /* used to set 32 bit integer properties */
+ char *str; /* used to set string properties */
err = fdt_check_header(fdt);
if (err < 0) {
- printf("libfdt: %s\n", fdt_strerror(err));
+ printf("fdt_chosen: %s\n", fdt_strerror(err));
return err;
}
@@ -63,11 +65,12 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
err = fdt_num_reservemap(fdt, &used, &total);
if (err < 0) {
- printf("libfdt: %s\n", fdt_strerror(err));
+ printf("fdt_chosen: %s\n", fdt_strerror(err));
return err;
}
if (used >= total) {
- printf("fdt_chosen: no room in the reserved map (%d of %d)\n",
+ printf("WARNING: "
+ "no room in the reserved map (%d of %d)\n",
used, total);
return -1;
}
@@ -84,7 +87,7 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
err = fdt_replace_reservemap_entry(fdt, j,
initrd_start, initrd_end - initrd_start + 1);
if (err < 0) {
- printf("libfdt: %s\n", fdt_strerror(err));
+ printf("fdt_chosen: %s\n", fdt_strerror(err));
return err;
}
}
@@ -92,7 +95,7 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
/*
* Find the "chosen" node.
*/
- nodeoffset = fdt_path_offset (fdt, "/chosen");
+ nodeoffset = fdt_find_node_by_path (fdt, "/chosen");
/*
* If we have a "chosen" node already the "force the writing"
@@ -110,7 +113,8 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
*/
nodeoffset = fdt_add_subnode(fdt, 0, "chosen");
if (nodeoffset < 0) {
- printf("libfdt: %s\n", fdt_strerror(nodeoffset));
+ printf("WARNING: could not create /chosen %s.\n",
+ fdt_strerror(nodeoffset));
return nodeoffset;
}
}
@@ -120,42 +124,35 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
*/
str = getenv("bootargs");
if (str != NULL) {
- err = fdt_setprop(fdt, nodeoffset, "bootargs", str, strlen(str)+1);
+ err = fdt_setprop(fdt, nodeoffset,
+ "bootargs", str, strlen(str)+1);
if (err < 0)
- printf("libfdt: %s\n", fdt_strerror(err));
+ printf("WARNING: could not set bootargs %s.\n",
+ fdt_strerror(err));
}
if (initrd_start && initrd_end) {
tmp = __cpu_to_be32(initrd_start);
- err = fdt_setprop(fdt, nodeoffset, "linux,initrd-start", &tmp, sizeof(tmp));
+ err = fdt_setprop(fdt, nodeoffset,
+ "linux,initrd-start", &tmp, sizeof(tmp));
if (err < 0)
- printf("libfdt: %s\n", fdt_strerror(err));
+ printf("WARNING: "
+ "could not set linux,initrd-start %s.\n",
+ fdt_strerror(err));
tmp = __cpu_to_be32(initrd_end);
- err = fdt_setprop(fdt, nodeoffset, "linux,initrd-end", &tmp, sizeof(tmp));
+ err = fdt_setprop(fdt, nodeoffset,
+ "linux,initrd-end", &tmp, sizeof(tmp));
if (err < 0)
- printf("libfdt: %s\n", fdt_strerror(err));
+ printf("WARNING: could not set linux,initrd-end %s.\n",
+ fdt_strerror(err));
}
#ifdef OF_STDOUT_PATH
- err = fdt_setprop(fdt, nodeoffset, "linux,stdout-path", OF_STDOUT_PATH, strlen(OF_STDOUT_PATH)+1);
+ err = fdt_setprop(fdt, nodeoffset,
+ "linux,stdout-path", OF_STDOUT_PATH, strlen(OF_STDOUT_PATH)+1);
if (err < 0)
- printf("libfdt: %s\n", fdt_strerror(err));
+ printf("WARNING: could not set linux,stdout-path %s.\n",
+ fdt_strerror(err));
#endif
- nodeoffset = fdt_path_offset (fdt, "/cpus");
- if (nodeoffset >= 0) {
- clock = cpu_to_be32(bd->bi_intfreq);
- err = fdt_setprop(fdt, nodeoffset, "clock-frequency", &clock, 4);
- if (err < 0)
- printf("libfdt: %s\n", fdt_strerror(err));
- }
-#ifdef OF_TBCLK
- nodeoffset = fdt_path_offset (fdt, "/cpus/" OF_CPU "/timebase-frequency");
- if (nodeoffset >= 0) {
- clock = cpu_to_be32(OF_TBCLK);
- err = fdt_setprop(fdt, nodeoffset, "clock-frequency", &clock, 4);
- if (err < 0)
- printf("libfdt: %s\n", fdt_strerror(err));
- }
-#endif
return err;
}
@@ -177,7 +174,7 @@ int fdt_env(void *fdt)
err = fdt_check_header(fdt);
if (err < 0) {
- printf("libfdt: %s\n", fdt_strerror(err));
+ printf("fdt_env: %s\n", fdt_strerror(err));
return err;
}
@@ -185,11 +182,11 @@ int fdt_env(void *fdt)
* See if we already have a "u-boot-env" node, delete it if so.
* Then create a new empty node.
*/
- nodeoffset = fdt_path_offset (fdt, "/u-boot-env");
+ nodeoffset = fdt_find_node_by_path (fdt, "/u-boot-env");
if (nodeoffset >= 0) {
err = fdt_del_node(fdt, nodeoffset);
if (err < 0) {
- printf("libfdt: %s\n", fdt_strerror(err));
+ printf("fdt_env: %s\n", fdt_strerror(err));
return err;
}
}
@@ -198,7 +195,8 @@ int fdt_env(void *fdt)
*/
nodeoffset = fdt_add_subnode(fdt, 0, "u-boot-env");
if (nodeoffset < 0) {
- printf("libfdt: %s\n", fdt_strerror(nodeoffset));
+ printf("WARNING: could not create /u-boot-env %s.\n",
+ fdt_strerror(nodeoffset));
return nodeoffset;
}
@@ -226,7 +224,8 @@ int fdt_env(void *fdt)
continue;
err = fdt_setprop(fdt, nodeoffset, lval, rval, strlen(rval)+1);
if (err < 0) {
- printf("libfdt: %s\n", fdt_strerror(err));
+ printf("WARNING: could not set %s %s.\n",
+ lval, fdt_strerror(err));
return err;
}
}
@@ -292,12 +291,12 @@ int fdt_bd_t(void *fdt)
bd_t *bd = gd->bd;
int nodeoffset;
int err;
- u32 tmp; /* used to set 32 bit integer properties */
+ u32 tmp; /* used to set 32 bit integer properties */
int i;
err = fdt_check_header(fdt);
if (err < 0) {
- printf("libfdt: %s\n", fdt_strerror(err));
+ printf("fdt_bd_t: %s\n", fdt_strerror(err));
return err;
}
@@ -305,11 +304,11 @@ int fdt_bd_t(void *fdt)
* See if we already have a "bd_t" node, delete it if so.
* Then create a new empty node.
*/
- nodeoffset = fdt_path_offset (fdt, "/bd_t");
+ nodeoffset = fdt_find_node_by_path (fdt, "/bd_t");
if (nodeoffset >= 0) {
err = fdt_del_node(fdt, nodeoffset);
if (err < 0) {
- printf("libfdt: %s\n", fdt_strerror(err));
+ printf("fdt_bd_t: %s\n", fdt_strerror(err));
return err;
}
}
@@ -318,7 +317,9 @@ int fdt_bd_t(void *fdt)
*/
nodeoffset = fdt_add_subnode(fdt, 0, "bd_t");
if (nodeoffset < 0) {
- printf("libfdt: %s\n", fdt_strerror(nodeoffset));
+ printf("WARNING: could not create /bd_t %s.\n",
+ fdt_strerror(nodeoffset));
+ printf("fdt_bd_t: %s\n", fdt_strerror(nodeoffset));
return nodeoffset;
}
/*
@@ -326,20 +327,23 @@ int fdt_bd_t(void *fdt)
*/
for (i = 0; i < sizeof(bd_map)/sizeof(bd_map[0]); i++) {
tmp = cpu_to_be32(getenv("bootargs"));
- err = fdt_setprop(fdt, nodeoffset, bd_map[i].name, &tmp, sizeof(tmp));
+ err = fdt_setprop(fdt, nodeoffset,
+ bd_map[i].name, &tmp, sizeof(tmp));
if (err < 0)
- printf("libfdt: %s\n", fdt_strerror(err));
+ printf("WARNING: could not set %s %s.\n",
+ bd_map[i].name, fdt_strerror(err));
}
/*
* Add a couple of oddball entries...
*/
err = fdt_setprop(fdt, nodeoffset, "enetaddr", &bd->bi_enetaddr, 6);
if (err < 0)
- printf("libfdt: %s\n", fdt_strerror(err));
+ printf("WARNING: could not set enetaddr %s.\n",
+ fdt_strerror(err));
err = fdt_setprop(fdt, nodeoffset, "ethspeed", &bd->bi_ethspeed, 4);
if (err < 0)
- printf("libfdt: %s\n", fdt_strerror(err));
-
+ printf("WARNING: could not set ethspeed %s.\n",
+ fdt_strerror(err));
return 0;
}
#endif /* ifdef CONFIG_OF_HAS_BD_T */
diff --git a/common/flash.c b/common/flash.c
index a64bc98..888ff9c 100644
--- a/common/flash.c
+++ b/common/flash.c
@@ -47,16 +47,16 @@ flash_protect (int flag, ulong from, ulong to, flash_info_t *info)
short s_end = info->sector_count - 1; /* index of last sector */
int i;
- debug ("flash_protect %s: from 0x%08lX to 0x%08lX\n",
- (flag & FLAG_PROTECT_SET) ? "ON" :
- (flag & FLAG_PROTECT_CLEAR) ? "OFF" : "???",
- from, to);
-
/* Do nothing if input data is bad. */
if (info->sector_count == 0 || info->size == 0 || to < from) {
return;
}
+ debug ("flash_protect %s: from 0x%08lX to 0x%08lX\n",
+ (flag & FLAG_PROTECT_SET) ? "ON" :
+ (flag & FLAG_PROTECT_CLEAR) ? "OFF" : "???",
+ from, to);
+
/* There is nothing to do if we have no data about the flash
* or the protect range and flash range don't overlap.
*/
diff --git a/common/hush.c b/common/hush.c
index feb5627..582635c 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -1682,7 +1682,7 @@ static int run_pipe_real(struct pipe *pi)
return -1; /* give up after bad command */
} else {
int rcode;
-#if (CONFIG_COMMANDS & CFG_CMD_BOOTD)
+#if defined(CONFIG_CMD_BOOTD)
extern int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
/* avoid "bootd" recursion */
@@ -1694,7 +1694,7 @@ static int run_pipe_real(struct pipe *pi)
else
flag |= CMD_FLAG_BOOTD;
}
-#endif /* CFG_CMD_BOOTD */
+#endif
/* found - check max args */
if ((child->argc - i) > cmdtp->maxargs) {
printf ("Usage:\n%s\n", cmdtp->usage);
diff --git a/common/kgdb.c b/common/kgdb.c
index 6de6ec9..1d34669 100644
--- a/common/kgdb.c
+++ b/common/kgdb.c
@@ -92,7 +92,7 @@
#include <kgdb.h>
#include <command.h>
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
+#if defined(CONFIG_CMD_KGDB)
#undef KGDB_DEBUG
@@ -591,4 +591,4 @@ U_BOOT_CMD(
int kgdb_not_configured = 1;
-#endif /* CFG_CMD_KGDB */
+#endif
diff --git a/common/lcd.c b/common/lcd.c
index eaed2ab..914dc2e 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -571,7 +571,7 @@ void bitmap_plot (int x, int y)
#endif /* CONFIG_LCD_LOGO */
/*----------------------------------------------------------------------*/
-#if (CONFIG_COMMANDS & CFG_CMD_BMP) || defined(CONFIG_SPLASH_SCREEN)
+#if defined(CONFIG_CMD_BMP) || defined(CONFIG_SPLASH_SCREEN)
/*
* Display the BMP file located at address bmp_image.
* Only uncompressed.
@@ -700,7 +700,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
return (0);
}
-#endif /* (CONFIG_COMMANDS & CFG_CMD_BMP) || CONFIG_SPLASH_SCREEN */
+#endif
static void *lcd_logo (void)
diff --git a/common/main.c b/common/main.c
index d8c0054..379695c 100644
--- a/common/main.c
+++ b/common/main.c
@@ -44,6 +44,12 @@
DECLARE_GLOBAL_DATA_PTR;
#endif
+/*
+ * Board-specific Platform code can reimplement show_boot_progress () if needed
+ */
+void inline __show_boot_progress (int val) {}
+void inline show_boot_progress (int val) __attribute__((weak, alias("__show_boot_progress")));
+
#if defined(CONFIG_BOOT_RETRY_TIME) && defined(CONFIG_RESET_TO_RETRY)
extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); /* for do_reset() prototype */
#endif
@@ -113,7 +119,7 @@ static __inline__ int abortboot(int bootdelay)
u_int i;
# ifdef CONFIG_AUTOBOOT_PROMPT
- printf (CONFIG_AUTOBOOT_PROMPT, bootdelay);
+ printf(CONFIG_AUTOBOOT_PROMPT, bootdelay);
# endif
# ifdef CONFIG_AUTOBOOT_DELAY_STR
@@ -187,7 +193,7 @@ static __inline__ int abortboot(int bootdelay)
}
# if DEBUG_BOOTKEYS
if (!abort)
- puts ("key timeout\n");
+ puts("key timeout\n");
# endif
#ifdef CONFIG_SILENT_CONSOLE
@@ -244,13 +250,13 @@ static __inline__ int abortboot(int bootdelay)
# endif
break;
}
- udelay (10000);
+ udelay(10000);
}
- printf ("\b\b\b%2d ", bootdelay);
+ printf("\b\b\b%2d ", bootdelay);
}
- putc ('\n');
+ putc('\n');
#ifdef CONFIG_SILENT_CONSOLE
if (abort)
@@ -962,7 +968,7 @@ int readline (const char *const prompt)
n = 0;
continue;
- case 0x17: /* ^W - erase word */
+ case 0x17: /* ^W - erase word */
p=delete_char(console_buffer, p, &col, &n, plen);
while ((n > 0) && (*p != ' ')) {
p=delete_char(console_buffer, p, &col, &n, plen);
@@ -1191,6 +1197,8 @@ static void process_macros (const char *input, char *output)
if (outputcnt)
*output = 0;
+ else
+ *(output - 1) = 0;
#ifdef DEBUG_PARSER
printf ("[PROCESS_MACROS] OUTPUT len %d: \"%s\"\n",
@@ -1309,7 +1317,7 @@ int run_command (const char *cmd, int flag)
continue;
}
-#if (CONFIG_COMMANDS & CFG_CMD_BOOTD)
+#if defined(CONFIG_CMD_BOOTD)
/* avoid "bootd" recursion */
if (cmdtp->cmd == do_bootd) {
#ifdef DEBUG_PARSER
@@ -1323,7 +1331,7 @@ int run_command (const char *cmd, int flag)
flag |= CMD_FLAG_BOOTD;
}
}
-#endif /* CFG_CMD_BOOTD */
+#endif
/* OK - call function to do the command */
if ((cmdtp->cmd) (cmdtp, flag, argc, argv) != 0) {
@@ -1334,7 +1342,7 @@ int run_command (const char *cmd, int flag)
/* Did the user stop this? */
if (had_ctrlc ())
- return 0; /* if stopped then not repeatable */
+ return -1; /* if stopped then not repeatable */
}
return rc ? rc : repeatable;
@@ -1342,7 +1350,7 @@ int run_command (const char *cmd, int flag)
/****************************************************************************/
-#if (CONFIG_COMMANDS & CFG_CMD_RUN)
+#if defined(CONFIG_CMD_RUN)
int do_run (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
{
int i;
@@ -1370,4 +1378,4 @@ int do_run (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
}
return 0;
}
-#endif /* CFG_CMD_RUN */
+#endif
diff --git a/common/miiphyutil.c b/common/miiphyutil.c
index e411e57..c69501f 100644
--- a/common/miiphyutil.c
+++ b/common/miiphyutil.c
@@ -29,7 +29,7 @@
#include <common.h>
#include <miiphy.h>
-#if defined(CONFIG_MII) || (CONFIG_COMMANDS & CFG_CMD_MII)
+#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
#include <asm/types.h>
#include <linux/list.h>
#include <malloc.h>
@@ -470,4 +470,4 @@ int miiphy_link (char *devname, unsigned char addr)
}
#endif
-#endif /* CONFIG_MII || (CONFIG_COMMANDS & CFG_CMD_MII) */
+#endif /* CONFIG_MII */
diff --git a/common/serial.c b/common/serial.c
index 13e9f30..dee1cc0 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -32,7 +32,7 @@ DECLARE_GLOBAL_DATA_PTR;
static struct serial_device *serial_devices = NULL;
static struct serial_device *serial_current = NULL;
-#ifndef CONFIG_LWMON
+#if !defined(CONFIG_LWMON) && !defined(CONFIG_PXA27X)
struct serial_device *default_serial_console (void)
{
#if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2)
@@ -65,7 +65,7 @@ struct serial_device *default_serial_console (void)
}
#endif
-static int serial_register (struct serial_device *dev)
+int serial_register (struct serial_device *dev)
{
dev->init += gd->reloc_off;
dev->setbrg += gd->reloc_off;
@@ -110,6 +110,15 @@ void serial_initialize (void)
serial_register(&eserial4_device);
#endif
#endif /* CFG_NS16550_SERIAL */
+#if defined (CONFIG_FFUART)
+ serial_register(&serial_ffuart_device);
+#endif
+#if defined (CONFIG_BTUART)
+ serial_register(&serial_btuart_device);
+#endif
+#if defined (CONFIG_STUART)
+ serial_register(&serial_stuart_device);
+#endif
serial_assign (default_serial_console ()->name);
}
diff --git a/common/soft_i2c.c b/common/soft_i2c.c
index edad51b..c5d7e20 100644
--- a/common/soft_i2c.c
+++ b/common/soft_i2c.c
@@ -29,13 +29,16 @@
#ifdef CONFIG_MPC8260 /* only valid for MPC8260 */
#include <ioports.h>
#endif
-#ifdef CONFIG_AT91RM9200DK /* need this for the at91rm9200dk */
+#ifdef CONFIG_AT91RM9200 /* need this for the at91rm9200 */
#include <asm/io.h>
#include <asm/arch/hardware.h>
#endif
#ifdef CONFIG_IXP425 /* only valid for IXP425 */
#include <asm/arch/ixp425.h>
#endif
+#ifdef CONFIG_LPC2292
+#include <asm/arch/hardware.h>
+#endif
#include <i2c.h>
#if defined(CONFIG_SOFT_I2C)
diff --git a/common/soft_spi.c b/common/soft_spi.c
index 00a57de..e425061 100644
--- a/common/soft_spi.c
+++ b/common/soft_spi.c
@@ -79,7 +79,9 @@ void spi_init (void)
*/
int spi_xfer(spi_chipsel_type chipsel, int bitlen, uchar *dout, uchar *din)
{
+#ifdef CFG_IMMR
volatile immap_t *immr = (immap_t *)CFG_IMMR;
+#endif
uchar tmpdin = 0;
uchar tmpdout = 0;
int j;
diff --git a/common/usb.c b/common/usb.c
index 0857494..933afa9 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -49,7 +49,7 @@
#include <asm/processor.h>
#include <linux/ctype.h>
-#if (CONFIG_COMMANDS & CFG_CMD_USB)
+#if defined(CONFIG_CMD_USB)
#include <usb.h>
#ifdef CONFIG_4xx
@@ -1247,6 +1247,6 @@ int usb_hub_probe(struct usb_device *dev, int ifnum)
return ret;
}
-#endif /* (CONFIG_COMMANDS & CFG_CMD_USB) */
+#endif
/* EOF */
diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index 56c2166..aec558a 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -129,7 +129,11 @@ static int usb_kbd_testc(void)
static int usb_kbd_getc(void)
{
char c;
- while(usb_in_pointer==usb_out_pointer);
+ while(usb_in_pointer==usb_out_pointer) {
+#ifdef CFG_USB_EVENT_POLL
+ usb_event_poll();
+#endif
+ }
if((usb_out_pointer+1)==USB_KBD_BUFFER_LEN)
usb_out_pointer=0;
else
diff --git a/common/usb_storage.c b/common/usb_storage.c
index 196ceb7..0f79f36 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -55,7 +55,7 @@
#include <asm/processor.h>
-#if (CONFIG_COMMANDS & CFG_CMD_USB)
+#if defined(CONFIG_CMD_USB)
#include <part.h>
#include <usb.h>
@@ -1249,4 +1249,4 @@ int usb_stor_get_info(struct usb_device *dev,struct us_data *ss,block_dev_desc_t
}
#endif /* CONFIG_USB_STORAGE */
-#endif /* CFG_CMD_USB */
+#endif