* Code cleanup:
  - remove trailing white space, trailing empty lines, C++ comments, etc.
  - split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c)

* Patches by Kenneth Johansson, 25 Jun 2003:
  - major rework of command structure
    (work done mostly by Michal Cendrowski and Joakim Kristiansen)
diff --git a/board/lwmon/Makefile b/board/lwmon/Makefile
index 35b8428..7a2014d 100644
--- a/board/lwmon/Makefile
+++ b/board/lwmon/Makefile
@@ -28,7 +28,7 @@
 OBJS	= $(BOARD).o flash.o
 
 $(LIB):	.depend $(OBJS)
-	$(AR) crv $@ $^
+	$(AR) crv $@ $(OBJS)
 
 #########################################################################
 
diff --git a/board/lwmon/README.keybd b/board/lwmon/README.keybd
index bf759c6..788c864 100644
--- a/board/lwmon/README.keybd
+++ b/board/lwmon/README.keybd
@@ -15,7 +15,6 @@
 einer Applikation ausgewertet werden.
 
 
-
 Sonderfunktionen beim Booten:
 
 Es lassen sich eine oder mehrere (beliebig viele) Tasten oder Tasten-
diff --git a/board/lwmon/lwmon.c b/board/lwmon/lwmon.c
index d5a637f..b359ec7 100644
--- a/board/lwmon/lwmon.c
+++ b/board/lwmon/lwmon.c
@@ -38,7 +38,6 @@
 #include <commproc.h>
 #include <i2c.h>
 #include <command.h>
-#include <cmd_bsp.h>
 #include <malloc.h>
 #include <post.h>
 
@@ -73,9 +72,9 @@
 	/*
 	 * SDRAM Initialization (offset 5 in UPM RAM)
 	 *
-         * This is no UPM entry point. The following definition uses
-         * the remaining space to establish an initialization
-         * sequence, which is executed by a RUN command.
+	 * This is no UPM entry point. The following definition uses
+	 * the remaining space to establish an initialization
+	 * sequence, which is executed by a RUN command.
 	 *
 	 */
 		    0x1FF5FC34, 0xEFEABC34, 0x1FB57C35, /* last */
@@ -121,9 +120,9 @@
 	/*
 	 * SDRAM Initialization (offset 5 in UPM RAM)
 	 *
-         * This is no UPM entry point. The following definition uses
-         * the remaining space to establish an initialization
-         * sequence, which is executed by a RUN command.
+	 * This is no UPM entry point. The following definition uses
+	 * the remaining space to establish an initialization
+	 * sequence, which is executed by a RUN command.
 	 *
 	 */
 		    0x1FF5FC34, 0xEFEABC34, 0x1FB57C35, /* last */
@@ -132,7 +131,7 @@
 	 */
 	0x0E2DBC04, 0x10AF7C04, 0xF0AFFC00, 0xF0AFFC00,
 	0xF1AFFC00, 0xEFBAFC00, 0x1FF5FC47, /* last */
-				 	    _NOT_USED_,
+					    _NOT_USED_,
 	_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
 	_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
 	/*
@@ -146,7 +145,7 @@
 	 */
 	0x0E29BC04, 0x10A77C00, 0xF0AFFC00, 0xF0AFFC00,
 	0xE1BAFC04, 0x1FF5FC47, /* last */
-			        _NOT_USED_, _NOT_USED_,
+				_NOT_USED_, _NOT_USED_,
 	_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
 	_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
 	/*
@@ -511,7 +510,7 @@
 	int i;
 
 	i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
-	
+
 	gd->kbd_status = 0;
 
 	/* Read initial keyboard error code */
@@ -543,13 +542,13 @@
 	/*
 	 * Read current keyboard state.
 	 *
-         * After the error reset it may take some time before the
-         * keyboard PIC picks up a valid keyboard scan - the total
-         * scan time is approx. 1.6 ms (information by Martin Rajek,
-         * 28 Sep 2002). We read a couple of times for the keyboard
-         * to stabilize, using a big enough delay.
-         * 10 times should be enough. If the data is still changing,
-         * we use what we get :-(
+	 * After the error reset it may take some time before the
+	 * keyboard PIC picks up a valid keyboard scan - the total
+	 * scan time is approx. 1.6 ms (information by Martin Rajek,
+	 * 28 Sep 2002). We read a couple of times for the keyboard
+	 * to stabilize, using a big enough delay.
+	 * 10 times should be enough. If the data is still changing,
+	 * we use what we get :-(
 	 */
 
 	memset (tmp_data, 0xFF, KEYBD_DATALEN);	/* impossible value */
@@ -849,6 +848,12 @@
 	printf ("Usage:\n%s\n", cmdtp->usage);
 	return 1;
 }
+cmd_tbl_t U_BOOT_CMD(pic) = MK_CMD_ENTRY(
+	"pic",	4,	1,	do_pic,
+	"pic     - read and write PIC registers\n",
+	"read  reg      - read PIC register `reg'\n"
+	"pic write reg val  - write value `val' to PIC register `reg'\n"
+);
 
 /***********************************************************************
 F* Function:     int do_kbd (cmd_tbl_t *cmdtp, int flag,
@@ -902,6 +907,12 @@
 	return 0;
 }
 
+cmd_tbl_t U_BOOT_CMD(kdb) = MK_CMD_ENTRY(
+	"kbd",	1,	1,	do_kbd,
+	"kbd     - read keyboard status\n",
+	NULL
+);
+
 /* Read and set LSB switch */
 #define CFG_PC_TXD1_ENA		0x0008		/* PC.12 */
 
@@ -968,6 +979,14 @@
 	return 1;
 }
 
+cmd_tbl_t U_BOOT_CMD(lsb) = MK_CMD_ENTRY(
+	"lsb",	2,	1,	do_lsb,
+	"lsb     - check and set LSB switch\n",
+	"on  - switch LSB on\n"
+	"lsb off - switch LSB off\n"
+	"lsb     - print current setting\n"
+);
+
 #endif /* CFG_CMD_BSP */
 
 /*----------------------------- Utilities -----------------------------*/
diff --git a/board/lwmon/u-boot.lds b/board/lwmon/u-boot.lds
index 3764878..fffa79e 100644
--- a/board/lwmon/u-boot.lds
+++ b/board/lwmon/u-boot.lds
@@ -98,6 +98,11 @@
   _edata  =  .;
   PROVIDE (edata = .);
 
+  __u_boot_cmd_start = .;
+  .u_boot_cmd : { *(.u_boot_cmd) }
+  __u_boot_cmd_end = .;
+
+
   __start___ex_table = .;
   __ex_table : { *(__ex_table) }
   __stop___ex_table = .;
@@ -120,4 +125,3 @@
   _end = . ;
   PROVIDE (end = .);
 }
-
diff --git a/board/lwmon/u-boot.lds.debug b/board/lwmon/u-boot.lds.debug
index 9183016..153286b 100644
--- a/board/lwmon/u-boot.lds.debug
+++ b/board/lwmon/u-boot.lds.debug
@@ -107,6 +107,11 @@
   _edata  =  .;
   PROVIDE (edata = .);
 
+  __u_boot_cmd_start = .;
+  .u_boot_cmd : { *(.u_boot_cmd) }
+  __u_boot_cmd_end = .;
+
+
   __start___ex_table = .;
   __ex_table : { *(__ex_table) }
   __stop___ex_table = .;
@@ -129,4 +134,3 @@
   _end = . ;
   PROVIDE (end = .);
 }
-