mbox series

[net-next,v3,0/2] net: mdio-ipq4019: fix wrong default MDC rate

Message ID 20240131022606.1532-1-ansuelsmth@gmail.com
Headers show
Series net: mdio-ipq4019: fix wrong default MDC rate | expand

Message

Christian Marangi Jan. 31, 2024, 2:26 a.m. UTC
This was a long journey to arrive and discover this problem.

To not waste too much char, there is a race problem with PHY and driver
probe. This was observed with Aquantia PHY firmware loading.

With some hacks the race problem was workarounded but an interesting
thing was notice. It took more than a minute for the firmware to load
via MDIO.

This was strange as the same operation was done by UBoot in at max 5
second and the same data was loaded.

A similar problem was observed on a mtk board that also had an
Aquantia PHY where the load was very slow. It was notice that the cause
was the MDIO bus running at a very low speed and the firmware
was missing a property (present in mtk sdk) that set the right frequency
to the MDIO bus.

It was fun to find that THE VERY SAME PROBLEM is present on IPQ in a
different form. The MDIO apply internally a division to the feed clock
resulting in the bus running at 390KHz instead of 6.25Mhz.

Searching around the web for some documentation and some include and
analyzing the uboot codeflow resulted in the divider being set wrongly
at /256 instead of /16 as the value was actually never set.
Applying the value restore the original load time for the Aquantia PHY.

This series mainly handle this by adding support for the "clock-frequency"
property.

Changes v3:
- Add Reviewed-by tag
- Fix english grammar error in comment
- Drop DTS patch
Changes v2:
- Use DIV_ROUND_UP
- Introduce logic to chose a default value for 802.3 spec 2.5MHz

Christian Marangi (2):
  dt-bindings: net: ipq4019-mdio: document now supported clock-frequency
  net: mdio: ipq4019: add support for clock-frequency property

 .../bindings/net/qcom,ipq4019-mdio.yaml       |  15 +++
 drivers/net/mdio/mdio-ipq4019.c               | 109 +++++++++++++++++-
 2 files changed, 118 insertions(+), 6 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org Feb. 2, 2024, 10:10 a.m. UTC | #1
Hello:

This series was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

On Wed, 31 Jan 2024 03:26:02 +0100 you wrote:
> This was a long journey to arrive and discover this problem.
> 
> To not waste too much char, there is a race problem with PHY and driver
> probe. This was observed with Aquantia PHY firmware loading.
> 
> With some hacks the race problem was workarounded but an interesting
> thing was notice. It took more than a minute for the firmware to load
> via MDIO.
> 
> [...]

Here is the summary with links:
  - [net-next,v3,1/2] dt-bindings: net: ipq4019-mdio: document now supported clock-frequency
    https://git.kernel.org/netdev/net-next/c/9484b9555de0
  - [net-next,v3,2/2] net: mdio: ipq4019: add support for clock-frequency property
    https://git.kernel.org/netdev/net-next/c/bdce82e960d1

You are awesome, thank you!