Message ID | A2CA0424C0A6F04399FB9E1CD98E030484506F3B@US01WEMBX2.internal.synopsys.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Paul Zimmerman <Paul.Zimmerman@synopsys.com> writes: > The patch below fixes it. And it seems like the right thing to me, > since GPIOs should be optional for a generic phy, I would think. But > my device tree foo is very weak, so I'm not sure. > > CCing Robert, who touched the generic phy code last. Robert, what do > you think? I think your patch in [1] is correct, because "Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt" states that reset-gpios is optional, and because Felipe told me gpios for phy_generic are optional. Now the original code was written by Felipe, so better ask him first. The original code was : af9f51c55 phy-generic.c nop->gpio_reset = of_get_named_gpio_flags(node, "reset-gpios", af9f51c55 phy-generic.c 0, &flags); af9f51c55 phy-generic.c if (nop->gpio_reset == -EPROBE_DEFER) af9f51c55 phy-generic.c return -EPROBE_DEFER; Cheers. -- Robert [1] > diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c > index dd05254..9a826ff 100644 > --- a/drivers/usb/phy/phy-generic.c > +++ b/drivers/usb/phy/phy-generic.c > @@ -218,10 +218,10 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop, > clk_rate = 0; > > needs_vcc = of_property_read_bool(node, "vcc-supply"); > - nop->gpiod_reset = devm_gpiod_get(dev, "reset-gpios"); > + nop->gpiod_reset = devm_gpiod_get_optional(dev, "reset-gpios"); > err = PTR_ERR(nop->gpiod_reset); > if (!err) { > - nop->gpiod_vbus = devm_gpiod_get(dev, > + nop->gpiod_vbus = devm_gpiod_get_optional(dev, > "vbus-detect-gpio"); > err = PTR_ERR(nop->gpiod_vbus); > }
On Tue, Jan 13, 2015 at 10:35:52AM +0100, Robert Jarzmik wrote: > Paul Zimmerman <Paul.Zimmerman@synopsys.com> writes: > > The patch below fixes it. And it seems like the right thing to me, > > since GPIOs should be optional for a generic phy, I would think. But > > my device tree foo is very weak, so I'm not sure. > > > > CCing Robert, who touched the generic phy code last. Robert, what do > > you think? > I think your patch in [1] is correct, because > "Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt" states that > reset-gpios is optional, and because Felipe told me gpios for phy_generic are > optional. > > Now the original code was written by Felipe, so better ask him first. The > original code was : > af9f51c55 phy-generic.c nop->gpio_reset = of_get_named_gpio_flags(node, "reset-gpios", > af9f51c55 phy-generic.c 0, &flags); > af9f51c55 phy-generic.c if (nop->gpio_reset == -EPROBE_DEFER) > af9f51c55 phy-generic.c return -EPROBE_DEFER; yeah, at the time that was written, there was no _optional() varianto of get_gpio, if there is one now, we should use it, indeed. I can rather easily test here on BBB to make sure there are no regressions.
diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c index dd05254..9a826ff 100644 --- a/drivers/usb/phy/phy-generic.c +++ b/drivers/usb/phy/phy-generic.c @@ -218,10 +218,10 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop, clk_rate = 0; needs_vcc = of_property_read_bool(node, "vcc-supply"); - nop->gpiod_reset = devm_gpiod_get(dev, "reset-gpios"); + nop->gpiod_reset = devm_gpiod_get_optional(dev, "reset-gpios"); err = PTR_ERR(nop->gpiod_reset); if (!err) { - nop->gpiod_vbus = devm_gpiod_get(dev, + nop->gpiod_vbus = devm_gpiod_get_optional(dev, "vbus-detect-gpio"); err = PTR_ERR(nop->gpiod_vbus); }