Message ID | 1426886727-537-2-git-send-email-arun.ramamurthy@broadcom.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Arun, On Fri, Mar 20, 2015 at 02:25:25PM -0700, Arun Ramamurthy wrote: > Multi-port phy's may have per-port power supplies. Let's change phy core > to first attempt to look up the supply at the port level, and then, if > not found, check parent device. > > Reviewed-by: Ray Jui <rjui@broadcom.com> > Reviewed-by: Scott Branden <sbranden@broadcom.com> > Signed-off-by: Dmitry Torokhov <dtor@chromium.org> > Signed-off-by: Arun Ramamurthy <arun.ramamurthy@broadcom.com> > This should have had: From: Dmitry Torokhov <dtor@chromium.org> as first line of the body of e-mail as the patch was authored by me. Thanks. --- > drivers/phy/phy-core.c | 30 ++++++++++++++++++++---------- > 1 file changed, 20 insertions(+), 10 deletions(-) > > diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c > index a12d353..b43bb6b 100644 > --- a/drivers/phy/phy-core.c > +++ b/drivers/phy/phy-core.c > @@ -650,16 +650,6 @@ struct phy *phy_create(struct device *dev, struct device_node *node, > goto free_phy; > } > > - /* phy-supply */ > - phy->pwr = regulator_get_optional(dev, "phy"); > - if (IS_ERR(phy->pwr)) { > - if (PTR_ERR(phy->pwr) == -EPROBE_DEFER) { > - ret = -EPROBE_DEFER; > - goto free_ida; > - } > - phy->pwr = NULL; > - } > - > device_initialize(&phy->dev); > mutex_init(&phy->mutex); > > @@ -673,6 +663,26 @@ struct phy *phy_create(struct device *dev, struct device_node *node, > if (ret) > goto put_dev; > > + /* > + * Locate phy-supply. We first try individual port and then, > + * if supply is not found, try parent device. > + */ > + phy->pwr = regulator_get_optional(&phy->dev, "phy"); > + if (IS_ERR(phy->pwr)) { > + ret = PTR_ERR(phy->pwr); > + if (ret == -EPROBE_DEFER) > + goto free_ida; > + > + phy->pwr = regulator_get_optional(phy->dev.parent, "phy"); > + if (IS_ERR(phy->pwr)) { > + ret = PTR_ERR(phy->pwr); > + if (ret == -EPROBE_DEFER) > + goto free_ida; > + > + phy->pwr = NULL; > + } > + } > + > ret = device_add(&phy->dev); > if (ret) > goto put_dev; > -- > 2.3.2 >
Hi, On Saturday 21 March 2015 02:55 AM, Arun Ramamurthy wrote: > Multi-port phy's may have per-port power supplies. Let's change phy core > to first attempt to look up the supply at the port level, and then, if > not found, check parent device. Why not just have every port provide the power supply if it needs? I don't think checking for parent device should be present in the phy-core at all. Thanks Kishon
On Wed, Mar 25, 2015 at 3:11 PM, Kishon Vijay Abraham I <kishon@ti.com> wrote: > Hi, > > On Saturday 21 March 2015 02:55 AM, Arun Ramamurthy wrote: >> Multi-port phy's may have per-port power supplies. Let's change phy core >> to first attempt to look up the supply at the port level, and then, if >> not found, check parent device. > > Why not just have every port provide the power supply if it needs? > I don't think checking for parent device should be present in the phy-core at > all. We need to do that if we want to keep compatibility with the current DTSes: before this patch the supply would be always looked up on device and not port level. Thanks, Dmitry
Hi, On Thursday 26 March 2015 03:47 AM, Dmitry Torokhov wrote: > On Wed, Mar 25, 2015 at 3:11 PM, Kishon Vijay Abraham I <kishon@ti.com> wrote: >> Hi, >> >> On Saturday 21 March 2015 02:55 AM, Arun Ramamurthy wrote: >>> Multi-port phy's may have per-port power supplies. Let's change phy core >>> to first attempt to look up the supply at the port level, and then, if >>> not found, check parent device. >> >> Why not just have every port provide the power supply if it needs? >> I don't think checking for parent device should be present in the phy-core at >> all. > > We need to do that if we want to keep compatibility with the current > DTSes: before this patch the supply would be always looked up on > device and not port level. ah okay. so just using regulator_get_optional(&phy->dev, "phy"); should be sufficient right? Why do we need regulator_get_optional(phy->dev.parent, "phy");? Thanks Kishon
On Thu, Mar 26, 2015 at 04:09:23AM +0530, Kishon Vijay Abraham I wrote: > Hi, > > On Thursday 26 March 2015 03:47 AM, Dmitry Torokhov wrote: > > On Wed, Mar 25, 2015 at 3:11 PM, Kishon Vijay Abraham I <kishon@ti.com> wrote: > >> Hi, > >> > >> On Saturday 21 March 2015 02:55 AM, Arun Ramamurthy wrote: > >>> Multi-port phy's may have per-port power supplies. Let's change phy core > >>> to first attempt to look up the supply at the port level, and then, if > >>> not found, check parent device. > >> > >> Why not just have every port provide the power supply if it needs? > >> I don't think checking for parent device should be present in the phy-core at > >> all. > > > > We need to do that if we want to keep compatibility with the current > > DTSes: before this patch the supply would be always looked up on > > device and not port level. > > ah okay. > so just using regulator_get_optional(&phy->dev, "phy"); should be sufficient This is for regulators specified at port level (&phy->dev represents port). > right? Why do we need regulator_get_optional(phy->dev.parent, "phy");? > This is for compatibility with old multi-port bindings where supply is specified at parent device level and phy_create() is called with dev and node that is not NULL and not the same as dev->of_node. I have no idea if such bindings exist in wild, but wanted to keep them working given stated DT stability rules. Thanks.
Hi, On Thursday 26 March 2015 04:19 AM, Dmitry Torokhov wrote: > On Thu, Mar 26, 2015 at 04:09:23AM +0530, Kishon Vijay Abraham I wrote: >> Hi, >> >> On Thursday 26 March 2015 03:47 AM, Dmitry Torokhov wrote: >>> On Wed, Mar 25, 2015 at 3:11 PM, Kishon Vijay Abraham I <kishon@ti.com> wrote: >>>> Hi, >>>> >>>> On Saturday 21 March 2015 02:55 AM, Arun Ramamurthy wrote: >>>>> Multi-port phy's may have per-port power supplies. Let's change phy core >>>>> to first attempt to look up the supply at the port level, and then, if >>>>> not found, check parent device. >>>> >>>> Why not just have every port provide the power supply if it needs? >>>> I don't think checking for parent device should be present in the phy-core at >>>> all. >>> >>> We need to do that if we want to keep compatibility with the current >>> DTSes: before this patch the supply would be always looked up on >>> device and not port level. >> >> ah okay. >> so just using regulator_get_optional(&phy->dev, "phy"); should be sufficient > > This is for regulators specified at port level (&phy->dev represents > port). > >> right? Why do we need regulator_get_optional(phy->dev.parent, "phy");? >> > > This is for compatibility with old multi-port bindings where supply is > specified at parent device level and phy_create() is called with dev and > node that is not NULL and not the same as dev->of_node. I have no idea > if such bindings exist in wild, but wanted to keep them working given > stated DT stability rules. Such a binding doesn't exist. So let's keep only the regulator_get_optional(&phy->dev, "phy"); part. Only TI SoCs and recently sun9i started using phy-supply and none of them use multi-phy PHY provider. Thanks Kishon
On Thu, Mar 26, 2015 at 05:14:07AM +0530, Kishon Vijay Abraham I wrote: > Hi, > > On Thursday 26 March 2015 04:19 AM, Dmitry Torokhov wrote: > > On Thu, Mar 26, 2015 at 04:09:23AM +0530, Kishon Vijay Abraham I wrote: > >> Hi, > >> > >> On Thursday 26 March 2015 03:47 AM, Dmitry Torokhov wrote: > >>> On Wed, Mar 25, 2015 at 3:11 PM, Kishon Vijay Abraham I <kishon@ti.com> wrote: > >>>> Hi, > >>>> > >>>> On Saturday 21 March 2015 02:55 AM, Arun Ramamurthy wrote: > >>>>> Multi-port phy's may have per-port power supplies. Let's change phy core > >>>>> to first attempt to look up the supply at the port level, and then, if > >>>>> not found, check parent device. > >>>> > >>>> Why not just have every port provide the power supply if it needs? > >>>> I don't think checking for parent device should be present in the phy-core at > >>>> all. > >>> > >>> We need to do that if we want to keep compatibility with the current > >>> DTSes: before this patch the supply would be always looked up on > >>> device and not port level. > >> > >> ah okay. > >> so just using regulator_get_optional(&phy->dev, "phy"); should be sufficient > > > > This is for regulators specified at port level (&phy->dev represents > > port). > > > >> right? Why do we need regulator_get_optional(phy->dev.parent, "phy");? > >> > > > > This is for compatibility with old multi-port bindings where supply is > > specified at parent device level and phy_create() is called with dev and > > node that is not NULL and not the same as dev->of_node. I have no idea > > if such bindings exist in wild, but wanted to keep them working given > > stated DT stability rules. > > Such a binding doesn't exist. So let's keep only the > regulator_get_optional(&phy->dev, "phy"); part. Only TI SoCs and recently > sun9i started using phy-supply and none of them use multi-phy PHY provider. OK, fair enough. Thanks.
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index a12d353..b43bb6b 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -650,16 +650,6 @@ struct phy *phy_create(struct device *dev, struct device_node *node, goto free_phy; } - /* phy-supply */ - phy->pwr = regulator_get_optional(dev, "phy"); - if (IS_ERR(phy->pwr)) { - if (PTR_ERR(phy->pwr) == -EPROBE_DEFER) { - ret = -EPROBE_DEFER; - goto free_ida; - } - phy->pwr = NULL; - } - device_initialize(&phy->dev); mutex_init(&phy->mutex); @@ -673,6 +663,26 @@ struct phy *phy_create(struct device *dev, struct device_node *node, if (ret) goto put_dev; + /* + * Locate phy-supply. We first try individual port and then, + * if supply is not found, try parent device. + */ + phy->pwr = regulator_get_optional(&phy->dev, "phy"); + if (IS_ERR(phy->pwr)) { + ret = PTR_ERR(phy->pwr); + if (ret == -EPROBE_DEFER) + goto free_ida; + + phy->pwr = regulator_get_optional(phy->dev.parent, "phy"); + if (IS_ERR(phy->pwr)) { + ret = PTR_ERR(phy->pwr); + if (ret == -EPROBE_DEFER) + goto free_ida; + + phy->pwr = NULL; + } + } + ret = device_add(&phy->dev); if (ret) goto put_dev;