hw/gpio/pl061: Make pullup/pulldown of outputs configurable
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 2 Jul 2021 10:40:14 +0000 (11:40 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 9 Jul 2021 15:09:12 +0000 (16:09 +0100)
commitc1e69e92aea696fa148c4d79aff6a2fdf46ef2b8
treec4b99c3c6dda39145e1cff4487e529f36a7a0f49
parentad06d56fc7155c7893b18efecb9fe0f2e9124eaf
hw/gpio/pl061: Make pullup/pulldown of outputs configurable

The PL061 GPIO does not itself include pullup or pulldown resistors
to set the value of a GPIO line treated as an output when it is
configured as an input (ie when the PL061 itself is not driving it).
In real hardware it is up to the board to add suitable pullups or
pulldowns.  Currently our implementation hardwires this to "outputs
pulled high", which is correct for some boards (eg the realview ones:
see figure 3-29 in the "RealView Platform Baseboard for ARM926EJ-S
User Guide" DUI0224I), but wrong for others.

In particular, the wiring in the 'virt' board and the gpio-pwr device
assumes that wires should be pulled low, because otherwise the
pull-to-high will trigger a shutdown or reset action.  (The only
reason this doesn't happen immediately on startup is due to another
bug in the PL061, where we don't assert the GPIOs to the correct
value on reset, but will do so as soon as the guest touches a
register and pl061_update() gets called.)

Add properties to the pl061 so the board can configure whether it
wants GPIO lines to have pullup, pulldown, or neither.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
hw/gpio/pl061.c