summaryrefslogtreecommitdiffstats
path: root/commands/miitool.c
Commit message (Collapse)AuthorAgeFilesLines
* commands: miitool: remove unsupported options a and bAndreas Schmidt2018-12-171-6/+0
| | | | Signed-off-by: Andreas Schmidt <andreas.schmidt@wago.com>
* miitool: Fix inconsistent spacingAndrey Smirnov2018-10-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make sure that there's a space between device name and it's status string regardless if if device is using "id" field or not. Before: barebox@ZII RDU2 Board:/ miitool mdio0-phy00: mdio:no link mdio1-phy15: 2188000.ethernet@2188000:10 Mbit, half duplex, no link mdio1-phy16: 2188000.ethernet@2188000:10 Mbit, half duplex, no link mdio2-phy00: 2188000.ethernet@2188000:mdio:switch@0:no link mdio2-phy01: 2188000.ethernet@2188000:mdio:switch@0:no link mdio2-phy02: 2188000.ethernet@2188000:mdio:switch@0:negotiated 100baseTx-FD, link ok mdio2-phy03: 2188000.ethernet@2188000:mdio:switch@0:no link mdio2-phy04: 2188000.ethernet@2188000:mdio:switch@0:no link mdio3-phy01: eth1: negotiated 1000baseT-FD flow-control, link ok After: barebox@ZII RDU2 Board:/ miitool mdio0-phy00: mdio: no link mdio1-phy15: 2188000.ethernet@2188000: 10 Mbit, half duplex, no link mdio1-phy16: 2188000.ethernet@2188000: 10 Mbit, half duplex, no link mdio2-phy00: 2188000.ethernet@2188000:mdio:switch@0: no link mdio2-phy01: 2188000.ethernet@2188000:mdio:switch@0: no link mdio2-phy02: 2188000.ethernet@2188000:mdio:switch@0: no link mdio2-phy03: 2188000.ethernet@2188000:mdio:switch@0: no link mdio2-phy04: 2188000.ethernet@2188000:mdio:switch@0: no link mdio3-phy01: eth1: no link Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands/miitool: Allow specifying PHY by their full pathAndrey Smirnov2017-12-061-2/+4
| | | | | | | | | | Make -s option to be a bit more consistent with how it is used in other commands by allowing PHY device to be specified by either its name of full path in /dev. This change also allows us to leverage autocompletion since it will work as expected for paths in /dev. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: miitool: Constify 'phydevname' in mdiobus_show()Andrey Smirnov2017-12-061-1/+2
| | | | | | | | It seems like mdiobus_show() doesn't need more than read-only to 'phydevname', so constify it to allow passing const stings in. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* stdio: replace fprintf(stderr,...) with eprintfSascha Hauer2016-04-151-1/+1
| | | | | | | We have a shortcut for fprintf(stderr, so use it. This is done to be able to remove fprintf in the next step. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* miitool: Add code to register a PHYAndrey Smirnov2016-02-041-18/+76
| | | | | | | | | | | | | This commit changes the behaviour of the 'miitool'. Now in order to show PHY's link information 'miitool' should be invoked as such: miitool -s [PHY] Also, implment code to allow to register a dummy PHY device in order to be able to perform raw MDIO bus access. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* miitool: Don't print negative parent IDsAndrey Smirnov2016-02-031-2/+3
| | | | | | | | | Do not include ID of the parent to mii_bus if that ID is negative since it produces a rather confusing string (e.g. "mdio.11-1", which is very likely to be interpreted as "mdio.11<dash>1"). Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* miitool: Fix PHY argument handlingAndrey Smirnov2016-02-031-8/+17
| | | | | | | | | | | Instead of displaying the status of PHY "PHY" the tool will print status of all PHYs it encounters while searching for the one that was requested. This commit fixes the logic such that only requested information is printed. Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2014-07-041-3/+3
|\ | | | | | | | | | | | | | | Conflicts: arch/arm/boards/chumby_falconwing/falconwing.c arch/arm/boards/imx233-olinuxino/imx23-olinuxino.c arch/x86/mach-x86.dox scripts/setupmbr/setupmbr.c
| * mii-tool: make the 'No MII transceiver present!' message more clearAntony Pavlov2014-07-021-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Suppose you have two network controllers. The first one is ENC28J60 (it is in low power mode after start) the second one is always-enabled eth1. As ENC28J60 is in low power mode before enc28j60_eth_open() is called. ENC28J60's mii traceiver is in low power mode too so the mii traceiver's register are inaccessable. Here is a sample log just after barebox start: barebox:/ miitool miibus0: registered phy as /dev/phy0 No MII transceiver present!. miibus1: registered phy as /dev/phy1 phy1: eth1: negotiated 100baseTx-FD, link ok barebox:/ miitool No MII transceiver present!. phy1: eth1: negotiated 100baseTx-FD, link ok The 'No MII transceiver present!.' message is confusing here. This patch fixes the problem so the miitool output looks like this: barebox:/ miitool phy0: spieth0: No MII transceiver present!. phy1: eth1: negotiated 100baseTx-FD, link ok Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Documentation: remove doxygen documentationSascha Hauer2014-06-261-6/+0
|/ | | | | | | The doxygen documentation is long outdated. Remove it. It will be replaced with sphinx based documentation later. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mii-tool: Fix gigabit advertise / link partner ability mixupSascha Hauer2014-06-111-2/+2
| | | | | | | bmcr2 contains the gigabit advertise bits and lpa2 contains the gigabit link partner ability bits, not the other way round. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mii-tool: Fix gigabit link testSascha Hauer2014-06-111-1/+1
| | | | | | | | | | | | media_list tests for gigabit phys like this: if (mask & BMCR_SPEED1000) mask does not contain the value of the BMCR register though, so the test is completely bogus. Test for mask2 instead which is only nonzero when the phy has gigabit capabilities. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mii-tool: Fix string lengthSascha Hauer2014-06-111-1/+1
| | | | | | | | media_list writes into a static string. Worst case length of this string is 125 bytes, but the function only allocates 100 bytes. Use 256 bytes which is long enough for some extensions. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: harmonize in-barebox documentationHolger Schurig2014-05-141-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch does probably too much, but it's hard (and very cumbersome/time consuming) to break it out. What is does is this: * each command has one short description, e.g. "list MUX configuration" * made sure the short descriptions start lowercase * each command has one usage. That string contains just the options, e.g. "[-npn]". It's not part of the long help text. * that is, it doesn't say "[OPTIONS]" anymore, every usable option is listed by character in this (short) option string (the long description is in the long help text, as before) * help texts have been reworked, to make them - sometimes smaller - sometimes describe the options better - more often present themselves in a nicer format * all long help texts are now created with BUSYBOX_CMD_HELP_ macros, no more 'static const __maybe_unused char cmd_foobar_help[]' * made sure the long help texts starts uppercase * because cmdtp->name and cmdtp->opts together provide the new usage, all "Usage: foobar" texts have been removed from the long help texts * BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this is nicer in the source code * BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself * made sure no line gets longer than 77 characters * delibertely renamed cmdtp->usage, so that we can get compile-time errors (e.g. in out-of-tree modules that use register_command() * the 'help' command can now always emit the usage, even without compiled long help texts * 'help -v' gives a list of commands with their short description, this is similar like the old "help" command before my patchset * 'help -a' gives out help of all commands Signed-off-by: Holger Schurig <holgerschurig@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: group 'help' outputHolger Schurig2014-05-141-0/+1
| | | | | | | | | | | | | | | | | | | The old output of "help" was just producing a long list, that usually scrolled of the screen (even on a X11 terminal). This list is more compact, and also sorted by groups. The old output format (plus grouping) is now available with 'help -v'. Example: Information commands: ?, devinfo, help, iomem, meminfo, version Boot commands: boot, bootm, go, loadb, loads, loadx, loady, saves, uimage ... Signed-off-by: Holger Schurig <holgerschurig@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* miitool: drop internal table of known MII, use phy drivers insteadAntony Pavlov2014-01-061-25/+5
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* miitool: add initial GbE supportAntony Pavlov2014-01-061-16/+56
| | | | | | | | | | | | | | | | | | The GbE support based on the patch for generic 'mii-tool', see http://ftp.debian.org/debian/pool/main/n/net-tools/net-tools_1.60-24.2.diff.gz We need to note Jean-Christophe PLAGNIOL-VILLARD for his initial GbE support patch: http://lists.infradead.org/pipermail/barebox/2013-February/012634.html Generic 'mii-tool' GbE support patch has some disadvantages: 1. 1000baseT-HD is prefered to 1000baseT-FD; 2. show GbE-features for 10/100 only phys (e.g. Level One LXT971). This patch fixes this disadvantages. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* miitool: change behaviour closer to linux' mii-toolAntony Pavlov2014-01-061-41/+47
| | | | | | | miitool without arguments will try to show status for all phys. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* miitool: Add option to scan mii busesSascha Hauer2013-12-111-2/+10
| | | | | | | | | With the -s option all mii buses can be scanned for devices so that they are available without doing network operations. Also, now *all* phy devices on a mii bus can be examined, not only the one attached to an ethernet device. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* add 'miitool' command to view media-independent interface statusAntony Pavlov2012-10-301-0/+268
This command is based on the 'mii-diag' and 'mii-tool' Unix utilities, but it lacks routines to manipulate MII state (e.g. reset MII, restart autonegotiation or force MII mode). This version of the 'miitool' command has no GbE support, but we can upgrade it in the future. The GbE support patch for generic 'mii-tool' is here http://ftp.debian.org/debian/pool/main/n/net-tools/net-tools_1.60-24.2.diff.gz EXAMPLE: barebox:/ miitool -vv /dev/phy0 negotiated 100baseTx-FD, link ok registers for MII PHY: 3100 782d 0013 78e2 01e1 45e1 0007 2001 0000 ffff ffff ffff ffff ffff ffff ffff 0084 4780 0000 0000 0422 0000 0000 0000 0000 0000 0080 0000 ffff 0000 0000 3660 product info: Level One LXT971A rev 2 basic mode: autonegotiation enabled basic status: autonegotiation complete, link ok capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD advertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD link partner: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>