[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5b6eb4c3-1ef8-4ed5-bcf3-0bb11897ce24@lunn.ch>
Date: Thu, 11 May 2023 00:15:21 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Yan Wang <rk.code@...look.com>
Cc: hkallweit1@...il.com, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, linux@...linux.org.uk
Subject: Re: [PATCH v3] net: mdiobus: Add a function to deassert reset
> +static void fwnode_mdiobus_pre_enable_phy(struct fwnode_handle *fwnode)
> +{
> + struct gpio_desc *reset;
> +
> + reset = fwnode_gpiod_get_index(fwnode, "reset", 0, GPIOD_OUT_HIGH, NULL);
> + if (IS_ERR(reset) && PTR_ERR(reset) != -EPROBE_DEFER)
> + return;
> +
> + usleep_range(100, 200);
> + gpiod_set_value_cansleep(reset, 0);
> + /*Release the reset pin,it needs to be registered with the PHY.*/
> + gpiod_put(reset);
You are still putting it into reset, and then taking it out of
reset. This is what i said should not be done. Please only take it out
of reset if it is in reset.
Also, you ignored my comments about delay after reset.
Documentation/devicetree/bindings/net/ethernet-phy.yaml says:
reset-gpios:
maxItems: 1
description:
The GPIO phandle and specifier for the PHY reset signal.
reset-assert-us:
description:
Delay after the reset was asserted in microseconds. If this
property is missing the delay will be skipped.
reset-deassert-us:
description:
Delay after the reset was deasserted in microseconds. If
this property is missing the delay will be skipped.
You are deasserting the reset, so you should look for this property,
and if it is there, delay for that amount. Some PHYs take a while
before they will respond on the bus.
Andrew
Powered by blists - more mailing lists