[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
- Re: [Qemu-devel] [PATCH v7 04/12] register: Define REG and FIELD macros, (continued)
- [Qemu-devel] [PATCH v7 02/12] register: Add Register API, Alistair Francis, 2016/06/22
- [Qemu-devel] [PATCH v7 09/12] irq: Add opaque setter routine, Alistair Francis, 2016/06/22
- [Qemu-devel] [PATCH v7 07/12] dma: Add Xilinx Zynq devcfg device model, Alistair Francis, 2016/06/22
- [Qemu-devel] [PATCH v7 08/12] xilinx_zynq: Connect devcfg to the Zynq machine model, Alistair Francis, 2016/06/22
- [Qemu-devel] [PATCH v7 10/12] register: Add GPIO API, Alistair Francis, 2016/06/22
- Re: [Qemu-devel] [PATCH v7 10/12] register: Add GPIO API,
Peter Maydell <=
- [Qemu-devel] [PATCH v7 11/12] misc: Introduce ZynqMP IOU SLCR, Alistair Francis, 2016/06/22