From b0ae63a095cfd481282871b91c4f179ea2a624e1 Mon Sep 17 00:00:00 2001 From: Sandy Huang Date: Tue, 14 Aug 2018 20:23:52 +0800 Subject: [PATCH] drm/rockchip: csi: Add support RK1808 Change-Id: Ia908f1a8c0a4f72b61bacf98ab6e4ed9a3e3ebed Signed-off-by: Sandy Huang --- .../display/rockchip/rockchip_mipi_csi_tx.txt | 56 + drivers/gpu/drm/rockchip/Kconfig | 10 + drivers/gpu/drm/rockchip/Makefile | 1 + .../gpu/drm/rockchip/rockchip-mipi-csi-tx.c | 1274 +++++++++++++++++ .../gpu/drm/rockchip/rockchip-mipi-csi-tx.h | 244 ++++ include/dt-bindings/display/drm_mipi_dsi.h | 3 + 6 files changed, 1588 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/rockchip/rockchip_mipi_csi_tx.txt create mode 100644 drivers/gpu/drm/rockchip/rockchip-mipi-csi-tx.c create mode 100644 drivers/gpu/drm/rockchip/rockchip-mipi-csi-tx.h diff --git a/Documentation/devicetree/bindings/display/rockchip/rockchip_mipi_csi_tx.txt b/Documentation/devicetree/bindings/display/rockchip/rockchip_mipi_csi_tx.txt new file mode 100644 index 000000000000..440ebf359d15 --- /dev/null +++ b/Documentation/devicetree/bindings/display/rockchip/rockchip_mipi_csi_tx.txt @@ -0,0 +1,56 @@ +Rockchip MIPI CSI HOST +================================ + +Required properties: +- compatible: must be one of: + "rockchip,rk1808-mipi-csi". +- reg: Represent the physical address range of the controller. +- interrupts: Represent the controller's interrupt to the CPU(s). +- clocks, clock-names: Phandles to the controller's APB clock(pclk) as + described in [1]. +- resets : phandle to the reset of MIPI CSI APB Clock. +- reset-names : should be "apb". +- rockchip,grf: this soc should set GRF regs to mux vopl/vopb. +- #address-cells: Should be <1>. +- #size-cells: Should be <0>. +- ports: contain a port node with endpoint definitions as defined in [2]. + For vopb,set the reg = <0> and set the reg = <1> for vopl. + +Optional properties +- clocks, clock-names: + phandle to the SNPS-PHY config clock, name should be "phy_cfg". + phandle to the SNPS-PHY PLL reference clock, name should be "ref". + phandle to the Non-SNPS PHY high speed clock, name should be "hs_clk". + phandle to the h2p bridge clock, name should be "h2p". +- phys: phandle to Non-SNPS PHY node +- phy-names: the string "mipi_dphy" when is found in a node, along with "phys" + attribute, provides phandle to MIPI PHY node +- rockchip,dual-channel: for dual-channel panel, if not, don't configure +- rockchip,lane-rate: manually configure lane-rate, not necessary. + +[1] Documentation/devicetree/bindings/clock/clock-bindings.txt +[2] Documentation/devicetree/bindings/media/video-interfaces.txt +[3] Documentation/devicetree/bindings/reset/reset.txt + +Example: + +For Rockchip RK1808: + + csi: csi@ffb20000 { + compatible = "rockchip,rk1808-mipi-csi"; + clocks = <&cru PCLK_MIPI_CSI0>, <&mipi_dphy>; + clock-names = "pclk", "hs_clk"; + phys = <&mipi_dphy>; + phy-names = "mipi_dphy"; + resets = <&cru SRST_MIPICSI>; + reset-names = "apb"; + ... + + ports { + port { + csi_in_vop: endpoint { + remote-endpoint = <&vop_out_csi>; + }; + }; + }; + }; diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig index ba6a029bf3d3..9e9253f2fa7e 100644 --- a/drivers/gpu/drm/rockchip/Kconfig +++ b/drivers/gpu/drm/rockchip/Kconfig @@ -60,6 +60,16 @@ config ROCKCHIP_DW_MIPI_DSI enable MIPI DSI on RK3288 based SoC, you should selet this option. +config ROCKCHIP_MIPI_CSI_TX + tristate "Rockchip specific extensions for MIPI CSI TX" + depends on DRM_ROCKCHIP + select DRM_MIPI_DSI + help + This selects support for Rockchip SoC specific extensions + for the rocckhip mipi CSI TX driver. If you want to + enable MIPI CSI on RK1808 based SoC, you should selet this + option. + config ROCKCHIP_ANALOGIX_DP tristate "Rockchip specific extensions for Analogix DP driver" depends on DRM_ROCKCHIP diff --git a/drivers/gpu/drm/rockchip/Makefile b/drivers/gpu/drm/rockchip/Makefile index 1276a0365195..658fef2d7d18 100644 --- a/drivers/gpu/drm/rockchip/Makefile +++ b/drivers/gpu/drm/rockchip/Makefile @@ -10,6 +10,7 @@ obj-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o obj-$(CONFIG_ROCKCHIP_CDN_DP) += cdn-dp.o cdn-dp-objs := cdn-dp-core.o cdn-dp-reg.o cdn-dp-link-training.o obj-$(CONFIG_ROCKCHIP_DW_MIPI_DSI) += dw-mipi-dsi.o +obj-$(CONFIG_ROCKCHIP_MIPI_CSI_TX) += rockchip-mipi-csi-tx.o obj-$(CONFIG_ROCKCHIP_ANALOGIX_DP) += analogix_dp-rockchip.o obj-$(CONFIG_ROCKCHIP_INNO_HDMI) += inno_hdmi.o obj-$(CONFIG_ROCKCHIP_LVDS) += rockchip_lvds.o diff --git a/drivers/gpu/drm/rockchip/rockchip-mipi-csi-tx.c b/drivers/gpu/drm/rockchip/rockchip-mipi-csi-tx.c new file mode 100644 index 000000000000..df696fa97d49 --- /dev/null +++ b/drivers/gpu/drm/rockchip/rockchip-mipi-csi-tx.c @@ -0,0 +1,1274 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2018 Fuzhou Rockchip Electronics Co., Ltd + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include