Skip to contentSkip to conversation

ARM: OMAP2+: USB Host bug fixes for 3.13 rc

PATCH In review Roger Quadros 5 participants 14 messages Dec 3, 2013 – Dec 9, 2013

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

v2 cover ARM: OMAP2+: USB Host bug fixes for 3.13 rc

Hi,

This is a follow up solution to the original series in [1]

The first patch fixes the OMAP4 Panda USB detection problems on 3.13-rc1 with u-boot v2013.10.

The remaining 2 patches are required if SOFTRESET needs to be done for the USB Host module on OMAP3 platforms.

Patch 2 fixes the hwmod RESET logic to prevent multiple SOFTRESETs being issued to the modules. This multiple SOFTRESET was causing problems with OMAP3 USB Host module. On Beagleboard C4 this is seen as failure to mount NFS root over external USB to Ethernet device.

This might be the reason why HWMOD_INIT_NO_RESET was used for the OMAP USB host module in OMAP3 hwmod data and just carried forward in OMAP4 and OMAP5 hwmod data as well.

cheers,
-roger

[1] - http://thread.gmane.org/gmane.linux.kernel/1603931

Roger Quadros (3):
ARM: OMAP4+: hwmod data: Don't prevent RESET of USB Host module
ARM: OMAP2+: hwmod: Fix RESET logic
ARM: OMAP3: hwmod data: Don't prevent RESET of USB Host module

 arch/arm/mach-omap2/omap_hwmod.c           | 43 +++++++++++++++++++++++++++++-
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 13 +++------
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 12 ++-------
 arch/arm/mach-omap2/omap_hwmod_54xx_data.c | 13 +++------
 4 files changed, 50 insertions(+), 31 deletions(-)
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH v2 1/3 ARM: OMAP4+: hwmod data: Don't prevent RESET of USB Host module

Without this, the USB devices are sometimes not detected on OMAP4 Panda with u-boot v2013.10.

Unlike what the comment states, errata i660 does not state that we can't RESET the USB host module. Instead it states that RESET is the only way to recover from a deadlock situation.

RESET ensures that the module is in a known good state irrespective of what bootloader does with the module, so it must be done at boot.

---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 12 ++----------
 arch/arm/mach-omap2/omap_hwmod_54xx_data.c | 13 +++----------
 2 files changed, 5 insertions(+), 20 deletions(-)
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +2 -10
index 1e5b12c..3318cae9 100644
@@ -2937,7 +2937,7 @@ static struct omap_hwmod_class_sysconfig omap44xx_usb_host_hs_sysc = {
 	.sysc_offs	= 0x0010,
 	.syss_offs	= 0x0014,
 	.sysc_flags	= (SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE |
-			   SYSC_HAS_SOFTRESET),
+			   SYSC_HAS_SOFTRESET | SYSC_HAS_RESET_STATUS),
 	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
 			   SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
 			   MSTANDBY_SMART | MSTANDBY_SMART_WKUP),
@@ -3001,15 +3001,7 @@ static struct omap_hwmod omap44xx_usb_host_hs_hwmod = {
 	 * hence HWMOD_SWSUP_MSTANDBY
 	 */
 
-	/*
-	 * During system boot; If the hwmod framework resets the module
-	 * the module will have smart idle settings; which can lead to deadlock
-	 * (above Errata Id:i660); so, dont reset the module during boot;
-	 * Use HWMOD_INIT_NO_RESET.
-	 */
-
-	.flags		= HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY |
-			  HWMOD_INIT_NO_RESET,
+	.flags		= HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY,
 };
 
 /*
arch/arm/mach-omap2/omap_hwmod_54xx_data.c +3 -10
index 9e08d69..e297d62 100644
@@ -1544,7 +1544,8 @@ static struct omap_hwmod_class_sysconfig omap54xx_usb_host_hs_sysc = {
 	.rev_offs	= 0x0000,
 	.sysc_offs	= 0x0010,
 	.sysc_flags	= (SYSC_HAS_MIDLEMODE | SYSC_HAS_RESET_STATUS |
-			   SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
+			   SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
+			   SYSC_HAS_RESET_STATUS),
 	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
 			   SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
 			   MSTANDBY_SMART | MSTANDBY_SMART_WKUP),
@@ -1598,15 +1599,7 @@ static struct omap_hwmod omap54xx_usb_host_hs_hwmod = {
 	 * hence HWMOD_SWSUP_MSTANDBY
 	 */
 
-	/*
-	 * During system boot; If the hwmod framework resets the module
-	 * the module will have smart idle settings; which can lead to deadlock
-	 * (above Errata Id:i660); so, dont reset the module during boot;
-	 * Use HWMOD_INIT_NO_RESET.
-	 */
-
-	.flags		= HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY |
-			  HWMOD_INIT_NO_RESET,
+	.flags		= HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY,
 	.main_clk	= "l3init_60m_fclk",
 	.prcm = {
 		.omap4 = {
Signature · 1 line
1.8.3.2
maintainer Acked-by on v2 1/3
#2 lore raw

Re: [PATCH 1/3] ARM: OMAP4+: hwmod data: Don't prevent RESET of USB Host module

Hi Beno?t,

Quoted 7 lines · Roger Quadros

Without this, the USB devices are sometimes not detected on OMAP4 Panda with u-boot v2013.10.

Unlike what the comment states, errata i660 does not state that we can't RESET the USB host module. Instead it states that RESET is the only way to recover from a deadlock situation.

Quoted 5 lines

RESET ensures that the module is in a known good state irrespective of what bootloader does with the module, so it must be done at boot.

Will you pick this up for the -rc series, or do you want me or Tony to? Roger writes that this one's pretty important.

- Paul

Quoted 69 lines
---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 12 ++----------
 arch/arm/mach-omap2/omap_hwmod_54xx_data.c | 13 +++----------
 2 files changed, 5 insertions(+), 20 deletions(-)
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +2 -10
index 1e5b12c..3318cae9 100644
@@ -2937,7 +2937,7 @@ static struct omap_hwmod_class_sysconfig omap44xx_usb_host_hs_sysc = {
 	.sysc_offs	= 0x0010,
 	.syss_offs	= 0x0014,
 	.sysc_flags	= (SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE |
-			   SYSC_HAS_SOFTRESET),
+			   SYSC_HAS_SOFTRESET | SYSC_HAS_RESET_STATUS),
 	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
 			   SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
 			   MSTANDBY_SMART | MSTANDBY_SMART_WKUP),
@@ -3001,15 +3001,7 @@ static struct omap_hwmod omap44xx_usb_host_hs_hwmod = {
 	 * hence HWMOD_SWSUP_MSTANDBY
 	 */
 
-	/*
-	 * During system boot; If the hwmod framework resets the module
-	 * the module will have smart idle settings; which can lead to deadlock
-	 * (above Errata Id:i660); so, dont reset the module during boot;
-	 * Use HWMOD_INIT_NO_RESET.
-	 */
-
-	.flags		= HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY |
-			  HWMOD_INIT_NO_RESET,
+	.flags		= HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY,
 };
 
 /*
arch/arm/mach-omap2/omap_hwmod_54xx_data.c +3 -10
index 9e08d69..e297d62 100644
@@ -1544,7 +1544,8 @@ static struct omap_hwmod_class_sysconfig omap54xx_usb_host_hs_sysc = {
 	.rev_offs	= 0x0000,
 	.sysc_offs	= 0x0010,
 	.sysc_flags	= (SYSC_HAS_MIDLEMODE | SYSC_HAS_RESET_STATUS |
-			   SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
+			   SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
+			   SYSC_HAS_RESET_STATUS),
 	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
 			   SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
 			   MSTANDBY_SMART | MSTANDBY_SMART_WKUP),
@@ -1598,15 +1599,7 @@ static struct omap_hwmod omap54xx_usb_host_hs_hwmod = {
 	 * hence HWMOD_SWSUP_MSTANDBY
 	 */
 
-	/*
-	 * During system boot; If the hwmod framework resets the module
-	 * the module will have smart idle settings; which can lead to deadlock
-	 * (above Errata Id:i660); so, dont reset the module during boot;
-	 * Use HWMOD_INIT_NO_RESET.
-	 */
-
-	.flags		= HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY |
-			  HWMOD_INIT_NO_RESET,
+	.flags		= HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY,
 	.main_clk	= "l3init_60m_fclk",
 	.prcm = {
 		.omap4 = {
Signature · 1 line
1.8.3.2

- Paul

maintainer
#3 lore raw

Re: [PATCH 1/3] ARM: OMAP4+: hwmod data: Don't prevent RESET of USB Host module

Quoted 14 lines · Paul Walmsley

Hi Beno?t,

Quoted 10 lines · Roger Quadros

Without this, the USB devices are sometimes not detected on OMAP4 Panda with u-boot v2013.10.

Unlike what the comment states, errata i660 does not state that we can't RESET the USB host module. Instead it states that RESET is the only way to recover from a deadlock situation.

RESET ensures that the module is in a known good state irrespective of what bootloader does with the module, so it must be done at boot.

Quoted 7 lines
Quoted 2 lines

Will you pick this up for the -rc series, or do you want me or Tony to? Roger writes that this one's pretty important.

I suggest that you just queue this with your other fixes so we get things working.

Regards,

Tony

Quoted 71 lines
Quoted 68 lines
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 12 ++----------
 arch/arm/mach-omap2/omap_hwmod_54xx_data.c | 13 +++----------
 2 files changed, 5 insertions(+), 20 deletions(-)
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +2 -10
index 1e5b12c..3318cae9 100644
@@ -2937,7 +2937,7 @@ static struct omap_hwmod_class_sysconfig omap44xx_usb_host_hs_sysc = {
 	.sysc_offs	= 0x0010,
 	.syss_offs	= 0x0014,
 	.sysc_flags	= (SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE |
-			   SYSC_HAS_SOFTRESET),
+			   SYSC_HAS_SOFTRESET | SYSC_HAS_RESET_STATUS),
 	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
 			   SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
 			   MSTANDBY_SMART | MSTANDBY_SMART_WKUP),
@@ -3001,15 +3001,7 @@ static struct omap_hwmod omap44xx_usb_host_hs_hwmod = {
 	 * hence HWMOD_SWSUP_MSTANDBY
 	 */
 
-	/*
-	 * During system boot; If the hwmod framework resets the module
-	 * the module will have smart idle settings; which can lead to deadlock
-	 * (above Errata Id:i660); so, dont reset the module during boot;
-	 * Use HWMOD_INIT_NO_RESET.
-	 */
-
-	.flags		= HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY |
-			  HWMOD_INIT_NO_RESET,
+	.flags		= HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY,
 };
 
 /*
arch/arm/mach-omap2/omap_hwmod_54xx_data.c +3 -10
index 9e08d69..e297d62 100644
@@ -1544,7 +1544,8 @@ static struct omap_hwmod_class_sysconfig omap54xx_usb_host_hs_sysc = {
 	.rev_offs	= 0x0000,
 	.sysc_offs	= 0x0010,
 	.sysc_flags	= (SYSC_HAS_MIDLEMODE | SYSC_HAS_RESET_STATUS |
-			   SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
+			   SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
+			   SYSC_HAS_RESET_STATUS),
 	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
 			   SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
 			   MSTANDBY_SMART | MSTANDBY_SMART_WKUP),
@@ -1598,15 +1599,7 @@ static struct omap_hwmod omap54xx_usb_host_hs_hwmod = {
 	 * hence HWMOD_SWSUP_MSTANDBY
 	 */
 
-	/*
-	 * During system boot; If the hwmod framework resets the module
-	 * the module will have smart idle settings; which can lead to deadlock
-	 * (above Errata Id:i660); so, dont reset the module during boot;
-	 * Use HWMOD_INIT_NO_RESET.
-	 */
-
-	.flags		= HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY |
-			  HWMOD_INIT_NO_RESET,
+	.flags		= HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY,
 	.main_clk	= "l3init_60m_fclk",
 	.prcm = {
 		.omap4 = {
Signature · 1 line
1.8.3.2

- Paul

maintainer
#4 lore raw

Re: [PATCH 1/3] ARM: OMAP4+: hwmod data: Don't prevent RESET of USB Host module

Quoted 16 lines · Tony Lindgren
Quoted 15 lines · Paul Walmsley
Quoted 12 lines · Roger Quadros

Without this, the USB devices are sometimes not detected on OMAP4 Panda with u-boot v2013.10.

Unlike what the comment states, errata i660 does not state that we can't RESET the USB host module. Instead it states that RESET is the only way to recover from a deadlock situation.

RESET ensures that the module is in a known good state irrespective of what bootloader does with the module, so it must be done at boot.

Quoted 7 lines
Quoted 4 lines

Will you pick this up for the -rc series, or do you want me or Tony to? Roger writes that this one's pretty important.

I suggest that you just queue this with your other fixes so we get things working.

I'm going to wait until tomorrow anyway to see if Sathya responds to my other E-mail, so maybe Beno?t will let us know by then.

- Paul

#5 lore raw

Re: [PATCH 1/3] ARM: OMAP4+: hwmod data: Don't prevent RESET of USB Host module

In reply to Paul Walmsley

Salut Paul,

Quoted 14 lines · Paul Walmsley

Hi Beno?t,

Quoted 10 lines · Roger Quadros

Without this, the USB devices are sometimes not detected on OMAP4 Panda with u-boot v2013.10.

Unlike what the comment states, errata i660 does not state that we can't RESET the USB host module. Instead it states that RESET is the only way to recover from a deadlock situation.

RESET ensures that the module is in a known good state irrespective of what bootloader does with the module, so it must be done at boot.

Quoted 7 lines
Quoted 2 lines

Will you pick this up for the -rc series, or do you want me or Tony to? Roger writes that this one's pretty important.

I guess, it is better for you to take it. I don't have anything queued for -rc.

Thanks,
Benoit

Quoted 78 lines

- Paul

Quoted 67 lines
---
  arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 12 ++----------
  arch/arm/mach-omap2/omap_hwmod_54xx_data.c | 13 +++----------
  2 files changed, 5 insertions(+), 20 deletions(-)
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +2 -10
index 1e5b12c..3318cae9 100644
@@ -2937,7 +2937,7 @@ static struct omap_hwmod_class_sysconfig omap44xx_usb_host_hs_sysc = {
  	.sysc_offs	= 0x0010,
  	.syss_offs	= 0x0014,
  	.sysc_flags	= (SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE |
-			   SYSC_HAS_SOFTRESET),
+			   SYSC_HAS_SOFTRESET | SYSC_HAS_RESET_STATUS),
  	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
  			   SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
  			   MSTANDBY_SMART | MSTANDBY_SMART_WKUP),
@@ -3001,15 +3001,7 @@ static struct omap_hwmod omap44xx_usb_host_hs_hwmod = {
  	 * hence HWMOD_SWSUP_MSTANDBY
  	 */
 
-	/*
-	 * During system boot; If the hwmod framework resets the module
-	 * the module will have smart idle settings; which can lead to deadlock
-	 * (above Errata Id:i660); so, dont reset the module during boot;
-	 * Use HWMOD_INIT_NO_RESET.
-	 */
-
-	.flags		= HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY |
-			  HWMOD_INIT_NO_RESET,
+	.flags		= HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY,
  };
 
  /*
arch/arm/mach-omap2/omap_hwmod_54xx_data.c +3 -11
index 9e08d69..e297d62 100644
@@ -1544,7 +1544,8 @@ static struct omap_hwmod_class_sysconfig omap54xx_usb_host_hs_sysc = {
  	.rev_offs	= 0x0000,
  	.sysc_offs	= 0x0010,
  	.sysc_flags	= (SYSC_HAS_MIDLEMODE | SYSC_HAS_RESET_STATUS |
-			   SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
+			   SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
+			   SYSC_HAS_RESET_STATUS),
  	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
  			   SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
  			   MSTANDBY_SMART | MSTANDBY_SMART_WKUP),
@@ -1598,15 +1599,7 @@ static struct omap_hwmod omap54xx_usb_host_hs_hwmod = {
  	 * hence HWMOD_SWSUP_MSTANDBY
  	 */
 
-	/*
-	 * During system boot; If the hwmod framework resets the module
-	 * the module will have smart idle settings; which can lead to deadlock
-	 * (above Errata Id:i660); so, dont reset the module during boot;
-	 * Use HWMOD_INIT_NO_RESET.
-	 */
-
-	.flags		= HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY |
-			  HWMOD_INIT_NO_RESET,
+	.flags		= HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY,
  	.main_clk	= "l3init_60m_fclk",
  	.prcm = {
  		.omap4 = {
--
Quoted 2 lines

1.8.3.2

- Paul

Signature · 4 lines
Beno?t Cousson
BayLibre
Embedded Linux Technology Lab
www.baylibre.com
#6 lore raw

PATCH v2 2/3 ARM: OMAP2+: hwmod: Fix RESET logic

In reply to Roger Quadros

In _ocp_softreset(), after _set_softreset() + write_sysconfig(), the hwmod's sysc_cache will always contain SOFTRESET bit set so all further writes to sysconfig using this cache will initiate a repeated SOFTRESET e.g. enable_sysc(). This is true for OMAP3 like platforms that have RESET_DONE status in the SYSSTATUS register and so the the SOFTRESET bit in SYSCONFIG is not automatically cleared. It is not a problem for OMAP4 like platforms that indicate RESET completion by clearing the SOFTRESET bit in the SYSCONFIG register.

This repeated SOFTRESET is undesired and was the root cause of USB host issues on OMAP3 platforms when hwmod was allowed to do the SOFTRESET for the USB Host module.

To fix this we clear the SOFTRESET bit and update the sysconfig register + sysc_cache using write_sysconfig().

---
 arch/arm/mach-omap2/omap_hwmod.c | 43 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)
arch/arm/mach-omap2/omap_hwmod.c +42 -1
index e3f0eca..615acec 100644
@@ -399,7 +399,7 @@ static int _set_clockactivity(struct omap_hwmod *oh, u8 clockact, u32 *v)
 }
 
 /**
- * _set_softreset: set OCP_SYSCONFIG.CLOCKACTIVITY bits in @v
+ * _set_softreset: set OCP_SYSCONFIG.SOFTRESET bit in @v
  * @oh: struct omap_hwmod *
  * @v: pointer to register contents to modify
  *
@@ -427,6 +427,36 @@ static int _set_softreset(struct omap_hwmod *oh, u32 *v)
 }
 
 /**
+ * _clr_softreset: clear OCP_SYSCONFIG.SOFTRESET bit in @v
+ * @oh: struct omap_hwmod *
+ * @v: pointer to register contents to modify
+ *
+ * Clear the SOFTRESET bit in @v for hwmod @oh.  Returns -EINVAL upon
+ * error or 0 upon success.
+ */
+static int _clr_softreset(struct omap_hwmod *oh, u32 *v)
+{
+	u32 softrst_mask;
+
+	if (!oh->class->sysc ||
+	    !(oh->class->sysc->sysc_flags & SYSC_HAS_SOFTRESET))
+		return -EINVAL;
+
+	if (!oh->class->sysc->sysc_fields) {
+		WARN(1,
+		     "omap_hwmod: %s: sysc_fields absent for sysconfig class\n",
+		     oh->name);
+		return -EINVAL;
+	}
+
+	softrst_mask = (0x1 << oh->class->sysc->sysc_fields->srst_shift);
+
+	*v &= ~softrst_mask;
+
+	return 0;
+}
+
+/**
  * _wait_softreset_complete - wait for an OCP softreset to complete
  * @oh: struct omap_hwmod * to wait on
  *
@@ -1911,6 +1941,12 @@ static int _ocp_softreset(struct omap_hwmod *oh)
 	ret = _set_softreset(oh, &v);
 	if (ret)
 		goto dis_opt_clks;
+
+	_write_sysconfig(v, oh);
+	ret = _clr_softreset(oh, &v);
+	if (ret)
+		goto dis_opt_clks;
+
 	_write_sysconfig(v, oh);
 
 	if (oh->class->sysc->srst_udelay)
@@ -3169,6 +3205,11 @@ int omap_hwmod_softreset(struct omap_hwmod *oh)
 		goto error;
 	_write_sysconfig(v, oh);
 
+	ret = _clr_softreset(oh, &v);
+	if (ret)
+		goto error;
+	_write_sysconfig(v, oh);
+
 error:
 	return ret;
 }
Signature · 1 line
1.8.3.2
maintainer
#7 lore raw

Re: [PATCH 2/3] ARM: OMAP2+: hwmod: Fix RESET logic

Hi Roger,

Quoted 9 lines · Roger Quadros

In _ocp_softreset(), after _set_softreset() + write_sysconfig(), the hwmod's sysc_cache will always contain SOFTRESET bit set so all further writes to sysconfig using this cache will initiate a repeated SOFTRESET e.g. enable_sysc(). This is true for OMAP3 like platforms that have RESET_DONE status in the SYSSTATUS register and so the the SOFTRESET bit in SYSCONFIG is not automatically cleared. It is not a problem for OMAP4 like platforms that indicate RESET completion by clearing the SOFTRESET bit in the SYSCONFIG register.

Quoted 3 lines

This repeated SOFTRESET is undesired and was the root cause of USB host issues on OMAP3 platforms when hwmod was allowed to do the SOFTRESET for the USB Host module.

Doh :-(

Nice catch. Renamed _clr_softreset() to _clear_softreset() and queued the following for v3.13-rc.

- Paul

From: Roger Quadros <[email protected]>

ARM: OMAP2+: hwmod: Fix SOFTRESET logic

In _ocp_softreset(), after _set_softreset() + write_sysconfig(), the hwmod's sysc_cache will always contain SOFTRESET bit set so all further writes to sysconfig using this cache will initiate a repeated SOFTRESET e.g. enable_sysc(). This is true for OMAP3 like platforms that have RESET_DONE status in the SYSSTATUS register and so the the SOFTRESET bit in SYSCONFIG is not automatically cleared. It is not a problem for OMAP4 like platforms that indicate RESET completion by clearing the SOFTRESET bit in the SYSCONFIG register.

This repeated SOFTRESET is undesired and was the root cause of USB host issues on OMAP3 platforms when hwmod was allowed to do the SOFTRESET for the USB Host module.

To fix this we clear the SOFTRESET bit and update the sysconfig register + sysc_cache using write_sysconfig().

[paul at pwsan.com: renamed _clr_softreset() to _clear_softreset()]
---
 arch/arm/mach-omap2/omap_hwmod.c | 43 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)
arch/arm/mach-omap2/omap_hwmod.c +42 -1
index e3f0ecaf87dd..cacc0c7e8634 100644
@@ -399,7 +399,7 @@ static int _set_clockactivity(struct omap_hwmod *oh, u8 clockact, u32 *v)
 }
 
 /**
- * _set_softreset: set OCP_SYSCONFIG.CLOCKACTIVITY bits in @v
+ * _set_softreset: set OCP_SYSCONFIG.SOFTRESET bit in @v
  * @oh: struct omap_hwmod *
  * @v: pointer to register contents to modify
  *
@@ -427,6 +427,36 @@ static int _set_softreset(struct omap_hwmod *oh, u32 *v)
 }
 
 /**
+ * _clear_softreset: clear OCP_SYSCONFIG.SOFTRESET bit in @v
+ * @oh: struct omap_hwmod *
+ * @v: pointer to register contents to modify
+ *
+ * Clear the SOFTRESET bit in @v for hwmod @oh.  Returns -EINVAL upon
+ * error or 0 upon success.
+ */
+static int _clear_softreset(struct omap_hwmod *oh, u32 *v)
+{
+	u32 softrst_mask;
+
+	if (!oh->class->sysc ||
+	    !(oh->class->sysc->sysc_flags & SYSC_HAS_SOFTRESET))
+		return -EINVAL;
+
+	if (!oh->class->sysc->sysc_fields) {
+		WARN(1,
+		     "omap_hwmod: %s: sysc_fields absent for sysconfig class\n",
+		     oh->name);
+		return -EINVAL;
+	}
+
+	softrst_mask = (0x1 << oh->class->sysc->sysc_fields->srst_shift);
+
+	*v &= ~softrst_mask;
+
+	return 0;
+}
+
+/**
  * _wait_softreset_complete - wait for an OCP softreset to complete
  * @oh: struct omap_hwmod * to wait on
  *
@@ -1911,6 +1941,12 @@ static int _ocp_softreset(struct omap_hwmod *oh)
 	ret = _set_softreset(oh, &v);
 	if (ret)
 		goto dis_opt_clks;
+
+	_write_sysconfig(v, oh);
+	ret = _clear_softreset(oh, &v);
+	if (ret)
+		goto dis_opt_clks;
+
 	_write_sysconfig(v, oh);
 
 	if (oh->class->sysc->srst_udelay)
@@ -3169,6 +3205,11 @@ int omap_hwmod_softreset(struct omap_hwmod *oh)
 		goto error;
 	_write_sysconfig(v, oh);
 
+	ret = _clear_softreset(oh, &v);
+	if (ret)
+		goto error;
+	_write_sysconfig(v, oh);
+
 error:
 	return ret;
 }
Signature · 1 line
1.8.4.4
#8 lore raw

PATCH v2 3/3 ARM: OMAP3: hwmod data: Don't prevent RESET of USB Host module

In reply to Roger Quadros

Unlike what the comment states, errata i660 does not state that we can't RESET the USB host module. Instead it states that RESET is the only way to recover from a deadlock situation.

RESET ensures that the module is in a known good state irrespective of what bootloader does with the module, so it must be done at boot.

---
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +3 -10
index 9e56fab..d337429 100644
@@ -1943,7 +1943,8 @@ static struct omap_hwmod_class_sysconfig omap3xxx_usb_host_hs_sysc = {
 	.syss_offs	= 0x0014,
 	.sysc_flags	= (SYSC_HAS_MIDLEMODE | SYSC_HAS_CLOCKACTIVITY |
 			   SYSC_HAS_SIDLEMODE | SYSC_HAS_ENAWAKEUP |
-			   SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE),
+			   SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE |
+			   SYSS_HAS_RESET_STATUS),
 	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
 			   MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART),
 	.sysc_fields	= &omap_hwmod_sysc_type1,
@@ -2021,15 +2022,7 @@ static struct omap_hwmod omap3xxx_usb_host_hs_hwmod = {
 	 * hence HWMOD_SWSUP_MSTANDBY
 	 */
 
-	/*
-	 * During system boot; If the hwmod framework resets the module
-	 * the module will have smart idle settings; which can lead to deadlock
-	 * (above Errata Id:i660); so, dont reset the module during boot;
-	 * Use HWMOD_INIT_NO_RESET.
-	 */
-
-	.flags		= HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY |
-			  HWMOD_INIT_NO_RESET,
+	.flags		= HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY,
 };
 
 /*
Signature · 1 line
1.8.3.2
maintainer
#9 lore raw

Re: [PATCH 3/3] ARM: OMAP3: hwmod data: Don't prevent RESET of USB Host module

Quoted 8 lines · Roger Quadros

Unlike what the comment states, errata i660 does not state that we can't RESET the USB host module. Instead it states that RESET is the only way to recover from a deadlock situation.

RESET ensures that the module is in a known good state irrespective of what bootloader does with the module, so it must be done at boot.

Thanks, queued for v3.13-rc.

- Paul

#10 lore raw
In reply to Roger Quadros
Quoted 15 lines · Roger Quadros

Hi,

This is a follow up solution to the original series in [1]

The first patch fixes the OMAP4 Panda USB detection problems on 3.13-rc1 with u-boot v2013.10.

The remaining 2 patches are required if SOFTRESET needs to be done for the USB Host module on OMAP3 platforms.

Patch 2 fixes the hwmod RESET logic to prevent multiple SOFTRESETs being issued to the modules. This multiple SOFTRESET was causing problems with OMAP3 USB Host module. On Beagleboard C4 this is seen as failure to mount NFS root over external USB to Ethernet device.

Quoted 6 lines

This might be the reason why HWMOD_INIT_NO_RESET was used for the OMAP USB host module in OMAP3 hwmod data and just carried forward in OMAP4 and OMAP5 hwmod data as well.

cheers,
-roger

Tested on Panda and Beagle xM. Works fine for me.

Tomi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131204/073597ac/attachment.sig>

maintainer
#11 lore raw
Quoted 16 lines · Tomi Valkeinen
Quoted 15 lines · Roger Quadros

Hi,

This is a follow up solution to the original series in [1]

The first patch fixes the OMAP4 Panda USB detection problems on 3.13-rc1 with u-boot v2013.10.

The remaining 2 patches are required if SOFTRESET needs to be done for the USB Host module on OMAP3 platforms.

Patch 2 fixes the hwmod RESET logic to prevent multiple SOFTRESETs being issued to the modules. This multiple SOFTRESET was causing problems with OMAP3 USB Host module. On Beagleboard C4 this is seen as failure to mount NFS root over external USB to Ethernet device.

Quoted 8 lines
Quoted 6 lines

This might be the reason why HWMOD_INIT_NO_RESET was used for the OMAP USB host module in OMAP3 hwmod data and just carried forward in OMAP4 and OMAP5 hwmod data as well.

cheers,
-roger

Tested on Panda and Beagle xM. Works fine for me.

Looks like we should merge these as regression fixes during the -rc cycle. Paul should take a look at these first though.

Regards,

Tony

#12 lore raw

Tony,

Quoted 21 lines · Tony Lindgren
Quoted 20 lines · Tomi Valkeinen
Quoted 19 lines · Roger Quadros

Hi,

This is a follow up solution to the original series in [1]

The first patch fixes the OMAP4 Panda USB detection problems on 3.13-rc1 with u-boot v2013.10.

The remaining 2 patches are required if SOFTRESET needs to be done for the USB Host module on OMAP3 platforms.

Patch 2 fixes the hwmod RESET logic to prevent multiple SOFTRESETs being issued to the modules. This multiple SOFTRESET was causing problems with OMAP3 USB Host module. On Beagleboard C4 this is seen as failure to mount NFS root over external USB to Ethernet device.

This might be the reason why HWMOD_INIT_NO_RESET was used for the OMAP USB host module in OMAP3 hwmod data and just carried forward in OMAP4 and OMAP5 hwmod data as well.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

cheers,
-roger

Tested on Panda and Beagle xM. Works fine for me.

Looks like we should merge these as regression fixes during the -rc cycle. Paul should take a look at these first though.

At least the first one must be taken ASAP. The other two would be nice to have though.

cheers,
-roger