[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 05/13] hw/gpio/imx_gpio: Don't clear input GPIO values upo
From: |
Peter Maydell |
Subject: |
Re: [PATCH v2 05/13] hw/gpio/imx_gpio: Don't clear input GPIO values upon reset |
Date: |
Mon, 27 Jan 2025 13:47:52 +0000 |
On Sat, 11 Jan 2025 at 18:37, Bernhard Beschow <shentey@gmail.com> wrote:
>
> Input GPIO values such as a present SD card may get notified before the GPIO
> controller itself gets reset. Claring the input values thus loses data.
> Assuming
> that input GPIO events are only fired when the state changes, the input values
> shouldn't be reset.
>
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
> hw/gpio/imx_gpio.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/hw/gpio/imx_gpio.c b/hw/gpio/imx_gpio.c
> index 898f80f8c8..67c47a7280 100644
> --- a/hw/gpio/imx_gpio.c
> +++ b/hw/gpio/imx_gpio.c
> @@ -302,7 +302,6 @@ static void imx_gpio_reset(DeviceState *dev)
>
> s->dr = 0;
> s->gdir = 0;
> - s->psr = 0;
> s->icr = 0;
> s->imr = 0;
> s->isr = 0;
I guess so; we really don't do a good job of consistency about
how to handle GPIO lines that might be high on reset.
The other approach to this would be:
* devices on both ends implement three-phase reset
* device that has the GPIO line high on reset should ensure
it does the qemu_set_irq() for that in the reset "exit" phase
* device on the input end should:
- clear the input-data state to 0 in the "hold" phase
- ensure that its qemu_irq callback function does the
right thing if it's called during an "exit" phase
(probably needs no code changes)
That is more "what my mental model of the right thing is"
rather than something we actually do in many (any?) devices
today, though.
thanks
-- PMM
- Re: [PATCH v2 04/13] hw/pci-host/designware: Expose MSI IRQ, (continued)
- [PATCH v2 03/13] hw/char/imx_serial: Update all state before restarting ageing timer, Bernhard Beschow, 2025/01/11
- [PATCH v2 06/13] hw/sd/sd: Remove legacy sd_set_cb() in favor of GPIOs, Bernhard Beschow, 2025/01/11
- [PATCH v2 05/13] hw/gpio/imx_gpio: Don't clear input GPIO values upon reset, Bernhard Beschow, 2025/01/11
- Re: [PATCH v2 05/13] hw/gpio/imx_gpio: Don't clear input GPIO values upon reset,
Peter Maydell <=
- [PATCH v2 07/13] hw/sd/sd: Allow for inverting polarities of presence and write-protect GPIOs, Bernhard Beschow, 2025/01/11
- [PATCH v2 08/13] hw/char/imx_serial: Turn some DPRINTF() statements into trace events, Bernhard Beschow, 2025/01/11
- [PATCH v2 09/13] hw/timer/imx_gpt: Remove unused define, Bernhard Beschow, 2025/01/11
- [PATCH v2 10/13] tests/qtest/libqos: Reuse TYPE_IMX_I2C define, Bernhard Beschow, 2025/01/11
- [PATCH v2 11/13] hw/i2c/imx_i2c: Convert DPRINTF() to trace events, Bernhard Beschow, 2025/01/11
- [PATCH v2 12/13] hw/misc/imx6_src: Convert DPRINTF() to trace events, Bernhard Beschow, 2025/01/11
- [PATCH v2 13/13] hw/gpio/imx_gpio: Turn DPRINTF() into trace events, Bernhard Beschow, 2025/01/11