Patchwork [U-Boot] cmd_mii parameter choice

login
register
mail settings
Submitter Stephan Bauroth
Date Aug. 8, 2013, 11:44 a.m.
Message ID <OF13D5DE37.67B48CEB-ONC1257BC1.003EF79A-C1257BC1.004082D2@retarus.de>
Download mbox | patch
Permalink /patch/265707/
State Accepted
Delegated to: Joe Hershberger
Headers show

Comments

Stephan Bauroth - Aug. 8, 2013, 11:44 a.m.
Hi experts,

stumbling across some kernel panics due to a faulty ethernet-driver, i 
recently got to use the mii command set for some analysis. Doing so, I 
noticed some inconvienient behaviour in the parameter choices of the 
mii-commands. the command in general takes 5 arguments: the 'sub'-command 
to execute ('read','write','dev','info' or 'dump') and four number/ranges, 
specifying the mii-addresses and corresponding registers. the command is 
intelligent somehow and remembers the last used parameters (and reuses 
them if none are specified), so
        > mii dump 1-3 0-5
        > mii dump
gives two exactly same outputs. this is pretty neat. what is irritating to 
me is:
        1. why not check for all valid mii-adresses if none is specified? 
(i only got a PHY on mii 6, if i call 'mii dump', i want that one)
        2. the initialisation of the last used parameters is unclear to 
me. i wasn't able to find it in the source code, and if i execute
                > mii dump 6
            as first command after reboot, the command only dumps register 
0, why not dump 0-5, since those are standards anyway?
        3. when calling 'mii dump' on an invalid address, the dump doesn't 
deliver an error, it returns '0xffff' for the register. why? :)
                (this is for both, valid but unpresent addresses (e.g. 5), 
and invalid addresses (e.g. 100))


another example:
        > mii dump 6 0-5
        > mii dump 100
gives 6 fine-dumped registers at first and 6 0xffff-dumped registers for 
address 100. I really don't think this is critical, but i guess it's not 
wanted...


btw: i stumbled upon a 'typo' in the mii-cmd-set:


(not critical either, but hey :))


regards,
Stephan

Patch

diff --git a/common/cmd_mii.c b/common/cmd_mii.c
index d3dd6b1..b82a7ce 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"              },