Commit 7f70e85309c6367138c0ebd14abdd49964b8d50a

Authored by wdenk
1 parent 59de2ed6b5

* Patch by David Updegraff, 22 Apr 2003:

update for CrayL1 board

* Patch by Pantelis Antoniou, 21 Apr 2003:
  add boot support for ARTOS (a proprietary OS)

* Patch by Steven Scholz, 11 Apr 2003:
  Add support for RTC DS1338

* Patch by Rod Boyce, 24 Jan 2003:
  Fix counting of extended partitions in diskboot command

Showing 18 changed files with 447 additions and 84 deletions Side-by-side Diff

... ... @@ -2,6 +2,18 @@
2 2 Changes since U-Boot 0.3.1:
3 3 ======================================================================
4 4  
  5 +* Patch by David Updegraff, 22 Apr 2003:
  6 + update for CrayL1 board
  7 +
  8 +* Patch by Pantelis Antoniou, 21 Apr 2003:
  9 + add boot support for ARTOS (a proprietary OS)
  10 +
  11 +* Patch by Steven Scholz, 11 Apr 2003:
  12 + Add support for RTC DS1338
  13 +
  14 +* Patch by Rod Boyce, 24 Jan 2003:
  15 + Fix counting of extended partitions in diskboot command
  16 +
5 17 * Patch by Christophe Lindheimer, 20 May 2003:
6 18 allow the use of CFG_LOADS when CFG_NO_FLASH is set
7 19  
... ... @@ -26,6 +26,10 @@
26 26 E: guillaume.alexandre@gespac.ch
27 27 D: Add PCIPPC6 configuration
28 28  
  29 +N: Pantelis Antoniou
  30 +E: panto@intracom.gr
  31 +D: NETVIA board support, ARTOS support.
  32 +
29 33 N: Pierre Aubert
30 34 E: <p.aubert@staubli.com>
31 35 D: Support for RPXClassic board
... ... @@ -747,6 +747,7 @@
747 747 rm -f tools/easylogo/easylogo tools/bmp_logo
748 748 rm -f tools/gdb/astest tools/gdb/gdbcont tools/gdb/gdbsend
749 749 rm -f tools/env/fw_printenv tools/env/fw_setenv
  750 + rm -f board/cray/L1/bootscript.c board/cray/L1/bootscript.image
750 751  
751 752 clobber: clean
752 753 find . -type f \
... ... @@ -343,7 +343,8 @@
343 343 CONFIG_GTH, CONFIG_RPXClassic, CONFIG_rsdproto,
344 344 CONFIG_IAD210, CONFIG_RPXlite, CONFIG_sbc8260,
345 345 CONFIG_EBONY, CONFIG_sacsng, CONFIG_FPS860L,
346   - CONFIG_V37, CONFIG_ELPT860, CONFIG_CMI
  346 + CONFIG_V37, CONFIG_ELPT860, CONFIG_CMI,
  347 + CONFIG_NETVIA
347 348  
348 349 ARM based boards:
349 350 -----------------
... ... @@ -638,6 +639,7 @@
638 639 CONFIG_RTC_MC146818 - use MC146818 RTC
639 640 CONFIG_RTC_DS1307 - use Maxim, Inc. DS1307 RTC
640 641 CONFIG_RTC_DS1337 - use Maxim, Inc. DS1337 RTC
  642 + CONFIG_RTC_DS1338 - use Maxim, Inc. DS1338 RTC
641 643 CONFIG_RTC_DS164x - use Dallas DS164x RTC
642 644  
643 645 - Timestamp Support:
... ... @@ -1750,7 +1752,7 @@
1750 1752 FPS850L_config Sandpoint8240_config sbc8260_config
1751 1753 GENIETV_config TQM823L_config PIP405_config
1752 1754 GEN860T_config EBONY_config FPS860L_config
1753   - ELPT860_config cmi_mpc5xx_config
  1755 + ELPT860_config cmi_mpc5xx_config NETVIA_config
1754 1756  
1755 1757 Note: for some board special configuration names may exist; check if
1756 1758 additional information is available from the board vendor; for
... ... @@ -2066,8 +2068,8 @@
2066 2068  
2067 2069 * Target Operating System (Provisions for OpenBSD, NetBSD, FreeBSD,
2068 2070 4.4BSD, Linux, SVR4, Esix, Solaris, Irix, SCO, Dell, NCR, VxWorks,
2069   - LynxOS, pSOS, QNX;
2070   - Currently supported: Linux, NetBSD, VxWorks, QNX).
  2071 + LynxOS, pSOS, QNX, RTEMS, ARTOS;
  2072 + Currently supported: Linux, NetBSD, VxWorks, QNX, RTEMS, ARTOS).
2071 2073 * Target CPU Architecture (Provisions for Alpha, ARM, Intel x86,
2072 2074 IA64, MIPS, MIPS, PowerPC, IBM S390, SuperH, Sparc, Sparc 64 Bit;
2073 2075 Currently supported: PowerPC).
... ... @@ -27,7 +27,9 @@
27 27 #include <command.h>
28 28 #include <cmd_nvedit.h>
29 29 #include <cmd_bootm.h>
  30 +#include <cmd_boot.h>
30 31 #include <rtc.h>
  32 +#include <post.h>
31 33 #include <net.h>
32 34 #include <malloc.h>
33 35  
34 36  
35 37  
... ... @@ -53,17 +55,19 @@
53 55 * space.
54 56 * on the server this looks like:
55 57 *
56   - * option space U-Boot;
57   - * option U-Boot.initrd code 3 = string;
58   - * option U-Boot.bootcmd code 4 = string;
59   - * option U-Boot.bootflags code 5 = string;
60   - * option U-Boot.rootdev code 6 = string;
  58 + * option space CRAYL1;
  59 + * option CRAYL1.initrd code 3 = string;
  60 + * ..etc...
61 61 */
62 62 #define DHCP_VENDOR_SPECX 43
63 63 #define DHCP_VX_INITRD 3
64 64 #define DHCP_VX_BOOTCMD 4
65   -#define DHCP_VX_BOOTFLAGS 5
  65 +#define DHCP_VX_BOOTARGS 5
66 66 #define DHCP_VX_ROOTDEV 6
  67 +#define DHCP_VX_FROMFLASH 7
  68 +#define DHCP_VX_BOOTSCRIPT 8
  69 +#define DHCP_VX_RCFILE 9
  70 +#define DHCP_VX_MAGIC 10
67 71  
68 72 /* Things DHCP server can tellme about. If there's no flash address, then
69 73 * they dont participate in 'update' to flash, and we force their values
70 74  
71 75  
72 76  
73 77  
... ... @@ -89,18 +93,29 @@
89 93 /* and the other way.. */
90 94 {DHCP_VENDOR_SPECX, DHCP_VX_INITRD, NULL, "initrd"},
91 95 {DHCP_VENDOR_SPECX, DHCP_VX_BOOTCMD, NULL, "bootcmd"},
92   - {DHCP_VENDOR_SPECX, DHCP_VX_BOOTFLAGS, NULL, NULL},
  96 + {DHCP_VENDOR_SPECX, DHCP_VX_FROMFLASH, NULL, "fromflash"},
  97 + {DHCP_VENDOR_SPECX, DHCP_VX_BOOTSCRIPT, NULL, "bootscript"},
  98 + {DHCP_VENDOR_SPECX, DHCP_VX_RCFILE, NULL, "rcfile"},
  99 + {DHCP_VENDOR_SPECX, DHCP_VX_BOOTARGS, NULL, "xbootargs"},
93 100 {DHCP_VENDOR_SPECX, DHCP_VX_ROOTDEV, NULL, NULL},
  101 + {DHCP_VENDOR_SPECX, DHCP_VX_MAGIC, NULL, NULL}
94 102 };
95 103  
96 104 #define N_THINGS ((sizeof(Things))/(sizeof(dhcp_item_t)))
97 105  
98   -static void init_ecc_sdram (void);
  106 +extern char bootscript[];
99 107  
  108 +/* Here is the boot logic as HUSH script. Overridden by any TFP provided
  109 + * bootscript file.
  110 + */
  111 +
  112 +static void init_sdram (void);
  113 +
100 114 /* ------------------------------------------------------------------------- */
101 115 int board_pre_init (void)
102 116 {
103   - init_ecc_sdram ();
  117 + /* Running from ROM: global data is still READONLY */
  118 + init_sdram ();
104 119 mtdcr (uicsr, 0xFFFFFFFF); /* clear all ints */
105 120 mtdcr (uicer, 0x00000000); /* disable all ints */
106 121 mtdcr (uiccr, 0x00000020); /* set all but FPGA SMI to be non-critical */
... ... @@ -116,6 +131,7 @@
116 131 {
117 132 return (0);
118 133 }
  134 +/* ------------------------------------------------------------------------- */
119 135  
120 136 /* ------------------------------------------------------------------------- */
121 137 int misc_init_r (void)
... ... @@ -124,6 +140,7 @@
124 140 image_header_t *hdr;
125 141 time_t timestamp;
126 142 struct rtc_time tm;
  143 + char bootcmd[32];
127 144  
128 145 hdr = (image_header_t *) (CFG_MONITOR_BASE - sizeof (image_header_t));
129 146 timestamp = (time_t) hdr->ih_time;
... ... @@ -143,6 +160,8 @@
143 160 setenv ("ethaddr", e);
144 161 }
145 162 }
  163 + sprintf (bootcmd,"autoscript %X",(unsigned)bootscript);
  164 + setenv ("bootcmd", bootcmd);
146 165 return (0);
147 166 }
148 167  
149 168  
150 169  
... ... @@ -168,11 +187,11 @@
168 187 }
169 188  
170 189 /* ------------------------------------------------------------------------- */
171   -/* Do sdram bank init in C so I can read it..
  190 +/* Do sdram bank init in C so I can read it..no console to print to yet!
172 191 */
173   -static void init_ecc_sdram (void)
  192 +static void init_sdram (void)
174 193 {
175   - unsigned long tmp, *p;
  194 + unsigned long tmp;
176 195  
177 196 /* write SDRAM bank 0 register */
178 197 mtdcr (memcfga, mem_mb0cf);
179 198  
180 199  
181 200  
182 201  
... ... @@ -202,33 +221,78 @@
202 221 mtdcr (memcfgd, 0x90800000);
203 222 udelay (200);
204 223  
205   -/* disable ECC on all banks */
  224 +/* initially, disable ECC on all banks */
  225 + udelay (200);
206 226 mtdcr (memcfga, mem_ecccf);
207 227 tmp = mfdcr (memcfgd);
208 228 tmp &= 0xff0fffff;
209 229 mtdcr (memcfga, mem_ecccf);
210 230 mtdcr (memcfgd, tmp);
211 231  
212   -/* set up SDRAM Controller with ECC enabled */
  232 + return;
  233 +}
  234 +
  235 +extern int memory_post_test (int flags);
  236 +
  237 +int testdram (void)
  238 +{
  239 + unsigned long tmp;
  240 + uint *pstart = (uint *) 0x00000000;
  241 + uint *pend = (uint *) L1_MEMSIZE;
  242 + uint *p;
  243 +
  244 + if (getenv_r("booted",NULL,0) <= 0)
  245 + {
  246 + printf ("testdram..");
  247 + /*AA*/
  248 + for (p = pstart; p < pend; p++)
  249 + *p = 0xaaaaaaaa;
  250 + for (p = pstart; p < pend; p++) {
  251 + if (*p != 0xaaaaaaaa) {
  252 + printf ("SDRAM test fails at: %08x, was %08x expected %08x\n",
  253 + (uint) p, *p, 0xaaaaaaaa);
  254 + return 1;
  255 + }
  256 + }
  257 + /*55*/
  258 + for (p = pstart; p < pend; p++)
  259 + *p = 0x55555555;
  260 + for (p = pstart; p < pend; p++) {
  261 + if (*p != 0x55555555) {
  262 + printf ("SDRAM test fails at: %08x, was %08x expected %08x\n",
  263 + (uint) p, *p, 0x55555555);
  264 + return 1;
  265 + }
  266 + }
  267 + /*addr*/
  268 + for (p = pstart; p < pend; p++)
  269 + *p = (unsigned)p;
  270 + for (p = pstart; p < pend; p++) {
  271 + if (*p != (unsigned)p) {
  272 + printf ("SDRAM test fails at: %08x, was %08x expected %08x\n",
  273 + (uint) p, *p, (uint)p);
  274 + return 1;
  275 + }
  276 + }
  277 + printf ("Success. ");
  278 + }
  279 + printf ("Enable ECC..");
  280 +
213 281 mtdcr (memcfga, mem_mcopt1);
214 282 tmp = (mfdcr (memcfgd) & ~0xFFE00000) | 0x90800000;
215 283 mtdcr (memcfga, mem_mcopt1);
216 284 mtdcr (memcfgd, tmp);
217 285 udelay (600);
218   -
219   -/* fill all the memory */
220   - for (p = (unsigned long) 0; ((unsigned long) p < L1_MEMSIZE);
221   - *p++ = 0L);
  286 + for (p = (unsigned long) 0; ((unsigned long) p < L1_MEMSIZE); *p++ = 0L)
  287 + ;
222 288 udelay (400);
223 289 mtdcr (memcfga, mem_ecccf);
224 290 tmp = mfdcr (memcfgd);
225   -
226   -/* enable ECC on bank 0 */
227 291 tmp |= 0x00800000;
228 292 mtdcr (memcfgd, tmp);
229 293 udelay (400);
230   -
231   - return;
  294 + printf ("enabled.\n");
  295 + return (0);
232 296 }
233 297  
234 298 /* ------------------------------------------------------------------------- */
235 299  
... ... @@ -250,7 +314,9 @@
250 314  
251 315 /* set env. */
252 316 if (Things[thing].envname)
  317 + {
253 318 setenv (Things[thing].envname, Things[thing].dhcpvalue);
  319 + }
254 320 return (Things[thing].dhcpvalue);
255 321 }
256 322  
... ... @@ -285,9 +351,9 @@
285 351 oplen -= sub_oplen, sub_op += (sub_oplen + 2)) {
286 352 for (thing = 0; thing < N_THINGS; thing++) {
287 353 if (*sub_op == Things[thing].dhcp_vendor_option) {
288   - if (!(retval = dhcp_env_update (thing, sub_op))) {
289   - return NULL;
290   - }
  354 + if (!(retval = dhcp_env_update (thing, sub_op))) {
  355 + return NULL;
  356 + }
291 357 }
292 358 }
293 359 }
... ... @@ -298,6 +364,6 @@
298 364 return NULL;
299 365 }
300 366 }
301   - return (thing >= N_THINGS ? NULL : pop);
  367 + return (pop);
302 368 }
board/cray/L1/Makefile
... ... @@ -25,17 +25,27 @@
25 25  
26 26 LIB = lib$(BOARD).a
27 27  
28   -OBJS = $(BOARD).o flash.o
29   -SOBJS = init.o
  28 +OBJS = $(BOARD).o flash.o bootscript.o
  29 +SOBJS = init.o
30 30  
31 31 $(LIB): $(OBJS) $(SOBJS)
32 32 $(AR) crv $@ $^
33 33  
34 34 clean:
35   - rm -f $(SOBJS) $(OBJS)
  35 + rm -f $(SOBJS) $(OBJS) bootscript.c bootscript.image
36 36  
37 37 distclean: clean
38 38 rm -f $(LIB) core *.bak .depend
  39 +
  40 +$(BOARD).o: $(BOARD).c bootscript.o
  41 +
  42 +bootscript.o: bootscript.c
  43 +
  44 +bootscript.c: bootscript.image
  45 + od -t x1 -v -A x $^ | awk -f x2c.awk > $@
  46 +
  47 +bootscript.image: bootscript.hush Makefile
  48 + -$(TOPDIR)/tools/mkimage -A ppc -O linux -T script -C none -a 0 -e 0 -n bootscript -d bootscript.hush $@
39 49  
40 50 #########################################################################
41 51  
board/cray/L1/bootscript.hush
  1 +# $Header$
  2 +# hush bootscript for PPCBOOT on L1
  3 +# note: all #s are in hex, do _NOT_ prefix it with 0x
  4 +
  5 +flash_rfs=ffc00000
  6 +flash_krl=fff00000
  7 +tftp_addr=100000
  8 +tftp2_addr=1000000
  9 +
  10 +if printenv booted
  11 +then
  12 + echo already booted before
  13 +else
  14 + echo first boot in environment, create and save settings
  15 + setenv booted OK
  16 + saveenv
  17 +fi
  18 +
  19 +setenv autoload no
  20 +# clear out stale env stuff, so we get fresh from dhcp.
  21 +for setting in initrd fromflash kernel rootfs rootpath
  22 +do
  23 +setenv $setting
  24 +done
  25 +
  26 +dhcp
  27 +
  28 +# if host provides us with a different bootscript, us it.
  29 +if printenv bootscript
  30 + then
  31 + tftp $tftp_addr $bootcript
  32 + if imi $tftp_addr
  33 + then
  34 + autoscript $tftp_addr
  35 + fi
  36 +fi
  37 +
  38 +# default base kernel arguments.
  39 +setenv bootargs $xbootargs devfs=mount ip=$ipaddr:$serverip:$gatewayip:$netmask:L1:eth0:off wdt=120
  40 +
  41 +# Have a kernel in flash?
  42 +if imi $flash_krl
  43 +then
  44 + echo ok kernel to boot from $flash_krl
  45 + setenv kernel $flash_krl
  46 +else
  47 + echo no kernel to boot from $flash_krl, need tftp
  48 +fi
  49 +
  50 +# Have a rootfs in flash?
  51 +echo test for SQUASHfs at $flash_rfs
  52 +
  53 +if imi $flash_rfs
  54 +then
  55 + echo appears to be a good initrd image at base of flash OK
  56 + setenv rootfs $flash_rfs
  57 +else
  58 + echo no image at base of flash, need nfsroot or initrd
  59 +fi
  60 +
  61 +# I boot from flash if told to and I can.
  62 +if printenv fromflash && printenv kernel && printenv rootfs
  63 +then
  64 + echo booting entirely from flash
  65 + setenv bootargs root=/dev/ram0 rw $bootargs
  66 + bootm $kernel $rootfs
  67 + echo oh no failed so I try some other stuff
  68 +fi
  69 +
  70 +# TFTP down a kernel
  71 +if printenv bootfile
  72 +then
  73 + tftp $tftp_addr $bootfile
  74 + setenv kernel $tftp_addr
  75 + echo I will boot the TFTP kernel
  76 +else
  77 + if printenv kernel
  78 + then
  79 + echo no bootfile specified, will use one from flash
  80 + else
  81 + setenv bootfile /opt/crayx1/craymcu/l1/flash/linux.image
  82 + echo OH NO! we have no bootfile,nor flash kernel! try default: $bootfile
  83 + tftp $tftp_addr $bootfile
  84 + setenv kernel $tftp_addr
  85 + fi
  86 +fi
  87 +
  88 +# the rootfs.
  89 +if printenv rootpath
  90 +then
  91 + echo rootpath is $rootpath
  92 + if printenv initrd
  93 + then
  94 + echo initrd is also specified, so use $initrd
  95 + tftp $tftp2_addr $initrd
  96 + setenv bootargs root=/dev/ram0 rw cwsroot=$serverip:$rootpath $bootargs
  97 + bootm $kernel $tftp2_addr
  98 + else
  99 + echo initrd is not specified, so use NFSROOT $rootpat
  100 + setenv bootargs root=/dev/nfs ro nfsroot=$serverip:$rootpath $bootargs
  101 + bootm $kernel
  102 + fi
  103 +else
  104 + echo we have no rootpath check for one in flash
  105 + if printenv rootfs
  106 + then
  107 + echo I will use the one in flash
  108 + setenv bootargs root=/dev/mtdblock/0 ro rootfstype=squashfs $bootargs
  109 + bootm $kernel
  110 + else
  111 + setenv rootpath /export/crayl1
  112 + echo OH NO! we have no rootpath,nor flash kernel! try default: $rootpath
  113 + setenv bootargs root=/dev/mtdblock/0 ro rootfstype=squashfs $bootargs
  114 + bootm $kernel
  115 + fi
  116 +fi
  117 +reset
board/cray/L1/patchme
  1 +# master confi.mk
  2 +echo "CROSS_COMPILE = powerpc-linux-" >>include/config.mk
  3 +
  4 +# patch the examples/Makefile to ignore return value from OBJCOPY
  5 +sed -e 's/$(OBJCOPY)/-&/' < examples/Makefile > examples/makefile
  6 +
  7 +# add a built target for mkimage on the target architecture
  8 +sed -e 's/^all:.*$/all: .depend envcrc mkimage mkimage.ppc/' < tools/Makefile > tools/makefile
  9 +
  10 +cat <<EOF >>tools/makefile
  11 +mkimage.ppc : mkimage.o.ppc crc32.o.ppc
  12 + powerpc-linux-gcc -msoft-float -Wall -Wstrict-prototypes -o \$@ \$^
  13 + powerpc-linux-strip $@
  14 +
  15 +XFLAGS="-D__KERNEL__ -I../include -DCONFIG_4xx -Wall -Wstict-prototypes"
  16 +mkimage.o.ppc: mkimage.c
  17 + powerpc-linux-gcc -msoft-float -Wall -I../include -c -o \$@ \$^
  18 +
  19 +crc32.o.ppc: crc32.c
  20 + powerpc-linux-gcc -msoft-float -Wall -I../include -c -o \$@ \$^
  21 +
  22 +EOF
  23 +
  24 +# make an image by default out of the u-boot image
  25 +sed -e 's/^all:.*$/all: u-boot.image /' < Makefile > makefile
  26 +cat <<EOF >>makefile
  27 +u-boot.image: u-boot.bin
  28 + tools/mkimage -A ppc -O linux -T firmware -C none -a 0 -e 0 -n U-Boot -d \$^ \$@
  29 +
  30 +EOF
board/cray/L1/x2c.awk
  1 +#!/bin/awk
  2 +BEGIN { print "unsigned char bootscript[] = { \n"}
  3 +{ for (i = 2; i <= NF ; i++ ) printf "0x"$i","
  4 + print ""
  5 +}
  6 +END { print "\n};\n" }
... ... @@ -31,6 +31,7 @@
31 31 #include <image.h>
32 32 #include <malloc.h>
33 33 #include <zlib.h>
  34 +#include <environment.h>
34 35 #include <asm/byteorder.h>
35 36 #if (CONFIG_COMMANDS & CFG_CMD_DATE) || defined(CONFIG_TIMESTAMP)
36 37 #include <rtc.h>
... ... @@ -105,6 +106,9 @@
105 106 int do_bootvx ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[] );
106 107 int do_bootelf (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[] );
107 108 #endif /* CFG_CMD_ELF */
  109 +#if defined(CONFIG_ARTOS) && defined(CONFIG_PPC)
  110 +static boot_os_Fcn do_bootm_artos;
  111 +#endif
108 112  
109 113 image_header_t header;
110 114  
... ... @@ -338,6 +342,12 @@
338 342 addr, len_ptr, verify);
339 343 break;
340 344 #endif /* CFG_CMD_ELF */
  345 +#ifdef CONFIG_ARTOS
  346 + case IH_OS_ARTOS:
  347 + do_bootm_artos (cmdtp, flag, argc, argv,
  348 + addr, len_ptr, verify);
  349 + break;
  350 +#endif
341 351 }
342 352  
343 353 SHOW_BOOT_PROGRESS (-9);
... ... @@ -717,6 +727,99 @@
717 727 (*loader) (gd->bd, img_addr, consdev, cmdline);
718 728 }
719 729  
  730 +#if defined(CONFIG_ARTOS) && defined(CONFIG_PPC)
  731 +
  732 +/* Function that returns a character from the environment */
  733 +extern uchar (*env_get_char)(int);
  734 +
  735 +static void
  736 +do_bootm_artos (cmd_tbl_t *cmdtp, int flag,
  737 + int argc, char *argv[],
  738 + ulong addr,
  739 + ulong *len_ptr,
  740 + int verify)
  741 +{
  742 + DECLARE_GLOBAL_DATA_PTR;
  743 + ulong top;
  744 + char *s, *cmdline;
  745 + char **fwenv, **ss;
  746 + int i, j, nxt, len, envno, envsz;
  747 + bd_t *kbd;
  748 + void (*entry)(bd_t *bd, char *cmdline, char **fwenv, ulong top);
  749 + image_header_t *hdr = &header;
  750 +
  751 + /*
  752 + * Booting an ARTOS kernel image + application
  753 + */
  754 +
  755 + /* this used to be the top of memory, but was wrong... */
  756 +#ifdef CONFIG_PPC
  757 + /* get stack pointer */
  758 + asm volatile ("mr %0,1" : "=r"(top) );
  759 +#endif
  760 + debug ("## Current stack ends at 0x%08lX ", top);
  761 +
  762 + top -= 2048; /* just to be sure */
  763 + if (top > CFG_BOOTMAPSZ)
  764 + top = CFG_BOOTMAPSZ;
  765 + top &= ~0xF;
  766 +
  767 + debug ("=> set upper limit to 0x%08lX\n", top);
  768 +
  769 + /* first check the artos specific boot args, then the linux args*/
  770 + if ((s = getenv("abootargs")) == NULL && (s = getenv("bootargs")) == NULL)
  771 + s = "";
  772 +
  773 + /* get length of cmdline, and place it */
  774 + len = strlen(s);
  775 + top = (top - (len + 1)) & ~0xF;
  776 + cmdline = (char *)top;
  777 + debug ("## cmdline at 0x%08lX ", top);
  778 + strcpy(cmdline, s);
  779 +
  780 + /* copy bdinfo */
  781 + top = (top - sizeof(bd_t)) & ~0xF;
  782 + debug ("## bd at 0x%08lX ", top);
  783 + kbd = (bd_t *)top;
  784 + memcpy(kbd, gd->bd, sizeof(bd_t));
  785 +
  786 + /* first find number of env entries, and their size */
  787 + envno = 0;
  788 + envsz = 0;
  789 + for (i = 0; env_get_char(i) != '\0'; i = nxt + 1) {
  790 + for (nxt = i; env_get_char(nxt) != '\0'; ++nxt)
  791 + ;
  792 + envno++;
  793 + envsz += (nxt - i) + 1; /* plus trailing zero */
  794 + }
  795 + envno++; /* plus the terminating zero */
  796 + debug ("## %u envvars total size %u ", envno, envsz);
  797 +
  798 + top = (top - sizeof(char **)*envno) & ~0xF;
  799 + fwenv = (char **)top;
  800 + debug ("## fwenv at 0x%08lX ", top);
  801 +
  802 + top = (top - envsz) & ~0xF;
  803 + s = (char *)top;
  804 + ss = fwenv;
  805 +
  806 + /* now copy them */
  807 + for (i = 0; env_get_char(i) != '\0'; i = nxt + 1) {
  808 + for (nxt = i; env_get_char(nxt) != '\0'; ++nxt)
  809 + ;
  810 + *ss++ = s;
  811 + for (j = i; j < nxt; ++j)
  812 + *s++ = env_get_char(j);
  813 + *s++ = '\0';
  814 + }
  815 + *ss++ = NULL; /* terminate */
  816 +
  817 + entry = (void (*)(bd_t *, char *, char **, ulong))ntohl(hdr->ih_ep);
  818 + (*entry)(kbd, cmdline, fwenv, top);
  819 +}
  820 +#endif
  821 +
  822 +
720 823 #if (CONFIG_COMMANDS & CFG_CMD_BOOTD)
721 824 int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
722 825 {
... ... @@ -839,6 +942,9 @@
839 942 case IH_OS_QNX: os = "QNX"; break;
840 943 case IH_OS_U_BOOT: os = "U-Boot"; break;
841 944 case IH_OS_RTEMS: os = "RTEMS"; break;
  945 +#ifdef CONFIG_ARTOS
  946 + case IH_OS_ARTOS: os = "ARTOS"; break;
  947 +#endif
842 948 default: os = "Unknown OS"; break;
843 949 }
844 950  
... ... @@ -87,7 +87,9 @@
87 87 static int hardware_enable (int slot);
88 88 static int voltage_set(int slot, int vcc, int vpp);
89 89  
  90 +#ifndef CONFIG_I82365
90 91 static u_int m8xx_get_graycode(u_int size);
  92 +#endif /* CONFIG_I82365 */
91 93 #if 0
92 94 static u_int m8xx_get_speed(u_int ns, u_int is_io);
93 95 #endif
... ... @@ -2258,6 +2260,8 @@
2258 2260  
2259 2261 /* -------------------------------------------------------------------- */
2260 2262  
  2263 +#ifndef CONFIG_I82365
  2264 +
2261 2265 static u_int m8xx_get_graycode(u_int size)
2262 2266 {
2263 2267 u_int k;
... ... @@ -2272,6 +2276,8 @@
2272 2276  
2273 2277 return k;
2274 2278 }
  2279 +
  2280 +#endif /* CONFIG_I82365 */
2275 2281  
2276 2282 /* -------------------------------------------------------------------- */
2277 2283  
... ... @@ -169,7 +169,9 @@
169 169 * fdisk does not show the extended partitions that
170 170 * are not in the MBR
171 171 */
172   - if (pt->sys_ind != 0 && part_num == which_part) {
  172 + if ((pt->sys_ind != 0) &&
  173 + (part_num == which_part) &&
  174 + (is_extended(pt->sys_ind) == 0)) {
173 175 info->blksz = 512;
174 176 info->start = ext_part_sector + le32_to_int (pt->start4);
175 177 info->size = le32_to_int (pt->size4);
... ... @@ -3,7 +3,7 @@
3 3  
4 4 1. Put the s2 switch into the following position:
5 5  
6   - 1 0
  6 + Off On
7 7 ------
8 8 |x |
9 9 | x|
... ... @@ -13,7 +13,7 @@
13 13  
14 14 Put the s3 switch into the following position:
15 15  
16   - 1 0
  16 + Off On
17 17 ------
18 18 | x |
19 19 | x |
... ... @@ -23,7 +23,7 @@
23 23  
24 24 Put the s4 switch into the following position:
25 25  
26   - 1 0
  26 + Off On
27 27 ------
28 28 |x |
29 29 |x |
... ... @@ -60,7 +60,7 @@
60 60  
61 61 6. Power off. Restore the original S2 switch position:
62 62  
63   - 1 0
  63 + Off On
64 64 ------
65 65 | x|
66 66 | x|
include/configs/CRAYL1.h
... ... @@ -41,43 +41,28 @@
41 41 #define CONFIG_BOOTDELAY 5 /* autoboot after 5 seconds */
42 42 #define CONFIG_MII 1 /* MII PHY management */
43 43 #define CONFIG_PHY_ADDR 1 /* PHY address; handling of ENET */
44   -#define CONFIG_BOARD_PRE_INIT 1 /* setup for 405gp */
  44 +#define CONFIG_BOARD_PRE_INIT 1 /* early setup for 405gp */
45 45 #define CONFIG_MISC_INIT_R 1 /* so that a misc_init_r() is called */
46 46  
47 47 /* set PRAM to keep U-Boot out, mem= to keep linux out, and initrd_hi to
48 48 * keep possible initrd ramdisk decompression out. This is in k (1024 bytes)
49   - #define CONFIG_PRAM 16
  49 + #define CONFIG_PRAM 16
50 50 */
51   -#define CONFIG_LOADADDR 0x100000
  51 +#define CONFIG_LOADADDR 0x100000 /* where TFTP images go */
52 52 #undef CONFIG_BOOTARGS
53 53  
54   -/* the logic is that booting is driven by what env vars get set from DHCP.
55   - * Normal DHCP sets things like serverip, rootpath, etc.
56   - * if printenv
  54 +/* Bootcmd is overridden by the bootscript in board/cray/L1
57 55 */
58   -#define CFG_AUTOLOAD "yes"
59   -#define CONFIG_BOOTCOMMAND "dhcp;"\
60   - "setenv bootargs devfs=mount;"\
61   - "setenv bootargs ip=$ipaddr:$serverip:$gatewayip:$netmask:::off $bootargs;"\
62   - "if printenv initrd;"\
63   - "then;" \
64   - "setenv initrd_hi $mem;"\
65   - "tftp 1000000 $initrd;"\
66   - "setenv bootargs root=/dev/ram0 rw cwsroot=$serverip:$rootpath $bootargs;"\
67   - "bootm 100000 1000000;"\
68   - "else;"\
69   - "setenv bootargs root=/dev/nfs ro nfsroot=$serverip:$rootpath $bootargs;"\
70   - "bootm 100000;"\
71   - "fi;"
  56 +#define CFG_AUTOLOAD "no"
  57 +#define CONFIG_BOOTCOMMAND "dhcp"
72 58  
73   -#define CONFIG_EXTRA_ENV_SETTINGS ""
74   -
75   -/*
  59 +/*
76 60 * ..during experiments..
77 61 #define CONFIG_SERVERIP 10.0.0.1
78   - #define CONFIG_ETHADDR 00:40:a6:80:14:5
  62 + #define CONFIG_ETHADDR 00:40:a6:80:14:5
79 63 */
80 64 #define CONFIG_HARD_I2C 1 /* hardware support for i2c */
  65 +#define CONFIG_SDRAM_BANK0 1
81 66 #define CFG_I2C_SPEED 400000 /* I2C speed and slave address */
82 67 #define CFG_I2C_SLAVE 0x7F
83 68 #define CFG_I2C_EEPROM_ADDR 0x57
... ... @@ -87,6 +72,7 @@
87 72 #define CFG_HZ 1000 /* decrementer freq: 1 ms ticks */
88 73 #define CFG_HUSH_PARSER 1
89 74 #define CFG_PROMPT_HUSH_PS2 "> "
  75 +#define CONFIG_AUTOSCRIPT 1
90 76  
91 77  
92 78 #define CONFIG_COMMANDS (\
... ... @@ -106,6 +92,8 @@
106 92 CFG_CMD_RUN|\
107 93 CFG_CMD_I2C|\
108 94 CFG_CMD_EEPROM|\
  95 + CFG_CMD_DIAG|\
  96 + CFG_CMD_AUTOSCRIPT|\
109 97 CFG_CMD_SETGETDCR)
110 98  
111 99 /*
... ... @@ -120,7 +108,13 @@
120 108 CONFIG_BOOTP_BOOTFILESIZE|\
121 109 CONFIG_BOOTP_BOOTPATH)
122 110  
123   -/*
  111 +/*
  112 + * how many time to fail & restart a net-TFTP before giving up & resetting
  113 + * the board hoping that a reset of net interface might help..
  114 + */
  115 +#define CONFIG_NET_RESET 5
  116 +
  117 +/*
124 118 * bauds. Just to make it compile; in our case, I read the base_baud
125 119 * from the DCR anyway, so its kinda-tied to the above ref. clock which in turn
126 120 * drives the system clock.
... ... @@ -145,6 +139,7 @@
145 139 #define CFG_LOAD_ADDR 0x100000/* where to load what we get from TFTP */
146 140 #define CFG_TFTP_LOADADDR CFG_LOAD_ADDR
147 141 #define CFG_EXTBDINFO 1 /* To use extended board_into (bd_t) */
  142 +#define CFG_DRAM_TEST 1
148 143  
149 144 /*-----------------------------------------------------------------------
150 145 * Start addresses for the final memory configuration
151 146  
152 147  
... ... @@ -155,16 +150,9 @@
155 150 #define CFG_FLASH_BASE 0xFFC00000
156 151 #define CFG_MONITOR_BASE TEXT_BASE
157 152  
158   -#ifndef CFG_HUSH_PARSER
159   -#define CFG_MONITOR_LEN (128 * 1024) /* Reserve 128 kB for Monitor */
160   -#define CFG_ENV_OFFSET 0x3D0000
161   -#else
  153 +
162 154 #define CFG_MONITOR_LEN (192 * 1024) /* Reserve 192 kB for Monitor */
163   -#define CFG_ENV_OFFSET 0x3FE000
164   -#endif
165 155  
166   -#define CFG_MALLOC_LEN (128 * 1024) /* Reserve 128 kB for malloc() */
167   -
168 156 /*
169 157 * For booting Linux, the board info and command line data
170 158 * have to be in the first 8 MB of memory, since this is
171 159  
172 160  
... ... @@ -180,11 +168,12 @@
180 168 #define CFG_FLASH_WRITE_TOUT 500 /* Timeout for Flash Write (in ms) */
181 169  
182 170 /* BEG ENVIRONNEMENT FLASH: needs to be a whole FlashSector */
  171 +#define CFG_ENV_OFFSET 0x3c8000
183 172 #define CFG_ENV_IS_IN_FLASH 1 /* use FLASH for environment vars */
184   -#define CFG_ENV_SIZE 0x1000 /* Total Size of Environment Sector */
  173 +#define CFG_ENV_SIZE 0x1000 /* Total Size of Environment area */
185 174 #define CFG_ENV_SECT_SIZE 0x10000 /* see README - env sector total size */
186 175  
187   -/* Memory tests: U-Boot relocates itself to the top of Ram, so its at
  176 +/* Memory tests: U-BOOT relocates itself to the top of Ram, so its at
188 177 * 32meg-(128k+some_malloc_space+copy-of-ENV sector)..
189 178 */
190 179 #define CFG_SDRAM_SIZE 32 /* megs of ram */
... ... @@ -193,6 +182,7 @@
193 182 /* to the end of the DRAM */
194 183 /* less monitor and malloc area */
195 184 #define CFG_STACK_USAGE 0x10000 /* Reserve 64k for the stack usage */
  185 +#define CFG_MALLOC_LEN (128 << 10) /* 128k for malloc space */
196 186 #define CFG_MEM_END_USAGE ( CFG_MONITOR_LEN \
197 187 + CFG_MALLOC_LEN \
198 188 + CFG_ENV_SECT_SIZE \
... ... @@ -202,7 +192,7 @@
202 192 /* END ENVIRONNEMENT FLASH */
203 193  
204 194 /*-----------------------------------------------------------------------
205   - * Cache Configuration. Only used to ..?? clear it, I guess..
  195 + * Cache Configuration. Only used to ..?? clear it, I guess..
206 196 */
207 197 #define CFG_DCACHE_SIZE 16384
208 198 #define CFG_CACHELINE_SIZE 32
209 199  
210 200  
211 201  
... ... @@ -219,20 +209,26 @@
219 209 /*-----------------------------------------------------------------------
220 210 * Definitions for initial stack pointer and data area (in OnChipMem )
221 211 */
222   -#if 0
223   -#define CFG_INIT_RAM_ADDR 0x40000000 /* use data cache */
224   -#define CFG_INIT_RAM_END 0x2000 /* End of used area in RAM */
225   -#else
  212 +#if 1
  213 +/* On Chip Memory location */
226 214 #define CFG_TEMP_STACK_OCM 1
227 215 #define CFG_OCM_DATA_ADDR 0xF0000000
228 216 #define CFG_OCM_DATA_SIZE 0x1000
  217 +
  218 +#define CFG_INIT_RAM_ADDR CFG_OCM_DATA_ADDR /* inside of SDRAM */
  219 +#define CFG_INIT_RAM_END CFG_OCM_DATA_SIZE /* End of used area in RAM */
  220 +#define CFG_GBL_DATA_SIZE 256 /* size in bytes reserved for initial data */
  221 +#define CFG_GBL_DATA_OFFSET (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
  222 +#define CFG_INIT_SP_OFFSET CFG_GBL_DATA_OFFSET
  223 +#else
  224 +#define CFG_OCM_DATA_ADDR 0xF0000000
  225 +#define CFG_OCM_DATA_SIZE 0x1000
229 226 #define CFG_INIT_RAM_ADDR CFG_OCM_DATA_ADDR /* inside of On Chip SRAM */
230 227 #define CFG_INIT_RAM_END CFG_OCM_DATA_SIZE /* End of On Chip SRAM */
231   -#endif
232   -
233 228 #define CFG_GBL_DATA_SIZE 64 /* size in bytes reserved for initial data */
234 229 #define CFG_GBL_DATA_OFFSET (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
235 230 #define CFG_INIT_SP_OFFSET CFG_GBL_DATA_OFFSET
  231 +#endif
236 232  
237 233 /*-----------------------------------------------------------------------
238 234 * Definitions for Serial Presence Detect EEPROM address
include/configs/NETVIA.h
... ... @@ -345,5 +345,7 @@
345 345 /* Ethernet at SCC2 */
346 346 #define CONFIG_SCC2_ENET
347 347  
  348 +#define CONFIG_ARTOS /* include ARTOS support */
  349 +
348 350 #endif /* __CONFIG_H */
... ... @@ -46,6 +46,7 @@
46 46 #define IH_OS_QNX 16 /* QNX */
47 47 #define IH_OS_U_BOOT 17 /* Firmware */
48 48 #define IH_OS_RTEMS 18 /* RTEMS */
  49 +#define IH_OS_ARTOS 19 /* ARTOS */
49 50  
50 51 /*
51 52 * CPU Architecture Codes (supported by Linux)
... ... @@ -25,7 +25,7 @@
25 25  
26 26 /*
27 27 * Date & Time support (no alarms) for Dallas Semiconductor (now Maxim)
28   - * DS1307 Real Time Clock (RTC).
  28 + * DS1307 and DS1338 Real Time Clock (RTC).
29 29 *
30 30 * based on ds1337.c
31 31 */
... ... @@ -35,7 +35,8 @@
35 35 #include <rtc.h>
36 36 #include <i2c.h>
37 37  
38   -#if defined(CONFIG_RTC_DS1307) && (CONFIG_COMMANDS & CFG_CMD_DATE)
  38 +#if (defined(CONFIG_RTC_DS1307) || defined(CONFIG_RTC_DS1338) ) && \
  39 + (CONFIG_COMMANDS & CFG_CMD_DATE)
39 40  
40 41 /*---------------------------------------------------------------------*/
41 42 #undef DEBUG_RTC
... ... @@ -200,5 +201,5 @@
200 201 return (((n / 10) << 4) | (n % 10));
201 202 }
202 203  
203   -#endif /* CONFIG_RTC_DS1307 && (CFG_COMMANDS & CFG_CMD_DATE) */
  204 +#endif /* (CONFIG_RTC_DS1307 || CONFIG_RTC_DS1338) && (CFG_COMMANDS & CFG_CMD_DATE) */
... ... @@ -93,6 +93,7 @@
93 93 { IH_OS_QNX, "qnx", "QNX", },
94 94 { IH_OS_U_BOOT, "u-boot", "U-Boot", },
95 95 { IH_OS_RTEMS, "rtems", "RTEMS", },
  96 + { IH_OS_ARTOS, "artos", "ARTOS", },
96 97 { -1, "", "", },
97 98 };
98 99