From patchwork Mon Aug 12 11:05:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Bauroth X-Patchwork-Id: 266488 X-Patchwork-Delegate: joe.hershberger@gmail.com 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 163F92C008A for ; Mon, 12 Aug 2013 21:05:57 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 29A174A02C; Mon, 12 Aug 2013 13:05:48 +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 N-xcKKWLsovJ; Mon, 12 Aug 2013 13:05:47 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 701AC4A01F; Mon, 12 Aug 2013 13:05:45 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AE3A34A01F for ; Mon, 12 Aug 2013 13:05:42 +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 RzDf1+EU-NNw for ; Mon, 12 Aug 2013 13:05:40 +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 mailout03.rmx.de (mailout03.rmx.de [217.111.120.11]) by theia.denx.de (Postfix) with ESMTPS id 521674A018 for ; Mon, 12 Aug 2013 13:05:34 +0200 (CEST) Received: from cryptout01.retarus.com ([172.19.21.78]) by mailout03.rmx.de (8.14.4/8.14.5/retarus.custom) with ESMTP id r7CB5Vgg028501 for ; Mon, 12 Aug 2013 13:05:32 +0200 Received: from cryptout01 (localhost [127.0.0.1]) by cryptout01.retarus.com (Postfix) with ESMTP id 7E6CA14D604 for ; Mon, 12 Aug 2013 13:05:30 +0200 (CEST) Received: from cryptrouter01.dmz2.retloc (unknown [172.19.21.36]) by cryptout01.retarus.com (Postfix) with SMTP id 2375614D604 for ; Mon, 12 Aug 2013 13:05:29 +0200 (CEST) X-RMX-Split: 2013-08-12 13:05:26 +0200 To: u-boot@lists.denx.de MIME-Version: 1.0 X-KeepSent: C443A64E:1B89EB46-C1257BC5:003CAD7D; type=4; name=$KeepSent X-Mailer: Lotus Notes Release 8.5.3FP1 March 08, 2012 From: Stephan Bauroth Message-ID: Date: Mon, 12 Aug 2013 13:05:05 +0200 X-RouteServers: CN=SRVB02M/O=IAV;CN=SRVHUB1/O=IAV X-MIMETrack: Serialize by Router on jaja/RetarusMail(Release 8.5.3FP3|November 15, 2012) at 08/12/2013 13:05:15, Serialize complete at 08/12/2013 13:05:15 X-RMX-ID: 20130812-130516-r7CB5FOD006932-0@kdin02 X-RMX-TRACE: 2013-08-12 13:05:16 KdIn2013@kdin02/mailcc05 [0.1s] 20130812-130516-r7CB5FOD006932-0@kdin02 0:00:00 X-RMX-TRACE: 2013-08-12 13:05:16 RmxMSO@kdin02/mailcc06 [0.0s] 20130812-130516-r7CB5FOD006932-0@kdin02 0:00:00 X-Content-Filtered-By: Mailman/MimeDel 2.1.11 Subject: [U-Boot] [PATCH] mii: dump: parameter choice X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 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 Hi all, since no one commented on my prior mail, i just took the liberty to write a little patch that chooses regs 0-5 if none are specified for 'mii dump'. Also fixes some alignment issues, typos and introduces the 'Selector Field' to the register description of PHY regs 4 and 5. On top, 'mii dump' now prints the PHY address in front of a register dump. this is my first patch, if anything is wrong, plese tell me :) if (miiphy_read(devname, addr, reg, ®s[reg]) != 0) { @@ -394,8 +400,9 @@ static int do_mii(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) rcode = 1; } } - if (ok) - MII_dump_0_to_5(regs, reglo, reghi); + if (ok) { + MII_dump_0_to_5(addr, regs, reglo, reghi); + } printf("\n"); } } else if (strncmp(op, "de", 2) == 0) { diff --git a/common/cmd_mii.c b/common/cmd_mii.c index d3dd6b1..1856c5b 100644 --- a/common/cmd_mii.c +++ b/common/cmd_mii.c @@ -78,9 +78,9 @@ static const MII_field_desc_t reg_3_desc_tbl[] = { static const MII_field_desc_t reg_4_desc_tbl[] = { { 15, 15, 0x01, "next page able" }, - { 14, 14, 0x01, "reserved" }, + { 14, 14, 0x01, "(reserved)" }, { 13, 13, 0x01, "remote fault" }, - { 12, 12, 0x01, "reserved" }, + { 12, 12, 0x01, "(reserved)" }, { 11, 11, 0x01, "asymmetric pause" }, { 10, 10, 0x01, "pause enable" }, { 9, 9, 0x01, "100BASE-T4 able" }, @@ -88,7 +88,7 @@ static const MII_field_desc_t reg_4_desc_tbl[] = { { 7, 7, 0x01, "100BASE-TX able" }, { 6, 6, 0x01, "10BASE-T full duplex able" }, { 5, 5, 0x01, "10BASE-T able" }, - { 4, 0, 0x1f, "xxx to do" }, + { 4, 0, 0x1f, "Selector Field" }, }; static const MII_field_desc_t reg_5_desc_tbl[] = { @@ -103,7 +103,7 @@ static const MII_field_desc_t reg_5_desc_tbl[] = { { 7, 7, 0x01, "100BASE-TX able" }, { 6, 6, 0x01, "10BASE-T full duplex able" }, { 5, 5, 0x01, "10BASE-T able" }, - { 4, 0, 0x1f, "xxx to do" }, + { 4, 0, 0x1f, "Selctor Field" }, }; typedef struct _MII_field_desc_and_len_t { const MII_field_desc_t *pdesc; @@ -130,6 +130,7 @@ static int special_field( ushort regval); static void MII_dump_0_to_5( + unsigned char addr, ushort regvals[6], uchar reglo, uchar reghi) @@ -138,6 +139,7 @@ static void MII_dump_0_to_5( for (i = 0; i < 6; i++) { if ((reglo <= i) && (i <= reghi)) + printf("%02x.", addr); dump_reg(regvals[i], ®_0_5_desc_tbl[i], &desc_and_len_tbl[i]); } @@ -218,7 +220,7 @@ static int special_field( else if ((regno == MII_ADVERTISE) && (pdesc->lo == 0)) { ushort sel_bits = (regval >> pdesc->lo) & pdesc->mask; - printf("%2u-%2u = %5u selector = %s", + printf("%2u-%2u = %5u Selector Field = %s", pdesc->hi, pdesc->lo, sel_bits, sel_bits == PHY_ANLPAR_PSB_802_3 ? "IEEE 802.3" : @@ -230,7 +232,7 @@ static int special_field( else if ((regno == MII_LPA) && (pdesc->lo == 0)) { ushort sel_bits = (regval >> pdesc->lo) & pdesc->mask; - printf("%2u-%2u = %u selector = %s", + printf("%2u-%2u = %5u Selector Field = %s", pdesc->hi, pdesc->lo, sel_bits, sel_bits == PHY_ANLPAR_PSB_802_3 ? "IEEE 802.3" : @@ -384,6 +386,10 @@ static int do_mii(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) "standard MII registers, 0-5.\n"); return 1; } + if (argc < 4){ /* no reg-range given -> dump 0 to 5 */ + reglo = 0; + reghi = 5; + } for (addr = addrlo; addr <= addrhi; addr++) { for (reg = reglo; reg < reghi + 1; reg++) {