From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Andrew Lunn <andrew@lunn.ch>
Cc: David Jander <david@protonic.nl>,
kernel@pengutronix.de, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, Russell King <linux@armlinux.org.uk>,
mkl@pengutronix.de, Marek Vasut <marex@denx.de>,
Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>
Subject: PHY reset question
Date: Tue, 6 Oct 2020 10:04:24 +0200 [thread overview]
Message-ID: <20201006080424.GA6988@pengutronix.de> (raw)
Hello PHY experts,
Short version:
what is the proper way to handle the PHY reset before identifying PHY?
Long version:
I stumbled over following issue:
If PHY reset is registered within PHY node. Then, sometimes, we will not be
able to identify it (read PHY ID), because PHY is under reset.
mdio {
compatible = "virtual,mdio-gpio";
[...]
/* Microchip KSZ8081 */
usbeth_phy: ethernet-phy@3 {
reg = <0x3>;
interrupts-extended = <&gpio5 12 IRQ_TYPE_LEVEL_LOW>;
reset-gpios = <&gpio5 11 GPIO_ACTIVE_LOW>;
reset-assert-us = <500>;
reset-deassert-us = <1000>;
};
[...]
};
On simple boards with one PHY per MDIO bus, it is easy to workaround by using
phy-reset-gpios withing MAC node (illustrated in below DT example), instead of
using reset-gpios within PHY node (see above DT example).
&fec {
[...]
phy-mode = "rmii";
phy-reset-gpios = <&gpio4 12 GPIO_ACTIVE_LOW>;
[...]
};
On boards with multiple PHYs (for example attached to a switch) and separate
reset lines to each PHY, it becomes more challenging. In my case, after power
cycle the system is working as expected:
- pinmux is configured to GPIO mode with internal pull-up
- GPIO is by default in input state. So the internal pull-up will automatically
dessert the PHY reset.
On reboot, the system will assert the reset. GPIO configuration will survive the
reboot and PHYs will stay in the reset state, and not detected by the system.
So far I have following options/workarounds:
- do all needed configurations in the bootloader.
Disadvantage:
- not clear at which init level it should be done?
1. Boot ROM script (in case of iMX). One fix per each board. Ease to forget.
2. Pre bootloader. Same as 1.
3. GPIO driver in the bootloader. What if some configuration was done in
1. or 2.?
- we will go back to the same problem if we jumped to Kexec
- Use compatible ("compatible = "ethernet-phy-id0022.1560") in the devicetree,
so that reading the PHYID is not needed
- easy to solve.
Disadvantage:
- losing PHY auto-detection capability
- need a new devicetree if different PHY is used (for example in different
board revision)
- modify PHY framework to deassert reset before identifying the PHY.
Disadvantages?
Regards,
Oleksij
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next reply other threads:[~2020-10-06 8:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-06 8:04 Oleksij Rempel [this message]
2020-10-06 19:36 ` PHY reset question Florian Fainelli
2020-10-06 20:24 ` Marek Vasut
2020-10-06 21:11 ` Florian Fainelli
2020-10-06 22:24 ` Marek Vasut
2020-10-07 8:14 ` Marco Felsch
2020-10-07 8:23 ` Marek Vasut
2020-10-07 9:06 ` Marco Felsch
2020-10-07 9:20 ` Marek Vasut
2020-10-07 10:47 ` Marco Felsch
2020-10-07 15:44 ` Florian Fainelli
2020-10-07 9:50 ` Fabio Estevam
2020-10-09 14:25 ` Bruno Thomsen
2020-10-12 5:48 ` Oleksij Rempel
2020-10-12 8:25 ` Marek Vasut
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201006080424.GA6988@pengutronix.de \
--to=o.rempel@pengutronix.de \
--cc=andrew@lunn.ch \
--cc=david@protonic.nl \
--cc=f.fainelli@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=marex@denx.de \
--cc=mkl@pengutronix.de \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).