net: ti: cpsw-mdio: Add workaround for errata i2329
authorRavi Gunasekaran <r-gunasekaran@ti.com>
Thu, 22 Sep 2022 09:51:23 +0000 (15:21 +0530)
committerTom Rini <trini@konsulko.com>
Fri, 7 Oct 2022 01:05:17 +0000 (21:05 -0400)
commit9ea30ea66a57b47f42d68733840adf43714eb882
tree8e6c38624ad4af2c276c0baa1735b49b58d3dc5c
parent742f302cdc9198dc27deeea8c1c35482cf616ec2
net: ti: cpsw-mdio: Add workaround for errata i2329

In certain TI SoCs, on the CPSW and ICSS peripherals, there is
a possibility that the MDIO interface returns corrupt data on
MDIO reads or writes incorrect data on MDIO writes. There is also
a possibility for the MDIO interface to become unavailable until
the next peripheral reset.

The workaround is to configure the MDIO in manual mode and disable the
MDIO state machine and emulate the MDIO protocol by reading and writing
appropriate fields in MDIO_MANUAL_IF_REG register of the MDIO controller
to manipulate the MDIO clock and data pins.

More details about the errata i2329 and the workaround is available in:
https://www.ti.com/lit/er/sprz487a/sprz487a.pdf

Add implementation to disable MDIO state machine, configure MDIO in manual
mode and provide software MDIO read and writes via MDIO bitbanging. Allow
the MDIO to be initialized based on the need for manual mode.

Signed-off-by: Ravi Gunasekaran <r-gunasekaran@ti.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
drivers/net/ti/am65-cpsw-nuss.c
drivers/net/ti/cpsw.c
drivers/net/ti/cpsw_mdio.c
drivers/net/ti/cpsw_mdio.h
drivers/net/ti/keystone_net.c