]> git.baikalelectronics.ru Git - uboot.git/commit
cmd: mdio: Fix access to arbitrary PHY addresses
authorVladimir Oltean <olteanv@gmail.com>
Thu, 30 May 2019 00:08:32 +0000 (03:08 +0300)
committerJoe Hershberger <joe.hershberger@ni.com>
Sat, 1 Jun 2019 18:33:17 +0000 (13:33 -0500)
commit81fe4386386640316cce5fac862914989bdb2616
tree8008cdd498bfb685bb8c0ecde7c47a9db45fab41
parenta69ebef2d44eb8b24498c9d8a9a579f67ba1276b
cmd: mdio: Fix access to arbitrary PHY addresses

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:
  874cd75a25ca72254567128cebff23fd9584b495 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 874cd75a25ca ("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.c