Skip to contentSkip to conversation

Add support for the RK356x variant of the Inno CSI DPHY

PATCH Applied Michael Riesch 4 participants 11 messages Jul 20, 2022 – Sep 4, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Add support for the RK356x variant of the Inno CSI DPHY

Hi all,

This series adds support for the variant of the Innosilicon MIPI CSI DPHY that can be found in Rockchip RK356x SoCs.

Please note that only the basic operating mode is supported, in which all four CSI lanes are controlled by the Rockchip ISP. Split lane operation (e.g., two lanes to ISP and two lanes to VICAP) is not supported.

This has been tested on a Radxa ROCK3 Model A board together with an IMX219 camera sensor and a patched version of the rkisp1 driver (with support for the RK356x variant V2.1 added in a very crude way).

Looking forward to your comments!

Best regards,
Michael

Michael Riesch (3):
dt-bindings: phy: add compatible for rk356x to rockchip-inno-csi-dphy
phy: rockchip: add support for the rk356x variant to
rockchip-inno-csidphy
arm64: dts: rockchip: add csi dphy node to rk356x

 .../bindings/phy/rockchip-inno-csi-dphy.yaml  |  1 +
 arch/arm64/boot/dts/rockchip/rk356x.dtsi      | 12 ++++++++++
 .../phy/rockchip/phy-rockchip-inno-csidphy.c  | 24 +++++++++++++++++++
 3 files changed, 37 insertions(+)
Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/3 dt-bindings: phy: add compatible for rk356x to rockchip-inno-csi-dphy

The driver for the Innosilicon MIPI CSI DPHY is compatible with the variant in the Rockchip RK356x SoCs. Add the compatible string to the binding.

---
 .../devicetree/bindings/phy/rockchip-inno-csi-dphy.yaml          | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/phy/rockchip-inno-csi-dphy.yaml +1 -0
index bb4a2e4b8ab0..810537a0f7dd 100644
@@ -20,6 +20,7 @@ properties:
       - rockchip,rk1808-csi-dphy
       - rockchip,rk3326-csi-dphy
       - rockchip,rk3368-csi-dphy
+      - rockchip,rk3568-csi-dphy
 
   reg:
     maxItems: 1
Signature · 1 line
2.30.2
maintainer Acked-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] dt-bindings: phy: add compatible for rk356x to rockchip-inno-csi-dphy

Quoted 8 lines · Michael Riesch

The driver for the Innosilicon MIPI CSI DPHY is compatible with the variant in the Rockchip RK356x SoCs. Add the compatible string to the binding.

---
 .../devicetree/bindings/phy/rockchip-inno-csi-dphy.yaml          | 1 +
 1 file changed, 1 insertion(+)
maintainer Reviewed-by on v1 1/3
#3 lore raw

Re: [PATCH 1/3] dt-bindings: phy: add compatible for rk356x to rockchip-inno-csi-dphy

In reply to Michael Riesch

Am Mittwoch, 20. Juli 2022, 11:15:25 CEST schrieb Michael Riesch:

Quoted 4 lines

The driver for the Innosilicon MIPI CSI DPHY is compatible with the variant in the Rockchip RK356x SoCs. Add the compatible string to the binding.

Signature · 3 lines
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
#4 lore raw

PATCH 2/3 phy: rockchip: add support for the rk356x variant to rockchip-inno-csidphy

In reply to Michael Riesch

This adds support for variant found in Rockchip RK356x SoCs. Note that only the basic operating mode is supported, in which all four CSI lines are controlled by the Rockchip ISP.

---
 .../phy/rockchip/phy-rockchip-inno-csidphy.c  | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/phy/rockchip/phy-rockchip-inno-csidphy.c +24 -0
index ca13a604ab4f..75f948bdea6a 100644
@@ -27,6 +27,9 @@
 
 #define RK3368_GRF_SOC_CON6_OFFSET	0x0418
 
+#define RK3568_GRF_VI_CON0		0x0340
+#define RK3568_GRF_VI_CON1		0x0344
+
 /* PHY */
 #define CSIDPHY_CTRL_LANE_ENABLE		0x00
 #define CSIDPHY_CTRL_LANE_ENABLE_CK		BIT(6)
@@ -58,9 +61,11 @@
 #define RK1808_CSIDPHY_CLK_WR_THS_SETTLE	0x160
 #define RK3326_CSIDPHY_CLK_WR_THS_SETTLE	0x100
 #define RK3368_CSIDPHY_CLK_WR_THS_SETTLE	0x100
+#define RK3568_CSIDPHY_CLK_WR_THS_SETTLE	0x160
 
 /* Calibration reception enable */
 #define RK1808_CSIDPHY_CLK_CALIB_EN		0x168
+#define RK3568_CSIDPHY_CLK_CALIB_EN		0x168
 
 /*
  * The higher 16-bit of this register is used for write protection
@@ -103,6 +108,12 @@ static const struct dphy_reg rk3368_grf_dphy_regs[] = {
 	[GRF_DPHY_CSIPHY_FORCERXMODE] = PHY_REG(RK3368_GRF_SOC_CON6_OFFSET, 4, 8),
 };
 
+static const struct dphy_reg rk3568_grf_dphy_regs[] = {
+	[GRF_DPHY_CSIPHY_FORCERXMODE] = PHY_REG(RK3568_GRF_VI_CON0, 4, 0),
+	[GRF_DPHY_CSIPHY_DATALANE_EN] = PHY_REG(RK3568_GRF_VI_CON0, 4, 4),
+	[GRF_DPHY_CSIPHY_CLKLANE_EN] = PHY_REG(RK3568_GRF_VI_CON0, 1, 8),
+};
+
 struct hsfreq_range {
 	u32 range_h;
 	u8 cfg_bit;
@@ -352,6 +363,15 @@ static const struct dphy_drv_data rk3368_mipidphy_drv_data = {
 	.grf_regs = rk3368_grf_dphy_regs,
 };
 
+static const struct dphy_drv_data rk3568_mipidphy_drv_data = {
+	.pwrctl_offset = -1,
+	.ths_settle_offset = RK3568_CSIDPHY_CLK_WR_THS_SETTLE,
+	.calib_offset = RK3568_CSIDPHY_CLK_CALIB_EN,
+	.hsfreq_ranges = rk1808_mipidphy_hsfreq_ranges,
+	.num_hsfreq_ranges = ARRAY_SIZE(rk1808_mipidphy_hsfreq_ranges),
+	.grf_regs = rk3568_grf_dphy_regs,
+};
+
 static const struct of_device_id rockchip_inno_csidphy_match_id[] = {
 	{
 		.compatible = "rockchip,px30-csi-dphy",
@@ -369,6 +389,10 @@ static const struct of_device_id rockchip_inno_csidphy_match_id[] = {
 		.compatible = "rockchip,rk3368-csi-dphy",
 		.data = &rk3368_mipidphy_drv_data,
 	},
+	{
+		.compatible = "rockchip,rk3568-csi-dphy",
+		.data = &rk3568_mipidphy_drv_data,
+	},
 	{}
 };
 MODULE_DEVICE_TABLE(of, rockchip_inno_csidphy_match_id);
Signature · 1 line
2.30.2
maintainer Reviewed-by on v1 2/3
#5 lore raw

Re: [PATCH 2/3] phy: rockchip: add support for the rk356x variant to rockchip-inno-csidphy

Am Mittwoch, 20. Juli 2022, 11:15:26 CEST schrieb Michael Riesch:

Quoted 5 lines

This adds support for variant found in Rockchip RK356x SoCs. Note that only the basic operating mode is supported, in which all four CSI lines are controlled by the Rockchip ISP.

Signature · 3 lines
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
#6 lore raw

PATCH 3/3 arm64: dts: rockchip: add csi dphy node to rk356x

In reply to Michael Riesch

Add the MIPI CSI DPHY node to the RK356x device tree.

---
 arch/arm64/boot/dts/rockchip/rk356x.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm64/boot/dts/rockchip/rk356x.dtsi +12 -0
index 7d9ad6aa4052..16d18170ae82 100644
@@ -1544,6 +1544,18 @@ combphy2: phy@fe840000 {
 		status = "disabled";
 	};
 
+	csi_dphy: phy@fe870000 {
+		compatible = "rockchip,rk3568-csi-dphy";
+		reg = <0x0 0xfe870000 0x0 0x10000>;
+		clocks = <&cru PCLK_MIPICSIPHY>;
+		clock-names = "pclk";
+		#phy-cells = <0>;
+		resets = <&cru SRST_P_MIPICSIPHY>;
+		reset-names = "apb";
+		rockchip,grf = <&grf>;
+		status = "disabled";
+	};
+
 	usb2phy0: usb2phy@fe8a0000 {
 		compatible = "rockchip,rk3568-usb2phy";
 		reg = <0x0 0xfe8a0000 0x0 0x10000>;
Signature · 1 line
2.30.2
#7 lore raw
In reply to Michael Riesch

Hi all,

Quoted 5 lines · Michael Riesch

Hi all,

This series adds support for the variant of the Innosilicon MIPI CSI DPHY that can be found in Rockchip RK356x SoCs.

Quoted 7 lines

Please note that only the basic operating mode is supported, in which all four CSI lanes are controlled by the Rockchip ISP. Split lane operation (e.g., two lanes to ISP and two lanes to VICAP) is not supported.

This has been tested on a Radxa ROCK3 Model A board together with an IMX219 camera sensor and a patched version of the rkisp1 driver (with support for the RK356x variant V2.1 added in a very crude way).

If someone would like to test the patches, I pushed the hacks required to bring up the RK3568 ISP to

https://github.com/mriesch-wv/linux/commits/feature/isp2

The following commands are required to set up streaming for my IMX219 module (Raspberry Pi Camera V2.1):

media-ctl -d "platform:rkisp1" --set-v4l2 '"rkisp1_isp":0 [fmt:SRGGB10_1X10/3280x2464 crop: (0,0)/3200x2400]'

media-ctl -d "platform:rkisp1" --set-v4l2 '"rkisp1_isp":2 [fmt:YUYV8_2X8/3200x2400 crop: (0,0)/3200x2400]'

media-ctl -d "platform:rkisp1" --set-v4l2 '"rkisp1_resizer_mainpath":0 [fmt:YUYV8_2X8/3200x2400 crop: (0,0)/3200x2400]'

media-ctl -d "platform:rkisp1" --set-v4l2 '"rkisp1_resizer_mainpath":1 [fmt:YUYV8_2X8/3200x2400]'

media-ctl -d "platform:rkisp1" --set-v4l2 '"rkisp1_resizer_selfpath":0 [fmt:YUYV8_2X8/3200x2400]'

media-ctl -d "platform:rkisp1" --set-v4l2 '"rkisp1_resizer_selfpath":1 [fmt:YUYV8_2X8/800x600]'

v4l2-ctl -z "platform:rkisp1" -d "rkisp1_mainpath" -v "width=3200,height=2400"

(adjust to your camera module as required). After that, I can stream with, e.g.,

gst-launch-1.0 v4l2src ! video/x-raw,width=3200,height=2400 ! waylandsink

The image quality is horrid, of course (I think the ISP is not even debayering the sensor data), but one can recognize the objects before the camera and it can be proved that the CSI DPHY works.

Best regards,
Michael

Quoted 17 lines

Looking forward to your comments!

Best regards,
Michael

Michael Riesch (3):
dt-bindings: phy: add compatible for rk356x to rockchip-inno-csi-dphy
phy: rockchip: add support for the rk356x variant to
rockchip-inno-csidphy
arm64: dts: rockchip: add csi dphy node to rk356x

 .../bindings/phy/rockchip-inno-csi-dphy.yaml  |  1 +
 arch/arm64/boot/dts/rockchip/rk356x.dtsi      | 12 ++++++++++
 .../phy/rockchip/phy-rockchip-inno-csidphy.c  | 24 +++++++++++++++++++
 3 files changed, 37 insertions(+)
#8 lore raw
In reply to Michael Riesch
Quoted 24 lines · Michael Riesch

Hi all,

This series adds support for the variant of the Innosilicon MIPI CSI DPHY that can be found in Rockchip RK356x SoCs.

Please note that only the basic operating mode is supported, in which all four CSI lanes are controlled by the Rockchip ISP. Split lane operation (e.g., two lanes to ISP and two lanes to VICAP) is not supported.

This has been tested on a Radxa ROCK3 Model A board together with an IMX219 camera sensor and a patched version of the rkisp1 driver (with support for the RK356x variant V2.1 added in a very crude way).

Looking forward to your comments!

Best regards,
Michael

Michael Riesch (3):
dt-bindings: phy: add compatible for rk356x to rockchip-inno-csi-dphy
phy: rockchip: add support for the rk356x variant to
rockchip-inno-csidphy
arm64: dts: rockchip: add csi dphy node to rk356x

Quoted 5 lines
 .../bindings/phy/rockchip-inno-csi-dphy.yaml  |  1 +
 arch/arm64/boot/dts/rockchip/rk356x.dtsi      | 12 ++++++++++
 .../phy/rockchip/phy-rockchip-inno-csidphy.c  | 24 +++++++++++++++++++
 3 files changed, 37 insertions(+)

Gentle ping on this one. I am aware of course that it is still vacation season and the merge window was there as well, but it would be nice to have some feedback.

Thanks and best regards,
Michael

Signature · 3 lines
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
maintainer
#9 lore raw
In reply to Michael Riesch
Quoted 5 lines · Michael Riesch

Hi all,

This series adds support for the variant of the Innosilicon MIPI CSI DPHY that can be found in Rockchip RK356x SoCs.

Quoted 7 lines

Please note that only the basic operating mode is supported, in which all four CSI lanes are controlled by the Rockchip ISP. Split lane operation (e.g., two lanes to ISP and two lanes to VICAP) is not supported.

This has been tested on a Radxa ROCK3 Model A board together with an IMX219 camera sensor and a patched version of the rkisp1 driver (with support for the RK356x variant V2.1 added in a very crude way).

Applied 1-2, thanks

Signature · 1 line
~Vinod
maintainer Applied
#10 lore raw

Re: (subset) [PATCH 0/3] Add support for the RK356x variant of the Inno CSI DPHY

In reply to Michael Riesch
Quoted 8 lines · Michael Riesch

This series adds support for the variant of the Innosilicon MIPI CSI DPHY that can be found in Rockchip RK356x SoCs.

Please note that only the basic operating mode is supported, in which all four CSI lanes are controlled by the Rockchip ISP. Split lane operation (e.g., two lanes to ISP and two lanes to VICAP) is not supported.

[...]

Applied, thanks!

[3/3] arm64: dts: rockchip: add csi dphy node to rk356x

      commit: b6c228401b2565b7bd59ad7418074145cdaa316a

Best regards,

Signature · 1 line
Heiko Stuebner <[email protected]>