diff options
author | Simon Glass <sjg@chromium.org> | 2011-05-27 16:02:38 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2011-08-24 10:01:50 -0700 |
commit | 0b0857e615397e4bddc71b889f930664f423fb3d (patch) | |
tree | 93fde723feba0ab2b46208f5b24869dca18b2833 /include/fdt_decode.h | |
parent | da5f37d703c43a204e9d1801d1f0a3996b6599d9 (diff) |
fdt: add GPIO support to fdt_decode
BUG=chromium-os:13228
TEST=Build, boot on Seaboard
Change-Id: Ifd1db8b0acdbe63c68372418f35c3e76882dc6e0
Reviewed-on: http://gerrit.chromium.org/gerrit/1288
Reviewed-by: Anton Staaf <robotboy@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/fdt_decode.h')
-rw-r--r-- | include/fdt_decode.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/fdt_decode.h b/include/fdt_decode.h index 4a4f970c9e..4b69e85b99 100644 --- a/include/fdt_decode.h +++ b/include/fdt_decode.h @@ -82,6 +82,20 @@ struct fdt_spi_uart { u32 port; /* Port number of UART affected */ }; +enum { + FDT_GPIO_NONE = 255, /* an invalid GPIO used to end our list */ + FDT_GPIO_MAX = 254, /* maximum value GPIO number */ +}; + +/* This is the state of a GPIO pin. For now it only handles output pins */ +struct fdt_gpio_state { + u8 gpio; /* GPIO number */ + u8 high; /* 1=high, 0 = low */ +}; + +/* This tells us whether a fdt_gpio_state record is valid or not */ +#define fdt_gpio_isvalid(gpio) ((gpio)->gpio != FDT_GPIO_NONE) + /** * Return information from the FDT about the console UART. This looks for * an alias node called 'console' which must point to a UART. It then reads @@ -136,3 +150,10 @@ enum fdt_compat_id fdt_decode_lookup(const void *blob, int node); * @returns 0 on success, -ve on error, in which case config is unchanged */ int fdt_decode_get_spi_switch(const void *blob, struct fdt_spi_uart *config); + +/** + * Set up GPIO pins according to the list provided. + * + * @param gpio_list List of GPIOs to set up + */ +void fdt_setup_gpios(struct fdt_gpio_state *gpio_list); |