All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: qemu-devel@nongnu.org
Cc: Guenter Roeck <linux@roeck-us.net>
Subject: [Qemu-devel] [PATCH] hw/arm/pxa2xx: Correctly handle external GPIO reset requests
Date: Mon, 24 Oct 2016 19:06:52 -0700	[thread overview]
Message-ID: <1477361212-18833-1-git-send-email-linux@roeck-us.net> (raw)

The internal GPIO reset, enabled with GPR_EN, only applies to GPIO pin 1.
If other GPIO pins are used for reset, this is unrelated to GPR_EN, the
reset is an external reset pin, and it resets the entire system.

This fixes GPIO reset failures seen with various PXA270 emulations (akita,
borzoi, spitz, tosa, terrier) when running Linux.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 hw/arm/pxa2xx.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c
index cb55704..2a2a821 100644
--- a/hw/arm/pxa2xx.c
+++ b/hw/arm/pxa2xx.c
@@ -2048,10 +2048,18 @@ static void pxa2xx_reset(void *opaque, int line, int level)
 {
     PXA2xxState *s = (PXA2xxState *) opaque;
 
-    if (level && (s->pm_regs[PCFR >> 2] & 0x10)) {	/* GPR_EN */
+    /*
+     * GPIO pin 1 is the CPU internal GPIO reset, enabled with GPR_EN.
+     * Any other pin is board specific and resets the entire system.
+     */
+    if (line == 1 && level && (s->pm_regs[PCFR >> 2] & 0x10)) {	/* GPR_EN */
         cpu_reset(CPU(s->cpu));
         /* TODO: reset peripherals */
     }
+
+    if (line != 1 && level) {
+        qemu_system_reset_request();
+    }
 }
 
 /* Initialise a PXA270 integrated chip (ARM based core).  */
-- 
2.5.0

             reply	other threads:[~2016-10-25  2:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-25  2:06 Guenter Roeck [this message]
2016-10-25  5:36 ` [Qemu-devel] [PATCH] hw/arm/pxa2xx: Correctly handle external GPIO reset requests no-reply
2016-10-25 11:49 ` Peter Maydell
2016-10-25 13:27   ` Guenter Roeck
2016-10-25 13:40     ` Peter Maydell
2016-10-25 18:21       ` Guenter Roeck
2016-10-27 14:34         ` Peter Maydell
2016-10-27 19:09           ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1477361212-18833-1-git-send-email-linux@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.