linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] microblaze: improve failure handling for GPIO reset
@ 2012-08-08 18:43 Stephan Linz
  2012-08-22  6:02 ` Peter Crosthwaite
  0 siblings, 1 reply; 3+ messages in thread
From: Stephan Linz @ 2012-08-08 18:43 UTC (permalink / raw)
  To: monstr; +Cc: microblaze-uclinux, linux-kernel, Stephan Linz

Early exit from of_platform_reset_gpio_probe() if there
was no GPIO reset line configured.

Avoid kernel oops in gpio_system_reset():

[   96.603690] Restarting system.
[   96.606094] Machine restart...
[   96.608810] Oops: kernel access of bad area, sig: 11
[   96.613662]  Registers dump: mode=824C1D1C
[   96.617858]  r1=C000BB0C, r2=00000000, r3=FFFFFEF8, r4=000015B4
[   96.623736]  r5=C0276270, r6=00000001, r7=FFFFFFFF, r8=000015B4
[   96.629597]  r9=000015B3, r10=000015B4, r11=00000000, r12=00000000
[   96.635733]  r13=00000000, r14=0000000F, r15=C0002B04, r16=00000000
[   96.641973]  r17=C011E1A0, r18=80000115, r19=00000010, r20=48184ED8
[   96.648184]  r21=00000000, r22=FFFFFFEA, r23=00000001, r24=FEE1DEAD
[   96.654396]  r25=00000054, r26=1000B1C8, r27=00000000, r28=00000000
[   96.660622]  r29=00000000, r30=00000000, r31=C24A97E0, rPC=C011E1A0
[   96.666849]  msr=000042A2, ear=0000004C, esr=00000872, fsr=362E3639

Signed-off-by: Stephan Linz <linz@li-pro.net>
---
v2 Remove additional printk message from machine_restart()
---
 arch/microblaze/kernel/reset.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/arch/microblaze/kernel/reset.c b/arch/microblaze/kernel/reset.c
index 8d663d9..c021123 100644
--- a/arch/microblaze/kernel/reset.c
+++ b/arch/microblaze/kernel/reset.c
@@ -28,6 +28,7 @@ void of_platform_reset_gpio_probe(void)
 	if (!gpio_is_valid(handle)) {
 		printk(KERN_INFO "Skipping unavailable RESET gpio %d (%s)\n",
 				handle, "reset");
+		return;
 	}
 
 	ret = gpio_request(handle, "reset");
@@ -60,7 +61,10 @@ err:
 
 static void gpio_system_reset(void)
 {
-	gpio_set_value(handle, 1 - reset_val);
+	if (gpio_is_valid(handle))
+		gpio_set_value(handle, 1 - reset_val);
+	else
+		printk(KERN_NOTICE "Reset GPIO unavailable - halting!\n");
 }
 #else
 static void gpio_system_reset(void)
-- 
1.7.0.4


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

* Re: [PATCH v2] microblaze: improve failure handling for GPIO reset
  2012-08-08 18:43 [PATCH v2] microblaze: improve failure handling for GPIO reset Stephan Linz
@ 2012-08-22  6:02 ` Peter Crosthwaite
  2012-08-24  8:53   ` Michal Simek
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Crosthwaite @ 2012-08-22  6:02 UTC (permalink / raw)
  To: Stephan Linz; +Cc: monstr, microblaze-uclinux, linux-kernel

On Thu, Aug 9, 2012 at 4:43 AM, Stephan Linz <linz@li-pro.net> wrote:
> Early exit from of_platform_reset_gpio_probe() if there
> was no GPIO reset line configured.
>
> Avoid kernel oops in gpio_system_reset():
>
> [   96.603690] Restarting system.
> [   96.606094] Machine restart...
> [   96.608810] Oops: kernel access of bad area, sig: 11
> [   96.613662]  Registers dump: mode=824C1D1C
> [   96.617858]  r1=C000BB0C, r2=00000000, r3=FFFFFEF8, r4=000015B4
> [   96.623736]  r5=C0276270, r6=00000001, r7=FFFFFFFF, r8=000015B4
> [   96.629597]  r9=000015B3, r10=000015B4, r11=00000000, r12=00000000
> [   96.635733]  r13=00000000, r14=0000000F, r15=C0002B04, r16=00000000
> [   96.641973]  r17=C011E1A0, r18=80000115, r19=00000010, r20=48184ED8
> [   96.648184]  r21=00000000, r22=FFFFFFEA, r23=00000001, r24=FEE1DEAD
> [   96.654396]  r25=00000054, r26=1000B1C8, r27=00000000, r28=00000000
> [   96.660622]  r29=00000000, r30=00000000, r31=C24A97E0, rPC=C011E1A0
> [   96.666849]  msr=000042A2, ear=0000004C, esr=00000872, fsr=362E3639
>
> Signed-off-by: Stephan Linz <linz@li-pro.net>

Tested-by: Peter Crosthwaite <peter.crosthwaite@petalogix.com>

> ---
> v2 Remove additional printk message from machine_restart()
> ---
>  arch/microblaze/kernel/reset.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/arch/microblaze/kernel/reset.c b/arch/microblaze/kernel/reset.c
> index 8d663d9..c021123 100644
> --- a/arch/microblaze/kernel/reset.c
> +++ b/arch/microblaze/kernel/reset.c
> @@ -28,6 +28,7 @@ void of_platform_reset_gpio_probe(void)
>         if (!gpio_is_valid(handle)) {
>                 printk(KERN_INFO "Skipping unavailable RESET gpio %d (%s)\n",
>                                 handle, "reset");
> +               return;
>         }
>
>         ret = gpio_request(handle, "reset");
> @@ -60,7 +61,10 @@ err:
>
>  static void gpio_system_reset(void)
>  {
> -       gpio_set_value(handle, 1 - reset_val);
> +       if (gpio_is_valid(handle))
> +               gpio_set_value(handle, 1 - reset_val);
> +       else
> +               printk(KERN_NOTICE "Reset GPIO unavailable - halting!\n");
>  }
>  #else
>  static void gpio_system_reset(void)
> --
> 1.7.0.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

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

* Re: [PATCH v2] microblaze: improve failure handling for GPIO reset
  2012-08-22  6:02 ` Peter Crosthwaite
@ 2012-08-24  8:53   ` Michal Simek
  0 siblings, 0 replies; 3+ messages in thread
From: Michal Simek @ 2012-08-24  8:53 UTC (permalink / raw)
  To: Peter Crosthwaite; +Cc: Stephan Linz, microblaze-uclinux, linux-kernel

On 08/22/2012 08:02 AM, Peter Crosthwaite wrote:
> On Thu, Aug 9, 2012 at 4:43 AM, Stephan Linz <linz@li-pro.net> wrote:
>> Early exit from of_platform_reset_gpio_probe() if there
>> was no GPIO reset line configured.
>>
>> Avoid kernel oops in gpio_system_reset():
>>
>> [   96.603690] Restarting system.
>> [   96.606094] Machine restart...
>> [   96.608810] Oops: kernel access of bad area, sig: 11
>> [   96.613662]  Registers dump: mode=824C1D1C
>> [   96.617858]  r1=C000BB0C, r2=00000000, r3=FFFFFEF8, r4=000015B4
>> [   96.623736]  r5=C0276270, r6=00000001, r7=FFFFFFFF, r8=000015B4
>> [   96.629597]  r9=000015B3, r10=000015B4, r11=00000000, r12=00000000
>> [   96.635733]  r13=00000000, r14=0000000F, r15=C0002B04, r16=00000000
>> [   96.641973]  r17=C011E1A0, r18=80000115, r19=00000010, r20=48184ED8
>> [   96.648184]  r21=00000000, r22=FFFFFFEA, r23=00000001, r24=FEE1DEAD
>> [   96.654396]  r25=00000054, r26=1000B1C8, r27=00000000, r28=00000000
>> [   96.660622]  r29=00000000, r30=00000000, r31=C24A97E0, rPC=C011E1A0
>> [   96.666849]  msr=000042A2, ear=0000004C, esr=00000872, fsr=362E3639
>>
>> Signed-off-by: Stephan Linz <linz@li-pro.net>
>
> Tested-by: Peter Crosthwaite <peter.crosthwaite@petalogix.com>
>
>> ---
>> v2 Remove additional printk message from machine_restart()
>> ---
>>   arch/microblaze/kernel/reset.c |    6 +++++-
>>   1 files changed, 5 insertions(+), 1 deletions(-)

I have added it to my next branch to the previous patch.

Thanks,
Michal


-- 
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-08 18:43 [PATCH v2] microblaze: improve failure handling for GPIO reset Stephan Linz
2012-08-22  6:02 ` Peter Crosthwaite
2012-08-24  8:53   ` Michal Simek

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).