Skip to contentSkip to conversation

Few ti-sysc related fixes

PATCH In review Tony Lindgren 2 participants 7 messages Oct 26, 2020 – Oct 31, 2020

Subsystems (3)
lore
Share & tools
lore

Tony Lindgren

author maintainer
#0 lore raw

cover Few ti-sysc related fixes

Hi,

Here are few fixes for ti-sysc interconnect target module driver related issues.

Regards,

Tony

Tony Lindgren (4):
ARM: OMAP2+: Fix location for select PM_GENERIC_DOMAINS
ARM: OMAP2+: Fix missing select PM_GENERIC_DOMAINS_OF
bus: ti-sysc: Fix reset status check for modules with quirks
bus: ti-sysc: Fix bogus resetdone warning for cpsw

 arch/arm/mach-omap2/Kconfig           |  3 ++-
 drivers/bus/ti-sysc.c                 | 28 ++++++++++++++++-----------
 include/linux/platform_data/ti-sysc.h |  1 +
 3 files changed, 20 insertions(+), 12 deletions(-)
Signature · 1 line
2.29.1
author maintainer
#1 lore raw

PATCH 1/4 ARM: OMAP2+: Fix location for select PM_GENERIC_DOMAINS

I accidentally misplaced select PM_GENERIC_DOMAINS, it should be selected for all the SoCs instead.

Fixes 58cbff023bfa ("soc: ti: omap-prm: Add basic power domain support")
---
 arch/arm/mach-omap2/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/Kconfig +1 -1
@@ -7,7 +7,6 @@ config ARCH_OMAP2
 	depends on ARCH_MULTI_V6
 	select ARCH_OMAP2PLUS
 	select CPU_V6
-	select PM_GENERIC_DOMAINS if PM
 	select SOC_HAS_OMAP2_SDRC
 
 config ARCH_OMAP3
@@ -106,6 +105,7 @@ config ARCH_OMAP2PLUS
 	select OMAP_DM_TIMER
 	select OMAP_GPMC
 	select PINCTRL
+	select PM_GENERIC_DOMAINS if PM
 	select RESET_CONTROLLER
 	select SOC_BUS
 	select TI_SYSC
Signature · 1 line
2.29.1
author maintainer
#2 lore raw

PATCH 2/4 ARM: OMAP2+: Fix missing select PM_GENERIC_DOMAINS_OF

In reply to Tony Lindgren

We should select also PM_GENERIC_DOMAINS_OF in addition to PM_GENERIC_DOMAINS to have device tree based PM domain providers enabled.

Fixes 58cbff023bfa ("soc: ti: omap-prm: Add basic power domain support")
---
 arch/arm/mach-omap2/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-omap2/Kconfig +1 -0
@@ -106,6 +106,7 @@ config ARCH_OMAP2PLUS
 	select OMAP_GPMC
 	select PINCTRL
 	select PM_GENERIC_DOMAINS if PM
+	select PM_GENERIC_DOMAINS_OF if PM
 	select RESET_CONTROLLER
 	select SOC_BUS
 	select TI_SYSC
Signature · 1 line
2.29.1
author maintainer
#3 lore raw

PATCH 3/4 bus: ti-sysc: Fix reset status check for modules with quirks

In reply to Tony Lindgren

Commit d46f9fbec719 ("bus: ti-sysc: Use optional clocks on for enable and wait for softreset bit") started showing a "OCP softreset timed out" warning on enable if the interconnect target module is not out of reset. This caused the warning to be often triggered for i2c and hdq while the devices are working properly.

Turns out that some interconnect target modules seem to have an unusable reset status bits unless the module specific reset quirks are activated.

Let's just skip the reset status check for those modules as we only want to activate the reset quirks when doing a reset, and not on enable. This way we don't see the bogus "OCP softreset timed out" warnings during boot.

Fixes d46f9fbec719 ("bus: ti-sysc: Use optional clocks on for enable and wait for softreset bit")
---
 drivers/bus/ti-sysc.c                 | 24 +++++++++++++++---------
 include/linux/platform_data/ti-sysc.h |  1 +
 2 files changed, 16 insertions(+), 9 deletions(-)
drivers/bus/ti-sysc.c +15 -9
@@ -970,9 +970,15 @@ static int sysc_enable_module(struct device *dev)
 			return error;
 		}
 	}
-	error = sysc_wait_softreset(ddata);
-	if (error)
-		dev_warn(ddata->dev, "OCP softreset timed out\n");
+	/*
+	 * Some modules like i2c and hdq1w have unusable reset status unless
+	 * the module reset quirk is enabled. Skip status check on enable.
+	 */
+	if (!(ddata->cfg.quirks & SYSC_MODULE_QUIRK_ENA_RESETDONE)) {
+		error = sysc_wait_softreset(ddata);
+		if (error)
+			dev_warn(ddata->dev, "OCP softreset timed out\n");
+	}
 	if (ddata->cfg.quirks & SYSC_QUIRK_OPT_CLKS_IN_RESET)
 		sysc_disable_opt_clocks(ddata);
 
@@ -1373,17 +1379,17 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = {
 	SYSC_QUIRK("hdmi", 0, 0, 0x10, -ENODEV, 0x50030200, 0xffffffff,
 		   SYSC_QUIRK_OPT_CLKS_NEEDED),
 	SYSC_QUIRK("hdq1w", 0, 0, 0x14, 0x18, 0x00000006, 0xffffffff,
-		   SYSC_MODULE_QUIRK_HDQ1W),
+		   SYSC_MODULE_QUIRK_HDQ1W | SYSC_MODULE_QUIRK_ENA_RESETDONE),
 	SYSC_QUIRK("hdq1w", 0, 0, 0x14, 0x18, 0x0000000a, 0xffffffff,
-		   SYSC_MODULE_QUIRK_HDQ1W),
+		   SYSC_MODULE_QUIRK_HDQ1W | SYSC_MODULE_QUIRK_ENA_RESETDONE),
 	SYSC_QUIRK("i2c", 0, 0, 0x20, 0x10, 0x00000036, 0x000000ff,
-		   SYSC_MODULE_QUIRK_I2C),
+		   SYSC_MODULE_QUIRK_I2C | SYSC_MODULE_QUIRK_ENA_RESETDONE),
 	SYSC_QUIRK("i2c", 0, 0, 0x20, 0x10, 0x0000003c, 0x000000ff,
-		   SYSC_MODULE_QUIRK_I2C),
+		   SYSC_MODULE_QUIRK_I2C | SYSC_MODULE_QUIRK_ENA_RESETDONE),
 	SYSC_QUIRK("i2c", 0, 0, 0x20, 0x10, 0x00000040, 0x000000ff,
-		   SYSC_MODULE_QUIRK_I2C),
+		   SYSC_MODULE_QUIRK_I2C | SYSC_MODULE_QUIRK_ENA_RESETDONE),
 	SYSC_QUIRK("i2c", 0, 0, 0x10, 0x90, 0x5040000a, 0xfffff0f0,
-		   SYSC_MODULE_QUIRK_I2C),
+		   SYSC_MODULE_QUIRK_I2C | SYSC_MODULE_QUIRK_ENA_RESETDONE),
 	SYSC_QUIRK("gpu", 0x50000000, 0x14, -ENODEV, -ENODEV, 0x00010201, 0xffffffff, 0),
 	SYSC_QUIRK("gpu", 0x50000000, 0xfe00, 0xfe10, -ENODEV, 0x40000000 , 0xffffffff,
 		   SYSC_MODULE_QUIRK_SGX),
include/linux/platform_data/ti-sysc.h +1 -0
@@ -50,6 +50,7 @@ struct sysc_regbits {
 	s8 emufree_shift;
 };
 
+#define SYSC_MODULE_QUIRK_ENA_RESETDONE	BIT(25)
 #define SYSC_MODULE_QUIRK_PRUSS		BIT(24)
 #define SYSC_MODULE_QUIRK_DSS_RESET	BIT(23)
 #define SYSC_MODULE_QUIRK_RTC_UNLOCK	BIT(22)
Signature · 1 line
2.29.1
author maintainer
#4 lore raw

PATCH 4/4 bus: ti-sysc: Fix bogus resetdone warning for cpsw

In reply to Tony Lindgren

The cpsw SOFT_RESET register is cleard when out of reset so let's add SYSS_QUIRK_RESETDONE_INVERTED flag for cpsw. Otherwise we will get bogus "OCP softreset timed out" warnings on boot.

Fixes d46f9fbec719 ("bus: ti-sysc: Use optional clocks on for enable and wait for softreset bit")
---
 drivers/bus/ti-sysc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/bus/ti-sysc.c +2 -2
@@ -1364,6 +1364,8 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = {
 	/* Quirks that need to be set based on detected module */
 	SYSC_QUIRK("aess", 0, 0, 0x10, -ENODEV, 0x40000000, 0xffffffff,
 		   SYSC_MODULE_QUIRK_AESS),
+	SYSC_QUIRK("cpgmac", 0, 0x1200, 0x1208, 0x1204, 0x4edb1902,
+		   0xffff00f0, SYSS_QUIRK_RESETDONE_INVERTED),
 	SYSC_QUIRK("dcan", 0x48480000, 0x20, -ENODEV, -ENODEV, 0xa3170504, 0xffffffff,
 		   SYSC_QUIRK_CLKDM_NOAUTO),
 	SYSC_QUIRK("dss", 0x4832a000, 0, 0x10, 0x14, 0x00000020, 0xffffffff,
@@ -1423,8 +1425,6 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = {
 	SYSC_QUIRK("atl", 0, 0, -ENODEV, -ENODEV, 0x0a070100, 0xffffffff, 0),
 	SYSC_QUIRK("cm", 0, 0, -ENODEV, -ENODEV, 0x40000301, 0xffffffff, 0),
 	SYSC_QUIRK("control", 0, 0, 0x10, -ENODEV, 0x40000900, 0xffffffff, 0),
-	SYSC_QUIRK("cpgmac", 0, 0x1200, 0x1208, 0x1204, 0x4edb1902,
-		   0xffff00f0, 0),
 	SYSC_QUIRK("dcan", 0, 0x20, -ENODEV, -ENODEV, 0xa3170504, 0xffffffff, 0),
 	SYSC_QUIRK("dcan", 0, 0x20, -ENODEV, -ENODEV, 0x4edb1902, 0xffffffff, 0),
 	SYSC_QUIRK("dispc", 0x4832a400, 0, 0x10, 0x14, 0x00000030, 0xffffffff, 0),
Signature · 1 line
2.29.1
#5 lore raw

Re: [PATCH 4/4] bus: ti-sysc: Fix bogus resetdone warning for cpsw

Hi Tony,

Quoted 3 lines · Tony Lindgren

The cpsw SOFT_RESET register is cleard when out of reset so let's add SYSS_QUIRK_RESETDONE_INVERTED flag for cpsw. Otherwise we will get bogus "OCP softreset timed out" warnings on boot.

Not sure if this quirk based approach is right way to move forward here.

The cpsw/cpgmac is "ti,sysc-omap4-simple" which means sysc_omap4_simple, which, in turn, has .srst_shift = -ENODEV.

And above should be enough to avoid both sysc_reset() and sysc_wait_softreset() for such modules.

Quoted 29 lines
Fixes d46f9fbec719 ("bus: ti-sysc: Use optional clocks on for enable and wait for softreset bit")
---
  drivers/bus/ti-sysc.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/bus/ti-sysc.c +2 -2
@@ -1364,6 +1364,8 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = {
  	/* Quirks that need to be set based on detected module */
  	SYSC_QUIRK("aess", 0, 0, 0x10, -ENODEV, 0x40000000, 0xffffffff,
  		   SYSC_MODULE_QUIRK_AESS),
+	SYSC_QUIRK("cpgmac", 0, 0x1200, 0x1208, 0x1204, 0x4edb1902,
+		   0xffff00f0, SYSS_QUIRK_RESETDONE_INVERTED),
  	SYSC_QUIRK("dcan", 0x48480000, 0x20, -ENODEV, -ENODEV, 0xa3170504, 0xffffffff,
  		   SYSC_QUIRK_CLKDM_NOAUTO),
  	SYSC_QUIRK("dss", 0x4832a000, 0, 0x10, 0x14, 0x00000020, 0xffffffff,
@@ -1423,8 +1425,6 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = {
  	SYSC_QUIRK("atl", 0, 0, -ENODEV, -ENODEV, 0x0a070100, 0xffffffff, 0),
  	SYSC_QUIRK("cm", 0, 0, -ENODEV, -ENODEV, 0x40000301, 0xffffffff, 0),
  	SYSC_QUIRK("control", 0, 0, 0x10, -ENODEV, 0x40000900, 0xffffffff, 0),
-	SYSC_QUIRK("cpgmac", 0, 0x1200, 0x1208, 0x1204, 0x4edb1902,
-		   0xffff00f0, 0),
  	SYSC_QUIRK("dcan", 0, 0x20, -ENODEV, -ENODEV, 0xa3170504, 0xffffffff, 0),
  	SYSC_QUIRK("dcan", 0, 0x20, -ENODEV, -ENODEV, 0x4edb1902, 0xffffffff, 0),
  	SYSC_QUIRK("dispc", 0x4832a400, 0, 0x10, 0x14, 0x00000030, 0xffffffff, 0),
Signature · 2 lines
Best regards,
grygorii
author maintainer
#6 lore raw

Re: [PATCH 4/4] bus: ti-sysc: Fix bogus resetdone warning for cpsw

Quoted 7 lines · Grygorii Strashko

Hi Tony,

Quoted 3 lines · Tony Lindgren

The cpsw SOFT_RESET register is cleard when out of reset so let's add SYSS_QUIRK_RESETDONE_INVERTED flag for cpsw. Otherwise we will get bogus "OCP softreset timed out" warnings on boot.

Quoted 6 lines

Not sure if this quirk based approach is right way to move forward here.

The cpsw/cpgmac is "ti,sysc-omap4-simple" which means sysc_omap4_simple, which, in turn, has .srst_shift = -ENODEV.

And above should be enough to avoid both sysc_reset() and sysc_wait_softreset() for such modules.

That sounds like a much better fix indeed, I'll take a look.

Thanks,

Tony