* [U-Boot] [Patch v3] powerpc/eeprom: cleanup mac command
@ 2011-08-11 14:48 York Sun
2011-08-11 14:55 ` [U-Boot] [u-boot-release] " Tabi Timur-B04825
0 siblings, 1 reply; 4+ messages in thread
From: York Sun @ 2011-08-11 14:48 UTC (permalink / raw)
To: u-boot
Change the help message to be more helpful. Print argument format.
Fix MAX_NUM_PORTS to comply with v1 NXID format. Use decimal for port count.
Signed-off-by: York Sun <yorksun@freescale.com>
---
board/freescale/common/sys_eeprom.c | 4 ++--
common/cmd_mac.c | 29 +++++++++++++++++------------
2 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/board/freescale/common/sys_eeprom.c b/board/freescale/common/sys_eeprom.c
index d2ed036..e139a34 100644
--- a/board/freescale/common/sys_eeprom.c
+++ b/board/freescale/common/sys_eeprom.c
@@ -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
@@ -398,7 +398,7 @@ int do_mac(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
set_date(argv[2]);
break;
case 'p': /* MAC table size */
- e.mac_count = simple_strtoul(argv[2], NULL, 16);
+ e.mac_count = simple_strtoul(argv[2], NULL, 10);
update_crc();
break;
case '0' ... '9': /* "mac 0" through "mac 22" */
diff --git a/common/cmd_mac.c b/common/cmd_mac.c
index 1884c2a..bd9cc19 100644
--- a/common/cmd_mac.c
+++ b/common/cmd_mac.c
@@ -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
);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [u-boot-release] [Patch v3] powerpc/eeprom: cleanup mac command
2011-08-11 14:48 [U-Boot] [Patch v3] powerpc/eeprom: cleanup mac command York Sun
@ 2011-08-11 14:55 ` Tabi Timur-B04825
2011-08-11 15:03 ` York Sun
0 siblings, 1 reply; 4+ messages in thread
From: Tabi Timur-B04825 @ 2011-08-11 14:55 UTC (permalink / raw)
To: u-boot
York Sun wrote:
> - e.mac_count = simple_strtoul(argv[2], NULL, 16);
> + e.mac_count = simple_strtoul(argv[2], NULL, 10);
You forgot the MAC address index. There's another use of strtoul in the
code that needs to be fixed.
Also, if you use "0" instead of "10", then it should be able to handle
hex as well, just in case someone wants to use it.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [u-boot-release] [Patch v3] powerpc/eeprom: cleanup mac command
2011-08-11 14:55 ` [U-Boot] [u-boot-release] " Tabi Timur-B04825
@ 2011-08-11 15:03 ` York Sun
2011-08-11 18:40 ` Tabi Timur-B04825
0 siblings, 1 reply; 4+ messages in thread
From: York Sun @ 2011-08-11 15:03 UTC (permalink / raw)
To: u-boot
On Thu, 2011-08-11 at 09:55 -0500, Tabi Timur-B04825 wrote:
> York Sun wrote:
> > - e.mac_count = simple_strtoul(argv[2], NULL, 16);
> > + e.mac_count = simple_strtoul(argv[2], NULL, 10);
>
> You forgot the MAC address index. There's another use of strtoul in the
> code that needs to be fixed.
I didn't forget the index. It is base 10 already.
>
> Also, if you use "0" instead of "10", then it should be able to handle
> hex as well, just in case someone wants to use it.
That's not a bad idea. I will change to "0" but leave the mac address as
hex.
York
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [u-boot-release] [Patch v3] powerpc/eeprom: cleanup mac command
2011-08-11 15:03 ` York Sun
@ 2011-08-11 18:40 ` Tabi Timur-B04825
0 siblings, 0 replies; 4+ messages in thread
From: Tabi Timur-B04825 @ 2011-08-11 18:40 UTC (permalink / raw)
To: u-boot
I see two calls to simple_stroul, and both have 16 in them.
--
Timur Tabi
Linux kernel developer at Freescale
________________________________________
From: sun york-R58495
Sent: Thursday, August 11, 2011 10:03 AM
To: Tabi Timur-B04825
Cc: u-boot at lists.denx.de
Subject: Re: [u-boot-release] [Patch v3] powerpc/eeprom: cleanup mac command
On Thu, 2011-08-11 at 09:55 -0500, Tabi Timur-B04825 wrote:
> York Sun wrote:
> > - e.mac_count = simple_strtoul(argv[2], NULL, 16);
> > + e.mac_count = simple_strtoul(argv[2], NULL, 10);
>
> You forgot the MAC address index. There's another use of strtoul in the
> code that needs to be fixed.
I didn't forget the index. It is base 10 already.
>
> Also, if you use "0" instead of "10", then it should be able to handle
> hex as well, just in case someone wants to use it.
That's not a bad idea. I will change to "0" but leave the mac address as
hex.
York
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-08-11 18:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-11 14:48 [U-Boot] [Patch v3] powerpc/eeprom: cleanup mac command York Sun
2011-08-11 14:55 ` [U-Boot] [u-boot-release] " Tabi Timur-B04825
2011-08-11 15:03 ` York Sun
2011-08-11 18:40 ` Tabi Timur-B04825
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox