From: Jacob Chen Date: Fri, 9 Dec 2016 06:41:10 +0000 (+0800) Subject: UPSTREAM: phy: rockchip-usb: should be a child device of the GRF X-Git-Tag: firefly_0821_release~1101 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f5feba517b9213b0a6ef8e59b4988a6abea81894;p=firefly-linux-kernel-4.4.55.git UPSTREAM: phy: rockchip-usb: should be a child device of the GRF 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 Signed-off-by: Kishon Vijay Abraham I Change-Id: I747a18fba361d6c6f161b6572e43955e18593a34 (cherry picked from commit a0da445aabe49c31093ecf3930f531e3c63e0b83) Signed-off-by: Jacob Chen --- diff --git a/Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt b/Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt index 98334f0c8a9e..58bd94a634d0 100644 --- a/Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt +++ b/Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt @@ -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>; + }; }; }; diff --git a/drivers/phy/phy-rockchip-usb.c b/drivers/phy/phy-rockchip-usb.c index 898683414f47..b2216a4cc2ef 100644 --- a/drivers/phy/phy-rockchip-usb.c +++ b/drivers/phy/phy-rockchip-usb.c @@ -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);