From 35a788ded3c4c8f0f57b2d19a13045b4ee737fd0 Mon Sep 17 00:00:00 2001 From: WeiYong Bi Date: Tue, 14 Mar 2017 17:25:27 +0800 Subject: [PATCH] phy: Add support for INNO MIPI D-PHY The INNO MIPI D-PHY is built in witch a standard digital interface to talk to any third part Host controller.That is part of Rockchip SoCs, like rk3368. Change-Id: I9806882e0e3fb6b20348015d0f34923d1bc46b89 Signed-off-by: WeiYong Bi --- .../phy/phy-rockchip-inno-mipi-dphy.txt | 38 + drivers/phy/Kconfig | 7 + drivers/phy/Makefile | 1 + drivers/phy/phy-rockchip-inno-mipi-dphy.c | 739 ++++++++++++++++++ 4 files changed, 785 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/phy-rockchip-inno-mipi-dphy.txt create mode 100644 drivers/phy/phy-rockchip-inno-mipi-dphy.c diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-mipi-dphy.txt b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-mipi-dphy.txt new file mode 100644 index 000000000000..238e3405f8eb --- /dev/null +++ b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-mipi-dphy.txt @@ -0,0 +1,38 @@ +ROCKCHIP MIPI DPHY WITH INNO IP BLOCK + +Required properties: + - compatible : should be "rockchip,rk3368-mipi-dphy"; + - reg : the address offset of register for mipi-dphy configuration. + - #phy-cells : must be 0. See ./phy-bindings.txt for details. + - clocks and clock-names: + - the "pclk" clock is required by the phy module, used to register + configuration + - the "ref" clock is used to get the rate of the reference clock + provided to the PHY module + - rockchip,dsi-panel : phandle to MIPI DSI panel node, used to get the display + timing of the panel provided to the PHY module. + +Example: + +For Rockchip RK3368 + +mipi_dphy: mipi-dphy@ff968000 { + compatible = "rockchip,rk3368-mipi-dphy"; + reg = <0x0 0xff968000 0x0 0x4000>; + #phy-cells = <0>; + clocks = <&cru SCLK_MIPIDSI_24M>, <&cru PCLK_DPHYTX0>; + clock-names = "ref", "pclk"; + rockchip,dsi-panel = <&dsi_panel>; +}; + +Then the PHY can be used in other nodes such as: + +mipi-dsi-host@ff960000 { + phys = <&mipi_dphy>; + phy-names = "mipi_dphy"; + + dsi_panel: panel { + dsi,lanes = 4; + ... + }; +}; diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index d1c72214f6e7..b09bec07db4b 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -352,6 +352,13 @@ config PHY_ROCKCHIP_DP help Enable this to support the Rockchip Display Port PHY. +config PHY_ROCKCHIP_INNO_MIPI_DPHY + tristate "Rockchip INNO MIPI D-PHY Driver" + depends on ARCH_ROCKCHIP && OF + select GENERIC_PHY + help + Enable this to support the Rockchip MIPI D-PHY with Innosilicon IP block. + config PHY_ROCKCHIP_TYPEC tristate "Rockchip TYPEC PHY Driver" depends on ARCH_ROCKCHIP && OF diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index 518551c85cc0..1cfe7b7049ca 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -37,6 +37,7 @@ obj-$(CONFIG_PHY_QCOM_APQ8064_SATA) += phy-qcom-apq8064-sata.o obj-$(CONFIG_PHY_ROCKCHIP_USB) += phy-rockchip-usb.o obj-$(CONFIG_PHY_ROCKCHIP_INNO_USB2) += phy-rockchip-inno-usb2.o obj-$(CONFIG_PHY_ROCKCHIP_INNO_USB3) += phy-rockchip-inno-usb3.o +obj-$(CONFIG_PHY_ROCKCHIP_INNO_MIPI_DPHY) += phy-rockchip-inno-mipi-dphy.o obj-$(CONFIG_PHY_ROCKCHIP_EMMC) += phy-rockchip-emmc.o obj-$(CONFIG_PHY_ROCKCHIP_DP) += phy-rockchip-dp.o obj-$(CONFIG_PHY_ROCKCHIP_TYPEC) += phy-rockchip-typec.o diff --git a/drivers/phy/phy-rockchip-inno-mipi-dphy.c b/drivers/phy/phy-rockchip-inno-mipi-dphy.c new file mode 100644 index 000000000000..9a3a670d3154 --- /dev/null +++ b/drivers/phy/phy-rockchip-inno-mipi-dphy.c @@ -0,0 +1,739 @@ +/* + * Copyright (c) 2017 Rockchip Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include