Add StarFive JH7110 SoC DSI support
Subsystems (4)
cover Add StarFive JH7110 SoC DSI support
This series is the v1 series that attempts to support the CDNS DSI driver used to converts DPI to DSI. CDNS DSI is embedded in StarFive JH7110 SoC. The series has been tested on the VisionFive 2 board.
Keith Zhao (2):
dt-bindings: display: bridge: cdns: Add properties to support StarFive
JH7110 SoC
gpu: drm: bridge: cadence: Add a driver and platform ops for StarFive
JH7110 SoC.../bindings/display/bridge/cdns,dsi.yaml | 38 +- MAINTAINERS | 8 + drivers/gpu/drm/bridge/cadence/Kconfig | 7 + drivers/gpu/drm/bridge/cadence/Makefile | 1 + .../gpu/drm/bridge/cadence/cdns-dsi-core.c | 28 +- .../gpu/drm/bridge/cadence/cdns-dsi-core.h | 19 + .../gpu/drm/bridge/cadence/cdns-dsi-jh7110.c | 386 ++++++++++++++++++ .../gpu/drm/bridge/cadence/cdns-dsi-jh7110.h | 186 +++++++++ 8 files changed, 670 insertions(+), 3 deletions(-) create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110.c create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110.h
Signature · 1 line
2.17.1
PATCH 1/2 dt-bindings: display: bridge: cdns: Add properties to support StarFive JH7110 SoC
From: Keith Zhao <[email protected]>
Add properties in CDNS DSI yaml file to match with CDNS DSI module in StarFive JH7110 SoC.
--- .../bindings/display/bridge/cdns,dsi.yaml | 38 ++++++++++++++++++- 1 file changed, 36 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml +36 -2
@@ -17,6 +17,7 @@ properties: enum: - cdns,dsi - ti,j721e-dsi + - starfive,cdns-dsi reg: minItems: 1
@@ -27,14 +28,20 @@ properties: Register block for wrapper settings registers in case of TI J7 SoCs. clocks: + minItems: 2 items: - description: PSM clock, used by the IP - description: sys clock, used by the IP + - description: apb clock, used by the IP + - description: txesc clock, used by the IP clock-names: + minItems: 2 items: - const: dsi_p_clk - const: dsi_sys_clk + - const: apb + - const: txesc phys: maxItems: 1
@@ -46,10 +53,21 @@ properties: maxItems: 1 resets: - maxItems: 1 + minItems: 1 + items: + - description: dsi sys reset line + - description: dsi dpi reset line + - description: dsi apb reset line + - description: dsi txesc reset line + - description: dsi txbytehs reset line reset-names: - const: dsi_p_rst + items: + - const: dsi_p_rst + - const: dsi_dpi + - const: dsi_apb + - const: dsi_txesc + - const: dsi_txbytehs ports: $ref: /schemas/graph.yaml#/properties/ports
@@ -90,6 +108,22 @@ allOf: reg: maxItems: 1 + - if: + properties: + compatible: + contains: + const: starfive,cdns-dsi + then: + properties: + clocks: + minItems: 4 + maxItems: 4 + resets: + minItems: 5 + maxItems: 5 + required: + - reset-names + required: - compatible - reg
Signature · 1 line
2.17.1
Re: [PATCH v1 1/2] dt-bindings: display: bridge: cdns: Add properties to support StarFive JH7110 SoC
Quoted 15 lines · Shengyang Chen
From: Keith Zhao <[email protected]>
Add properties in CDNS DSI yaml file to match with CDNS DSI module in StarFive JH7110 SoC.
Signed-off-by Keith Zhao <[email protected]>--- .../bindings/display/bridge/cdns,dsi.yaml | 38 ++++++++++++++++++- 1 file changed, 36 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml +0
-0
Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml properties: · line 20
Quoted 4 lines
Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml +1
-0@@ -17,6 +17,7 @@ properties: enum: - cdns,dsi - ti,j721e-dsi + - starfive,cdns-dsi
Keep alphabetical order.
Quoted 49 lines
Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml +19
-2reg: minItems: 1@@ -27,14 +28,20 @@ properties: Register block for wrapper settings registers in case of TI J7 SoCs. clocks: + minItems: 2 items: - description: PSM clock, used by the IP - description: sys clock, used by the IP + - description: apb clock, used by the IP + - description: txesc clock, used by the IP clock-names: + minItems: 2 items: - const: dsi_p_clk - const: dsi_sys_clk + - const: apb + - const: txesc phys: maxItems: 1@@ -46,10 +53,21 @@ properties: maxItems: 1 resets: - maxItems: 1 + minItems: 1 + items: + - description: dsi sys reset line + - description: dsi dpi reset line + - description: dsi apb reset line + - description: dsi txesc reset line + - description: dsi txbytehs reset line reset-names: - const: dsi_p_rst + items: + - const: dsi_p_rst + - const: dsi_dpi + - const: dsi_apb + - const: dsi_txesc + - const: dsi_txbytehs ports: $ref: /schemas/graph.yaml#/properties/ports
Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml allOf: · line 110
Quoted 3 lines
Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml +0
-0@@ -90,6 +108,22 @@ allOf: reg: maxItems: 1
You need to restrict other variants, because you just relaxed several properties for everyone...
Best regards,
Krzysztof
Re: [PATCH v1 1/2] dt-bindings: display: bridge: cdns: Add properties to support StarFive JH7110 SoC
Hi,Krzysztof
Thanks for review and comment.
Quoted 11 lines · Krzysztof Kozlowski
Quoted 10 lines · Shengyang Chen
From: Keith Zhao <[email protected]>
Add properties in CDNS DSI yaml file to match with CDNS DSI module in StarFive JH7110 SoC.
Signed-off-by Keith Zhao <[email protected]>--- .../bindings/display/bridge/cdns,dsi.yaml | 38 ++++++++++++++++++- 1 file changed, 36 insertions(+), 2 deletions(-)
Quoted 12 lines
Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml properties: · line 20
Quoted 9 lines
Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml +1
-0@@ -17,6 +17,7 @@ properties: enum: - cdns,dsi - ti,j721e-dsi + - starfive,cdns-dsiKeep alphabetical order.
ok, will keep it order
Quoted 46 lines
Quoted 46 lines
Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml +19
-2reg: minItems: 1@@ -27,14 +28,20 @@ properties: Register block for wrapper settings registers in case of TI J7 SoCs. clocks: + minItems: 2 items: - description: PSM clock, used by the IP - description: sys clock, used by the IP + - description: apb clock, used by the IP + - description: txesc clock, used by the IP clock-names: + minItems: 2 items: - const: dsi_p_clk - const: dsi_sys_clk + - const: apb + - const: txesc phys: maxItems: 1@@ -46,10 +53,21 @@ properties: maxItems: 1 resets: - maxItems: 1 + minItems: 1 + items: + - description: dsi sys reset line + - description: dsi dpi reset line + - description: dsi apb reset line + - description: dsi txesc reset line + - description: dsi txbytehs reset line reset-names: - const: dsi_p_rst + items: + - const: dsi_p_rst + - const: dsi_dpi + - const: dsi_apb + - const: dsi_txesc + - const: dsi_txbytehs
Quoted 11 lines
Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml allOf: · line 110
Quoted 6 lines
Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml +0
-0ports: $ref: /schemas/graph.yaml#/properties/ports@@ -90,6 +108,22 @@ allOf: reg: maxItems: 1You need to restrict other variants, because you just relaxed several properties for everyone...
ok, will fix it
Quoted 3 lines
Best regards,
Krzysztof
thanks.
Best Regards,
Shengyang
Re: [PATCH v1 1/2] dt-bindings: display: bridge: cdns: Add properties to support StarFive JH7110 SoC
In reply to Shengyang ChenQuoted 15 lines · Shengyang Chen
From: Keith Zhao <[email protected]>
Add properties in CDNS DSI yaml file to match with CDNS DSI module in StarFive JH7110 SoC.
Signed-off-by Keith Zhao <[email protected]>--- .../bindings/display/bridge/cdns,dsi.yaml | 38 ++++++++++++++++++- 1 file changed, 36 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml +0
-0
Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml properties: · line 20
Quoted 4 lines
Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml +1
-0@@ -17,6 +17,7 @@ properties: enum: - cdns,dsi - ti,j721e-dsi + - starfive,cdns-dsi
BTW, one more thing, I really doubt that starfive created "cdns" block. "cdns" is vendor prefix. Use SoCs-specific compatibles.
Best regards,
Krzysztof
Re: [PATCH v1 1/2] dt-bindings: display: bridge: cdns: Add properties to support StarFive JH7110 SoC
Quoted 11 lines · Krzysztof Kozlowski
Quoted 10 lines · Shengyang Chen
From: Keith Zhao <[email protected]>
Add properties in CDNS DSI yaml file to match with CDNS DSI module in StarFive JH7110 SoC.
Signed-off-by Keith Zhao <[email protected]>--- .../bindings/display/bridge/cdns,dsi.yaml | 38 ++++++++++++++++++- 1 file changed, 36 insertions(+), 2 deletions(-)
Quoted 13 lines
Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml properties: · line 20
Quoted 9 lines
Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml +1
-0@@ -17,6 +17,7 @@ properties: enum: - cdns,dsi - ti,j721e-dsi + - starfive,cdns-dsiBTW, one more thing, I really doubt that starfive created "cdns" block. "cdns" is vendor prefix. Use SoCs-specific compatibles.
The StarFive SoC contains cdns dsi ip inside. It did not create cdns block. Sorry about that. It will be fixed by using SoCs-specific compatibles.
thanks
Quoted 3 lines
Best regards,
Krzysztof
Rob Herring
maintainerRe: [PATCH v1 1/2] dt-bindings: display: bridge: cdns: Add properties to support StarFive JH7110 SoC
In reply to Shengyang ChenQuoted 54 lines · Shengyang Chen
From: Keith Zhao <[email protected]>
Add properties in CDNS DSI yaml file to match with CDNS DSI module in StarFive JH7110 SoC.
Signed-off-by Keith Zhao <[email protected]>--- .../bindings/display/bridge/cdns,dsi.yaml | 38 ++++++++++++++++++- 1 file changed, 36 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml +13
-1@@ -17,6 +17,7 @@ properties: enum: - cdns,dsi - ti,j721e-dsi + - starfive,cdns-dsi reg: minItems: 1@@ -27,14 +28,20 @@ properties: Register block for wrapper settings registers in case of TI J7 SoCs. clocks: + minItems: 2 items: - description: PSM clock, used by the IP - description: sys clock, used by the IP + - description: apb clock, used by the IP + - description: txesc clock, used by the IP clock-names: + minItems: 2 items: - const: dsi_p_clk - const: dsi_sys_clk + - const: apb + - const: txesc phys: maxItems: 1@@ -46,10 +53,21 @@ properties: maxItems: 1 resets: - maxItems: 1 + minItems: 1 + items: + - description: dsi sys reset line + - description: dsi dpi reset line + - description: dsi apb reset line + - description: dsi txesc reset line
Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml properties: · line 70
Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml +7
-1+ - description: dsi txbytehs reset line reset-names: - const: dsi_p_rst + items: + - const: dsi_p_rst + - const: dsi_dpi + - const: dsi_apb + - const: dsi_txesc + - const: dsi_txbytehs
Let's not continue the redundant 'dsi_' prefix. We're stuck with it for the first one, but not the new ones.
Rob
Re: [PATCH v1 1/2] dt-bindings: display: bridge: cdns: Add properties to support StarFive JH7110 SoC
Hi, Rob
Thanks for review and comment.
Quoted 57 lines · Rob Herring
Quoted 56 lines · Shengyang Chen
From: Keith Zhao <[email protected]>
Add properties in CDNS DSI yaml file to match with CDNS DSI module in StarFive JH7110 SoC.
Signed-off-by Keith Zhao <[email protected]>--- .../bindings/display/bridge/cdns,dsi.yaml | 38 ++++++++++++++++++- 1 file changed, 36 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml +14
-1@@ -17,6 +17,7 @@ properties: enum: - cdns,dsi - ti,j721e-dsi + - starfive,cdns-dsi reg: minItems: 1@@ -27,14 +28,20 @@ properties: Register block for wrapper settings registers in case of TI J7 SoCs. clocks: + minItems: 2 items: - description: PSM clock, used by the IP - description: sys clock, used by the IP + - description: apb clock, used by the IP + - description: txesc clock, used by the IP clock-names: + minItems: 2 items: - const: dsi_p_clk - const: dsi_sys_clk + - const: apb + - const: txesc phys: maxItems: 1@@ -46,10 +53,21 @@ properties: maxItems: 1 resets: - maxItems: 1 + minItems: 1 + items: + - description: dsi sys reset line + - description: dsi dpi reset line + - description: dsi apb reset line + - description: dsi txesc reset line + - description: dsi txbytehs reset line
Quoted 12 lines
Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml properties: · line 70
Quoted 8 lines
Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml +6
-1reset-names: - const: dsi_p_rst + items: + - const: dsi_p_rst + - const: dsi_dpi + - const: dsi_apb + - const: dsi_txesc + - const: dsi_txbytehsLet's not continue the redundant '
dsi_' prefix. We're stuck with it for the first one, but not the new ones.
ok, "dsi_" will be dropped in next commit.
Quoted 1 line
Rob
thanks.
Best Regards,
Shengyang
PATCH 2/2 gpu: drm: bridge: cadence: Add a driver and platform ops for StarFive JH7110 SoC
In reply to Shengyang ChenFrom: Keith Zhao <[email protected]>
In order to fit CDNS DSI module in StarFive JH7110 SoC, The mainly modification is followed:
1.Add driver for StarFive JH7110 SoC to drive its CDNS DSI module. 2.Add platform ops in cdns-dsi.c for StarFive JH7110 SoC probing.
--- MAINTAINERS | 8 + drivers/gpu/drm/bridge/cadence/Kconfig | 7 + drivers/gpu/drm/bridge/cadence/Makefile | 1 + .../gpu/drm/bridge/cadence/cdns-dsi-core.c | 28 +- .../gpu/drm/bridge/cadence/cdns-dsi-core.h | 19 + .../gpu/drm/bridge/cadence/cdns-dsi-jh7110.c | 386 ++++++++++++++++++ .../gpu/drm/bridge/cadence/cdns-dsi-jh7110.h | 186 +++++++++ 7 files changed, 634 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110.c create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110.h
MAINTAINERS +8 -0
@@ -6868,6 +6868,14 @@ F: Documentation/devicetree/bindings/display/solomon,ssd-common.yaml F: Documentation/devicetree/bindings/display/solomon,ssd13*.yaml F: drivers/gpu/drm/solomon/ssd130x* +DRM DRIVERS FOR STARFIVE +M: Keith Zhao <[email protected]> +M: Shengyang Chen <[email protected]> +L: [email protected] +S: Maintained +T: git git://anongit.freedesktop.org/drm/drm-misc +F: drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110* + DRM DRIVER FOR ST-ERICSSON MCDE M: Linus Walleij <[email protected]> S: Maintained
drivers/gpu/drm/bridge/cadence/Kconfig +7 -0
@@ -19,6 +19,13 @@ config DRM_CDNS_DSI_J721E help Support J721E Cadence DSI wrapper. The wrapper manages the routing of the DSS DPI signal to the Cadence DSI. + +config DRM_CDNS_DSI_JH7110 + bool "JH7110 SOC Cadence DSI support" + default n + help + Cadence DPI to DSI bridge which is embedded in the + StarFive JH7110 SoC. endif config DRM_CDNS_MHDP8546
drivers/gpu/drm/bridge/cadence/Makefile +1 -0
@@ -2,6 +2,7 @@ obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o cdns-dsi-y := cdns-dsi-core.o cdns-dsi-$(CONFIG_DRM_CDNS_DSI_J721E) += cdns-dsi-j721e.o +cdns-dsi-$(CONFIG_DRM_CDNS_DSI_JH7110) += cdns-dsi-jh7110.o obj-$(CONFIG_DRM_CDNS_MHDP8546) += cdns-mhdp8546.o cdns-mhdp8546-y := cdns-mhdp8546-core.o cdns-mhdp8546-hdcp.o cdns-mhdp8546-$(CONFIG_DRM_CDNS_MHDP8546_J721E) += cdns-mhdp8546-j721e.o
drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c +27 -1
@@ -27,6 +27,10 @@#include "cdns-dsi-j721e.h" #endif +#ifdef CONFIG_DRM_CDNS_DSI_JH7110 +#include "cdns-dsi-jh7110.h" +#endif +#define IP_CONF 0x0#define SP_HS_FIFO_DEPTH (x) (((x) & GENMASK(30, 26)) >> 26)#define SP_LP_FIFO_DEPTH (x) (((x) & GENMASK(25, 21)) >> 21)
@@ -586,6 +590,9 @@ static int cdns_dsi_check_conf(struct cdns_dsi *dsi,if (ret)return ret; +if (dsi->platform_ops && dsi->platform_ops->update) + dsi->platform_ops->update (dsi, dsi_cfg, mode); + dsi_hss_hsa_hse_hbp = dsi_cfg->hbp +DSI_HBP_FRAME_OVERHEAD ;if (output->dev->mode_flags &MIPI_DSI_MODE_VIDEO_SYNC_PULSE ) dsi_hss_hsa_hse_hbp += dsi_cfg->hsa +DSI_HSA_FRAME_OVERHEAD ;
@@ -683,7 +690,7 @@ static void cdns_dsi_bridge_post_disable(struct drm_bridge *bridge)pm_runtime_put (dsi->base.dev); } -static void cdns_dsi_hs_init (struct cdns_dsi *dsi) +void cdns_dsi_hs_init (struct cdns_dsi *dsi) {struct cdns_dsi_output *output = &dsi->output;u32 status;
@@ -1026,6 +1033,14 @@ static ssize_t cdns_dsi_transfer(struct mipi_dsi_host *host,cdns_dsi_init_link (dsi); +/* +* on Jh7110 soc , when transfer dsi command , +* cdns_dsi_hs_init is needed. +* or the final ret will be error value. +*/ +if (dsi->platform_ops && dsi->platform_ops->transfer) + dsi->platform_ops->transfer (dsi); + ret =mipi_dsi_create_packet (&packet, msg);if (ret) goto out;
@@ -1142,6 +1157,9 @@ static int __maybe_unused cdns_dsi_resume(struct device *dev)clk_prepare_enable (dsi->dsi_p_clk);clk_prepare_enable (dsi->dsi_sys_clk); +if (dsi->platform_ops && dsi->platform_ops->resume) + dsi->platform_ops->resume (dsi); +return 0 ; }
@@ -1152,6 +1170,10 @@ static int __maybe_unused cdns_dsi_suspend(struct device *dev)clk_disable_unprepare (dsi->dsi_sys_clk);clk_disable_unprepare (dsi->dsi_p_clk);reset_control_assert (dsi->dsi_p_rst); + +if (dsi->platform_ops && dsi->platform_ops->suspend) + dsi->platform_ops->suspend (dsi); + dsi->link_initialized = false;return 0 ; }
@@ -1294,6 +1316,10 @@ static const struct of_device_id cdns_dsi_of_match[] = { #ifdef CONFIG_DRM_CDNS_DSI_J721E { .compatible = "ti,j721e-dsi", .data = &dsi_ti_j721e_ops, }, #endif +#ifdef CONFIG_DRM_CDNS_DSI_JH7110 + { .compatible = "starfive,cdns-dsi", .data = &dsi_ti_jh7110_ops, }, +#endif + { }, }; MODULE_DEVICE_TABLE(of, cdns_dsi_of_match);
drivers/gpu/drm/bridge/cadence/cdns-dsi-core.h +19 -0
@@ -53,12 +53,20 @@ struct cdns_dsi;* @deinit: Called in the CDNS DSI remove * @enable: Called at the beginning of CDNS DSI bridge enable * @disable: Called at the end of CDNS DSI bridge disable +* @resume: Called at the resume of CDNS DSI +* @suspend: Called at the suspend of CDNS DSI +* @update: Called at the middle of CDNS DSI bridge enable */ struct cdns_dsi_platform_ops {int (*init)(struct cdns_dsi *dsi);void (*deinit)(struct cdns_dsi *dsi);void (*enable)(struct cdns_dsi *dsi);void (*disable)(struct cdns_dsi *dsi); +void (*resume)(struct cdns_dsi *dsi); +void (*suspend)(struct cdns_dsi *dsi); +void (*update)(struct cdns_dsi *dsi,struct cdns_dsi_cfg *dsi_cfg, +const struct drm_display_mode *mode); +void (*transfer)(struct cdns_dsi *dsi); };struct cdns_dsi {
@@ -79,6 +87,17 @@ struct cdns_dsi {bool link_initialized;bool phy_initialized;struct phy *dphy; + +#ifdef CONFIG_DRM_CDNS_DSI_JH7110 +struct clk *apb_clk; +struct clk *txesc_clk; +struct reset_control *dpi_rst; +struct reset_control *apb_rst; +struct reset_control *txesc_rst; +struct reset_control *txbytehs_rst; +#endif }; +void cdns_dsi_hs_init (struct cdns_dsi *dsi); +#endif /* !__CDNS_DSI_H__ */
drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110.c new file +386 -0
386 lines not on this page · raw message
drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110.h new file +186 -0
186 lines not on this page · raw message
Signature · 1 line
2.17.1