qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2] nrf51_gpio: reflect pull-up/pull-down to IRQ


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v2] nrf51_gpio: reflect pull-up/pull-down to IRQs
Date: Wed, 20 Mar 2019 13:56:39 +0000
User-agent: Mutt/1.11.3 (2019-02-01)

On Sun, Mar 17, 2019 at 03:10:01PM +0100, Paolo Bonzini wrote:
> Some drivers do I2C bitbanging by keeping the output to 0 and flipping
> the GPIO direction between input and output (see for example in Linux
> gpio_set_open_drain_value_commit, in drivers/gpio/gpiolib.c).
> When the GPIO is set to input, the pull-up resistor brings the output
> to 1, while when the GPIO is set to output, the output driver brings
> the output to 0.
> 
> Implement this for the nRF51 GPIO device model.  First, if both input and
> output are floating, and there is a pull-up or pull-down resistor
> configured, do not just set s->in, but also make any devices listening
> on the output qemu_irq receive that value.  Second, if the pin is
> driven both internally (output pin) and externally you don't get a
> short circuit if both sides drive the pin to the same value.
> 
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
>         v1->v2: fixed short circuit conditions, reordering the code according
>         to the schematic in the datasheet
> ---
>  hw/gpio/nrf51_gpio.c | 64 +++++++++++++++++++++++++++-----------------
>  1 file changed, 39 insertions(+), 25 deletions(-)

Acked-by: Stefan Hajnoczi <address@hidden>

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]