2024-05-09 14:07:14

by Alex Bee

[permalink] [raw]
Subject: [PATCH v3 0/7] Add DSI support for RK3128

This series aims to add support for the DesignWare MIPI DSI controller and
the Innoslicon D-PHY found in RK3128 SoCs. The code additions are rather
tiny: It only need some code in the Rockchip dw-mipi-dsi glue layer for
this SoC and do some changes in the SoC's clock driver. Support for the phy
was already added when the Innosilicon D-PHY driver was initially
submitted. I tested it with a 800x1280 DSI panel where all 4 lanes that are
supported are used.

changes in v2:
To improve power-efficiency when the DSI controller is not in use, I
dropped the patch which made hclk_vio_h2p a critical clock and instead
added support for an AHB clock to the DSI controller driver and updated
the bindings and the addition to the SoC DT accordingly.

Link to v1:
https://lore.kernel.org/linux-kernel/[email protected]/

changes in v3:
Dropped the changes for the additional AHB clock for the DSI controller,
as it's not part of the IP block. (Heiko)

Link to v2:
https://lore.kernel.org/linux-kernel/[email protected]/

Please see individual patches for details about the changes.

Alex Bee (7):
dt-bindings: display: rockchip,dw-mipi-dsi: Document RK3128 DSI
dt-bindings: clock: rk3128: Add PCLK_MIPIPHY
clk: rockchip: rk3128: Export PCLK_MIPIPHY
clk: rockchip: rk3128: Add hclk_vio_h2p to critical clocks
drm/rockchip: dsi: Add support for RK3128
ARM: dts: rockchip: Add D-PHY for RK3128
ARM: dts: rockchip: Add DSI for RK3128

.../rockchip/rockchip,dw-mipi-dsi.yaml | 2 +
arch/arm/boot/dts/rockchip/rk3128.dtsi | 50 +++++++++++++++++++
drivers/clk/rockchip/clk-rk3128.c | 3 +-
.../gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 20 ++++++++
include/dt-bindings/clock/rk3128-cru.h | 1 +
5 files changed, 75 insertions(+), 1 deletion(-)

--
2.43.2



2024-05-09 14:07:18

by Alex Bee

[permalink] [raw]
Subject: [PATCH v3 1/7] dt-bindings: display: rockchip,dw-mipi-dsi: Document RK3128 DSI

Document the MIPI DSI controller for Rockchip RK3128. The integration is
similar to PX30 so it's bindings-constraints can be re-used.

Signed-off-by: Alex Bee <[email protected]>
Acked-by: Conor Dooley <[email protected]>
---
changes since v1:
- added ahb clock

changes since v2:
- revert added ahb clock

.../rockchip/rockchip,dw-mipi-dsi.yaml | 25 ++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/display/rockchip/rockchip,dw-mipi-dsi.yaml b/Documentation/devicetree/bindings/display/rockchip/rockchip,dw-mipi-dsi.yaml
index ccf79e738fa1..ccd71c5324af 100644
--- a/Documentation/devicetree/bindings/display/rockchip/rockchip,dw-mipi-dsi.yaml
+++ b/Documentation/devicetree/bindings/display/rockchip/rockchip,dw-mipi-dsi.yaml
@@ -15,6 +15,7 @@ properties:
items:
- enum:
- rockchip,px30-mipi-dsi
+ - rockchip,rk3128-mipi-dsi
- rockchip,rk3288-mipi-dsi
- rockchip,rk3399-mipi-dsi
- rockchip,rk3568-mipi-dsi
@@ -77,6 +78,7 @@ allOf:
contains:
enum:
- rockchip,px30-mipi-dsi
+ - rockchip,rk3128-mipi-dsi
- rockchip,rk3568-mipi-dsi
- rockchip,rv1126-mipi-dsi

--
2.43.2


2024-05-09 14:07:39

by Alex Bee

[permalink] [raw]
Subject: [PATCH v3 2/7] dt-bindings: clock: rk3128: Add PCLK_MIPIPHY

The DPHY's APB clock is required to be exposed in order to be able to
enable it and access the phy's registers.

Signed-off-by: Alex Bee <[email protected]>
Acked-by: Conor Dooley <[email protected]>
---
changes since v1:
- none

include/dt-bindings/clock/rk3128-cru.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/include/dt-bindings/clock/rk3128-cru.h b/include/dt-bindings/clock/rk3128-cru.h
index 6a47825dac5d..1be455ba4985 100644
--- a/include/dt-bindings/clock/rk3128-cru.h
+++ b/include/dt-bindings/clock/rk3128-cru.h
@@ -116,6 +116,7 @@
#define PCLK_GMAC 367
#define PCLK_PMU_PRE 368
#define PCLK_SIM_CARD 369
+#define PCLK_MIPIPHY 370

/* hclk gates */
#define HCLK_SPDIF 440
--
2.43.2


2024-05-09 14:07:54

by Alex Bee

[permalink] [raw]
Subject: [PATCH v3 3/7] clk: rockchip: rk3128: Export PCLK_MIPIPHY

Export the D-DHY's APB clock for usage in the DT. Also drop the
CLK_IGNORE_UNUSED-flag, as the clock will be enabled on demand.

Signed-off-by: Alex Bee <[email protected]>
---
changes since v1:
- reword commit message

drivers/clk/rockchip/clk-rk3128.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/rockchip/clk-rk3128.c b/drivers/clk/rockchip/clk-rk3128.c
index 75071e0cd321..a20d1fd25e2a 100644
--- a/drivers/clk/rockchip/clk-rk3128.c
+++ b/drivers/clk/rockchip/clk-rk3128.c
@@ -526,7 +526,7 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = {
GATE(PCLK_ACODEC, "pclk_acodec", "pclk_cpu", 0, RK2928_CLKGATE_CON(5), 14, GFLAGS),
GATE(0, "pclk_ddrupctl", "pclk_cpu", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(5), 7, GFLAGS),
GATE(0, "pclk_grf", "pclk_cpu", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(5), 4, GFLAGS),
- GATE(0, "pclk_mipiphy", "pclk_cpu", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(5), 0, GFLAGS),
+ GATE(PCLK_MIPIPHY, "pclk_mipiphy", "pclk_cpu", 0, RK2928_CLKGATE_CON(5), 0, GFLAGS),

GATE(0, "pclk_pmu", "pclk_pmu_pre", 0, RK2928_CLKGATE_CON(9), 2, GFLAGS),
GATE(0, "pclk_pmu_niu", "pclk_pmu_pre", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(9), 3, GFLAGS),
--
2.43.2


2024-05-09 14:08:10

by Alex Bee

[permalink] [raw]
Subject: [PATCH v3 4/7] clk: rockchip: rk3128: Add hclk_vio_h2p to critical clocks

The DSI controller needs this clock to be enabled in order to be able to
access the registers. Make it critical for that purpose.

Signed-off-by: Alex Bee <[email protected]>
---
changes since v1:
- dropped patch

changes since v2:
-re-added patch

drivers/clk/rockchip/clk-rk3128.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/clk/rockchip/clk-rk3128.c b/drivers/clk/rockchip/clk-rk3128.c
index a20d1fd25e2a..d076b7971f33 100644
--- a/drivers/clk/rockchip/clk-rk3128.c
+++ b/drivers/clk/rockchip/clk-rk3128.c
@@ -563,6 +563,7 @@ static const char *const rk3128_critical_clocks[] __initconst = {
"pclk_cpu",
"aclk_peri",
"hclk_peri",
+ "hclk_vio_h2p",
"pclk_peri",
"pclk_pmu",
"sclk_timer5",
--
2.43.2


2024-05-09 14:08:29

by Alex Bee

[permalink] [raw]
Subject: [PATCH v3 5/7] drm/rockchip: dsi: Add support for RK3128

The DesignWare MIPI DSI controller found RK3128 SoCs supports up to 4 DSI
data lanes. Similar to PX30/RK356x/RV1126 it uses an external D-PHY.

Signed-off-by: Alex Bee <[email protected]>
---
changes since v1:
- none

.../gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c
index 4cc8ed8f4fbd..58a44af0e9ad 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c
@@ -153,6 +153,11 @@
#define PX30_DSI_TURNDISABLE BIT(5)
#define PX30_DSI_LCDC_SEL BIT(0)

+#define RK3128_GRF_LVDS_CON0 0x0150
+#define RK3128_DSI_FORCETXSTOPMODE GENMASK(13, 10)
+#define RK3128_DSI_FORCERXMODE BIT(9)
+#define RK3128_DSI_TURNDISABLE BIT(8)
+
#define RK3288_GRF_SOC_CON6 0x025c
#define RK3288_DSI0_LCDC_SEL BIT(6)
#define RK3288_DSI1_LCDC_SEL BIT(9)
@@ -1493,6 +1498,18 @@ static const struct rockchip_dw_dsi_chip_data px30_chip_data[] = {
{ /* sentinel */ }
};

+static const struct rockchip_dw_dsi_chip_data rk3128_chip_data[] = {
+ {
+ .reg = 0x10110000,
+ .lanecfg1_grf_reg = RK3128_GRF_LVDS_CON0,
+ .lanecfg1 = HIWORD_UPDATE(0, RK3128_DSI_TURNDISABLE |
+ RK3128_DSI_FORCERXMODE |
+ RK3128_DSI_FORCETXSTOPMODE),
+ .max_data_lanes = 4,
+ },
+ { /* sentinel */ }
+};
+
static const struct rockchip_dw_dsi_chip_data rk3288_chip_data[] = {
{
.reg = 0xff960000,
@@ -1670,6 +1687,9 @@ static const struct of_device_id dw_mipi_dsi_rockchip_dt_ids[] = {
{
.compatible = "rockchip,px30-mipi-dsi",
.data = &px30_chip_data,
+ }, {
+ .compatible = "rockchip,rk3128-mipi-dsi",
+ .data = &rk3128_chip_data,
}, {
.compatible = "rockchip,rk3288-mipi-dsi",
.data = &rk3288_chip_data,
--
2.43.2


2024-05-09 14:08:37

by Alex Bee

[permalink] [raw]
Subject: [PATCH v3 6/7] ARM: dts: rockchip: Add D-PHY for RK3128

The InnoSilicon D-PHY found in RK3128 SoCs supports DSI/LVDS/TTL with a
maximum transfer rate of 1 Gbps per lane. While adding it, also add it's
clocks to RK3128_PD_VIO powerdomain as the phy is part of it.

Signed-off-by: Alex Bee <[email protected]>
---
changes since v1:
- also added SCLK_MIPI_24M to powerdomain
- reword commit message

arch/arm/boot/dts/rockchip/rk3128.dtsi | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/arch/arm/boot/dts/rockchip/rk3128.dtsi b/arch/arm/boot/dts/rockchip/rk3128.dtsi
index fb98873fd94e..fbd95bb08cd3 100644
--- a/arch/arm/boot/dts/rockchip/rk3128.dtsi
+++ b/arch/arm/boot/dts/rockchip/rk3128.dtsi
@@ -216,6 +216,8 @@ power-domain@RK3128_PD_VIO {
<&cru ACLK_LCDC0>,
<&cru HCLK_LCDC0>,
<&cru PCLK_MIPI>,
+ <&cru PCLK_MIPIPHY>,
+ <&cru SCLK_MIPI_24M>,
<&cru ACLK_RGA>,
<&cru HCLK_RGA>,
<&cru ACLK_VIO0>,
@@ -496,6 +498,18 @@ hdmi_out: port@1 {
};
};

+ dphy: phy@20038000 {
+ compatible = "rockchip,rk3128-dsi-dphy";
+ reg = <0x20038000 0x4000>;
+ clocks = <&cru SCLK_MIPI_24M>, <&cru PCLK_MIPIPHY>;
+ clock-names = "ref", "pclk";
+ resets = <&cru SRST_MIPIPHY_P>;
+ reset-names = "apb";
+ power-domains = <&power RK3128_PD_VIO>;
+ #phy-cells = <0>;
+ status = "disabled";
+ };
+
timer0: timer@20044000 {
compatible = "rockchip,rk3128-timer", "rockchip,rk3288-timer";
reg = <0x20044000 0x20>;
--
2.43.2


2024-05-09 14:08:47

by Alex Bee

[permalink] [raw]
Subject: [PATCH v3 7/7] ARM: dts: rockchip: Add DSI for RK3128

Add the Designware MIPI DSI controller and it's port nodes.

Signed-off-by: Alex Bee <[email protected]>
---
changes since v1:
- added HCLK_VIO_H2P as ahb clock

changes since v2:
- dropped ahb clock again

arch/arm/boot/dts/rockchip/rk3128.dtsi | 36 ++++++++++++++++++++++++++
1 file changed, 36 insertions(+)

diff --git a/arch/arm/boot/dts/rockchip/rk3128.dtsi b/arch/arm/boot/dts/rockchip/rk3128.dtsi
index fbd95bb08cd3..7f2bf3e51082 100644
--- a/arch/arm/boot/dts/rockchip/rk3128.dtsi
+++ b/arch/arm/boot/dts/rockchip/rk3128.dtsi
@@ -277,6 +277,42 @@ vop_out_hdmi: endpoint@0 {
reg = <0>;
remote-endpoint = <&hdmi_in_vop>;
};
+
+ vop_out_dsi: endpoint@1 {
+ reg = <1>;
+ remote-endpoint = <&dsi_in_vop>;
+ };
+ };
+ };
+
+ dsi: dsi@10110000 {
+ compatible = "rockchip,rk3128-mipi-dsi", "snps,dw-mipi-dsi";
+ reg = <0x10110000 0x4000>;
+ interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&cru PCLK_MIPI>;
+ clock-names = "pclk";
+ phys = <&dphy>;
+ phy-names = "dphy";
+ resets = <&cru SRST_VIO_MIPI_DSI>;
+ reset-names = "apb";
+ rockchip,grf = <&grf>;
+ power-domains = <&power RK3128_PD_VIO>;
+ status = "disabled";
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ dsi_in: port@0 {
+ reg = <0>;
+ dsi_in_vop: endpoint {
+ remote-endpoint = <&vop_out_dsi>;
+ };
+ };
+
+ dsi_out: port@1 {
+ reg = <1>;
+ };
};
};

--
2.43.2


2024-05-28 10:17:08

by Heiko Stuebner

[permalink] [raw]
Subject: Re: (subset) [PATCH v3 0/7] Add DSI support for RK3128

On Thu, 9 May 2024 16:06:46 +0200, Alex Bee wrote:
> This series aims to add support for the DesignWare MIPI DSI controller and
> the Innoslicon D-PHY found in RK3128 SoCs. The code additions are rather
> tiny: It only need some code in the Rockchip dw-mipi-dsi glue layer for
> this SoC and do some changes in the SoC's clock driver. Support for the phy
> was already added when the Innosilicon D-PHY driver was initially
> submitted. I tested it with a 800x1280 DSI panel where all 4 lanes that are
> supported are used.
>
> [...]

Applied, thanks!

[1/7] dt-bindings: display: rockchip,dw-mipi-dsi: Document RK3128 DSI
commit: 9bb3d9ad3e19f16efc34f427a58e480424c56a16
[5/7] drm/rockchip: dsi: Add support for RK3128
commit: 62545c719e26ec9f62efab7e9582deb73265b6d0

Best regards,
--
Heiko Stuebner <[email protected]>

2024-05-28 15:11:24

by Heiko Stuebner

[permalink] [raw]
Subject: Re: (subset) [PATCH v3 0/7] Add DSI support for RK3128

On Thu, 9 May 2024 16:06:46 +0200, Alex Bee wrote:
> This series aims to add support for the DesignWare MIPI DSI controller and
> the Innoslicon D-PHY found in RK3128 SoCs. The code additions are rather
> tiny: It only need some code in the Rockchip dw-mipi-dsi glue layer for
> this SoC and do some changes in the SoC's clock driver. Support for the phy
> was already added when the Innosilicon D-PHY driver was initially
> submitted. I tested it with a 800x1280 DSI panel where all 4 lanes that are
> supported are used.
>
> [...]

Applied, thanks!

[2/7] dt-bindings: clock: rk3128: Add PCLK_MIPIPHY
commit: 14a1d1dc35d346a1523f38f6517c349dfa447a58
[3/7] clk: rockchip: rk3128: Export PCLK_MIPIPHY
commit: 577c04fbf255f81f26507a7ffb2477fce50c214d
[4/7] clk: rockchip: rk3128: Add hclk_vio_h2p to critical clocks
commit: e745698209837a952d4515bc02cddd5a31a644b9
[6/7] ARM: dts: rockchip: Add D-PHY for RK3128
commit: 45b22b83e00b1ec36d5de53b797cd9d8545a0d34
[7/7] ARM: dts: rockchip: Add DSI for RK3128
commit: 73fc389129dfe22b5706b4b6cbc1a4f86d1fbc1b

Best regards,
--
Heiko Stuebner <[email protected]>