Skip to contentSkip to conversation

powerpc/eeprom: cleanup mac command

PATCH Superseded York Sun 3 participants 4 messages Aug 10, 2011 – Aug 11, 2011

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

York Sun

author
#0 lore raw

PATCH v2 1/1 powerpc/eeprom: cleanup mac command

Change the help message to be more helpful. Print argument format. Fix MAX_NUM_PORTS to comply with v1 NXID format.

---
 board/freescale/common/sys_eeprom.c |    2 +-
 common/cmd_mac.c                    |   29 +++++++++++++++++------------
 2 files changed, 18 insertions(+), 13 deletions(-)
board/freescale/common/sys_eeprom.c +1 -1
index d2ed036..ebcdfd8 100644
@@ -34,7 +34,7 @@
 #endif
 
 #ifdef CONFIG_SYS_I2C_EEPROM_NXID
-#define MAX_NUM_PORTS	23
+#define MAX_NUM_PORTS	31
 #define NXID_VERSION	1
 #endif
 
common/cmd_mac.c +17 -12
index 1884c2a..bd9cc19 100644
@@ -29,21 +29,26 @@ extern int do_mac(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
 U_BOOT_CMD(
 	mac, 3, 1,  do_mac,
 	"display and program the system ID and MAC addresses in EEPROM",
-	"[read|save|id|num|errata|date|ports|0|1|2|3|4|5|6|7]\n"
+	"without argument\n"
+	"    - show content of system ID and MAC addresses\n"
 	"read\n"
-	"    - show content of EEPROM\n"
+	"    - read EEPROM without showing\n"
 	"mac save\n"
 	"    - save to the EEPROM\n"
 	"mac id\n"
-	"    - program system id\n"
-	"mac num\n"
-	"    - program system serial number\n"
-	"mac errata\n"
-	"    - program errata data\n"
-	"mac date\n"
-	"    - program date\n"
-	"mac ports\n"
+	"    - program system id (fixed)\n"
+	"mac num <string>\n"
+	"    - program <string> as system serial number\n"
+	"mac errata <string>\n"
+	"    - program <string> as errata data\n"
+	"mac date <YYMMDDhhmmss>\n"
+	"    - program timestamp\n"
+	"mac ports <n>\n"
 	"    - program the number of ports\n"
-	"mac X\n"
-	"    - program the MAC address for port X [X=0...7]"
+	"mac <n> <XX:XX:XX:XX:XX:XX>\n"
+#ifdef CONFIG_SYS_I2C_EEPROM_NXID
+	"    - program the MAC address for port n [n=0...30]"
+#else
+	"    - program the MAC address for port n [n=0...7]"
+#endif
 );
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH v2 1/1 powerpc/eeprom: cleanup mac command

Quoted 4 lines · York Sun

Change the help message to be more helpful. Print argument format. Fix MAX_NUM_PORTS to comply with v1 NXID format.

Could you also fix the commands so that they take a number in decimal instead of hex?

         e.mac[index][i] = simple_strtoul(p, &p, 16);

...

	e.mac_count = simple_strtoul(argv[2], NULL, 16);

I know U-Boot uses hex for everything, but it doesn't make sense for this command.

#2 lore raw

PATCH v2 1/1 powerpc/eeprom: cleanup mac command

Quoted 10 lines · On Wednesday, August 10, 2011 21:27:28 Tabi Timur-B04825 wrote:
Quoted 4 lines · York Sun

Change the help message to be more helpful. Print argument format. Fix MAX_NUM_PORTS to comply with v1 NXID format.

Could you also fix the commands so that they take a number in decimal instead of hex?

Quoted 8 lines
         e.mac[index][i] = simple_strtoul(p, &p, 16);

...

	e.mac_count = simple_strtoul(argv[2], NULL, 16);

I know U-Boot uses hex for everything, but it doesn't make sense for this command.

change it to 0 and then both should work
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110810/07f1559c/attachment.pgp

author
#3 lore raw

PATCH v2 1/1 powerpc/eeprom: cleanup mac command

In reply to Tabi Timur-B04825
Quoted 10 lines · On Wed, 2011-08-10 at 20:27 -0500, Tabi Timur-B04825 wrote:
Quoted 4 lines · York Sun

Change the help message to be more helpful. Print argument format. Fix MAX_NUM_PORTS to comply with v1 NXID format.

Could you also fix the commands so that they take a number in decimal instead of hex?

Quoted 8 lines
         e.mac[index][i] = simple_strtoul(p, &p, 16);

...

	e.mac_count = simple_strtoul(argv[2], NULL, 16);

I know U-Boot uses hex for everything, but it doesn't make sense for this command.

Yes, I can change it. But not all of them. We use hexadecimal for mac address but not the count of ports. Please comment on my next version.

York