Bug fixing, see TODO file for details.
Added persistent environment handling (save to flash).
-
- 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
N: Wolfgang Denk
E: wd@denx.de
D: PPCBOOT initial version
+W: www.denx.de
N: Kirk Haderlie
E: khaderlie@vividimage.com
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/)
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
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
#########################################################################
+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 .. ; \
#########################################################################
depend dep:
- @for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir $@ ; done
+ @for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir .depend ; done
#########################################################################
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.
- 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.
- 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
-* 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
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..
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
+
+#########################################################################
int board_type;
ulong addr_moni, addr_sp;
ulong dram_size, cpu_speed;
+ char *s, *e;
/* SYPCR - contains watchdog control (11-9) */
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) */
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
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 );
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);
ulong data, len, checksum;
ulong initrd_start, initrd_end;
ulong cmd_start, cmd_end;
+ int verify;
char *cmdline;
char *name, *s;
bd_t *kbd;
return;
}
+ s = getenv ("verify");
+ verify = (s && (*s == 'n')) ? 0 : 1;
+
asc_to_hex(argv[1], &addr);
printf ("## Booting Linux kernel at %08lx ...\n", addr);
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");
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) ||
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
{
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);
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) {
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) {
{
flash_info_t *info;
ulong bank, addr_first, addr_last;
- int s_first, s_last;
- int protected;
int i;
int p;
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) {
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) {
#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;
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)
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);
* 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 {
*/
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;
}
/* 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);
}
/*
* 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++)
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));
+ }
+}
/*
* 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[])
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 (' ');
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;
}
}
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 ),
};
--- /dev/null
+#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
{
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 */
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);
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
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 \
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 \
#########################################################################
-.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
+
+#########################################################################
*/
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)
*/
#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
*/
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.
*/
/* 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;
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 */
#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[]);
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 */
#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[]);
#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" \
"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[]);
#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[]);
#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[]);
/* 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
*
#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 */
#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
+
/*-----------------------------------------------------------------------
*
*-----------------------------------------------------------------------
#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
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);
/* 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, ...);
#ifndef __VERSION_H__
#define __VERSION_H__
-#define PPCBOOT_VERSION "ppcboot 0.4.1"
+#define PPCBOOT_VERSION "ppcboot 0.4.2"
#endif /* __VERSION_H__ */
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
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
+
+#########################################################################
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;
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);
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 */
#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.
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 \
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
+
+#########################################################################
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
+
+#########################################################################
* 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>
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);
#########################################################################
-.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
+
+#########################################################################
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;
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;
.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)
--- /dev/null
+/*
+ * (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 = .);
+}
+
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;
}
/* ------------------------------------------------------------------------- */
-/*
- * 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;
* | ... | 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
-/* ???????? */
-