summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorMichal Simek <monstr@monstr.eu>2007-09-11 00:29:27 +0200
committerMichal Simek <monstr@monstr.eu>2007-09-11 00:29:27 +0200
commit9c73f4b81172bc9f1b8f132450e69bcfb5b960ca (patch)
treeb20402ff5f80a91423b9d444ba5b947d36cd06ff /common
parent78cff50edba6b1508eb15c2f53ce966ac891eb9e (diff)
parente251e00d0db4b36d1d2b7e38fec43a7296b529a2 (diff)
downloadtalos-obmc-uboot-9c73f4b81172bc9f1b8f132450e69bcfb5b960ca.tar.gz
talos-obmc-uboot-9c73f4b81172bc9f1b8f132450e69bcfb5b960ca.zip
Merge git://www.denx.de/git/u-boot
Diffstat (limited to 'common')
-rw-r--r--common/cmd_bdinfo.c67
-rw-r--r--common/cmd_bootm.c78
-rw-r--r--common/cmd_ide.c51
-rw-r--r--common/cmd_mii.c2
-rw-r--r--common/cmd_nand.c37
-rw-r--r--common/env_flash.c20
-rw-r--r--common/fdt_support.c1
-rw-r--r--common/serial.c13
8 files changed, 177 insertions, 92 deletions
diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
index ccb826b8ab..ef15a006cd 100644
--- a/common/cmd_bdinfo.c
+++ b/common/cmd_bdinfo.c
@@ -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);
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index df1d0380d4..6ebedfbc83 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -817,27 +817,34 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
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;
}
+#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 + sizeof(image_header_t))) != OF_DT_HEADER) {
+ if (*((ulong *)(of_flat_tree)) != OF_DT_HEADER) {
#else
- if (fdt_check_header(of_flat_tree + sizeof(image_header_t)) != 0) {
+ if (fdt_check_header (of_flat_tree) != 0) {
#endif
puts ("ERROR: image is not a fdt - "
"must RESET the board to recover.\n");
@@ -845,9 +852,11 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
}
#if defined(CONFIG_OF_FLAT_TREE)
- if (((struct boot_param_header *)of_data)->totalsize != ntohl(len_ptr[2])) {
+ if (((struct boot_param_header *)of_flat_tree)->totalsize !=
+ ntohl (len_ptr[2])) {
#else
- if (be32_to_cpu(fdt_totalsize(of_data)) != ntohl(len_ptr[2])) {
+ if (be32_to_cpu (fdt_totalsize (of_flat_tree)) !=
+ ntohl(len_ptr[2])) {
#endif
puts ("ERROR: fdt size != image size - "
"must RESET the board to recover.\n");
@@ -932,7 +941,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
* so we flag it to be copied if it is not.
*/
if (of_flat_tree >= (char *)CFG_BOOTMAPSZ)
- of_data = of_flat_tree;
+ of_data = (ulong)of_flat_tree;
#endif
/* move of_flat_tree if needed */
@@ -957,36 +966,48 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
"must RESET the board to recover.\n");
do_reset (cmdtp, flag, argc, argv);
}
+ 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 (fdt_chosen(of_flat_tree, initrd_start, initrd_end, 0) < 0) {
- puts ("ERROR: /chosen node create failed - "
- "must RESET the board to recover.\n");
- do_reset (cmdtp, flag, argc, argv);
- }
+ if (of_flat_tree) {
+ if (fdt_chosen(of_flat_tree, initrd_start, initrd_end, 0) < 0) {
+ 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) {
- puts ("ERROR: /u-boot-env node create failed - "
- "must RESET the board to recover.\n");
- do_reset (cmdtp, flag, argc, argv);
- }
+ if (fdt_env(of_flat_tree) < 0) {
+ 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) {
- puts ("ERROR: /bd_t node create failed - "
- "must RESET the board to recover.\n");
- do_reset (cmdtp, flag, argc, argv);
- }
+ if (fdt_bd_t(of_flat_tree) < 0) {
+ 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);
+ /* 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;
@@ -1002,6 +1023,7 @@ 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
diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index 89fefed33d..bb064eaa04 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>
@@ -128,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
@@ -172,8 +171,8 @@ 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);
@@ -805,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;
- *((u16 *)(ATA_CURR_BASE(dev)+CFG_ATA_PORT_ADDR(port))) = val;
-}
-#else /* ! __PPC__ */
-static void __inline__
-ide_outb(int dev, int port, unsigned char val)
-{
- outb(val, ATA_CURR_BASE(dev)+CFG_ATA_PORT_ADDR(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 = *((u16 *)(ATA_CURR_BASE(dev)+CFG_ATA_PORT_ADDR(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)+CFG_ATA_PORT_ADDR(port));
-}
-#endif /* __PPC__ */
+unsigned char inline ide_inb(int dev, int port)
+ __attribute__((weak, alias("__ide_inb")));
#ifdef __PPC__
# ifdef CONFIG_AMIGAONEG3SE
diff --git a/common/cmd_mii.c b/common/cmd_mii.c
index f6b98d1f3d..72e11d5442 100644
--- a/common/cmd_mii.c
+++ b/common/cmd_mii.c
@@ -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
diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index c72612d0d6..254a7755fc 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -468,14 +468,31 @@ 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 (-56);
@@ -495,8 +512,18 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
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 (-58);
@@ -545,7 +572,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],
@@ -604,7 +631,7 @@ usage:
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
diff --git a/common/env_flash.c b/common/env_flash.c
index 7a37e550de..eccfb62a3b 100644
--- a/common/env_flash.c
+++ b/common/env_flash.c
@@ -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/fdt_support.c b/common/fdt_support.c
index caaa682a4f..175d59eb99 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -46,7 +46,6 @@ 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 */
diff --git a/common/serial.c b/common/serial.c
index 13e9f30e41..dee1cc0ab9 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);
}
OpenPOWER on IntegriCloud