* Cleanup, minor fixes

* Patch by Rune Torgersen, 16 Apr 2004:
  LBA48 fixes

* Patches by Pantelis Antoniou, 16 Apr 2004:
  - Fix some compile problems;
    add "once" functionality for the netretry variable
diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index baab871..50ada33 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -1186,13 +1186,12 @@
 
 #ifdef CONFIG_LBA48
 	if (iop->command_set_2 & 0x0400) { /* LBA 48 support */
-		dev_desc->lba48support = 1;
-		dev_desc->lba48 = (unsigned long long)iop->lba48_capacity[0] |
+		dev_desc->lba48 = 1;
+		dev_desc->lba = (unsigned long long)iop->lba48_capacity[0] |
 						  ((unsigned long long)iop->lba48_capacity[1] << 16) |
 						  ((unsigned long long)iop->lba48_capacity[2] << 32) |
 						  ((unsigned long long)iop->lba48_capacity[3] << 48);
 	} else {
-		dev_desc->lba48support = 0;
 		dev_desc->lba48 = 0;
 	}
 #endif /* CONFIG_LBA48 */
diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index 8430298..aeacb8e 100644
--- a/common/cmd_mem.c
+++ b/common/cmd_mem.c
@@ -1001,7 +1001,7 @@
 	ulong addr, length;
 	ulong crc;
 	ulong *ptr;
-	ulong vcrc; 
+	ulong vcrc;
 	int verify;
 	int ac;
 	char **av;
diff --git a/common/cmd_net.c b/common/cmd_net.c
index 85a9023..5989733 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -94,62 +94,50 @@
 );
 #endif	/* CFG_CMD_NFS */
 
-static void netboot_update_env(void)
+static void netboot_update_env (void)
 {
-    char tmp[22] ;
+	char tmp[22];
 
-    if (NetOurGatewayIP) {
-	ip_to_string (NetOurGatewayIP, tmp);
-	setenv("gatewayip", tmp);
-    }
+	if (NetOurGatewayIP) {
+		ip_to_string (NetOurGatewayIP, tmp);
+		setenv ("gatewayip", tmp);
+	}
 
-    if (NetOurSubnetMask) {
-	ip_to_string (NetOurSubnetMask, tmp);
-	setenv("netmask", tmp);
-    }
+	if (NetOurSubnetMask) {
+		ip_to_string (NetOurSubnetMask, tmp);
+		setenv ("netmask", tmp);
+	}
 
-    if (NetOurHostName[0])
-	setenv("hostname", NetOurHostName);
+	if (NetOurHostName[0])
+		setenv ("hostname", NetOurHostName);
 
-    if (NetOurRootPath[0])
-	setenv("rootpath", NetOurRootPath);
+	if (NetOurRootPath[0])
+		setenv ("rootpath", NetOurRootPath);
 
-    if (NetOurIP) {
-	ip_to_string (NetOurIP, tmp);
-	setenv("ipaddr", tmp);
-    }
+	if (NetOurIP) {
+		ip_to_string (NetOurIP, tmp);
+		setenv ("ipaddr", tmp);
+	}
 
-    if (NetServerIP) {
-	ip_to_string (NetServerIP, tmp);
-	setenv("serverip", tmp);
-    }
+	if (NetServerIP) {
+		ip_to_string (NetServerIP, tmp);
+		setenv ("serverip", tmp);
+	}
 
-    if (NetOurDNSIP) {
-	ip_to_string (NetOurDNSIP, tmp);
-	setenv("dnsip", tmp);
-    }
-
+	if (NetOurDNSIP) {
+		ip_to_string (NetOurDNSIP, tmp);
+		setenv ("dnsip", tmp);
+	}
 #if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS2)
-    if (NetOurDNS2IP) {
-	    ip_to_string (NetOurDNS2IP, tmp);
-	    setenv("dnsip2", tmp);
-    }
+	if (NetOurDNS2IP) {
+		ip_to_string (NetOurDNS2IP, tmp);
+		setenv ("dnsip2", tmp);
+	}
 #endif
-
-    if (NetOurNISDomain[0])
-	setenv("domain", NetOurNISDomain);
-
-    if (ntohs(NetOurVLAN) != (ushort)-1) {
-	    VLAN_to_string(NetOurVLAN, tmp);
-	    setenv("vlan", tmp);
-    }
-
-    if (ntohs(NetOurNativeVLAN) != (ushort)-1) {
-	    VLAN_to_string(NetOurNativeVLAN, tmp);
-	    setenv("vlan", tmp);
-    }
-
+	if (NetOurNISDomain[0])
+		setenv ("domain", NetOurNISDomain);
 }
+
 static int
 netboot_common (int proto, cmd_tbl_t *cmdtp, int argc, char *argv[])
 {
diff --git a/common/cmd_pcmcia.c b/common/cmd_pcmcia.c
index 7a2ca9e..9ff0949 100644
--- a/common/cmd_pcmcia.c
+++ b/common/cmd_pcmcia.c
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2000-2002
+ * (C) Copyright 2000-2004
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
  * See file CREDITS for list of people who contributed to this
@@ -91,7 +91,7 @@
 
 #if (! defined(CONFIG_I82365)) && (! defined(CONFIG_PXA_PCMCIA))
 static u_int m8xx_get_graycode(u_int size);
-#endif	/* CONFIG_I82365 */
+#endif	/* !CONFIG_I82365, !CONFIG_PXA_PCMCIA */
 #if 0
 static u_int m8xx_get_speed(u_int ns, u_int is_io);
 #endif
@@ -106,9 +106,10 @@
 	&((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_pgcra,
 	&((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_pgcrb,
 };
-
 #define PCMCIA_PGCRX(slot)	(*pcmcia_pgcrx[slot])
 
+#endif	/* CONFIG_PXA_PCMCIA */
+
 #endif /* CONFIG_I82365 */
 
 #if defined(CONFIG_IDE_8xx_PCCARD)  || defined(CONFIG_PXA_PCMCIA)
@@ -116,9 +117,7 @@
 static void print_fixed  (volatile uchar *p);
 static int  identify     (volatile uchar *p);
 static int  check_ide_device (int slot);
-#endif	/* CONFIG_IDE_8xx_PCCARD */
-
-#endif
+#endif	/* CONFIG_IDE_8xx_PCCARD, CONFIG_PXA_PCMCIA */
 
 const char *indent = "\t   ";
 
diff --git a/common/command.c b/common/command.c
index 2b48a1c..64e56af 100644
--- a/common/command.c
+++ b/common/command.c
@@ -89,12 +89,12 @@
 #if 0
 	{
 		printf("test:");
-		left = 1; 
+		left = 1;
 		while (argv[left])
 			printf(" %s", argv[left++]);
 	}
 #endif
-	
+
 	last_expr = 0;
 	left = argc - 1; ap = argv + 1;
 	if (left > 0 && strcmp(ap[0], "!") == 0) {
diff --git a/common/console.c b/common/console.c
index f858fb3..8dbd8e3 100644
--- a/common/console.c
+++ b/common/console.c
@@ -412,6 +412,9 @@
 	DECLARE_GLOBAL_DATA_PTR;
 	char *stdinname, *stdoutname, *stderrname;
 	device_t *inputdev = NULL, *outputdev = NULL, *errdev = NULL;
+#ifdef CFG_CONSOLE_ENV_OVERWRITE
+	int i;
+#endif /* CFG_CONSOLE_ENV_OVERWRITE */
 
 	/* set default handlers at first */
 	gd->jt[XF_getc] = serial_getc;
@@ -483,7 +486,7 @@
 	for (i = 0; i < 3; i++) {
 		setenv (stdio_names[i], stdio_devices[i]->name);
 	}
-#endif /*  CFG_CONSOLE_ENV_OVERWRITE */
+#endif /* CFG_CONSOLE_ENV_OVERWRITE */
 
 #if 0
 	/* If nothing usable installed, use only the initial console */