UPSTREAM: phy: rockchip-usb: should be a child device of the GRF
authorJacob Chen <jacob2.chen@rock-chips.com>
Fri, 9 Dec 2016 06:41:10 +0000 (14:41 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Fri, 9 Dec 2016 10:17:52 +0000 (18:17 +0800)
The usb-phy is fully enclosed in the general register files (GRF).
Therefore as seen from the device-tree it shouldn't be a separate
platform-device but instead a sub-device of the GRF - using the
simply-mfd mechanism.

As the usb-phy is part of the kernel for some releases now, we keep
the old (and now deprecated) binding for compatibility purposes.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Change-Id: I747a18fba361d6c6f161b6572e43955e18593a34
 (cherry picked from commit a0da445aabe49c31093ecf3930f531e3c63e0b83)
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt
drivers/phy/phy-rockchip-usb.c

index 98334f0c8a9ece79016bc6ea6272f85dd9b0b3a1..58bd94a634d001f4d2020c8f4e67e94fcbf0e533 100644 (file)
@@ -7,11 +7,13 @@ Required properties:
      "rockchip,rk3288-usb-phy"
      "rockchip,rk336x-usb-phy"
      "rockchip,rk3399-usb-phy"
- - rockchip,grf : phandle to the syscon managing the "general
-   register files"
  - #address-cells: should be 1
  - #size-cells: should be 0
 
+Deprecated properties:
+ - rockchip,grf : phandle to the syscon managing the "general
+   register files" - phy should be a child of the GRF instead
+
 Sub-nodes:
 Each PHY should be represented as a sub-node.
 
@@ -34,16 +36,21 @@ Optional Properties:
 
 Example:
 
-usbphy: phy {
-       compatible = "rockchip,rk3288-usb-phy";
-       rockchip,grf = <&grf>;
-       #address-cells = <1>;
-       #size-cells = <0>;
-       resets = <&cru SRST_USBHOST1_PHY>;
-       reset-names = "phy-reset";
-
-       usbphy0: usb-phy0 {
-               #phy-cells = <0>;
-               reg = <0x320>;
+grf: syscon@ff770000 {
+       compatible = "rockchip,rk3288-grf", "syscon", "simple-mfd";
+
+...
+
+       usbphy: phy {
+               compatible = "rockchip,rk3288-usb-phy";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               resets = <&cru SRST_USBHOST1_PHY>;
+               reset-names = "phy-reset";
+
+               usbphy0: usb-phy0 {
+                       #phy-cells = <0>;
+                       reg = <0x320>;
+               };
        };
 };
index 898683414f47a09b86ae68348b3827802326dd9e..b2216a4cc2ef955f5053f8fd8726eff44917ef4b 100644 (file)
@@ -379,8 +379,13 @@ static int rockchip_usb_phy_probe(struct platform_device *pdev)
        phy_base->pdata = match->data;
 
        phy_base->dev = dev;
-       phy_base->reg_base = syscon_regmap_lookup_by_phandle(dev->of_node,
-                                                            "rockchip,grf");
+       phy_base->reg_base = ERR_PTR(-ENODEV);
+       if (dev->parent && dev->parent->of_node)
+               phy_base->reg_base = syscon_node_to_regmap(
+                                               dev->parent->of_node);
+       if (IS_ERR(phy_base->reg_base))
+               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(phy_base->reg_base);