From patchwork Thu Aug 11 15:31:50 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: York Sun X-Patchwork-Id: 109631 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 02A9FB70B9 for ; Fri, 12 Aug 2011 01:32:12 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 68FA1281F9; Thu, 11 Aug 2011 17:32:10 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Dn-UiGu5-Rip; Thu, 11 Aug 2011 17:32:10 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 124CF2823F; Thu, 11 Aug 2011 17:32:08 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 78DDD2823F for ; Thu, 11 Aug 2011 17:32:04 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Hgr8Yk+KYDYI for ; Thu, 11 Aug 2011 17:32:02 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from ch1outboundpool.messaging.microsoft.com (ch1ehsobe001.messaging.microsoft.com [216.32.181.181]) by theia.denx.de (Postfix) with ESMTPS id 80562281F9 for ; Thu, 11 Aug 2011 17:32:01 +0200 (CEST) Received: from mail215-ch1-R.bigfish.com (216.32.181.174) by CH1EHSOBE003.bigfish.com (10.43.70.53) with Microsoft SMTP Server id 14.1.225.22; Thu, 11 Aug 2011 15:31:59 +0000 Received: from mail215-ch1 (localhost.localdomain [127.0.0.1]) by mail215-ch1-R.bigfish.com (Postfix) with ESMTP id 7D2EF12802BE for ; Thu, 11 Aug 2011 15:31:59 +0000 (UTC) X-SpamScore: -1 X-BigFish: VS-1(zzfb6Izz1202hzz8275bhz2dh2a8h668h839h) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPVD:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail215-ch1 (localhost.localdomain [127.0.0.1]) by mail215-ch1 (MessageSwitch) id 1313076719339199_32050; Thu, 11 Aug 2011 15:31:59 +0000 (UTC) Received: from CH1EHSMHS003.bigfish.com (snatpool1.int.messaging.microsoft.com [10.43.68.254]) by mail215-ch1.bigfish.com (Postfix) with ESMTP id 44CB3A6004C for ; Thu, 11 Aug 2011 15:31:59 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CH1EHSMHS003.bigfish.com (10.43.70.3) with Microsoft SMTP Server (TLS) id 14.1.225.22; Thu, 11 Aug 2011 15:31:52 +0000 Received: from az33smr02.freescale.net (10.64.34.200) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server id 14.1.323.2; Thu, 11 Aug 2011 10:31:51 -0500 Received: from localhost.localdomain (oslab-l1.am.freescale.net [10.82.136.101]) by az33smr02.freescale.net (8.13.1/8.13.0) with ESMTP id p7BFVpoT015221; Thu, 11 Aug 2011 10:31:51 -0500 (CDT) From: York Sun To: Date: Thu, 11 Aug 2011 10:31:50 -0500 Message-ID: <1313076710-12662-1-git-send-email-yorksun@freescale.com> X-Mailer: git-send-email 1.7.0.4 MIME-Version: 1.0 X-OriginatorOrg: freescale.com Subject: [U-Boot] [Patch v4] powerpc/eeprom: cleanup mac command X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Change the help message to be more helpful. Print argument format. Fix MAX_NUM_PORTS to comply with v1 NXID format. Accept hexadecimal and decimal for port count and index. Signed-off-by: York Sun --- board/freescale/common/sys_eeprom.c | 8 ++++---- common/cmd_mac.c | 29 +++++++++++++++++------------ 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/board/freescale/common/sys_eeprom.c b/board/freescale/common/sys_eeprom.c index d2ed036..bd3572b 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,11 +398,11 @@ 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, 0); update_crc(); break; - case '0' ... '9': /* "mac 0" through "mac 22" */ - set_mac_address(simple_strtoul(argv[1], NULL, 10), argv[2]); + case '0' ... '9': /* "mac 0" through "mac 31" */ + set_mac_address(simple_strtoul(argv[1], NULL, 0), argv[2]); break; case 'h': /* help */ default: 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 \n" + " - program as system serial number\n" + "mac errata \n" + " - program as errata data\n" + "mac date \n" + " - program timestamp\n" + "mac ports \n" " - program the number of ports\n" - "mac X\n" - " - program the MAC address for port X [X=0...7]" + "mac \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 );