]> www.infradead.org Git - users/rw/ppcboot.git/commitdiff
* Squeeze a few bytes here and there to make it fit in 128k again. Sic!
authorwdenk <wdenk>
Mon, 29 Jan 2001 18:41:09 +0000 (18:41 +0000)
committerwdenk <wdenk>
Mon, 29 Jan 2001 18:41:09 +0000 (18:41 +0000)
* Don't count-down if no bootcmd is defined
* Add I2C command
* On the 8260, the i2c parameter RAM must be 64 aligned. Turn off
  debugging.
* board.c: include mpc8xx.h only when compiling for MPC8xx CPUs
* Fix "tags" target
* The i2c pins on the 8260 chip must be set Open Drain (I believe
  this is common to all, but I'm not sure).

16 files changed:
CHANGELOG
Makefile
README
board/hymod/hymod.c
common/Makefile
common/board.c
common/cmd_boot.c
common/cmd_i2c.c [new file with mode: 0644]
common/command.c
common/main.c
cpu/mpc8260/i2c.c
cpu/mpc8xx/cpu.c
include/cmd_confdefs.h
include/cmd_i2c.h [new file with mode: 0644]
include/config_rsdproto.h
include/version.h

index a0895f59c182f8228d622326c0cd6e5a15243827..0a0bdfe195c9e09e71f8d87ef4de72ea9e8fe47f 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -57,6 +57,26 @@ To do:
 * "last user address" is set even if bootp is used without parameters
   (and it uses default address).
 
+======================================================================
+Modifications for 0.8.2:
+======================================================================
+
+* Squeeze a few bytes here and there to make it fit in 128k again. Sic!
+
+* Don't count-down if no bootcmd is defined
+
+* Add I2C command
+
+* On the 8260, the i2c parameter RAM must be 64 aligned. Turn off
+  debugging.
+
+* board.c: include mpc8xx.h only when compiling for MPC8xx CPUs
+
+* Fix "tags" target
+
+* The i2c pins on the 8260 chip must be set Open Drain (I believe
+  this is common to all, but I'm not sure).
+
 ======================================================================
 Modifications for 0.8.1:
 ======================================================================
index 82ee8488d989c222639d6f24613b79411e2b55c8..f5fd37291ec791b10934f9bfc94171572337d765 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -68,7 +68,7 @@ OBJS +=       common/libcommon.a
 
 #########################################################################
 
-all:   ppcboot.srec ppcboot.bin
+all:           ppcboot.srec ppcboot.bin
 
 install:       all
                #cp ppcboot.srec /tftpboot/moni.srec
@@ -89,6 +89,10 @@ subdirs:
 depend dep:
                @for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir .depend ; done
 
+tags:
+               ctags -w `find $(SUBDIRS) include \
+                       \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)`
+
 #########################################################################
 else
 all install ppcboot ppcboot.srec depend dep:
@@ -301,10 +305,6 @@ rsdproto_config:   unconfig
 
 #########################################################################
 
-tags:
-       ctags -w `find $(SUBDIRS) include \
-               \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)`
-
 clean:
        rm -f `find . -type f \
                \( -name 'core' -o -name '*.bak' \
diff --git a/README b/README
index 17c9fbc8b7c4a83aae309b355e6657a7942ed73b..fef6aa18b1a8991123cf5da637c299cb12d6c1fc 100644 (file)
--- a/README
+++ b/README
@@ -205,7 +205,7 @@ The following options need to be configured:
 
 - Boot Delay:  CONFIG_BOOTDELAY - in seconds
                Delay before automatically booting the default image;
-               set to 0 to disable autoboot.
+               set to -1 to disable autoboot.
 
 - Autoboot Command:
                CONFIG_BOOTCOMMAND
index 4f9623ca28d1b8c672c3eb108592ffb5fd7d9f1f..ce7670784723983199023d5375bc7e44ea9468dd 100644 (file)
@@ -164,8 +164,8 @@ const iop_conf_t iop_conf_tab[4][32] = {
        /* PD18 */ {   1,   1,   1,   0,   0,   0   }, /* SPI CLK */
        /* PD17 */ {   1,   1,   1,   0,   0,   0   }, /* SPI MOSI */
        /* PD16 */ {   1,   1,   1,   0,   0,   0   }, /* SPI MISO */
-       /* PD15 */ {   1,   1,   1,   0,   0,   0   }, /* I2C SDA */
-       /* PD14 */ {   1,   1,   1,   0,   0,   0   }, /* I2C SCL */
+       /* PD15 */ {   1,   1,   1,   0,   1,   0   }, /* I2C SDA */
+       /* PD14 */ {   1,   1,   1,   0,   1,   0   }, /* I2C SCL */
        /* PD13 */ {   1,   0,   0,   1,   0,   1   }, /* TEMP ~STDBY */
        /* PD12 */ {   1,   0,   0,   1,   0,   1   }, /* FCC3 ~RESET */
        /* PD11 */ {   1,   0,   0,   1,   0,   1   }, /* FCC2 ~RESET */
index 630b19bf87cd0d18c3073e403f5b7165ff972e4b..8c8f5e7caab1526ad46baf3a4d07e6deed73c28c 100644 (file)
@@ -34,7 +34,7 @@ COBJS = board.o main.o command.o \
          cmd_ide.o cmd_mem.o cmd_net.o \
          cmd_nvedit.o cmd_pcmcia.o \
          s_record.o dlmalloc.o \
-         kgdb.o console.o lists.o devices.o flash.o
+         kgdb.o console.o lists.o devices.o flash.o cmd_i2c.o
 
 OBJS   = $(AOBJS) $(COBJS)
 
index 08bde4504ad4571fb572ba248e1fbe5ac3cbaa7c..1b6ab8291bfea8daac7947935b0ae38106e63882 100644 (file)
@@ -25,7 +25,9 @@
 #include <command.h>
 #include <malloc.h>
 #include <devices.h>
+#ifdef CONFIG_8xx
 #include <mpc8xx.h>
+#endif
 #if (CONFIG_COMMANDS & CFG_CMD_IDE)
 #include <ide.h>
 #endif
index 040eaea4d1d56e7fb6d2e9f41a513b45d5545632..1d17becc720126cad53ea7ecc1907afdf6ea243f 100644 (file)
@@ -40,47 +40,60 @@ static int do_echo = 1;
 
 
 #if (CONFIG_COMMANDS & CFG_CMD_BDI)
+static void print_num(const char *, ulong);
+static void print_str(const char *, const char *);
+
 void do_bdinfo (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
 {
        int i;
        char buf[32];
 
-       printf ("  memstart    = 0x%08lx\n",  bd->bi_memstart   );
-       printf ("  memsize     = 0x%08lx\n",  bd->bi_memsize    );
-       printf ("  flashstart  = 0x%08lx\n",  bd->bi_flashstart );
-       printf ("  flashsize   = 0x%08lx\n",  bd->bi_flashsize  );
-       printf ("  flashoffset = 0x%08lx\n",  bd->bi_flashoffset);
-       printf ("  sramstart   = 0x%08lx\n",  bd->bi_sramstart  );
-       printf ("  sramsize    = 0x%08lx\n",  bd->bi_sramsize   );
+       print_num ("memstart",      bd->bi_memstart     );
+       print_num ("memsize",       bd->bi_memsize      );
+       print_num ("flashstart",    bd->bi_flashstart   );
+       print_num ("flashsize",     bd->bi_flashsize    );
+       print_num ("flashoffset",   bd->bi_flashoffset  );
+       print_num ("sramstart",     bd->bi_sramstart    );
+       print_num ("sramsize",      bd->bi_sramsize     );
 #if defined(CONFIG_8xx) || defined(CONFIG_8260)
-       printf ("  immr_base   = 0x%08lx\n",  bd->bi_immr_base  );
+       print_num ("immr_base",     bd->bi_immr_base    );
 #endif
-       printf ("  bootflags   = 0x%08lx\n",  bd->bi_bootflags  );
+       print_num ("bootflags",     bd->bi_bootflags    );
 #if defined(CFG_CLKS_IN_HZ)
-       printf ("  intfreq     = %6s MHz\n",  strmhz(buf, bd->bi_intfreq));
-       printf ("  busfreq     = %6s MHz\n",  strmhz(buf, bd->bi_busfreq));
+       print_str ("intfreq",       strmhz(buf, bd->bi_intfreq));
+       print_str ("busfreq",       strmhz(buf, bd->bi_busfreq));
 #else
-       printf ("  intfreq     = %6s MHz\n",  strmhz(buf, bd->bi_intfreq*1000000L));
-       printf ("  busfreq     = %6s MHz\n",  strmhz(buf, bd->bi_busfreq*1000000L));
+       print_str ("intfreq",       strmhz(buf, bd->bi_intfreq*1000000L));
+       print_str ("busfreq",       strmhz(buf, bd->bi_busfreq*1000000L));
 #endif /* CFG_CLKS_IN_HZ */
        printf ("  ethaddr     =");
        for (i=0; i<6; ++i) {
                printf ("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]);
        }
 #ifdef CONFIG_HERMES
-       printf ("  ethspeed    = %6d MHz\n", bd->bi_ethspeed);
+       print_str ("ethspeed",      strmhz(buf, bd->bi_ethspeed);
 #endif
        printf ("\n  IP addr     = ");  print_IPaddr (bd->bi_ip_addr);
        printf ("\n  baudrate    = %6ld bps\n", bd->bi_baudrate   );
-       printf ("  getc        = 0x%08lx\n",(ulong)bd->bi_mon_fnc->getc);
-       printf ("  tstc        = 0x%08lx\n",(ulong)bd->bi_mon_fnc->tstc);
-       printf ("  putc        = 0x%08lx\n",(ulong)bd->bi_mon_fnc->putc);
-       printf ("  puts        = 0x%08lx\n",(ulong)bd->bi_mon_fnc->puts);
-       printf ("  printf      = 0x%08lx\n",(ulong)bd->bi_mon_fnc->printf);
-       printf ("  install_hdlr= 0x%08lx\n",(ulong)bd->bi_mon_fnc->install_hdlr);
-       printf ("  free_hdlr   = 0x%08lx\n",(ulong)bd->bi_mon_fnc->free_hdlr);
-       printf ("  malloc      = 0x%08lx\n",(ulong)bd->bi_mon_fnc->malloc);
-       printf ("  free        = 0x%08lx\n",(ulong)bd->bi_mon_fnc->free);
+       print_num ("getc",          (ulong)bd->bi_mon_fnc->getc);
+       print_num ("tstc",          (ulong)bd->bi_mon_fnc->tstc);
+       print_num ("putc",          (ulong)bd->bi_mon_fnc->putc);
+       print_num ("puts",          (ulong)bd->bi_mon_fnc->puts);
+       print_num ("printf",        (ulong)bd->bi_mon_fnc->printf);
+       print_num ("install_hdlr",  (ulong)bd->bi_mon_fnc->install_hdlr);
+       print_num ("free_hdlr",     (ulong)bd->bi_mon_fnc->free_hdlr);
+       print_num ("malloc",        (ulong)bd->bi_mon_fnc->malloc);
+       print_num ("free",          (ulong)bd->bi_mon_fnc->free);
+}
+
+static void print_num(const char *name, ulong value)
+{
+       printf ("  %-12s= 0x%08lx\n", name, value);
+}
+
+static void print_str(const char *name, const char *str)
+{
+       printf ("  %-12s= %6s MHz\n", name, str);
 }
 #endif /* CFG_CMD_BDI */
 
diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c
new file mode 100644 (file)
index 0000000..e561801
--- /dev/null
@@ -0,0 +1,232 @@
+/*
+ * (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
+ *
+ * hacked for i2c support by Murray.Jensen@cmst.csiro.au, 20-Dec-00
+ */
+
+/*
+ * I2C support
+ */
+#include <ppcboot.h>
+#include <command.h>
+#include <i2c.h>
+#include <cmd_i2c.h>
+
+#undef I2C_DEBUG
+
+#ifdef I2C_DEBUG
+#define        PRINTF(fmt,args...)     do {                            \
+                                       printf (fmt ,##args);   \
+                               } while (0)
+#else
+#define PRINTF(fmt,args...)
+#endif
+
+#if defined(CONFIG_I2C) && (CONFIG_COMMANDS & CFG_CMD_I2C)
+
+/* ------------------------------------------------------------------------- */
+
+void
+do_i2c(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
+{
+    unsigned char i2c_addr, sec_addr, *data_addr;
+    unsigned short size;
+    int speed;
+#ifdef CONFIG_MPC8260
+    i2c_state_t state;
+    int rc;
+#endif
+
+    switch (argc) {
+
+    case 0:
+    case 1:
+       break;
+
+    case 2:
+       if (strncmp(argv[1], "res", 3) == 0) {
+           printf("\nI2C reset 50kHz ... ");
+#ifdef CONFIG_MPC8260
+           i2c_init(50000, 0xfe);      /* use all one's as slave address */
+#else
+           i2c_init(50000);
+#endif
+           printf("DONE\n");
+           return;
+       }
+       break;
+
+    case 3:
+       if (strncmp(argv[1], "res", 3) == 0) {
+           speed = (int)simple_strtoul(argv[2], NULL, 10);
+           if (speed % 1000)
+               printf("\nI2C reset %d.%03dkHz ... ", speed/1000, speed%1000);
+           else
+               printf("\nI2C reset %dkHz ... ", speed/1000);
+#ifdef CONFIG_MPC8260
+           i2c_init(speed, 0xfe);      /* use all one's as slave address */
+#else
+           i2c_init(speed);
+#endif
+           printf("DONE\n");
+           return;
+       }
+       break;
+
+    case 4:
+       break;
+
+    case 5:
+       if (strcmp(argv[1], "recv") == 0) {
+               i2c_addr = (unsigned char)simple_strtoul(argv[2], NULL, 16);
+               data_addr = (unsigned char *)simple_strtoul(argv[3], NULL, 16);
+               size = (unsigned short)simple_strtoul(argv[4], NULL, 16);
+
+               printf("\nI2C recv: i2c_addr 0x%02x, data_addr 0x%08lx, "
+                       "size %u ... ", i2c_addr, (ulong)data_addr, size);
+#ifdef CONFIG_MPC8260
+               i2c_newio(&state);
+
+               rc = i2c_receive(&state, i2c_addr, 0,
+                   I2CF_START_COND|I2CF_STOP_COND, size, data_addr);
+               if (rc) {
+                   printf("FAILED (i2c_receive return code = %d)\n", rc);
+                   return;
+               }
+
+               rc = i2c_doio(&state);
+               if (rc) {
+                   printf("FAILED (i2c_doio return code = %d)\n", rc);
+                   return;
+               }
+#else
+               i2c_receive(i2c_addr, 0, 0, size, data_addr);
+#endif
+               printf("DONE\n");
+               return;
+       }
+       else if (strcmp(argv[1], "send") == 0) {
+               i2c_addr = (unsigned char)simple_strtoul(argv[2], NULL, 16);
+               data_addr = (unsigned char *)simple_strtoul(argv[3], NULL, 16);
+               size = (unsigned short)simple_strtoul(argv[4], NULL, 16);
+
+               printf("\nI2C send: i2c_addr 0x%02x, data_addr 0x%08lx, "
+                       "size %u ... ", i2c_addr, (ulong)data_addr, size);
+#ifdef CONFIG_MPC8260
+               i2c_newio(&state);
+
+               rc = i2c_send(&state, i2c_addr, 0,
+                   I2CF_START_COND|I2CF_STOP_COND, size, data_addr);
+               if (rc) {
+                   printf("FAILED (i2c_receive return code = %d)\n", rc);
+                   return;
+               }
+
+               rc = i2c_doio(&state);
+               if (rc) {
+                   printf("FAILED (i2c_doio return code = %d)\n", rc);
+                   return;
+               }
+#else
+               i2c_send(i2c_addr, 0, 0, size, data_addr);
+#endif
+               printf("DONE\n");
+               return;
+       }
+       break;
+
+    case 6:
+       if (strcmp(argv[1], "rcvs") == 0) {
+               i2c_addr = (unsigned char)simple_strtoul(argv[2], NULL, 16);
+               sec_addr = (unsigned char)simple_strtoul(argv[3], NULL, 16);
+               data_addr = (unsigned char *)simple_strtoul(argv[4], NULL, 16);
+               size = (unsigned short)simple_strtoul(argv[5], NULL, 16);
+
+               printf("\nI2C recv: i2c_addr 0x%02x, sec_addr 0x%02x, "
+                       "data_addr 0x%08lx, size %u ... ",
+                       i2c_addr, sec_addr, (ulong)data_addr, size);
+#ifdef CONFIG_MPC8260
+               i2c_newio(&state);
+
+               rc = i2c_receive(&state, i2c_addr, sec_addr,
+                   I2CF_ENABLE_SECONDARY|I2CF_START_COND|I2CF_STOP_COND,
+                   size, data_addr);
+               if (rc) {
+                   printf("FAILED (i2c_receive return code = %d)\n", rc);
+                   return;
+               }
+
+               rc = i2c_doio(&state);
+               if (rc) {
+                   printf("FAILED (i2c_doio return code = %d)\n", rc);
+                   return;
+               }
+#else
+               i2c_receive(i2c_addr, sec_addr, 1, size, data_addr);
+#endif
+               printf("DONE\n");
+               return;
+       }
+       else if (strcmp(argv[1], "snds") == 0) {
+               i2c_addr = (unsigned char)simple_strtoul(argv[2], NULL, 16);
+               sec_addr = (unsigned char)simple_strtoul(argv[3], NULL, 16);
+               data_addr = (unsigned char *)simple_strtoul(argv[4], NULL, 16);
+               size = (unsigned short)simple_strtoul(argv[5], NULL, 16);
+
+               printf("\nI2C send: i2c_addr 0x%02x, sec_addr 0x%02x, "
+                       "data_addr 0x%08lx, size %u ... ",
+                       i2c_addr, sec_addr, (ulong)data_addr, size);
+#ifdef CONFIG_MPC8260
+               i2c_newio(&state);
+
+               rc = i2c_receive(&state, i2c_addr, sec_addr,
+                   I2CF_ENABLE_SECONDARY|I2CF_START_COND|I2CF_STOP_COND,
+                   size, data_addr);
+               if (rc) {
+                   printf("FAILED (i2c_receive return code = %d)\n", rc);
+                   return;
+               }
+
+               rc = i2c_doio(&state);
+               if (rc) {
+                   printf("FAILED (i2c_doio return code = %d)\n", rc);
+                   return;
+               }
+#else
+               i2c_send(i2c_addr, sec_addr, 1, size, data_addr);
+#endif
+               printf("DONE\n");
+               return;
+       }
+       break;
+
+    default:
+       break;
+    }
+
+    printf("Usage:\n%s\n", cmdtp->usage);
+    return;
+}
+
+/* ------------------------------------------------------------------------- */
+
+#endif /* CONFIG_COMMANDS & CFG_CMD_I2C */
index 7c55d788670a684db8a9c5085a9e4091d1eb1a4c..510aa1e14c3c47dfc518fe562b0d8faad334489e 100644 (file)
@@ -42,6 +42,7 @@
 #include <cmd_pcmcia.h>
 
 #include <cmd_eeprom.h>
+#include <cmd_i2c.h>
 
 /*
  * HELP command
@@ -200,6 +201,7 @@ cmd_tbl_t cmd_tbl[] = {
        CMD_TBL_DCACHE
        CMD_TBL_RESET
        CMD_TBL_KGDB
+       CMD_TBL_I2C
        CMD_TBL_ECHO
        CMD_TBL_VERS
        CMD_TBL_HELP
index 05f2db0f20b9868327fda0e328ae3892fa9501eb..ad24f26ea449404cb5b1026cafdd8713d3778f5e 100644 (file)
@@ -49,6 +49,11 @@ void main_loop(bd_t *bd)
        int bootdelay = s ? (int)simple_strtoul(s, NULL, 10) : 0;
        int autoboot  = 1;
 
+       if (getenv ("bootcmd") == NULL) {       /* don't try to autoboot */
+               bootdelay = 0;
+               autoboot  = 0;
+       }
+
 #endif /* CONFIG_BOOTDELAY */
 
 #if 0
index 32a34b779a4ba73a2cda002920a7226f4afaf958..530bd5e82a9239b0c5ceac1ade6c18c17e9683f0 100644 (file)
@@ -32,7 +32,7 @@
 #include <i2c.h>
 
 /* define to enable debug messages */
-#define DEBUG_I2C
+#undef DEBUG_I2C
 
 /* us to wait before checking the i2c */
 #define DELAY_US       100000  
@@ -157,7 +157,7 @@ void i2c_init(int speed, int slaveaddr)
            /* need to allocate dual port ram */
            dpaddr = m8260_cpm_dpalloc(64 +
                (NUM_RX_BDS * sizeof(I2C_BD)) + (NUM_TX_BDS * sizeof(I2C_BD)) +
-               MAX_TX_SPACE, 8);
+               MAX_TX_SPACE, 64);
            *((unsigned short*)(&immap->im_dprambase[PROFF_I2C_BASE])) = dpaddr;
        }
 
index 386e057f3ba166be318a5863bc0b65316e8ab9c4..94861153158c4d0377e0140aa04c356fae9d4d9f 100644 (file)
@@ -50,6 +50,9 @@ static int check_CPU(long clock, uint pvr, uint immr)
   volatile immap_t *immap = (immap_t *)(immr & 0xFFFF0000);
   uint k, m;
   char buf[32];
+  char  pre = 'X';
+  char *mid = "xx";
+  char *suf;
 
   /* the highest 16 bits should be 0x0050 for a 860 */
 
@@ -60,31 +63,35 @@ static int check_CPU(long clock, uint pvr, uint immr)
   m = 0;
 
   switch(k) {
-  case 0x00020001 : printf("p" ID_STR "xxZPnn");       break;
-  case 0x00030001 : printf("X" ID_STR "xxZPnn");       break;
+  case 0x00020001 : pre='p';   suf = "";       break;
+  case 0x00030001 :            suf = "";       break;
 
-  case 0x00120003 : printf("X" ID_STR "xxZPnnA");      break;
-  case 0x00130003 : printf("X" ID_STR "xxZPnnA3");     break;
+  case 0x00120003 :            suf = "A";      break;
+  case 0x00130003 :            suf = "A3";     break;
 
-  case 0x00200004 : printf("X" ID_STR "xxZPnnB");      break;
+  case 0x00200004 :            suf = "B";      break;
 
-  case 0x00300004 : printf("X" ID_STR "xxZPnnC");      break;
-  case 0x00310004 : printf("X" ID_STR "xxZPnnC1");     m = 1; break;
+  case 0x00300004 :            suf = "C";      break;
+  case 0x00310004 :            suf = "C1";     m = 1; break;
 
-
-  case 0x00200064 : printf("X" ID_STR "SRZPnnB");      break;
-  case 0x00300065 : printf("X" ID_STR "SRZPnnC");      break;
-  case 0x00310065 : printf("X" ID_STR "SRZPnnC1");     m = 1; break;
-  case 0x05010000 : printf("X" ID_STR "xxZPnnD3");     m = 1; break;
-  case 0x05020000 : printf("X" ID_STR "xxZPnnD4");     m = 1; break;
+  case 0x00200064 : mid = "SR";        suf = "B";      break;
+  case 0x00300065 : mid = "SR";        suf = "C";      break;
+  case 0x00310065 : mid = "SR";        suf = "C1";     m = 1; break;
+  case 0x05010000 :            suf = "D3";     m = 1; break;
+  case 0x05020000 :            suf = "D4";     m = 1; break;
 
     /* this value is not documented anywhere */
 
-  case 0x40000000 : printf("P" ID_STR "PZPnnD");       m = 1; break;
+  case 0x40000000 : pre='P';   suf = "D";      m = 1; break;
 
-  default: printf("unknown M" ID_STR " (0x%08x)", k);
+  default:                     suf = NULL;     break;
   }
 
+  if (suf)
+       printf ("%c" ID_STR "%sZPnn%s", pre, mid, suf);
+  else
+       printf ("unknown M" ID_STR " (0x%08x)", k);
+
   printf(" at %s MHz:", strmhz(buf, clock));
 
   printf(" %u kB I-Cache", checkicache() >> 10);
@@ -113,6 +120,7 @@ static int check_CPU(long clock, uint pvr, uint immr)
   volatile immap_t *immap = (immap_t *)(immr & 0xFFFF0000);
   uint k, m;
   char buf[32];
+  char *suf;
 
   /* the highest 16 bits should be 0x0050 for a 8xx */
 
@@ -124,18 +132,21 @@ static int check_CPU(long clock, uint pvr, uint immr)
 
   switch(k) {
   /* MPC823 */
-  case 0x20000000 : printf("PPC823ZTnn0");     break;
-  case 0x20010000 : printf("PPC823ZTnn0.1");   break;
-  case 0x20020000 : printf("PPC823ZTnnZ2/3");  break;
-  case 0x20020001 : printf("PPC823ZTnnZ3");    break;
-  case 0x21000000 : printf("PPC823ZTnnA");     break;
-  case 0x21010000 : printf("PPC823ZTnnB");     m=1; break;
-  case 0x21010001 : printf("PPC823ZTnnB2");    m=1; break;
+  case 0x20000000 : suf = "0";         break;
+  case 0x20010000 : suf = "0.1";       break;
+  case 0x20020000 : suf = "Z2/3";      break;
+  case 0x20020001 : suf = "Z3";                break;
+  case 0x21000000 : suf = "A";         break;
+  case 0x21010000 : suf = "B"; m=1;    break;
+  case 0x21010001 : suf = "B2";        m=1;    break;
   /* MPC823E */
-  case 0x24010000 : printf("PPC823EZTnnB2");   m=1; break;
+  case 0x24010000 : suf = NULL; printf("PPC823EZTnnB2"); m=1; break;
 
-  default: printf("unknown MPC823 (0x%08x)", k);
+  default:         suf = NULL; printf("unknown MPC823 (0x%08x)", k); break;
   }
+  if (suf)
+       printf ("PPC823ZTnn%s", suf);
+
   printf(" at %s MHz:", strmhz(buf, clock));
 
   printf(" %u kB I-Cache", checkicache() >> 10);
index efebeb443b3b6495905bc95bcb5f490b45899ae4..12554ffb106ee7da09e0219a1320fcc100308f76 100644 (file)
@@ -51,6 +51,7 @@
 #define        CFG_CMD_ASKENV  0x00020000      /* ask for env variable         */
 #define        CFG_CMD_RUN     0x00040000      /* run command in env variable  */
 #define        CFG_CMD_ECHO    0x00080000      /* echo arguments               */
+#define        CFG_CMD_I2C     0x00100000      /* I2C serial bus support       */
 
 #define CFG_CMD_ALL    0xFFFFFFFF      /* ALL commands                 */
 
@@ -64,7 +65,8 @@
                        CFG_CMD_IRQ     | \
                        CFG_CMD_EEPROM  | \
                        CFG_CMD_ASKENV  | \
-                       CFG_CMD_ECHO    )
+                       CFG_CMD_ECHO    | \
+                       CFG_CMD_I2C     )
 
 /* Default configuration
  */
diff --git a/include/cmd_i2c.h b/include/cmd_i2c.h
new file mode 100644 (file)
index 0000000..0595b5b
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * (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
+ *
+ * hacked for I2C support by Murray.Jensen@cmst.csiro.au, 20-Dec-00
+ */
+
+/*
+ * I2C support
+ */
+#ifndef        _CMD_I2C_H
+#define        _CMD_I2C_H
+
+#include <ppcboot.h>
+#include <command.h>
+
+#if defined(CONFIG_I2C) && (CONFIG_COMMANDS & CFG_CMD_I2C)
+
+#define        CMD_TBL_I2C     MK_CMD_TBL_ENTRY(                               \
+       "i2c",  3,      6,      1,      do_i2c,                         \
+       "i2c     - I2C sub-system\n",                                   \
+       "reset [speed] - reset I2C controller using clock speed `speed'\n"\
+       "    (defaults to 50kHz)\n"                                     \
+       "i2c recv i2c_addr data_addr size\n"                            \
+       "i2c send i2c_addr data_addr size - recv/send `size' bytes to/from\n"\
+       "    mem addr `data_addr' from/to device with i2c address `i2c_addr'\n"\
+       "i2c rcvs i2c_addr sec_addr data_addr size\n"                   \
+       "i2c snds i2c_addr sec_addr data_addr size - recv/send `size' bytes\n"\
+       "    to/from mem addr `data_addr' from/to device with i2c address\n"\
+       "    `i2c_addr' and secondary address `sec_addr'\n"             \
+),
+
+void do_i2c (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]);
+
+#else
+#define CMD_TBL_I2C
+#endif
+
+#endif /* _CMD_I2C_H */
index 6ea59e4d5807d0cb3e28830e79213fbe7a6b566a..5049077d61921c274750d73586190070183a2db6 100644 (file)
 /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
 #include <cmd_confdefs.h>
 
-#if 1
-#define CONFIG_BOOTDELAY       -1      /* autoboot disabled            */
-#else
-#define CONFIG_BOOTDELAY       5       /* autoboot after 5 seconds     */
-#endif
-//#define CONFIG_BOOTCOMMAND   "bootm 04080000 04200000" /* autoboot command*/
-#define CONFIG_BOOTCOMMAND     ""
-
-#define CONFIG_BOOTARGS                \
-       "root=/dev/nfs rw " \
-       "nfsroot=192.1.1.1:/LinuxPPC " \
-       "nfsaddrs=192.1.1.2:192.1.1.1:192.1.1.1:255.255.255.0:rsdproto::off"
-
-#define CONFIG_ETHADDR         08:00:3e:26:0a:5a
-
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
-#define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2               /* which serial port to use */
-#endif
-
-#undef CONFIG_WATCHDOG                 /* turn on platform specific watchdog */
+#define CONFIG_BOOTDELAY       5
 
 /*
  * Miscellaneous configurable options
 #define        CFG_CBSIZE              256             /* Console I/O Buffer Size      */
 #endif
 #define        CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
-#define        CFG_MAXARGS             16              /* max number of command args   */
+#define        CFG_MAXARGS                           /* max number of command args   */
 #define CFG_BARGSIZE           CFG_CBSIZE      /* Boot Argument Buffer Size    */
 
 #define CFG_MEMTEST_START      0x00400000      /* memtest works on     */
 
 #define        CFG_HZ                  1000            /* decrementer freq: 1 ms ticks */
 
+                                               /* valid baudrates */
 #define CFG_BAUDRATE_TABLE     { 9600, 19200, 38400, 57600, 115200 }
 
 /*
index 8403ffebb6b01f9848f4da28f95d41712194c757..576c278028da04a401603b97396628c6d8640fe8 100644 (file)
@@ -24,6 +24,6 @@
 #ifndef        __VERSION_H__
 #define        __VERSION_H__
 
-#define        PPCBOOT_VERSION "ppcboot 0.8.1"
+#define        PPCBOOT_VERSION "ppcboot 0.8.2"
 
 #endif /* __VERSION_H__ */