summaryrefslogtreecommitdiffstats
path: root/cmd/mdio.c
Commit message (Collapse)AuthorAgeFilesLines
* net: Drop dm.h header file from phy.hSimon Glass2020-08-031-0/+1
| | | | | | | This header file should not be included in other header files. Remove it and use other headers and C inclusions instead. Signed-off-by: Simon Glass <sjg@chromium.org>
* command: Remove the cmd_tbl_t typedefSimon Glass2020-05-181-1/+2
| | | | | | | | | | | | | We should not use typedefs in U-Boot. They cannot be used as forward declarations which means that header files must include the full header to access them. Drop the typedef and rename the struct to remove the _s suffix which is now not useful. This requires quite a few header-file additions. Signed-off-by: Simon Glass <sjg@chromium.org>
* net: mdio: Clarify code flow Covarity 244085 & 244090Joe Hershberger2019-09-041-1/+2
| | | | | | | | | Document that the lack of breaks is intentional. Series-to: u-boot Series-cc: ti Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* cmd: mdio: prevent data abort when no mdio bus is foundSimon Goldschmidt2019-07-181-0/+5
| | | | | | | | | | | | Calling 'mdio read ...' currently leads to a data abort when no mdio bus is found. To fix this, check if 'bus' is a valid pointer before accessing it. Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Tested-by: Vladimir Oltean <olteanv@gmail.com> Reviewed-by: Vladimir Oltean <olteanv@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: introduce MDIO DM class for MDIO devicesAlex Marginean2019-07-151-0/+5
| | | | | | | | | | | Adds UCLASS_MDIO DM class supporting MDIO buses that are probed as stand-alone devices. Useful in particular for systems that support DM_ETH and have a stand-alone MDIO hardware block shared by multiple Ethernet interfaces. Signed-off-by: Alex Marginean <alexm.osslist@gmail.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* cmd: mdio: Fix access to arbitrary PHY addressesVladimir Oltean2019-06-011-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Alex reported the following: " I'm doing some MDIO work on a freescale/NXP platform and I bumped into errors with this command: => mdio r emdio#3 5 3 Reading from bus emdio#3 "Synchronous Abort" handler, esr 0x8600000e elr: ffffffff862b8000 lr : 000000008200cce4 (reloc) ... mdio list does not list any PHYs currently because ethernet is using DM and the interfaces are not probed at this time. The PHY does exist on the bus though. The above scenario works with this commit reverted: e55047ec51a662c12ed53ff543ec7cdf158b2137 cmd: mdio: Switch to generic helpers when accessing the registers The current code using generic helpers only works for PHYs that have been registered and show up in bus->phymap and crashes for arbitrary IDs. I find it useful to allow reading from other addresses over MDIO too, certainly helpful for people debugging MDIO on various boards. " Fix this by reverting to use the raw MDIO bus operations in case there is no PHY probed based on DT at the specified address. This restores the old behavior for these PHYs, which means that the newly introduced MMD-over-C22 helpers won't be available for them, but at least they will be accessible again without crashing the system. Fixes: commit e55047ec51a6 ("cmd: mdio: Switch to generic helpers when accessing the registers") Reported-by: Alex Marginean <alexm.osslist@gmail.com> Signed-off-by: Vladimir Oltean <olteanv@gmail.com> Reviewed-by: Alex Marginean <alexm.osslist@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* cmd: mdio: Switch to generic helpers when accessing the registersCarlo Caione2019-05-071-11/+16
| | | | | | | | | | Switch to use the generic helpers to access the MMD registers so that we can used the same command also for C45 PHYs, C22 PHYs with direct and indirect access and PHYs implementing a custom way to access the registers. Signed-off-by: Carlo Caione <ccaione@baylibre.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini2018-05-071-2/+1
| | | | | | | | | | | | | | | | | | | | When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
* cmd: mdio: Fix style violationsMario Six2018-02-261-4/+3
| | | | | | | Fix some style violations in the MDIO command. Acked-by: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Mario Six <mario.six@gdsys.cc>
* common: miiphyutil: Work and report phy address in hex in mdio cmdMichal Simek2016-12-021-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It is confusing that mdio commands work and report phy id as decimal value when mii is working with hex values. For example: ZynqMP> mdio list gem: 21 - TI DP83867 <--> ethernet@ff0e0000 ZynqMP> mdio read ethernet@ff0e0000 0 Reading from bus gem PHY at address 21: 0 - 0x1140 ZynqMP> mii dump 21 0 Incorrect PHY address. Range should be 0-31 ... ZynqMP> mii dump 15 0. (1140) -- PHY control register -- (8000:0000) 0.15 = 0 reset U-Boot normally takes hex values that's why this patch is changing mdio command to handle hex instead of changing mii command to handle decimal values. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* Remove the cmd_ prefix from command filesSimon Glass2016-01-251-0/+313
Now that they are in their own directory, we can remove this prefix. This makes it easier to find a file since the prefix does not get in the way. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Heiko Schocher <hs@denx.de> Acked-by: Stefan Roese <sr@denx.de> Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>