Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1262747

Re: [PATCH 2/8] phy: rockchip-usb: introduce a common data-struct for the device

From Doug Anderson <dianders@chromium.org>
Newsgroups linux.kernel
Subject Re: [PATCH 2/8] phy: rockchip-usb: introduce a common data-struct for the device
Date 2015-11-05 00:50 +0100
Message-ID <qrfYt-7c7-7@gated-at.bofh.it> (permalink)
References <qre6l-5Zh-5@gated-at.bofh.it> <qre6n-5Zh-33@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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...

-Doug
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/8] phy: rockchip-usb: correct pll handling and usb-uart Heiko Stuebner <heiko@sntech.de> - 2015-11-04 22:50 +0100
  [PATCH 3/8] phy: rockchip-usb: move per-phy init into a separate function Heiko Stuebner <heiko@sntech.de> - 2015-11-04 22:50 +0100
    Re: [PATCH 3/8] phy: rockchip-usb: move per-phy init into a separate function Doug Anderson <dianders@chromium.org> - 2015-11-05 01:00 +0100
  [PATCH 1/8] phy: rockchip-usb: fix clock get-put mismatch Heiko Stuebner <heiko@sntech.de> - 2015-11-04 22:50 +0100
    Re: [PATCH 1/8] phy: rockchip-usb: fix clock get-put mismatch Doug Anderson <dianders@chromium.org> - 2015-11-05 00:40 +0100
    Re: [PATCH 1/8] phy: rockchip-usb: fix clock get-put mismatch Kishon Vijay Abraham I <kishon@ti.com> - 2015-11-13 07:30 +0100
  [PATCH 2/8] phy: rockchip-usb: introduce a common data-struct for the device Heiko Stuebner <heiko@sntech.de> - 2015-11-04 22:50 +0100
    Re: [PATCH 2/8] phy: rockchip-usb: introduce a common data-struct for  the device Doug Anderson <dianders@chromium.org> - 2015-11-05 00:50 +0100
      Re: [PATCH 2/8] phy: rockchip-usb: introduce a common data-struct for the device Heiko Stuebner <heiko@sntech.de> - 2015-11-05 01:00 +0100
  [PATCH 4/8] phy: rockchip-usb: expose the phy-internal PLLs Heiko Stuebner <heiko@sntech.de> - 2015-11-04 22:50 +0100
    Re: [PATCH 4/8] phy: rockchip-usb: expose the phy-internal PLLs Kishon Vijay Abraham I <kishon@ti.com> - 2015-11-13 09:50 +0100
  [PATCH 7/8] ARM: dts: rockchip: assign usbphy480m_src to the new usbphy pll on veyron Heiko Stuebner <heiko@sntech.de> - 2015-11-04 22:50 +0100

csiph-web