]> www.infradead.org Git - users/rw/ppcboot.git/commitdiff
Release 0.4.2:
authorwdenk <wdenk>
Fri, 4 Aug 2000 12:47:54 +0000 (12:47 +0000)
committerwdenk <wdenk>
Fri, 4 Aug 2000 12:47:54 +0000 (12:47 +0000)
Bug fixing, see TODO file for details.
Added persistent environment handling (save to flash).

40 files changed:
CREDITS
Makefile
README
TODO
common/Makefile
common/board.c
common/cmd_boot.c
common/cmd_bootm.c
common/cmd_flash.c
common/cmd_nvedit.c
common/command.c
common/environment.S [new file with mode: 0644]
common/main.c
config.mk
examples/Makefile
include/asm/8xx_immap.h
include/cmd_boot.h
include/cmd_bootm.h
include/cmd_cache.h
include/cmd_flash.h
include/cmd_mem.h
include/cmd_nvedit.h
include/command.h
include/config_TQM850L.h
include/mpc8xx.h
include/ppcboot.h
include/version.h
mpc8xx/Makefile
mpc8xx/cpu.c
mpc8xx/interrupts.c
mpc8xx/serial.c
ppc/Makefile
tools/Makefile
tools/mkimage.c
tqm8xx/Makefile
tqm8xx/flash.c
tqm8xx/ppcboot.lds [moved from include/ppcboot.lds with 90% similarity]
tqm8xx/ppcboot.lds.debug [new file with mode: 0644]
tqm8xx/tqm8xx.c
tqm8xx/tqm8xx.h

diff --git a/CREDITS b/CREDITS
index 5ddbc1203849133c4c30ce6b65e0313d0091ad4d..fa3c8c8136015ff2dc933934b5c037bda4044ac3 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -1,17 +1,26 @@
-
-    This is at least a partial credits-file of people that have
-    contributed to the PPCBOOT project. It is sorted by name and
-    formatted to allow easy grepping and beautification by scripts.
-    The fields are: name (N), email (E), web-address (W), PGP key ID
-    and fingerprint (P), description (D), and snail-mail address (S).
-    Thanks,
-
-                        Wolfgang Denk
-----------
+#
+#   Parts of the development effort for this project have been
+#   sponsored by SIEMENS AG, Austria. Thanks to SIEMENS for
+#   supporting an Open Source project!
+#
+#
+#   This is at least a partial credits-file of individual people that
+#   have contributed to the PPCBOOT project. It is sorted by name and
+#   formatted to allow easy grepping and beautification by scripts.
+#   The fields are: name (N), email (E), web-address (W), PGP key ID
+#   and fingerprint (P), description (D), and snail-mail address (S).
+#   Thanks,
+#
+#                       Wolfgang Denk
+#----------
+
+N: Andre Beaudin
+E: <andre.beaudin@colubris.com>
+D: PCMCIA, Ethernet, TFTP
 
 N: Roland Borde
 E: 100.130266@germanynet.de
-D: TFTP / BOOTP
+D: Ethernet, TFTP / BOOTP
 
 N: Raphael Bossek
 E: raphael.bossek@solutions4linux.de
@@ -28,6 +37,7 @@ D: 8xxrom
 N: Wolfgang Denk
 E: wd@denx.de
 D: PPCBOOT initial version
+W: www.denx.de
 
 N: Kirk Haderlie
 E: khaderlie@vividimage.com
index c0221ca87f813c1a5845ca4d1d8b24aafd89bc84..cd9b438fb009aacd81927b17cc204df7c252dff3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -24,8 +24,6 @@
 ARCH   := ppc
 CPU    := mpc8xx
 BOARD  := tqm8xx
-#XXX#KERNEL    := /home/wd/ppc/linux-2.2.13
-KERNEL :=
 
 HOSTARCH := $(shell uname -m | \
        sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
@@ -36,7 +34,7 @@ else
 CROSS_COMPILE = powerpc-linux-
 endif
 
-export ARCH CPU BOARD KERNEL CROSS_COMPILE HOSTARCH
+export ARCH CPU BOARD CROSS_COMPILE HOSTARCH
 
 SUBDIRS        = $(ARCH) $(CPU) $(BOARD) common examples tools
 
@@ -61,17 +59,11 @@ all:        ppcboot.srec
 install:       all
        cp ppcboot.srec /net/gatekeeper/tftpboot/moni.srec
 
-#ppcboot.elf:  ppcboot
-#      $(OBJCOPY) $(OBJCFLAGS) -O elf32-powerpc $< $@
-#
-#ppcboot.srec: ppcboot.elf
-#      $(OBJCOPY) -O srec $< $@
-
 ppcboot.srec:  ppcboot
        $(OBJCOPY) -O srec $< $@
 
-ppcboot:       $(SUBDIRS) $(OBJS) include/ppcboot.lds
-       $(LD) $(LDFLAGS) $(OBJS) -o ppcboot
+ppcboot:       $(SUBDIRS) $(OBJS) $(LDSCRIPT)
+       $(LD) $(LDFLAGS) $(OBJS) -Map ppcboot.map -o ppcboot
 
 $(SUBDIRS):    dummy
        @for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir || exit 1 ; done
@@ -80,13 +72,29 @@ dummy:
 
 #########################################################################
 
+TQM823L_config \
+TQM850L_config \
+TQM860L_config :
+       rm -f board cpu include/config.h
+       ln -s tqm8xx board
+       ln -s mpc8xx cpu
+       cd include ; ln -s config_$(@:_config=).h config.h
+
+FADS_config:
+       rm -f board cpu include/config.h
+       ln -s FADS board
+       ln -s mpc8xx cpu
+       cd include ; ln -s config_FADS.h  config.h
+
+#########################################################################
+
 clean:
        @for dir in $(SUBDIRS); do $(MAKE) -C $$dir clean; done
 
 clobber distclean: clean
        @for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir distclean; done
        rm -f $(OBJS) *.bak
-       rm -f ppcboot ppcboot.bin ppcboot.elf ppcboot.srec
+       rm -f ppcboot ppcboot.bin ppcboot.elf ppcboot.srec ppcboot.map
 
 backup:
        F=`basename $(TOPDIR)` ; cd .. ; \
@@ -95,7 +103,7 @@ backup:
 #########################################################################
 
 depend dep:
-       @for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir $@ ; done
+       @for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir .depend ; done
 
 #########################################################################
 
diff --git a/README b/README
index 46185856e8c7c14a02e5e129ee79cb92c6180b34..afd20c8210b2abfe433cfa6d8a5974bff07c9f02 100644 (file)
--- a/README
+++ b/README
@@ -181,6 +181,9 @@ The following options need to be configured:
 Configuration Settings:
 -----------------------
 
+- CFG_LONGHELP: Defined when you want long help messages included;
+               undefine this when you're short of memory.
+
 - CFG_PROMPT:  This is what PPCBOOT prints on the console to
                prompt for user input.
 
@@ -207,12 +210,6 @@ Configuration Settings:
 - CFG_MONITOR_LEN:
                Size of memory reserved for monitor code
 
-- CFG_HWINFO_LEN:
-               Size of Hardware Information stored with monitor
-
-- CFG_HWINFO_ADDR:
-               Physical start address of HW Information
-
 - CFG_MALLOC_LEN:
                Size of DRAM reserved for malloc() use.
 
@@ -234,6 +231,21 @@ Configuration Settings:
 - CFG_FLASH_WRITE_TOUT:
                Timeout for Flash write operations (in ms)
 
+- CFG_FLASH_ENV_ALIGN:
+                Bitshift to align envrionment data (aka NVRAM area)
+                to the beginning of the right flash sector; for
+                instance, to with bottom boot type flash chips the
+                second sector will be used; in our example
+                configuration, the offset for this sector ix 0x8000
+                or 1 << 15, thus the value to use for
+                CFG_FLASH_ENV_ALIGN is 15
+
+                I _know_ this is *UGLY*. Please tell me if you know a
+                better way to do this - wd
+
+- CFG_FLASH_ENV_SIZE:
+               Size of the flash sector(s) used for the environment
+
 
 Many of the remaining options are named exactly as the corresponding
 Linux kernel configuration options. The intention is to make it
diff --git a/TODO b/TODO
index 495c70319500e3f1e540b44dec202427a1c786f9..4f73b7fafbd78264987ec245b7a6e95e2cb1adac 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,6 +1,19 @@
-* mkimage:
+* NEW:
 
-  BUG: mkimage -d does not truncate an existing image
+  Add check that monitor still fits in area defined by CFG_MONITOR_LEN
+
+* ppc/vsprintf.c:
+
+  Eliminate asc_to_hex() - replace by simple_strtoul()
+
+* Timer:
+
+  don't use 'lr RX, const; mtdec RX" -> use:
+          mfdec R3
+  foo:    add.  R3,277000,R3 # 277,777 is base 10
+         ble   foo
+         mtdec R3
+  instead
 
 * loads:
 
 
 * saveenv:
 
-  Implement writing environment variables to Flash. Needs special
-  layout of monitor image to reserve one of the small Flash "boot"
-  sectors. Make sure we fall back to useful defaults in case somebody
-  erases the Flash contents.
-
-* INIT:
-
-  get ethernet address from environment
+  Can we create a ld script which automagically takes care about
+  flash boot sector location, so that it makes code "flow" around the
+  gap if there is one, instead of hard-coding the map - which will
+  break if sizes change?
 
 * INIT:
 
   structure containing `monitor functions'; add things like malloc()
   and free().
 
-* protect:
-
-  Bug in sector limit check:
-
-       => protect off 40000000 40008000
-       Un-Protected 35 sectors
-
 * ALL:
 
   Put `implementation' features in #ifdef's to make it possible to
   shrink monitor size to specific needs
 
-* command:
+* BUG:
+
+  Fix Exception handling for "Software Emulation Exception" etc.
 
+======================================================================
+Modifications for 0.4.2:
+======================================================================
+
+* saveenv:
+  Implement writing environment variables to Flash. Needs special
+  layout of monitor image to reserve one of the small Flash "boot"
+  sectors. Make sure we fall back to useful defaults in case somebody
+  erases the Flash contents.
+
+  Done - Thu Aug  3 2000 - wd@denx.de
+
+* INIT:
+  get ethernet address from environment
+
+  Done - Thu Aug  3 2000 - wd@denx.de
+
+* NEW:
+  Implement equivalent to TQ "sethwi" command
+  => Use "setenv serial#" and "setenv ethaddr" and "saveenv"
+
+  Done - Fri Aug  4 2000 - wd@denx.de
+
+* command:
   Make "long help" texts configurable by a #ifdef to reduce monitor
   size
+  => See CFG_LONGHELP option
 
-* bootm:
+  Done - Sun Jul 30 2000 - wd@denx.de
 
+* bootm:
   Make checksum verification of images optional (depending on
   "verify" environment variable?) to allow for fast boot is speed is
   more important than safety.
+  Done - Fri Aug  4 2000 - wd@denx.de
 
-* NEW:
+* protect:
+  Bug in sector limit check:
+       => protect off 40000000 40008000
+       Un-Protected 35 sectors
 
-  Implement equivalent to TQ "sethwi" command
+  Done - Fri Aug  4 2000 - wd@denx.de
+
+* mkimage:
+  BUG: mkimage -d does not truncate an existing image
+
+  Done - Fri Aug  4 2000 - wd@denx.de
index 91ecf6ca8ef00ec15fd70513d258c6abd0b7c2a1..6d953f6fd79ce66ac49e429d99706cd366d10667 100644 (file)
@@ -25,10 +25,12 @@ include $(TOPDIR)/config.mk
 
 LIB    = libcommon.a
 
-OBJS   = board.o main.o command.o \
+AOBJS  = environment.o
+COBJS  = board.o main.o command.o \
          cmd_cache.o cmd_mem.o cmd_boot.o cmd_flash.o \
          cmd_bootm.o cmd_nvedit.o \
          s_record.o dlmalloc.o
+OBJS   = $(AOBJS) $(COBJS)
 
 CPPFLAGS += -I..
 
@@ -41,9 +43,11 @@ clean:
 distclean:     clean
        rm -f $(LIB) core *.bak .depend
 
-.depend: Makefile $(OBJS:.o=.c)
-       $(CC) -M $(CFLAGS) $(OBJS:.o=.c) > $@
+#########################################################################
 
-depend dep: .depend
+.depend:       Makefile $(AOBJS:.o=.S) $(COBJS:.o=.c)
+               $(CC) -M $(CFLAGS) $(AOBJS:.o=.S) $(COBJS:.o=.c) > $@
 
 sinclude .depend
+
+#########################################################################
index 8db763c850fdd63a56c70c5b96fd26574c3aa153..2cb8450b6199510b1a69264d4c0b201e78fd546d 100644 (file)
@@ -78,6 +78,7 @@ board_init_f (volatile immap_t *immr, unsigned long bootflag)
     int                board_type;
     ulong      addr_moni, addr_sp;
     ulong      dram_size, cpu_speed;
+    char       *s, *e;
 
     /* SYPCR - contains watchdog control (11-9) */
 
@@ -104,7 +105,7 @@ board_init_f (volatile immap_t *immr, unsigned long bootflag)
     immr->im_clkrstk.cark_plprcrk = KAPWR_KEY;
     reg = immr->im_clkrst.car_plprcr;
     reg &= PLPRCR_MF_MSK;              /* isolate MF field     */
-    reg |= CFG_PLPRCR;         /* reset control bits   */
+    reg |= CFG_PLPRCR;                 /* reset control bits   */
     immr->im_clkrst.car_plprcr = reg;
 
     /* System integration timers. Don't change EBDF! (15-27) */
@@ -216,16 +217,27 @@ board_init_f (volatile immap_t *immr, unsigned long bootflag)
     bd->bi_immr_base   = (ulong)immr;    /* base  of IMMR register             */
     bd->bi_bootflags   = bootflag;       /* boot / reboot flag (for LynxOS)    */
 
-    bd->bi_ip_addr     = (10<<24)|99;    /* Default IP Address: 10.0.0.99      */
-    bd->bi_enetaddr[0] = 0x00;           /* Default Ethernet adress            */
-    bd->bi_enetaddr[1] = 0xD0;
-    bd->bi_enetaddr[2] = 0x93;
-    bd->bi_enetaddr[3] = 0x00;
-    bd->bi_enetaddr[4] = 0x02;
-    bd->bi_enetaddr[5] = 0x6C;
+    /* IP Address */
+    bd->bi_ip_addr = 0;
+    s = getenv ("ipaddr");
+    for (reg=0; reg<4; ++reg) {
+       ulong val = s ? simple_strtoul(s, &e, 10) : 0;
+       bd->bi_ip_addr <<= 8;
+       bd->bi_ip_addr  |= (val & 0xFF);
+       s = (*e) ? e+1 : e;
+    }
+
+    s = getenv ("ethaddr");
+    for (reg=0; reg<6; ++reg) {
+       bd->bi_enetaddr[reg] = s ? simple_strtoul(s, &e, 16) : 0;
+       s = (*e) ? e+1 : e;
+    }
     bd->bi_intfreq     = cpu_speed;            /* Internal Freq, in MHz        */
     bd->bi_busfreq     = CONFIG_8xx_BUSCLOCK;  /* Bus Freq,      in MHz        */
-    bd->bi_baudrate    = CONFIG_8xx_BAUDRATE;  /* Console Baudrate             */
+
+    /* Console Baudrate */
+    s = getenv ("baudrate");
+    bd->bi_baudrate = s ? (int)simple_strtoul(s, NULL, 10) : 9600;
 
     /* Function pointers must be added after code relocation */
 #if 0
index 1bc68ffd4ee5dd0b77a386ebfefc124ebfbe5adb..da09465a4f80bdd86f807ef044f9214d9d9cde85 100644 (file)
@@ -36,6 +36,9 @@ static int read_record (char *buf, ulong len);
 
 void do_bdinfo (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
 {
+       int i;
+       ulong ip = bd->bi_ip_addr;
+
        printf ("  memstart    = 0x%08lx\n",  bd->bi_memstart   );
        printf ("  memsize     = 0x%08lx\n",  bd->bi_memsize    );
        printf ("  flashstart  = 0x%08lx\n",  bd->bi_flashstart );
@@ -47,7 +50,16 @@ void do_bdinfo (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
        printf ("  bootflags   = 0x%08lx\n",  bd->bi_bootflags  );
        printf ("  intfreq     = %6ld MHz\n", bd->bi_intfreq    );
        printf ("  busfreq     = %6ld MHz\n", bd->bi_busfreq    );
-       printf ("  baudrate    = %6ld bps\n", bd->bi_baudrate   );
+       printf ("  ethaddr     =");
+       for (i=0; i<6; ++i) {
+               printf ("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]);
+       }
+       printf ("\n  IP addr     =");
+       for (i=0; i<4; ++i) {
+               printf ("%c%d", i ? '.' : ' ', (ip >> 24) & 0xFF);
+               ip <<= 8;
+       }
+       printf ("\n  baudrate    = %6ld bps\n", bd->bi_baudrate   );
        printf ("  getc        = 0x%08lx\n",(ulong)bd->bi_serial_io.getc);
        printf ("  tstc        = 0x%08lx\n",(ulong)bd->bi_serial_io.tstc);
        printf ("  putc        = 0x%08lx\n",(ulong)bd->bi_serial_io.putc);
index 63ee6ae2d9ce2f0101dca01821ed8d15d1d3bed6..4d7093266fb4c75ff6ec9b0648dd3c719ab0a649 100644 (file)
@@ -49,6 +49,7 @@ void do_bootm (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
        ulong   data, len, checksum;
        ulong   initrd_start, initrd_end;
        ulong   cmd_start, cmd_end;
+       int     verify;
        char    *cmdline;
        char    *name, *s;
        bd_t    *kbd;
@@ -61,6 +62,9 @@ void do_bootm (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
                return;
        }
 
+       s = getenv ("verify");
+       verify = (s && (*s == 'n')) ? 0 : 1;
+
        asc_to_hex(argv[1], &addr);
 
        printf ("## Booting Linux kernel at %08lx ...\n", addr);
@@ -89,12 +93,14 @@ void do_bootm (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
        data = addr + sizeof(image_header_t);
        len  = hdr->ih_size;
 
-       printf ("   Verifying Checksum ... ");
-       if (crc32 (0, (char *)data, len) != hdr->ih_dcrc) {
-               printf ("Bad Data CRC\n");
-               return;
+       if (verify) {
+               printf ("   Verifying Checksum ... ");
+               if (crc32 (0, (char *)data, len) != hdr->ih_dcrc) {
+                       printf ("Bad Data CRC\n");
+                       return;
+               }
+               printf ("OK\n");
        }
-       printf ("OK\n");
 
        if ((hdr->ih_os != IH_OS_LINUX) || (hdr->ih_arch != IH_CPU_PPC)) {
                printf ("Unsupported OS or Architecture\n");
@@ -222,12 +228,14 @@ void do_bootm (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
                data = addr + sizeof(image_header_t);
                len  = hdr->ih_size;
 
-               printf ("   Verifying Checksum ... ");
-               if (crc32 (0, (char *)data, len) != hdr->ih_dcrc) {
-                       printf ("Bad Data CRC\n");
-                       do_reset (cmdtp, bd, flag, argc, argv);
+               if (verify) {
+                       printf ("   Verifying Checksum ... ");
+                       if (crc32 (0, (char *)data, len) != hdr->ih_dcrc) {
+                               printf ("Bad Data CRC\n");
+                               do_reset (cmdtp, bd, flag, argc, argv);
+                       }
+                       printf ("OK\n");
                }
-               printf ("OK\n");
 
                if ((hdr->ih_os   != IH_OS_LINUX)       ||
                    (hdr->ih_arch != IH_CPU_PPC)        ||
index 4fce39fa09da8be73dfdccd88a899042e4b4e2e7..f5105be3fef4d40177051568a3bbe2ca6388c108 100644 (file)
@@ -30,6 +30,9 @@
 
 extern flash_info_t flash_info[];      /* info for FLASH chips */
 
+void flash_sect_erase (ulong addr_first, ulong addr_last);
+void flash_sect_protect (int flag, ulong addr_first, ulong addr_last);
+
 /*
  * The user interface starts numbering for Flash banks with 1. The
  * main reason is that asc_to_hex() returns 0 for invalid input, so
@@ -65,8 +68,6 @@ void do_flerase(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
 {
        flash_info_t *info;
        ulong bank, addr_first, addr_last;
-       int s_first, s_last;
-       int erased;
 
        if (argc < 2) {
                printf ("Usage:\n%s\n", cmdtp->usage);
@@ -108,6 +109,16 @@ void do_flerase(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
                return;
        }
 
+       flash_sect_erase(addr_first, addr_last);
+}
+
+void flash_sect_erase (ulong addr_first, ulong addr_last)
+{
+       flash_info_t *info;
+       ulong bank;
+       int s_first, s_last;
+       int erased;
+
        erased = 0;
 
        for (bank=0,info=&flash_info[0]; bank < CFG_MAX_FLASH_BANKS; ++bank, ++info) {
@@ -132,13 +143,9 @@ void do_flerase(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
 
                        if (addr_first == info->start[sect]) {
                                s_first = sect;
-                               if (s_last < 0)
-                                       s_last = s_end;
                        }
                        if (addr_last  == end) {
                                s_last  = sect;
-                               if (s_first < 0)
-                                       s_first = 0;
                        }
                }
                if (s_first>=0 && s_first<=s_last) {
@@ -159,8 +166,6 @@ void do_protect(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
 {
        flash_info_t *info;
        ulong bank, addr_first, addr_last;
-       int s_first, s_last;
-       int protected;
        int i;
        int p;
 
@@ -219,6 +224,16 @@ void do_protect(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
                return;
        }
 
+       flash_sect_protect (p, addr_first, addr_last);
+}
+
+void flash_sect_protect (int p, ulong addr_first, ulong addr_last)
+{
+       flash_info_t *info;
+       ulong bank;
+       int s_first, s_last;
+       int protected, i;
+
        protected = 0;
 
        for (bank=0,info=&flash_info[0]; bank < CFG_MAX_FLASH_BANKS; ++bank, ++info) {
@@ -243,13 +258,9 @@ void do_protect(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
 
                        if (addr_first == info->start[sect]) {
                                s_first = sect;
-                               if (s_last < 0)
-                                       s_last = s_end;
                        }
                        if (addr_last  == end) {
                                s_last  = sect;
-                               if (s_first < 0)
-                                       s_first = 0;
                        }
                }
                if (s_first>=0 && s_first<=s_last) {
index 9b193dde4e32e6962385555c8947faea11512321..f876cca31af54aeea4b66c5965bf1bbdf920066b 100644 (file)
 #include <command.h>
 #include <cmd_nvedit.h>
 
-/*
- * FIXME:
- *
- * XXX DUMMY IMPLEMENTATION ONLY! XXX
- */
-
 /*
  * The environment storages is simply a list of '\0'-terminated
  * "name=value" strings, the end of the list marked by a double '\0'.
  * combination of deleting the old and adding the new value.
  */
 
-#define        CFG_ENVSIZE     1024
-char environment[CFG_ENVSIZE] = {
-       "bootargs="     "root=/dev/nfs rw "
-                       "nfsroot=10.0.0.2:/LinuxPPC "
-                       "nfsaddrs=10.0.0.98:10.0.0.2"
-                       "\0"
-       "ethaddr="      "00:D0:93:00:02:6C\0"
-       "ipaddr="       "10.0.0.98\0"
-       "verify="       "y\0"
-};
+extern uchar environment[];
+extern ulong env_size;
+
+static uchar *flash_addr = environment;
 
-static char *envmatch (char *, char *);
+static uchar *envmatch (uchar *, uchar *);
+static void env_init(void);
 
-char *getenv (char *name)
+#define XMK_STR(x)     #x
+#define MK_STR(x)      XMK_STR(x)
+
+static uchar default_environment[] = {
+       "bootargs="     CONFIG_BOOTARGS                 "\0"
+       "bootcmd="      CONFIG_8xx_BOOTCOMMAND          "\0"
+#if (CONFIG_8xx_BOOTDELAY >= 0)
+       "bootdelay="    MK_STR(CONFIG_8xx_BOOTDELAY)    "\0"
+#endif
+       "baudrate="     MK_STR(CONFIG_8xx_BAUDRATE)     "\0"
+       "\0"
+};
+
+char *getenv (uchar *name)
 {
-       char *env, *nxt;
+       uchar *env, *nxt;
+
+       env_init();
 
        for (env=environment; *env; env=nxt+1) {
                char *val;
@@ -75,9 +79,11 @@ char *getenv (char *name)
 
 void do_printenv (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
 {
-       char *env, *nxt;
+       uchar *env, *nxt;
        int i;
 
+       env_init();
+
        if (argc == 1) {                /* Print all env variables      */
                for (env=environment; *env; env=nxt+1) {
                        for (nxt=env; *nxt; ++nxt)
@@ -113,9 +119,11 @@ void do_printenv (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
 void do_setenv   (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
 {
        int  i, len;
-       char *env, *nxt;
-       char *oldval = NULL;
-       char *name;
+       uchar *env, *nxt;
+       uchar *oldval = NULL;
+       uchar *name;
+
+       env_init();
 
        if (argc < 2) {
                printf ("Usage:\n%s\n", cmdtp->usage);
@@ -138,6 +146,15 @@ void do_setenv   (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
         * Delete any existing definition
         */
        if (oldval) {
+               /*
+                * Ethernet Address and serial# can be set only once
+                */
+               if ((strcmp (name, "ethaddr") == 0) ||
+                   (strcmp (name, "serial#") == 0) ) {
+                       printf ("Can't overwrite \"%s\"\n", name);
+                       return;
+               }
+
                if (*++nxt == '\0') {
                        *env = '\0';
                } else {
@@ -160,18 +177,18 @@ void do_setenv   (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
         */
        for (env=environment; *env || *(env+1); ++env)
                ;
-       ++env;
+       if (env > environment)
+               ++env;
        /*
         * Overflow when:
-        * "name" + "=" + "val" +"\0\0"  > CFG_ENVSIZE - (env-environment)
+        * "name" + "=" + "val" +"\0\0"  > env_size - (env-environment)
         */
        len = strlen(name) + 2;
        /* add '=' for first arg, ' ' for all others */
        for (i=2; i<argc; ++i) {
                len += strlen(argv[i]) + 1;
        }
-printf ("FREE: %d   NEED: %d\n", &environment[CFG_ENVSIZE]-env, len);
-       if (len > (&environment[CFG_ENVSIZE] - env)) {
+       if (len > (&environment[env_size]-env)) {
                printf ("## Error: environment overflow, \"%s\" deleted\n", name);
                return;
        }
@@ -188,9 +205,34 @@ printf ("FREE: %d   NEED: %d\n", &environment[CFG_ENVSIZE]-env, len);
        /* end is marked with double '\0' */
        *++env = '\0';
 }
+
 void do_saveenv  (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
 {
-       printf ("XXX - not yet implemented\n");
+       int rc;
+       extern void flash_sect_protect (int p, ulong addr_first, ulong addr_last);
+       extern void flash_sect_erase (ulong addr_first, ulong addr_last);
+
+       env_init();
+
+       flash_sect_protect (0, (ulong)flash_addr, (ulong)flash_addr+env_size-1);
+       
+       printf ("Erasing Flash...");
+       flash_sect_erase ((ulong)flash_addr, (ulong)flash_addr+env_size-1);
+       
+       printf ("Saving Environment to Flash...\n");
+       switch (rc = flash_write (environment, (ulong)flash_addr, env_size)) {
+       case 0: break;
+       case 1: printf ("Timeout writing to Flash\n");
+               break;
+       case 2: printf ("Flash not Erased\n");
+               break;
+       case 4: printf ("Can't write to protected Flash sectors\n");
+               break;
+       default:
+               printf ("%s[%d] FIXME: rc=%d\n",__FILE__,__LINE__,rc);
+       }
+       
+       flash_sect_protect (1, (ulong)flash_addr, (ulong)flash_addr+env_size-1);
 }
 
 /*
@@ -199,8 +241,8 @@ void do_saveenv  (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
  * If the names match, return the value of s2, else NULL.
  */
 
-static char *
-envmatch (char *s1, char *s2)
+static uchar *
+envmatch (uchar *s1, uchar *s2)
 {
 
        while (*s1 == *s2++)
@@ -210,3 +252,16 @@ envmatch (char *s1, char *s2)
                return(s2);
        return(NULL);
 }
+
+/*
+ * Prevent confusion if running from erased flash memory
+ */
+static void env_init(void)
+{
+       if (environment[0] == 0xFF) {
+               printf ("*** Warning - no Environment, using defaults\n\n");
+               memcpy (environment,
+                       default_environment,
+                       sizeof(default_environment));
+       }
+}
index bd6907b1a23b27e205cd30b7fb5add71e08bcf6b..96181ada143bfc97e9ccfa08dc8516d12a67ad60 100644 (file)
@@ -37,7 +37,7 @@
 /*
  * HELP command
  */
-#define        CMD_TBL_HELP    {                                                       \
+#define        CMD_TBL_HELP    MK_CMD_TBL_ENTRY(                                       \
        "help",         1,      CFG_MAXARGS,    do_help,                        \
        "help    - print online help\n",                                        \
        "[command ...]\n"                                                       \
        "'help' prints online help for the monitor commands.\n\n"               \
        "Without arguments, it prints a short usage message for all commands.\n\n" \
        "To get detailed help information for specific commands you can type\n" \
-       "'help' with one or more command names as arguments.\n",                \
-    }
+       "'help' with one or more command names as arguments.\n"                 \
+    )
 
-#define        CMD_TBL_QUES    {                                                       \
+#define        CMD_TBL_QUES    MK_CMD_TBL_ENTRY(                                       \
        "?",            1,      CFG_MAXARGS,    do_help,                        \
        "?       - alias for 'help'\n",                                         \
-       NULL,                                                                   \
-    }
+       NULL                                                                    \
+    )
 
-#define CMD_TBL_VERS   {                                                       \
+#define CMD_TBL_VERS   MK_CMD_TBL_ENTRY(                                       \
        "version",      4,      1,              do_version,                     \
        "version - print monitor version\n",                                    \
-       NULL,                                                                   \
-    }
+       NULL                                                                    \
+    )
 
 void
 do_version (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
@@ -93,6 +93,7 @@ do_help (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
        for (i=1; i<argc; ++i) {
                for (cmdtp=&cmd_tbl[0]; cmdtp->name; cmdtp++) {
                        if (strncmp(argv[i], cmdtp->name, cmdtp->lmin) == 0) {
+#ifdef CFG_LONGHELP
                                /* found - print (long) help info */
                                serial_putstr (cmdtp->name);
                                serial_putc   (' ');
@@ -102,6 +103,10 @@ do_help (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
                                        serial_putstr ("- No help available.\n");
                                }
                                serial_putc ('\n');
+#else  /* no long help available */
+                               if (cmdtp->usage)
+                                       serial_putstr (cmdtp->usage);
+#endif /* CFG_LONGHELP */
                                goto done;
                        }
                }
@@ -141,5 +146,5 @@ cmd_tbl_t cmd_tbl[] = {
        CMD_TBL_HELP,
        CMD_TBL_QUES,
        /* the following entry terminates this table */
-       {       NULL,   0,      0,      NULL,   NULL,   NULL,   },
+       MK_CMD_TBL_ENTRY( NULL, 0, 0, NULL, NULL, NULL ),
 };
diff --git a/common/environment.S b/common/environment.S
new file mode 100644 (file)
index 0000000..3db1276
--- /dev/null
@@ -0,0 +1,29 @@
+#include <config.h>
+
+#define XMK_STR(x)     #x
+#define MK_STR(x)      XMK_STR(x)
+
+       .text
+       .p2align CFG_FLASH_ENV_ALIGN
+       .globl  environment
+environment:
+       .ascii  "bootargs="
+       .ascii          CONFIG_BOOTARGS
+       .ascii          "\0"
+       .ascii  "bootcmd="
+       .ascii          CONFIG_8xx_BOOTCOMMAND
+       .ascii          "\0"
+#if (CONFIG_8xx_BOOTDELAY >= 0)
+       .ascii  "bootdelay="
+       .ascii          MK_STR(CONFIG_8xx_BOOTDELAY)
+       .ascii          "\0"
+#endif
+       .ascii  "baudrate="
+       .ascii          MK_STR(CONFIG_8xx_BAUDRATE)
+       .ascii          "\0"
+       .ascii  "\0"
+       . = environment + CFG_FLASH_ENV_SIZE
+.L_end:
+       .globl  env_size
+env_size:
+       .long   .L_end - environment
index 1bbf75552ec27e84a818abdb49821e7b58c8359b..14514c02da76d5f6cc5fbd4212f92ff89394c8e2 100644 (file)
@@ -43,7 +43,8 @@ void main_loop(bd_t *bd)
 {
        cmd_tbl_t *cmdtp;
 #if (CONFIG_8xx_BOOTDELAY >= 0)
-       int bootdelay = CONFIG_8xx_BOOTDELAY;
+       char *s = getenv ("bootdelay");
+       int bootdelay = s ? (int)simple_strtoul(s, NULL, 10) : 0;
        int autoboot  = 1;
 
 #endif /* CONFIG_8xx_BOOTDELAY */
@@ -90,8 +91,9 @@ void main_loop(bd_t *bd)
                serial_putc ('\n');
 
                if (autoboot) {
+                       s = getenv("bootcmd");
                        strncpy (console_buffer,
-                                CONFIG_8xx_BOOTCOMMAND,
+                                s ? s : "",
                                 CFG_CBSIZE-1);
                        console_buffer[CFG_CBSIZE-1] = '\0';    /* just in case */
                        len = strlen (console_buffer);
index de5758bb8950704f694a06de381405574b06dd79..357405adbe92c0da7c2710b78b828052731094b8 100644 (file)
--- a/config.mk
+++ b/config.mk
@@ -27,8 +27,6 @@ CONFIG_SHELL  := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
                    else if [ -x /bin/bash ]; then echo /bin/bash; \
                    else echo sh; fi ; fi)
 
-#XXX#HPATH             = $(KERNEL)/include
-#XXX#CDKHPATH  = /LinuxPPC/CDK/lib/gcc-lib/powerpc-linux/2.95.2/include
 CDK_DIR                = /LinuxPPC/CDK
 CDKHEADERS     = -I$(CDK_DIR)/include \
                  -I$(CDK_DIR)/lib/gcc-lib/powerpc-linux/2.95.2/include
@@ -53,8 +51,10 @@ RANLIB       = $(CROSS_COMPILE)RANLIB
 MAKEDEPEND = makedepend -Y
 
 RELFLAGS= -mrelocatable -ffixed-r14
-DBGFLAGS= -g -DDEBUG
-OPTFLAGS= #-O2
+DBGFLAGS= #-g -DDEBUG
+OPTFLAGS= -O2
+#LDSCRIPT := $(BOARD)/ppcboot.lds.debug
+LDSCRIPT := $(BOARD)/ppcboot.lds
 
 CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS)        \
        -D__KERNEL__ -D__powerpc__ -DCONFIG_8xx \
@@ -68,7 +68,7 @@ CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS)       \
 CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -fomit-frame-pointer
 AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS)
 
-LDFLAGS += -Bstatic -T include/ppcboot.lds -Ttext $(TEXT_BASE)
+LDFLAGS += -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE)
 
 OBJCFLAGS = --remove-section=.stab                     \
        --remove-section=.comment                       \
index 1d61cee71baa09852b5b6e24c5a05b937bb4ea49..773b7040c7ab45d046744c31176bf1998e1f5c96 100644 (file)
@@ -47,9 +47,9 @@ distclean:    clean
 
 #########################################################################
 
-.depend: Makefile $(OBJS:.o=.c)
-       $(CC) -M $(CFLAGS) $(OBJS:.o=.c) > $@
-
-depend dep: .depend
+.depend:       Makefile $(OBJS:.o=.c)
+               $(CC) -M $(CFLAGS) $(OBJS:.o=.c) > $@
 
 sinclude .depend
+
+#########################################################################
index 0223fe275d42874ac5d0327e80283131bd1a628f..47216149550366990a903c8910a5aad90ee82f3b 100644 (file)
@@ -96,19 +96,21 @@ typedef struct      mem_ctlr {
 */
 typedef struct sys_int_timers {
        ushort  sit_tbscr;
+       char    res0[0x02];
        uint    sit_tbreff0;
        uint    sit_tbreff1;
        char    res1[0x14];
        ushort  sit_rtcsc;
+       char    res2[0x02];
        uint    sit_rtc;
        uint    sit_rtsec;
        uint    sit_rtcal;
-       char    res2[0x10];
+       char    res3[0x10];
        ushort  sit_piscr;
-       char    res3[2];
+       char    res4[2];
        uint    sit_pitc;
        uint    sit_pitr;
-       char    res4[0x34];
+       char    res5[0x34];
 } sit8xx_t;
 
 #define TBSCR_TBIRQ_MASK       ((ushort)0xff00)
@@ -174,20 +176,38 @@ typedef struct cark {
 */
 #define KAPWR_KEY      ((unsigned int)0x55ccaa33)
 
-/* LCD interface.  MPC821 Only.
+/* Video interface.  MPC823 Only.
+*/
+typedef struct vid823 {
+       ushort  vid_vccr;
+       ushort  res1;
+       u_char  vid_vsr;
+       u_char  res2;
+       u_char  vid_vcmr;
+       u_char  res3;
+       uint    vid_vbcb;
+       uint    res4;
+       uint    vid_vfcr0;
+       uint    vid_vfaa0;
+       uint    vid_vfba0;
+       uint    vid_vfcr1;
+       uint    vid_vfaa1;
+       uint    vid_vfba1;
+       u_char  res5[0x18];
+} vid823_t;
+
+/* LCD interface.  823 Only.
 */
 typedef struct lcd {
-       ushort  lcd_lcolr[16];
-       char    res[0x20];
        uint    lcd_lccr;
        uint    lcd_lchcr;
        uint    lcd_lcvcr;
-       char    res2[4];
+       char    res1[4];
        uint    lcd_lcfaa;
        uint    lcd_lcfba;
        char    lcd_lcsr;
-       char    res3[0x7];
-} lcd8xx_t;
+       char    res2[0x7];
+} lcd823_t;
 
 /* I2C
 */
@@ -349,22 +369,30 @@ typedef struct fec {
        uint    res9[0x1e];
 } fec_t;
 
+/* The FEC and LCD color map share the same address space....
+ * I guess we will never see an 823T :-).
+ */
+union fec_lcd {
+       fec_t   fl_un_fec;
+       u_char  fl_un_cmap[0x200];
+};
+
 typedef struct comm_proc {
        /* General control and status registers.
        */
        ushort  cp_cpcr;
-       char    res1[2];
+       u_char  res1[2];
        ushort  cp_rccr;
-       char    res2[6];
+       u_char  res2[6];
        ushort  cp_cpmcr1;
        ushort  cp_cpmcr2;
        ushort  cp_cpmcr3;
        ushort  cp_cpmcr4;
-       char    res3[2];
+       u_char  res3[2];
        ushort  cp_rter;
-       char    res4[2];
+       u_char  res4[2];
        ushort  cp_rtmr;
-       char    res5[0x14];
+       u_char  res5[0x14];
 
        /* Baud rate generators.
        */
@@ -384,52 +412,59 @@ typedef struct comm_proc {
        /* Serial Peripheral Interface.
        */
        ushort  cp_spmode;
-       char    res6[4];
+       u_char  res6[4];
        u_char  cp_spie;
-       char    res7[3];
+       u_char  res7[3];
        u_char  cp_spim;
-       char    res8[2];
+       u_char  res8[2];
        u_char  cp_spcom;
-       char    res9[2];
+       u_char  res9[2];
 
        /* Parallel Interface Port.
        */
-       char    res10[2];
+       u_char  res10[2];
        ushort  cp_pipc;
-       char    res11[2];
+       u_char  res11[2];
        ushort  cp_ptpr;
        uint    cp_pbdir;
        uint    cp_pbpar;
-       char    res12[2];
+       u_char  res12[2];
        ushort  cp_pbodr;
        uint    cp_pbdat;
-       char    res13[0x18];
+       u_char  res13[0x18];
 
        /* Serial Interface and Time Slot Assignment.
        */
        uint    cp_simode;
        u_char  cp_sigmr;
-       char    res14;
+       u_char  res14;
        u_char  cp_sistr;
        u_char  cp_sicmr;
-       char    res15[4];
+       u_char  res15[4];
        uint    cp_sicr;
        uint    cp_sirp;
-       char    res16[0x10c];
+       u_char  res16[0xc];
+
+       /* 256 bytes of MPC823 video controller RAM array.
+       */
+       u_char  cp_vcram[0x100];
        u_char  cp_siram[0x200];
 
        /* The fast ethernet controller is not really part of the CPM,
         * but it resides in the address space.
+        * The LCD color map is also here.
         */
-       fec_t   cp_fec;
+       union   fec_lcd fl_un;
+#define cp_fec         fl_un.fl_un_fec
+#define lcd_cmap       fl_un.fl_un_cmap
        char    res18[0x1000];
 
        /* Dual Ported RAM follows.
         * There are many different formats for this memory area
         * depending upon the devices used and options chosen.
+        * Some processors don't have all of it populated.
         */
-       u_char  cp_dpmem[0x1000];       /* BD / Data / ucode */
-       u_char  res19[0xc00];
+       u_char  cp_dpmem[0x1C00];       /* BD / Data / ucode */
        u_char  cp_dparam[0x400];       /* Parameter RAM */
 } cpm8xx_t;
 
@@ -443,7 +478,8 @@ typedef struct immap {
        car8xx_t        im_clkrst;      /* Clocks and reset */
        sitk8xx_t       im_sitk;        /* Sys int timer keys */
        cark8xx_t       im_clkrstk;     /* Clocks and reset keys */
-       lcd8xx_t        im_lcd;         /* LCD (821 only) */
+       vid823_t        im_vid;         /* Video (823 only) */
+       lcd823_t        im_lcd;         /* LCD (823 only) */
        i2c8xx_t        im_i2c;         /* I2C control/status */
        sdma8xx_t       im_sdma;        /* SDMA control/status */
        cpic8xx_t       im_cpic;        /* CPM Interrupt Controller */
index 5fd8e1ac2a99b13250acd844222eb00408923af3..359e5c403aba6a8424c4637d3ed64c98c3476e2d 100644 (file)
 #ifndef        _CMD_BOOT_H
 #define        _CMD_BOOT_H
 
-#define        CMD_TBL_BDINFO  {                                                       \
+#define        CMD_TBL_BDINFO  MK_CMD_TBL_ENTRY(                                       \
        "bdinfo",       2,      1,      do_bdinfo,                              \
        "bdinfo  - print Board Info structure\n",                               \
-       NULL,                                                                   \
-}
+       NULL                                                                    \
+)
 
 void do_bdinfo (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]);
 
-#define CMD_TBL_GO     {                                                       \
+#define CMD_TBL_GO     MK_CMD_TBL_ENTRY(                                       \
        "go",           2,      CFG_MAXARGS,    do_go,                          \
        "go      - start application at address 'addr'\n",                      \
        "addr [arg ...]\n    - start application at address 'addr'\n"           \
-       "      passing 'arg' as arguments\n",                                   \
-}
+       "      passing 'arg' as arguments\n"                                    \
+)
 
 void do_go (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]);
 
-#define        CMD_TBL_LOADS   {                                                       \
+#define        CMD_TBL_LOADS   MK_CMD_TBL_ENTRY(                                       \
        "loads",        5,      2,      do_load_serial,                         \
        "loads   - load S-Record file over serial line\n",                      \
        "[ off ]\n"                                                             \
-       "    - load S-Record file over serial line with offset 'off'\n",        \
-}
+       "    - load S-Record file over serial line with offset 'off'\n"         \
+)
 
 void do_load_serial (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]);
 
-#define CMD_TBL_RESET  {                                                       \
+#define CMD_TBL_RESET  MK_CMD_TBL_ENTRY(                                       \
        "reset",        5,      1,      do_reset,                               \
-       "reset   - Perform RESET of the CPU\n",                         \
-       NULL,                                                                   \
-}
+       "reset   - Perform RESET of the CPU\n",                                 \
+       NULL                                                                    \
+)
 
 void do_reset (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]);
 
index a6127ad86db74c46553591c01e760c9750b7ba7f..e0532c7dfdae7666a6bff1013c3f21934b449de9 100644 (file)
 
 void do_bootm (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]);
 
-#define        CMD_TBL_BOOTM   {                                                       \
+#define        CMD_TBL_BOOTM   MK_CMD_TBL_ENTRY(                                       \
        "bootm",        3,      CFG_MAXARGS,    do_bootm,                       \
        "bootm   - boot application image from memory\n",                       \
        "addr [arg ...]\n    - boot application image stored in memory\n"       \
        "        passing arguments 'arg ...'; when booting a Linux kernel,\n"   \
-       "        'arg' can be the address of an initrd image\n",                \
-}
+       "        'arg' can be the address of an initrd image\n"                 \
+)
 
 void do_iminfo (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]);
 
-#define        CMD_TBL_IMINFO  {                                                       \
+#define        CMD_TBL_IMINFO  MK_CMD_TBL_ENTRY(                                       \
        "iminfo",       3,      CFG_MAXARGS,    do_iminfo,                      \
        "iminfo  - print header information for application image\n",           \
        "addr [addr ...]\n"                                                     \
        "    - print header information for application image starting at\n"    \
        "      address 'addr' in memory; this includes verification of the\n"   \
-       "      image contents (magic number, header and payload checksums)\n",  \
-}
+       "      image contents (magic number, header and payload checksums)\n"   \
+)
 
 #endif /* _CMD_BOOTM_H */
index e33e7ec8b84d29ae31478508a0a38dc2b573e12a..0b2879d1285d22c1a8ae05c5777a84306d2a9c65 100644 (file)
 #ifndef        _CMD_CACHE_H
 #define        _CMD_CACHE_H
 
-#define        CMD_TBL_ICACHE  {                                                       \
+#define        CMD_TBL_ICACHE  MK_CMD_TBL_ENTRY(                                       \
        "icache",       2,      2,      do_icache,                              \
        "icache  - enable or disable instruction cache\n",                      \
        "[on, off]\n"                                                           \
-       "    - enable or disable instruction cache\n",                          \
-}
+       "    - enable or disable instruction cache\n"                           \
+)
 
-#define CMD_TBL_DCACHE {                                                       \
+#define CMD_TBL_DCACHE MK_CMD_TBL_ENTRY(                                       \
        "dcache",       2,      2,      do_dcache,                              \
        "dcache  - enable or disable data cache\n",                             \
        "[on, off]\n"                                                           \
-       "    - enable or disable data (writethrough) cache\n",                  \
-}
+       "    - enable or disable data (writethrough) cache\n"                   \
+)
 
 void do_icache (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]);
 void do_dcache (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]);
index 8be6c38db402ac29e2c6ee46281f6b68176aeeeb..b937243badee1dcbab2f5957a23630bda588d1cb 100644 (file)
 #ifndef        _CMD_FLASH_H
 #define        _CMD_FLASH_H
 
-#define        CMD_TBL_FLINFO  {                                                       \
+#define        CMD_TBL_FLINFO  MK_CMD_TBL_ENTRY(                                       \
        "flinfo",       3,      2,      do_flinfo,                              \
        "flinfo  - print FLASH memory information\n",                           \
        "\n    - print information for all FLASH memory banks\n"                \
-       "flinfo N\n    - print information for FLASH memory bank # N\n",        \
-}
+       "flinfo N\n    - print information for FLASH memory bank # N\n"         \
+)
 
-#define        CMD_TBL_FLERASE {                                                       \
+#define        CMD_TBL_FLERASE MK_CMD_TBL_ENTRY(                                       \
        "erase",        3,      3,      do_flerase,                             \
        "erase   - erase FLASH memory\n",                                       \
        "start end\n"                                                           \
        "    - erase FLASH from addr 'start' to addr 'end'\n"                   \
        "erase bank N\n    - erase FLASH bank # N\n"                            \
-       "erase all\n    - erase all FLASH banks\n",                             \
-}
+       "erase all\n    - erase all FLASH banks\n"                              \
+)
 
-#define        CMD_TBL_PROTECT {                                                       \
+#define        CMD_TBL_PROTECT MK_CMD_TBL_ENTRY(                                       \
        "protect",      4,      4,      do_protect,                             \
        "protect - enable or disable FLASH write protection\n",                 \
        "on  start end\n"                                                       \
@@ -53,8 +53,8 @@
        "protect off start end\n"                                               \
        "    - make FLASH from addr 'start' to addr 'end' writable\n"           \
        "protect off bank N\n    - make FLASH bank # N writable\n"              \
-       "protect off all\n    - make all FLASH banks writable\n",               \
-}
+       "protect off all\n    - make all FLASH banks writable\n"                \
+)
 
 void do_flinfo (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]);
 void do_flerase(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]);
index 8bf916d116381bcd10a171351234e4e27651ef94..4f8756e6a490e71ea2dc6ad5dc7e0d6ca6915a25 100644 (file)
 #ifndef        _CMD_MEM_H
 #define _CMD_MEM_H
 
-#define CMD_TBL_MD     {                                                       \
+#define CMD_TBL_MD     MK_CMD_TBL_ENTRY(                                       \
        "md",           2,      3,      do_mem_md,                              \
        "md      - memory display\n",                                           \
-       "[.b, .w, .l] address [# of objects]\n    - memory display\n",          \
-}
-#define CMD_TBL_MM     {                                                       \
+       "[.b, .w, .l] address [# of objects]\n    - memory display\n"           \
+)
+#define CMD_TBL_MM     MK_CMD_TBL_ENTRY(                                       \
        "mm",           2,      2,      do_mem_mm,                              \
        "mm      - memory modify (auto-incrementing)\n",                        \
        "[.b, .w, .l] address\n"                                                \
-       "    - memory modify, auto increment address\n",                        \
-}
-#define CMD_TBL_NM     {                                                       \
+       "    - memory modify, auto increment address\n"                         \
+)
+#define CMD_TBL_NM     MK_CMD_TBL_ENTRY(                                       \
        "nm",           2,      2,      do_mem_nm,                              \
        "nm      - memory modify (constant address)\n",                         \
-       "[.b, .w, .l] address\n    - memory modify, read and keep address\n",   \
-}
-#define CMD_TBL_MW     {                                                       \
+       "[.b, .w, .l] address\n    - memory modify, read and keep address\n"    \
+)
+#define CMD_TBL_MW     MK_CMD_TBL_ENTRY(                                       \
        "mw",           2,      4,      do_mem_mw,                              \
        "mw      - memory write (fill)\n",                                      \
-       "[.b, .w, .l] address value [count]\n    - write memory\n",             \
-}
-#define        CMD_TBL_CP      {                                                       \
+       "[.b, .w, .l] address value [count]\n    - write memory\n"              \
+)
+#define        CMD_TBL_CP      MK_CMD_TBL_ENTRY(                                       \
        "cp",           2,      4,      do_mem_cp,                              \
        "cp      - memory copy\n",                                              \
-       "[.b, .w, .l] source target count\n    - copy memory\n",                \
-}
-#define        CMD_TBL_CRC     {                                                       \
+       "[.b, .w, .l] source target count\n    - copy memory\n"                 \
+)
+#define        CMD_TBL_CRC     MK_CMD_TBL_ENTRY(                                       \
        "crc32",        3,      4,      do_mem_crc,                             \
        "crc32   - checksum calculation\n",                                     \
-       "address count\n    - compute CRC32 checksum\n",                        \
-}
-#define CMD_TBL_BASE   {                                                       \
+       "address count\n    - compute CRC32 checksum\n"                         \
+)
+#define CMD_TBL_BASE   MK_CMD_TBL_ENTRY(                                       \
        "base",         2,      2,      do_mem_base,                            \
        "base    - print or set address offset\n",                              \
        "\n    - print address offset fpr memory commands\n"                    \
-       "base off\n    - set address offset for memory commands to 'off'\n",    \
-}
+       "base off\n    - set address offset for memory commands to 'off'\n"     \
+)
 /*
  * Require full name for "loop" and "mtest" because these are infinite loops!
  */
-#define CMD_TBL_LOOP   {                                                       \
+#define CMD_TBL_LOOP   MK_CMD_TBL_ENTRY(                                       \
        "loop",         4,      3,      do_mem_loop,                            \
        "loop    - infinite loop on address range\n",                           \
        "[.b, .w, .l] address number_of_objects\n"                              \
-       "    - loop on a set of addresses\n",                                   \
-}
-#define CMD_TBL_MTEST  {                                                       \
+       "    - loop on a set of addresses\n"                                    \
+)
+#define CMD_TBL_MTEST  MK_CMD_TBL_ENTRY(                                       \
        "mtest",        5,      1,      do_mem_mtest,                           \
        "mtest   - simple RAM test\n",                                          \
-       "\n    - simple SDRAM read/write test\n",                                       \
-}
+       "\n    - simple SDRAM read/write test\n"                                \
+)
 
 void do_mem_md    (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]);
 void do_mem_mm    (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]);
index 2b37eaa490df1aa65abfa23486f3ded65fb2e5b1..5a0099ca2c803e63981738364bddd8443091888c 100644 (file)
 #ifndef        _CMD_NVEDIT_H
 #define        _CMD_NVEDIT_H
 
-#define        CMD_TBL_PRINTENV        {                                               \
+#define        CMD_TBL_PRINTENV        MK_CMD_TBL_ENTRY(                               \
        "printenv",     8,      CFG_MAXARGS,    do_printenv,                    \
        "printenv- print environment variables\n",                              \
        "\n    - print values of all environment variables\n"                   \
        "printenv name ...\n"                                                   \
-       "    - print value of environment variable 'name'\n",                   \
-}
+       "    - print value of environment variable 'name'\n"                    \
+)
 
-#define CMD_TBL_SETENV         {                                               \
+#define CMD_TBL_SETENV         MK_CMD_TBL_ENTRY(                               \
        "setenv",       6,      CFG_MAXARGS,    do_setenv,                      \
        "setenv  - set environment variables\n",                                \
        "name value ...\n"                                                      \
        "    - set environment variable 'name' to 'value ...'\n"                \
        "setenv name\n"                                                         \
-       "    - delete environment variable 'name'\n",                           \
-}
+       "    - delete environment variable 'name'\n"                            \
+)
 
-#define        CMD_TBL_SAVEENV         {                                               \
+#define        CMD_TBL_SAVEENV         MK_CMD_TBL_ENTRY(                               \
        "saveenv",      4,      1,              do_saveenv,                     \
        "saveenv - save environment variables to persistent storage\n",         \
-       NULL,                                                                   \
-}
+       NULL                                                                    \
+)
 
 void do_printenv (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]);
 void do_setenv   (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]);
index 311d9d5e271ecc1a1426b755be55e8e102e9ed53..9ef4229867af740399a21586273637243834e074 100644 (file)
@@ -42,13 +42,25 @@ struct cmd_tbl_s {
                                        /* Implementation function      */
        void            (*cmd)(struct cmd_tbl_s *, bd_t *, int, int, char *[]);
        char            *usage;         /* Usage message        (short) */
+#ifdef CFG_LONGHELP
        char            *help;          /* Help  message        (long)  */
+#endif
 };
 
 typedef struct cmd_tbl_s       cmd_tbl_t;
 
 extern cmd_tbl_t cmd_tbl[];
 
+#ifdef CFG_LONGHELP
+#define        MK_CMD_TBL_ENTRY(name,lmin,maxargs,cmd,usage,help)      \
+                               { name, lmin, maxargs, cmd, usage, help }
+#else  /* no help info */
+#define        MK_CMD_TBL_ENTRY(name,lmin,maxargs,cmd,usage,help)      \
+                               { name, lmin, maxargs, cmd, usage }
+#endif
+
+
+
 /*
  * Monitor Command
  *
index 1fefb30cffcbb9b9941a8e6c5a53186fd9f83fe9..de630f38b9e9709a24a61f4730edbd0f7d842c10 100644 (file)
 #else
 #define CONFIG_8xx_BOOTDELAY   5       /* autoboot after 5 seconds     */
 #endif
-#define CONFIG_8xx_BOOTCOMMAND "help"  /* autoboot command             */
+#define CONFIG_8xx_BOOTCOMMAND "bootm 40020000" /* autoboot command    */
+
+#define CONFIG_BOOTARGS                "root=/dev/nfs rw "                     \
+                               "nfsroot=10.0.0.2:/LinuxPPC "           \
+                               "nfsaddrs=10.0.0.99:10.0.0.2"
 
 #define CONFIG_DRAM_SPEED      (CONFIG_8xx_BUSCLOCK)   /* MHz          */
 
 /*
  * 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 */
@@ -80,8 +85,6 @@
 #define        CFG_SDRAM_BASE          0x00000000
 #define CFG_FLASH_BASE         0x40000000
 #define        CFG_MONITOR_LEN         (128 << 10)     /* Reserve 128 kB for Monitor   */
-#define CFG_HWINFO_LEN         0x0040          /* Length of HW Info Data       */
-#define CFG_HWINFO_ADDR  (CFG_FLASH_BASE + CFG_MONITOR_LEN - CFG_HWINFO_LEN)
 #define        CFG_MALLOC_LEN          (128 << 10)     /* Reserve 128 kB for malloc()  */
 
 /*
 #define CFG_FLASH_ERASE_TOUT   120000  /* Timeout for Flash Erase (in ms)      */
 #define CFG_FLASH_WRITE_TOUT   500     /* Timeout for Flash Write (in ms)      */
 
+#define        CFG_FLASH_ENV_ALIGN     15      /*  Bitshift for Environment Sector     */
+#define        CFG_FLASH_ENV_SIZE      0x4000  /* Total Size of Environment Sector     */
 /*-----------------------------------------------------------------------
  * Cache Configuration
  */
                         SCCR_DFNL000 | SCCR_DFNH000  | SCCR_DFLCD000 | \
                         SCCR_DFALCD00)
 
+/*-----------------------------------------------------------------------
+ * PCMCIA stuff
+ *-----------------------------------------------------------------------
+ *
+ */
+#define CFG_PCMCIA_MEM_ADDR    (0xE0000000)
+#define CFG_PCMCIA_MEM_SIZE    ( 64 << 20 )
+#define CFG_PCMCIA_DMA_ADDR    (0xE4000000)
+#define CFG_PCMCIA_DMA_SIZE    ( 64 << 20 )
+#define CFG_PCMCIA_ATTRB_ADDR  (0xE8000000)
+#define CFG_PCMCIA_ATTRB_SIZE  ( 64 << 20 )
+#define CFG_PCMCIA_IO_ADDR     (0xEC000000)
+#define CFG_PCMCIA_IO_SIZE     ( 64 << 20 )
+
+#define CFG_PCMCIA_INTERRUPT   SIU_LEVEL6
+
 /*-----------------------------------------------------------------------
  * 
  *-----------------------------------------------------------------------
index 976deae055977cbf4e7c560f47302cc2d53cb0d6..05918b3ddfad3c7ad586164728b1c605fc33a934 100644 (file)
 #define TMR_GE                  0x0001  /* Gate Enable                         */
 
 
+/*-----------------------------------------------------------------------
+ * PCMCIA Interface General Control Register                           17-12
+ */
+#define        PCMCIA_GCRX_CXRESET     0x00000040
+#define PCMCIA_GCRX_CXOE       0x00000080
+
+#define PCMCIA_VS1(slot)       (0x80000000 >> (slot << 4))
+#define PCMCIA_VS2(slot)       (0x40000000 >> (slot << 4))
+#define PCMCIA_VS_MASK(slot)   (0xc0000000 >> (slot << 4))
+#define PCMCIA_VS_SHIFT(slot)  (30 - (slot << 4))
+
+#define PCMCIA_WP(slot)                (0x20000000 >> (slot << 4))
+#define PCMCIA_CD2(slot)       (0x10000000 >> (slot << 4))
+#define PCMCIA_CD1(slot)       (0x08000000 >> (slot << 4))
+#define PCMCIA_BVD2(slot)      (0x04000000 >> (slot << 4))
+#define PCMCIA_BVD1(slot)      (0x02000000 >> (slot << 4))
+#define PCMCIA_RDY(slot)       (0x01000000 >> (slot << 4))
+#define PCMCIA_RDY_L(slot)     (0x00800000 >> (slot << 4))
+#define PCMCIA_RDY_H(slot)     (0x00400000 >> (slot << 4))
+#define PCMCIA_RDY_R(slot)     (0x00200000 >> (slot << 4))
+#define PCMCIA_RDY_F(slot)     (0x00100000 >> (slot << 4))
+#define PCMCIA_MASK(slot)      (0xFFFF0000 >> (slot << 4))
+
+
 
 #define UPMA   0x00000000
 #define UPMB   0x00800000
index 46692e72e1f968356ebd25b485aa55c7da03fc37..aee520e595466d029314691ce682ddc94c505ef9 100644 (file)
@@ -111,7 +111,7 @@ int checkdram     (void);
 int    testdram      (void);
 
 /* common/cmd_nvedit.c */
-char *getenv (char *);
+char *getenv (uchar *);
 
 /* board/flash.c */
 ulong flash_get_size (vu_long *addr, flash_info_t *info);
@@ -168,6 +168,8 @@ int disable_interrupts (void);
 /* mpc8xx/traps.c */
 
 /* ppc/vsprintf.c */
+unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base);
+long simple_strtol(const char *cp,char **endp,unsigned int base);
 unsigned int asc_to_hex(char *cp, ulong *val);
 void printf(const char *fmt, ...);
 void panic(const char *fmt, ...);
index 63b70e6b04e2b5dde139605dfe5a13532fa84864..46e730b9fb0639c5e4051972db4c7e3677f77308 100644 (file)
@@ -24,6 +24,6 @@
 #ifndef        __VERSION_H__
 #define        __VERSION_H__
 
-#define        PPCBOOT_VERSION "ppcboot 0.4.1"
+#define        PPCBOOT_VERSION "ppcboot 0.4.2"
 
 #endif /* __VERSION_H__ */
index 71b052584f3d41d050dd3f071c744b2294b44bc4..6f7abba92d801959375500aad459461e934447be 100644 (file)
@@ -23,9 +23,7 @@
 
 include $(TOPDIR)/config.mk
 
-DIR    := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
-NAME   = $(shell basename $(DIR))
-LIB    = lib$(NAME).a
+LIB    = lib$(CPU).a
 
 START  = start.o
 OBJS   = traps.o serial.o cpu.o speed.o interrupts.o
@@ -41,9 +39,11 @@ clean:
 distclean:     clean
        rm -f $(LIB) core *.bak .depend
 
-.depend: Makefile $(START:.o=.S) $(OBJS:.o=.c)
-       $(CC) -M $(CFLAGS) $(START:.o=.S) $(OBJS:.o=.c) > $@
+#########################################################################
 
-depend dep: .depend
+.depend:       Makefile $(START:.o=.S) $(OBJS:.o=.c)
+               $(CC) -M $(CFLAGS) $(START:.o=.S) $(OBJS:.o=.c) > $@
 
 sinclude .depend
+
+#########################################################################
index bdbad05d57dc4eace367ef0cef9e2f61359cd41b..732901b1b64df7211d1d68c7cdfe0b13e6186676 100644 (file)
@@ -119,6 +119,7 @@ static int check_CPU(long clock, uint pvr, uint immr)
   case 0x20020001 : printf("PPC823ZTnnZ3");    break;
   case 0x21000000 : printf("PPC823ZTnnA");     break;
   case 0x21010000 : printf("PPC823ZTnnB");     m=1; break;
+  case 0x21010001 : printf("PPC823ZTnnB2");    m=1; break;
   /* MPC823E */
   case 0x24010000 : printf("PPC823EZTnnB2");   m=1; break;
 
index c1b9ae952bffec70b7ad9345ee018974d005dd2c..8d68c277c741078b9697a2af7e5f80d7a0a9f55a 100644 (file)
@@ -104,8 +104,7 @@ interrupt_init (bd_t *bd)
 
        cpm_interrupt_init();
 
-       ((immap_t *)CFG_IMMR)->im_siu_conf.sc_simask |=
-               (1 << (31-CPM_INTERRUPT));
+       ((immap_t *)CFG_IMMR)->im_siu_conf.sc_simask |= (1 << (31-CPM_INTERRUPT));
 
        set_dec (decrementer_count);
 
index ad8ff2909385b39265c126da0607315b0967d530..fe84396c8d7ca78f99be58d46f962455653fab43 100644 (file)
@@ -57,6 +57,8 @@ serial_init()
        volatile cpm8xx_t *cp = &(im->im_cpm);
        volatile iop8xx_t *ip = (iop8xx_t *)&(im->im_ioport);
        uint    dpaddr;
+       char    *s = getenv ("baudrate");
+       int     baudrate = s ? (int)simple_strtoul(s, NULL, 10) : 9600;
 
        /* initialize pointers to SMC */
 
@@ -147,7 +149,7 @@ serial_init()
 #else
        cp->cp_brgc2 =                  /* Console on SMC2 */
 #endif
-               (((((CONFIG_8xx_CPUCLOCK * 1000000)/16) / CONFIG_8xx_BAUDRATE)-1) << 1)
+               (((((CONFIG_8xx_CPUCLOCK * 1000000)/16) / baudrate)-1) << 1)
                | CPM_BRG_EN;
 
        /* Make the first buffer the only buffer.
index 489cd0b180965e9b3d5bfca2d1f57455a08c61b0..f9d79e2955ad6dd2ffb64db0b473c9f4c21c4d3d 100644 (file)
@@ -23,9 +23,7 @@
 
 include $(TOPDIR)/config.mk
 
-DIR    := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
-NAME   = $(shell basename $(DIR))
-LIB    = lib$(NAME).a
+LIB    = lib$(ARCH).a
 
 AOBJS  = ppcstring.o
 COBJS  = ctype.o vsprintf.o extable.o string.o \
@@ -41,9 +39,11 @@ clean:
 distclean:     clean
        rm -f $(LIB) core *.bak .depend
 
-.depend: Makefile $(AOBJS:.o=.S) $(COBJS:.o=.c)
-       $(CC) -M $(CFLAGS) $(AOBJS:.o=.S) $(COBJS:.o=.c) > $@
+#########################################################################
 
-depend dep: .depend
+.depend:       Makefile $(AOBJS:.o=.S) $(COBJS:.o=.c)
+               $(CC) -M $(CFLAGS) $(AOBJS:.o=.S) $(COBJS:.o=.c) > $@
 
 sinclude .depend
+
+#########################################################################
index 666a6514feb83ae01d632803f0fd368095869c21..b93e7981cd400530e53e8f1f9e85c905be6249ed 100644 (file)
@@ -55,9 +55,11 @@ clean:
 distclean:     clean
        rm -f $(BINS) core *.bak .depend
 
-.depend: Makefile $(OBJS:.o=.c)
-       $(CC) -M $(CPPFLAGS) -I../include $(OBJS:.o=.c) > $@
+#########################################################################
 
-depend dep: .depend
+.depend:       Makefile $(OBJS:.o=.c)
+               $(CC) -M $(CPPFLAGS) -I../include $(OBJS:.o=.c) > $@
 
 sinclude .depend
+
+#########################################################################
index 39d0bf4671cf705ec2d56f9ba78b60aa9bb24b0d..7a11fd0f751b067dad75d241876d77898707218b 100644 (file)
@@ -4,8 +4,8 @@
  * Wolfgang Denk, wd@denx.de
  * All rights reserved.
  *     
- * $Date: 2000/07/18 08:54:27 $
- * $Revision: 1.1 $
+ * $Date: 2000/08/04 12:04:10 $
+ * $Revision: 1.2 $
  */
 
 #include <errno.h>
@@ -205,7 +205,7 @@ NXTARG:             ;
 
        imagefile = *argv;
 
-       if ((ifd = open(imagefile, lflag ? O_RDONLY : O_WRONLY | O_CREAT)) < 0) {
+       if ((ifd=open(imagefile,lflag ? O_RDONLY : O_WRONLY|O_CREAT|O_TRUNC)) < 0) {
                fprintf (stderr, "%s: Can't open %s: %s\n",
                        cmdname, imagefile, strerror(errno));
                exit (EXIT_FAILURE);
index b5fe35e15cfb7a81931ac6fe0613709739e7ec16..bb59b52643e791b438999b286d07884ce01e5841 100644 (file)
@@ -38,9 +38,9 @@ distclean:    clean
 
 #########################################################################
 
-.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
-       $(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
-
-depend dep: .depend
-
+.depend:       Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
+               $(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
+       
 sinclude .depend
+
+#########################################################################
index 757900b159a87b022b53804282a38cc15db4031e..e1017ac196182b41ef904d6c0487b47c636a609c 100644 (file)
@@ -460,7 +460,7 @@ void        flash_erase (flash_info_t *info, int s_first, int s_last)
        addr[0x02AA] = 0x00550055;
 
        /* Start erase on unprotected sectors */
-       for (sect = s_first; sect<s_last; sect++) {
+       for (sect = s_first; sect<=s_last; sect++) {
                if (info->protect[sect] == 0) { /* not protected */
                        addr = (vu_long*)(info->start[sect]);
                        addr[0] = 0x00300030;
@@ -536,7 +536,7 @@ flash_info_t *addr2info (ulong addr)
 int flash_write (uchar *src, ulong addr, ulong cnt)
 {
        int i;
-       ulong         end        = addr + cnt;
+       ulong         end        = addr + cnt - 1;
        flash_info_t *info_first = addr2info (addr);
        flash_info_t *info_last  = addr2info (end );
        flash_info_t *info;
similarity index 90%
rename from include/ppcboot.lds
rename to tqm8xx/ppcboot.lds
index 989d8b5b0b89f2952b42c81f66a13049622b47e5..5c6c84161965baee77fa9db320e06195c2632f75 100644 (file)
@@ -53,6 +53,18 @@ SECTIONS
   .plt : { *(.plt) }
   .text      :
   {
+    /* WARNING - the following is hand-optimized to fit within */
+    /* the sector layout of our flash chips!   XXX FIXME XXX   */
+
+    mpc8xx/start.o     (.text)
+    common/dlmalloc.o  (.text)
+    ppc/ppcstring.o    (.text)
+    ppc/vsprintf.o     (.text)
+    ppc/crc32.o                (.text)
+    ppc/zlib.o         (.text)
+
+    common/environment.o(.text)
+
     *(.text)
     *(.fixup)
     *(.got1)
diff --git a/tqm8xx/ppcboot.lds.debug b/tqm8xx/ppcboot.lds.debug
new file mode 100644 (file)
index 0000000..83c7f19
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+ * (C) Copyright 2000
+ * 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);
+/* Do we need any of these for elf?
+   __DYNAMIC = 0;    */
+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      :
+  {
+    /* WARNING - the following is hand-optimized to fit within */
+    /* the sector layout of our flash chips!   XXX FIXME XXX   */
+
+    mpc8xx/start.o     (.text)
+    common/dlmalloc.o  (.text)
+    ppc/vsprintf.o     (.text)
+    ppc/crc32.o                (.text)
+    ppc/extable.o      (.text)
+
+    common/environment.o(.text)
+
+    *(.text)
+    *(.fixup)
+    *(.got1)
+  }
+  _etext = .;
+  PROVIDE (etext = .);
+  .rodata    :
+  {
+    *(.rodata)
+    *(.rodata1)
+  }
+  .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 = .);
+
+  __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 = .);
+}
+
index c526a0652a2eef162eac7d4a25f5eef321d84d37..fc334e0209893414328f9561dabd16ce6877be40 100644 (file)
@@ -98,19 +98,19 @@ const uint sdram_table[] =
 
 int checkboard (void)
 {
-    unsigned char *s = (unsigned char *)CFG_HWINFO_ADDR;
+    unsigned char *s = getenv("serial#");
     unsigned char *e;
     int l_type;
 
-    if (strncmp(s, "TQM8", 4)) {
+    if (!s || strncmp(s, "TQM8", 4)) {
        printf ("### No HW ID - assuming TQM8xxL\n");
        return (1);
     }
 
     l_type = (*(s+6) == 'L');
 
-    for (e=s; (e-s)<CFG_HWINFO_LEN; ++e) {
-       if ((*e == ' ') || *e == '\0')
+    for (e=s; *e; ++e) {
+       if (*e == ' ')
            break;
     }
 
@@ -124,19 +124,6 @@ int checkboard (void)
 
 /* ------------------------------------------------------------------------- */
 
-/*
- * Check Size of FLASH memory
- */
-int checkflash (void)
-{
-    /* TODO: XXX XXX XXX */
-    printf ("8 MB ## Test not implemented yet ##\n");
-
-    return (0);
-}
-
-/* ------------------------------------------------------------------------- */
-
 long int initdram (int board_type)
 {
     volatile immap_t     *immap  = (immap_t *)CFG_IMMR;
index b9c1a873ba19db8920271e31e4ead8d26097b068..5fc313a2583c742c2e870ab82fe0a60dd2d5f516 100644 (file)
  * | ...                   |                                 v
  *
  *****************************************************************************/
-
-/* ------------------------------------------------------------------------- */
-/* SDRAM Table according to TQM8xxL Initialization Code                      */
-
-#define SDRAM_MPTPRVALUE 0x1000
-
-#define SDRAM_MARVALUE   0x00000088     /* MAR = Memory Address Register        */
-
-/* ???????? */
-#define SDRAM_MBMRVALUE0 0xc3802114  /* (16-14) 50 MHz */
-#define SDRAM_MBMRVALUE1 SDRAM_MBMRVALUE0
-
-#define SDRAM_OR2VALUE   0xffc00a00
-#define SDRAM_BR2VALUE   0x000000c1   /* base address will be or:ed on */
-
-#define SDRAM_MCRVALUE0  0x80808111   /* run pattern 0x11 */ 
-#define SDRAM_MCRVALUE1  SDRAM_MCRVALUE0
-/* ???????? */
-