qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v7 10/12] register: Add GPIO API


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH v7 10/12] register: Add GPIO API
Date: Thu, 23 Jun 2016 14:19:17 +0100

On 22 June 2016 at 21:24, Alistair Francis <address@hidden> wrote:
> Add GPIO functionality to the register API. This allows association
> and automatic connection of GPIOs to bits in registers. GPIO inputs
> will attach to handlers that automatically set read-only bits in
> registers. GPIO outputs will be updated to reflect their field value
> when their respective registers are written (or reset). Supports
> active low GPIOs.
>
> This is particularly effective for implementing system level
> controllers, where heterogenous collections of control signals are
> placed is a SoC specific peripheral then propagated all over the
> system.

I still don't think this is a good idea. GPIOs are device-level,
not register-level. Most devices don't really have very many
GPIOs. It should be easy to wire up "change GPIO state based on
new register value" from a register post-write hook. This API
can't handle the absolute most common case, which is "GPIO state
is based on a bit being set in (raw-state-register AND mask-register)."

Basically I don't think GPIOs belong in this API, and I don't think
there's a good case that adding them makes a significant class
of devices much easier to write.

thanks
-- PMM



reply via email to

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