Implement a new method to retrieve the gpiobus reference from a GPIO

controller.

The gpiobus is responsible to keep track of the used pins and serialize
the access to pins.

Some of these features are important to devices that do not descend
directly from gpiobus and as such cannot make use of its features (one
classic example is gpioc that is attached to the GPIO controller and could
not, until now, make use of the gpiobus locking).
This commit is contained in:
loos 2015-01-31 15:50:19 +00:00
parent b59332f8aa
commit b40768965e

View File

@ -32,6 +32,13 @@
INTERFACE gpio;
CODE {
static device_t
gpio_default_get_bus(void)
{
return (NULL);
}
static int
gpio_default_map_gpios(device_t bus, phandle_t dev,
phandle_t gparent, int gcells, pcell_t *gpios, uint32_t *pin,
@ -55,6 +62,13 @@ HEADER {
#include <dev/ofw/openfirm.h>
};
#
# Return the gpiobus device reference
#
METHOD device_t get_bus {
device_t dev;
} DEFAULT gpio_default_get_bus;
#
# Get maximum pin number
#