summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Roese <sr@denx.de>2007-02-20 10:58:04 +0100
committerStefan Roese <sr@denx.de>2007-02-20 10:58:04 +0100
commit90b0cf47eb23e5f3461d3d957f6898386907fd99 (patch)
tree4acaab40f79d89c08cad928fdf52cad3a93dbdec
parent4745acaa1a603b67f6b9b7970365ebadd7d6586f (diff)
parenteb867a76238fb38e952c37871b16d0d7fd61c95f (diff)
downloadu-boot-imx-90b0cf47eb23e5f3461d3d957f6898386907fd99.zip
u-boot-imx-90b0cf47eb23e5f3461d3d957f6898386907fd99.tar.gz
u-boot-imx-90b0cf47eb23e5f3461d3d957f6898386907fd99.tar.bz2
Merge with /home/stefan/git/u-boot/denx-merge-sr
-rwxr-xr-xMAKEALL7
-rw-r--r--Makefile3
-rw-r--r--board/esd/common/auto_update.c3
-rw-r--r--board/lpc2292sodimm/lpc2292sodimm.c2
-rw-r--r--board/mcc200/auto_update.c96
-rw-r--r--board/motionpro/Makefile50
-rw-r--r--board/motionpro/config.mk30
-rw-r--r--board/motionpro/motionpro.c171
-rw-r--r--board/motionpro/u-boot.lds123
-rw-r--r--board/mpl/mip405/mip405.c3
-rw-r--r--board/prodrive/p3mx/p3mx.h34
-rw-r--r--board/trab/auto_update.c1
-rw-r--r--board/xilinx/ml300/Makefile2
-rw-r--r--board/xilinx/ml300/ml300.c2
-rw-r--r--board/xilinx/ml300/serial.c3
-rw-r--r--board/xilinx/xilinx_enet/emac_adapter.c2
-rw-r--r--board/xilinx/xilinx_enet/xemac.h2
-rw-r--r--board/xilinx/xilinx_enet/xemac_g.c2
-rw-r--r--board/xilinx/xilinx_iic/iic_adapter.c2
-rw-r--r--common/Makefile3
-rw-r--r--common/cmd_ace.c267
-rw-r--r--common/cmd_ext2.c40
-rw-r--r--common/cmd_fat.c37
-rw-r--r--common/cmd_ide.c16
-rw-r--r--common/cmd_mem.c65
-rw-r--r--common/cmd_reiser.c40
-rw-r--r--common/cmd_scsi.c6
-rw-r--r--common/cmd_usb.c1
-rw-r--r--common/ft_build.c6
-rw-r--r--common/usb_storage.c7
-rw-r--r--cpu/mpc5xxx/fec.c8
-rw-r--r--cpu/pxa/mmc.c4
-rw-r--r--disk/part.c49
-rw-r--r--drivers/Makefile2
-rw-r--r--drivers/systemace.c247
-rw-r--r--include/common.h2
-rw-r--r--include/configs/bamboo.h1
-rw-r--r--include/configs/bubinga.h1
-rw-r--r--include/configs/ebony.h1
-rw-r--r--include/configs/luan.h1
-rw-r--r--include/configs/motionpro.h305
-rw-r--r--include/configs/ocotea.h1
-rw-r--r--include/configs/sequoia.h4
-rw-r--r--include/configs/taishan.h1
-rw-r--r--include/configs/walnut.h1
-rw-r--r--include/configs/yucca.h1
-rw-r--r--include/ide.h6
-rw-r--r--include/part.h15
-rw-r--r--lib_generic/display_options.c70
49 files changed, 1220 insertions, 526 deletions
diff --git a/MAKEALL b/MAKEALL
index c9f5958..8431b3e 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -37,9 +37,10 @@ LIST_5xx=" \
LIST_5xxx=" \
BC3450 cpci5200 EVAL5200 fo300 \
icecube_5100 icecube_5200 lite5200b mcc200 \
- mecp5200 o2dnt pf5200 PM520 \
- TB5200 Total5100 Total5200 Total5200_Rev2 \
- TQM5200 TQM5200_B TQM5200S v38b \
+ mecp5200 motionpro o2dnt pf5200 \
+ PM520 TB5200 Total5100 Total5200 \
+ Total5200_Rev2 TQM5200 TQM5200_B TQM5200S \
+ v38b \
"
#########################################################################
diff --git a/Makefile b/Makefile
index 546a808..358d181 100644
--- a/Makefile
+++ b/Makefile
@@ -607,6 +607,9 @@ TQM5200_STK100_config: unconfig
@$(MKCONFIG) -n $@ -a TQM5200 ppc mpc5xxx tqm5200
uc101_config: unconfig
@$(MKCONFIG) uc101 ppc mpc5xxx uc101
+motionpro_config: unconfig
+ @$(MKCONFIG) motionpro ppc mpc5xxx motionpro
+
#########################################################################
## MPC8xx Systems
diff --git a/board/esd/common/auto_update.c b/board/esd/common/auto_update.c
index 5cd3423..001fd68 100644
--- a/board/esd/common/auto_update.c
+++ b/board/esd/common/auto_update.c
@@ -33,6 +33,7 @@
#include <asm/byteorder.h>
#include <linux/mtd/nand_legacy.h>
#include <fat.h>
+#include <part.h>
#include "auto_update.h"
@@ -71,8 +72,6 @@ extern int transfer_pic(unsigned char, unsigned char *, int, int);
extern int flash_sect_erase(ulong, ulong);
extern int flash_sect_protect (int, ulong, ulong);
extern int flash_write (char *, ulong, ulong);
-/* change char* to void* to shutup the compiler */
-extern block_dev_desc_t *get_dev (char*, int);
#if (CONFIG_COMMANDS & CFG_CMD_NAND) && defined(CFG_NAND_LEGACY)
/* references to names in cmd_nand.c */
diff --git a/board/lpc2292sodimm/lpc2292sodimm.c b/board/lpc2292sodimm/lpc2292sodimm.c
index de04c66..d212c63 100644
--- a/board/lpc2292sodimm/lpc2292sodimm.c
+++ b/board/lpc2292sodimm/lpc2292sodimm.c
@@ -46,7 +46,7 @@ int board_init (void)
gd->bd->bi_arch_number = 83;
/* location of boot parameters */
- gd->bd->bi_boot_params = 0xc0000100;
+ gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
return 0;
}
diff --git a/board/mcc200/auto_update.c b/board/mcc200/auto_update.c
index f1bb721..df003fe 100644
--- a/board/mcc200/auto_update.c
+++ b/board/mcc200/auto_update.c
@@ -23,6 +23,7 @@
#include <image.h>
#include <asm/byteorder.h>
#include <usb.h>
+#include <part.h>
#ifdef CFG_HUSH_PARSER
#include <hush.h>
@@ -47,25 +48,6 @@
#error "must define CFG_CMD_FAT"
#endif
-/*
- * Check whether a USB memory stick is plugged in.
- * If one is found:
- * 1) if prepare.img ist found load it into memory. If it is
- * valid then run it.
- * 2) if preinst.img is found load it into memory. If it is
- * valid then run it. Update the EEPROM.
- * 3) if firmw_01.img is found load it into memory. If it is valid,
- * burn it into FLASH and update the EEPROM.
- * 4) if kernl_01.img is found load it into memory. If it is valid,
- * burn it into FLASH and update the EEPROM.
- * 5) if app.img is found load it into memory. If it is valid,
- * burn it into FLASH and update the EEPROM.
- * 6) if disk.img is found load it into memory. If it is valid,
- * burn it into FLASH and update the EEPROM.
- * 7) if postinst.img is found load it into memory. If it is
- * valid then run it. Update the EEPROM.
- */
-
#undef AU_DEBUG
#undef debug
@@ -78,6 +60,7 @@
/* possible names of files on the USB stick. */
#define AU_FIRMWARE "u-boot.img"
#define AU_KERNEL "kernel.img"
+#define AU_ROOTFS "rootfs.img"
struct flash_layout {
long start;
@@ -89,33 +72,45 @@ struct flash_layout {
#define AU_FL_FIRMWARE_ND 0xfC03FFFF
#define AU_FL_KERNEL_ST 0xfC0C0000
#define AU_FL_KERNEL_ND 0xfC1BFFFF
+#define AU_FL_ROOTFS_ST 0xFC1C0000
+#define AU_FL_ROOTFS_ND 0xFCFBFFFF
static int au_usb_stor_curr_dev; /* current device */
/* index of each file in the following arrays */
#define IDX_FIRMWARE 0
#define IDX_KERNEL 1
+#define IDX_ROOTFS 2
/* max. number of files which could interest us */
-#define AU_MAXFILES 2
+#define AU_MAXFILES 3
/* pointers to file names */
-char *aufile[AU_MAXFILES];
+char *aufile[AU_MAXFILES] = {
+ AU_FIRMWARE,
+ AU_KERNEL,
+ AU_ROOTFS
+};
/* sizes of flash areas for each file */
-long ausize[AU_MAXFILES];
+long ausize[AU_MAXFILES] = {
+ (AU_FL_FIRMWARE_ND + 1) - AU_FL_FIRMWARE_ST,
+ (AU_FL_KERNEL_ND + 1) - AU_FL_KERNEL_ST,
+ (AU_FL_ROOTFS_ND + 1) - AU_FL_ROOTFS_ST
+};
/* array of flash areas start and end addresses */
-struct flash_layout aufl_layout[AU_MAXFILES] = { \
- {AU_FL_FIRMWARE_ST, AU_FL_FIRMWARE_ND,}, \
- {AU_FL_KERNEL_ST, AU_FL_KERNEL_ND,}, \
+struct flash_layout aufl_layout[AU_MAXFILES] = {
+ {AU_FL_FIRMWARE_ST, AU_FL_FIRMWARE_ND,},
+ {AU_FL_KERNEL_ST, AU_FL_KERNEL_ND,},
+ {AU_FL_ROOTFS_ST, AU_FL_ROOTFS_ND,}
};
/* where to load files into memory */
#define LOAD_ADDR ((unsigned char *)0x00200000)
/* the app is the largest image */
-#define MAX_LOADSZ ausize[IDX_KERNEL]
+#define MAX_LOADSZ ausize[IDX_ROOTFS]
/*i2c address of the keypad status*/
#define I2C_PSOC_KEYPAD_ADDR 0x53
@@ -134,8 +129,6 @@ extern int i2c_read (unsigned char, unsigned int, int , unsigned char* , int);
extern int flash_sect_erase(ulong, ulong);
extern int flash_sect_protect (int, ulong, ulong);
extern int flash_write (char *, ulong, ulong);
-/* change char* to void* to shutup the compiler */
-extern block_dev_desc_t *get_dev (char*, int);
extern int u_boot_hush_start(void);
int au_check_cksum_valid(int idx, long nbytes)
@@ -163,7 +156,6 @@ int au_check_header_valid(int idx, long nbytes)
{
image_header_t *hdr;
unsigned long checksum;
- unsigned char buf[4];
hdr = (image_header_t *)LOAD_ADDR;
/* check the easy ones first */
@@ -200,6 +192,10 @@ int au_check_header_valid(int idx, long nbytes)
printf ("Image %s wrong type\n", aufile[idx]);
return -1;
}
+ if ((idx == IDX_ROOTFS) && (hdr->ih_type != IH_TYPE_RAMDISK)) {
+ printf ("Image %s wrong type\n", aufile[idx]);
+ return -1;
+ }
/* recycle checksum */
checksum = ntohl(hdr->ih_size);
/* for kernel and app the image header must also fit into flash */
@@ -257,7 +253,7 @@ int au_do_update(int idx, long sz)
flash_sect_erase(start, end);
wait_ms(100);
/* strip the header - except for the kernel and ramdisk */
- if (hdr->ih_type == IH_TYPE_KERNEL) {
+ if (hdr->ih_type == IH_TYPE_KERNEL || hdr->ih_type == IH_TYPE_RAMDISK) {
addr = (char *)hdr;
off = sizeof(*hdr);
nbytes = sizeof(*hdr) + ntohl(hdr->ih_size);
@@ -305,7 +301,7 @@ int do_auto_update(void)
int i, res, bitmap_first, cnt, old_ctrlc, got_ctrlc;
char *env;
long start, end;
- char keypad_status1[2] = {0,0}, keypad_status2[2] = {0,0};
+ uchar keypad_status1[2] = {0,0}, keypad_status2[2] = {0,0};
/*
* Read keypad status
@@ -317,10 +313,6 @@ int do_auto_update(void)
/*
* Check keypad
*/
- if ( !(keypad_status1[0] & KEYPAD_MASK_HI) ||
- (keypad_status1[0] != keypad_status2[0])) {
- return 0;
- }
if ( !(keypad_status1[1] & KEYPAD_MASK_LO) ||
(keypad_status1[1] != keypad_status2[1])) {
return 0;
@@ -359,14 +351,6 @@ int do_auto_update(void)
debug ("file_fat_detectfs failed\n");
}
- /* initialize the array of file names */
- memset(aufile, 0, sizeof(aufile));
- aufile[IDX_FIRMWARE] = AU_FIRMWARE;
- aufile[IDX_KERNEL] = AU_KERNEL;
- /* initialize the array of flash sizes */
- memset(ausize, 0, sizeof(ausize));
- ausize[IDX_FIRMWARE] = (AU_FL_FIRMWARE_ND + 1) - AU_FL_FIRMWARE_ST;
- ausize[IDX_KERNEL] = (AU_FL_KERNEL_ND + 1) - AU_FL_KERNEL_ST;
/*
* now check whether start and end are defined using environment
* variables.
@@ -381,8 +365,8 @@ int do_auto_update(void)
end = simple_strtoul(env, NULL, 16);
if (start >= 0 && end && end > start) {
ausize[IDX_FIRMWARE] = (end + 1) - start;
- aufl_layout[0].start = start;
- aufl_layout[0].end = end;
+ aufl_layout[IDX_FIRMWARE].start = start;
+ aufl_layout[IDX_FIRMWARE].end = end;
}
start = -1;
end = 0;
@@ -394,9 +378,23 @@ int do_auto_update(void)
end = simple_strtoul(env, NULL, 16);
if (start >= 0 && end && end > start) {
ausize[IDX_KERNEL] = (end + 1) - start;
- aufl_layout[1].start = start;
- aufl_layout[1].end = end;
+ aufl_layout[IDX_KERNEL].start = start;
+ aufl_layout[IDX_KERNEL].end = end;
}
+ start = -1;
+ end = 0;
+ env = getenv("rootfs_st");
+ if (env != NULL)
+ start = simple_strtoul(env, NULL, 16);
+ env = getenv("rootfs_nd");
+ if (env != NULL)
+ end = simple_strtoul(env, NULL, 16);
+ if (start >= 0 && end && end > start) {
+ ausize[IDX_ROOTFS] = (end + 1) - start;
+ aufl_layout[IDX_ROOTFS].start = start;
+ aufl_layout[IDX_ROOTFS].end = end;
+ }
+
/* make certain that HUSH is runnable */
u_boot_hush_start();
/* make sure that we see CTRL-C and save the old state */
@@ -443,8 +441,8 @@ int do_auto_update(void)
}
cnt++;
#ifdef AU_TEST_ONLY
- } while (res < 0 && cnt < 3);
- if (cnt < 3)
+ } while (res < 0 && cnt < (AU_MAXFILES + 1));
+ if (cnt < (AU_MAXFILES + 1))
#else
} while (res < 0);
#endif
diff --git a/board/motionpro/Makefile b/board/motionpro/Makefile
new file mode 100644
index 0000000..698ead1
--- /dev/null
+++ b/board/motionpro/Makefile
@@ -0,0 +1,50 @@
+#
+# (C) Copyright 2003-2007
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB = $(obj)lib$(BOARD).a
+
+COBJS := $(BOARD).o
+
+SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS := $(addprefix $(obj),$(COBJS))
+SOBJS := $(addprefix $(obj),$(SOBJS))
+
+$(LIB): $(obj).depend $(OBJS)
+ $(AR) $(ARFLAGS) $@ $(OBJS)
+
+clean:
+ rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+ rm -f $(LIB) core *.bak .depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/motionpro/config.mk b/board/motionpro/config.mk
new file mode 100644
index 0000000..e7934d2
--- /dev/null
+++ b/board/motionpro/config.mk
@@ -0,0 +1,30 @@
+#
+# (C) Copyright 2006-2007
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# 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
+#
+
+#
+# Promess Motion-PRO
+#
+
+TEXT_BASE = 0xfff00000
+
+PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -I$(TOPDIR)/board
diff --git a/board/motionpro/motionpro.c b/board/motionpro/motionpro.c
new file mode 100644
index 0000000..95576ed
--- /dev/null
+++ b/board/motionpro/motionpro.c
@@ -0,0 +1,171 @@
+/*
+ * (C) Copyright 2003-2007
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * modified for Promess PRO - by Andy Joseph, andy@promessdev.com
+ * modified for Promess PRO-Motion - by Robert McCullough, rob@promessdev.com
+ * modified by Chris M. Tumas 6/20/06 Change CAS latency to 2 from 3
+ * Also changed the refresh for 100Mhz operation
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <mpc5xxx.h>
+
+
+/* Kollmorgen DPR initialization data */
+struct init_elem {
+ unsigned long addr;
+ unsigned len;
+ char *data;
+ } init_seq[] = {
+ {0x500003F2, 2, "\x86\x00"}, /* HW parameter */
+ {0x500003F0, 2, "\x00\x00"},
+ {0x500003EC, 4, "\x00\x80\xc1\x52"}, /* Magic word */
+ };
+
+/*
+ * Initialize Kollmorgen DPR
+ */
+static void kollmorgen_init(void)
+{
+ unsigned i, j;
+ vu_char *p;
+
+ for (i = 0; i < sizeof(init_seq) / sizeof(struct init_elem); ++i) {
+ p = (vu_char *)init_seq[i].addr;
+ for (j = 0; j < init_seq[i].len; ++j)
+ *(p + j) = *(init_seq[i].data + j);
+ }
+
+ printf("DPR: Kollmorgen DPR initialized\n");
+}
+
+
+/*
+ * Early board initalization.
+ */
+int board_early_init_r(void)
+{
+ /* Now, when we are in RAM, disable Boot Chipselect and enable CS0 */
+ *(vu_long *)MPC5XXX_ADDECR &= ~(1 << 25);
+ *(vu_long *)MPC5XXX_ADDECR |= (1 << 16);
+
+ /* Initialize Kollmorgen DPR */
+ kollmorgen_init();
+
+ return 0;
+}
+
+
+#ifndef CFG_RAMBOOT
+/*
+ * Helper function to initialize SDRAM controller.
+ */
+static void sdram_start (int hi_addr)
+{
+ long hi_addr_bit = hi_addr ? 0x01000000 : 0;
+
+ /* unlock mode register */
+ *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000000 |
+ hi_addr_bit;
+
+ /* precharge all banks */
+ *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 |
+ hi_addr_bit;
+
+ /* auto refresh */
+ *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000004 |
+ hi_addr_bit;
+
+ /* auto refresh, second time */
+ *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000004 |
+ hi_addr_bit;
+
+ /* set mode register */
+ *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE;
+
+ /* normal operation */
+ *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | hi_addr_bit;
+}
+#endif /* !CFG_RAMBOOT */
+
+
+/*
+ * Initalize SDRAM - configure SDRAM controller, detect memory size.
+ */
+long int initdram (int board_type)
+{
+ ulong dramsize = 0;
+#ifndef CFG_RAMBOOT
+ ulong test1, test2;
+
+ /* configure SDRAM start/end for detection */
+ *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x0000001e; /* 2G at 0x0 */
+ *(vu_long *)MPC5XXX_SDRAM_CS1CFG = 0x80000000; /* disabled */
+
+ /* setup config registers */
+ *(vu_long *)MPC5XXX_SDRAM_CONFIG1 = SDRAM_CONFIG1;
+ *(vu_long *)MPC5XXX_SDRAM_CONFIG2 = SDRAM_CONFIG2;
+
+ sdram_start(0);
+ test1 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000);
+ sdram_start(1);
+ test2 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000);
+ if (test1 > test2) {
+ sdram_start(0);
+ dramsize = test1;
+ } else {
+ dramsize = test2;
+ }
+
+ /* memory smaller than 1MB is impossible */
+ if (dramsize < (1 << 20))
+ dramsize = 0;
+
+ /* set SDRAM CS0 size according to the amount of RAM found */
+ if (dramsize > 0)
+ *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x13 +
+ __builtin_ffs(dramsize >> 20) - 1;
+ else
+ *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0; /* disabled */
+
+ /* let SDRAM CS1 start right after CS0 and disable it */
+ *(vu_long *) MPC5XXX_SDRAM_CS1CFG = dramsize;
+
+#else /* !CFG_RAMBOOT */
+ /* retrieve size of memory connected to SDRAM CS0 */
+ dramsize = *(vu_long *)MPC5XXX_SDRAM_CS0CFG & 0xFF;
+ if (dramsize >= 0x13)
+ dramsize = (1 << (dramsize - 0x13)) << 20;
+ else
+ dramsize = 0;
+#endif /* CFG_RAMBOOT */
+
+ /* return total ram size */
+ return dramsize;
+}
+
+
+int checkboard (void)
+{
+ puts("Board: Promess Motion-PRO board\n");
+ return 0;
+}
diff --git a/board/motionpro/u-boot.lds b/board/motionpro/u-boot.lds
new file mode 100644
index 0000000..8fa9c0f
--- /dev/null
+++ b/board/motionpro/u-boot.lds
@@ -0,0 +1,123 @@
+/*
+ * (C) Copyright 2003-2007
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+OUTPUT_ARCH(powerpc)
+SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
+SECTIONS
+{
+ /* Read-only sections, merged into text segment: */
+ . = + SIZEOF_HEADERS;
+ .interp : { *(.interp) }
+ .hash : { *(.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+ .rel.text : { *(.rel.text) }
+ .rela.text : { *(.rela.text) }
+ .rel.data : { *(.rel.data) }
+ .rela.data : { *(.rela.data) }
+ .rel.rodata : { *(.rel.rodata) }
+ .rela.rodata : { *(.rela.rodata) }
+ .rel.got : { *(.rel.got) }
+ .rela.got : { *(.rela.got) }
+ .rel.ctors : { *(.rel.ctors) }
+ .rela.ctors : { *(.rela.ctors) }
+ .rel.dtors : { *(.rel.dtors) }
+ .rela.dtors : { *(.rela.dtors) }
+ .rel.bss : { *(.rel.bss) }
+ .rela.bss : { *(.rela.bss) }
+ .rel.plt : { *(.rel.plt) }
+ .rela.plt : { *(.rela.plt) }
+ .init : { *(.init) }
+ .plt : { *(.plt) }
+ .text :
+ {
+ cpu/mpc5xxx/start.o (.text)
+ *(.text)
+ *(.fixup)
+ *(.got1)
+ . = ALIGN(16);
+ *(.rodata)
+ *(.rodata1)
+ *(.rodata.str1.4)
+ *(.eh_frame)
+ }
+ .fini : { *(.fini) } =0
+ .ctors : { *(.ctors) }
+ .dtors : { *(.dtors) }
+
+ /* Read-write section, merged into data segment: */
+ . = (. + 0x0FFF) & 0xFFFFF000;
+ _erotext = .;
+ PROVIDE (erotext = .);
+ .reloc :
+ {
+ *(.got)
+ _GOT2_TABLE_ = .;
+ *(.got2)
+ _FIXUP_TABLE_ = .;
+ *(.fixup)
+ }
+ __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2;
+ __fixup_entries = (. - _FIXUP_TABLE_) >> 2;
+
+ .data :
+ {
+ *(.data)
+ *(.data1)
+ *(.sdata)
+ *(.sdata2)
+ *(.dynamic)
+ CONSTRUCTORS
+ }
+ _edata = .;
+ PROVIDE (edata = .);
+
+ . = .;
+ __u_boot_cmd_start = .;
+ .u_boot_cmd : { *(.u_boot_cmd) }
+ __u_boot_cmd_end = .;
+
+
+ . = .;
+ __start___ex_table = .;
+ __ex_table : { *(__ex_table) }
+ __stop___ex_table = .;
+
+ . = ALIGN(4096);
+ __init_begin = .;
+ .text.init : { *(.text.init) }
+ .data.init : { *(.data.init) }
+ . = ALIGN(4096);
+ __init_end = .;
+
+ __bss_start = .;
+ .bss :
+ {
+ *(.sbss) *(.scommon)
+ *(.dynbss)
+ *(.bss)
+ *(COMMON)
+ }
+ _end = . ;
+ PROVIDE (end = .);
+}
diff --git a/board/mpl/mip405/mip405.c b/board/mpl/mip405/mip405.c
index 4dbf492..4b1c1c0 100644
--- a/board/mpl/mip405/mip405.c
+++ b/board/mpl/mip405/mip405.c
@@ -73,9 +73,6 @@
DECLARE_GLOBAL_DATA_PTR;
-extern block_dev_desc_t * scsi_get_dev(int dev);
-extern block_dev_desc_t * ide_get_dev(int dev);
-
#undef SDRAM_DEBUG
#define ENABLE_ECC /* for ecc boards */
#define FALSE 0
diff --git a/board/prodrive/p3mx/p3mx.h b/board/prodrive/p3mx/p3mx.h
new file mode 100644
index 0000000..91071e9
--- /dev/null
+++ b/board/prodrive/p3mx/p3mx.h
@@ -0,0 +1,34 @@
+/*
+ * (C) Copyright 2005
+ *
+ * Roel Loeffen, (C) Copyright 2006 Prodrive B.V. roel.loeffen@prodrive.nl
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __P3MX_H__
+#define __P3MX_H__
+
+#define LED_OFF 1
+#define LED_GREEN 2
+#define LED_RED 3
+#define LED_ORANGE 4
+
+#endif /* __P3MX_H__ */
+
diff --git a/board/trab/auto_update.c b/board/trab/auto_update.c
index d2c8d44..f4074ae 100644
--- a/board/trab/auto_update.c
+++ b/board/trab/auto_update.c
@@ -203,7 +203,6 @@ extern int flash_write (char *, ulong, ulong);
/* change char* to void* to shutup the compiler */
extern int i2c_write_multiple (uchar, uint, int, void *, int);
extern int i2c_read_multiple (uchar, uint, int, void *, int);
-extern block_dev_desc_t *get_dev (char*, int);
extern int u_boot_hush_start(void);
int
diff --git a/board/xilinx/ml300/Makefile b/board/xilinx/ml300/Makefile
index 02c22fb..05ad235 100644
--- a/board/xilinx/ml300/Makefile
+++ b/board/xilinx/ml300/Makefile
@@ -28,7 +28,7 @@ $(shell mkdir -p $(obj)../xilinx_enet)
$(shell mkdir -p $(obj)../xilinx_iic)
endif
-INCS := -I../ml300 -I../common -I../xilinx_enet -I../xilinx_iic
+INCS := -I../common -I../xilinx_enet -I../xilinx_iic
CFLAGS += $(INCS)
HOST_CFLAGS += $(INCS)
diff --git a/board/xilinx/ml300/ml300.c b/board/xilinx/ml300/ml300.c
index dad562f..60f0bc2 100644
--- a/board/xilinx/ml300/ml300.c
+++ b/board/xilinx/ml300/ml300.c
@@ -38,9 +38,9 @@
*
*/
+#include <config.h>
#include <common.h>
#include <asm/processor.h>
-#include "xparameters.h"
#ifdef CFG_ENV_IS_IN_EEPROM
extern void convert_env(void);
diff --git a/board/xilinx/ml300/serial.c b/board/xilinx/ml300/serial.c
index c204b88..9b03f89 100644
--- a/board/xilinx/ml300/serial.c
+++ b/board/xilinx/ml300/serial.c
@@ -40,8 +40,7 @@
#include <asm/processor.h>
#include <common.h>
#include <command.h>
-#include <configs/ml300.h>
-#include "xparameters.h"
+#include <config.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/xilinx/xilinx_enet/emac_adapter.c b/board/xilinx/xilinx_enet/emac_adapter.c
index b30e897..f159cb6 100644
--- a/board/xilinx/xilinx_enet/emac_adapter.c
+++ b/board/xilinx/xilinx_enet/emac_adapter.c
@@ -37,9 +37,9 @@
*
******************************************************************************/
+#include <config.h>
#include <common.h>
#include <net.h>
-#include "xparameters.h"
#include "xemac.h"
#if defined(XPAR_EMAC_0_DEVICE_ID)
diff --git a/board/xilinx/xilinx_enet/xemac.h b/board/xilinx/xilinx_enet/xemac.h
index ed704bf..584cb7a 100644
--- a/board/xilinx/xilinx_enet/xemac.h
+++ b/board/xilinx/xilinx_enet/xemac.h
@@ -257,9 +257,9 @@
/***************************** Include Files *********************************/
+#include <config.h>
#include "xbasic_types.h"
#include "xstatus.h"
-#include "xparameters.h"
#include "xpacket_fifo_v1_00_b.h" /* Uses v1.00b of Packet Fifo */
#include "xdma_channel.h"
diff --git a/board/xilinx/xilinx_enet/xemac_g.c b/board/xilinx/xilinx_enet/xemac_g.c
index 9340f91..d985157 100644
--- a/board/xilinx/xilinx_enet/xemac_g.c
+++ b/board/xilinx/xilinx_enet/xemac_g.c
@@ -43,7 +43,7 @@
*
*******************************************************************/
-#include "xparameters.h"
+#include <config.h>
#include "xemac.h"
/*
diff --git a/board/xilinx/xilinx_iic/iic_adapter.c b/board/xilinx/xilinx_iic/iic_adapter.c
index 163fe15..37dce03 100644
--- a/board/xilinx/xilinx_iic/iic_adapter.c
+++ b/board/xilinx/xilinx_iic/iic_adapter.c
@@ -37,10 +37,10 @@
*
******************************************************************************/
+#include <config.h>
#include <common.h>
#include <environment.h>
#include <net.h>
-#include "xparameters.h"
#ifdef CFG_ENV_IS_IN_EEPROM
#include <i2c.h>
diff --git a/common/Makefile b/common/Makefile
index 0106088..6f81c4a 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -27,8 +27,7 @@ LIB = $(obj)libcommon.a
AOBJS =
-COBJS = main.o ACEX1K.o altera.o bedbug.o circbuf.o \
- cmd_ace.o cmd_autoscript.o \
+COBJS = main.o ACEX1K.o altera.o bedbug.o circbuf.o cmd_autoscript.o \
cmd_bdinfo.o cmd_bedbug.o cmd_bmp.o cmd_boot.o cmd_bootm.o \
cmd_cache.o cmd_console.o \
cmd_date.o cmd_dcr.o cmd_diag.o cmd_display.o cmd_doc.o cmd_dtt.o \
diff --git a/common/cmd_ace.c b/common/cmd_ace.c
deleted file mode 100644
index b6d6105..0000000
--- a/common/cmd_ace.c
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * Copyright (c) 2004 Picture Elements, Inc.
- * Stephen Williams (XXXXXXXXXXXXXXXX)
- *
- * This source code is free software; you can redistribute it
- * and/or modify it in source code form 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
- */
-#ident "$Id:$"
-
-/*
- * The Xilinx SystemACE chip support is activated by defining
- * CONFIG_SYSTEMACE to turn on support, and CFG_SYSTEMACE_BASE
- * to set the base address of the device. This code currently
- * assumes that the chip is connected via a byte-wide bus.
- *
- * The CONFIG_SYSTEMACE also adds to fat support the device class
- * "ace" that allows the user to execute "fatls ace 0" and the
- * like. This works by making the systemace_get_dev function
- * available to cmd_fat.c:get_dev and filling in a block device
- * description that has all the bits needed for FAT support to
- * read sectors.
- *
- * According to Xilinx technical support, before accessing the
- * SystemACE CF you need to set the following control bits:
- * FORCECFGMODE : 1
- * CFGMODE : 0
- * CFGSTART : 0
- */
-
-# include <common.h>
-# include <command.h>
-# include <systemace.h>
-# include <part.h>
-# include <asm/io.h>
-
-#ifdef CONFIG_SYSTEMACE
-
-/*
- * The ace_readw and writew functions read/write 16bit words, but the
- * offset value is the BYTE offset as most used in the Xilinx
- * datasheet for the SystemACE chip. The CFG_SYSTEMACE_BASE is defined
- * to be the base address for the chip, usually in the local
- * peripheral bus.
- */
-static unsigned ace_readw(unsigned offset)
-{
-#if (CFG_SYSTEMACE_WIDTH == 8)
- u16 temp;
-
-#if !defined(__BIG_ENDIAN)
- temp =((u16)readb(CFG_SYSTEMACE_BASE+offset) << 8);
- temp |= (u16)readb(CFG_SYSTEMACE_BASE+offset+1);
-#else
- temp = (u16)readb(CFG_SYSTEMACE_BASE+offset);
- temp |=((u16)readb(CFG_SYSTEMACE_BASE+offset+1) << 8);
-#endif
- return temp;
-#else
- return readw(CFG_SYSTEMACE_BASE+offset);
-#endif
-}
-
-static void ace_writew(unsigned val, unsigned offset)
-{
-#if (CFG_SYSTEMACE_WIDTH == 8)
-#if !defined(__BIG_ENDIAN)
- writeb((u8)(val>>8), CFG_SYSTEMACE_BASE+offset);
- writeb((u8)val, CFG_SYSTEMACE_BASE+offset+1);
-#else
- writeb((u8)val, CFG_SYSTEMACE_BASE+offset);
- writeb((u8)(val>>8), CFG_SYSTEMACE_BASE+offset+1);
-#endif
-#else
- writew(val, CFG_SYSTEMACE_BASE+offset);
-#endif
-}
-
-/* */
-
-static unsigned long systemace_read(int dev,
- unsigned long start,
- unsigned long blkcnt,
- unsigned long *buffer);
-
-static block_dev_desc_t systemace_dev = {0};
-
-static int get_cf_lock(void)
-{
- int retry = 10;
-
- /* CONTROLREG = LOCKREG */
- unsigned val=ace_readw(0x18);
- val|=0x0002;
- ace_writew((val&0xffff), 0x18);
-
- /* Wait for MPULOCK in STATUSREG[15:0] */
- while (! (ace_readw(0x04) & 0x0002)) {
-
- if (retry < 0)
- return -1;
-
- udelay(100000);
- retry -= 1;
- }
-
- return 0;
-}
-
-static void release_cf_lock(void)
-{
- unsigned val=ace_readw(0x18);
- val&=~(0x0002);
- ace_writew((val&0xffff), 0x18);
-}
-
-block_dev_desc_t * systemace_get_dev(int dev)
-{
- /* The first time through this, the systemace_dev object is
- not yet initialized. In that case, fill it in. */
- if (systemace_dev.blksz == 0) {
- systemace_dev.if_type = IF_TYPE_UNKNOWN;
- systemace_dev.dev = 0;
- systemace_dev.part_type = PART_TYPE_UNKNOWN;
- systemace_dev.type = DEV_TYPE_HARDDISK;
- systemace_dev.blksz = 512;
- systemace_dev.removable = 1;
- systemace_dev.block_read = systemace_read;
-
- init_part(&systemace_dev);
-
- }
-
- return &systemace_dev;
-}
-
-/*
- * This function is called (by dereferencing the block_read pointer in
- * the dev_desc) to read blocks of data. The return value is the
- * number of blocks read. A zero return indicates an error.
- */
-static unsigned long systemace_read(int dev,
- unsigned long start,
- unsigned long blkcnt,
- unsigned long *buffer)
-{
- int retry;
- unsigned blk_countdown;
- unsigned char*dp = (unsigned char*)buffer;
- unsigned val;
-
- if (get_cf_lock() < 0) {
- unsigned status = ace_readw(0x04);
-
- /* If CFDETECT is false, card is missing. */
- if (! (status&0x0010)) {
- printf("** CompactFlash card not present. **\n");
- return 0;
- }
-
- printf("**** ACE locked away from me (STATUSREG=%04x)\n", status);
- return 0;
- }
-
-#ifdef DEBUG_SYSTEMACE
- printf("... systemace read %lu sectors at %lu\n", blkcnt, start);
-#endif
-
- retry = 2000;
- for (;;) {
- val = ace_readw(0x04);
-
- /* If CFDETECT is false, card is missing. */
- if (! (val & 0x0010)) {
- printf("**** ACE CompactFlash not found.\n");
- release_cf_lock();
- return 0;
- }
-
- /* If RDYFORCMD, then we are ready to go. */
- if (val & 0x0100)
- break;
-
- if (retry < 0) {
- printf("**** SystemACE not ready.\n");
- release_cf_lock();
- return 0;
- }
-
- udelay(1000);
- retry -= 1;
- }
-
- /* The SystemACE can only transfer 256 sectors at a time, so
- limit the current chunk of sectors. The blk_countdown
- variable is the number of sectors left to transfer. */
-
- blk_countdown = blkcnt;
- while (blk_countdown > 0) {
- unsigned trans = blk_countdown;
-
- if (trans > 256) trans = 256;
-
-#ifdef DEBUG_SYSTEMACE
- printf("... transfer %lu sector in a chunk\n", trans);
-#endif
- /* Write LBA block address */
- ace_writew((start>> 0) & 0xffff, 0x10);
- ace_writew((start>>16) & 0x00ff, 0x12);
-
- /* NOTE: in the Write Sector count below, a count of 0
- causes a transfer of 256, so &0xff gives the right
- value for whatever transfer count we want. */
-
- /* Write sector count | ReadMemCardData. */
- ace_writew((trans&0xff) | 0x0300, 0x14);
-
- /* Reset the configruation controller */
- val = ace_readw(0x18);
- val|=0x0080;
- ace_writew(val, 0x18);
-
- retry = trans * 16;
- while (retry > 0) {
- int idx;
-
- /* Wait for buffer to become ready. */
- while (! (ace_readw(0x04) & 0x0020)) {
- udelay(100);
- }
-
- /* Read 16 words of 2bytes from the sector buffer. */
- for (idx = 0 ; idx < 16 ; idx += 1) {
- unsigned short val = ace_readw(0x40);
- *dp++ = val & 0xff;
- *dp++ = (val>>8) & 0xff;
- }
-
- retry -= 1;
- }
-
- /* Clear the configruation controller reset */
- val = ace_readw(0x18);
- val&=~0x0080;
- ace_writew(val, 0x18);
-
- /* Count the blocks we transfer this time. */
- start += trans;
- blk_countdown -= trans;
- }
-
- release_cf_lock();
-
- return blkcnt;
-}
-#endif /* CONFIG_SYSTEMACE */
diff --git a/common/cmd_ext2.c b/common/cmd_ext2.c
index 5db42f2..94bd9b6 100644
--- a/common/cmd_ext2.c
+++ b/common/cmd_ext2.c
@@ -33,6 +33,7 @@
* Ext2fs support
*/
#include <common.h>
+#include <part.h>
#if (CONFIG_COMMANDS & CFG_CMD_EXT2)
#include <config.h>
@@ -57,41 +58,6 @@
#define PRINTF(fmt,args...)
#endif
-static block_dev_desc_t *get_dev (char* ifname, int dev)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_IDE)
- if (strncmp(ifname,"ide",3)==0) {
- extern block_dev_desc_t * ide_get_dev(int dev);
- return((dev >= CFG_IDE_MAXDEVICE) ? NULL : ide_get_dev(dev));
- }
-#endif
-#if (CONFIG_COMMANDS & CFG_CMD_SCSI)
- if (strncmp(ifname,"scsi",4)==0) {
- extern block_dev_desc_t * scsi_get_dev(int dev);
- return((dev >= CFG_SCSI_MAXDEVICE) ? NULL : scsi_get_dev(dev));
- }
-#endif
-#if ((CONFIG_COMMANDS & CFG_CMD_USB) && defined(CONFIG_USB_STORAGE))
- if (strncmp(ifname,"usb",3)==0) {
- extern block_dev_desc_t * usb_stor_get_dev(int dev);
- return((dev >= USB_MAX_STOR_DEV) ? NULL : usb_stor_get_dev(dev));
- }
-#endif
-#if defined(CONFIG_MMC)
- if (strncmp(ifname,"mmc",3)==0) {
- extern block_dev_desc_t * mmc_get_dev(int dev);
- return((dev >= 1) ? NULL : mmc_get_dev(dev));
- }
-#endif
-#if defined(CONFIG_SYSTEMACE)
- if (strcmp(ifname,"ace")==0) {
- extern block_dev_desc_t * systemace_get_dev(int dev);
- return((dev >= 1) ? NULL : systemace_get_dev(dev));
- }
-#endif
- return(NULL);
-}
-
int do_ext2ls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
char *filename = "/";
@@ -106,7 +72,7 @@ int do_ext2ls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return(1);
}
dev = (int)simple_strtoul (argv[2], &ep, 16);
- dev_desc=get_dev(argv[1],dev);
+ dev_desc = get_dev(argv[1],dev);
if (dev_desc == NULL) {
printf ("\n** Block device %s %d not supported\n", argv[1], dev);
@@ -210,7 +176,7 @@ int do_ext2load (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
dev = (int)simple_strtoul (argv[2], &ep, 16);
- dev_desc=get_dev(argv[1],dev);
+ dev_desc = get_dev(argv[1],dev);
if (dev_desc==NULL) {
printf ("\n** Block device %s %d not supported\n", argv[1], dev);
return(1);
diff --git a/common/cmd_fat.c b/common/cmd_fat.c
index 6844c10..afaf299 100644
--- a/common/cmd_fat.c
+++ b/common/cmd_fat.c
@@ -29,6 +29,7 @@
#include <s_record.h>
#include <net.h>
#include <ata.h>
+#include <part.h>
#if (CONFIG_COMMANDS & CFG_CMD_FAT)
@@ -37,42 +38,6 @@
#include <fat.h>
-block_dev_desc_t *get_dev (char* ifname, int dev)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_IDE)
- if (strncmp(ifname,"ide",3)==0) {
- extern block_dev_desc_t * ide_get_dev(int dev);
- return(ide_get_dev(dev));
- }
-#endif
-#if (CONFIG_COMMANDS & CFG_CMD_SCSI)
- if (strncmp(ifname,"scsi",4)==0) {
- extern block_dev_desc_t * scsi_get_dev(int dev);
- return(scsi_get_dev(dev));
- }
-#endif
-#if ((CONFIG_COMMANDS & CFG_CMD_USB) && defined(CONFIG_USB_STORAGE))
- if (strncmp(ifname,"usb",3)==0) {
- extern block_dev_desc_t * usb_stor_get_dev(int dev);
- return(usb_stor_get_dev(dev));
- }
-#endif
-#if defined(CONFIG_MMC)
- if (strncmp(ifname,"mmc",3)==0) {
- extern block_dev_desc_t * mmc_get_dev(int dev);
- return(mmc_get_dev(dev));
- }
-#endif
-#if defined(CONFIG_SYSTEMACE)
- if (strcmp(ifname,"ace")==0) {
- extern block_dev_desc_t * systemace_get_dev(int dev);
- return(systemace_get_dev(dev));
- }
-#endif
- return NULL;
-}
-
-
int do_fat_fsload (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
long size;
diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index a415502..2e185cc 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -31,20 +31,26 @@
#include <command.h>
#include <image.h>
#include <asm/byteorder.h>
+
#if defined(CONFIG_IDE_8xx_DIRECT) || defined(CONFIG_IDE_PCMCIA)
# include <pcmcia.h>
#endif
+
#ifdef CONFIG_8xx
# include <mpc8xx.h>
#endif
+
#ifdef CONFIG_MPC5xxx
#include <mpc5xxx.h>
#endif
+
#include <ide.h>
#include <ata.h>
+
#ifdef CONFIG_STATUS_LED
# include <status_led.h>
#endif
+
#ifndef __PPC__
#include <asm/io.h>
#ifdef __MIPS__
@@ -182,7 +188,7 @@ static void ident_cpy (unsigned char *dest, unsigned char *src, unsigned int len
#ifdef CONFIG_ATAPI
static void atapi_inquiry(block_dev_desc_t *dev_desc);
-ulong atapi_read (int device, lbaint_t blknr, ulong blkcnt, ulong *buffer);
+ulong atapi_read (int device, lbaint_t blknr, ulong blkcnt, void *buffer);
#endif
@@ -697,7 +703,7 @@ void ide_init (void)
block_dev_desc_t * ide_get_dev(int dev)
{
- return ((block_dev_desc_t *)&ide_dev_desc[dev]);
+ return (dev < CFG_IDE_MAXDEVICE) ? &ide_dev_desc[dev] : NULL;
}
@@ -1227,7 +1233,7 @@ static void ide_ident (block_dev_desc_t *dev_desc)
/* ------------------------------------------------------------------------- */
-ulong ide_read (int device, lbaint_t blknr, ulong blkcnt, ulong *buffer)
+ulong ide_read (int device, lbaint_t blknr, ulong blkcnt, void *buffer)
{
ulong n = 0;
unsigned char c;
@@ -1347,7 +1353,7 @@ IDE_READ_E:
/* ------------------------------------------------------------------------- */
-ulong ide_write (int device, lbaint_t blknr, ulong blkcnt, ulong *buffer)
+ulong ide_write (int device, lbaint_t blknr, ulong blkcnt, void *buffer)
{
ulong n = 0;
unsigned char c;
@@ -2009,7 +2015,7 @@ static void atapi_inquiry(block_dev_desc_t * dev_desc)
#define ATAPI_READ_BLOCK_SIZE 2048 /* assuming CD part */
#define ATAPI_READ_MAX_BLOCK ATAPI_READ_MAX_BYTES/ATAPI_READ_BLOCK_SIZE /* max blocks */
-ulong atapi_read (int device, lbaint_t blknr, ulong blkcnt, ulong *buffer)
+ulong atapi_read (int device, lbaint_t blknr, ulong blkcnt, void *buffer)
{
ulong n = 0;
unsigned char ccb[12]; /* Command descriptor block */
diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index d0fae6b..fcbb023 100644
--- a/common/cmd_mem.c
+++ b/common/cmd_mem.c
@@ -92,8 +92,9 @@ static ulong base_address = 0;
int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
ulong addr, length;
- ulong i, nbytes, linebytes;
- u_char *cp;
+#if defined(CONFIG_HAS_DATAFLASH)
+ ulong nbytes, linebytes;
+#endif
int size;
int rc = 0;
@@ -128,6 +129,7 @@ int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
length = simple_strtoul(argv[2], NULL, 16);
}
+#if defined(CONFIG_HAS_DATAFLASH)
/* Print the lines.
*
* We buffer all read data, so we can make sure data is read only
@@ -136,64 +138,25 @@ int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
nbytes = length * size;
do {
char linebuf[DISP_LINE_LEN];
- uint *uip = (uint *)linebuf;
- ushort *usp = (ushort *)linebuf;
- u_char *ucp = (u_char *)linebuf;
-#ifdef CONFIG_HAS_DATAFLASH
- int rc;
-#endif
- printf("%08lx:", addr);
+ void* p;
linebytes = (nbytes>DISP_LINE_LEN)?DISP_LINE_LEN:nbytes;
-#ifdef CONFIG_HAS_DATAFLASH
- if ((rc = read_dataflash(addr, (linebytes/size)*size, linebuf)) == DATAFLASH_OK){
- /* if outside dataflash */
- /*if (rc != 1) {
- dataflash_perror (rc);
- return (1);
- }*/
- for (i=0; i<linebytes; i+= size) {
- if (size == 4) {
- printf(" %08x", *uip++);
- } else if (size == 2) {
- printf(" %04x", *usp++);
- } else {
- printf(" %02x", *ucp++);
- }
- addr += size;
- }
+ rc = read_dataflash(addr, (linebytes/size)*size, linebuf);
+ p = (rc == DATAFLASH_OK) ? linebuf : (void*)addr;
+ print_buffer(addr, p, size, linebytes/size, DISP_LINE_LEN/size);
- } else { /* addr does not correspond to DataFlash */
-#endif
- for (i=0; i<linebytes; i+= size) {
- if (size == 4) {
- printf(" %08x", (*uip++ = *((uint *)addr)));
- } else if (size == 2) {
- printf(" %04x", (*usp++ = *((ushort *)addr)));
- } else {
- printf(" %02x", (*ucp++ = *((u_char *)addr)));
- }
- addr += size;
- }
-#ifdef CONFIG_HAS_DATAFLASH
- }
-#endif
- puts (" ");
- cp = (u_char *)linebuf;
- for (i=0; i<linebytes; i++) {
- if ((*cp < 0x20) || (*cp > 0x7e))
- putc ('.');
- else
- printf("%c", *cp);
- cp++;
- }
- putc ('\n');
nbytes -= linebytes;
+ addr += linebytes;
if (ctrlc()) {
rc = 1;
break;
}
} while (nbytes > 0);
+#else
+ /* Print the lines. */
+ print_buffer(addr, (void*)addr, size, length, DISP_LINE_LEN/size);
+ addr += size*length;
+#endif
dp_last_addr = addr;
dp_last_length = length;
diff --git a/common/cmd_reiser.c b/common/cmd_reiser.c
index 508ffcb..09c86e6 100644
--- a/common/cmd_reiser.c
+++ b/common/cmd_reiser.c
@@ -35,6 +35,7 @@
#include <linux/ctype.h>
#include <asm/byteorder.h>
#include <reiserfs.h>
+#include <part.h>
#ifndef CONFIG_DOS_PARTITION
#error DOS partition support must be selected
@@ -48,41 +49,6 @@
#define PRINTF(fmt,args...)
#endif
-static block_dev_desc_t *get_dev (char* ifname, int dev)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_IDE)
- if (strncmp(ifname,"ide",3)==0) {
- extern block_dev_desc_t * ide_get_dev(int dev);
- return((dev >= CFG_IDE_MAXDEVICE) ? NULL : ide_get_dev(dev));
- }
-#endif
-#if (CONFIG_COMMANDS & CFG_CMD_SCSI)
- if (strncmp(ifname,"scsi",4)==0) {
- extern block_dev_desc_t * scsi_get_dev(int dev);
- return((dev >= CFG_SCSI_MAXDEVICE) ? NULL : scsi_get_dev(dev));
- }
-#endif
-#if ((CONFIG_COMMANDS & CFG_CMD_USB) && defined(CONFIG_USB_STORAGE))
- if (strncmp(ifname,"usb",3)==0) {
- extern block_dev_desc_t * usb_stor_get_dev(int dev);
- return((dev >= USB_MAX_STOR_DEV) ? NULL : usb_stor_get_dev(dev));
- }
-#endif
-#if defined(CONFIG_MMC)
- if (strncmp(ifname,"mmc",3)==0) {
- extern block_dev_desc_t * mmc_get_dev(int dev);
- return((dev >= 1) ? NULL : mmc_get_dev(dev));
- }
-#endif
-#if defined(CONFIG_SYSTEMACE)
- if (strcmp(ifname,"ace")==0) {
- extern block_dev_desc_t * systemace_get_dev(int dev);
- return((dev >= 1) ? NULL : systemace_get_dev(dev));
- }
-#endif
- return NULL;
-}
-
int do_reiserls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
char *filename = "/";
@@ -97,7 +63,7 @@ int do_reiserls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return 1;
}
dev = (int)simple_strtoul (argv[2], &ep, 16);
- dev_desc=get_dev(argv[1],dev);
+ dev_desc = get_dev(argv[1],dev);
if (dev_desc == NULL) {
printf ("\n** Block device %s %d not supported\n", argv[1], dev);
@@ -196,7 +162,7 @@ int do_reiserload (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
dev = (int)simple_strtoul (argv[2], &ep, 16);
- dev_desc=get_dev(argv[1],dev);
+ dev_desc = get_dev(argv[1],dev);
if (dev_desc==NULL) {
printf ("\n** Block device %s %d not supported\n", argv[1], dev);
return 1;
diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
index cc08743..da36ed9 100644
--- a/common/cmd_scsi.c
+++ b/common/cmd_scsi.c
@@ -74,7 +74,7 @@ void scsi_setup_inquiry(ccb * pccb);
void scsi_ident_cpy (unsigned char *dest, unsigned char *src, unsigned int len);
-ulong scsi_read(int device, ulong blknr, ulong blkcnt, ulong *buffer);
+ulong scsi_read(int device, ulong blknr, ulong blkcnt, void *buffer);
/*********************************************************************************
@@ -194,7 +194,7 @@ void scsi_init(void)
block_dev_desc_t * scsi_get_dev(int dev)
{
- return((block_dev_desc_t *)&scsi_dev_desc[dev]);
+ return (dev < CFG_SCSI_MAX_DEVICE) ? &scsi_dev_desc[dev] : NULL;
}
@@ -424,7 +424,7 @@ int do_scsi (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
#define SCSI_MAX_READ_BLK 0xFFFF /* almost the maximum amount of the scsi_ext command.. */
-ulong scsi_read(int device, ulong blknr, ulong blkcnt, ulong *buffer)
+ulong scsi_read(int device, ulong blknr, ulong blkcnt, void *buffer)
{
ulong start,blks, buf_addr;
unsigned short smallblks;
diff --git a/common/cmd_usb.c b/common/cmd_usb.c
index 28c05aa..904df71 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -28,6 +28,7 @@
#include <common.h>
#include <command.h>
#include <asm/byteorder.h>
+#include <part.h>
#if (CONFIG_COMMANDS & CFG_CMD_USB)
diff --git a/common/ft_build.c b/common/ft_build.c
index 980e40f..5a0575e 100644
--- a/common/ft_build.c
+++ b/common/ft_build.c
@@ -29,6 +29,7 @@
#include <stddef.h>
#include <ft_build.h>
+#include <linux/ctype.h>
#undef DEBUG
@@ -180,11 +181,6 @@ void ft_finalize_tree(struct ft_cxt *cxt) {
bph->dt_strings_size = cxt->p_end - cxt->p;
}
-static inline int isprint(int c)
-{
- return c >= 0x20 && c <= 0x7e;
-}
-
static int is_printable_string(const void *data, int len)
{
const char *s = data;
diff --git a/common/usb_storage.c b/common/usb_storage.c
index 06ea99b..196ceb7 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -56,6 +56,7 @@
#if (CONFIG_COMMANDS & CFG_CMD_USB)
+#include <part.h>
#include <usb.h>
#ifdef CONFIG_USB_STORAGE
@@ -168,13 +169,13 @@ static struct us_data usb_stor[USB_MAX_STOR_DEV];
int usb_stor_get_info(struct usb_device *dev, struct us_data *us, block_dev_desc_t *dev_desc);
int usb_storage_probe(struct usb_device *dev, unsigned int ifnum,struct us_data *ss);
-unsigned long usb_stor_read(int device, unsigned long blknr, unsigned long blkcnt, unsigned long *buffer);
+unsigned long usb_stor_read(int device, unsigned long blknr, unsigned long blkcnt, void *buffer);
struct usb_device * usb_get_dev_index(int index);
void uhci_show_temp_int_td(void);
block_dev_desc_t *usb_stor_get_dev(int index)
{
- return &usb_dev_desc[index];
+ return (index < USB_MAX_STOR_DEV) ? &usb_dev_desc[index] : NULL;
}
@@ -940,7 +941,7 @@ static void usb_bin_fixup(struct usb_device_descriptor descriptor,
#define USB_MAX_READ_BLK 20
-unsigned long usb_stor_read(int device, unsigned long blknr, unsigned long blkcnt, unsigned long *buffer)
+unsigned long usb_stor_read(int device, unsigned long blknr, unsigned long blkcnt, void *buffer)
{
unsigned long start,blks, buf_addr;
unsigned short smallblks;
diff --git a/cpu/mpc5xxx/fec.c b/cpu/mpc5xxx/fec.c
index 71c1bfa..e639234 100644
--- a/cpu/mpc5xxx/fec.c
+++ b/cpu/mpc5xxx/fec.c
@@ -880,10 +880,10 @@ int mpc5xxx_fec_initialize(bd_t * bis)
fec->rbdBase = (FEC_RBD *)(FEC_BD_BASE + FEC_TBD_NUM * sizeof(FEC_TBD));
#if defined(CONFIG_CANMB) || defined(CONFIG_HMI1001) || \
defined(CONFIG_ICECUBE) || defined(CONFIG_INKA4X0) || \
- defined(CONFIG_MCC200) || defined(CONFIG_O2DNT) || \
- defined(CONFIG_PM520) || defined(CONFIG_TOP5200) || \
- defined(CONFIG_TQM5200) || defined(CONFIG_V38B) || \
- defined(CONFIG_UC101)
+ defined(CONFIG_MCC200) || defined(CONFIG_MOTIONPRO) || \
+ defined(CONFIG_O2DNT) || defined(CONFIG_PM520) || \
+ defined(CONFIG_TOP5200) || defined(CONFIG_TQM5200) || \
+ defined(CONFIG_UC101) || defined(CONFIG_V38B)
# ifndef CONFIG_FEC_10MBIT
fec->xcv_type = MII100;
# else
diff --git a/cpu/pxa/mmc.c b/cpu/pxa/mmc.c
index f7020ee..0fbaa16 100644
--- a/cpu/pxa/mmc.c
+++ b/cpu/pxa/mmc.c
@@ -37,7 +37,7 @@ static block_dev_desc_t mmc_dev;
block_dev_desc_t * mmc_get_dev(int dev)
{
- return ((block_dev_desc_t *)&mmc_dev);
+ return (dev == 0) ? &mmc_dev : NULL;
}
/*
@@ -363,7 +363,7 @@ mmc_write(uchar *src, ulong dst, int size)
ulong
/****************************************************/
-mmc_bread(int dev_num, ulong blknr, ulong blkcnt, ulong *dst)
+mmc_bread(int dev_num, ulong blknr, ulong blkcnt, void *dst)
/****************************************************/
{
int mmc_block_size = MMC_BLOCK_SIZE;
diff --git a/disk/part.c b/disk/part.c
index 2255e72..f1026c5 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -24,6 +24,7 @@
#include <common.h>
#include <command.h>
#include <ide.h>
+#include <part.h>
#undef PART_DEBUG
@@ -39,6 +40,54 @@
defined(CONFIG_MMC) || \
defined(CONFIG_SYSTEMACE) )
+struct block_drvr {
+ char *name;
+ block_dev_desc_t* (*get_dev)(int dev);
+};
+
+static const struct block_drvr block_drvr[] = {
+#if (CONFIG_COMMANDS & CFG_CMD_IDE)
+ { .name = "ide", .get_dev = ide_get_dev, },
+#endif
+#if (CONFIG_COMMANDS & CFG_CMD_SCSI)
+ { .name = "scsi", .get_dev = scsi_get_dev, },
+#endif
+#if ((CONFIG_COMMANDS & CFG_CMD_USB) && defined(CONFIG_USB_STORAGE))
+ { .name = "usb", .get_dev = usb_stor_get_dev, },
+#endif
+#if defined(CONFIG_MMC)
+ { .name = "mmc", .get_dev = mmc_get_dev, },
+#endif
+#if defined(CONFIG_SYSTEMACE)
+ { .name = "ace", .get_dev = systemace_get_dev, },
+#endif
+ { },
+};
+
+block_dev_desc_t *get_dev(char* ifname, int dev)
+{
+ const struct block_drvr *drvr = block_drvr;
+
+ while (drvr->name) {
+ if (strncmp(ifname, drvr->name, strlen(drvr->name)) == 0)
+ return drvr->get_dev(dev);
+ drvr++;
+ }
+ return NULL;
+}
+#else
+block_dev_desc_t *get_dev(char* ifname, int dev)
+{
+ return NULL;
+}
+#endif
+
+#if ((CONFIG_COMMANDS & CFG_CMD_IDE) || \
+ (CONFIG_COMMANDS & CFG_CMD_SCSI) || \
+ (CONFIG_COMMANDS & CFG_CMD_USB) || \
+ defined(CONFIG_MMC) || \
+ defined(CONFIG_SYSTEMACE) )
+
/* ------------------------------------------------------------------------- */
/*
* reports device info to the user
diff --git a/drivers/Makefile b/drivers/Makefile
index 5a369df..fffc22a 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -44,7 +44,7 @@ COBJS = 3c589.o 5701rls.o ali512x.o atmel_usart.o \
serial.o serial_max3100.o \
serial_pl010.o serial_pl011.o serial_xuartlite.o \
sl811_usb.o sm501.o smc91111.o smiLynxEM.o \
- status_led.o sym53c8xx.o ahci.o \
+ status_led.o sym53c8xx.o systemace.o ahci.o \
ti_pci1410a.o tigon3.o tsec.o \
usbdcore.o usbdcore_ep0.o usbdcore_omap1510.o usbtty.o \
videomodes.o w83c553f.o \
diff --git a/drivers/systemace.c b/drivers/systemace.c
new file mode 100644
index 0000000..9502623
--- /dev/null
+++ b/drivers/systemace.c
@@ -0,0 +1,247 @@
+/*
+ * Copyright (c) 2004 Picture Elements, Inc.
+ * Stephen Williams (XXXXXXXXXXXXXXXX)
+ *
+ * This source code is free software; you can redistribute it
+ * and/or modify it in source code form 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
+ */
+
+/*
+ * The Xilinx SystemACE chip support is activated by defining
+ * CONFIG_SYSTEMACE to turn on support, and CFG_SYSTEMACE_BASE
+ * to set the base address of the device. This code currently
+ * assumes that the chip is connected via a byte-wide bus.
+ *
+ * The CONFIG_SYSTEMACE also adds to fat support the device class
+ * "ace" that allows the user to execute "fatls ace 0" and the
+ * like. This works by making the systemace_get_dev function
+ * available to cmd_fat.c:get_dev and filling in a block device
+ * description that has all the bits needed for FAT support to
+ * read sectors.
+ *
+ * According to Xilinx technical support, before accessing the
+ * SystemACE CF you need to set the following control bits:
+ * FORCECFGMODE : 1
+ * CFGMODE : 0
+ * CFGSTART : 0
+ */
+
+#include <common.h>
+#include <command.h>
+#include <systemace.h>
+#include <part.h>
+#include <asm/io.h>
+
+#ifdef CONFIG_SYSTEMACE
+
+/*
+ * The ace_readw and writew functions read/write 16bit words, but the
+ * offset value is the BYTE offset as most used in the Xilinx
+ * datasheet for the SystemACE chip. The CFG_SYSTEMACE_BASE is defined
+ * to be the base address for the chip, usually in the local
+ * peripheral bus.
+ */
+#if (CFG_SYSTEMACE_WIDTH == 8)
+#if !defined(__BIG_ENDIAN)
+#define ace_readw(off) ((readb(CFG_SYSTEMACE_BASE+off)<<8) | \
+ (readb(CFG_SYSTEMACE_BASE+off+1)))
+#define ace_write(val, off) {writeb(val>>8, CFG_SYSTEMACE_BASE+off); \
+ writeb(val, CFG_SYSTEMACE_BASE+off+1);}
+#else
+#define ace_readw(off) ((readb(CFG_SYSTEMACE_BASE+off)) | \
+ (readb(CFG_SYSTEMACE_BASE+off+1)<<8))
+#define ace_write(val, off) {writeb(val, CFG_SYSTEMACE_BASE+off); \
+ writeb(val>>8, CFG_SYSTEMACE_BASE+off+1);}
+#endif
+#else
+#define ace_readw(off) (readw(CFG_SYSTEMACE_BASE+off))
+#define ace_writew(val, off) (writew(val, CFG_SYSTEMACE_BASE+off))
+#endif
+
+/* */
+
+static unsigned long systemace_read(int dev, unsigned long start,
+ unsigned long blkcnt, void *buffer);
+
+static block_dev_desc_t systemace_dev = { 0 };
+
+static int get_cf_lock(void)
+{
+ int retry = 10;
+
+ /* CONTROLREG = LOCKREG */
+ unsigned val = ace_readw(0x18);
+ val |= 0x0002;
+ ace_writew((val & 0xffff), 0x18);
+
+ /* Wait for MPULOCK in STATUSREG[15:0] */
+ while (!(ace_readw(0x04) & 0x0002)) {
+
+ if (retry < 0)
+ return -1;
+
+ udelay(100000);
+ retry -= 1;
+ }
+
+ return 0;
+}
+
+static void release_cf_lock(void)
+{
+ unsigned val = ace_readw(0x18);
+ val &= ~(0x0002);
+ ace_writew((val & 0xffff), 0x18);
+}
+
+block_dev_desc_t *systemace_get_dev(int dev)
+{
+ /* The first time through this, the systemace_dev object is
+ not yet initialized. In that case, fill it in. */
+ if (systemace_dev.blksz == 0) {
+ systemace_dev.if_type = IF_TYPE_UNKNOWN;
+ systemace_dev.dev = 0;
+ systemace_dev.part_type = PART_TYPE_UNKNOWN;
+ systemace_dev.type = DEV_TYPE_HARDDISK;
+ systemace_dev.blksz = 512;
+ systemace_dev.removable = 1;
+ systemace_dev.block_read = systemace_read;
+
+ init_part(&systemace_dev);
+
+ }
+
+ return &systemace_dev;
+}
+
+/*
+ * This function is called (by dereferencing the block_read pointer in
+ * the dev_desc) to read blocks of data. The return value is the
+ * number of blocks read. A zero return indicates an error.
+ */
+static unsigned long systemace_read(int dev, unsigned long start,
+ unsigned long blkcnt, void *buffer)
+{
+ int retry;
+ unsigned blk_countdown;
+ unsigned char *dp = buffer;
+ unsigned val;
+
+ if (get_cf_lock() < 0) {
+ unsigned status = ace_readw(0x04);
+
+ /* If CFDETECT is false, card is missing. */
+ if (!(status & 0x0010)) {
+ printf("** CompactFlash card not present. **\n");
+ return 0;
+ }
+
+ printf("**** ACE locked away from me (STATUSREG=%04x)\n",
+ status);
+ return 0;
+ }
+#ifdef DEBUG_SYSTEMACE
+ printf("... systemace read %lu sectors at %lu\n", blkcnt, start);
+#endif
+
+ retry = 2000;
+ for (;;) {
+ val = ace_readw(0x04);
+
+ /* If CFDETECT is false, card is missing. */
+ if (!(val & 0x0010)) {
+ printf("**** ACE CompactFlash not found.\n");
+ release_cf_lock();
+ return 0;
+ }
+
+ /* If RDYFORCMD, then we are ready to go. */
+ if (val & 0x0100)
+ break;
+
+ if (retry < 0) {
+ printf("**** SystemACE not ready.\n");
+ release_cf_lock();
+ return 0;
+ }
+
+ udelay(1000);
+ retry -= 1;
+ }
+
+ /* The SystemACE can only transfer 256 sectors at a time, so
+ limit the current chunk of sectors. The blk_countdown
+ variable is the number of sectors left to transfer. */
+
+ blk_countdown = blkcnt;
+ while (blk_countdown > 0) {
+ unsigned trans = blk_countdown;
+
+ if (trans > 256)
+ trans = 256;
+
+#ifdef DEBUG_SYSTEMACE
+ printf("... transfer %lu sector in a chunk\n", trans);
+#endif
+ /* Write LBA block address */
+ ace_writew((start >> 0) & 0xffff, 0x10);
+ ace_writew((start >> 16) & 0x00ff, 0x12);
+
+ /* NOTE: in the Write Sector count below, a count of 0
+ causes a transfer of 256, so &0xff gives the right
+ value for whatever transfer count we want. */
+
+ /* Write sector count | ReadMemCardData. */
+ ace_writew((trans & 0xff) | 0x0300, 0x14);
+
+ /* Reset the configruation controller */
+ val = ace_readw(0x18);
+ val |= 0x0080;
+ ace_writew(val, 0x18);
+
+ retry = trans * 16;
+ while (retry > 0) {
+ int idx;
+
+ /* Wait for buffer to become ready. */
+ while (!(ace_readw(0x04) & 0x0020)) {
+ udelay(100);
+ }
+
+ /* Read 16 words of 2bytes from the sector buffer. */
+ for (idx = 0; idx < 16; idx += 1) {
+ unsigned short val = ace_readw(0x40);
+ *dp++ = val & 0xff;
+ *dp++ = (val >> 8) & 0xff;
+ }
+
+ retry -= 1;
+ }
+
+ /* Clear the configruation controller reset */
+ val = ace_readw(0x18);
+ val &= ~0x0080;
+ ace_writew(val, 0x18);
+
+ /* Count the blocks we transfer this time. */
+ start += trans;
+ blk_countdown -= trans;
+ }
+
+ release_cf_lock();
+
+ return blkcnt;
+}
+#endif /* CONFIG_SYSTEMACE */
diff --git a/include/common.h b/include/common.h
index 982d6a8..5b2e71c 100644
--- a/include/common.h
+++ b/include/common.h
@@ -187,6 +187,8 @@ void hang (void) __attribute__ ((noreturn));
long int initdram (int);
int display_options (void);
void print_size (ulong, const char *);
+int print_buffer (ulong addr, void* data, uint width, uint count,
+ uint linelen);
/* common/main.c */
void main_loop (void);
diff --git a/include/configs/bamboo.h b/include/configs/bamboo.h
index 4961011..bcc736c 100644
--- a/include/configs/bamboo.h
+++ b/include/configs/bamboo.h
@@ -257,6 +257,7 @@
"bootfile=/tftpboot/bamboo/uImage\0" \
"kernel_addr=fff00000\0" \
"ramdisk_addr=fff10000\0" \
+ "initrd_high=30000000\0" \
"load=tftp 100000 /tftpboot/bamboo/u-boot.bin\0" \
"update=protect off fffa0000 ffffffff;era fffa0000 ffffffff;" \
"cp.b 100000 fffa0000 60000;" \
diff --git a/include/configs/bubinga.h b/include/configs/bubinga.h
index a66cdc3..10c4814 100644
--- a/include/configs/bubinga.h
+++ b/include/configs/bubinga.h
@@ -106,6 +106,7 @@
"bootfile=/tftpboot/bubinga/uImage\0" \
"kernel_addr=fff80000\0" \
"ramdisk_addr=fff90000\0" \
+ "initrd_high=30000000\0" \
"load=tftp 100000 /tftpboot/bubinga/u-boot.bin\0" \
"update=protect off fffc0000 ffffffff;era fffc0000 ffffffff;" \
"cp.b 100000 fffc0000 40000;" \
diff --git a/include/configs/ebony.h b/include/configs/ebony.h
index d8882ea..6c4d7cc 100644
--- a/include/configs/ebony.h
+++ b/include/configs/ebony.h
@@ -177,6 +177,7 @@
"bootfile=/tftpboot/ebony/uImage\0" \
"kernel_addr=ff800000\0" \
"ramdisk_addr=ff810000\0" \
+ "initrd_high=30000000\0" \
"load=tftp 100000 /tftpboot/ebony/u-boot.bin\0" \
"update=protect off fffc0000 ffffffff;era fffc0000 ffffffff;" \
"cp.b 100000 fffc0000 40000;" \
diff --git a/include/configs/luan.h b/include/configs/luan.h
index 0350e91..5c9d208 100644
--- a/include/configs/luan.h
+++ b/include/configs/luan.h
@@ -178,6 +178,7 @@
"bootfile=/tftpboot/luan/uImage\0" \
"kernel_addr=fc000000\0" \
"ramdisk_addr=fc100000\0" \
+ "initrd_high=30000000\0" \
"load=tftp 100000 /tftpboot/luan/u-boot.bin\0" \
"update=protect off fffc0000 ffffffff;era fffc0000 ffffffff;" \
"cp.b 100000 fffc0000 40000;" \
diff --git a/include/configs/motionpro.h b/include/configs/motionpro.h
new file mode 100644
index 0000000..5328e8d
--- /dev/null
+++ b/include/configs/motionpro.h
@@ -0,0 +1,305 @@
+/*
+ * (C) Copyright 2003-2007
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * Based on PRO Motion board config file by Andy Joseph, andy@promessdev.com
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+
+/*
+ * High Level Configuration Options
+ */
+
+
+/* CPU and board */
+#define CONFIG_MPC5xxx 1 /* This is an MPC5xxx CPU */
+#define CONFIG_MPC5200 1 /* More exactly a MPC5200 */
+#define CONFIG_MOTIONPRO 1 /* ... on Promess Motion-PRO board */
+
+
+/*
+ * Supported commands
+ */
+#define CONFIG_COMMANDS (CONFIG_CMD_DFL | \
+ CFG_CMD_ASKENV | \
+ CFG_CMD_DHCP | \
+ CFG_CMD_REGINFO | \
+ CFG_CMD_IMMAP | \
+ CFG_CMD_ELF | \
+ CFG_CMD_MII | \
+ CFG_CMD_BEDBUG | \
+ CFG_CMD_NET | \
+ CFG_CMD_PING)
+
+/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
+#include <cmd_confdefs.h>
+
+
+/*
+ * Serial console configuration
+ */
+#define CONFIG_PSC_CONSOLE 1 /* console is on PSC1 */
+#define CONFIG_NETCONSOLE 1 /* network console */
+#define CONFIG_BAUDRATE 115200
+#define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 }
+
+
+/*
+ * Ethernet configuration
+ */
+#define CONFIG_MPC5xxx_FEC 1
+#define CONFIG_PHY_ADDR 0x2
+#define CONFIG_PHY_TYPE 0x79c874
+
+
+/*
+ * Autobooting
+ */
+#define CONFIG_BOOTDELAY 2 /* autoboot after 2 seconds */
+#define CONFIG_AUTOBOOT_KEYED
+#define CONFIG_AUTOBOOT_STOP_STR "\x1b\x1b"
+#define DEBUG_BOOTKEYS 0
+#undef CONFIG_AUTOBOOT_DELAY_STR
+#undef CONFIG_BOOTARGS
+#define CONFIG_AUTOBOOT_PROMPT "Autobooting in %d seconds, " \
+ "press \"<Esc><Esc>\" to stop\n"
+
+#define CONFIG_ETHADDR 00:50:C2:40:10:00
+#define CONFIG_OVERWRITE_ETHADDR_ONCE 1
+#define CONFIG_VERSION_VARIABLE 1 /* include version env variable */
+
+
+/*
+ * Default environment settings
+ */
+#define CONFIG_EXTRA_ENV_SETTINGS \
+ "sdram_test=0\0" \
+ "netdev=eth0\0" \
+ "hostname=motionpro\0" \
+ "netmask=255.255.0.0\0" \
+ "ipaddr=192.168.160.22\0" \
+ "serverip=192.168.1.1\0" \
+ "gatewayip=192.168.1.1\0" \
+ "kernel_addr=200000\0" \
+ "u-boot_addr=100000\0" \
+ "kernel_sector=20\0" \
+ "kernel_size=1000\0" \
+ "console=ttyS0,115200\0" \
+ "rootpath=/opt/eldk-4.1/ppc_6xx\0" \
+ "bootfile=/tftpboot/motionpro/uImage\0" \
+ "u-boot=/tftpboot/motionpro/u-boot.bin\0" \
+ "load=tftp $(u-boot_addr) $(u-boot)\0" \
+ "update=prot off fff00000 fff3ffff; era fff00000 fff3ffff; " \
+ "cp.b $(u-boot_addr) fff00000 $(filesize);" \
+ "prot on fff00000 fff3ffff\0" \
+ "ramargs=setenv bootargs root=/dev/ram rw\0" \
+ "addip=setenv bootargs $(bootargs) console=$(console) " \
+ "ip=$(ipaddr):$(serverip):$(gatewayip):" \
+ "$(netmask):$(hostname):$(netdev):off panic=1\0" \
+ "flash_nfs=run nfsargs addip;bootm $(kernel_addr)\0" \
+ "flash_self=run ramargs addip;bootm $(kernel_addr) " \
+ "$(ramdisk_addr)\0" \
+ "net_nfs=tftp $(kernel_addr) $(bootfile); run nfsargs addip; " \
+ "bootm $(kernel_addr)\0" \
+ "nfsargs=setenv bootargs root=/dev/nfs rw " \
+ "nfsroot=$(serverip):$(rootpath)\0" \
+ "fstype=ext3\0" \
+ "fatargs=setenv bootargs init=/linuxrc rw\0" \
+ ""
+#define CONFIG_BOOTCOMMAND "run net_nfs"
+
+
+/*
+ * do board-specific init
+ */
+#define CONFIG_BOARD_EARLY_INIT_R 1
+
+
+/*
+ * Low level configuration
+ */
+
+
+/*
+ * Clock configuration: SYS_XTALIN = 25MHz
+ */
+#define CFG_MPC5XXX_CLKIN 25000000
+
+
+/*
+ * Memory map
+ */
+/*
+ * Warning!!! with the current BestComm Task, MBAR MUST BE set to 0xf0000000.
+ * Setting MBAR to otherwise will cause system hang when using SmartDMA such
+ * as network commands.
+ */
+#define CFG_MBAR 0xf0000000
+#define CFG_SDRAM_BASE 0x00000000
+
+/*
+ * If building for running out of SDRAM, then MBAR has been set up beforehand
+ * (e.g., by the BDI). Otherwise we must specify the default boot-up value of
+ * MBAR, as given in the doccumentation.
+ */
+#if TEXT_BASE == 0x00100000
+#define CFG_DEFAULT_MBAR 0xf0000000
+#else /* TEXT_BASE != 0x00100000 */
+#define CFG_DEFAULT_MBAR 0x80000000
+#define CFG_LOWBOOT 1
+#endif /* TEXT_BASE == 0x00100000 */
+
+/* Use SRAM until RAM will be available */
+#define CFG_INIT_RAM_ADDR MPC5XXX_SRAM
+#define CFG_INIT_RAM_END MPC5XXX_SRAM_SIZE
+
+#define CFG_GBL_DATA_SIZE 128 /* size in bytes for initial data */
+#define CFG_GBL_DATA_OFFSET (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
+#define CFG_INIT_SP_OFFSET CFG_GBL_DATA_OFFSET
+
+#define CFG_MONITOR_BASE TEXT_BASE
+#if (CFG_MONITOR_BASE < CFG_FLASH_BASE)
+#define CFG_RAMBOOT 1
+#endif
+
+#define CFG_MONITOR_LEN (256 << 10) /* 256 kB for Monitor */
+#define CFG_MALLOC_LEN (128 << 10) /* 128 kB for malloc() */
+#define CFG_BOOTMAPSZ (8 << 20) /* initial mem map for Linux */
+
+
+/*
+ * Chip selects configuration
+ */
+/* Boot Chipselect */
+#define CFG_BOOTCS_START CFG_FLASH_BASE
+#define CFG_BOOTCS_SIZE CFG_FLASH_SIZE
+#define CFG_BOOTCS_CFG 0x03035D00
+
+/* Flash memory addressing */
+#define CFG_CS0_START CFG_FLASH_BASE
+#define CFG_CS0_SIZE CFG_FLASH_SIZE
+#define CFG_CS0_CFG CFG_BOOTCS_CFG
+
+/* Dual Port SRAM -- Kollmorgen Drive memory addressing */
+#define CFG_CS1_START 0x50000000
+#define CFG_CS1_SIZE 0x10000
+#define CFG_CS1_CFG 0x05055800
+
+/* Local register access */
+#define CFG_CS2_START 0x50010000
+#define CFG_CS2_SIZE 0x10000
+#define CFG_CS2_CFG 0x05055800
+
+/* Anybus CompactCom Module memory addressing */
+#define CFG_CS3_START 0x50020000
+#define CFG_CS3_SIZE 0x10000
+#define CFG_CS3_CFG 0x05055800
+
+/* No burst and dead cycle = 2 for all CSs */
+#define CFG_CS_BURST 0x00000000
+#define CFG_CS_DEADCYCLE 0x22222222
+
+
+/*
+ * SDRAM configuration
+ */
+/* 2 x MT48LC16M16A2BG-75 IT:D, CASL 2, 32 bit data bus */
+#define SDRAM_CONFIG1 0x52222600
+#define SDRAM_CONFIG2 0x88b70000
+#define SDRAM_CONTROL 0x50570000
+#define SDRAM_MODE 0x008d0000
+
+
+/*
+ * Flash configuration
+ */
+#define CFG_FLASH_CFI 1 /* Flash is CFI conformant */
+#define CFG_FLASH_CFI_DRIVER 1
+#define CFG_FLASH_BASE 0xff000000
+#define CFG_FLASH_SIZE 0x01000000
+#define CFG_MAX_FLASH_BANKS 1 /* max num of memory banks */
+#define CFG_FLASH_BANKS_LIST { CFG_FLASH_BASE }
+#define CFG_MAX_FLASH_SECT 256 /* max num of sects on one chip */
+#define CONFIG_FLASH_16BIT /* Flash is 16-bit */
+
+
+/*
+ * Environment settings
+ */
+#define CFG_ENV_IS_IN_FLASH 1
+/* This has to be a multiple of the Flash sector size */
+#define CFG_ENV_ADDR (CFG_MONITOR_BASE + CFG_MONITOR_LEN)
+#define CFG_ENV_SIZE 0x1000
+#define CFG_ENV_SECT_SIZE 0x10000
+
+
+/*
+ * Pin multiplexing configuration
+ */
+
+/* PSC1: UART1
+ * PSC2: GPIO (default)
+ * PSC3: GPIO (default)
+ * USB: 2xUART4/5
+ * Ethernet: Ethernet 100Mbit with MD
+ * Timer: CAN2/GPIO
+ * PSC6/IRDA: GPIO (default)
+ */
+#define CFG_GPS_PORT_CONFIG 0x1105a004
+
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CFG_LONGHELP /* undef to save memory */
+#define CFG_PROMPT "=> " /* Monitor Command Prompt */
+#define CFG_CBSIZE 256 /* Console I/O Buffer Size */
+#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
+#define CFG_MAXARGS 16 /* max number of command args */
+#define CFG_BARGSIZE CFG_CBSIZE /* Boot Argument Buffer Size */
+
+#define CFG_MEMTEST_START 0x00100000 /* memtest works on */
+#define CFG_MEMTEST_END 0x03f00000 /* 1 ... 64 MiB in DRAM */
+
+#define CFG_LOAD_ADDR 0x200000 /* default kernel load addr */
+
+#define CFG_HZ 1000 /* decrementer freq: 1 ms ticks */
+
+
+/*
+ * Various low-level settings
+ */
+#define CFG_HID0_INIT HID0_ICE | HID0_ICFI
+#define CFG_HID0_FINAL HID0_ICE
+
+#define BOOTFLAG_COLD 0x01 /* Normal Power-On: Boot from FLASH */
+#define BOOTFLAG_WARM 0x02 /* Software reboot */
+
+#define CFG_CACHELINE_SIZE 32 /* For MPC5xxx CPUs */
+
+
+/* Not needed for MPC 5xxx U-Boot, but used by tools/updater */
+#define CFG_RESET_ADDRESS 0xfff00100
+
+#endif /* __CONFIG_H */
diff --git a/include/configs/ocotea.h b/include/configs/ocotea.h
index 89e9164..0e3660b 100644
--- a/include/configs/ocotea.h
+++ b/include/configs/ocotea.h
@@ -192,6 +192,7 @@
"bootfile=/tftpboot/ocotea/uImage\0" \
"kernel_addr=fff00000\0" \
"ramdisk_addr=fff10000\0" \
+ "initrd_high=30000000\0" \
"load=tftp 100000 /tftpboot/ocotea/u-boot.bin\0" \
"update=protect off fffc0000 ffffffff;era fffc0000 ffffffff;" \
"cp.b 100000 fffc0000 40000;" \
diff --git a/include/configs/sequoia.h b/include/configs/sequoia.h
index 098aa3f..29f3b40 100644
--- a/include/configs/sequoia.h
+++ b/include/configs/sequoia.h
@@ -391,7 +391,7 @@
#if !defined(CONFIG_NAND_U_BOOT) && !defined(CONFIG_NAND_SPL)
#define CFG_NAND_CS 3 /* NAND chip connected to CSx */
/* Memory Bank 0 (NOR-FLASH) initialization */
-#define CFG_EBC_PB0AP 0x03017300
+#define CFG_EBC_PB0AP 0x03017200
#define CFG_EBC_PB0CR (CFG_FLASH | 0xda000)
/* Memory Bank 3 (NAND-FLASH) initialization */
@@ -400,7 +400,7 @@
#else
#define CFG_NAND_CS 0 /* NAND chip connected to CSx */
/* Memory Bank 3 (NOR-FLASH) initialization */
-#define CFG_EBC_PB3AP 0x03017300
+#define CFG_EBC_PB3AP 0x03017200
#define CFG_EBC_PB3CR (CFG_FLASH | 0xda000)
/* Memory Bank 0 (NAND-FLASH) initialization */
diff --git a/include/configs/taishan.h b/include/configs/taishan.h
index 7ace397..2b28f93 100644
--- a/include/configs/taishan.h
+++ b/include/configs/taishan.h
@@ -188,6 +188,7 @@
"bootfile=/tftpboot/taishan/uImage\0" \
"kernel_addr=fc000000\0" \
"ramdisk_addr=fc180000\0" \
+ "initrd_high=30000000\0" \
"load=tftp 100000 /tftpboot/taishan/u-boot.bin\0" \
"update=protect off fffc0000 ffffffff;era fffc0000 ffffffff;" \
"cp.b 100000 fffc0000 40000;" \
diff --git a/include/configs/walnut.h b/include/configs/walnut.h
index 28abd6e..b34dc71 100644
--- a/include/configs/walnut.h
+++ b/include/configs/walnut.h
@@ -68,6 +68,7 @@
"bootfile=/tftpboot/walnut/uImage\0" \
"kernel_addr=fff80000\0" \
"ramdisk_addr=fff80000\0" \
+ "initrd_high=30000000\0" \
"load=tftp 100000 /tftpboot/walnut/u-boot.bin\0" \
"update=protect off fffc0000 ffffffff;era fffc0000 ffffffff;" \
"cp.b 100000 fffc0000 40000;" \
diff --git a/include/configs/yucca.h b/include/configs/yucca.h
index a6532b5..6417ed8 100644
--- a/include/configs/yucca.h
+++ b/include/configs/yucca.h
@@ -178,6 +178,7 @@
"bootfile=yucca/uImage\0" \
"kernel_addr=E7F10000\0" \
"ramdisk_addr=E7F20000\0" \
+ "initrd_high=30000000\0" \
"load=tftp 100000 yuca/u-boot.bin\0" \
"update=protect off 2:4-7;era 2:4-7;" \
"cp.b ${fileaddr} FFFB0000 ${filesize};" \
diff --git a/include/ide.h b/include/ide.h
index dfef32f..6976a6c 100644
--- a/include/ide.h
+++ b/include/ide.h
@@ -48,8 +48,8 @@ typedef ulong lbaint_t;
* Function Prototypes
*/
-void ide_init (void);
-ulong ide_read (int device, lbaint_t blknr, ulong blkcnt, ulong *buffer);
-ulong ide_write (int device, lbaint_t blknr, ulong blkcnt, ulong *buffer);
+void ide_init(void);
+ulong ide_read(int device, lbaint_t blknr, ulong blkcnt, void *buffer);
+ulong ide_write(int device, lbaint_t blknr, ulong blkcnt, void *buffer);
#endif /* _IDE_H */
diff --git a/include/part.h b/include/part.h
index 318aa3c..29c0320 100644
--- a/include/part.h
+++ b/include/part.h
@@ -22,6 +22,7 @@
*/
#ifndef _PART_H
#define _PART_H
+
#include <ide.h>
typedef struct block_dev_desc {
@@ -43,7 +44,11 @@ typedef struct block_dev_desc {
unsigned long (*block_read)(int dev,
unsigned long start,
lbaint_t blkcnt,
- unsigned long *buffer);
+ void *buffer);
+ unsigned long (*block_write)(int dev,
+ unsigned long start,
+ lbaint_t blkcnt,
+ const void *buffer);
}block_dev_desc_t;
/* Interface types: */
@@ -83,6 +88,14 @@ typedef struct disk_partition {
uchar type[32]; /* string type description */
} disk_partition_t;
+/* Misc _get_dev functions */
+block_dev_desc_t* get_dev(char* ifname, int dev);
+block_dev_desc_t* ide_get_dev(int dev);
+block_dev_desc_t* scsi_get_dev(int dev);
+block_dev_desc_t* usb_stor_get_dev(int dev);
+block_dev_desc_t* mmc_get_dev(int dev);
+block_dev_desc_t* systemace_get_dev(int dev);
+
/* disk/part.c */
int get_partition_info (block_dev_desc_t * dev_desc, int part, disk_partition_t *info);
void print_part (block_dev_desc_t *dev_desc);
diff --git a/lib_generic/display_options.c b/lib_generic/display_options.c
index 512e898..5ddd94f 100644
--- a/lib_generic/display_options.c
+++ b/lib_generic/display_options.c
@@ -21,7 +21,10 @@
* MA 02111-1307 USA
*/
+#include <config.h>
#include <common.h>
+#include <linux/ctype.h>
+#include <asm/io.h>
int display_options (void)
{
@@ -65,3 +68,70 @@ void print_size (ulong size, const char *s)
}
printf (" %cB%s", c, s);
}
+
+/*
+ * Print data buffer in hex and ascii form to the terminal.
+ *
+ * data reads are buffered so that each memory address is only read once.
+ * Useful when displaying the contents of volatile registers.
+ *
+ * parameters:
+ * addr: Starting address to display at start of line
+ * data: pointer to data buffer
+ * width: data value width. May be 1, 2, or 4.
+ * count: number of values to display
+ * linelen: Number of values to print per line; specify 0 for default length
+ */
+#define MAX_LINE_LENGTH_BYTES (64)
+#define DEFAULT_LINE_LENGTH_BYTES (16)
+int print_buffer (ulong addr, void* data, uint width, uint count, uint linelen)
+{
+ uint8_t linebuf[MAX_LINE_LENGTH_BYTES];
+ uint32_t *uip = (void*)linebuf;
+ uint16_t *usp = (void*)linebuf;
+ uint8_t *ucp = (void*)linebuf;
+ int i;
+
+ if (linelen*width > MAX_LINE_LENGTH_BYTES)
+ linelen = MAX_LINE_LENGTH_BYTES / width;
+ if (linelen < 1)
+ linelen = DEFAULT_LINE_LENGTH_BYTES / width;
+
+ while (count) {
+ printf("%08lx:", addr);
+
+ /* check for overflow condition */
+ if (count < linelen)
+ linelen = count;
+
+ /* Copy from memory into linebuf and print hex values */
+ for (i = 0; i < linelen; i++) {
+ if (width == 4) {
+ uip[i] = *(volatile uint32_t *)data;
+ printf(" %08x", uip[i]);
+ } else if (width == 2) {
+ usp[i] = *(volatile uint16_t *)data;
+ printf(" %04x", usp[i]);
+ } else {
+ ucp[i] = *(volatile uint8_t *)data;
+ printf(" %02x", ucp[i]);
+ }
+ data += width;
+ }
+
+ /* Print data in ASCII characters */
+ puts(" ");
+ for (i = 0; i < linelen * width; i++)
+ putc(isprint(ucp[i]) && (ucp[i] < 0x80) ? ucp[i] : '.');
+ putc ('\n');
+
+ /* update references */
+ addr += linelen * width;
+ count -= linelen;
+
+ if (ctrlc())
+ return -1;
+ }
+
+ return 0;
+}