public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] net: gmac_rockchip: Add phy supply support
Date: Wed, 22 Mar 2017 10:05:15 +0100	[thread overview]
Message-ID: <1490173515.12448.7.camel@collabora.co.uk> (raw)
In-Reply-To: <CAFLEztRXa-qgS1=wEr1LWXswBXO02ZO3fKQEqHNcBKt0NYRpBw@mail.gmail.com>

On Wed, 2017-03-22 at 11:17 +0800, Jacob Chen wrote:
> 2017-03-22 2:56 GMT+08:00 Joe Hershberger <joe.hershberger@gmail.com>
> :
> > On Wed, Mar 15, 2017 at 4:28 AM, Jacob Chen <jacob2.chen@rock-chips
> > .com> wrote:
> > > Some board need a regulator for gmac phy, so add this code to
> > > handle it.
> > > 
> > > Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
> > > ---
> > > 
> > >  drivers/net/gmac_rockchip.c | 17 +++++++++++++++++
> > >  1 file changed, 17 insertions(+)
> > > 
> > > diff --git a/drivers/net/gmac_rockchip.c
> > > b/drivers/net/gmac_rockchip.c
> > > index e9b202a..63cccc9 100644
> > > --- a/drivers/net/gmac_rockchip.c
> > > +++ b/drivers/net/gmac_rockchip.c
> > > @@ -17,6 +17,7 @@
> > >  #include <asm/arch/grf_rk3288.h>
> > >  #include <dm/pinctrl.h>
> > >  #include <dt-bindings/clock/rk3288-cru.h>
> > > +#include <power/regulator.h>
> > >  #include "designware.h"
> > > 
> > >  DECLARE_GLOBAL_DATA_PTR;
> > > @@ -79,6 +80,22 @@ static int gmac_rockchip_probe(struct udevice
> > > *dev)
> > >         struct clk clk;
> > >         int ret;
> > > 
> > > +#if defined(CONFIG_DM_REGULATOR)
> > > +       struct udevice *phy_supply;
> > > +
> > > +       ret = device_get_supply_regulator(dev, "phy-supply",
> > > +                                         &phy_supply);
> > > +       if (ret) {
> > > +               debug("%s: No phy supply\n", dev->name);
> > > +       } else {
> > > +               ret = regulator_set_enable(phy_supply, true);
> > > +               if (ret) {
> > > +                       puts("Error enabling phy supply\n");
> > > +                       return ret;
> > > +               }
> > > +       }
> > > +#endif
> > > +
> > 
> > This seems pretty generic. Is there maybe a more common place this
> > could live? Or is the phy-supply binding in DT only defined for
> > rockchip?
> > 
> 
> I have look kernel driver and phy-supply is set in "
> drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c".
> So i think it might not be generic.


From the device-tree bindings, it's specifically documented for
allwinner,sun7i-a20-gmac and rockchip,*-gmac. It's also the common
naming for in the generic phy bindings (though i haven't seen those
used for any networking device-tree bindings). So it's not documented
as a generic property but definitely is the convential naming for,
well, phy supplies. 

Which is all pretty inconclusive :) But it might make sense to do it
generically for dwmac so e.g. the allwinner support also can use it.

> 
> > >         ret = clk_get_by_index(dev, 0, &clk);
> > >         if (ret)
> > >                 return ret;
> > > --
> > > 1.9.1
> > > 
> > > _______________________________________________
> > > U-Boot mailing list
> > > U-Boot at lists.denx.de
> > > https://lists.denx.de/listinfo/u-boot
> > 
> > _______________________________________________
> > U-Boot mailing list
> > U-Boot at lists.denx.de
> > https://lists.denx.de/listinfo/u-boot

-- 
Sjoerd Simons
Collabora Ltd.

  reply	other threads:[~2017-03-22  9:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-15  9:28 [U-Boot] [PATCH 1/2] rockchip: configs: correct mmc env dev for rk3288 based boards Jacob Chen
2017-03-15  9:28 ` [U-Boot] [PATCH 2/2] net: gmac_rockchip: Add phy supply support Jacob Chen
2017-03-21 18:56   ` Joe Hershberger
2017-03-22  3:17     ` Jacob Chen
2017-03-22  9:05       ` Sjoerd Simons [this message]
2017-03-26  2:39 ` [U-Boot] [PATCH 1/2] rockchip: configs: correct mmc env dev for rk3288 based boards Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1490173515.12448.7.camel@collabora.co.uk \
    --to=sjoerd.simons@collabora.co.uk \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox