linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: heiko@sntech.de (Heiko Stuebner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/8] phy: rockchip-usb: introduce a common data-struct for the device
Date: Thu, 05 Nov 2015 00:55:10 +0100	[thread overview]
Message-ID: <6210861.uglufxBnXQ@phil> (raw)
In-Reply-To: <CAD=FV=Uf0w0buknqwvW+ufao64m78i3B7Goza2pGCkjDSPU0tA@mail.gmail.com>

Am Mittwoch, 4. November 2015, 15:46:04 schrieb Doug Anderson:
> Hi,
> 
> On Wed, Nov 4, 2015 at 1:44 PM, Heiko Stuebner <heiko@sntech.de> wrote:
> > This introduces a common struct that holds data belonging to
> > the umbrella device that contains all the phys and that we
> > want to use later.
> >
> > Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> > ---
> >  drivers/phy/phy-rockchip-usb.c | 24 +++++++++++++++++-------
> >  1 file changed, 17 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/phy/phy-rockchip-usb.c b/drivers/phy/phy-rockchip-usb.c
> > index dfc056b..dda1994 100644
> > --- a/drivers/phy/phy-rockchip-usb.c
> > +++ b/drivers/phy/phy-rockchip-usb.c
> > @@ -36,9 +36,14 @@
> >  #define SIDDQ_ON               BIT(13)
> >  #define SIDDQ_OFF              (0 << 13)
> >
> > +struct rockchip_usb_phy_base {
> > +       struct device *dev;
> > +       struct regmap *reg_base;
> > +};
> > +
> >  struct rockchip_usb_phy {
> > +       struct rockchip_usb_phy_base *base;
> >         unsigned int    reg_offset;
> > -       struct regmap   *reg_base;
> >         struct clk      *clk;
> >         struct phy      *phy;
> >  };
> > @@ -46,7 +51,7 @@ struct rockchip_usb_phy {
> >  static int rockchip_usb_phy_power(struct rockchip_usb_phy *phy,
> >                                            bool siddq)
> >  {
> > -       return regmap_write(phy->reg_base, phy->reg_offset,
> > +       return regmap_write(phy->base->reg_base, phy->reg_offset,
> >                             SIDDQ_WRITE_ENA | (siddq ? SIDDQ_ON : SIDDQ_OFF));
> >  }
> >
> > @@ -101,17 +106,23 @@ static void rockchip_usb_phy_action(void *data)
> >  static int rockchip_usb_phy_probe(struct platform_device *pdev)
> >  {
> >         struct device *dev = &pdev->dev;
> > +       struct rockchip_usb_phy_base *phy_base;
> >         struct rockchip_usb_phy *rk_phy;
> >         struct phy_provider *phy_provider;
> >         struct device_node *child;
> > -       struct regmap *grf;
> >         unsigned int reg_offset;
> >         int err;
> >
> > -       grf = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,grf");
> > -       if (IS_ERR(grf)) {
> > +       phy_base = devm_kzalloc(dev, sizeof(*phy_base), GFP_KERNEL);
> > +       if (!phy_base)
> > +               return -ENOMEM;
> > +
> > +       phy_base->dev = dev;
> > +       phy_base->reg_base = syscon_regmap_lookup_by_phandle(dev->of_node,
> > +                                                            "rockchip,grf");
> > +       if (IS_ERR(phy_base->reg_base)) {
> >                 dev_err(&pdev->dev, "Missing rockchip,grf property\n");
> > -               return PTR_ERR(grf);
> > +               return PTR_ERR(phy_base->reg_base);
> >         }
> >
> >         for_each_available_child_of_node(dev->of_node, child) {
> > @@ -126,7 +137,6 @@ static int rockchip_usb_phy_probe(struct platform_device *pdev)
> >                 }
> >
> >                 rk_phy->reg_offset = reg_offset;
> > -               rk_phy->reg_base = grf;
> 
> I'm probably missing something, but I would have expected a line line:
> 
>   rk_phy->base = phy_base;
> 
> Otherwise how does "base" get assigned?  Ah, I see.  You forgot it in
> this patch and then cheated and slipped it in in patch #3.  ;)  For
> nice bisectability it probably belongs here, too...

Thanks for that catch and yep, it should definitly be here too. While
I did a compile-test for the individual steps, I guess I did not do
runtime tests for each.

I guess this is what happens when you try to separate a final work into
separate steps :-) . I'll send a revised version hopefully tomorrow.


Heiko

  reply	other threads:[~2015-11-04 23:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-04 21:44 [PATCH 0/8] phy: rockchip-usb: correct pll handling and usb-uart Heiko Stuebner
2015-11-04 21:44 ` [PATCH 1/8] phy: rockchip-usb: fix clock get-put mismatch Heiko Stuebner
2015-11-04 23:34   ` Doug Anderson
2015-11-13  6:28   ` Kishon Vijay Abraham I
2015-11-04 21:44 ` [PATCH 2/8] phy: rockchip-usb: introduce a common data-struct for the device Heiko Stuebner
2015-11-04 23:46   ` Doug Anderson
2015-11-04 23:55     ` Heiko Stuebner [this message]
2015-11-04 21:44 ` [PATCH 3/8] phy: rockchip-usb: move per-phy init into a separate function Heiko Stuebner
2015-11-04 23:53   ` Doug Anderson
2015-11-04 21:44 ` [PATCH 4/8] phy: rockchip-usb: expose the phy-internal PLLs Heiko Stuebner
2015-11-13  8:48   ` Kishon Vijay Abraham I
2015-11-04 21:44 ` [PATCH 5/8] clk: rockchip: fix usbphy-related clocks Heiko Stuebner
2015-12-05  0:07   ` Michael Turquette
2015-12-05 10:12     ` Heiko Stübner
2015-11-04 21:44 ` [PATCH 6/8] ARM: dts: rockchip: add clock-cells for usb phy nodes Heiko Stuebner
2015-12-05  0:07   ` Michael Turquette
2015-11-04 21:44 ` [PATCH 7/8] ARM: dts: rockchip: assign usbphy480m_src to the new usbphy pll on veyron Heiko Stuebner
2015-11-04 21:44 ` [PATCH 8/8] phy: rockchip-usb: add handler for usb-uart functionality Heiko Stuebner

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=6210861.uglufxBnXQ@phil \
    --to=heiko@sntech.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).