Messages in this thread | | | Date | Thu, 11 May 2023 11:19:52 +0800 | Subject | Re: [PATCH v3] net: mdiobus: Add a function to deassert reset | From | Yan Wang <> |
| |
On 5/11/2023 6:15 AM, Andrew Lunn wrote: >> +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. I'm very sorry, I forgot. Thank you > Andrew
| |