]> www.infradead.org Git - users/rw/ppcboot.git/commitdiff
* PCMCIA support added / extended
authorwdenk <wdenk>
Mon, 15 Jan 2001 19:07:03 +0000 (19:07 +0000)
committerwdenk <wdenk>
Mon, 15 Jan 2001 19:07:03 +0000 (19:07 +0000)
* Misc patches by Paolo Scaffardi added (NETWORK, DPRAM, COMMANDS,
  GENIETV)
* Minor fixes

57 files changed:
CHANGELOG
Makefile
README
board/fads/fads.c
board/genietv/genietv.c
board/genietv/ppcboot.lds.debug [new file with mode: 0644]
board/hermes/hermes.c
board/hymod/flash.c
board/sixnet/sixnet.c
common/Makefile
common/board.c
common/cmd_bootm.c
common/cmd_ide.c
common/cmd_nvedit.c
common/cmd_pcmcia.c
common/command.c
common/console.c
common/devices.c
common/environment.S
common/main.c
cpu/mpc8240/cpu.c
cpu/mpc8260/cpu.c
cpu/mpc8xx/commproc.c
cpu/mpc8xx/cpu.c
cpu/mpc8xx/fec.c
cpu/mpc8xx/i2c.c
cpu/mpc8xx/scc.c
cpu/mpc8xx/serial.c
cpu/mpc8xx/video.c
cpu/ppc4xx/interrupts.c
include/cmd_confdefs.h
include/cmd_ide.h
include/cmd_nvedit.h
include/cmd_pcmcia.h
include/commproc.h
include/config_AR405.h
include/config_CANBT.h
include/config_CPCI405.h
include/config_FADS823.h
include/config_GENIETV.h
include/config_MBX.h
include/config_TQM823L.h
include/config_TQM850L.h
include/config_TQM855L.h
include/config_TQM860L.h
include/config_cogent_common.h
include/config_cogent_mpc8xx.h
include/config_hermes.h
include/config_hymod.h
include/config_rsdproto.h
include/i2c.h
include/pcmcia.h
include/ppcboot.h
include/version.h
net/arp.c
tools/Makefile
tools/envcrc.c [new file with mode: 0644]

index 31ed2c29037413d10517d27adc70da7955a08600..617c74c174b83d972ae3a1ca04d117e38d1960cb 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -57,6 +57,57 @@ To do:
 * "last user address" is set even if bootp is used without parameters
   (and it uses default address).
 
+======================================================================
+Modifications for 0.7.3:
+======================================================================
+
+* PCMCIA support added / extended; we can now boot from PCMCIA memory
+  devices like harddisk adapters or CompactFlash cards (tested with
+  "ARGOSY PnPIDE D5" IDE harddisk adapter and "STI Flash 5.0" CF
+  card. Other card types are recognised, too (for instance, the
+  "Xircom CreditCard 10/100 CE3-10/100" and "ELSA AirLancer MC-11"
+  are recognized as "network adapter cards".
+
+----------------------------------------------------------------------
+NETWORK patch by Paolo Scaffardi (Fri, 12 Jan 2001 13:00:03 +0100)
+----------------------------------------------------------------------
+* Environment variable "autoload" can now be set in default
+  environment using configuration #define CFG_AUTOLOAD.
+----------------------------------------------------------------------
+
+----------------------------------------------------------------------
+DPRAM patch by Paolo Scaffardi (Fri, 12 Jan 2001 13:00:03 +0100)
+----------------------------------------------------------------------
+* Completed and fully supported DPRAM allocation functions for MPC8xx
+  architecture (set CFG_ALLOC_DPRAM or fixed values are still used)
+----------------------------------------------------------------------
+
+----------------------------------------------------------------------
+COMMANDS patch by Paolo Scaffardi (Fri, 12 Jan 2001 13:00:03 +0100)
+----------------------------------------------------------------------
+* Add 'run' command to run a script defined into a environment
+  variable (compiled if CFG_CMD_RUN included with CONFIG_COMMANDS)
+  [completely re-written -wd]
+* Add 'askenv' command to ask an environment variable to the user
+  (compiled if CFG_CMD_ASKENV included with CONFIG_COMMANDS)
+----------------------------------------------------------------------
+
+----------------------------------------------------------------------
+GENIETV patch by Paolo Scaffardi (Fri, 12 Jan 2001 13:00:03 +0100)
+----------------------------------------------------------------------
+* Initialize built-in environment with correct CRC value (computed by
+  'tools/envcrc.c')
+* Added support for AMDLV040B 512Kb flash in flash.h
+* Changed TEXTBASE in GENIETV configuration
+* Added VIDEO_ADDR definition to config_GENIETV.h
+----------------------------------------------------------------------
+
+* Make "reset" command work on RSD Proto board (Marius Gröger)
+
+* Make invalid address used for do_reset() configurable
+
+* Modified 405 configuration (Stefan Roese)
+
 ======================================================================
 Modifications for 0.7.2:
 ======================================================================
index 8caa7090e77968ca594f9732fe183e5a6a864e8c..a97bcedefc0aac757fa12dcc57a96ef54bf6e308 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -44,7 +44,7 @@ export        ARCH CPU BOARD
 # load other configuration
 include $(TOPDIR)/config.mk
 
-SUBDIRS        = $(ARCH) cpu/$(CPU) board/$(BOARD) common net disk examples tools
+SUBDIRS        = tools $(ARCH) cpu/$(CPU) board/$(BOARD) common net disk examples
 
 #########################################################################
 # ppcboot objects....order is important (i.e. start must be first)
@@ -286,7 +286,8 @@ clean:
                \( -name 'core' -o -name '*.bak' \
                -o -name '*.o'  -o -name '*.a'  \) -print`
        rm -f examples/hello_world examples/timer
-       rm -f tools/img2srec tools/mkimage tools/easylogo/easylogo
+       rm -f tools/img2srec tools/mkimage tools/envcrc
+       rm -f tools/easylogo/easylogo
        rm -f tools/gdb/astest tools/gdb/gdbcont tools/gdb/gdbsend
 
 clobber:       clean
diff --git a/README b/README
index fd41f00fa51d3f5fdf14eaa2be9259fd01f05332..17c9fbc8b7c4a83aae309b355e6657a7942ed73b 100644 (file)
--- a/README
+++ b/README
@@ -200,8 +200,8 @@ The following options need to be configured:
 
 - Console Baudrate:
                CONFIG_BAUDRATE - in bps
-               Select one of 9600, 19200, 38400, 57600, 115200
-               (or 230400 if CONFIG_COGENT is defined)
+                Select one of the baudrates listed in
+               CFG_BAUDRATE_TABLE, see below.
 
 - Boot Delay:  CONFIG_BOOTDELAY - in seconds
                Delay before automatically booting the default image;
@@ -231,8 +231,8 @@ The following options need to be configured:
 
 - Kgdb Serial Baudrate:        (if CFG_CMD_KGDB is defined)
                CONFIG_KGDB_BAUDRATE
-               Select one of 9600, 19200, 38400, 57600, 115200
-               (or 230400 if CONFIG_COGENT is defined)
+                Select one of the baudrates listed in
+               CFG_BAUDRATE_TABLE, see below.
 
 - Monitor Functions:
                CONFIG_COMMANDS
@@ -264,7 +264,7 @@ The following options need to be configured:
                                = everything except KGDB
 
                If you don't define CONFIG_COMMANDS it defaults to
-CFG_CMD_DFL .
+               CFG_CMD_DFL .
 
                EXAMPLE: If you want all functions except of network
                support you can write:
@@ -300,6 +300,9 @@ Configuration Settings:
                the application (usually a Linux kernel) when it is
                bootet
 
+- CFG_BAUDRATE_TABLE:
+               List of legal baudrate settings for this board.
+
 - CFG_MEMTEST_START, CFG_MEMTEST_END:
                Begin and End addresses of the area used by the
                simple memory test.
@@ -465,7 +468,7 @@ monitor is relocated into RAM, as a result of a bad CRC you will be
 working with the compiled-in default environment - *silently*!!!
 [This is necessary, because the first environment variable we need is
 the "baudrate" setting for the console - if we have a bad CRC, we
-don't have any device yet whewre we could complain.]
+don't have any device yet where we could complain.]
 
 Note: once the monitor has been relocated, then it will complain if
 the default environment is used; a new CRC is computed as sson as you
@@ -707,9 +710,8 @@ the board). PPCBoot refuses to delete or overwrite these variables
 once they have been set once.
 
 
-Please note that changes to some configuration parameters (like
-console baudrate) may take only effect after the next boot (yes,
-that's just like Windoze :-).
+Please note that changes to some configuration parameters may take
+only effect after the next boot (yes, that's just like Windoze :-).
 
 
 
index 52aa429c1846bea2a3634530f7ac8f2100714110..a2751a11cc9a20fa92ff12dbf8563af34ec18ac7 100644 (file)
@@ -711,7 +711,7 @@ int testdram (void)
 }
 
 
-#ifdef CONFIG_PCMCIA
+#if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
 
 #ifdef CFG_PCMCIA_MEM_ADDR
 volatile unsigned char *pcmcia_mem = (unsigned char*)CFG_PCMCIA_MEM_ADDR;
@@ -854,4 +854,4 @@ int pcmcia_init(void)
        return 0;
 }
 
-#endif /* CONFIG_PCMCIA */
+#endif /* CFG_CMD_PCMCIA */
index 803fea931a0f43b932113d1973a00328ebdf60d7..a42f0b726b835c90601286a73cc963c7db98da19 100644 (file)
@@ -279,7 +279,7 @@ static long int dram_size (long int mbmr_value, long int *base, long int maxsize
        return (0);
 }
 
-#ifdef CONFIG_PCMCIA
+#if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
 
 #ifdef CFG_PCMCIA_MEM_ADDR
 volatile unsigned char *pcmcia_mem = (unsigned char*)CFG_PCMCIA_MEM_ADDR;
@@ -372,4 +372,4 @@ int pcmcia_init(void)
 
        return 0;
 }
-#endif
\ No newline at end of file
+#endif /* CFG_CMD_PCMCIA */
diff --git a/board/genietv/ppcboot.lds.debug b/board/genietv/ppcboot.lds.debug
new file mode 100644 (file)
index 0000000..0441c66
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ * (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   */
+
+    cpu/mpc8xx/start.o (.text)
+    common/dlmalloc.o  (.text)
+    ppc/ppcstring.o    (.text)
+    ppc/vsprintf.o     (.text)
+    ppc/crc32.o                (.text)
+    ppc/zlib.o         (.text)
+
+    . = env_offset;
+    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)
+  }
+  . = ALIGN(256 * 1024);
+  .ppcenv      :
+  {
+    common/environment.o (.ppcenv)
+  }
+  _end = . ;
+  PROVIDE (end = .);
+}
+
index c29e36dbb8a4aba14cb1d9e775f4517fdbfdbd24..f7922593d6f84d0e0078b34fe1785aaba970606f 100644 (file)
@@ -435,7 +435,7 @@ void hermes_start_lxt980 (int speed)
     immr->im_ioport.iop_padir |= 0x4000;
 
     /* get temporary BD; no need for permanent alloc */
-    bd_off = m8xx_cpm_dpbase_align(8);
+    bd_off = dpram_base_align(8);
 
     bd = (cbd_t *)(immr->im_cpm.cp_dpmem + bd_off);
 
index f5f75a2bc8d7f8dc9669599f07f3ed63c8e43859..be8b4794eb590fb47d5096db0e1369dde7c52b3a 100644 (file)
@@ -37,11 +37,13 @@ flash_info_t flash_info[CFG_MAX_FLASH_BANKS];       /* info for FLASH chips */
 /*-----------------------------------------------------------------------
  * Functions
  */
+#if 0
 static ulong flash_get_size (vu_long *addr, flash_info_t *info);
-static int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt);
-static int write_word (flash_info_t *info, ulong dest, ulong data);
 static void flash_get_offsets (ulong base, flash_info_t *info);
 static int  flash_protect (int flag, ulong from, ulong to, flash_info_t *info);
+#endif
+static int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt);
+static int write_word (flash_info_t *info, ulong dest, ulong data);
 
 /*-----------------------------------------------------------------------
  */
@@ -140,6 +142,7 @@ flash_init(void)
  *
  * The monitor always occupies the _first_ part of the _first_ Flash bank.
  */
+#if 0
 static int
 flash_protect(int flag, ulong from, ulong to, flash_info_t *info)
 {
@@ -194,10 +197,12 @@ flash_protect(int flag, ulong from, ulong to, flash_info_t *info)
        }
        return (rc);
 }
+#endif /* 0 */
 
 
 /*-----------------------------------------------------------------------
  */
+#if 0
 static void
 flash_get_offsets(ulong base, flash_info_t *info)
 {
@@ -225,6 +230,7 @@ flash_get_offsets(ulong base, flash_info_t *info)
        }
 
 }
+#endif /* 0 */
 
 /*-----------------------------------------------------------------------
  */
@@ -290,7 +296,7 @@ flash_print_info(flash_info_t *info)
 /*
  * The following code cannot be run from FLASH!
  */
-
+#if 0
 static ulong
 flash_get_size(vu_long *addr, flash_info_t *info)
 {
@@ -417,6 +423,7 @@ flash_get_size(vu_long *addr, flash_info_t *info)
 
        return (info->size);
 }
+#endif /* 0 */
 
 
 /*-----------------------------------------------------------------------
index e5fdec7d43d28c02d5856cb6eb51dffe70334348..b6a301eb3a6663762dbf81d32bafc82ec689551c 100644 (file)
@@ -612,7 +612,7 @@ long int initdram (int board_type)
 
 /* ------------------------------------------------------------------------- */
 
-#ifdef CONFIG_PCMCIA
+#if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
 
 #ifdef CFG_PCMCIA_MEM_ADDR
 volatile unsigned char *pcmcia_mem = (unsigned char*)CFG_PCMCIA_MEM_ADDR;
@@ -732,7 +732,7 @@ int pcmcia_init(void)
        return 0;
 }
 
-#endif /* CONFIG_PCMCIA */
+#endif /* CFG_CMD_PCMCIA */
 
 /* ------------------------------------------------------------------------- */
 
index 27b0cf4fb107b1b84200dc70290953895eef4141..4565e69a1d143882dca2bdb0995be87b7c1869da 100644 (file)
@@ -32,7 +32,8 @@ COBJS = board.o main.o command.o \
          cmd_boot.o cmd_bootm.o cmd_cache.o \
          cmd_console.o cmd_eeprom.o cmd_flash.o \
          cmd_ide.o cmd_mem.o cmd_net.o \
-         cmd_nvedit.o s_record.o dlmalloc.o \
+         cmd_nvedit.o cmd_pcmcia.o \
+         s_record.o dlmalloc.o \
          kgdb.o console.o lists.o devices.o
 
 OBJS   = $(AOBJS) $(COBJS)
@@ -44,6 +45,9 @@ all:  $(LIB) $(AOBJS)
 $(LIB):        .depend $(COBJS)
        $(AR) crv $@ $(COBJS)
 
+environment.o: environment.S ../tools/envcrc
+       $(CC) $(AFLAGS) -DENV_CRC=$(shell ../tools/envcrc) -c -o $@ environment.S
+
 #########################################################################
 
 .depend:       Makefile $(AOBJS:.o=.S) $(COBJS:.o=.c)
index 79ec74e592090037aafc9b3910bf3375fb934813..d25f95abf6ec3dbb803c057fa61df54598ce10a2 100644 (file)
@@ -38,6 +38,9 @@
 #if (CONFIG_COMMANDS & CFG_CMD_NET)
 #include <net.h>
 #endif
+#ifdef CFG_ALLOC_DPRAM
+#include <commproc.h>
+#endif
 #include <version.h>
 
 static char *failed = "*** failed ***\n";
@@ -105,13 +108,13 @@ strmhz(char *buf, long hz)
 
     n = hz / 1000000L;
 
-    l = sprintf(buf, "%ld", n);
+    l = sprintf (buf, "%ld", n);
 
 #if defined(CFG_CLKS_IN_HZ)
     m = (hz % 1000000L) / 1000L;
 
     if (m != 0)
-       sprintf(buf+l, ".%03ld", m);
+       sprintf (buf+l, ".%03ld", m);
 #endif
 
     return (buf);
@@ -167,6 +170,14 @@ board_init_f (ulong bootflag)
     i = getenv_r ("baudrate", tmp, sizeof(tmp));
     baudrate = (i > 0) ? (int)simple_strtoul(tmp, NULL, 10) : CONFIG_BAUDRATE;
 
+#ifdef CFG_ALLOC_DPRAM
+    /* 
+     * set up dual port ram alloc area
+     * if used, it is needed by serial, scc and i2c.
+     */
+    dpram_init ();
+#endif
+
     /* set up serial port */
     serial_init (idata->cpu_clk, baudrate);
 
@@ -181,34 +192,34 @@ board_init_f (ulong bootflag)
     prt_8260_clks();
 #endif /* CONFIG_8260 */
 
-    printf ("Initializing...\n  CPU:   ");             /* Check CPU            */
+    puts ("Initializing...\n  CPU:   ");               /* Check CPU            */
 
     if (checkcpu(idata->cpu_clk) < 0) {
-       printf (failed);
+       puts (failed);
        hang();
     }
 
-    printf ("  Board: ");                              /* Check Board          */
+    puts ("  Board: ");                                        /* Check Board          */
 
     if ((board_type = checkboard()) < 0) {
-       printf (failed);
+       puts (failed);
        hang();
     }
 
 #if defined(CONFIG_COGENT) || defined(CONFIG_SXNI855T) || defined(CONFIG_RSD_PROTO)
     /* miscellaneous platform dependent initialisations */
     if (misc_init_f() < 0) {
-       printf (failed);
+       puts (failed);
        hang();
     }
 #endif
 
-    printf ("  DRAM:  ");
+    puts ("  DRAM:  ");
 
     if ((dram_size = initdram (board_type)) > 0) {
        printf ("%2ld MB\n", dram_size >> 20);
     } else {
-       printf (failed);
+       puts (failed);
        hang();
     }
 
@@ -383,7 +394,7 @@ void    board_init_r  (bd_t *bd, ulong dest_addr)
     extern void malloc_bin_reloc (ulong);
 
 #ifdef DEBUG
-    printf("  Now running in RAM - dest_addr = 0x%08lx\n", dest_addr);
+    printf ("  Now running in RAM - dest_addr = 0x%08lx\n", dest_addr);
 #endif
 
     /* Save a global pointer to the board info struct */
@@ -430,7 +441,7 @@ void    board_init_r  (bd_t *bd, ulong dest_addr)
      */
     trap_init(dest_addr);
 
-    printf ("  FLASH: ");
+    puts ("  FLASH: ");
 
     if ((flash_size = flash_init ()) > 0) {
        if (flash_size >= (1 << 20)) {
@@ -439,7 +450,7 @@ void    board_init_r  (bd_t *bd, ulong dest_addr)
                printf ("%2ld kB\n", flash_size >> 10);
        }
     } else {
-       printf (failed);
+       puts (failed);
        hang();
     }
     bd->bi_flashsize = flash_size;   /* size of FLASH memory (final value)     */
@@ -471,28 +482,32 @@ void    board_init_r  (bd_t *bd, ulong dest_addr)
     defined(CONFIG_IVMS8)      || \
     defined(CONFIG_IP860)
 # ifdef DEBUG
-    printf("  Reset Ethernet PHY\n");
+    puts ("  Reset Ethernet PHY\n");
 # endif
     reset_phy ();
 #endif
 
-#ifdef CONFIG_PCMCIA
-    printf("  PCMCIA: ");
+#if (CONFIG_COMMANDS & CFG_CMD_PCMCIA) && !(CONFIG_COMMANDS & CFG_CMD_IDE)
+    puts ("  PCMCIA:");
     pcmcia_init();
 #endif
 
 #if (CONFIG_COMMANDS & CFG_CMD_IDE)
-    printf ("  IDE:   ");
+# ifdef        CONFIG_IDE_PCCARD
+    puts ("  PCMCIA:");
+# else
+    puts ("  IDE:   ");
+# endif
     ide_init(bd);
-#endif
+#endif /* CFG_CMD_IDE */
 
 #if (CONFIG_COMMANDS & CFG_CMD_KGDB)
-    printf ("  KGDB:  ");
+    puts ("  KGDB:  ");
     kgdb_init();
 #endif
 
 #ifdef DEBUG
-    printf("  Monitor relocated to 0x%08lx\n", dest_addr);
+    printf ("  Monitor relocated to 0x%08lx\n", dest_addr);
 #endif
 
     /*
@@ -549,6 +564,6 @@ void    board_init_r  (bd_t *bd, ulong dest_addr)
 
 void hang(void)
 {
-       printf ("### ERROR ### Please RESET the board ###\n");
+       puts ("### ERROR ### Please RESET the board ###\n");
        for (;;);
 }
index 11665ae6d43b01a8d61dbb36ebc0b1f27669251e..c43a2c73d6c04c8470a48cad013d6023e692fe3f 100644 (file)
@@ -32,7 +32,7 @@
 #include <zlib.h>
 
 int  gunzip (void *, int, unsigned char *, int *);
-void run_default_command (int len, cmd_tbl_t *cmdtp, bd_t *bd, int flag);
+void run_command (const char *cmd, cmd_tbl_t *cmdtp, bd_t *bd, int flag);
 
 static void *zalloc(void *, unsigned, unsigned);
 static void zfree(void *, void *, unsigned);
@@ -416,7 +416,7 @@ void do_bootm (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
 #if (CONFIG_COMMANDS & CFG_CMD_BOOTD)
 void do_bootd (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
 {
-       run_default_command (-1, cmdtp, bd, flag);
+       run_command ("bootcmd", cmdtp, bd, flag);
 }
 #endif
 
index 1bb71f3dff8e63f979e137f9ccf87b84daa11b97..a13d90c2ea30a0148c5876b3f4d592994f272555 100644 (file)
@@ -37,6 +37,7 @@
 #include <ata.h>
 #include <cmd_ide.h>
 #include <cmd_disk.h>
+#include <cmd_pcmcia.h>
 #include <mpc8xx.h>
 
 /* stdlib.h causes some compatibility problems; should fixe these! -- wd */
@@ -105,7 +106,7 @@ static int curr_device = -1;
 /* Current offset for IDE0 / IDE1 bus access   */
 static ulong bus_offset[CFG_IDE_MAXBUS] = {
        CFG_ATA_IDE0_OFFSET,
-#ifdef CFG_ATA_IDE1_OFFSET
+#if CFG_IDE_MAXBUS > 1
        CFG_ATA_IDE1_OFFSET,
 #endif
 };
@@ -418,6 +419,16 @@ void ide_init (bd_t *bd)
        unsigned char c;
        int i, bus;
 
+#ifdef CONFIG_IDE_PCCARD
+       extern int pcmcia_on (void);
+
+       /* initialize the PCMCIA IDE adapter card */
+       if (pcmcia_on())
+               return;
+       udelay (1000000);       /* 1 s */
+       puts ("  ");
+#endif
+
        /* Initialize PIO timing tables */
        for (i=0; i <= IDE_MAX_PIO_MODE; ++i) {
            pio_config_clk[i].t_setup  = PCMCIA_MK_CLKS(pio_config_ns[i].t_setup,
@@ -473,6 +484,7 @@ void ide_init (bd_t *bd)
                        udelay (10000);         /* 10 ms */
 
                        c = inb (dev, ATA_STATUS);
+                       i++;
                        if (i > (ATA_RESET_TIME * 100)) {
                                puts ("** Timeout **\n");
                                ide_led ((LED_IDE1 | LED_IDE2), 0); /* LED's off */
@@ -481,7 +493,6 @@ void ide_init (bd_t *bd)
                        if ((i >= 100) && ((i%100)==0)) {
                                putc ('.');
                        }
-                       i++;
                } while (c & ATA_STAT_BUSY);
 
                if (c & (ATA_STAT_BUSY | ATA_STAT_FAULT)) {
@@ -951,22 +962,14 @@ static void ide_reset (void)
        immr->im_ioport.iop_pcso  &= ~(CFG_PC_IDE_RESET);
        immr->im_ioport.iop_pcdir |=   CFG_PC_IDE_RESET;        /* Make output  */
 
-#if 1
        /* assert IDE RESET signal */
        immr->im_ioport.iop_pcdat &= ~(CFG_PC_IDE_RESET);
        udelay (20000);
        /* de-assert RESET signal of IDE */
        immr->im_ioport.iop_pcdat |=   CFG_PC_IDE_RESET;
-#else
-       /* assert IDE RESET signal */
-       immr->im_ioport.iop_pcdat |=   CFG_PC_IDE_RESET;
-       udelay (20000);
-       /* de-assert RESET signal of IDE */
-       immr->im_ioport.iop_pcdat &= ~(CFG_PC_IDE_RESET);
-#endif
 #else
 #error IDE reset pin not configured
-#endif
+#endif /* CFG_PC_IDE_RESET */
 
 #ifdef CFG_PB_IDE_MOTOR
        immr->im_cpm.cp_pbpar &= ~(CFG_PB_IDE_MOTOR);   /* IDE Motor in pin */
index 83e1ccaf634e286b95d02047c2f982975c7233a7..6b8948c21e61ca5c0116246d44b9f1855cc7c10d 100644 (file)
@@ -531,19 +531,98 @@ void _do_setenv (bd_t *bd, int flag, int argc, char *argv[])
 
 void setenv (char *varname, char *varvalue)
 {
-    char *argv[4] = { "setenv", varname, varvalue, NULL };
-    _do_setenv (bd_ptr, 0, 3, argv);
+       char *argv[4] = { "setenv", varname, varvalue, NULL };
+       _do_setenv (bd_ptr, 0, 3, argv);
 }
 
-void do_setenv   (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[])
 {
-    if (argc < 2) {
-       printf ("Usage:\n%s\n", cmdtp->usage);
-       return;
-    }
+       if (argc < 2) {
+               printf ("Usage:\n%s\n", cmdtp->usage);
+               return;
+       }
+
+       _do_setenv (bd, flag, argc, argv);
+}
+
+/************************************************************************
+ * Prompt for environment variable
+ */
+
+#if (CONFIG_COMMANDS & CFG_CMD_ASKENV)
+void do_askenv (cmd_tbl_t * cmdtp, bd_t * bd, int flag, int argc,
+               char *argv[])
+{
+       extern char console_buffer[CFG_CBSIZE];
+       char message[CFG_CBSIZE];
+       int size = CFG_CBSIZE - 1;
+       int len;
+       char *local_args[4];
+
+       local_args[0] = argv[0];
+       local_args[1] = argv[1];
+       local_args[2] = NULL;
+       local_args[3] = NULL;
+
+       if (argc < 2) {
+               printf ("Usage:\n%s\n", cmdtp->usage);
+               return;
+       }
+       /* Check the syntax */
+       switch (argc) {
+       case 1:
+               printf ("Usage:\n%s\n", cmdtp->usage);
+               return;
+
+       case 2:         /* askenv envname */
+               sprintf (message, "Please enter '%s':", argv[1]);
+               break;
+
+       case 3:         /* askenv envname size */
+               sprintf (message, "Please enter '%s':", argv[1]);
+               size = simple_strtoul (argv[2], NULL, 10);
+               break;
+
+       default:        /* askenv envname message1 ... messagen size */
+               {
+                       int i;
+                       int pos = 0;
+
+                       for (i = 2; i < argc - 1; i++) {
+                               if (pos) {
+                                       message[pos++] = ' ';
+                               }
+                               strcpy (message+pos, argv[i]);
+                               pos += strlen(argv[i]);
+                       }
+                       message[pos] = '\0';
+                       size = simple_strtoul (argv[argc - 1], NULL, 10);
+               }
+       }
+
+       if (size >= CFG_CBSIZE)
+               size = CFG_CBSIZE - 1;
+
+       if (size <= 0)
+               return;
+
+       /* prompt for input */
+       len = readline (message);
+
+       if (size < len)
+               console_buffer[size] = '\0';
+
+       len = 2;
+       if (console_buffer[0] != '\0') {
+               local_args[2] = console_buffer;
+               len = 3;
+       }
 
-    _do_setenv (bd, flag, argc, argv);
+       // Continue calling setenv code
+       _do_setenv (bd, flag, len, local_args);
 }
+#endif /* CFG_CMD_ASKENV */
 
 /************************************************************************
  * Look up variable from environment,
index 77f425c6465237b1b3a9c5275ca399b83fadc51c..cb4ffe47618b892f19e6ac8235148b5546898e60 100644 (file)
 #include <mpc8xx_irq.h>
 #include <ppcboot.h>
 #include <command.h>
+#include <config.h>
+#include <pcmcia.h>
 #include <cmd_pcmcia.h>
 #include <mpc8xx.h>
 
+#if (CONFIG_COMMANDS & CFG_CMD_PCMCIA) || \
+    ((CONFIG_COMMANDS & CFG_CMD_IDE) && defined(CONFIG_IDE_PCCARD))
 
-static int hardware_enable (int slot);
-static int hardware_disable(int slot);
-static int voltage_set(int slot, int vcc, int vpp);
+int pcmcia_on (void);
+
+#if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
+static void pcmcia_off (void);
+static int  hardware_disable(int slot);
+#endif
+static int  hardware_enable (int slot);
+static int  voltage_set(int slot, int vcc, int vpp);
+#ifdef CONFIG_IDE_PCCARD
+static void print_funcid (int func);
+static void print_fixed  (volatile uchar *p);
+static int  identify     (volatile uchar *p);
+static int  check_ide_device (void);
+#endif /* CONFIG_IDE_PCCARD */
 
 static u_int m8xx_get_graycode(u_int size);
 #if 0
@@ -68,74 +83,6 @@ static u_int m8xx_get_speed(u_int ns, u_int is_io);
 #endif
 
 /* ------------------------------------------------------------------------- */
-/* Autoconfigure boards if no settings are defined                           */
-#if defined(CONFIG_TQM823L) || defined(CONFIG_TQM850L) || defined(CONFIG_TQM860L)
-#define        CONFIG_TQM8xxL
-#endif
-
-#if !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B)
-
-/* The RPX series use SLOT_B */
-#if defined(CONFIG_RPXCLASSIC) || defined(CONFIG_RPXLITE)
-# define CONFIG_PCMCIA_SLOT_B
-#endif
-
-/* The ADS board use SLOT_A */
-#ifdef CONFIG_ADS
-# define CONFIG_PCMCIA_SLOT_A
-#endif
-
-/* The FADS series are a mess */
-#ifdef CONFIG_FADS
-# if defined(CONFIG_MPC860T) || defined(CONFIG_MPC860) || defined(CONFIG_MPC821)
-#  define CONFIG_PCMCIA_SLOT_A
-# else
-#  define CONFIG_PCMCIA_SLOT_B
-# endif
-#endif
-
-/* The TQM8xxL modules use SLOT_A on MPC860, SLOT_B else */
-#ifdef CONFIG_TQM8xxL
-# if defined(CONFIG_MPC860T) || defined(CONFIG_MPC860)
-#  define      CONFIG_PCMCIA_SLOT_A
-# else /* ! 860, 860T */
-#  define      CONFIG_PCMCIA_SLOT_B
-# endif        /* 860, 860T */
-#endif /* CONFIG_TQM8xxL */
-
-#endif /* !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B) */
-
-/* Make sure exactly one slot is defined - we support only one for now */
-#if !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B)
-#error Neither CONFIG_PCMCIA_SLOT_A nor CONFIG_PCMCIA_SLOT_B configured
-#endif
-#if defined(CONFIG_PCMCIA_SLOT_A) && defined(CONFIG_PCMCIA_SLOT_B)
-#error Both CONFIG_PCMCIA_SLOT_A and CONFIG_PCMCIA_SLOT_B configured
-#endif
-
-#define PCMCIA_SOCKETS_NO      1
-#define PCMCIA_MEM_WIN_NO      4
-#define PCMCIA_IO_WIN_NO       2
-
-/* define _slot_ to be able to optimize macros */
-#ifdef CONFIG_PCMCIA_SLOT_A
-# define _slot_                        0
-# define PCMCIA_SLOT_MSG       "SLOT_A"
-#else
-# define _slot_                        1
-# define PCMCIA_SLOT_MSG       "SLOT_B"
-#endif
-
-/*
- * The TQM850L hardware has two pins swapped! Grrrrgh!
- */
-#ifdef CONFIG_TQM850L
-#define __MY_PCMCIA_GCRX_CXRESET       PCMCIA_GCRX_CXOE
-#define __MY_PCMCIA_GCRX_CXOE          PCMCIA_GCRX_CXRESET
-#else
-#define __MY_PCMCIA_GCRX_CXRESET       PCMCIA_GCRX_CXRESET
-#define __MY_PCMCIA_GCRX_CXOE          PCMCIA_GCRX_CXOE
-#endif
 
 /* look up table for pgcrx registers */
 
@@ -146,106 +93,249 @@ static u_int *pcmcia_pgcrx[2] = {
 
 #define PCMCIA_PGCRX(slot)     (*pcmcia_pgcrx[slot])
 
-/*
- * This structure is used to address each window in the PCMCIA controller.
- *
- * Keep in mind that we assume that pcmcia_win_t[n+1] is mapped directly
- * after pcmcia_win_t[n]...
- */
-
-typedef struct {
-       uint    br;
-       uint    or;
-} pcmcia_win_t;
+const char *indent = "\t   ";
 
+/* ------------------------------------------------------------------------- */
 
+#ifdef DEBUG
+#define        PCMCIA_DEBUG(fmt,args...)       do { printf (fmt ,##args); } while (0)
+#else
+#define PCMCIA_DEBUG(fmt,args...)
+#endif
 
 /* ------------------------------------------------------------------------- */
 
+#if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
+
 void do_pinit (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
 {
-       int i;
-       u_long reg, base;
-       pcmcia_win_t *win;
 
        if (argc != 2) {
                printf ("Usage: pinit {on | off}\n");
                return;
        }
        if (strcmp(argv[1],"on") == 0) {
-               printf ("Enable PCMCIA " PCMCIA_SLOT_MSG "\n");
+               pcmcia_on ();
+       } else if (strcmp(argv[1],"off") == 0) {
+               pcmcia_off ();
+       } else {
+               printf ("Usage: pinit {on | off}\n");
+               return;
+       }
+
+       return;
+}
+#endif /* CFG_CMD_PCMCIA */
 
-               /* intialize the fixed memory windows */
-               win = (pcmcia_win_t *)(&((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_pbr0);
-               base = CFG_PCMCIA_MEM_ADDR;
+/* ------------------------------------------------------------------------- */
 
-               if((reg = m8xx_get_graycode(CFG_PCMCIA_MEM_SIZE)) == -1) {
-                       printf ("Cannot set window size to 0x%08x\n",
-                               CFG_PCMCIA_MEM_SIZE);
-                       return;
+int pcmcia_on (void)
+{
+       int i;
+       u_long reg, base;
+       pcmcia_win_t *win;
+
+       PCMCIA_DEBUG ("Enable PCMCIA " PCMCIA_SLOT_MSG "\n");
+
+       /* intialize the fixed memory windows */
+       win = (pcmcia_win_t *)(&((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_pbr0);
+       base = CFG_PCMCIA_MEM_ADDR;
+
+       if((reg = m8xx_get_graycode(CFG_PCMCIA_MEM_SIZE)) == -1) {
+               printf ("Cannot set window size to 0x%08x\n",
+                       CFG_PCMCIA_MEM_SIZE);
+               return (1);
+       }
+
+       for (i=0; i<PCMCIA_MEM_WIN_NO; ++i) {
+               win->br = base;
+
+               switch (i) {
+#ifdef CONFIG_IDE_PCCARD
+               case 0: {       /* map attribute memory */
+                       win->or = (     PCMCIA_BSIZE_64M
+                               |       PCMCIA_PPS_8
+                               |       PCMCIA_PRS_ATTR
+                               |       PCMCIA_PSLOT_B
+                               |       PCMCIA_PV
+                               |       0x00024480 );   /* fixed access timing */
+                       break;
+                   }
+
+               case 1: {       /* map I/O window for data reg */
+                       win->or = (     PCMCIA_BSIZE_1K
+                               |       PCMCIA_PPS_16
+                               |       PCMCIA_PRS_IO
+                               |       PCMCIA_PSLOT_B
+                               |       PCMCIA_PV
+                               |       0x00024480 );   /* fixed access timing */
+                       break;
+                   }
+
+               case 2: {       /* map I/O window for command/ctrl reg block */
+                       win->or = (     PCMCIA_BSIZE_1K
+                               |       PCMCIA_PPS_8
+                               |       PCMCIA_PRS_IO
+                               |       PCMCIA_PSLOT_B
+                               |       PCMCIA_PV
+                               |       0x00024480 );   /* fixed access timing */
+                       break;
+                   }
+#endif
+               default:        /* set to not valid */
+                       win->or = 0;
+                       break;
                }
-#if 0
-XXX XXX XXX
-if(mem->flags & MAP_ATTRIB)
-       reg |= 0x00000010;
 
-if(mem->flags & MAP_WRPROT)
-       reg |= 0x00000002;
+               PCMCIA_DEBUG ("MemWin %d: Base 0x%08lX\n", i, base);
+               base += CFG_PCMCIA_MEM_SIZE;
+               ++win;
+       }
+
+       /* turn off voltage */
+       if (voltage_set(_slot_, 0, 0))
+               return (1);
 
-if(mem->flags & MAP_16BIT)
-       reg |= 0x00000040;
+       /* Enable external hardware */
+       if (hardware_enable(_slot_))
+               return (1);
 
-if(mem->flags & MAP_ACTIVE)
-       reg |= 0x00000001;
-XXX XXX XXX
+#ifdef CONFIG_IDE_PCCARD
+       if (check_ide_device())
+               return (1);
 #endif
+       return (0);
+}
 
-               for (i=0; i<PCMCIA_MEM_WIN_NO; ++i) {
-                       win->br = base;
-                       win->or = 0;    /* set to not valid */
-printf ("MemWin %d: Base 0x%08lX\n", i, base);
-                       base += CFG_PCMCIA_MEM_SIZE;
-                       ++win;
-               }
+/* ------------------------------------------------------------------------- */
 
-               /* turn off voltage */
-               voltage_set(_slot_, 0, 0);
+#if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
 
-               /* Enable external hardware */
-               hardware_enable(_slot_);
+static void pcmcia_off (void)
+{
+       int i;
+       pcmcia_win_t *win;
 
-       } else if (strcmp(argv[1],"off") == 0) {
-               printf ("Disable PCMCIA " PCMCIA_SLOT_MSG "\n");
+       printf ("Disable PCMCIA " PCMCIA_SLOT_MSG "\n");
 
-               /* clear interrupt state, and disable interrupts */
-               ((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_pscr =  PCMCIA_MASK(_slot_);
-               ((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_per &= ~PCMCIA_MASK(_slot_);
+       /* clear interrupt state, and disable interrupts */
+       ((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_pscr =  PCMCIA_MASK(_slot_);
+       ((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_per &= ~PCMCIA_MASK(_slot_);
 
-               /* turn off interrupt and disable CxOE */
-               PCMCIA_PGCRX(_slot_) = __MY_PCMCIA_GCRX_CXOE;
+       /* turn off interrupt and disable CxOE */
+       PCMCIA_PGCRX(_slot_) = __MY_PCMCIA_GCRX_CXOE;
 
-               /* turn off memory windows */
-               win = (pcmcia_win_t *)(&((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_pbr0);
+       /* turn off memory windows */
+       win = (pcmcia_win_t *)(&((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_pbr0);
 
-               for (i=0; i<PCMCIA_MEM_WIN_NO; ++i) {
-                       /* disable memory window */
-                       win->or = 0;
-                       ++win;
+       for (i=0; i<PCMCIA_MEM_WIN_NO; ++i) {
+               /* disable memory window */
+               win->or = 0;
+               ++win;
+       }
+
+       /* turn off voltage */
+       voltage_set(_slot_, 0, 0);
+
+       /* disable external hardware */
+       printf ("Shutdown and Poweroff " PCMCIA_SLOT_MSG "\n");
+       hardware_disable(_slot_);
+}
+
+#endif /* CFG_CMD_PCMCIA */
+
+/* ------------------------------------------------------------------------- */
+
+#ifdef CONFIG_IDE_PCCARD
+
+#define        MAX_TUPEL_SZ    512
+#define MAX_FEATURES   4
+
+static int check_ide_device (void)
+{
+       volatile uchar *ident = NULL;
+       volatile uchar *feature_p[MAX_FEATURES];
+       volatile uchar *p, *start;
+       int n_features = 0;
+       uchar func_id = ~0;
+       uchar code, len;
+       ushort config_base = 0;
+       int found = 0;
+       int i;
+
+       PCMCIA_DEBUG ("PCMCIA MEM: %08lX\n", CFG_PCMCIA_MEM_ADDR);
+
+       start = p = (volatile uchar *) CFG_PCMCIA_MEM_ADDR;
+
+       while ((p - start) < MAX_TUPEL_SZ) {
+
+               code = *p; p += 2;
+
+               if (code == 0xFF) { /* End of chain */
+                       break;
                }
 
-               /* turn off voltage */
-               voltage_set(_slot_, 0, 0);
+               len = *p; p += 2;
+#ifdef DEBUG
+               { volatile uchar *q = p;
+                       printf ("\nTuple code %02x  length %d\n\tData:",
+                               code, len);
 
-               /* disable external hardware */
-               printf ("Shutdown and Poweroff " PCMCIA_SLOT_MSG "\n");
-               hardware_disable(_slot_);
-       } else {
-               printf ("Usage: pinit {on | off}\n");
-               return;
+                       for (i = 0; i < len; ++i) {
+                               printf (" %02x", *q);
+                               q+= 2;
+                       }
+               }
+#endif /* DEBUG */
+               switch (code) {
+               case CISTPL_VERS_1:
+                       ident = p + 4;
+                       break;
+               case CISTPL_FUNCID:
+                       func_id = *p;
+                       break;
+               case CISTPL_FUNCE:
+                       if (n_features < MAX_FEATURES)
+                               feature_p[n_features++] = p;
+                       break;
+               case CISTPL_CONFIG:
+                       config_base = (*(p+6) << 8) + (*(p+4));
+                       PCMCIA_DEBUG ("\n## Config_base = %04x ###\n", config_base);
+               default:
+                       break;
+               }
+               p += 2 * len;
        }
 
-       return;
+       found = identify (ident);
+
+       if (func_id != ((uchar)~0)) {
+               print_funcid (func_id);
+
+               if (func_id == CISTPL_FUNCID_FIXED)
+                       found = 1;
+               else
+                       return (1);     /* no disk drive */
+       }
+
+       for (i=0; i<n_features; ++i) {
+               print_fixed (feature_p[i]);
+       }
+
+       if (!found) {
+               printf ("unknown card type\n");
+               return (1);
+       }
+
+       /* set I/O area in config reg -> only valid for ARGOSY D5!!! */
+       *((uchar *)(CFG_PCMCIA_MEM_ADDR + config_base)) = 1;
+
+       return (0);
 }
+#endif /* CONFIG_IDE_PCCARD */
+
+/* ------------------------------------------------------------------------- */
+
 
 /* ---------------------------------------------------------------------------- */
 /* board specific stuff:                                                       */
@@ -313,11 +403,13 @@ static int hardware_enable (int slot)
 {
        return 0;       /* No hardware to enable */
 }
+#if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
 static int hardware_disable(int slot)
 {
        return 0;       /* No hardware to disable */
 }
-#endif /* CONFIG_RPXCLASSIC */
+#endif /* CFG_CMD_PCMCIA */
+#endif /* CONFIG_RPXCLASSIC */
 
 /* ---------------------------------------------------------------------------- */
 /* (F)ADS Boards from Motorola                                                 */
@@ -387,11 +479,13 @@ static int hardware_enable(int slot)
        return 0;
 }
 
+#if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
 static int hardware_disable(int slot)
 {
        *((uint *)BCSR1) &= ~BCSR1_PCCEN;
        return 0;
 }
+#endif /* CFG_CMD_PCMCIA */
 
 #endif /* (F)ADS */
 
@@ -399,6 +493,13 @@ static int hardware_disable(int slot)
 /* TQM8xxL Boards by TQ Components                                             */
 /* ---------------------------------------------------------------------------- */
 
+#if defined(CONFIG_TQM823L) || defined(CONFIG_TQM850L) || \
+    defined(CONFIG_TQM855L) || defined(CONFIG_TQM860L)
+# ifndef CONFIG_TQM8xxL
+#  define CONFIG_TQM8xxL
+# endif
+#endif
+
 #ifdef CONFIG_TQM8xxL
 
 #define PCMCIA_BOARD_MSG "TQM8xxL"
@@ -411,12 +512,7 @@ static int hardware_enable(int slot)
        volatile sysconf8xx_t   *sysp;
        uint reg, mask;
 
-printf ("hardware_enable: TQM8xxL Slot %c\n", 'A'+slot);
-
-if (slot != 1) {
- printf ("## Only Slot B supported for now ##\n");
- return (1);
-}
+       PCMCIA_DEBUG ("hardware_enable: TQM8xxL Slot %c\n", 'A'+slot);
 
        immap = (immap_t *)CFG_IMMR;
        sysp  = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
@@ -440,9 +536,9 @@ if (slot != 1) {
         * Disable PCMCIA buffers (isolate the interface)
         * and assert RESET signal
         */
-printf ("Disable PCMCIA buffers and assert RESET\n");
+       PCMCIA_DEBUG ("Disable PCMCIA buffers and assert RESET\n");
        reg  =  PCMCIA_PGCRX(_slot_);
-       reg &= ~__MY_PCMCIA_GCRX_CXRESET;       /* active high */
+       reg |=  __MY_PCMCIA_GCRX_CXRESET;       /* active high */
        reg |=  __MY_PCMCIA_GCRX_CXOE;          /* active low  */
        PCMCIA_PGCRX(_slot_) = reg;
        udelay(500);
@@ -454,66 +550,66 @@ printf ("Disable PCMCIA buffers and assert RESET\n");
        immap->im_ioport.iop_pcpar &= ~(0x0002 | 0x0004);
        immap->im_ioport.iop_pcso  &= ~(0x0002 | 0x0004);
        /* remove all power */
+
        immap->im_ioport.iop_pcdat &= ~(0x0002 | 0x0004);
 
        /*
         * Make sure there is a card in the slot, then configure the interface.
         */
-printf ("[%d] %s: PIPR(%p)=0x%x\n",__LINE__,__FUNCTION__,&(pcmp->pcmc_pipr),pcmp->pcmc_pipr);udelay(10000);
-printf ("[%d] %s: PIPR(%p)=0x%x\n",__LINE__,__FUNCTION__,&(pcmp->pcmc_pipr),pcmp->pcmc_pipr);udelay(10000);
-printf ("[%d] %s: PIPR(%p)=0x%x\n",__LINE__,__FUNCTION__,&(pcmp->pcmc_pipr),pcmp->pcmc_pipr);udelay(10000);
+       PCMCIA_DEBUG ("[%d] %s: PIPR(%p)=0x%x\n",
+               __LINE__,__FUNCTION__,
+               &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);udelay(10000);
        if (pcmp->pcmc_pipr & 0x00001800) {
-printf ("##### hardware_enable - no card in slot\n");
-               return (-1);
+               printf ("   No Card found\n");
+               return (1);
        }
-printf ("# hardware_enable - card found\n");
 
        /*
         * Power On.
         */
        mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
        reg  = pcmp->pcmc_pipr;
-printf ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n", reg,
-(reg&PCMCIA_VS1(slot))?"n":"ff", (reg&PCMCIA_VS2(slot))?"n":"ff");
+       PCMCIA_DEBUG ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
+               reg,
+               (reg&PCMCIA_VS1(slot))?"n":"ff",
+               (reg&PCMCIA_VS2(slot))?"n":"ff");
        if ((reg & mask) == mask) {
                immap->im_ioport.iop_pcdat |= 0x0004;
-printf ("PCMCIA Power on 5.0 Volt\n");
+               puts (" 5.0V card found: ");
        } else {
                immap->im_ioport.iop_pcdat |= 0x0002;
-printf ("PCMCIA Power on 3.3 Volt\n");
+               puts (" 3.3V card found: ");
        }
        immap->im_ioport.iop_pcdir |=  (0x0002 | 0x0004);
-
+#if 0
        /*  VCC switch error flag, PCMCIA slot INPACK_ pin */
        cp->cp_pbdir &= ~(0x0020 | 0x0010);
        cp->cp_pbpar &= ~(0x0020 | 0x0010);
        udelay(500000);
-
-printf ("Enable PCMCIA buffers and stop RESET\n");
+#endif
+       PCMCIA_DEBUG ("Enable PCMCIA buffers and stop RESET\n");
        reg  =  PCMCIA_PGCRX(_slot_);
-       reg |=  __MY_PCMCIA_GCRX_CXRESET;               /* active high */
+       reg &= ~__MY_PCMCIA_GCRX_CXRESET;       /* active high */
        reg &= ~__MY_PCMCIA_GCRX_CXOE;          /* active low  */
        PCMCIA_PGCRX(_slot_) = reg;
-       udelay(500);
 
-printf ("# hardware_enable done\n");
+       udelay(250000); /* some cards need >150 ms to come up :-( */
+
+       PCMCIA_DEBUG ("# hardware_enable done\n");
+
        return (0);
 }
 
 
 
+#if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
 static int hardware_disable(int slot)
 {
        volatile immap_t        *immap;
        volatile pcmconf8xx_t   *pcmp;
        u_long reg;
 
-printf ("hardware_disable: TQM8xxL Slot %c\n", 'A'+slot);
-
-if (slot != 1) {
- printf ("## Only Slot B supported for now ##\n");
- return (1);
-}
+       PCMCIA_DEBUG ("hardware_disable: TQM8xxL Slot %c\n", 'A'+slot);
 
        immap = (immap_t *)CFG_IMMR;
        pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
@@ -527,11 +623,11 @@ if (slot != 1) {
        /*
         * Disable PCMCIA buffers (isolate the interface)
         */
-printf ("Disable PCMCIA buffers\n");
+       PCMCIA_DEBUG ("Disable PCMCIA buffers\n");
        PCMCIA_PGCRX(_slot_) &= ~__MY_PCMCIA_GCRX_CXOE;
        udelay(500);
 
-printf ("Disable PCMCIA buffers and assert RESET\n");
+       PCMCIA_DEBUG ("Disable PCMCIA buffers and assert RESET\n");
        reg  =  PCMCIA_PGCRX(_slot_);
        reg &= ~__MY_PCMCIA_GCRX_CXRESET;       /* active high */
        reg |=  __MY_PCMCIA_GCRX_CXOE;          /* active low  */
@@ -539,6 +635,7 @@ printf ("Disable PCMCIA buffers and assert RESET\n");
 
        return (0);
 }
+#endif /* CFG_CMD_PCMCIA */
 
 
 
@@ -548,13 +645,8 @@ static int voltage_set(int slot, int vcc, int vpp)
        volatile pcmconf8xx_t   *pcmp;
        u_long reg;
 
-printf ("voltage_set: TQM8xxL Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
-'A'+slot,vcc/10,vcc%10,vpp/10,vcc%10);
-
-if (slot != 1) {
- printf ("## Only Slot B supported for now ##\n");
- return (1);
-}
+       PCMCIA_DEBUG ("voltage_set: TQM8xxL Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
+               'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
 
        immap = (immap_t *)CFG_IMMR;
        pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
@@ -562,9 +654,9 @@ if (slot != 1) {
         * Disable PCMCIA buffers (isolate the interface)
         * and assert RESET signal
         */
-printf ("Disable PCMCIA buffers and assert RESET\n");
+       PCMCIA_DEBUG ("Disable PCMCIA buffers and assert RESET\n");
        reg  =  PCMCIA_PGCRX(_slot_);
-       reg &= ~__MY_PCMCIA_GCRX_CXRESET;       /* active high */
+       reg |=  __MY_PCMCIA_GCRX_CXRESET;       /* active high */
        reg |=  __MY_PCMCIA_GCRX_CXOE;          /* active low  */
        PCMCIA_PGCRX(_slot_) = reg;
        udelay(500);
@@ -574,7 +666,7 @@ printf ("Disable PCMCIA buffers and assert RESET\n");
         * 5 Volts Enable and 3 Volts enable,
         * Turn off all power
         */
-printf ("PCMCIA power OFF\n");
+       PCMCIA_DEBUG ("PCMCIA power OFF\n");
        immap->im_ioport.iop_pcpar &= ~(0x0002 | 0x0004);
        immap->im_ioport.iop_pcso  &= ~(0x0002 | 0x0004);
        immap->im_ioport.iop_pcdat &= ~(0x0002 | 0x0004);
@@ -589,26 +681,28 @@ printf ("PCMCIA power OFF\n");
 
        /* Checking supported voltages */
 
-printf ("PIPR: 0x%x --> %s\n", pcmp->pcmc_pipr,
-(pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");
+       PCMCIA_DEBUG ("PIPR: 0x%x --> %s\n",
+               pcmp->pcmc_pipr,
+               (pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");
 
        immap->im_ioport.iop_pcdat |= reg;
        immap->im_ioport.iop_pcdir |=  (0x0002 | 0x0004);
-if (reg) {
-printf ("PCMCIA powered at %sV\n",(reg&0x0004)?"5.0":"3.3");
-} else {
-printf ("PCMCIA powered down\n");
-}
+       if (reg) {
+               PCMCIA_DEBUG ("PCMCIA powered at %sV\n",
+                       (reg&0x0004) ? "5.0" : "3.3");
+       } else {
+               PCMCIA_DEBUG ("PCMCIA powered down\n");
+       }
 
 done:
-printf ("Enable PCMCIA buffers and stop RESET\n");
+       PCMCIA_DEBUG ("Enable PCMCIA buffers and stop RESET\n");
        reg  =  PCMCIA_PGCRX(_slot_);
-       reg |=  __MY_PCMCIA_GCRX_CXRESET;       /* active high */
+       reg &= ~__MY_PCMCIA_GCRX_CXRESET;       /* active high */
        reg &= ~__MY_PCMCIA_GCRX_CXOE;          /* active low  */
        PCMCIA_PGCRX(_slot_) = reg;
        udelay(500);
 
-printf ("voltage_set: TQM8xxL Slot %c, DONE\n", slot+'A');
+       PCMCIA_DEBUG ("voltage_set: TQM8xxL Slot %c, DONE\n", slot+'A');
        return (0);
 }
 
@@ -715,6 +809,168 @@ static u_int m8xx_get_speed(u_int ns, u_int is_io)
 
 /* ------------------------------------------------------------------------- */
 
+#ifdef CONFIG_IDE_PCCARD
+static void print_funcid (int func)
+{
+       puts (indent);
+       switch (func) {
+       case CISTPL_FUNCID_MULTI:
+               puts (" Multi-Function");
+               break;
+       case CISTPL_FUNCID_MEMORY:
+               puts (" Memory");
+               break;
+       case CISTPL_FUNCID_SERIAL:
+               puts (" Serial Port");
+               break;
+       case CISTPL_FUNCID_PARALLEL:
+               puts (" Parallel Port");
+               break;
+       case CISTPL_FUNCID_FIXED:
+               puts (" Fixed Disk");
+               break;
+       case CISTPL_FUNCID_VIDEO:
+               puts (" Video Adapter");
+               break;
+       case CISTPL_FUNCID_NETWORK:
+               puts (" Network Adapter");
+               break;
+       case CISTPL_FUNCID_AIMS:
+               puts (" AIMS Card");
+               break;
+       case CISTPL_FUNCID_SCSI:
+               puts (" SCSI Adapter");
+               break;
+       default:
+               puts (" Unknown");
+               break;
+       }
+       puts (" Card\n");
+}
+#endif /* CONFIG_IDE_PCCARD */
+
+/* ------------------------------------------------------------------------- */
+
+#ifdef CONFIG_IDE_PCCARD
+static void print_fixed (volatile uchar *p)
+{
+       if (p == NULL)
+               return;
+
+       puts(indent);
+
+       switch (*p) {
+       case CISTPL_FUNCE_IDE_IFACE:
+           {   uchar iface = *(p+2);
+
+               puts ((iface == CISTPL_IDE_INTERFACE) ? " IDE" : " unknown");
+               puts (" interface ");
+               break;
+           }
+       case CISTPL_FUNCE_IDE_MASTER:
+       case CISTPL_FUNCE_IDE_SLAVE:
+           {   uchar f1 = *(p+2);
+               uchar f2 = *(p+4);
+
+               puts ((f1 & CISTPL_IDE_SILICON) ? " [silicon]" : " [rotating]");
+
+               if (f1 & CISTPL_IDE_UNIQUE)
+                       puts (" [unique]");
+
+               puts ((f1 & CISTPL_IDE_DUAL) ? " [dual]" : " [single]");
+
+               if (f2 & CISTPL_IDE_HAS_SLEEP)
+                       puts (" [sleep]");
+
+               if (f2 & CISTPL_IDE_HAS_STANDBY)
+                       puts (" [standby]");
+
+               if (f2 & CISTPL_IDE_HAS_IDLE)
+                       puts (" [idle]");
+
+               if (f2 & CISTPL_IDE_LOW_POWER)
+                       puts (" [low power]");
+
+               if (f2 & CISTPL_IDE_REG_INHIBIT)
+                       puts (" [reg inhibit]");
+
+               if (f2 & CISTPL_IDE_HAS_INDEX)
+                       puts (" [index]");
+
+               if (f2 & CISTPL_IDE_IOIS16)
+                       puts (" [IOis16]");
+
+               break;
+           }
+       }
+       putc ('\n');
+}
+#endif /* CONFIG_IDE_PCCARD */
+
+/* ------------------------------------------------------------------------- */
+
+#ifdef CONFIG_IDE_PCCARD
+
+#define MAX_IDENT_CHARS                64
+#define        MAX_IDENT_FIELDS        4
+
+static uchar *known_cards[] = {
+       "ARGOSY PnPIDE D5",
+       NULL
+};
+
+static int identify  (volatile uchar *p)
+{
+       uchar id_str[MAX_IDENT_CHARS];
+       uchar data;
+       uchar *t;
+       uchar **card;
+       int i, done;
+
+       if (p == NULL)
+               return (0);     /* Don't know */
+
+       t = id_str;
+       done =0;
+
+       for (i=0; i<=4 && !done; ++i, p+=2) {
+               while ((data = *p) != '\0') {
+                       if (data == 0xFF) {
+                               done = 1; 
+                               break; 
+                       }
+                       *t++ = data;
+                       if (t == &id_str[MAX_IDENT_CHARS-1]) {
+                               done = 1;
+                               break;
+                       }
+                       p += 2;
+               }
+               if (!done)
+                       *t++ = ' ';
+       }
+       *t = '\0';
+       while (--t > id_str) {
+               if (*t == ' ')
+                       *t = '\0';
+               else
+                       break;
+       }
+       puts (id_str);
+       putc ('\n');
+
+       for (card=known_cards; *card; ++card) {
+               PCMCIA_DEBUG ("## Compare against \"%s\"\n", *card);
+               if (strcmp(*card, id_str) == 0) {       /* found! */
+                       PCMCIA_DEBUG ("## CARD FOUND ##\n");
+                       return (1);
+               }
+       }
+
+       return (0);     /* don't know */
+}
+#endif /* CONFIG_IDE_PCCARD */
 
 /* ------------------------------------------------------------------------- */
 
+#endif /* CFG_CMD_PCMCIA || (CFG_CMD_IDE && CONFIG_IDE_PCCARD) */
index 001b0e79fa06ac0754667a45f60c44915e856f4e..1c1050514a38c986a3652fa713bf56e4e62a59b6 100644 (file)
@@ -39,6 +39,7 @@
 #include <cmd_ide.h>
 #include <cmd_disk.h>
 #include <cmd_console.h>
+#include <cmd_pcmcia.h>
 
 #include <cmd_eeprom.h>
 
@@ -132,6 +133,7 @@ done:               ;
 
 cmd_tbl_t cmd_tbl[] = {
        CMD_TBL_GO
+       CMD_TBL_RUN
        CMD_TBL_BOOTM
        CMD_TBL_BOOTP
        CMD_TBL_TFTPB
@@ -150,6 +152,7 @@ cmd_tbl_t cmd_tbl[] = {
        CMD_TBL_BASE
        CMD_TBL_PRINTENV
        CMD_TBL_SETENV
+       CMD_TBL_ASKENV
        CMD_TBL_SAVEENV
        CMD_TBL_PROTECT
        CMD_TBL_FLERASE
@@ -160,6 +163,7 @@ cmd_tbl_t cmd_tbl[] = {
        CMD_TBL_IRQINFO
        CMD_TBL_CONINFO
        CMD_TBL_IDE
+       CMD_TBL_PINIT
        CMD_TBL_LOOP
        CMD_TBL_MTEST
        CMD_TBL_ICACHE
index 977e36f3e213e399531130238d0ad3faa1f6a59f..d7b6dbe2dd521f5333253ec7471519b7cf8541cb 100644 (file)
 #include <ppcboot.h>
 #include <stdarg.h>
 #include <malloc.h>
-#include <devices.h>
+#include <console.h>
 
 static int console_setfile(int file, device_t  *dev)
-{      
+{
     int error = 0;
-    
+
     if (dev == NULL)
        return -1 ;
 
@@ -38,7 +38,7 @@ static int console_setfile(int file, device_t  *dev)
     case stdin:
     case stdout:
     case stderr:
-       // Start new device 
+       // Start new device
        if (dev->start)
        {
            error = dev->start() ;
@@ -46,24 +46,24 @@ static int console_setfile(int file, device_t  *dev)
            if (error < 0)
                break;
        }
-       
+
        // Assign the new device (leaving the existing one started)
        stdio_devices[file] = dev ;
-       
+
        // Update monitor functions (to use the console stuff by other applications)
        switch (file){
            case stdin:
                bd_ptr->bi_mon_fnc->getc = dev->getc ;
                bd_ptr->bi_mon_fnc->tstc = dev->tstc ;
-               break;          
+               break;
            case stdout:
                bd_ptr->bi_mon_fnc->putc = dev->putc ;
                bd_ptr->bi_mon_fnc->puts = dev->puts ;
                bd_ptr->bi_mon_fnc->printf = printf ;
-               break;          
+               break;
        }
        break;
-       
+
     default:   // Invalid file ID
        error = -1 ;
     }
@@ -93,7 +93,7 @@ int   fgetc(int file)
 {
     if (file < MAX_FILES)
        return stdio_devices[file]->getc();
-    
+
     return -1 ;
 }
 
@@ -101,7 +101,7 @@ int ftstc(int file)
 {
     if (file < MAX_FILES)
        return stdio_devices[file]->tstc();
-    
+
     return -1 ;
 }
 
@@ -144,7 +144,7 @@ int getc(void)
     if (idata->relocated)
            // Get from the standard input
            return fgetc (stdin);
-    
+
     // Send directly to the handler
     return serial_getc();
 }
@@ -156,7 +156,7 @@ int tstc(void)
     if (idata->relocated)
            // Test the standard input
            return ftstc (stdin);
-    
+
     // Send directly to the handler
     return serial_tstc();
 }
@@ -168,7 +168,7 @@ void        putc(const char c)
     if (idata->relocated)
        // Send to the standard output
        fputc (stdout, c);
-    else    
+    else
        // Send directly to the handler
        serial_putc(c);
 }
@@ -180,7 +180,7 @@ void        puts(const char *s)
     if (idata->relocated)
        // Send to the standard output
        fputs (stdout, s);
-    else    
+    else
        // Send directly to the handler
        serial_puts(s);
 }
@@ -221,22 +221,22 @@ int console_assign (int file, char *devname)
     default:
        return -1 ;
     }
-       
+
     // Check for valid device name
-    
+
     for(i=1; i<=ListNumItems(devlist); i++)
     {
        device_t        *dev = ListGetPtrToItem (devlist,i) ;
-       
+
        if (strcmp (devname, dev->name) == 0)
        {
-           if (dev->flags & flag)       
+           if (dev->flags & flag)
                return console_setfile(file, dev) ;
-               
+
            return -1 ;
        }
     }
-    
+
     return -1 ;
 }
 
@@ -246,10 +246,10 @@ void      console_init_f (void)
     init_data_t *idata = (init_data_t *)(CFG_INIT_RAM_ADDR + CFG_INIT_DATA_OFFSET);
 
     idata->relocated           = 0 ;           // Use these pointers before relocation
-    idata->bi_mon_fnc.getc     = serial_getc;  
-    idata->bi_mon_fnc.tstc     = serial_tstc;  
-    idata->bi_mon_fnc.putc     = serial_putc;  
-    idata->bi_mon_fnc.puts     = serial_puts;  
+    idata->bi_mon_fnc.getc     = serial_getc;
+    idata->bi_mon_fnc.tstc     = serial_tstc;
+    idata->bi_mon_fnc.putc     = serial_putc;
+    idata->bi_mon_fnc.puts     = serial_puts;
     idata->bi_mon_fnc.printf   = serial_printf;
 }
 
@@ -265,42 +265,46 @@ void      console_init_r (ulong reloc_offset)
 
     // Scan devices looking for input and output devices
     for (i=1; (i<=items) && ((inputdev == NULL) || (outputdev == NULL)); i++)
-    {  
+    {
        device_t        *dev = ListGetPtrToItem(devlist, i) ;
-       
+
        if ((dev->flags & DEV_FLAGS_INPUT) && (inputdev==NULL))
            inputdev = dev ;
 
        if ((dev->flags & DEV_FLAGS_OUTPUT) && (outputdev==NULL))
            outputdev = dev ;
     }
-           
+
     // Initializes output console first
     if (outputdev != NULL)
     {
        console_setfile(stdout, outputdev);
        console_setfile(stderr, outputdev);
     }
-       
+
     // Initializes input console
     if (inputdev != NULL)
        console_setfile(stdin, inputdev);
 
     // Print informations
-    printf("  Input:  ");
+    printf("  In:    ");
     if (stdio_devices[stdin] == NULL)
        printf("No input devices available!\n");
     else
-    {
        printf("%s\n", stdio_devices[stdin]->name);
-    }
-    
-    printf("  Output: ");
+
+    printf("  Out:   ");
     if (stdio_devices[stdout] == NULL)
        printf("No output devices available!\n");
     else
-       printf("%s\n", stdio_devices[stdout]->name);    
-    
+       printf("%s\n", stdio_devices[stdout]->name);
+
+    printf("  Err:   ");
+    if (stdio_devices[stderr] == NULL)
+       printf("No error devices available!\n");
+    else
+       printf("%s\n", stdio_devices[stderr]->name);
+
     // Setting environment variables
     for (i=0; i<3; i++)
        setenv(stdio_names[i], stdio_devices[i]->name);
@@ -309,6 +313,6 @@ void        console_init_r (ulong reloc_offset)
     if ((stdio_devices[stdin] == NULL) && (stdio_devices[stdout] == NULL))
        return ;
 
-    // Set the relocation flag    
+    // Set the relocation flag
     idata->relocated = reloc_offset;
 }
index 41a2836fede8313ad37c4e28a2d0212cc3734e7a..0e2af1b8cd6ecb7610a501d9d00e3ef338cb3f57 100644 (file)
@@ -25,6 +25,7 @@
 #include <stdarg.h>
 #include <malloc.h>
 #include <devices.h>
+#include <i2c.h>
 
 list_t         devlist = 0 ;
 device_t       *stdio_devices[] = {NULL,NULL,NULL} ;
@@ -80,7 +81,9 @@ int devices_init (void)
        eputs("Cannot initialize the list of devices!\n");
        return -1 ;
     }
-    
+#if defined(CONFIG_I2C) && !defined(CONFIG_MPC8260)
+    i2c_init();
+#endif    
 #ifdef CONFIG_VIDEO
     drv_video_init();
 #endif
index eae3ee42390c6fcfa4e5e58290d43165f00e27c8..20c506264b49e63dfc99e3b727834f44037d4f8c 100644 (file)
 environment:
        .globl  env_crc
 env_crc:
+#ifdef  ENV_CRC                // If we are building with computed CRC...
+       .long   ENV_CRC         // ...use it!
+#else
        .long   ~0
+#endif
+       .globl  env_data
+env_data:
 #ifdef CONFIG_BOOTARGS
        .ascii  "bootargs="
        .ascii          CONFIG_BOOTARGS
@@ -69,7 +75,11 @@ env_crc:
        .ascii          MK_STR(CONFIG_SERVERIP)
        .ascii          "\0"
 #endif
-
+#ifdef CFG_AUTOLOAD
+       .ascii  "autoload="
+       .ascii          CFG_AUTOLOAD
+       .ascii          "\0"
+#endif
 
        /* terminate list of environment strings */
        .ascii  "\0"
index 192e16d8edce0ae294afdc4b326adc962c5a7d13..05f2db0f20b9868327fda0e328ae3892fa9501eb 100644 (file)
 #include <command.h>
 
 int  readline (const char *const prompt);
-void run_default_command (int l, cmd_tbl_t *cmdtp, bd_t *bd, int flag);
+void run_command (const char *cmd, cmd_tbl_t *cmdtp, bd_t *bd, int flag);
 
 static char * delete_char (char *buffer, char *p, int *colp, int *np, int plen);
 static int parse_line (char *, char *[]);
-static void run_command (int len, cmd_tbl_t *cmdtp, bd_t *bd, int flag);
 
 char        console_buffer[CFG_CBSIZE];                /* console I/O buffer   */
 
 static char erase_seq[] = "\b \b";             /* erase sequence       */
 static char   tab_seq[] = "        ";          /* used to expand TABs  */
 
+#if (CONFIG_COMMANDS & CFG_CMD_RUN)
+void do_run (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]);
+#endif
+
 /****************************************************************************/
 
 void main_loop(bd_t *bd)
@@ -88,7 +91,7 @@ void main_loop(bd_t *bd)
                if (autoboot) {
                        autoboot = 0;
 
-                       run_default_command (1, cmdtp, bd, flag);
+                       run_command ("bootcmd", cmdtp, bd, flag);
 
                        continue;
                }
@@ -98,7 +101,7 @@ void main_loop(bd_t *bd)
                        printf ("<INTERRUPT>\n");
                        continue;
                }
-               run_command (len, cmdtp, bd, flag);
+               run_command (len ? NULL : "", cmdtp, bd, flag);
        }
 }
 
@@ -407,7 +410,7 @@ static int process_separators (char *s, int len,
 
 #if (CONFIG_COMMANDS & CFG_CMD_BOOTD)
                                /* avoid "bootd" recursion */
-                               if ((len < 0) && (cmdtp->cmd == do_bootd)) {
+                               if ((len == -1) && (cmdtp->cmd == do_bootd)) {
 #ifdef DEBUG_PARSER
                                        printf ("[%s]\n", finaltoken);
 #endif
@@ -415,6 +418,17 @@ static int process_separators (char *s, int len,
                                        return 0;
                                }
 #endif /* CFG_CMD_BOOTD */
+
+#if (CONFIG_COMMANDS & CFG_CMD_RUN)
+                               /* avoid "run" recursion */
+                               if ((len == -2) && (cmdtp->cmd == do_run)) {
+#ifdef DEBUG_PARSER
+                                       printf ("[%s]\n", finaltoken);
+#endif
+                                       printf ("'run' recursion detected\n");
+                                       return 0;
+                               }
+#endif /* CFG_CMD_RUN */
                                /* OK - call function */
                                (cmdtp->cmd) (cmdtp, bd, flag, argc, argv);
 
@@ -441,53 +455,67 @@ static int process_separators (char *s, int len,
 /****************************************************************************/
 
 /*
- * "len" is used to indicate if we're executing normal input
- * (len > 0), just re-executing the last command when the user
- * presses only ENTER (len == 0), or executing the default command
- * (len < 0).
+ * "cmd" is used to indicate if we are executing normal user input
+ * (cmd == NULL), re-executing the last command when the user presses
+ * only ENTER (cmd != NULL && strlen(cmd) == 0), or running a command
+ * stored in an environment variable ("cmd" contains the name of that
+ * variable).
  */
 
-static void run_command (int len,
+void run_command (const char *cmd,
                  cmd_tbl_t *cmdtp, bd_t *bd, int flag)
 {
        static char lastcommand[CFG_CBSIZE] = { 0, };
-       static int  lastlen = 0;
-
-       if (len > 0) {                  /* Process a new command                */
-               memcpy (lastcommand, console_buffer, len);
-               lastcommand[len] = 0;
-               lastlen = len;
-       } else if (len < 0) {           /* Process default command              */
-               char *str = getenv ("bootcmd");
-
-               if (!str)
-                       return;
-
-               strcpy (lastcommand, str);
-               lastlen = len;
-       } else {                        /* Process last command (len = 0)       */
-               /* Check if we have a valid command stored */
-               if (lastcommand[0] == 0)
-                       return;
-
-               flag |= CMD_FLAG_REPEAT;
-       }
+       static const char *last_cmd;
+
+       if (cmd) {
+               if (*cmd) {     /* got the name of a variable to run */
+                       char *str = getenv ((char *)cmd);
+
+                       if (!str)
+                               return;
 
+                       strcpy (lastcommand, str);
+                       last_cmd = cmd;
+               } else {        /* re-executing previous command */
+
+                       /* Check if we have a valid command stored */
+                       if (lastcommand[0] == 0)
+                               return;
+
+                       flag |= CMD_FLAG_REPEAT;
+                       last_cmd = "";
+               }
+       } else {                /* cmd == NULL: process user input */
+               strcpy (lastcommand, console_buffer);
+               last_cmd = NULL;
+       }
 #ifdef DEBUG_PARSER
-       printf ("[RUN_COMMAND] lastlen=%d -> %s\n", lastlen, lastcommand);
+       printf ("[RUN_COMMAND] last_cmd=\"%s\" -> %s\n",
+               last_cmd ? last_cmd : "NULL", lastcommand);
 #endif
        /* Process separators and check for non-valid repeatable commands       */
-       if (process_separators (lastcommand, lastlen, cmdtp, bd, flag) == 0) {
+       if (process_separators (lastcommand, strlen(lastcommand),
+                               cmdtp, bd, flag) == 0) {
                lastcommand[0] = 0;
-               lastlen = 0;
+               last_cmd = "";
        }
 }
 
 /****************************************************************************/
 
-void run_default_command (int l, cmd_tbl_t *cmdtp, bd_t *bd, int flag)
+#if (CONFIG_COMMANDS & CFG_CMD_RUN)
+void do_run (cmd_tbl_t * cmdtp, bd_t * bd, int flag, int argc, char *argv[])
 {
-       run_command(-1, cmdtp, bd, flag) ;
-}
+       int i;
 
-/****************************************************************************/
+       if (argc < 2) {
+               printf ("Usage:\n%s\n", cmdtp->usage);
+               return;
+       }
+
+       for (i=1; i<argc; ++i) {
+               run_command (argv[i], cmdtp, bd, flag);
+       }
+}
+#endif
index 85acc65b0eccc179286dcc1b940f116814461c03..ceeda077596177cec221d369f386918b43b08e01 100644 (file)
@@ -75,18 +75,32 @@ int checkdcache(void)
 
 void do_reset (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
 {
-    ulong msr, addr;
-
-
-    /* Interrupts and MMU off */
-    __asm__ ("mtspr    81, 0
-          mfmsr    %0": "=r"(msr) : );
-    msr &= ~0x1030;
-    __asm__ ("mtmsr    %0"::"r"(msr) );
-
-    /* jump to reset vector*/
-    addr = 0xfff0100;
-    ((void (*)(void ))addr)();
+       ulong msr, addr;
+
+       /* Interrupts and MMU off */
+       __asm__ ("mtspr    81, 0" );
+
+       /* Interrupts and MMU off */
+       __asm__ __volatile__ ("mfmsr    %0" : "=r"(msr) : );
+       msr &= ~0x1030;
+       __asm__ __volatile__ ("mtmsr    %0" : : "r"(msr) );
+
+       /*
+        * Trying to execute the next instruction at a non-existing address
+        * should cause a machine check, resulting in reset
+        */
+#ifdef CFG_RESET_ADDRESS
+       addr = CFG_RESET_ADDRESS;
+#else
+       /*
+        * note: when CFG_MONITOR_BASE points to a RAM address, CFG_MONITOR_BASE
+        * - sizeof (ulong) is usually a valid address. Better pick an address
+        * known to be invalid on your system and assign it to CFG_RESET_ADDRESS.
+        * "(ulong)-1" used to be a good choice for many systems...
+        */
+       addr = CFG_MONITOR_BASE - sizeof (ulong);
+#endif
+       ((void (*)(void ))addr)();
 
 }
 
index 7db546a601e54bb75101bdfdb07f86f00853f4cb..e5b4f14968454949c20d27195990796e8dc0e5f4 100644 (file)
@@ -155,20 +155,20 @@ do_reset(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
 
        /* Interrupts and MMU off */
        __asm__ __volatile__ ("mfmsr    %0" : "=r"(msr) : );
-       msr &= ~(MSR_EE|MSR_IR|MSR_DR);
+       msr &= ~(MSR_ME|MSR_EE|MSR_IR|MSR_DR);
        __asm__ __volatile__ ("mtmsr    %0" : : "r"(msr) );
 
        /*
-       * Trying to execute the next instruction at a non-existing address
-       * should cause a machine check, resulting in reset
-       */
-#if 0
-       addr = (ulong)-1;
+        * Trying to execute the next instruction at a non-existing address
+        * should cause a machine check, resulting in reset
+        */
+#ifdef CFG_RESET_ADDRESS
+       addr = CFG_RESET_ADDRESS;
 #else
        /*
-        * -1 was actually a valid address on my system, so I got a
-        * Software Emulation exception instead of a Machine Check
-        * exception. Let's try to pick a better address...
+        * note: when CFG_MONITOR_BASE points to a RAM address, CFG_MONITOR_BASE
+        * - sizeof (ulong) is usually a valid address. Better pick an address
+        * known to be invalid on your system and assign it to CFG_RESET_ADDRESS.
         */
        addr = CFG_MONITOR_BASE - sizeof (ulong);
 #endif
index cdf95c2cfffda1c4a8690b2e71cdd5b458fef7f0..09fc323312f5edb441825489934c8affd83eb55b 100644 (file)
@@ -1,89 +1,70 @@
 #include <ppcboot.h>
 #include <commproc.h>
 
-void m8xx_cpm_init(uint base, uint size)
+#ifdef CFG_ALLOC_DPRAM
+
+void dpram_init(void)
 {
     /* Pointer to initial global data area */
     init_data_t *idata = (init_data_t *)(CFG_INIT_RAM_ADDR + CFG_INIT_DATA_OFFSET);
 
     /* Reclaim the DP memory for our use. */
-    idata->dp_alloc_base = base;
-    idata->dp_alloc_top  = idata->dp_alloc_base + size;
+    idata->dp_alloc_base = CPM_DATAONLY_BASE ;
+    idata->dp_alloc_top  = idata->dp_alloc_base + CPM_DATAONLY_SIZE ;
 }
 
 /* Allocate some memory from the dual ported ram.  We may want to
  * enforce alignment restrictions, but right now everyone is a good
  * citizen.
  */
-uint m8xx_cpm_dpalloc(uint size)
+uint dpram_alloc(uint size)
 {
     /* Pointer to initial global data area */
     init_data_t *idata = (init_data_t *)(CFG_INIT_RAM_ADDR + CFG_INIT_DATA_OFFSET);
-    uint       retloc;
+    uint       addr = idata->dp_alloc_base ;
 
     if ((idata->dp_alloc_base + size) >= idata->dp_alloc_top)
        return(CPM_DP_NOSPACE);
 
-    retloc = idata->dp_alloc_base;
     idata->dp_alloc_base += size;
 
-#if 0
-    serial_printf("Requested %d bytes\n", size);
-    serial_printf("DPRAM BASE=%08x DPRAM TOP=%08x\n",
-       idata->dp_alloc_base,
-       idata->dp_alloc_top);
-    serial_printf("Returned %08x\n", retloc);
-#endif
-
-    return(retloc);
+    return addr;
 }
 
-uint m8xx_cpm_dpbase(void)
+uint dpram_base(void)
 {
     /* Pointer to initial global data area */
     init_data_t *idata = (init_data_t *)(CFG_INIT_RAM_ADDR + CFG_INIT_DATA_OFFSET);
-    uint retloc = idata->dp_alloc_base;
-
-#if 0
-    serial_printf("Returned %08x\n", retloc);
-#endif
-    return  retloc;
+    return idata->dp_alloc_base ;
 }
 
 /* Allocate some memory from the dual ported ram.  We may want to
  * enforce alignment restrictions, but right now everyone is a good
  * citizen.
  */
-uint m8xx_cpm_dpalloc_align(uint size, uint align)
+uint dpram_alloc_align(uint size, uint align)
 {
     /* Pointer to initial global data area */
     init_data_t *idata = (init_data_t *)(CFG_INIT_RAM_ADDR + CFG_INIT_DATA_OFFSET);
-    uint       retloc, mask = align -1;
+    uint       addr, mask = align -1 ;
 
-    if ((idata->dp_alloc_base + size) >= idata->dp_alloc_top)
-       return(CPM_DP_NOSPACE);
+    addr = (idata->dp_alloc_base + mask) & ~mask;
 
-    retloc = (idata->dp_alloc_base + mask) & ~mask;
-    idata->dp_alloc_base += size;
+    if ((addr + size) >= idata->dp_alloc_top)
+       return(CPM_DP_NOSPACE);
 
-#if 0
-    serial_printf("Requested %d bytes\n", size);
-    serial_printf("DPRAM BASE=%08x DPRAM TOP=%08x\n",
-       idata->dp_alloc_base,
-       idata->dp_alloc_top);
-    serial_printf("Returned %08x\n", retloc);
-#endif
+    idata->dp_alloc_base = addr + size;
 
-    return(retloc);
+    return addr;
 }
 
-uint m8xx_cpm_dpbase_align(uint align)
+uint dpram_base_align(uint align)
 {
     /* Pointer to initial global data area */
     init_data_t *idata = (init_data_t *)(CFG_INIT_RAM_ADDR + CFG_INIT_DATA_OFFSET);
-    uint mask = align-1, retloc = (idata->dp_alloc_base + mask) & ~mask;
-#if 0
-    serial_printf("Returned %08x\n", retloc);
-#endif
-    return  retloc;
+    uint mask = align-1 ;
+    
+    return (idata->dp_alloc_base + mask) & ~mask;
 }
+
+#endif /* CFG_ALLOC_DPRAM */
index 35796f5f34b84ac88274c5db7fcec1698ef749f5..386e057f3ba166be318a5863bc0b65316e8ab9c4 100644 (file)
@@ -338,13 +338,14 @@ void do_reset (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
        * Trying to execute the next instruction at a non-existing address
        * should cause a machine check, resulting in reset
        */
-#if 0
-       addr = (ulong)-1;
+#ifdef CFG_RESET_ADDRESS
+       addr = CFG_RESET_ADDRESS;
 #else
        /*
-        * -1 was actually a valid address on my system, so I got a
-        * Software Emulation exception instead of a Machine Check
-        * exception. Let's try to pick a better address...
+        * note: when CFG_MONITOR_BASE points to a RAM address, CFG_MONITOR_BASE
+        * - sizeof (ulong) is usually a valid address. Better pick an address
+        * known to be invalid on your system and assign it to CFG_RESET_ADDRESS.
+        * "(ulong)-1" used to be a good choice for many systems...
         */
        addr = CFG_MONITOR_BASE - sizeof (ulong);
 #endif
index a2a8e016349558ee76f1e60872cf9f7f2ae5a2d3..db99dc2781d380a32ba0059eb732e5164597e326 100644 (file)
@@ -34,8 +34,6 @@ static void mii_discover_phy(void);
 
 #if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(FEC_ENET)
 
-#define BD_OFFSET 0x860 /* offset to begin of DPRAM + allocation for serial IF*/
-
 /* Ethernet Transmit and Receive Buffers */
 #define DBUF_LENGTH  1520
 
@@ -264,8 +262,11 @@ int eth_init (bd_t * bd)
        txIdx = 0;
 
        if (!rtx) {
-               rtx = (RTXBD *) (immr->im_cpm.cp_dpmem +
-                                m8xx_cpm_dpalloc_align(sizeof(RTXBD),8));
+#ifdef CFG_ALLOC_DPRAM
+           rtx = (RTXBD *) (immr->im_cpm.cp_dpmem + dpram_alloc_align(sizeof(RTXBD),8));
+#else
+           rtx = (RTXBD *) (immr->im_cpm.cp_dpmem + CPM_FEC_BASE);
+#endif
        }
        /*
         * Setup Receiver Buffer Descriptors (13.14.24.18)
index 597e5be55175be3054217af7bca253459ceb9c9f..5af32860d1cd9b68251bcedfa84b30facd725910 100644 (file)
 #include <commproc.h>
 #include <i2c.h>
 
-#define DEBUG_STEP     0
-#define PRINTD(x)      if (DEBUG_STEP) printf(x);
+// **********************************
+// ** DEBUG MACROS
+// **********************************
+
+//#define CONFIG_I2C_DEBUG
 #define DELAY_US       100000  // us to wait before checking the I2c
 
-//#define DEBUG_I2C_RATE       0       // To show selected I2C bus rate
+// **********************************
+// ** CONSTANTS
+// **********************************
 
-#define I2C_PRAM 0
 #define CPCR_FLAG 0x01
 #define I2C_CPCR_CMD ( ( 0<<(15-7) ) | ( 1 << (15-11) ) | CPCR_FLAG )
 #define I2C_RX_LEN 128 /* Receive buffer length */
 #define RXBD_E 0x8000  /* Receive buffer is empty and can be used by CPM */
 #define RXBD_W 0x2000  /* Wrap, last receive buffer in buffer circle */
 
-typedef struct I2C_BD
-{
-  unsigned short status;
-  unsigned short length;
-  unsigned char *addr;
-} I2C_BD;
+// **********************************
+// ** VARIABLES
+// **********************************
+
+#ifdef CFG_ALLOC_DPRAM
+static unsigned char *rxbuf, *txbuf;
+#else
+static unsigned char rxbuf[I2C_RX_LEN], *txbuf[I2C_TX_LEN];
+#endif
 
+static cbd_t *rxbd, *txbd;     
 
-static I2C_BD *rxbd, *txbd;    /* buffer descriptors are defined */
-                               /* globally for this file */
+volatile i2c8xx_t      *i2c;
+volatile cbd_t         *tbdf, *rbdf;
+volatile iic_t         *iip;
 
-static unsigned char
-    rxbuf[I2C_RX_LEN],
-    txbuf[I2C_TX_LEN];
+// **********************************
+// ** FUNCTIONS
+// **********************************
 
 // Returns the best value of I2BRG to meet desired clock speed of I2C with
 // input parameters (clock speed, filter, and predivider value).
 // It returns computer speed value and the difference between it and desired
 // speed.
-static inline int i2c_roundrate (int hz, int speed, int filter, int modval,
+static inline int i2c_roundrate (int hz, int speed, int filter, int modval, 
                                    int *brgval, int *totspeed)
 {
     int moddiv = 1 << (5-(modval & 3)),
@@ -76,14 +85,14 @@ static inline int i2c_roundrate (int hz, int speed, int filter, int modval,
     brgdiv = hz / (moddiv * speed);
 
     *brgval = brgdiv / 2 - 3 - 2*filter ;
-
+    
     if ((*brgval < 0) || (*brgval > 255))
        return -1 ;
-
+    
     brgdiv = 2 * (*brgval + 3 + 2 * filter) ;
     div  = moddiv * brgdiv ;
     *totspeed = hz / div ;
-
+        
     return  0;
 }
 
@@ -99,16 +108,18 @@ static int i2c_setrate (int hz, int speed)
        bestspeed_modval=0,
        bestspeed_filter=0,
        totspeed,
-       filter=0;       // Use this fixed value
+       filter=0;       // Use this fixed value 'cause the filter has a bug!
 
-//    for (filter = 0; filter < 2; filter++)
+#if 0
+    for (filter = 0; filter < 2; filter++)
+#endif
        for (modval = 0; modval < 4; modval++)
-           if (i2c_roundrate ( hz, speed,
-                               filter, modval,
+           if (i2c_roundrate ( hz, speed, 
+                               filter, modval, 
                                &brgval, &totspeed) == 0)
            {
                int diff = speed - totspeed ;
-
+               
                if ((diff >= 0) && (diff < bestspeed_diff))
                {
                    bestspeed_diff      = diff ;
@@ -118,251 +129,248 @@ static int i2c_setrate (int hz, int speed)
                }
            }
 
-#ifdef DEBUG_I2C_RATE
-    printf("Best is:\n");
-    printf("\nCPU=%dhz RATE=%d F=%d I2MOD=%08x I2BRG=%08x DIFF=%dhz",
-           hz, speed,
-           bestspeed_filter, bestspeed_modval, bestspeed_brgval,
-           bestspeed_diff);
-#endif
-    i2c->i2c_i2mod |= ((bestspeed_modval & 3) << 1) | (bestspeed_filter << 3);
+    i2c->i2c_i2mod |= ((bestspeed_modval & 3) << 1) | (bestspeed_filter << 3); 
     i2c->i2c_i2brg = bestspeed_brgval & 0xff;
 
-#ifdef DEBUG_I2C_RATE
+#ifdef CONFIG_I2C_DEBUG
     printf("i2mod=%08x i2brg=%08x\n", i2c->i2c_i2mod, i2c->i2c_i2brg);
 #endif
 
     return 1 ;
 }
 
-volatile i2c8xx_t      *i2c;
-volatile cbd_t         *tbdf, *rbdf;
-volatile iic_t         *iip;
-
-void i2c_init(int speed)
+int i2c_setspeed (int speed)
 {
-       init_data_t *idata = (init_data_t *)(CFG_INIT_RAM_ADDR + CFG_INIT_DATA_OFFSET);
-        immap_t        *immap  = (immap_t *)CFG_IMMR ;
-       volatile cpm8xx_t       *cp;
-
-       /* Get pointer to Communication Processor
-        * and to internal registers
-        */
-       cp = (cpm8xx_t *)&immap->im_cpm ;
-       iip = (iic_t *)&cp->cp_dparam[PROFF_IIC];
-       i2c = (i2c8xx_t *)&(immap->im_i2c);
-
-       // Disable relocation
-       iip->iic_rpbase = 0 ;
-
-       /* Initialize Port B I2C pins.
-        */
-       cp->cp_pbpar |= 0x00000030;
-       cp->cp_pbdir |= 0x00000030;
-       cp->cp_pbodr |= 0x00000030;
-
-       /* Disable interrupts.
-        */
-       i2c->i2c_i2mod = 0;
-       i2c->i2c_i2cmr = 0;
-       i2c->i2c_i2cer = 0xff;
-
-       // Set the I2C BRG Clock division factor from desired i2c rate
-       // and current CPU rate (we assume sccr dfbgr field is 0;
-       // divide BRGCLK by 1)
-
-       PRINTD("\n[I2C  ] Setting rate...");
-       i2c_setrate (idata->cpu_clk, speed) ;
-
-       /* Set I2C controller in master mode
-        */
-       i2c->i2c_i2com = 0x01;
-
-       // Set SDMA bus arbitration level to 5 (SDCR)
-       immap->im_siu_conf.sc_sdcr = 0x0001 ;
+    init_data_t *idata = (init_data_t *)(CFG_INIT_RAM_ADDR + CFG_INIT_DATA_OFFSET);
 
-       /* Initialize Tx/Rx parameters.*/
-#if 0
-        iip->iic_rbptr = iip->iic_rbase = BD_IIC_START ;//2018 ;
-       iip->iic_tbptr = iip->iic_tbase = iip->iic_rbase + sizeof(I2C_BD) ; //2020 ;
+    // Set the I2C BRG Clock division factor from desired i2c rate
+    // and current CPU rate (we assume sccr dfbgr field is 0; 
+    // divide BRGCLK by 1)
+
+    debug("\n[I2C  ] Setting rate...");
+
+    i2c_setrate (idata->cpu_clk , speed) ;
+    
+    return ERROR_I2C_NONE ;
+}
+
+int i2c_init(void)
+{
+    immap_t    *immap  = (immap_t *)CFG_IMMR ;
+    volatile cpm8xx_t  *cp;
+
+    /* Get pointer to Communication Processor
+     * and to internal registers
+     */
+    cp = (cpm8xx_t *)&immap->im_cpm ;
+    iip = (iic_t *)&cp->cp_dparam[PROFF_IIC];
+    i2c = (i2c8xx_t *)&(immap->im_i2c);
+
+    // Disable relocation
+    iip->iic_rpbase = 0 ;      
+
+    /* Initialize Port B I2C pins. */
+    cp->cp_pbpar |= 0x00000030;
+    cp->cp_pbdir |= 0x00000030;
+    cp->cp_pbodr |= 0x00000030;
+       
+    /* Disable interrupts. */
+    i2c->i2c_i2mod = 0;
+    i2c->i2c_i2cmr = 0;
+    i2c->i2c_i2cer = 0xff;
+
+    /* Set I2C controller in master mode */
+    i2c->i2c_i2com = 0x01;
+
+    // Set SDMA bus arbitration level to 5 (SDCR)
+    immap->im_siu_conf.sc_sdcr = 0x0001 ;
+
+#ifdef CFG_ALLOC_DPRAM
+    /* Initialize Tx/Rx parameters.*/
+    iip->iic_rbptr = iip->iic_rbase = dpram_alloc_align(sizeof(cbd_t),8) ;
+    iip->iic_tbptr = iip->iic_tbase = dpram_alloc_align(sizeof(cbd_t),8) ;
+
+    rxbd = (cbd_t *)((unsigned char *)&cp->cp_dpmem[iip->iic_rbase]);
+    txbd = (cbd_t *)((unsigned char *)&cp->cp_dpmem[iip->iic_tbase]);
+
+    // Alloc rx and tx buffers into DPRAM
+    rxbuf = (unsigned char *)&cp->cp_dpmem[dpram_alloc(I2C_RX_LEN)] ;
+    txbuf = (unsigned char *)&cp->cp_dpmem[dpram_alloc(I2C_TX_LEN)] ;
 #else
-       iip->iic_rbptr = iip->iic_rbase = m8xx_cpm_dpbase_align(8) ;
-        iip->iic_tbptr = iip->iic_tbase = iip->iic_rbase + sizeof(I2C_BD);
-#endif
-       rxbd = (I2C_BD *)((unsigned char *)&cp->cp_dpmem[iip->iic_rbase]);
-       txbd = (I2C_BD *)((unsigned char *)&cp->cp_dpmem[iip->iic_tbase]);
-
-#if DEBUG_STEP
-       printf("rbase = %04x\n", iip->iic_rbase);
-       printf("tbase = %04x\n", iip->iic_tbase);
-       printf("Rxbd1=%08x\n", (int)rxbd);
-       printf("Txbd1=%08x\n", (int)txbd);
-#endif
+    {
+       ulong base = CPM_I2C_BASE ;
+       
+       /* Initialize Tx/Rx parameters.*/
+       iip->iic_rbptr = iip->iic_rbase = base ; base += sizeof(cbd_t) ;
+       iip->iic_tbptr = iip->iic_tbase = base ; base += sizeof(cbd_t) ;
 
-        cp->cp_cpcr = mk_cr_cmd(CPM_CR_CH_I2C, CPM_CR_INIT_TRX) | CPM_CR_FLG;
-       while (cp->cp_cpcr & CPM_CR_FLG);
+       rxbd = (cbd_t *)((unsigned char *)&cp->cp_dpmem[iip->iic_rbase]);
+       txbd = (cbd_t *)((unsigned char *)&cp->cp_dpmem[iip->iic_tbase]);
+    }
+#endif
 
-       /* Set big endian byte order
-        */
-       iip->iic_tfcr = 0x15;
-       iip->iic_rfcr = 0x15;
+#ifdef CONFIG_I2C_DEBUG
+    printf("Rxbd  = %08x\n", (int)rxbd);
+    printf("Txbd  = %08x\n", (int)txbd);
+    printf("Rxbuf = %08x (%d)\n", (int)rxbuf, I2C_RX_LEN);
+    printf("Txbuf = %08x (%d)\n", (int)txbuf, I2C_TX_LEN);
+#endif
 
-       /* Set maximum receive size.
-        */
-       iip->iic_mrblr = 128;
+    cp->cp_cpcr = mk_cr_cmd(CPM_CR_CH_I2C, CPM_CR_INIT_TRX) | CPM_CR_FLG;
+    while (cp->cp_cpcr & CPM_CR_FLG);
 
-       PRINTD("\n[I2C  ] Clearing the buffer memory...");
+    /* Set big endian byte order */
+    iip->iic_tfcr = 0x15;
+    iip->iic_rfcr = 0x15;
 
-       // Clear the buffer memory
-       memset ((char *)rxbuf, I2C_RX_LEN, 0);
-       memset ((char *)txbuf, I2C_TX_LEN, 0);
+    /* Set maximum receive size. */
+    iip->iic_mrblr = I2C_RX_LEN;
 
-       PRINTD("\n[I2C  ] Initializing BD's...");
+    debug("\n[I2C  ] Clearing the buffer memory...");
 
-       // Initialize the BD's
+    // Clear the buffer memory 
+    memset ((char *)rxbuf, I2C_RX_LEN, 0);
+    memset ((char *)txbuf, I2C_TX_LEN, 0);
+    
+    debug("\n[I2C  ] Initializing BD's...");
 
-       // Rx: Wrap, no interrupt, empty
-       rxbd->addr = rxbuf;
-       rxbd->status = 0xa800;
+    // Initialize the BD's 
+  
+    // Rx: Wrap, no interrupt, empty 
+    rxbd->cbd_bufaddr = (ulong)rxbuf;
+    rxbd->cbd_sc = 0xa800;
 
-       // Tx: Wrap, no interrupt, not ready to send, last
-       txbd->addr = txbuf;
-       txbd->status = 0x2800;
+    // Tx: Wrap, no interrupt, not ready to send, last 
+    txbd->cbd_bufaddr = (ulong)txbuf;
+    txbd->cbd_sc = 0x2800;
+       
+    // Clear events and interrupts
+    i2c->i2c_i2cer = 0xff ;
+    i2c->i2c_i2cmr = 0 ;
 
-       // Clear events and interrupts
-       i2c->i2c_i2cer = 0xff ;
-       i2c->i2c_i2cmr = 0 ;
+    return ERROR_I2C_NONE ;
 }
 
-void i2c_send( unsigned char address,
+int i2c_send( unsigned char address,
               unsigned char secondary_address,
               int enable_secondary,
               unsigned short size, unsigned char dataout[] )
 {
-  int i,j;
-
-  if( size > I2C_TX_LEN )  /* Trying to send message larger than BD */
-    return;
-
-  PRINTD("\n[I2C  ] Waiting for transmit buffer empty...");
-  while( txbd->status & TXBD_R ) ; // Loop until previous data sent
-
-  PRINTD("\n[I2C  ] Formatting addresses...");
-  if( enable_secondary ) /* Device has an internal address */
-  {
-    txbd->length = size + 2;  /* Length of message plus dest addresses */
-    txbd->addr[0] = address;
-    txbd->addr[0] &= ~(0x01);
-    txbd->addr[1] = secondary_address;
-    i = 2;
-  }
-  else
-  {
-    txbd->length = size + 1;  /* Length of message plus dest address */
-    txbd->addr[0] = address;  /* Write destination address to BD */
-    txbd->addr[0] &= ~(0x01);  /* Set address to write */
-    i = 1;
-  }
-
-#if DEBUG_STEP
-    printf("Length = %d addr[0] = %08x addr[1] = %08x\n",
-       txbd->length,
-       txbd->addr[0],
-       txbd->addr[1]);
+    unsigned char *buffer = (unsigned char *)txbd->cbd_bufaddr ;
+    int i,j;
+
+    if( size > I2C_TX_LEN )  /* Trying to send message larger than BD */
+       return ERROR_I2C_LENGTH; 
+
+    debug("\n[I2C  ] Waiting for transmit buffer empty...");
+    while( txbd->cbd_sc & TXBD_R ) ; // Loop until previous data sent 
+  
+    debug("\n[I2C  ] Formatting addresses...");  
+    if( enable_secondary ) /* Device has an internal address */
+    {
+       txbd->cbd_datlen = size + 2;  /* Length of message plus dest addresses */
+       buffer[0] = address;
+       buffer[0] &= ~(0x01);
+       buffer[1] = secondary_address;
+       i = 2;
+    }
+       else
+    {
+       txbd->cbd_datlen = size + 1;  /* Length of message plus dest address */
+       buffer[0] = address;  /* Write destination address to BD */
+       buffer[0] &= ~(0x01);  /* Set address to write */
+       i = 1;
+    }
+  
+#ifdef CONFIG_I2C_DEBUG
+    printf("Length = %d addr[0] = %08x addr[1] = %08x\n", 
+       txbd->cbd_datlen, 
+       buffer[0],
+       buffer[1]);
 #endif
+  
+    /* Copy data to send into buffer */
+    debug("\n[I2C  ] Copying data into buffer...");  
+    for( j = 0; j < size; i++, j++ )
+       buffer[ i ] = dataout[j];
+    
+    /* Ready to Transmit, wrap, last */    
+    debug("\n[I2C  ] Waiting to transmit...");  
+    txbd->cbd_sc = txbd->cbd_sc | TXBD_R | TXBD_W | TXBD_L | TXBD_S ;
+    
+    /* Enable I2C */
+    debug("\n[I2C  ] Enabling I2C...");
+    i2c->i2c_i2mod |= 1;  
+
+    /* Transmit */
+    debug("\n[I2C  ] Transmitting...");  
+    i2c->i2c_i2com |= 0x80;
 
-  /* Copy data to send into buffer */
-
- PRINTD("\n[I2C  ] Copying data into buffer...");
-
-  for( j = 0; j < size; i++, j++ )
-    txbd->addr[ i ] = dataout[j];
-
-  /* Ready to Transmit, wrap, last */
-
-  PRINTD("\n[I2C  ] Waiting to transmit...");
-
-  txbd->status = txbd->status | TXBD_R | TXBD_W | TXBD_L | TXBD_S ;
-
-  /* Enable I2C */
-
-  PRINTD("\n[I2C  ] Enabling I2C...");
-  i2c->i2c_i2mod |= 1;
-
-  /* Transmit */
-  PRINTD("\n[I2C  ] Transmitting...");
-  i2c->i2c_i2com |= 0x80;
-
-  PRINTD("\n[I2C  ] Waiting for transmit buffer empty...");
-  udelay (DELAY_US) ;  // This is a patch!
-
-  while( txbd->status & TXBD_R );
-
-  /* Turn off I2C */
-  PRINTD("\n[I2C  ] Turning off I2C...");
-  i2c->i2c_i2mod &= (~1);
-
-#if DEBUG_STEP
- printf("\nTXBD->CBD_SC=%08x\n", txbd->status);
+    debug("\n[I2C  ] Waiting for transmit buffer empty...");
+    udelay (DELAY_US) ;        // Why without this it doesnt work?
+    while( txbd->cbd_sc & TXBD_R );
+  
+    /* Turn off I2C */
+    debug("\n[I2C  ] Turning off I2C...");
+    i2c->i2c_i2mod &= (~1);
 
- if (txbd->status & 4)
-    while(1);
-#endif
+    return ERROR_I2C_NONE ;
 }
 
-void i2c_receive(unsigned char address,
+int i2c_receive(unsigned char address,
                unsigned char secondary_address,
-               int enable_secondary,
+               int enable_secondary,                           
                 unsigned short size_to_expect, unsigned char datain[] )
 {
-  int i, j;
-
-  if( size_to_expect > I2C_RX_LEN )
-       return;  /* Expected to receive too much */
-
-  /* Turn on I2C */
-  i2c->i2c_i2mod |= 0x01;
-
-  /* Setup TXBD for destination address */
-  if( enable_secondary )
-  {
-    txbd->length = 2;
-    txbd->addr[0] = address | 0x00;   /* Write data */
-    txbd->addr[1] = secondary_address;  /* Internal address */
-    txbd->status = TXBD_R;
-
-    /* Reset the rxbd */
-    rxbd->status = RXBD_E | RXBD_W;
-
-    /* Begin transmission */
-    i2c->i2c_i2com |= 0x80;
-
-  }
-  else
-  {
-    txbd->length = 1 + size_to_expect;
-    txbd->addr[0] = address | 0x01;
-
-
-    /* Buffer ready to transmit, wrap, loop */
-    txbd->status |= TXBD_R | TXBD_W | TXBD_L;
-
-    /* Reset the rxbd */
-    rxbd->status = RXBD_E | RXBD_W;
-
-    /* Begin transmission */
-    i2c->i2c_i2com |= 0x80;
-
-    while( txbd->status & TXBD_R);  /* Loop until transmit completed */
-  }
-
-  while( rxbd->status & RXBD_E);  /* Wait until receive is finished */
-
-  for( i= 0, j = 0; j < size_to_expect; j++, i++ )  /* Copy data to datain[] */
-    datain[j] = rxbd->addr[i];
-
-  /* Turn off I2C */
-  i2c->i2c_i2mod &= (~1);
+    unsigned char *buffer = (unsigned char *)txbd->cbd_bufaddr ;
+    int i, j;
+  
+    if( size_to_expect > I2C_RX_LEN )
+       return ERROR_I2C_LENGTH;  /* Expected to receive too much */
+  
+    /* Turn on I2C */
+    i2c->i2c_i2mod |= 0x01;
+    
+    /* Setup TXBD for destination address */   
+    if( enable_secondary )
+    {
+       txbd->cbd_datlen = 2; 
+       buffer[0] = address | 0x00;   /* Write data */
+       buffer[1] = secondary_address;  /* Internal address */
+       txbd->cbd_sc = TXBD_R;
+      
+       /* Reset the rxbd */
+       rxbd->cbd_sc = RXBD_E | RXBD_W;
+  
+       /* Begin transmission */
+       i2c->i2c_i2com |= 0x80;
+    } 
+       else
+    {
+       txbd->cbd_datlen = 1 + size_to_expect;
+       buffer[0] = address | 0x01;
+    
+       /* Buffer ready to transmit, wrap, loop */
+       txbd->cbd_sc |= TXBD_R | TXBD_W | TXBD_L;
+
+       /* Reset the rxbd */
+       rxbd->cbd_sc = RXBD_E | RXBD_W;
+  
+       /* Begin transmission */
+       i2c->i2c_i2com |= 0x80;
+  
+       while( txbd->cbd_sc & TXBD_R);  /* Loop until transmit completed */
+    }
+  
+    while( rxbd->cbd_sc & RXBD_E);  /* Wait until receive is finished */
+  
+    for( i= 0, j = 0; j < size_to_expect; j++, i++ )  /* Copy data to datain[] */
+       datain[j] = buffer[i];
+  
+    /* Turn off I2C */
+    i2c->i2c_i2mod &= (~1);
+
+    return ERROR_I2C_NONE ;
 }
 
-#endif /* CONFIG_I2C */
+#endif
index ceab3de7c5b2d9d0d155bc510c0811b7111111a6..8b125ec4021d90dc504b2bac25052005a3c6adcf 100644 (file)
 
 #if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(SCC_ENET)
 
-#if 0
-#define BD_OFFSET 0x860 /* offset to begin of DPRAM + allocation for serial IF*/
-#endif
-
 /* Ethernet Transmit and Receive Buffers */
 #define DBUF_LENGTH  1520
 
@@ -68,7 +64,6 @@ typedef volatile struct CommonBufferDescriptor {
 
 static RTXBD *rtx;
 
-
 int eth_send(volatile void *packet, int length)
 {
        int i, j=0;
@@ -183,12 +178,11 @@ int eth_init(bd_t *bis)
     rxIdx = 0;
     txIdx = 0;
 
-    /* assign static pointer to BD area */
-#if 0
-    rtx = (RTXBD *) (immr->im_cpm.cp_dpmem + BD_OFFSET);
-#else
+#ifdef CFG_ALLOC_DPRAM
     rtx = (RTXBD *) (immr->im_cpm.cp_dpmem +
-                    m8xx_cpm_dpalloc_align(sizeof(RTXBD), 8));
+                    dpram_alloc_align(sizeof(RTXBD), 8));
+#else
+    rtx = (RTXBD *) (immr->im_cpm.cp_dpmem + CPM_SCC_BASE);
 #endif /* 0 */
 
 #if (defined(PA_ENET_RXD) && defined(PA_ENET_TXD))
index 16840f772983c611a7bd75b473213f0f30752337..89e24428d0690d845c628e9f798f18a6fb20e002 100644 (file)
@@ -85,7 +85,7 @@ serial_init (ulong cpu_clock, int baudrate)
 #if (!defined(CONFIG_8xx_CONS_SMC1)) && (defined(CONFIG_MPC823) || defined(CONFIG_MPC850))
        volatile iop8xx_t *ip = (iop8xx_t *)&(im->im_ioport);
 #endif
-       uint    dpaddr, dpsize, size;
+       uint    dpaddr;
 
        /* initialize pointers to SMC */
 
@@ -149,15 +149,16 @@ serial_init (ulong cpu_clock, int baudrate)
         * the buffer descriptors.
         */
 
-       dpaddr = CPM_DATAONLY_BASE;
-       dpsize = CPM_DATAONLY_SIZE;
-
-#if defined(CONFIG_MBX)
-       board_serial_init();
-#endif /* CONFIG_MBX */
+#ifdef CFG_ALLOC_DPRAM
+       dpaddr = dpram_alloc_align (sizeof(cbd_t)*2 + 2, 8) ;
+#else
+       dpaddr = CPM_SERIAL_BASE ;
+#endif
 
-       /* Set the physical address of the host memory buffers in
-        * the buffer descriptors.
+       /* Allocate space for two buffer descriptors in the DP ram.
+        * For now, this address seems OK, but it may have to
+        * change with newer versions of the firmware.
+        * damm: allocating space after the two buffers for rx/tx data
         */
 
        rbdf = (cbd_t *)&cp->cp_dpmem[dpaddr];
@@ -174,15 +175,9 @@ serial_init (ulong cpu_clock, int baudrate)
        up->smc_rfcr = SMC_EB;
        up->smc_tfcr = SMC_EB;
 
-       /* Updating dpram address and size
-       */
-       size = ((sizeof(cbd_t)*2 + 2) + 15) & ~15;
-       dpaddr += size;
-       dpsize -= size;
-
-       /* Initialize CPM
-       */
-       m8xx_cpm_init(dpaddr, dpsize);
+#if defined(CONFIG_MBX)
+       board_serial_init();
+#endif /* CONFIG_MBX */
 
        /* Set UART mode, 8 bit, no parity, one stop.
         * Enable receive and transmit.
index 1f64b840c96206a988ac60580b6ec9086aa34e76..2197e256d9aa9a66e918292683476ca0a75b9ea5 100644 (file)
@@ -707,9 +707,11 @@ static int video_mode_generate (void)
 static void video_encoder_init (void)
 {
 #ifdef VIDEO_I2C
+    extern int i2c_setspeed (int speed);
+
     // Initialize the I2C
     PRINTD("\n[VIDEO ENCODER] Initializing I2C bus...");
-    i2c_init (VIDEO_I2C_RATE);
+    i2c_setspeed (VIDEO_I2C_RATE);
 
 #ifdef CONFIG_FADS
     // Reset ADV7176 chip 
index 0b03b71500e563229a718f419eb26306304ce608..5814055a4110c421fa2c93d191fb2653ffcf65e0 100644 (file)
@@ -128,7 +128,11 @@ interrupt_init (bd_t *bd)
   /*
    * Init PIT
    */
+#if defined(CFG_CLKS_IN_HZ)
+  set_pit(bd->bi_intfreq / 1000);
+#else
   set_pit(bd->bi_intfreq * 1000);
+#endif /* CFG_CLKS_IN_HZ */
 #endif  /* CONFIG_PPC405 */
 
 #ifdef CONFIG_ADCIOP
index d313bf756f617af5c195ae3b40506678909c7073..163940df28b95bcfdc80515c0bdb02bfe3b605f4 100644 (file)
@@ -48,6 +48,8 @@
 #define CFG_CMD_BOOTD  0x00004000      /* bootd                        */
 #define CFG_CMD_CONSOLE        0x00008000      /* coninfo                      */
 #define CFG_CMD_EEPROM 0x00010000      /* EEPROM read/write support    */
+#define        CFG_CMD_ASKENV  0x00020000      /* ask for env variable         */
+#define        CFG_CMD_RUN     0x00040000      /* run command in env variable  */
 
 #define CFG_CMD_ALL    0xFFFFFFFF      /* ALL commands                 */
 
@@ -59,7 +61,8 @@
                        CFG_CMD_PCMCIA  | \
                        CFG_CMD_PCI     | \
                        CFG_CMD_IRQ     | \
-                       CFG_CMD_EEPROM  )
+                       CFG_CMD_EEPROM  | \
+                       CFG_CMD_ASKENV  )
 
 /* Default configuration
  */
index be029c89beec0206d3417bb1dda1b561111f767f..eca0e354489a19a56bd6bc73d02baf189c95a9a5 100644 (file)
@@ -34,7 +34,7 @@
 #if (CONFIG_COMMANDS & CFG_CMD_IDE)
 #define        CMD_TBL_IDE     MK_CMD_TBL_ENTRY(                                       \
        "ide",  3,      5,      1,      do_ide,                                 \
-       "ide     - IDE sub-system",                                             \
+       "ide     - IDE sub-system\n",                                           \
        "reset - reset IDE controller\n"                                        \
        "ide info  - show available IDE devices\n"                              \
        "ide device [dev] - show or set current device\n"                       \
index 904e65264613350d5f09bb2d5862e7778e131c63..a970051f40846433503e0a05f9b65ffa48b94ed2 100644 (file)
@@ -57,4 +57,35 @@ void do_saveenv  (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]);
 #define CMD_TBL_SAVEENV
 #endif /* CFG_CMD_ENV */
 
+#if (CONFIG_COMMANDS & CFG_CMD_ASKENV)
+#define CMD_TBL_ASKENV         MK_CMD_TBL_ENTRY(                               \
+       "askenv",       8,      CFG_MAXARGS,    1,      do_askenv,              \
+       "askenv  - get environment variables from stdin\n",                     \
+       "name [message] [size]\n"                                               \
+       "    - get environment variable 'name' from stdin (max 'size' chars)\n" \
+       "askenv name\n"                                                         \
+       "    - get environment variable 'name' from stdin\n"                    \
+       "askenv name size\n"                                                    \
+       "    - get environment variable 'name' from stdin (max 'size' chars)\n" \
+       "askenv name [message] size\n"                                          \
+       "    - display 'message' string and get environment variable 'name'"    \
+       "from stdin (max 'size' chars)\n"                                       \
+),
+void do_askenv   (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]);
+#else
+#define CMD_TBL_ASKENV
+#endif /* CFG_CMD_ASKENV */
+
+#if (CONFIG_COMMANDS & CFG_CMD_RUN)
+#define        CMD_TBL_RUN     MK_CMD_TBL_ENTRY(                                       \
+       "run",  3,      CFG_MAXARGS,    1,      do_run,                         \
+       "run     - run commands in an environment variable\n",                  \
+       "var [...]\n"                                                           \
+       "    - run the commands in the environment variable(s) 'var'\n"         \
+),
+void do_run (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]);
+#else
+#define CMD_TBL_RUN
+#endif  /* CFG_CMD_RUN */
+
 #endif /* _CMD_NVEDIT_H */
index cf9d273d6b26a7c9832e5702e96f51624e365ae0..3f733eabf902812d42f7070fdc44172b2f56819a 100644 (file)
@@ -30,8 +30,9 @@
 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
 #define        CMD_TBL_PINIT   MK_CMD_TBL_ENTRY(                                       \
        "pinit",        4,      2,      1,      do_pinit,                       \
-       "pinit   - initialize PCMCIA sub-system\n",                             \
-       NULL                                                                    \
+       "pinit   - PCMCIA sub-system\n",                                        \
+       "on  - power on PCMCIA socket\n"                                        \
+       "pinit off - power off PCMCIA socket\n"                                 \
 ),
 
 void do_pinit (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]);
index aa56d77f2f7a288e6cdbd565b64aa48ad54e457a..8ef20ce80d5aec15d3a7bdbb49091a35a92726fb 100644 (file)
 
 #define mk_cr_cmd(CH, CMD)     ((CMD << 8) | (CH << 4))
 
+/* DPRAM defines and allocation functions
+*/
+
 /* The dual ported RAM is multi-functional.  Some areas can be (and are
  * being) used for microcode.  There is an area that can only be used
  * as data ram for buffer descriptors, which is all we use right now.
  * Currently the first 512 and last 256 bytes are used for microcode.
  */
+#ifdef  CFG_ALLOC_DPRAM
+
 #define CPM_DATAONLY_BASE      ((uint)0x0800)
 #define CPM_DATAONLY_SIZE      ((uint)0x0700)
 #define CPM_DP_NOSPACE         ((uint)0x7fffffff)
 
+void   dpram_init(void);
+uint   dpram_base(void);
+uint   dpram_base_align(uint align);
+uint   dpram_alloc(uint size);
+uint   dpram_alloc_align(uint size,uint align);
+
+#else
+
+#define CPM_SERIAL_BASE                0x0800 
+#define CPM_I2C_BASE           0x0820
+#define CPM_SPI_BASE           0x0840
+#define CPM_FEC_BASE           0x0860
+#define CPM_WLKBD_BASE         0x0880 
+#define CPM_SCC_BASE           0x0900
+
+#endif
+
+#define BD_IIC_START   ((uint) 0x0400) // <- please use CPM_I2C_BASE !!
+
 /* Export the base address of the communication processor registers
  * and dual port ram.
  */
 extern cpm8xx_t        *cpmp;          /* Pointer to comm processor */
 
-void   m8xx_cpm_init(uint base, uint size);
-uint   m8xx_cpm_dpalloc(uint size);
-uint   m8xx_cpm_dpbase(void);
-uint   m8xx_cpm_dpalloc_align(uint size,uint align);
-uint   m8xx_cpm_dpbase_align(uint align);
-
 /* Buffer descriptors used by many of the CPM protocols.
 */
 typedef struct cpm_buf_desc {
@@ -1081,8 +1099,6 @@ typedef struct hdlc_pram_s {
        ushort  tmp_mb;         /* temp */
 } hdlc_pram_t;
 
-#define BD_IIC_START           ((ushort)0x0400)
-
 /* CPM interrupts.  There are nearly 32 interrupts generated by CPM
  * channels or devices.  All of these are presented to the PPC core
  * as a single interrupt.  The CPM interrupt handler dispatches its
index 4a638ba95d5263d15e4bee9d16f1681c45752de3..6455c4fe7dfff7643ea0c741bb479570effdefbb 100644 (file)
@@ -94,6 +94,8 @@
         { 300, 600, 1200, 2400, 4800, 9600, 19200, 38400,     \
          57600, 115200, 230400, 460800, 921600 }
 
+#define CFG_CLKS_IN_HZ 1               /* everything, incl board info, in Hz */
+
 #define CFG_LOAD_ADDR          0x100000        /* default load address */
 #define CFG_EXTBDINFO          1       /* To use extended board_into (bd_t) */
 
 /*-----------------------------------------------------------------------
  * Definitions for initial stack pointer and data area (in RAM)
  */
-#define CFG_INIT_RAM_ADDR      0x8000  /* inside of SDRAM                     */
+#define CFG_INIT_RAM_ADDR      0x00df0000 /* inside of SDRAM                   */
 #define CFG_INIT_RAM_END       0x0f00  /* End of used area in RAM             */
 #define CFG_INIT_DATA_SIZE     64  /* size in bytes reserved for initial data */
 #define CFG_INIT_DATA_OFFSET   (CFG_INIT_RAM_END - CFG_INIT_DATA_SIZE)
index 297b6339f2a86010481d6033eb3ee5093a2572c4..69e892d5962bd74eee333d9ea2ce393c305fb351 100644 (file)
@@ -94,6 +94,8 @@
         { 300, 600, 1200, 2400, 4800, 9600, 19200, 38400,     \
          57600, 115200, 230400, 460800, 921600 }
 
+#define CFG_CLKS_IN_HZ 1               /* everything, incl board info, in Hz */
+
 #define CFG_LOAD_ADDR          0x100000        /* default load address */
 #define CFG_EXTBDINFO          1       /* To use extended board_into (bd_t) */
 
  * Please note that CFG_SDRAM_BASE _must_ start at 0
  */
 #define CFG_SDRAM_BASE         0x00000000
-#define CFG_FLASH_BASE         0xFFFD0000
+#define CFG_FLASH_BASE         0xFFFE0000
 #define CFG_MONITOR_BASE       CFG_FLASH_BASE
-#define CFG_MONITOR_LEN                (192 * 1024)    /* Reserve 196 kB for Monitor   */
+#define CFG_MONITOR_LEN                (128 * 1024)    /* Reserve 128 kB for Monitor   */
 #define CFG_MALLOC_LEN         (128 * 1024)    /* Reserve 128 kB for malloc()  */
 
 /*
 /*-----------------------------------------------------------------------
  * Definitions for initial stack pointer and data area (in RAM)
  */
-#define CFG_INIT_RAM_ADDR      0x8000  /* inside of SDRAM                     */
+#define CFG_INIT_RAM_ADDR      0x00df0000 /* inside of SDRAM                   */
 #define CFG_INIT_RAM_END       0x0f00  /* End of used area in RAM             */
 #define CFG_INIT_DATA_SIZE     64  /* size in bytes reserved for initial data */
 #define CFG_INIT_DATA_OFFSET   (CFG_INIT_RAM_END - CFG_INIT_DATA_SIZE)
index fb996b4f4c45bab0a69f704e96a720a30d8f0512..4a3fc1b5b16b7b46596b4bfc344a1f28b91204bb 100644 (file)
         { 300, 600, 1200, 2400, 4800, 9600, 19200, 38400,     \
          57600, 115200, 230400, 460800, 921600 }
 
+#define CFG_CLKS_IN_HZ 1               /* everything, incl board info, in Hz */
+
 #define CFG_LOAD_ADDR          0x100000        /* default load address */
 #define CFG_EXTBDINFO          1       /* To use extended board_into (bd_t) */
 
 /*-----------------------------------------------------------------------
  * Definitions for initial stack pointer and data area (in DPRAM)
  */
-#define CFG_INIT_RAM_ADDR      0x8000  /* inside of SDRAM                     */
+#define CFG_INIT_RAM_ADDR      0x00df0000 /* inside of SDRAM                   */
 #define CFG_INIT_RAM_END       0x0f00  /* End of used area in RAM             */
 #define CFG_INIT_DATA_SIZE     64  /* size in bytes reserved for initial data */
 #define CFG_INIT_DATA_OFFSET   (CFG_INIT_RAM_END - CFG_INIT_DATA_SIZE)
index e59c9bdb1abaac71283953e45a32df6398c6fd26..2ffbf9c001985529428187ee8bcc308a34dbb395 100644 (file)
@@ -42,7 +42,8 @@
 
 #define CONFIG_VIDEO           1       // To enable video controller support
 #define CONFIG_I2C             1       // To enable I2C support
-#define CONFIG_PCMCIA          1       // To enable PCMCIA support
+//Now included by CFG_CMD_PCMCIA
+//#define CONFIG_PCMCIA                1       // To enable PCMCIA support
 
 /* Video related */
 
index a465e3a92eadec1602a3b989bdd7e18edeb515cf..7c2a5d86dd2d4e31a9213c076a6923f0ffe2fb0f 100644 (file)
 #define __CONFIG_H
 
 #define        CONFIG_ETHADDR          08:00:22:50:70:63       // Ethernet address
-#define CONFIG_ENV_OVERWRITE                   1       // Overwrite the environment
+#define CONFIG_ENV_OVERWRITE   1       // Overwrite the environment
 
-#define CONFIG_VIDEO           1       // To enable the video initialization
-#define CONFIG_VIDEO_ADDR      0x00200000
-#define CONFIG_I2C             1       // Needed for 7176 & 7177
-#define CONFIG_PCMCIA          1       // To enable the PCMCIA initialization
+#define CFG_ALLOC_DPRAM                        // Use dynamic DPRAM allocation
 
-#define CFG_PCMCIA_IO_ADDR     0xff020000
-#define CFG_PCMCIA_IO_SIZE     0x10000
-#define CFG_PCMCIA_MEM_ADDR    0xe0000000
-#define CFG_PCMCIA_MEM_SIZE    0x10000
+#define CFG_AUTOLOAD           "n"     // No autoload
+
+//#define CONFIG_VIDEO         1       // To enable the video initialization
+//#define CONFIG_VIDEO_ADDR    0x00200000
+//#define CONFIG_I2C           1       // Needed for 7176 & 7177
+//#define CONFIG_PCMCIA                1       // To enable the PCMCIA initialization
+
+//#define CFG_PCMCIA_IO_ADDR   0xff020000
+//#define CFG_PCMCIA_IO_SIZE   0x10000
+//#define CFG_PCMCIA_MEM_ADDR  0xe0000000
+//#define CFG_PCMCIA_MEM_SIZE  0x10000
 
 /* Video related */
 
-#define CONFIG_VIDEO_LOGO                      1       // Show the logo
-#define CONFIG_VIDEO_ENCODER_AD7177            1       // Enable this encoder
-#define CONFIG_VIDEO_ENCODER_AD7177_ADDR       0xF4    // ALSB to ground
+//#define CONFIG_VIDEO_LOGO                    1       // Show the logo
+//#define CONFIG_VIDEO_ENCODER_AD7177          1       // Enable this encoder
+//#define CONFIG_VIDEO_ENCODER_AD7177_ADDR     0xF4    // ALSB to ground
 
 /* Wireless 56Khz 4PPM keyboard on SMCx */
 
-#define CONFIG_WL_4PPM_KEYBOARD                0
-#define CONFIG_WL_4PPM_KEYBOARD_SMC    0       // SMC to use (0 indexed)
+//#define CONFIG_WL_4PPM_KEYBOARD              0
+//#define CONFIG_WL_4PPM_KEYBOARD_SMC  0       // SMC to use (0 indexed)
 
 /*
  * High Level Configuration Options
 #define        CONFIG_8xx_CONS_SMC1    1       /* Console is on SMC1           */
 #undef CONFIG_8xx_CONS_SMC2
 #undef CONFIG_8xx_CONS_NONE
-#define CONFIG_BAUDRATE                4800
+#define CONFIG_BAUDRATE                9600
 
-#if 0  // Debugging
-#define MPC8XX_FACT    5                       /* Multiply by 5        */
-#else
 #define MPC8XX_FACT    12                      /* Multiply by 12       */
-#endif
-#define MPC8XX_XIN     4000000                 /* 4 MHz clock          */
+#define MPC8XX_XIN     5000000                 /* 4 MHz clock          */
 
 #define MPC8XX_HZ      ((MPC8XX_XIN) * (MPC8XX_FACT))
 #define CFG_PLPRCR_MF  ((MPC8XX_FACT-1) << 20)
@@ -92,7 +92,7 @@
 #define CONFIG_LOADS_ECHO      0       /* Dont echoes received characters */
 #define CONFIG_BOOTARGS                ""      
 #define CONFIG_BOOTCOMMAND                                                     \
-"bootp ;"                                                                      \
+"bootp; tftp; "                                                                        \
 "setenv bootargs console=tty0 console=ttyS0 "                                  \
 "root=/dev/nfs nfsroot=$(serverip):$(rootpath) "                               \
 "ip=$(ipaddr):$(serverip):$(gatewayip):$(subnetmask):$(hostname):eth0:off ;"   \
index df27d6bb0a9f2390114ccb9864eba3d21823754b..5ad1dc5e445e04bddf850f14c916efc13c19d85d 100644 (file)
 #else
 #define        CFG_MONITOR_LEN         (256 << 10)     /* Reserve 128 kB for Monitor   */
 #endif
-#undef  CFG_MONITOR_BASE       0x200000 /* to run ppcboot from RAM */
+#undef  CFG_MONITOR_BASE       /* 0x200000        to run ppcboot from RAM */
 #define CFG_MONITOR_BASE       CFG_FLASH_BASE
 #define        CFG_MALLOC_LEN          (128 << 10)     /* Reserve 128 kB for malloc()  */
 
index eee135c75f2f10a6ad7b201472f3c03444efde86..c4394b751c0f25d218edd86631e51e74ea145d5e 100644 (file)
 #define CONFIG_BOOTDELAY       5       /* autoboot after 5 seconds     */
 #endif
 
-#undef CONFIG_BOOTARGS 
+#define        CONFIG_ETHADDR  00:D0:93:00:05:B5
+
+#undef CONFIG_BOOTARGS
 #define CONFIG_BOOTCOMMAND                                                     \
        "bootp; "                                                               \
        "setenv bootargs root=/dev/nfs rw nfsroot=$(serverip):$(rootpath) "     \
        "ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname)::off; "   \
-       "bootm" 
+       "bootm"
 
 #define CONFIG_LOADS_ECHO      1       /* echo on for serial download  */
 #undef CFG_LOADS_BAUD_CHANGE           /* don't allow baudrate change  */
  */
 #define        CFG_SDRAM_BASE          0x00000000
 #define CFG_FLASH_BASE         0x40000000
-#ifdef DEBUG
+#if defined(DEBUG) || (CONFIG_COMMANDS & CFG_CMD_IDE)
 #define        CFG_MONITOR_LEN         (256 << 10)     /* Reserve 256 kB for Monitor   */
 #else
 #define        CFG_MONITOR_LEN         (128 << 10)     /* Reserve 128 kB for Monitor   */
 #define CFG_PCMCIA_IO_SIZE     ( 64 << 20 )
 
 /*-----------------------------------------------------------------------
- * 
+ * IDE/ATA stuff (Supports IDE harddisk on PCMCIA Adapter)
+ *-----------------------------------------------------------------------
+ */
+
+#define        CONFIG_IDE_PCCARD       1       /* Use IDE with PC Card Adapter */
+
+#undef CONFIG_IDE_PCMCIA               /* Direct IDE    not supported  */
+#undef CONFIG_IDE_LED                  /* LED   for ide not supported  */
+#undef CONFIG_IDE_RESET                /* reset for ide not supported  */
+
+#define CFG_IDE_MAXBUS         1       /* max. 1 IDE bus               */
+#define CFG_IDE_MAXDEVICE      1       /* max. 1 drive per IDE bus     */
+
+#define CFG_ATA_IDE0_OFFSET    0x0000
+#define CFG_ATA_IDE1_OFFSET    0x0C00
+
+#define CFG_ATA_BASE_ADDR      CFG_PCMCIA_MEM_ADDR
+
+/* Offset for data I/O                 */
+#define CFG_ATA_DATA_OFFSET    (CFG_PCMCIA_MEM_SIZE + 0x320)
+
+/* Offset for normal register accesses */
+#define CFG_ATA_REG_OFFSET     (2 * CFG_PCMCIA_MEM_SIZE + 0x320)
+
+/* Offset for alternate registers      */
+#define CFG_ATA_ALT_OFFSET     0x0100
+
+/*-----------------------------------------------------------------------
+ *
  *-----------------------------------------------------------------------
  *
  */
index ce7138df28aff29c1fe765405e5bcc36ae7bbdbf..c029e44f056fc6a4266a0f2431c57defec544827 100644 (file)
  */
 #define        CFG_SDRAM_BASE          0x00000000
 #define CFG_FLASH_BASE         0x40000000
-#ifdef DEBUG
+#if defined(DEBUG) || (CONFIG_COMMANDS & CFG_CMD_IDE)
 #define        CFG_MONITOR_LEN         (256 << 10)     /* Reserve 256 kB for Monitor   */
 #else
 #define        CFG_MONITOR_LEN         (128 << 10)     /* Reserve 128 kB for Monitor   */
index 93e4b017ba19e04ce8bb220ad2a252421567487a..32b5f0a1eba61909b58f4b8562382aaa203c6992 100644 (file)
  */
 #define        CFG_SDRAM_BASE          0x00000000
 #define CFG_FLASH_BASE         0x40000000
-#ifdef DEBUG
+#if defined(DEBUG) || (CONFIG_COMMANDS & CFG_CMD_IDE)
 #define        CFG_MONITOR_LEN         (256 << 10)     /* Reserve 256 kB for Monitor   */
 #else
 #define        CFG_MONITOR_LEN         (128 << 10)     /* Reserve 128 kB for Monitor   */
index bfbb8dab7b17920326b1362792265516b4a80bcc..f941b38c4a6028569608a8dd124fd4614f897bf6 100644 (file)
  */
 #define        CFG_SDRAM_BASE          0x00000000
 #define CFG_FLASH_BASE         0x40000000
-#ifdef DEBUG
+#if defined(DEBUG) || (CONFIG_COMMANDS & CFG_CMD_IDE)
 #define        CFG_MONITOR_LEN         (256 << 10)     /* Reserve 256 kB for Monitor   */
 #else
 #define        CFG_MONITOR_LEN         (128 << 10)     /* Reserve 128 kB for Monitor   */
 #define CFG_PCMCIA_IO_ADDR     (0xEC000000)
 #define CFG_PCMCIA_IO_SIZE     ( 64 << 20 )
 
+/*-----------------------------------------------------------------------
+ * IDE/ATA stuff (Supports IDE harddisk on PCMCIA Adapter)
+ *-----------------------------------------------------------------------
+ */
+
+#define        CONFIG_IDE_PCCARD       1       /* Use IDE with PC Card Adapter */
+
+#undef CONFIG_IDE_PCMCIA               /* Direct IDE    not supported  */
+#undef CONFIG_IDE_LED                  /* LED   for ide not supported  */
+#undef CONFIG_IDE_RESET                /* reset for ide not supported  */
+
+#define CFG_IDE_MAXBUS         1       /* max. 1 IDE bus               */
+#define CFG_IDE_MAXDEVICE      1       /* max. 1 drive per IDE bus     */
+
+#define CFG_ATA_IDE0_OFFSET    0x0000
+#define CFG_ATA_IDE1_OFFSET    0x0C00
+
+#define CFG_ATA_BASE_ADDR      CFG_PCMCIA_MEM_ADDR
+
+/* Offset for data I/O                 */
+#define CFG_ATA_DATA_OFFSET    (CFG_PCMCIA_MEM_SIZE + 0x320)
+
+/* Offset for normal register accesses */
+#define CFG_ATA_REG_OFFSET     (2 * CFG_PCMCIA_MEM_SIZE + 0x320)
+
+/* Offset for alternate registers      */
+#define CFG_ATA_ALT_OFFSET     0x0100
+
 /*-----------------------------------------------------------------------
  * 
  *-----------------------------------------------------------------------
index 043d9a0edf72b33a94091c2b4fe19e7a5aa1752d..1535c74afa5f8d67d23f7d81e2f7e2eaf07ab852 100644 (file)
 #if (CMA_MB_CAPS & CMA_MB_CAP_SER2) && !(CMA_MB_CAPS & CMA_MB_CAP_SERPAR)
 #error 2nd dual serial capability defined without serial/parallel capability
 #endif
-
 #include <board/cogent/mb.h>
-
 #endif /* _CONFIG_COGENT_COMMON_H */
index ee68bfe12fbd84c88a266d600aa70d1f9cf442ea..d3cd515ece2331e0f10f003dad92b626184b1432 100644 (file)
  * (second 2 for CMA120 only)
  */
 #define CFG_CMA_MB_BASE                0x00000000      /* base of m/b address space */
+
 #include <config_cogent_common.h>
+
 #define CFG_CMA_CONS_SERIAL    /* use Cogent motherboard serial for console */
 #define CONFIG_CONS_INDEX      1
 #define CFG_CMA_LCD_HEARTBEAT  /* define for sec rotator in lcd corner */
index 7d04ebb9a24a4e69cba795ac1e38983ad40a2651..a63e84381990d476f5dfa42afc66801997398ce9 100644 (file)
@@ -94,6 +94,7 @@
 
 #define CFG_BAUDRATE_TABLE     { 9600, 19200, 38400, 57600, 115200 }
 
+#define        CFG_ALLOC_DPRAM         1       /* use allocation routines      */
 /*
  * Low Level Configuration Settings
  * (address mappings, register initial values, etc.)
index 5a64a1b5379956bb3b769b5160dc1eeddbcb825e..73fb1ea202e7647ae10e8de58a943c619f9bd02f 100644 (file)
 #define CONFIG_BAUDRATE                9600
 #endif
 
-#define CONFIG_COMMANDS                (CFG_CMD_ALL & \
-       ~(CFG_CMD_NET|CFG_CMD_KGDB|CFG_CMD_IDE|CFG_CMD_PCI|CFG_CMD_EEPROM))
+#define CONFIG_COMMANDS                (CFG_CMD_ALL & ~( \
+                                       CFG_CMD_NET     | \
+                                       CFG_CMD_KGDB    | \
+                                       CFG_CMD_IDE     | \
+                                       CFG_CMD_PCMCIA  | \
+                                       CFG_CMD_PCI     | \
+                                       CFG_CMD_EEPROM  ))
 
 /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
 #include <cmd_confdefs.h>
index 67f1bcf3e294cb69916925a449360a7683e483a0..6ea59e4d5807d0cb3e28830e79213fbe7a6b566a 100644 (file)
@@ -1,13 +1,13 @@
 /*
  * (C) Copyright 2000
  * Murray Jensen <Murray.Jensen@cmst.csiro.au>
- * 
+ *
  * (C) Copyright 2000
  * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  * Marius Groeger <mgroeger@sysgo.de>
  *
  * Configuation settings for the R&S Protocol Board board.
- * 
+ *
  * See file CREDITS for list of people who contributed to this
  * project.
  *
@@ -53,7 +53,7 @@
 #undef         CONFIG_CONS_NONE                /* define if console on neither */
 #define CONFIG_CONS_INDEX      1       /* which SMC/SCC channel for console */
 
-/* 
+/*
  * select ethernet configuration
  *
  * if either CONFIG_ETHER_ON_SCC or CONFIG_ETHER_ON_FCC is selected, then
@@ -69,6 +69,9 @@
 #undef CONFIG_ETHER_NONE               /* define if ethernet on neither */
 #define CONFIG_ETHER_INDEX     2       /* which SCC/FCC channel for ethernet */
 
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+
 /* enable I2C */
 #define CONFIG_I2C          1
 
 
 #define CFG_IMMR               PHYS_IMMR
 
-/* turn off NVRAM env feature */
-#undef CONFIG_NVRAM_ENV  
+/*-----------------------------------------------------------------------
+ * Reset Address
+ *
+ * In order to reset the CPU, ppcboot jumps to a special address which
+ * causes a machine check exception. The default address for this is
+ * CFG_MONITOR_BASE - sizeof (ulong), which might not always work, eg. when
+ * testing the monitor in RAM using a JTAG debugger.
+ *
+ * Just set CFG_RESET_ADDRESS to an address that you know is sure to
+ * cause a bus error on your hardware.
+ */
+#define CFG_RESET_ADDRESS      0x20000000
 
 /*-----------------------------------------------------------------------
  * Hard Reset Configuration Words
 #define        CFG_BOOTMAPSZ           (8 << 20)       /* Initial Memory map for Linux */
 
 /*-----------------------------------------------------------------------
- * FLASH organization
+ * FLASH and environment organization
  */
 #define CFG_MAX_FLASH_BANKS    2       /* max number of memory banks           */
 #define CFG_MAX_FLASH_SECT     63      /* max number of sectors on one chip    */
 #define CFG_FLASH_ERASE_TOUT   12000   /* Timeout for Flash Erase (in ms)      */
 #define CFG_FLASH_WRITE_TOUT   3000    /* Timeout for Flash Write (in ms)      */
 
+/* turn off NVRAM env feature */
+#undef CONFIG_NVRAM_ENV
+
 #define        CFG_ENV_IS_IN_FLASH     1
 #define CFG_ENV_ADDR   (PHYS_FLASH + 0x8000)   /* Addr of Environment Sector   */
 #define CFG_ENV_SECT_SIZE      0x8000  /* Total Size of Environment Sector     */
  * HID1 has only read-only information - nothing to set.
  */
 #define CFG_HID0_INIT  (HID0_ICE|HID0_DCE|HID0_ICFI|HID0_DCI|HID0_IFEM|HID0_ABE)
-#define CFG_HID0_FINAL (HID0_ICE|HID0_IFEM|HID0_ABE)
+#define CFG_HID0_FINAL (HID0_ICE|HID0_IFEM|HID0_ABE|HID0_EMCP)
 #define CFG_HID2       0
 
 /*-----------------------------------------------------------------------
  */
 #define CFG_SYPCR      (SYPCR_SWTC | SYPCR_BMT | SYPCR_PBME | SYPCR_LBME | \
                         SYPCR_SWRI | SYPCR_SWP)
+
 /*-----------------------------------------------------------------------
  * TMCNTSC - Time Counter Status and Control                    4-40
  *-----------------------------------------------------------------------
index 42b9cdc6badb93457836de5b19924898688ee336..0cfd13a0a676e3721f0e7630b359127f21127731 100644 (file)
@@ -55,16 +55,19 @@ int i2c_doio(i2c_state_t *state);
 
 #else /* !CONFIG_MPC8260 */
 
-void i2c_init(int speed);
-void i2c_send( unsigned char address,
+int i2c_init(void);
+int i2c_send( unsigned char address,
               unsigned char secondary_address,
               int enable_secondary,
               unsigned short size, unsigned char dataout[] );
-void i2c_receive(unsigned char address,
+int i2c_receive(unsigned char address,
                unsigned char secondary_address,
                int enable_secondary,
                 unsigned short size_to_expect, unsigned char datain[] );
 
 #endif
 
+#define ERROR_I2C_NONE         0
+#define ERROR_I2C_LENGTH       1
+
 #endif
index 3cf43bce1c665647aedbe91d1f7c5352521750f6..42b372d86dbd91c36cbd23b7fcc1ae6fc14c526e 100644 (file)
  * MA 02111-1307 USA
  */
 
-#ifndef        _PCMCIA_H
+#ifndef _PCMCIA_H
 #define _PCMCIA_H
 
 #include <ppcboot.h>
 #include <config.h>
 
-#ifdef CONFIG_IDE_PCMCIA
 /*
  * Allow configuration to select PCMCIA slot,
  * or try to generate a useful default
  */
+#if (CONFIG_COMMANDS & CFG_CMD_PCMCIA) || \
+    ((CONFIG_COMMANDS & CFG_CMD_IDE) && defined(CONFIG_IDE_PCCARD))
+
 #if !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B)
 
                                        /* The RPX series use SLOT_B    */
@@ -46,7 +48,7 @@
 #  define CONFIG_PCMCIA_SLOT_B
 # endif
 #elif defined(CONFIG_TQM860L) || defined(CONFIG_TQM855L) /* The TQM8xxL modules */
-# define       CONFIG_PCMCIA_SLOT_A    /* ... use SLOT_A on MPC860/855 */
+# define       CONFIG_PCMCIA_SLOT_A    /* ... use SLOT_A on MPC860/855 */
 #elif defined(CONFIG_TQM823L) || defined(CONFIG_TQM850L)
 # define       CONFIG_PCMCIA_SLOT_B    /* ... and SLOT_B else          */
 #elif defined(CONFIG_SPD823TS)         /* The SPD8xx use SLOT_B        */
@@ -67,6 +69,8 @@
 #error Both CONFIG_PCMCIA_SLOT_A and CONFIG_PCMCIA_SLOT_B configured
 #endif
 
+#endif /* CFG_CMD_PCMCIA || (CFG_CMD_IDE && CONFIG_IDE_PCCARD) */
+
 #define PCMCIA_SOCKETS_NO      1
 #define PCMCIA_MEM_WIN_NO      4
 #define PCMCIA_IO_WIN_NO       2
 /* define _slot_ to be able to optimize macros */
 #ifdef CONFIG_PCMCIA_SLOT_A
 # define _slot_                        0
-# define PCMCIA_SLOT_MSG       "SLOT_A"
+# define PCMCIA_SLOT_MSG       "slot A"
 # define PCMCIA_SLOT_x         PCMCIA_PSLOT_A
 #else
 # define _slot_                        1
-# define PCMCIA_SLOT_MSG       "SLOT_B"
+# define PCMCIA_SLOT_MSG       "slot B"
 # define PCMCIA_SLOT_x         PCMCIA_PSLOT_B
 #endif
 
 #define __MY_PCMCIA_GCRX_CXOE          PCMCIA_GCRX_CXOE
 #endif
 
-/* look up table for pgcrx registers */
-
-#if 0
-static u_int *pcmcia_pgcrx[2] = {
-       &((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_pgcra,
-       &((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_pgcrb,
-};
-
-#define PCMCIA_PGCRX(slot)     (*pcmcia_pgcrx[slot])
-#endif
-
 /*
  * This structure is used to address each window in the PCMCIA controller.
  *
@@ -116,8 +109,6 @@ typedef struct {
        ulong   or;
 } pcmcia_win_t;
 
-#endif /* CONFIG_IDE_PCMCIA */
-
 /*
  * Definitions for PCMCIA control registers to operate in IDE mode
  *
@@ -132,7 +123,7 @@ typedef struct {
  *     Common Memory Space
  */
 
-#define        CFG_PCMCIA_PBR0         0xFE100000
+#define CFG_PCMCIA_PBR0                0xFE100000
 #define CFG_PCMCIA_POR0            (   PCMCIA_BSIZE_2  \
                            |   PCMCIA_PPS_16   \
                            |   PCMCIA_PRS_MEM  \
@@ -147,7 +138,7 @@ typedef struct {
  *     Common Memory Space
  */
 
-#define        CFG_PCMCIA_PBR1         0xFE100080
+#define CFG_PCMCIA_PBR1                0xFE100080
 #define CFG_PCMCIA_POR1            (   PCMCIA_BSIZE_8  \
                            |   PCMCIA_PPS_8    \
                            |   PCMCIA_PRS_MEM  \
@@ -162,7 +153,7 @@ typedef struct {
  *     Common Memory Space
  */
 
-#define        CFG_PCMCIA_PBR2         0xFE100100
+#define CFG_PCMCIA_PBR2                0xFE100100
 #define CFG_PCMCIA_POR2            (   PCMCIA_BSIZE_8  \
                            |   PCMCIA_PPS_8    \
                            |   PCMCIA_PRS_MEM  \
@@ -173,8 +164,8 @@ typedef struct {
 /* Window 3:
  *     not used
  */
-#define        CFG_PCMCIA_PBR3         0
-#define        CFG_PCMCIA_POR3         0
+#define CFG_PCMCIA_PBR3                0
+#define CFG_PCMCIA_POR3                0
 
 /* Window 4:
  *     Base: 0xFE100C00        CS1
@@ -183,7 +174,7 @@ typedef struct {
  *     Common Memory Space
  */
 
-#define        CFG_PCMCIA_PBR4         0xFE100C00
+#define CFG_PCMCIA_PBR4                0xFE100C00
 #define CFG_PCMCIA_POR4            (   PCMCIA_BSIZE_2  \
                            |   PCMCIA_PPS_16   \
                            |   PCMCIA_PRS_MEM  \
@@ -198,7 +189,7 @@ typedef struct {
  *     Common Memory Space
  */
 
-#define        CFG_PCMCIA_PBR5         0xFE100C80
+#define CFG_PCMCIA_PBR5                0xFE100C80
 #define CFG_PCMCIA_POR5            (   PCMCIA_BSIZE_8  \
                            |   PCMCIA_PPS_8    \
                            |   PCMCIA_PRS_MEM  \
@@ -213,7 +204,7 @@ typedef struct {
  *     Common Memory Space
  */
 
-#define        CFG_PCMCIA_PBR6         0xFE100D00
+#define CFG_PCMCIA_PBR6                0xFE100D00
 #define CFG_PCMCIA_POR6            (   PCMCIA_BSIZE_8  \
                            |   PCMCIA_PPS_8    \
                            |   PCMCIA_PRS_MEM  \
@@ -224,7 +215,80 @@ typedef struct {
 /* Window 7:
  *     not used
  */
-#define        CFG_PCMCIA_PBR7         0
-#define        CFG_PCMCIA_POR7         0
+#define CFG_PCMCIA_PBR7                0
+#define CFG_PCMCIA_POR7                0
+
+/**********************************************************************/
+
+/*
+ * CIS Tupel codes
+ */
+#define CISTPL_NULL            0x00
+#define CISTPL_DEVICE          0x01
+#define CISTPL_LONGLINK_CB     0x02
+#define CISTPL_INDIRECT                0x03
+#define CISTPL_CONFIG_CB       0x04
+#define CISTPL_CFTABLE_ENTRY_CB 0x05
+#define CISTPL_LONGLINK_MFC    0x06
+#define CISTPL_BAR             0x07
+#define CISTPL_PWR_MGMNT       0x08
+#define CISTPL_EXTDEVICE       0x09
+#define CISTPL_CHECKSUM                0x10
+#define CISTPL_LONGLINK_A      0x11
+#define CISTPL_LONGLINK_C      0x12
+#define CISTPL_LINKTARGET      0x13
+#define CISTPL_NO_LINK         0x14
+#define CISTPL_VERS_1          0x15
+#define CISTPL_ALTSTR          0x16
+#define CISTPL_DEVICE_A                0x17
+#define CISTPL_JEDEC_C         0x18
+#define CISTPL_JEDEC_A         0x19
+#define CISTPL_CONFIG          0x1a
+#define CISTPL_CFTABLE_ENTRY   0x1b
+#define CISTPL_DEVICE_OC       0x1c
+#define CISTPL_DEVICE_OA       0x1d
+#define CISTPL_DEVICE_GEO      0x1e
+#define CISTPL_DEVICE_GEO_A    0x1f
+#define CISTPL_MANFID          0x20
+#define CISTPL_FUNCID          0x21
+#define CISTPL_FUNCE           0x22
+#define CISTPL_SWIL            0x23
+#define CISTPL_END             0xff
+
+/*
+ * CIS Function ID codes
+ */
+#define CISTPL_FUNCID_MULTI    0x00
+#define CISTPL_FUNCID_MEMORY   0x01
+#define CISTPL_FUNCID_SERIAL   0x02
+#define CISTPL_FUNCID_PARALLEL 0x03
+#define CISTPL_FUNCID_FIXED    0x04
+#define CISTPL_FUNCID_VIDEO    0x05
+#define CISTPL_FUNCID_NETWORK  0x06
+#define CISTPL_FUNCID_AIMS     0x07
+#define CISTPL_FUNCID_SCSI     0x08
+
+/*
+ * Fixed Disk FUNCE codes
+ */
+#define CISTPL_IDE_INTERFACE   0x01
+
+#define CISTPL_FUNCE_IDE_IFACE 0x01
+#define CISTPL_FUNCE_IDE_MASTER        0x02
+#define CISTPL_FUNCE_IDE_SLAVE 0x03
+
+/* First feature byte */
+#define CISTPL_IDE_SILICON     0x04
+#define CISTPL_IDE_UNIQUE      0x08
+#define CISTPL_IDE_DUAL                0x10
+
+/* Second feature byte */
+#define CISTPL_IDE_HAS_SLEEP   0x01
+#define CISTPL_IDE_HAS_STANDBY 0x02
+#define CISTPL_IDE_HAS_IDLE    0x04
+#define CISTPL_IDE_LOW_POWER   0x08
+#define CISTPL_IDE_REG_INHIBIT 0x10
+#define CISTPL_IDE_HAS_INDEX   0x20
+#define CISTPL_IDE_IOIS16      0x40
 
 #endif /* _PCMCIA_H */
index a0586d23df2df38a8fd5a57c3ae852e0cf7cf254..5993198a9bca927882db16b6322f8688d52c1282 100644 (file)
@@ -73,9 +73,6 @@ typedef struct monitor_functions {
  * ppcboot starts it up.
  */
 typedef struct bd_info {
-#ifdef CFG_EXTBDINFO
-       unsigned char   bi_s_version[4];  /* Version of this structure          */
-#endif
        unsigned long   bi_memstart;    /* start of  DRAM memory                */
        unsigned long   bi_memsize;     /* size  of  DRAM memory in bytes       */
        unsigned long   bi_flashstart;  /* start of FLASH memory                */
@@ -99,11 +96,13 @@ typedef struct bd_info {
        unsigned long   bi_vco;         /* VCO Out from PLL, in MHz */
 #endif
        unsigned long   bi_baudrate;    /* Console Baudrate                     */
-#ifdef CFG_EXTBDINFO
+#if defined(CONFIG_PPC405)
+       unsigned char   bi_s_version[4];  /* Version of this structure          */
        unsigned char   bi_r_version[32]; /* Version of the ROM (IBM)           */
        unsigned int    bi_procfreq;    /* CPU (Internal) Freq, in Hz           */
        unsigned int    bi_plb_busfreq; /* PLB Bus speed, in Hz */
        unsigned int    bi_pci_busfreq; /* PCI Bus speed, in Hz */
+       unsigned char   bi_pci_enetaddr[6];     /* PCI Ethernet MAC address     */
 #endif
        mon_fnc_t       *bi_mon_fnc;    /* Pointer to monitor functions         */
 } bd_t;
@@ -132,7 +131,7 @@ typedef     struct  init_data {
        unsigned long   env_valid;      /* Checksum of Environment valid?       */
        unsigned long   relocated;      /* Relocat. offset when running in RAM  */
        mon_fnc_t       bi_mon_fnc;     /* Monitor functions                    */
-#ifdef CONFIG_8xx
+#ifdef CFG_ALLOC_DPRAM
        unsigned int    dp_alloc_base;
        unsigned int    dp_alloc_top;
 #endif
@@ -385,8 +384,6 @@ void        fputc(int file, const char c);
 int    ftstc(int file);
 int    fgetc(int file);
 
-#ifdef CONFIG_PCMCIA
 int    pcmcia_init (void);
-#endif
 
 #endif /* _PPCBOOT_H_ */
index 54e8037f9e0856651f8f5123715c8dca50b1dc29..9ffb2438308fa0cef74404cc046a3755457ce6d9 100644 (file)
@@ -24,6 +24,6 @@
 #ifndef        __VERSION_H__
 #define        __VERSION_H__
 
-#define        PPCBOOT_VERSION "ppcboot 0.7.2"
+#define        PPCBOOT_VERSION "ppcboot 0.7.3"
 
 #endif /* __VERSION_H__ */
index 59853f39b908d434f2e900931fb9a494cfffae95..dcb512af710dc5fa6e5255e57845c715e247d801 100644 (file)
--- a/net/arp.c
+++ b/net/arp.c
@@ -35,7 +35,7 @@
 static void ArpHandler(uchar *pkt, unsigned dest, unsigned src, unsigned len);
 static void ArpTimeout(void);
 
-int            ArpTry;
+int    ArpTry = 0;
 
 /*
  *     Handle a ARP received packet.
index 696a75438dbf89c53e09fa2c3ed9f859027714fc..f3cf4626fa658329b415f3bb04d4a34c8e9eb256 100644 (file)
 
 include $(TOPDIR)/config.mk
 
-BINS   = img2srec mkimage
+BINS   = img2srec mkimage envcrc
 
-OBJS   = img2srec.o mkimage.o crc32.o
+OBJS   = img2srec.o mkimage.o crc32.o envcrc.o
 
 TOOLSUBDIRS = gdb
 
 #
 # Use native tools and options
 #
-CPPFLAGS   = -Wall -pedantic -O
-CFLAGS     = $(CPPFLAGS) -I../include
+CPPFLAGS   = -Wall -pedantic -I../include -I..
+CFLAGS     = $(CPPFLAGS) -O
 CC        = $(HOSTCC)
 MAKEDEPEND = makedepend
 
 all:   .depend $(BINS) subdirs
 
+envcrc:                envcrc.o crc32.o environment.o
+               $(CC) $(CFLAGS) -o $@ $^
+
+environment.S: ../common/environment.S
+               ln -sf $^ $@
+
 img2srec:      img2srec.o
                $(CC) $(CFLAGS) -s -o $@ $^
 
 mkimage:       mkimage.o crc32.o
                $(CC) -g $(CFLAGS) -o $@ $^
 
+envcrc.o:      envcrc.c
+               $(CC) -g $(CFLAGS) -c $<
+
 crc32.o:       crc32.c
                $(CC) -g $(CFLAGS) -c $<
 
@@ -60,7 +69,7 @@ crc32.c:
 #########################################################################
 
 .depend:       Makefile $(OBJS:.o=.c)
-               $(CC) -M $(CPPFLAGS) -I../include $(OBJS:.o=.c) > $@
+               $(CC) -M $(CPPFLAGS) $(OBJS:.o=.c) > $@
 
 sinclude .depend
 
diff --git a/tools/envcrc.c b/tools/envcrc.c
new file mode 100644 (file)
index 0000000..9e0d535
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * (C) Copyright 2001
+ * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#define        __ASSEMBLY__    /* Dirty trick to get only #defines */
+#include <config.h>
+#undef __ASSEMBLY__
+
+#if defined(CFG_ENV_IS_IN_FLASH)
+# ifndef  CFG_ENV_ADDR
+#  define CFG_ENV_ADDR (CFG_FLASH_BASE + CFG_ENV_OFFSET)
+# endif
+# ifndef  CFG_ENV_OFFSET
+#  define CFG_ENV_OFFSET (CFG_ENV_ADDR - CFG_FLASH_BASE)
+# endif
+# ifndef  CFG_ENV_SIZE
+#  define CFG_ENV_SIZE CFG_ENV_SECT_SIZE
+# endif
+# if (CFG_ENV_ADDR >= CFG_FLASH_BASE) && \
+     (CFG_ENV_ADDR+CFG_ENV_SIZE) <= (CFG_FLASH_BASE + CFG_MONITOR_LEN)
+#  define ENV_IS_EMBEDDED
+# endif
+#endif /* CFG_ENV_IS_IN_FLASH */
+
+extern unsigned long crc32 (unsigned long, const unsigned char *, unsigned int);
+
+#ifdef ENV_IS_EMBEDDED
+extern unsigned int env_size ;
+extern unsigned char environment ;
+extern unsigned char env_data ;
+#endif /* ENV_IS_EMBEDDED */
+
+int main (int argc, char **argv)
+{
+#ifdef ENV_IS_EMBEDDED
+    int crc ;
+    unsigned char      *envptr         = &environment,
+                       *dataptr        = &env_data;
+    unsigned int       datasize        = env_size - (dataptr - envptr) ;
+        
+    crc = crc32(0, dataptr, datasize) ;
+
+    // Check if verbose mode is activated passing a parameter to the program
+    if (argc > 1) {
+       printf("CRC32 from offset %08X to %08X of environment = %08X\n", 
+           (unsigned int)(dataptr - envptr), 
+           (unsigned int)(dataptr - envptr) + datasize,
+           crc);
+    } else {
+       printf("0x%08X\n", crc);
+    }
+#else
+       printf("0\n");
+#endif
+    return EXIT_SUCCESS;
+}