Re: [PATCH v3 1/4] phylib: Add device reset GPIO support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Sat, Oct 21, 2017 at 12:03 PM, Sergei Shtylyov
<sergei.shtylyov@xxxxxxxxxxxxxxxxxx> wrote:
> On 10/20/2017 9:11 PM, Florian Fainelli wrote:
>>> From: Sergei Shtylyov <sergei.shtylyov@xxxxxxxxxxxxxxxxxx>
>>> --- a/drivers/of/of_mdio.c
>>> +++ b/drivers/of/of_mdio.c
>
> [...]
>>>
>>> @@ -55,10 +56,22 @@ static int of_mdiobus_register_phy(struct mii_bus
>>> *mdio,
>>>         is_c45 = of_device_is_compatible(child,
>>>                                          "ethernet-phy-ieee802.3-c45");
>>>   +     /* Deassert the optional reset signal */
>>> +       gpiod = fwnode_get_named_gpiod(&child->fwnode, "reset-gpios", 0,
>>> +                                      GPIOD_OUT_LOW, "PHY reset");
>>> +       if (PTR_ERR(gpiod) == -ENOENT)
>>> +               gpiod = NULL;
>>> +       else if (IS_ERR(gpiod))
>>> +               return PTR_ERR(gpiod);
>>> +
>>>         if (!is_c45 && !of_get_phy_id(child, &phy_id))
>>>                 phy = phy_device_create(mdio, addr, phy_id, 0, NULL);
>>>         else
>>>                 phy = get_phy_device(mdio, addr, is_c45);
>>> +
>>> +       /* Assert the reset signal again */
>>> +       gpiod_set_value(gpiod, 1);
>>
>> You have a phy_device reference now, so why not call phy_device_reset()
>> directly here?
>
>    Symmetry, perhaps? (There was a gpiod_set_value(gpiod, 0) call above
> it...

Not only because of symmetry: the validity of the phy object hasn't been
checked yet (that's done immediately below), and phy->mdio.reset hasn't been
filled in yet.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux