linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: OMAP: hwmod: Use sysc_fields->srst_shift and get rid of hardcoded SYSC_TYPE2_SOFTRESET_MASK
@ 2012-03-01 13:47 Rajendra Nayak
  2012-03-01 14:08 ` Cousson, Benoit
  2012-03-02  1:08 ` Paul Walmsley
  0 siblings, 2 replies; 3+ messages in thread
From: Rajendra Nayak @ 2012-03-01 13:47 UTC (permalink / raw)
  To: linux-omap, linux-arm-kernel
  Cc: Rajendra Nayak, Paul Walmsley, Benoit Cousson, Balaji TK

This is useful when we have broken type2 compliant IPs' where
the softreset shift is not the same as SYSC_TYPE2_SOFTRESET_SHIFT
and hence is overridden using sysc_fields->srst_shift.

We have atleast one such instance now with onchip keypad on OMAP5
which has a different softreset shift as compared to other type2
IPs'.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Benoit Cousson <b-cousson@ti.com>
Cc: Balaji TK  <balajitk@ti.com>
Tested-by: Sourav Poddar <sourav.poddar@ti.com>
---
Paul,

I based the patch on top of your reset/data cleanup series
for hwmod. So its based on 'hwmod_data_cleanup_3.4' branch.

regards,
Rajendra

 arch/arm/mach-omap2/omap_hwmod.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 3462dc5..6aadba2 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -1524,7 +1524,7 @@ static int _read_hardreset(struct omap_hwmod *oh, const char *name)
  */
 static int _ocp_softreset(struct omap_hwmod *oh)
 {
-	u32 v;
+	u32 v, softrst_mask;
 	int c = 0;
 	int ret = 0;
 
@@ -1559,11 +1559,13 @@ static int _ocp_softreset(struct omap_hwmod *oh)
 						    oh->class->sysc->syss_offs)
 				   & SYSS_RESETDONE_MASK),
 				  MAX_MODULE_SOFTRESET_WAIT, c);
-	else if (oh->class->sysc->sysc_flags & SYSC_HAS_RESET_STATUS)
+	else if (oh->class->sysc->sysc_flags & SYSC_HAS_RESET_STATUS) {
+		softrst_mask = (0x1 << oh->class->sysc->sysc_fields->srst_shift);
 		omap_test_timeout(!(omap_hwmod_read(oh,
 						     oh->class->sysc->sysc_offs)
-				   & SYSC_TYPE2_SOFTRESET_MASK),
+				   & softrst_mask),
 				  MAX_MODULE_SOFTRESET_WAIT, c);
+	}
 
 	if (c == MAX_MODULE_SOFTRESET_WAIT)
 		pr_warning("omap_hwmod: %s: softreset failed (waited %d usec)\n",
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ARM: OMAP: hwmod: Use sysc_fields->srst_shift and get rid of hardcoded SYSC_TYPE2_SOFTRESET_MASK
  2012-03-01 13:47 [PATCH] ARM: OMAP: hwmod: Use sysc_fields->srst_shift and get rid of hardcoded SYSC_TYPE2_SOFTRESET_MASK Rajendra Nayak
@ 2012-03-01 14:08 ` Cousson, Benoit
  2012-03-02  1:08 ` Paul Walmsley
  1 sibling, 0 replies; 3+ messages in thread
From: Cousson, Benoit @ 2012-03-01 14:08 UTC (permalink / raw)
  To: Rajendra Nayak; +Cc: linux-omap, linux-arm-kernel, Paul Walmsley, Balaji TK

On 3/1/2012 2:47 PM, Rajendra Nayak wrote:
> This is useful when we have broken type2 compliant IPs' where
> the softreset shift is not the same as SYSC_TYPE2_SOFTRESET_SHIFT
> and hence is overridden using sysc_fields->srst_shift.
>
> We have atleast one such instance now with onchip keypad on OMAP5

Nit: space is missing.

> which has a different softreset shift as compared to other type2
> IPs'.

A broken IP again :-)

That's anyway a good fix since the srst_shift was already configurable, 
so having a hard-coded mask was wrong or at least error prone for non 
standard IP.

> Signed-off-by: Rajendra Nayak<rnayak@ti.com>
> Cc: Paul Walmsley<paul@pwsan.com>
> Cc: Benoit Cousson<b-cousson@ti.com>
> Cc: Balaji TK<balajitk@ti.com>
> Tested-by: Sourav Poddar<sourav.poddar@ti.com>
> ---
> Paul,
>
> I based the patch on top of your reset/data cleanup series
> for hwmod. So its based on 'hwmod_data_cleanup_3.4' branch.
>
> regards,
> Rajendra
>
>   arch/arm/mach-omap2/omap_hwmod.c |    8 +++++---
>   1 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
> index 3462dc5..6aadba2 100644
> --- a/arch/arm/mach-omap2/omap_hwmod.c
> +++ b/arch/arm/mach-omap2/omap_hwmod.c
> @@ -1524,7 +1524,7 @@ static int _read_hardreset(struct omap_hwmod *oh, const char *name)
>    */
>   static int _ocp_softreset(struct omap_hwmod *oh)
>   {
> -	u32 v;
> +	u32 v, softrst_mask;
>   	int c = 0;
>   	int ret = 0;
>
> @@ -1559,11 +1559,13 @@ static int _ocp_softreset(struct omap_hwmod *oh)
>   						    oh->class->sysc->syss_offs)
>   				&  SYSS_RESETDONE_MASK),
>   				  MAX_MODULE_SOFTRESET_WAIT, c);
> -	else if (oh->class->sysc->sysc_flags&  SYSC_HAS_RESET_STATUS)
> +	else if (oh->class->sysc->sysc_flags&  SYSC_HAS_RESET_STATUS) {
> +		softrst_mask = (0x1<<  oh->class->sysc->sysc_fields->srst_shift);
>   		omap_test_timeout(!(omap_hwmod_read(oh,
>   						     oh->class->sysc->sysc_offs)
> -				&  SYSC_TYPE2_SOFTRESET_MASK),
> +				&  softrst_mask),
>   				  MAX_MODULE_SOFTRESET_WAIT, c);
> +	}
>
>   	if (c == MAX_MODULE_SOFTRESET_WAIT)
>   		pr_warning("omap_hwmod: %s: softreset failed (waited %d usec)\n",

Acked-by: Benoit Cousson<b-cousson@ti.com>

Thanks,
Benoit


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ARM: OMAP: hwmod: Use sysc_fields->srst_shift and get rid of hardcoded SYSC_TYPE2_SOFTRESET_MASK
  2012-03-01 13:47 [PATCH] ARM: OMAP: hwmod: Use sysc_fields->srst_shift and get rid of hardcoded SYSC_TYPE2_SOFTRESET_MASK Rajendra Nayak
  2012-03-01 14:08 ` Cousson, Benoit
@ 2012-03-02  1:08 ` Paul Walmsley
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Walmsley @ 2012-03-02  1:08 UTC (permalink / raw)
  To: Rajendra Nayak; +Cc: linux-omap, linux-arm-kernel, Benoit Cousson, Balaji TK

[-- Attachment #1: Type: TEXT/PLAIN, Size: 803 bytes --]

On Thu, 1 Mar 2012, Rajendra Nayak wrote:

> This is useful when we have broken type2 compliant IPs' where
> the softreset shift is not the same as SYSC_TYPE2_SOFTRESET_SHIFT
> and hence is overridden using sysc_fields->srst_shift.
> 
> We have atleast one such instance now with onchip keypad on OMAP5
> which has a different softreset shift as compared to other type2
> IPs'.
> 
> Signed-off-by: Rajendra Nayak <rnayak@ti.com>
> Cc: Paul Walmsley <paul@pwsan.com>
> Cc: Benoit Cousson <b-cousson@ti.com>
> Cc: Balaji TK  <balajitk@ti.com>
> Tested-by: Sourav Poddar <sourav.poddar@ti.com>
> ---
> Paul,
> 
> I based the patch on top of your reset/data cleanup series
> for hwmod. So its based on 'hwmod_data_cleanup_3.4' branch.

Thanks, Benoît's ack added and queued.


- Paul

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-03-02  1:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-01 13:47 [PATCH] ARM: OMAP: hwmod: Use sysc_fields->srst_shift and get rid of hardcoded SYSC_TYPE2_SOFTRESET_MASK Rajendra Nayak
2012-03-01 14:08 ` Cousson, Benoit
2012-03-02  1:08 ` Paul Walmsley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).