From: WeiYong Bi Date: Wed, 29 Mar 2017 08:14:56 +0000 (+0800) Subject: phy: rockchip-inno-mipi-dphy: Add reset control for PHY APB X-Git-Tag: firefly_0821_release~88 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=firefly-linux-kernel-4.4.55.git;a=commitdiff_plain;h=7f1daee88f2a435a744e7b6a9649adc9ef8c2705 phy: rockchip-inno-mipi-dphy: Add reset control for PHY APB Change-Id: I02915f0c5a291a1aa13c7e3ed45421667a19940d Signed-off-by: WeiYong Bi --- diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-mipi-dphy.txt b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-mipi-dphy.txt index 238e3405f8eb..94f4423442e5 100644 --- a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-mipi-dphy.txt +++ b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-mipi-dphy.txt @@ -12,6 +12,10 @@ Required properties: - rockchip,dsi-panel : phandle to MIPI DSI panel node, used to get the display timing of the panel provided to the PHY module. +Optional properties + - resets : phandle to the reset of MIPI DSI PHY APB clock. + - reset-names : should be "apb". + Example: For Rockchip RK3368 @@ -22,6 +26,8 @@ mipi_dphy: mipi-dphy@ff968000 { #phy-cells = <0>; clocks = <&cru SCLK_MIPIDSI_24M>, <&cru PCLK_DPHYTX0>; clock-names = "ref", "pclk"; + resets = <&cru SRST_MIPIDPHYTX>; + reset-names = "apb"; rockchip,dsi-panel = <&dsi_panel>; }; diff --git a/drivers/phy/phy-rockchip-inno-mipi-dphy.c b/drivers/phy/phy-rockchip-inno-mipi-dphy.c index 9a3a670d3154..6d4745839996 100644 --- a/drivers/phy/phy-rockchip-inno-mipi-dphy.c +++ b/drivers/phy/phy-rockchip-inno-mipi-dphy.c @@ -20,6 +20,7 @@ #include #include #include +#include #include @@ -236,6 +237,7 @@ struct inno_mipi_dphy { void __iomem *regs; struct clk *ref_clk; struct clk *pclk; + struct reset_control *rst; struct dsi_panel *panel; u32 lanes; @@ -560,6 +562,13 @@ static int inno_mipi_dphy_power_on(struct phy *phy) clk_prepare_enable(inno->ref_clk); clk_prepare_enable(inno->pclk); + if (inno->rst) { + /* MIPI DSI PHY APB software reset request. */ + reset_control_assert(inno->rst); + usleep_range(20, 40); + reset_control_deassert(inno->rst); + } + inno_mipi_dphy_pll_init(inno); inno_mipi_dphy_pll_ldo_enable(inno); inno_mipi_dphy_lane_enable(inno); @@ -693,11 +702,19 @@ static int inno_mipi_dphy_probe(struct platform_device *pdev) return PTR_ERR(inno->ref_clk); } + clk_set_rate(inno->ref_clk, 24000000); + inno->pclk = devm_clk_get(&pdev->dev, "pclk"); if (IS_ERR(inno->pclk)) { dev_err(&pdev->dev, "failed to get mipi dphy pclk\n"); return PTR_ERR(inno->pclk); - }; + } + + inno->rst = devm_reset_control_get_optional(&pdev->dev, "apb"); + if (IS_ERR(inno->rst)) { + dev_info(&pdev->dev, "No reset control specified\n"); + inno->rst = NULL; + } phy = devm_phy_create(&pdev->dev, NULL, &inno_mipi_dphy_ops); if (IS_ERR(phy)) {