mbox series

[net-next,0/3] net: phy: dp83867: add binding and support for io_impedance_ctrl nvmem cell

Message ID 20220606202220.1670714-1-linux@rasmusvillemoes.dk
Headers show
Series net: phy: dp83867: add binding and support for io_impedance_ctrl nvmem cell | expand

Message

Rasmus Villemoes June 6, 2022, 8:22 p.m. UTC
We have a board where measurements indicate that the current three
options - leaving IO_IMPEDANCE_CTRL at the (factory calibrated) reset
value or using one of the two boolean properties to set it to the
min/max value - are too coarse.

This series adds a device tree binding for an nvmem cell which can be
populated during production with a suitable value calibrated for each
board, and corresponding support in the driver. The second patch adds
a trivial phy wrapper for dev_err_probe(), used in the third.


Rasmus Villemoes (3):
  dt-bindings: dp83867: add binding for io_impedance_ctrl nvmem cell
  linux/phy.h: add phydev_err_probe() wrapper for dev_err_probe()
  net: phy: dp83867: implement support for io_impedance_ctrl nvmem cell

 .../devicetree/bindings/net/ti,dp83867.yaml   | 18 +++++-
 drivers/net/phy/dp83867.c                     | 55 +++++++++++++++++--
 include/linux/phy.h                           |  3 +
 3 files changed, 67 insertions(+), 9 deletions(-)

Comments

Rasmus Villemoes June 7, 2022, 11:54 a.m. UTC | #1
On 06/06/2022 23.58, Andrew Lunn wrote:
>> There is no documented mapping from the 32 possible values of the
>> IO_IMPEDANCE_CTRL field to values in the range 35-70 ohms
> 
> There have been a few active TI engineers submitting patches to TI PHY
> drivers. Please could you reach out to them and ask if they can
> provide documentation.
>
> Having magic values in DT is not the preferred why to use it. Ideally
> you should store Ohms in the cell and convert to the register value.

We've already asked TI for more detailed information, but apparently the
data sheet already says all there is to know. I should have worded the
commit message differently. Something like

  There is no fixed mapping from register values to values in the range
  35-70 ohms; it varies from chip to chip, and even that target range is
  approximate.

So AFAICS the only meaningful thing to store in an nvmem cell is an
appropriate (per-board) raw value of that field.

I would think this would be very similar to how various sensors have
nvmem cells defining calibration data.

Rasmus