diff mbox series

[2/4] hw/arm/nrf51_soc: Mark some peripherals as unimplemented

Message ID 20200504072822.18799-3-f4bug@amsat.org
State New
Headers show
Series hw/arm/nrf51: Extend tracing | expand

Commit Message

Philippe Mathieu-Daudé May 4, 2020, 7:28 a.m. UTC
Map some peripherals used by Zephyr Project:

https://github.com/zephyrproject-rtos/zephyr/blob/zephyr-v2.2.0/dts/arm/nordic/nrf51822.dtsi

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/hw/arm/nrf51.h |  4 ++++
 hw/arm/nrf51_soc.c     | 11 +++++++++++
 2 files changed, 15 insertions(+)

Comments

Richard Henderson May 4, 2020, 5:13 p.m. UTC | #1
On 5/4/20 12:28 AM, Philippe Mathieu-Daudé wrote:
> Map some peripherals used by Zephyr Project:
> 
> https://github.com/zephyrproject-rtos/zephyr/blob/zephyr-v2.2.0/dts/arm/nordic/nrf51822.dtsi
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  include/hw/arm/nrf51.h |  4 ++++
>  hw/arm/nrf51_soc.c     | 11 +++++++++++
>  2 files changed, 15 insertions(+)

There's a fair few more devices listed in the manual, and not all of the ones
that you add here are referenced in the dts files.  So what criteria are you
using to choose?

Perhaps it would be easier to add them all?


r~
Philippe Mathieu-Daudé May 4, 2020, 5:43 p.m. UTC | #2
+Ioannis

On 5/4/20 7:13 PM, Richard Henderson wrote:
> On 5/4/20 12:28 AM, Philippe Mathieu-Daudé wrote:
>> Map some peripherals used by Zephyr Project:
>>
>> https://github.com/zephyrproject-rtos/zephyr/blob/zephyr-v2.2.0/dts/arm/nordic/nrf51822.dtsi
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>>   include/hw/arm/nrf51.h |  4 ++++
>>   hw/arm/nrf51_soc.c     | 11 +++++++++++
>>   2 files changed, 15 insertions(+)
> 
> There's a fair few more devices listed in the manual, and not all of the ones
> that you add here are referenced in the dts files.  So what criteria are you
> using to choose?

Fair question :)

The board DTS [1] ends pulling in nrf51822.dtsi.

To be able to use the soft PWM declared in [2] and implemented in [3] 
(with timers and gpios), I added this commit on top:

https://gitlab.com/philmd/zephyr/-/commit/90b081cf79

But I won't send a pullrequest to Zephyr until the PPI is properly 
implemented in QEMU.

[1] 
https://github.com/zephyrproject-rtos/zephyr/blob/zephyr-v2.2.0/boards/arm/qemu_cortex_m0/qemu_cortex_m0.dts
[2] 
https://github.com/zephyrproject-rtos/zephyr/blob/zephyr-v2.2.0/dts/arm/nordic/nrf5_common.dtsi
[3] 
https://github.com/zephyrproject-rtos/zephyr/blob/zephyr-v2.2.0/drivers/pwm/pwm_nrf5_sw.c

> 
> Perhaps it would be easier to add them all?

Or better document this commit ;)

> 
> 
> r~
> 
> 
>
diff mbox series

Patch

diff --git a/include/hw/arm/nrf51.h b/include/hw/arm/nrf51.h
index de836beaa4..46d0cfc7a1 100644
--- a/include/hw/arm/nrf51.h
+++ b/include/hw/arm/nrf51.h
@@ -25,11 +25,15 @@ 
 #define NRF51_IOMEM_SIZE      0x20000000
 
 #define NRF51_PERIPHERAL_SIZE 0x00001000
+#define NRF51_RADIO_BASE      0x40001000
 #define NRF51_UART_BASE       0x40002000
 #define NRF51_TWI_BASE        0x40003000
+#define NRF51_GPIOTE_BASE     0x40006000
 #define NRF51_TIMER_BASE      0x40008000
+#define NRF51_TEMP_BASE       0x4000c000
 #define NRF51_RNG_BASE        0x4000D000
 #define NRF51_NVMC_BASE       0x4001E000
+#define NRF51_PPI_BASE        0x4001f000
 #define NRF51_GPIO_BASE       0x50000000
 
 #define NRF51_PRIVATE_BASE    0xF0000000
diff --git a/hw/arm/nrf51_soc.c b/hw/arm/nrf51_soc.c
index e50473fd19..6212c5cb53 100644
--- a/hw/arm/nrf51_soc.c
+++ b/hw/arm/nrf51_soc.c
@@ -170,6 +170,17 @@  static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
     memory_region_add_subregion_overlap(&s->container,
                                         NRF51_IOMEM_BASE, &s->clock, -1);
 
+    create_unimplemented_device("nrf51_soc.radio", NRF51_RADIO_BASE,
+                                NRF51_PERIPHERAL_SIZE);
+    create_unimplemented_device("nrf51_soc.uarte", NRF51_UART_BASE,
+                                NRF51_PERIPHERAL_SIZE);
+    create_unimplemented_device("nrf51_soc.gpiote", NRF51_GPIOTE_BASE,
+                                NRF51_PERIPHERAL_SIZE);
+    create_unimplemented_device("nrf51_soc.temp", NRF51_TEMP_BASE,
+                                NRF51_PERIPHERAL_SIZE);
+    create_unimplemented_device("nrf51_soc.ppi", NRF51_PPI_BASE,
+                                NRF51_PERIPHERAL_SIZE);
+
     create_unimplemented_device("nrf51_soc.io", NRF51_IOMEM_BASE,
                                 NRF51_IOMEM_SIZE);
     create_unimplemented_device("nrf51_soc.private",