All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] nrf51: Fix last GPIO CNF address
@ 2020-04-06 22:55 Cameron Esfahani via
  2020-04-07  6:49 ` Cédric Le Goater
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Cameron Esfahani via @ 2020-04-06 22:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: joel, peter.maydell, clg, philmd, kraxel

NRF51_GPIO_REG_CNF_END doesn't actually refer to the start of the last
valid CNF register: it's referring to the last byte of the last valid
CNF register.

This hasn't been a problem up to now, as current implementation in
memory.c turns an unaligned 4-byte read from 0x77f to a single byte read
and the qtest only looks at the least-significant byte of the register.

But, when running with Cedric Le Goater's <clg@kaod.org> pending fix for
unaligned accesses in memory.c, the qtest breaks.

Considering NRF51 doesn't support unaligned accesses, the simplest fix
is to actually set NRF51_GPIO_REG_CNF_END to the start of the last valid
CNF register: 0x77c.

Now, qtests work with or without Cedric's patch.

Signed-off-by: Cameron Esfahani <dirty@apple.com>
---
 include/hw/gpio/nrf51_gpio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/hw/gpio/nrf51_gpio.h b/include/hw/gpio/nrf51_gpio.h
index 337ee534bb..1d62bbc928 100644
--- a/include/hw/gpio/nrf51_gpio.h
+++ b/include/hw/gpio/nrf51_gpio.h
@@ -42,7 +42,7 @@
 #define NRF51_GPIO_REG_DIRSET       0x518
 #define NRF51_GPIO_REG_DIRCLR       0x51C
 #define NRF51_GPIO_REG_CNF_START    0x700
-#define NRF51_GPIO_REG_CNF_END      0x77F
+#define NRF51_GPIO_REG_CNF_END      0x77C
 
 #define NRF51_GPIO_PULLDOWN 1
 #define NRF51_GPIO_PULLUP 3
-- 
2.24.0



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

end of thread, other threads:[~2020-04-14  8:59 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-06 22:55 [PATCH v1] nrf51: Fix last GPIO CNF address Cameron Esfahani via
2020-04-07  6:49 ` Cédric Le Goater
2020-04-07  8:40 ` Peter Maydell
2020-04-07  8:45   ` Joel Stanley
2020-04-07  8:50     ` Peter Maydell
2020-04-10  3:42       ` Andrew Jeffery
2020-04-10 12:26         ` Peter Maydell
2020-04-10 13:35           ` Andrew Jeffery
2020-04-07  8:44 ` Philippe Mathieu-Daudé
2020-04-07 10:09   ` Cameron Esfahani via
2020-04-14  8:56     ` Joel Stanley

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.