Skip to contentSkip to conversation

Add Display support for AM43xx

PATCH New Sathya Prakash M R 6 participants 20 messages Mar 13, 2014 – Mar 14, 2014

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

v2 cover Add Display support for AM43xx

This patch series adds DSS support to the AM43x. The DPI LCD panel is supported on both am43x-epos-evm and am437x-gp-evm. The LCD panel is from OSD model: OSD057T0559-34TS

Version 1 of this series can be found below[1]:
[1]: https://patchwork.kernel.org/patch/3274421/

Tested on am43x-epos-evm and am437x-gp-evm.

Dependent patches :
Sourav patches adding device nodes for epos [2] and gp [3] evm [2]: https://patchwork.kernel.org/patch/3246701/
[3]: https://patchwork.kernel.org/patch/3246751/

AM43xx has a dedicated display pll. Hence tomi patch improving func clock handling is needed [4]
[4]: https://patchwork.kernel.org/patch/3196221/

Tomi patch adding DT support to DSS [5]
[5]: https://patchwork.kernel.org/patch/3516341/

Changes from V1:
Rebased to latest DSS DT changes from Tomi which is under review [5]

Sathya Prakash M R (3):
OMAPDSS: Add DSS features for AM43xx
ARM: OMAP2+: AM43xx DSS Hwmod
ARM: DTS: AM43x: Add DSS node

Tomi Valkeinen (1):
ARM: AM43xx: fix dpll init in bypass mode

 arch/arm/boot/dts/am4372.dtsi              |   28 ++++++++
 arch/arm/boot/dts/am437x-gp-evm.dts        |   77 ++++++++++++++++++++
 arch/arm/boot/dts/am43x-epos-evm.dts       |   73 +++++++++++++++++++
 arch/arm/boot/dts/am43xx-clocks.dtsi       |    2 +
 arch/arm/mach-omap2/clkt_dpll.c            |    4 +-
 arch/arm/mach-omap2/display.c              |    2 +
 arch/arm/mach-omap2/omap_hwmod_43xx_data.c |  104 ++++++++++++++++++++++++++++
 arch/arm/mach-omap2/prcm43xx.h             |    1 +
 drivers/video/omap2/dss/dispc.c            |    1 +
 drivers/video/omap2/dss/dpi.c              |    2 +
 drivers/video/omap2/dss/dsi.c              |    1 +
 drivers/video/omap2/dss/dss.c              |   11 +++
 drivers/video/omap2/dss/dss_features.c     |   67 ++++++++++++++++++
 include/video/omapdss.h                    |    1 +
 14 files changed, 372 insertions(+), 2 deletions(-)
Signature · 6 lines
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw

PATCH v2 1/4 OMAPDSS: Add DSS features for AM43xx

Add DSS features for AM43xx.

---
 arch/arm/mach-omap2/display.c          |    2 +
 drivers/video/omap2/dss/dispc.c        |    1 +
 drivers/video/omap2/dss/dpi.c          |    2 +
 drivers/video/omap2/dss/dsi.c          |    1 +
 drivers/video/omap2/dss/dss.c          |   11 ++++++
 drivers/video/omap2/dss/dss_features.c |   67 ++++++++++++++++++++++++++++++++
 include/video/omapdss.h                |    1 +
 7 files changed, 85 insertions(+)
arch/arm/mach-omap2/display.c +2 -0
index a4e536b..d1cac1c 100644
@@ -316,6 +316,8 @@ static enum omapdss_version __init omap_display_get_version(void)
 		return OMAPDSS_VER_OMAP4;
 	else if (soc_is_omap54xx())
 		return OMAPDSS_VER_OMAP5;
+	else if (soc_is_am43xx())
+		return OMAPDSS_VER_AM43xx;
 	else
 		return OMAPDSS_VER_UNKNOWN;
 }
drivers/video/omap2/dss/dispc.c +1 -0
index 4ec59ca..1b4aed5 100644
@@ -3622,6 +3622,7 @@ static int __init dispc_init_features(struct platform_device *pdev)
 	case OMAPDSS_VER_OMAP34xx_ES3:
 	case OMAPDSS_VER_OMAP3630:
 	case OMAPDSS_VER_AM35xx:
+	case OMAPDSS_VER_AM43xx:
 		src = &omap34xx_rev3_0_dispc_feats;
 		break;
 
drivers/video/omap2/dss/dpi.c +2 -0
index bd48cde..7ee7f86 100644
@@ -64,6 +64,7 @@ static struct platform_device *dpi_get_dsidev(enum omap_channel channel)
 	case OMAPDSS_VER_OMAP34xx_ES3:
 	case OMAPDSS_VER_OMAP3630:
 	case OMAPDSS_VER_AM35xx:
+	case OMAPDSS_VER_AM43xx:
 		return NULL;
 
 	case OMAPDSS_VER_OMAP4430_ES1:
@@ -593,6 +594,7 @@ static enum omap_channel dpi_get_channel(void)
 	case OMAPDSS_VER_OMAP34xx_ES3:
 	case OMAPDSS_VER_OMAP3630:
 	case OMAPDSS_VER_AM35xx:
+	case OMAPDSS_VER_AM43xx:
 		return OMAP_DSS_CHANNEL_LCD;
 
 	case OMAPDSS_VER_OMAP4430_ES1:
drivers/video/omap2/dss/dsi.c +1 -0
index 6056b27..d68b49b 100644
@@ -5082,6 +5082,7 @@ static enum omap_channel dsi_get_channel(int module_id)
 {
 	switch (omapdss_get_version()) {
 	case OMAPDSS_VER_OMAP24xx:
+	case OMAPDSS_VER_AM43xx:
 		DSSWARN("DSI not supported\n");
 		return OMAP_DSS_CHANNEL_LCD;
 
drivers/video/omap2/dss/dss.c +11 -0
index bd01608..0b60746 100644
@@ -795,6 +795,13 @@ static const struct dss_features omap54xx_dss_feats __initconst = {
 	.dpi_select_source	=	&dss_dpi_select_source_omap5,
 };
 
+static const struct dss_features am43xx_dss_feats __initconst = {
+	.fck_div_max		=	0,
+	.dss_fck_multiplier	=	0,
+	.parent_clk_name	=	NULL,
+	.dpi_select_source	=	&dss_dpi_select_source_omap2_omap3,
+};
+
 static int __init dss_init_features(struct platform_device *pdev)
 {
 	const struct dss_features *src;
@@ -831,6 +838,10 @@ static int __init dss_init_features(struct platform_device *pdev)
 		src = &omap54xx_dss_feats;
 		break;
 
+	case OMAPDSS_VER_AM43xx:
+		src = &am43xx_dss_feats;
+		break;
+
 	default:
 		return -ENODEV;
 	}
drivers/video/omap2/dss/dss_features.c +67 -0

109 lines not on this page · raw message

include/video/omapdss.h +1 -0
index 3d7c51a..7513146 100644
@@ -319,6 +319,7 @@ enum omapdss_version {
 	OMAPDSS_VER_OMAP4430_ES2,	/* OMAP4430 ES2.0, 2.1, 2.2 */
 	OMAPDSS_VER_OMAP4,		/* All other OMAP4s */
 	OMAPDSS_VER_OMAP5,
+	OMAPDSS_VER_AM43xx,
 };
 
 /* Board specific data */
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v2 2/4 ARM: AM43xx: fix dpll init in bypass mode

In reply to Sathya Prakash M R

From: Tomi Valkeinen <[email protected]>

On AM43xx, if a PLL is in bypass at kernel init, the code in omap2_get_dpll_rate() will not realize this and will try to calculate the clock rate using the multiplier and the divider, resulting in errors.

omap2_init_dpll_parent() has similar issue.

Add the missing soc_is_am43xx() check to make the code work on AM43xx.

---
 arch/arm/mach-omap2/clkt_dpll.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/clkt_dpll.c +2 -2
index 924c230..14e9e45 100644
@@ -209,7 +209,7 @@ u8 omap2_init_dpll_parent(struct clk_hw *hw)
 		if (v == OMAP3XXX_EN_DPLL_LPBYPASS ||
 		    v == OMAP3XXX_EN_DPLL_FRBYPASS)
 			return 1;
-	} else if (soc_is_am33xx() || cpu_is_omap44xx()) {
+	} else if (soc_is_am33xx() || cpu_is_omap44xx() || soc_is_am43xx()) {
 		if (v == OMAP4XXX_EN_DPLL_LPBYPASS ||
 		    v == OMAP4XXX_EN_DPLL_FRBYPASS ||
 		    v == OMAP4XXX_EN_DPLL_MNBYPASS)
@@ -255,7 +255,7 @@ unsigned long omap2_get_dpll_rate(struct clk_hw_omap *clk)
 		if (v == OMAP3XXX_EN_DPLL_LPBYPASS ||
 		    v == OMAP3XXX_EN_DPLL_FRBYPASS)
 			return __clk_get_rate(dd->clk_bypass);
-	} else if (soc_is_am33xx() || cpu_is_omap44xx()) {
+	} else if (soc_is_am33xx() || cpu_is_omap44xx() || soc_is_am43xx()) {
 		if (v == OMAP4XXX_EN_DPLL_LPBYPASS ||
 		    v == OMAP4XXX_EN_DPLL_FRBYPASS ||
 		    v == OMAP4XXX_EN_DPLL_MNBYPASS)
Signature · 1 line
1.7.9.5
#3 lore raw

Re: [PATCH v2 2/4] ARM: AM43xx: fix dpll init in bypass mode

Quoted 7 lines · Sathya Prakash M R

From: Tomi Valkeinen <[email protected]>

On AM43xx, if a PLL is in bypass at kernel init, the code in omap2_get_dpll_rate() will not realize this and will try to calculate the clock rate using the multiplier and the divider, resulting in errors.

Quoted 5 lines

omap2_init_dpll_parent() has similar issue.

Add the missing soc_is_am43xx() check to make the code work on AM43xx.

I see you sent this already in December, and Paul asked for your signed-off for it, but you never replied.

Tomi

#4 lore raw

Re: [PATCH v2 2/4] ARM: AM43xx: fix dpll init in bypass mode

Quoted 8 lines · Tomi Valkeinen
Quoted 7 lines · Sathya Prakash M R

From: Tomi Valkeinen <[email protected]>

On AM43xx, if a PLL is in bypass at kernel init, the code in omap2_get_dpll_rate() will not realize this and will try to calculate the clock rate using the multiplier and the divider, resulting in errors.

Quoted 7 lines
Quoted 5 lines

omap2_init_dpll_parent() has similar issue.

Add the missing soc_is_am43xx() check to make the code work on AM43xx.

I see you sent this already in December, and Paul asked for your signed-off for it, but you never replied.

just saw. Maybe i missed it during december vacation. Will update it in v3 alongwith other changes you suggested.

Quoted 3 lines

Tomi

Sathya

#5 lore raw

PATCH v2 3/4 ARM: OMAP2+: AM43xx DSS Hwmod

In reply to Sathya Prakash M R

Add DSS hwmod structs for AM43xx.

---
 arch/arm/mach-omap2/omap_hwmod_43xx_data.c |  104 ++++++++++++++++++++++++++++
 arch/arm/mach-omap2/prcm43xx.h             |    1 +
 2 files changed, 105 insertions(+)
arch/arm/mach-omap2/omap_hwmod_43xx_data.c +104 -0
index 9002fca..6a121db 100644
@@ -19,6 +19,8 @@
 #include "omap_hwmod.h"
 #include "omap_hwmod_33xx_43xx_common_data.h"
 #include "prcm43xx.h"
+#include "omap_hwmod_common_data.h"
+
 
 /* IP blocks */
 static struct omap_hwmod am43xx_l4_hs_hwmod = {
@@ -415,6 +417,76 @@ static struct omap_hwmod am43xx_qspi_hwmod = {
 	},
 };
 
+/* Display sub system - DSS */
+
+static struct omap_hwmod_dma_info am43xx_dss_sdma_chs[] = {
+	{ .name = "dispc", .dma_req = 5 },
+	{ .dma_req = -1 },
+};
+
+struct omap_dss_dispc_dev_attr am43xx_dss_dispc_dev_attr = {
+	.manager_count		= 1,
+	.has_framedonetv_irq	= 0
+};
+
+
+static struct omap_hwmod_class_sysconfig am43xx_dispc_sysc = {
+	.rev_offs	= 0x0000,
+	.sysc_offs	= 0x0010,
+	.syss_offs	= 0x0014,
+	.sysc_flags	= (SYSC_HAS_SIDLEMODE | SYSC_HAS_MIDLEMODE),
+	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+	.sysc_fields	= &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class am43xx_dispc_hwmod_class = {
+	.name	= "dispc",
+	.sysc	= &am43xx_dispc_sysc,
+};
+
+static struct omap_hwmod am43xx_dss_core_hwmod = {
+	.name		= "dss_core",
+	.class		= &omap2_dss_hwmod_class,
+	.clkdm_name	= "dss_clkdm",
+	.main_clk	= "disp_clk",
+	.sdma_reqs	= am43xx_dss_sdma_chs,
+	.prcm = {
+		.omap4 = {
+			.clkctrl_offs = AM43XX_CM_PER_DSS_CLKCTRL_OFFSET,
+			.modulemode   = MODULEMODE_SWCTRL,
+		},
+	},
+};
+
+/* display controller -dispc*/
+
+static struct omap_hwmod am43xx_dss_dispc_hwmod = {
+	.name		= "dss_dispc",
+	.class		= &am43xx_dispc_hwmod_class,
+	.clkdm_name	= "dss_clkdm",
+	.main_clk	= "disp_clk",
+	.prcm = {
+		.omap4 = {
+			.clkctrl_offs = AM43XX_CM_PER_DSS_CLKCTRL_OFFSET,
+		},
+	},
+	.dev_attr	= &am43xx_dss_dispc_dev_attr,
+};
+
+/*RFBI*/
+
+static struct omap_hwmod am43xx_dss_rfbi_hwmod = {
+	.name		= "dss_rfbi",
+	.class		= &omap2_rfbi_hwmod_class,
+	.clkdm_name	= "dss_clkdm",
+	.main_clk	= "disp_clk",
+	.prcm = {
+		.omap4 = {
+			.clkctrl_offs = AM43XX_CM_PER_DSS_CLKCTRL_OFFSET,
+		},
+	},
+};
+
 /* Interfaces */
 static struct omap_hwmod_ocp_if am43xx_l3_main__l4_hs = {
 	.master		= &am33xx_l3_main_hwmod,
@@ -654,6 +726,34 @@ static struct omap_hwmod_ocp_if am43xx_l3_s__qspi = {
 	.user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+static struct omap_hwmod_ocp_if am43xx_dss__l3_main = {
+	.master		= &am43xx_dss_core_hwmod,
+	.slave		= &am33xx_l3_main_hwmod,
+	.clk		= "disp_clk",
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+static struct omap_hwmod_ocp_if am43xx_l4_ls__dss = {
+	.master		= &am33xx_l4_ls_hwmod,
+	.slave		= &am43xx_dss_core_hwmod,
+	.clk		= "l4ls_gclk",
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+static struct omap_hwmod_ocp_if am43xx_l4_ls__dss_dispc = {
+	.master		= &am33xx_l4_ls_hwmod,
+	.slave		= &am43xx_dss_dispc_hwmod,
+	.clk		= "l4ls_gclk",
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+static struct omap_hwmod_ocp_if am43xx_l4_ls__dss_rfbi = {
+	.master		= &am33xx_l4_ls_hwmod,
+	.slave		= &am43xx_dss_rfbi_hwmod,
+	.clk		= "l4ls_gclk",
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
 static struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = {
 	&am33xx_l4_wkup__synctimer,
 	&am43xx_l4_ls__timer8,
@@ -747,6 +847,10 @@ static struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = {
 	&am43xx_l4_ls__ocp2scp1,
 	&am43xx_l3_s__usbotgss0,
 	&am43xx_l3_s__usbotgss1,
+	&am43xx_dss__l3_main,
+	&am43xx_l4_ls__dss,
+	&am43xx_l4_ls__dss_dispc,
+	&am43xx_l4_ls__dss_rfbi,
 	NULL,
 };
 
arch/arm/mach-omap2/prcm43xx.h +1 -0
index 7785be9..ad7b3e9 100644
@@ -142,5 +142,6 @@
 #define AM43XX_CM_PER_USBPHYOCP2SCP0_CLKCTRL_OFFSET	0x05B8
 #define AM43XX_CM_PER_USB_OTG_SS1_CLKCTRL_OFFSET        0x0268
 #define AM43XX_CM_PER_USBPHYOCP2SCP1_CLKCTRL_OFFSET	0x05C0
+#define AM43XX_CM_PER_DSS_CLKCTRL_OFFSET		0x0a20
 
 #endif
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH v2 4/4 ARM: DTS: AM43x: Add DSS node

In reply to Sathya Prakash M R

Add device node for DSS module for AM4372. Both the AM437x-Gp evm and Am43x-Epos evm use the same LCD panel. The lcd timings are added in respective dts files. Adds display pinctrl and enables required gpio. Also set the right parent clock to the DSS clock.

---
 arch/arm/boot/dts/am4372.dtsi        |   28 +++++++++++++
 arch/arm/boot/dts/am437x-gp-evm.dts  |   77 ++++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/am43x-epos-evm.dts |   73 ++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/am43xx-clocks.dtsi |    2 +
 4 files changed, 180 insertions(+)
arch/arm/boot/dts/am4372.dtsi +28 -0
index ea55a4e..b72a7df 100644
@@ -684,6 +684,34 @@
 			num-cs = <4>;
                         status = "disabled";
                 };
+
+		dss: dss@4832A000 {
+			compatible = "ti,omap3-dss", "simple-bus";
+			reg = <0x4832A000 0x200>;
+			ti,hwmods = "dss_core";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges;
+
+			dispc@4832A400 {
+				compatible = "ti,omap3-dispc";
+				reg = <0x4832A400 0x400>;
+				interrupts = <GIC_SPI 127 IRQ_TYPE_LEVEL_HIGH>;
+				ti,hwmods = "dss_dispc";
+			};
+
+			dpi: encoder@0 {
+				compatible = "ti,omap3-dpi";
+			};
+
+			rfbi: rfbi@4832A800 {
+				compatible = "ti,omap3-rfbi";
+			reg = <0x4832A800 0x100>;
+				ti,hwmods = "dss_rfbi";
+			};
+
+		};
+
 	};
 
 	clocks {
arch/arm/boot/dts/am437x-gp-evm.dts +77 -0

92 lines not on this page · raw message

arch/arm/boot/dts/am43x-epos-evm.dts +73 -0

88 lines not on this page · raw message

arch/arm/boot/dts/am43xx-clocks.dtsi +2 -0
index 85e7d4b..b20e192 100644
@@ -512,6 +512,8 @@ disp_clk: disp_clk@44df4244 {
 	compatible = "ti,mux-clock";
 	clocks = <&dpll_disp_m2_ck>, <&dpll_core_m5_ck>, <&dpll_per_m2_ck>;
 	reg = <0x44df4244 0x4>;
+	bit-mask = <0x3>;
+	set-rate-parent;
 };
 
 dpll_extdev_ck: dpll_extdev_ck@44df2e60 {
Signature · 1 line
1.7.9.5
#7 lore raw

Re: [PATCH v2 4/4] ARM: DTS: AM43x: Add DSS node

Quoted 40 lines · Sathya Prakash M R

Add device node for DSS module for AM4372. Both the AM437x-Gp evm and Am43x-Epos evm use the same LCD panel. The lcd timings are added in respective dts files. Adds display pinctrl and enables required gpio. Also set the right parent clock to the DSS clock.

---
 arch/arm/boot/dts/am4372.dtsi        |   28 +++++++++++++
 arch/arm/boot/dts/am437x-gp-evm.dts  |   77 ++++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/am43x-epos-evm.dts |   73 ++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/am43xx-clocks.dtsi |    2 +
 4 files changed, 180 insertions(+)
arch/arm/boot/dts/am4372.dtsi +18 -0
index ea55a4e..b72a7df 100644
@@ -684,6 +684,34 @@
 			num-cs = <4>;
                         status = "disabled";
                 };
+
+		dss: dss@4832A000 {
+			compatible = "ti,omap3-dss", "simple-bus";
+			reg = <0x4832A000 0x200>;
+			ti,hwmods = "dss_core";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges;
+
+			dispc@4832A400 {
+				compatible = "ti,omap3-dispc";
+				reg = <0x4832A400 0x400>;
+				interrupts = <GIC_SPI 127 IRQ_TYPE_LEVEL_HIGH>;
+				ti,hwmods = "dss_dispc";
+			};
+
+			dpi: encoder@0 {
+				compatible = "ti,omap3-dpi";

arch/arm/boot/dts/am4372.dtsi line 714

Quoted 10 lines
arch/arm/boot/dts/am4372.dtsi +10 -0
+			};
+
+			rfbi: rfbi@4832A800 {
+				compatible = "ti,omap3-rfbi";
+			reg = <0x4832A800 0x100>;
+				ti,hwmods = "dss_rfbi";
+			};
+
+		};
+

This seems to be based on old version of the DSS DT. Please rebase this on top of the latest one:

git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux.git work/dss-dt

You also need to split this into smaller pieces: the dts clock fix, the am4372.dtsi, and the board changes.

Tomi

#8 lore raw

Re: [PATCH v2 4/4] ARM: DTS: AM43x: Add DSS node

Quoted 54 lines · Tomi Valkeinen
Quoted 40 lines · Sathya Prakash M R

Add device node for DSS module for AM4372. Both the AM437x-Gp evm and Am43x-Epos evm use the same LCD panel. The lcd timings are added in respective dts files. Adds display pinctrl and enables required gpio. Also set the right parent clock to the DSS clock.

---
  arch/arm/boot/dts/am4372.dtsi        |   28 +++++++++++++
  arch/arm/boot/dts/am437x-gp-evm.dts  |   77 ++++++++++++++++++++++++++++++++++
  arch/arm/boot/dts/am43x-epos-evm.dts |   73 ++++++++++++++++++++++++++++++++
  arch/arm/boot/dts/am43xx-clocks.dtsi |    2 +
  4 files changed, 180 insertions(+)
arch/arm/boot/dts/am4372.dtsi +18 -0
index ea55a4e..b72a7df 100644
@@ -684,6 +684,34 @@
  			num-cs = <4>;
                          status = "disabled";
                  };
+
+		dss: dss@4832A000 {
+			compatible = "ti,omap3-dss", "simple-bus";
+			reg = <0x4832A000 0x200>;
+			ti,hwmods = "dss_core";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges;
+
+			dispc@4832A400 {
+				compatible = "ti,omap3-dispc";
+				reg = <0x4832A400 0x400>;
+				interrupts = <GIC_SPI 127 IRQ_TYPE_LEVEL_HIGH>;
+				ti,hwmods = "dss_dispc";
+			};
+
+			dpi: encoder@0 {
+				compatible = "ti,omap3-dpi";

arch/arm/boot/dts/am4372.dtsi line 714

Quoted 10 lines
arch/arm/boot/dts/am4372.dtsi +10 -0
+			};
+
+			rfbi: rfbi@4832A800 {
+				compatible = "ti,omap3-rfbi";
+			reg = <0x4832A800 0x100>;
+				ti,hwmods = "dss_rfbi";
+			};
+
+		};
+

This seems to be based on old version of the DSS DT. Please rebase this on top of the latest one:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux.git work/dss-dt

Thanks. maybe i missed couple of changes. Will do that.

Quoted 3 lines

You also need to split this into smaller pieces: the dts clock fix, the am4372.dtsi, and the board changes.

ok sure.

Quoted 4 lines

Tomi

#9 lore raw

Re: [PATCH v2 4/4] ARM: DTS: AM43x: Add DSS node

In reply to Sathya Prakash M R
Quoted 19 lines · Sathya Prakash M R

Add device node for DSS module for AM4372. Both the AM437x-Gp evm and Am43x-Epos evm use the same LCD panel. The lcd timings are added in respective dts files. Adds display pinctrl and enables required gpio. Also set the right parent clock to the DSS clock.

---
 arch/arm/boot/dts/am4372.dtsi        |   28 +++++++++++++
 arch/arm/boot/dts/am437x-gp-evm.dts  |   77 ++++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/am43x-epos-evm.dts |   73 ++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/am43xx-clocks.dtsi |    2 +
 4 files changed, 180 insertions(+)
arch/arm/boot/dts/am4372.dtsi +0 -0
index ea55a4e..b72a7df 100644

arch/arm/boot/dts/am4372.dtsi line 689

Quoted 6 lines
arch/arm/boot/dts/am4372.dtsi +3 -0
@@ -684,6 +684,34 @@
 			num-cs = <4>;
                         status = "disabled";
                 };
+
+		dss: dss@4832A000 {
+			compatible = "ti,omap3-dss", "simple-bus";

This doesn't look right to me. I'm not sure it makes sense for "simple-bus" to be in the compatible list.

Are the child nodes usable in isolation, or are they dependent on the "ti,omap3-dss" node? What exactly does the "ti,omap3-dss" node represent?

Thanks,
Mark.

Quoted 26 lines
arch/arm/boot/dts/am4372.dtsi +25 -0
+			reg = <0x4832A000 0x200>;
+			ti,hwmods = "dss_core";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges;
+
+			dispc@4832A400 {
+				compatible = "ti,omap3-dispc";
+				reg = <0x4832A400 0x400>;
+				interrupts = <GIC_SPI 127 IRQ_TYPE_LEVEL_HIGH>;
+				ti,hwmods = "dss_dispc";
+			};
+
+			dpi: encoder@0 {
+				compatible = "ti,omap3-dpi";
+			};
+
+			rfbi: rfbi@4832A800 {
+				compatible = "ti,omap3-rfbi";
+			reg = <0x4832A800 0x100>;
+				ti,hwmods = "dss_rfbi";
+			};
+
+		};
+
 	};
#10 lore raw

Re: [PATCH v2 4/4] ARM: DTS: AM43x: Add DSS node

Quoted 30 lines · Mark Rutland
Quoted 19 lines · Sathya Prakash M R

Add device node for DSS module for AM4372. Both the AM437x-Gp evm and Am43x-Epos evm use the same LCD panel. The lcd timings are added in respective dts files. Adds display pinctrl and enables required gpio. Also set the right parent clock to the DSS clock.

---
 arch/arm/boot/dts/am4372.dtsi        |   28 +++++++++++++
 arch/arm/boot/dts/am437x-gp-evm.dts  |   77 ++++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/am43x-epos-evm.dts |   73 ++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/am43xx-clocks.dtsi |    2 +
 4 files changed, 180 insertions(+)
arch/arm/boot/dts/am4372.dtsi +0 -0
index ea55a4e..b72a7df 100644

arch/arm/boot/dts/am4372.dtsi line 689

Quoted 6 lines
arch/arm/boot/dts/am4372.dtsi +3 -0
@@ -684,6 +684,34 @@
 			num-cs = <4>;
                         status = "disabled";
                 };
+
+		dss: dss@4832A000 {
+			compatible = "ti,omap3-dss", "simple-bus";

This doesn't look right to me. I'm not sure it makes sense for "simple-bus" to be in the compatible list.

Quoted 3 lines

Are the child nodes usable in isolation, or are they dependent on the "ti,omap3-dss" node? What exactly does the "ti,omap3-dss" node represent?

The child nodes are dependent on the dss node.

The "ti,omap3-dss" represents the dss_core block of the OMAP display subsystem. The dss_core is a small IP, a wrapper for the submodules, handling things like clock and video path routing between the submodules and the OMAP's other components (like the PRCM where we get clocks). It also handles reset, so when dss_core is reset, all the submodules are reset.

The HW design is a bit odd, in my opinion, as the submodules are proper IP blocks, and as far as I see, they could be designed to be independent of each others. But they have not been designed so.

Having dss_core as the parent node for the submodules gives us automatic runtime-pm handling, so when one submodule is enabled, it forces dss_core to be enabled first. This makes the reset work right (i.e. we don't accidentally reset dss_core when one of the submodules is in use), and, as the dss_core is always needed to setup the clock and video path routing, it gets properly initialized before any of the submodules will use it.

What "simple-bus" mostly gives us here is automatic creation of the platform devices for the submodules. We could also create the devices for submodules in the driver of the dss_core. I did have that at some point, but the "simple-bus" does identical job, and it seemed to make sense to me.

Note that the same method is used for omap2/3/4 also, in the patches that have been going around for some time in the lists.

Tomi

#11 lore raw

Re: [PATCH v2 4/4] ARM: DTS: AM43x: Add DSS node

Quoted 31 lines · Tomi Valkeinen
Quoted 30 lines · Mark Rutland
Quoted 19 lines · Sathya Prakash M R

Add device node for DSS module for AM4372. Both the AM437x-Gp evm and Am43x-Epos evm use the same LCD panel. The lcd timings are added in respective dts files. Adds display pinctrl and enables required gpio. Also set the right parent clock to the DSS clock.

---
 arch/arm/boot/dts/am4372.dtsi        |   28 +++++++++++++
 arch/arm/boot/dts/am437x-gp-evm.dts  |   77 ++++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/am43x-epos-evm.dts |   73 ++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/am43xx-clocks.dtsi |    2 +
 4 files changed, 180 insertions(+)
arch/arm/boot/dts/am4372.dtsi +0 -0
index ea55a4e..b72a7df 100644

arch/arm/boot/dts/am4372.dtsi line 689

Quoted 6 lines
arch/arm/boot/dts/am4372.dtsi +3 -0
@@ -684,6 +684,34 @@
 			num-cs = <4>;
                         status = "disabled";
                 };
+
+		dss: dss@4832A000 {
+			compatible = "ti,omap3-dss", "simple-bus";

This doesn't look right to me. I'm not sure it makes sense for "simple-bus" to be in the compatible list.

Quoted 5 lines
Quoted 3 lines

Are the child nodes usable in isolation, or are they dependent on the "ti,omap3-dss" node? What exactly does the "ti,omap3-dss" node represent?

The child nodes are dependent on the dss node.

Ok. Then simple-bus is not appropriate, as the dss node cannot be ignored for the children to function.

Quoted 19 lines

The "ti,omap3-dss" represents the dss_core block of the OMAP display subsystem. The dss_core is a small IP, a wrapper for the submodules, handling things like clock and video path routing between the submodules and the OMAP's other components (like the PRCM where we get clocks). It also handles reset, so when dss_core is reset, all the submodules are reset.

The HW design is a bit odd, in my opinion, as the submodules are proper IP blocks, and as far as I see, they could be designed to be independent of each others. But they have not been designed so.

Having dss_core as the parent node for the submodules gives us automatic runtime-pm handling, so when one submodule is enabled, it forces dss_core to be enabled first. This makes the reset work right (i.e. we don't accidentally reset dss_core when one of the submodules is in use), and, as the dss_core is always needed to setup the clock and video path routing, it gets properly initialized before any of the submodules will use it.

Quoted 5 lines

What "simple-bus" mostly gives us here is automatic creation of the platform devices for the submodules. We could also create the devices for submodules in the driver of the dss_core. I did have that at some point, but the "simple-bus" does identical job, and it seemed to make sense to me.

The "simple-bus" compatible string is intended for busses which are transparent (bar some address remapping expressed via ranges), and is not intended as an annotation to get Linux to probe child nodes.

Any node with a "simple-bus" entry in the compatible list should either be handled as a transparent bus, or optionally as the more specific bus it claims to be (where some hardware configuration may be required before children can be probed). Unfortunately Linux probes chidlren regardless, which is arguable a Linux bug.

There's no reason to leak this issue into dts files. Please remove the "simple-bus" string, and get the dss driver to probe children as required -- as described above the dss node never makes sense as a simple-bus.

Quoted 3 lines

Note that the same method is used for omap2/3/4 also, in the patches that have been going around for some time in the lists.

And those should be fixed.

Cheers,
Mark.

#12 lore raw

Re: [PATCH v2 4/4] ARM: DTS: AM43x: Add DSS node

Quoted 10 lines · Mark Rutland

The "simple-bus" compatible string is intended for busses which are transparent (bar some address remapping expressed via ranges), and is not intended as an annotation to get Linux to probe child nodes.

Any node with a "simple-bus" entry in the compatible list should either be handled as a transparent bus, or optionally as the more specific bus it claims to be (where some hardware configuration may be required before children can be probed). Unfortunately Linux probes chidlren regardless, which is arguable a Linux bug.

Quoted 4 lines

There's no reason to leak this issue into dts files. Please remove the "simple-bus" string, and get the dss driver to probe children as required -- as described above the dss node never makes sense as a simple-bus.

Ok. I'll remove the simple-bus, and make the dss_core register the devices. I presume of_platform_populate() is fine for this? Seems to work fine for registration, but I haven't figured out yet how to unregister the devices (I get a crash in platform_device_del() if I just call platform_device_unregister for the submodules).

Tomi

#13 lore raw

Re: [PATCH v2 4/4] ARM: DTS: AM43x: Add DSS node

Quoted 17 lines · Tomi Valkeinen
Quoted 10 lines · Mark Rutland

The "simple-bus" compatible string is intended for busses which are transparent (bar some address remapping expressed via ranges), and is not intended as an annotation to get Linux to probe child nodes.

Any node with a "simple-bus" entry in the compatible list should either be handled as a transparent bus, or optionally as the more specific bus it claims to be (where some hardware configuration may be required before children can be probed). Unfortunately Linux probes chidlren regardless, which is arguable a Linux bug.

Quoted 4 lines

There's no reason to leak this issue into dts files. Please remove the "simple-bus" string, and get the dss driver to probe children as required -- as described above the dss node never makes sense as a simple-bus.

Quoted 5 lines

Ok. I'll remove the simple-bus, and make the dss_core register the devices. I presume of_platform_populate() is fine for this? Seems to work fine for registration, but I haven't figured out yet how to unregister the devices (I get a crash in platform_device_del() if I just call platform_device_unregister for the submodules).

I think of_platform_populate should be ok. It's not fantastic -- all child nodes will be probed, regardless of whether you expect them to exist, but it's not as broken as using "simple-bus".

I'm unfortunately not familiar with how unregistration works.

I can't see anything obviously wrong in platform_device_del. Do you have a backtrace?

Thanks,
Mark.

#14 lore raw

Re: [PATCH v2 4/4] ARM: DTS: AM43x: Add DSS node

Quoted 2 lines · Mark Rutland

I can't see anything obviously wrong in platform_device_del. Do you have a backtrace?

Yes, below.

I can see at least drivers/usb/dwc3/dwc3-exynos.c doing the exact same thing I do, so maybe I've got something wrong with the omapdss driver.

Tomi

[   62.987335] Unable to handle kernel NULL pointer dereference at virtual address 00000018
[   62.995910] pgd = eb6b8000
[   62.998779] [00000018] *pgd=aa127831, *pte=00000000, *ppte=00000000
[   63.005462] Internal error: Oops: 17 [#1] SMP ARM
[   63.005462] Modules linked in: omapdss(-) [last unloaded: encoder_tfp410]
[   63.011779] CPU: 1 PID: 1021 Comm: rmmod Not tainted 3.14.0-rc2-00057-gacd3401a1fea-dirty #69
[   63.025909] task: eb17a040 ti: ea14e000 task.ti: ea14e000
[   63.032287] PC is at release_resource+0x1c/0x84
[   63.032287] LR is at _raw_write_lock+0x50/0x58
[   63.041748] pc : [<c004adc8>]    lr : [<c05bbd5c>]    psr: 60000113
[   63.041748] sp : ea14fde0  ip : ea14fdb8  fp : ea14fdf4
[   63.053833] r10: 00000000  r9 : ea14e000  r8 : c000f704
[   63.053833] r7 : 00000081  r6 : bf0004fc  r5 : eb714400  r4 : eb6a9600
[   63.061798] r3 : 00000000  r2 : 00000001  r1 : 00000011  r0 : c08cec3c
[   63.071746] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[   63.071746] Control: 10c53c7d  Table: ab6b804a  DAC: 00000015
[   63.081787] Process rmmod (pid: 1021, stack limit = 0xea14e248)
[   63.091735] Stack: (0xea14fde0 to 0xea150000)
[   63.093109] fde0: 00000001 eb714400 ea14fe0c ea14fdf8 c03953dc c004adb8 eb714400 00000000
[   63.101806] fe00: ea14fe24 ea14fe10 c0395808 c0395374 eb17a040 eb714400 ea14fe3c ea14fe28
[   63.114715] fe20: bf000530 c0395800 eb714410 00000000 ea14fe64 ea14fe40 c038fa5c bf000508
[   63.121795] fe40: eb214b80 eb6a9d30 ea14fe7c eb204410 bf032d98 eb204444 ea14fe7c ea14fe68
[   63.123352] fe60: bf022574 c038fa2c bf02254c eb204410 ea14fe8c ea14fe80 c0395080 bf022558
[   63.140136] fe80: ea14fea4 ea14fe90 c0393494 c039506c eb204410 bf032d98 ea14fec4 ea14fea8
[   63.149200] fea0: c0393efc c0393428 00000000 bf032d98 bf034438 bf0342b8 ea14fedc ea14fec8
[   63.154327] fec0: c0393244 c0393e4c eb6fa300 bf032d98 ea14fef4 ea14fee0 c0394570 c03931ec
[   63.166442] fee0: bf022800 00000005 ea14ff04 ea14fef8 c03951d0 c039454c ea14ff14 ea14ff08
[   63.175048] ff00: bf0010e8 c03951c8 ea14ff34 ea14ff18 bf022534 bf0010e0 bf0224f4 00000000
[   63.183685] ff20: bf0342d0 00000880 ea14ffa4 ea14ff38 c00b7f50 bf022500 c000f564 00000000
[   63.183685] ff40: bf0342d0 00000880 ea14ff3c 70616d6f 00737364 00088ec9 ea14ff84 ea14ff68
[   63.200927] ff60: c008fff0 c008fdd8 0001cec8 70616d6f 00737364 00000081 ea14ff94 ea14ff88
[   63.209533] ff80: c00900dc 0008ff08 00000000 0001cec8 70616d6f 00737364 00000000 ea14ffa8
[   63.218170] ffa0: c000f540 c00b7e0c 0001cec8 70616d6f bea28b10 00000880 bea28b10 00000880
[   63.226776] ffc0: 0001cec8 70616d6f 00737364 00000081 000acc00 00000042 00088ec9 00000000
[   63.234619] ffe0: bea28b08 bea28af8 0001cda4 b6ed3390 60000110 bea28b10 00000000 00000000
[   63.234619] Backtrace: 
[   63.246612] [<c004adac>] (release_resource) from [<c03953dc>] (platform_device_del+0x74/0xa4)
[   63.246612]  r5:eb714400 r4:00000001
[   63.246612] [<c0395368>] (platform_device_del) from [<c0395808>] (platform_device_unregister+0x14/0x20)
[   63.267150]  r5:00000000 r4:eb714400
[   63.273223] [<c03957f4>] (platform_device_unregister) from [<bf000530>] (dss_uninit_submodule_dev+0x34/0x40 [omapdss])
[   63.281799]  r4:eb714400 r3:eb17a040
[   63.281799] [<bf0004fc>] (dss_uninit_submodule_dev [omapdss]) from [<c038fa5c>] (device_for_each_child+0x3c/0x7c)
[   63.291839]  r4:00000000 r3:eb714410
[   63.303070] [<c038fa20>] (device_for_each_child) from [<bf022574>] (omap_dsshw_remove+0x28/0x70 [omapdss])
[   63.312255]  r6:eb204444 r5:bf032d98 r4:eb204410
[   63.318237] [<bf02254c>] (omap_dsshw_remove [omapdss]) from [<c0395080>] (platform_drv_remove+0x20/0x24)
[   63.321807]  r4:eb204410 r3:bf02254c
[   63.331848] [<c0395060>] (platform_drv_remove) from [<c0393494>] (__device_release_driver+0x78/0xd0)
[   63.341644] [<c039341c>] (__device_release_driver) from [<c0393efc>] (driver_detach+0xbc/0xc0)
[   63.350708]  r5:bf032d98 r4:eb204410
[   63.352874] [<c0393e40>] (driver_detach) from [<c0393244>] (bus_remove_driver+0x64/0xcc)
[   63.352874]  r6:bf0342b8 r5:bf034438 r4:bf032d98 r3:00000000
[   63.369018] [<c03931e0>] (bus_remove_driver) from [<c0394570>] (driver_unregister+0x30/0x50)
[   63.372894]  r4:bf032d98 r3:eb6fa300
[   63.381713] [<c0394540>] (driver_unregister) from [<c03951d0>] (platform_driver_unregister+0x14/0x18)
[   63.391418]  r4:00000005 r3:bf022800
[   63.391845] [<c03951bc>] (platform_driver_unregister) from [<bf0010e8>] (dss_uninit_platform_driver+0x14/0x1c [omapdss])
[   63.401794] [<bf0010d4>] (dss_uninit_platform_driver [omapdss]) from [<bf022534>] (omap_dss_exit+0x40/0x58 [omapdss])
[   63.406951] [<bf0224f4>] (omap_dss_exit [omapdss]) from [<c00b7f50>] (SyS_delete_module+0x150/0x1e0)
[   63.421844]  r6:00000880 r5:bf0342d0 r4:00000000 r3:bf0224f4
[   63.431793] [<c00b7e00>] (SyS_delete_module) from [<c000f540>] (ret_fast_syscall+0x0/0x48)
[   63.431793]  r6:00737364 r5:70616d6f r4:0001cec8
[   63.447448] Code: e1a04000 e59f0068 eb15c3d1 e5943010 (e5932018) 
[   63.453918] ---[ end trace 9bdaba0cecbfc6c4 ]---
#15 lore raw

Re: [PATCH v2 4/4] ARM: DTS: AM43x: Add DSS node

Quoted 9 lines · Tomi Valkeinen
Quoted 2 lines · Mark Rutland

I can't see anything obviously wrong in platform_device_del. Do you have a backtrace?

Yes, below.

I can see at least drivers/usb/dwc3/dwc3-exynos.c doing the exact same thing I do, so maybe I've got something wrong with the omapdss driver.

Looks to me that the devices created by of_platform_populate() are not unregisterable in all cases. The address resource created via of_platform_populate() had NULL res->parent, which causes release_resource to crash.

I can as well call of_platform_populate() in the platform init code at boot time, and create the devices there for now.

Tomi

#16 lore raw

Re: [PATCH v2 4/4] ARM: DTS: AM43x: Add DSS node

Quoted 8 lines · Tomi Valkeinen
Quoted 7 lines · Tomi Valkeinen
Quoted 2 lines · Mark Rutland

I can't see anything obviously wrong in platform_device_del. Do you have a backtrace?

Yes, below.

Quoted 7 lines
Quoted 2 lines

I can see at least drivers/usb/dwc3/dwc3-exynos.c doing the exact same thing I do, so maybe I've got something wrong with the omapdss driver.

Looks to me that the devices created by of_platform_populate() are not unregisterable in all cases. The address resource created via of_platform_populate() had NULL res->parent, which causes release_resource to crash.

Hmm. I can't see that unregistering such devices ever works as you say, given that __release_resource expects a non-NULL parent pointer. Either we should be setting the parent pointer when initialising devices from dt or we should teach __release_resource to not care. I'll have a go at fixing that.

It looks like drivers/usb/dwc3/dwc3-exynos.c only unregisters the top-level device, not children. This top-level device has no IORESOURCE_{IO,MEM} resources judging by arch/arm/boot/dts/exynos5250.dtsi, which would explain why that driver isn't exploding: __release_resource will never get called.

Anton, Felipe:

Does unregistering the parent ensure the children get cleaned up, or does it leave them dangling in the dwc3-exynos driver?

Cheers,
Mark.

#17 lore raw

Re: [PATCH v2 4/4] ARM: DTS: AM43x: Add DSS node

Quoted 29 lines · Mark Rutland
Quoted 8 lines · Tomi Valkeinen
Quoted 7 lines · Tomi Valkeinen
Quoted 2 lines · Mark Rutland

I can't see anything obviously wrong in platform_device_del. Do you have a backtrace?

Yes, below.

Quoted 7 lines
Quoted 2 lines

I can see at least drivers/usb/dwc3/dwc3-exynos.c doing the exact same thing I do, so maybe I've got something wrong with the omapdss driver.

Looks to me that the devices created by of_platform_populate() are not unregisterable in all cases. The address resource created via of_platform_populate() had NULL res->parent, which causes release_resource to crash.

Hmm. I can't see that unregistering such devices ever works as you say, given that __release_resource expects a non-NULL parent pointer. Either we should be setting the parent pointer when initialising devices from dt or we should teach __release_resource to not care. I'll have a go at fixing that.

It looks like drivers/usb/dwc3/dwc3-exynos.c only unregisters the top-level device, not children. This top-level device has no IORESOURCE_{IO,MEM} resources judging by arch/arm/boot/dts/exynos5250.dtsi, which would explain why that driver isn't exploding: __release_resource will never get called.

Quoted 4 lines

Anton, Felipe:

Does unregistering the parent ensure the children get cleaned up, or does it leave them dangling in the dwc3-exynos driver?

you should platform_device_unregister() for each children and dwc3-exynos does that just fine:

167 static int dwc3_exynos_remove(struct platform_device *pdev) 168 {
169 struct dwc3_exynos *exynos = platform_get_drvdata(pdev);
170

171         device_for_each_child(&pdev->dev, NULL, dwc3_exynos_remove_child);
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

172 platform_device_unregister(exynos->usb2_phy);
173 platform_device_unregister(exynos->usb3_phy);
174
175 clk_disable_unprepare(exynos->clk);
176
177 return 0;
178 }

for each child of this device, we call dwc3_exynos_remove_child(), which will:

94 static int dwc3_exynos_remove_child(struct device *dev, void *unused) 95 {
96 struct platform_device *pdev = to_platform_device(dev);
97
98 platform_device_unregister(pdev);
99
100 return 0;
101 }

Signature · 1 line
balbi
#18 lore raw

Re: [PATCH v2 4/4] ARM: DTS: AM43x: Add DSS node

Quoted 30 lines · Felipe Balbi
Quoted 29 lines · Mark Rutland
Quoted 8 lines · Tomi Valkeinen
Quoted 7 lines · Tomi Valkeinen
Quoted 2 lines · Mark Rutland

I can't see anything obviously wrong in platform_device_del. Do you have a backtrace?

Yes, below.

Quoted 7 lines
Quoted 2 lines

I can see at least drivers/usb/dwc3/dwc3-exynos.c doing the exact same thing I do, so maybe I've got something wrong with the omapdss driver.

Looks to me that the devices created by of_platform_populate() are not unregisterable in all cases. The address resource created via of_platform_populate() had NULL res->parent, which causes release_resource to crash.

Hmm. I can't see that unregistering such devices ever works as you say, given that __release_resource expects a non-NULL parent pointer. Either we should be setting the parent pointer when initialising devices from dt or we should teach __release_resource to not care. I'll have a go at fixing that.

It looks like drivers/usb/dwc3/dwc3-exynos.c only unregisters the top-level device, not children. This top-level device has no IORESOURCE_{IO,MEM} resources judging by arch/arm/boot/dts/exynos5250.dtsi, which would explain why that driver isn't exploding: __release_resource will never get called.

Quoted 7 lines
Quoted 4 lines

Anton, Felipe:

Does unregistering the parent ensure the children get cleaned up, or does it leave them dangling in the dwc3-exynos driver?

you should platform_device_unregister() for each children and dwc3-exynos does that just fine:

Yes, that's what I do also, and it crashes. What Mark said above about unregistering never working for such devices is correct, but I don't know why he said dwc3-exynos only unregisters the top level device.

"such devices" above meaning devices with a 'reg' defined in the DT data, if I'm not mistaken.

So at the moment, I think of_platform_populate() and platform_device_unregister() combination in a driver is a bit risky. Work fine for certain cases, not for some other.

Tomi

#19 lore raw

Re: [PATCH v2 4/4] ARM: DTS: AM43x: Add DSS node

Quoted 36 lines · Tomi Valkeinen
Quoted 35 lines · Felipe Balbi
Quoted 33 lines · Mark Rutland
Quoted 8 lines · Tomi Valkeinen
Quoted 7 lines · Tomi Valkeinen
Quoted 2 lines · Mark Rutland

I can't see anything obviously wrong in platform_device_del. Do you have a backtrace?

Yes, below.

Quoted 7 lines
Quoted 2 lines

I can see at least drivers/usb/dwc3/dwc3-exynos.c doing the exact same thing I do, so maybe I've got something wrong with the omapdss driver.

Looks to me that the devices created by of_platform_populate() are not unregisterable in all cases. The address resource created via of_platform_populate() had NULL res->parent, which causes release_resource to crash.

Hmm. I can't see that unregistering such devices ever works as you say, given that __release_resource expects a non-NULL parent pointer. Either we should be setting the parent pointer when initialising devices from dt or we should teach __release_resource to not care. I'll have a go at fixing that.

It looks like drivers/usb/dwc3/dwc3-exynos.c only unregisters the top-level device, not children. This top-level device has no IORESOURCE_{IO,MEM} resources judging by arch/arm/boot/dts/exynos5250.dtsi, which would explain why that driver isn't exploding: __release_resource will never get called.

Anton, Felipe:

Does unregistering the parent ensure the children get cleaned up, or does it leave them dangling in the dwc3-exynos driver?

Quoted 6 lines
Quoted 2 lines

you should platform_device_unregister() for each children and dwc3-exynos does that just fine:

Yes, that's what I do also, and it crashes. What Mark said above about unregistering never working for such devices is correct, but I don't know why he said dwc3-exynos only unregisters the top level device.

Because I'd failed to read the code correctly. It does indeed unregister each of the children via platform_device_unregister.

Apologies for the confusion there.

Quoted 2 lines

"such devices" above meaning devices with a 'reg' defined in the DT data, if I'm not mistaken.

Yes. As far as I can see, IORESOURCE_MEM resources instantiated from reg entries in dt do not have their parent pointer initialised, and will cause __release_resource to blow up. A quick inspection of resources on my TC2 shows this to be the case -- the parent, sibling, and child pointers are all NULL.

I'm at a loss to explain how the dwc3-exynos driver can call platform_device_unregister on devices with such resource and not blow up. Is anyone able to test dwc3_exynos_remove?

Quoted 3 lines

So at the moment, I think of_platform_populate() and platform_device_unregister() combination in a driver is a bit risky. Work fine for certain cases, not for some other.

It certainly looks to be broken at the moment, but it should be fixable.

Thanks,
Mark.