[U-Boot] cmd_mii parameter choice

Stephan Bauroth stephan.bauroth at iav.de
Thu Aug 8 13:44:41 CEST 2013


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:

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"              },

(not critical either, but hey :))


regards,
Stephan


More information about the U-Boot mailing list