All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Gilles Grimaud <gilles.grimaud@univ-lille.fr>
Cc: qemu-devel@nongnu.org,  qemu-arm@nongnu.org,
	 Paolo Bonzini <pbonzini@redhat.com>,
	 Peter Maydell <peter.maydell@linaro.org>,
	 Fabiano Rosas <farosas@suse.de>,
	 Laurent Vivier <lvivier@redhat.com>
Subject: Re: [PATCH RFC v2 07/30] hw/misc: add RP2040 TBMAN and voltage regulator
Date: Wed, 02 Sep 2026 11:23:01 +0100	[thread overview]
Message-ID: <87bjagrlyy.fsf@draig.linaro.org> (raw)
In-Reply-To: <20260829234308.33725-8-gilles.grimaud@univ-lille.fr> (Gilles Grimaud's message of "Sun, 30 Aug 2026 01:42:41 +0200")

Gilles Grimaud <gilles.grimaud@univ-lille.fr> writes:

> From: gilles grimaud <gilles.grimaud@univ-lille.fr>
>
> Replace the TBMAN and VREG/chip-reset placeholders with the RP2040 register models from the development tree. Expose the ASIC platform indication, documented reset values, write masks, regulator status, and APB atomic aliases.\n\nAdd focused qtests for both blocks.
>
> Signed-off-by: gilles grimaud <gilles.grimaud@univ-lille.fr>
> ---
>  hw/arm/Kconfig                  |   2 +
>  hw/arm/rp2040.c                 |  14 ++-
>  hw/misc/Kconfig                 |   6 ++
>  hw/misc/meson.build             |   2 +
>  hw/misc/rp2040_tbman.c          |  92 +++++++++++++++++
>  hw/misc/rp2040_vreg.c           | 178 ++++++++++++++++++++++++++++++++
>  include/hw/arm/rp2040.h         |   4 +
>  include/hw/misc/rp2040_tbman.h  |  25 +++++
>  include/hw/misc/rp2040_vreg.h   |  28 +++++
>  tests/qtest/meson.build         |   4 +-
>  tests/qtest/rp2040-tbman-test.c |  32 ++++++
>  tests/qtest/rp2040-vreg-test.c  |  79 ++++++++++++++
>  12 files changed, 463 insertions(+), 3 deletions(-)
>  create mode 100644 hw/misc/rp2040_tbman.c
>  create mode 100644 hw/misc/rp2040_vreg.c
>  create mode 100644 include/hw/misc/rp2040_tbman.h
>  create mode 100644 include/hw/misc/rp2040_vreg.h
>  create mode 100644 tests/qtest/rp2040-tbman-test.c
>  create mode 100644 tests/qtest/rp2040-vreg-test.c
>
<snip>
> new file mode 100644
> index 0000000000..e8480fc258
> --- /dev/null
> +++ b/hw/misc/rp2040_vreg.c
> @@ -0,0 +1,178 @@
> +/*
> + * RP2040 voltage regulator and chip reset emulation
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +#include "qemu/osdep.h"
> +#include "hw/misc/rp2040_nyi.h"
> +#include "hw/misc/rp2040_vreg.h"
> +#include "migration/vmstate.h"
> +#include "qemu/module.h"
> +
> +#define VREG_VREG          0x00
> +#define VREG_BOD           0x04
> +#define VREG_CHIP_RESET    0x08
> +
> +#define VREG_ROK           BIT(12)
> +#define VREG_VSEL_MASK     0x000000f0
> +#define VREG_HIZ           BIT(1)
> +#define VREG_EN            BIT(0)
> +#define VREG_RW_MASK       (VREG_VSEL_MASK | VREG_HIZ | VREG_EN)
> +#define VREG_RESET         0x000000b1
> +
> +#define BOD_VSEL_MASK      0x000000f0
> +#define BOD_EN             BIT(0)
> +#define BOD_RW_MASK        (BOD_VSEL_MASK | BOD_EN)
> +#define BOD_RESET          0x00000091
> +
> +#define CHIP_RESET_RW_MASK 0x01000000
> +
> +#define ATOMIC_ALIAS_MASK  0x3000
> +#define ATOMIC_XOR         0x1000
> +#define ATOMIC_SET         0x2000
> +#define ATOMIC_CLR         0x3000
> +
<snip>
> diff --git a/tests/qtest/rp2040-vreg-test.c b/tests/qtest/rp2040-vreg-test.c
> new file mode 100644
> index 0000000000..b08bb16765
> --- /dev/null
> +++ b/tests/qtest/rp2040-vreg-test.c
> @@ -0,0 +1,79 @@
> +/*
> + * QTest testcase for the RP2040 vreg_and_chip_reset block.
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +#include "qemu/osdep.h"
> +#include "libqtest.h"
> +#include "qemu/bitops.h"
> +
> +#define VREG_BASE           0x40064000
> +#define VREG_VREG           0x00
> +#define VREG_BOD            0x04
> +#define VREG_CHIP_RESET     0x08
> +
> +#define VREG_ROK            BIT(12)
> +#define VREG_RESET          0x000000b1
> +#define BOD_RESET           0x00000091
> +#define CHIP_RESET_RESCUE   BIT(24)
> +
> +#define ATOMIC_SET_ALIAS    0x2000
> +#define ATOMIC_CLR_ALIAS    0x3000

You don't need this duplication. qtest's can include QEMU headers.

As an aside you might want to look at the hw/core/registerfields.h
helpers which are good for defining registers and their fields and
generate the helpers for you.

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


  reply	other threads:[~2026-09-02 10:23 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-29 23:42 [PATCH RFC v2 00/30] arm: add Raspberry Pi Pico/RP2040 machine Gilles Grimaud
2026-08-29 23:42 ` [PATCH RFC v2 01/30] target/arm: support Cortex-M0+ MPU Gilles Grimaud
2026-09-01 17:52   ` Alex Bennée
2026-09-01 19:23     ` Peter Maydell
2026-08-29 23:42 ` [PATCH RFC v2 02/30] hw/char/pl011: expose DMA request outputs Gilles Grimaud
2026-08-29 23:42 ` [PATCH RFC v2 03/30] hw/misc: add RP2040 diagnostic helpers Gilles Grimaud
2026-09-01 18:30   ` Alex Bennée
2026-09-01 22:12     ` gilles grimaud
2026-08-29 23:42 ` [PATCH RFC v2 04/30] hw/arm: add RP2040 SoC and Raspberry Pi Pico machine Gilles Grimaud
2026-09-01 18:33   ` Alex Bennée
2026-09-01 22:33     ` gilles grimaud
2026-08-29 23:42 ` [PATCH RFC v2 05/30] tests/tcg/arm: add Raspberry Pi Pico smoke tests Gilles Grimaud
2026-09-01 18:35   ` Alex Bennée
2026-08-29 23:42 ` [PATCH RFC v2 06/30] hw/misc: add RP2040 SYSINFO and SYSCFG Gilles Grimaud
2026-09-01 18:44   ` Alex Bennée
2026-09-01 23:29     ` gilles grimaud
2026-09-02 10:13       ` Alex Bennée
2026-08-29 23:42 ` [PATCH RFC v2 07/30] hw/misc: add RP2040 TBMAN and voltage regulator Gilles Grimaud
2026-09-02 10:23   ` Alex Bennée [this message]
2026-09-04  9:33     ` gilles grimaud
2026-08-29 23:42 ` [PATCH RFC v2 08/30] hw/misc: add RP2040 crystal and ring oscillators Gilles Grimaud
2026-09-02 10:25   ` Alex Bennée
2026-09-04  9:36     ` gilles grimaud
2026-08-29 23:42 ` [PATCH RFC v2 09/30] hw/misc: add RP2040 PLL and clock controller Gilles Grimaud
2026-09-02 10:30   ` Alex Bennée
2026-09-04 14:46     ` gilles grimaud
2026-08-29 23:42 ` [PATCH RFC v2 10/30] hw/misc: add RP2040 reset and power state controllers Gilles Grimaud
2026-08-29 23:42 ` [PATCH RFC v2 11/30] hw/misc: add RP2040 watchdog Gilles Grimaud
2026-08-29 23:42 ` [PATCH RFC v2 12/30] hw/misc: add RP2040 pad controls Gilles Grimaud
2026-08-29 23:42 ` [PATCH RFC v2 13/30] hw/misc: add RP2040 IO_BANK0 Gilles Grimaud
2026-08-29 23:42 ` [PATCH RFC v2 14/30] hw/misc: add RP2040 IO_QSPI Gilles Grimaud
2026-08-30  6:15 ` [PATCH RFC v2 15/30] hw/char: integrate RP2040 UART pinmux Gilles Grimaud
2026-08-30  6:15 ` [PATCH RFC v2 16/30] hw/misc: add RP2040 SIO and multicore support Gilles Grimaud
2026-08-30  6:15 ` [PATCH RFC v2 17/30] tests/tcg/arm: test RP2040 SIO and multicore Gilles Grimaud
2026-08-30  6:15 ` [PATCH RFC v2 18/30] hw/timer: add RP2040 timer and alarms Gilles Grimaud
2026-08-30  6:15 ` [PATCH RFC v2 19/30] tests/tcg/arm: test RP2040 timer alarm interrupt Gilles Grimaud
2026-08-30  6:15 ` [PATCH RFC v2 20/30] hw/ssi: add RP2040 XIP flash controller Gilles Grimaud
2026-08-30  6:15 ` [PATCH RFC v2 21/30] tests/tcg/arm: test RP2040 flash and XIP behavior Gilles Grimaud
2026-08-30  6:15 ` [PATCH RFC v2 22/30] hw/dma: add RP2040 DMA controller Gilles Grimaud
2026-08-30  6:15 ` [PATCH RFC v2 23/30] tests/tcg/arm: test RP2040 DMA transfers Gilles Grimaud
2026-08-30  6:15 ` [PATCH RFC v2 24/30] hw/ssi: load RP2040 UF2 flash images Gilles Grimaud
2026-08-30  6:15 ` [PATCH RFC v2 25/30] hw/misc: add RP2040 bus controller Gilles Grimaud
2026-08-30  6:15 ` [PATCH RFC v2 26/30] hw/arm: add shallow RP2040 USB controller Gilles Grimaud
2026-08-30  6:15 ` [PATCH RFC v2 27/30] hw/arm: add RP2040 synthetic boot ROM service tables Gilles Grimaud
2026-08-30  6:15 ` [PATCH RFC v2 28/30] hw/arm: add RP2040 synthetic boot ROM accelerated helpers Gilles Grimaud
2026-08-30  6:16 ` [PATCH RFC v2 29/30] hw/arm: add optional Pico SDK exit handling Gilles Grimaud
2026-08-30  6:16 ` [PATCH RFC v2 30/30] docs/system/arm: document Raspberry Pi Pico Gilles Grimaud
2026-09-02 12:01   ` Alex Bennée
2026-09-02 13:20 ` [PATCH RFC v2 00/30] arm: add Raspberry Pi Pico/RP2040 machine Alex Bennée

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=87bjagrlyy.fsf@draig.linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=farosas@suse.de \
    --cc=gilles.grimaud@univ-lille.fr \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --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.