Messages in this thread | | | Date | Mon, 16 Jan 2023 12:10:39 +0100 | From | Simon Horman <> | Subject | Re: [PATCH v2] net: mdio: force deassert MDIO reset signal |
| |
On Sun, Jan 15, 2023 at 10:37:46PM +0100, Pierluigi Passaro wrote: > When the reset gpio is defined within the node of the device tree > describing the PHY, the reset is initialized and managed only after > calling the fwnode_mdiobus_phy_device_register function. > However, before calling it, the MDIO communication is checked by the > get_phy_device function. > When this happen and the reset GPIO was somehow previously set down, > the get_phy_device function fails, preventing the PHY detection. > These changes force the deassert of the MDIO reset signal before > checking the MDIO channel. > The PHY may require a minimum deassert time before being responsive: > use a reasonable sleep time after forcing the deassert of the MDIO > reset signal. > Once done, free the gpio descriptor to allow managing it later. > > Signed-off-by: Pierluigi Passaro <pierluigi.p@variscite.com> > Signed-off-by: FrancescoFerraro <francesco.f@variscite.com> > --- > drivers/net/mdio/fwnode_mdio.c | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > > diff --git a/drivers/net/mdio/fwnode_mdio.c b/drivers/net/mdio/fwnode_mdio.c > index b782c35c4ac1..1f4b8c4c1f60 100644 > --- a/drivers/net/mdio/fwnode_mdio.c > +++ b/drivers/net/mdio/fwnode_mdio.c > @@ -8,6 +8,8 @@ > > #include <linux/acpi.h> > #include <linux/fwnode_mdio.h> > +#include <linux/gpio/consumer.h> > +#include <linux/gpio/driver.h> > #include <linux/of.h> > #include <linux/phy.h> > #include <linux/pse-pd/pse.h> > @@ -118,6 +120,8 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus, > bool is_c45 = false; > u32 phy_id; > int rc; > + int reset_deassert_delay = 0;
nit: it looks like scope of reset_deassert_delay could be reduced to the else clause where it is used.
> + struct gpio_desc *reset_gpio;
nit: reverse xmas tree for local variable declarations
...
Also, if reposting, the target tree for this should be in the subject. Assuming net-next, that would mean "[PATCH net-next v3]"
| |