summaryrefslogtreecommitdiffstats
path: root/bsps/arm/include/bsp/imx-gpio.h
diff options
context:
space:
mode:
authorChristian Mauderer <christian.mauderer@embedded-brains.de>2023-11-21 15:54:33 +0100
committerChristian Mauderer <christian.mauderer@embedded-brains.de>2023-11-28 13:36:41 +0100
commita38f9c57f94d1689f3ab44244268d8d5472ecf3b (patch)
tree186fb5b593c5112abba7edfc45c9f029b882990e /bsps/arm/include/bsp/imx-gpio.h
parentvalidation: Remove superfluous includes (diff)
downloadrtems-a38f9c57f94d1689f3ab44244268d8d5472ecf3b.tar.bz2
bsps/imx*: imx_gpio from pointer to fdt property
Device trees allow mixing different kinds of GPIOs in one property. For that it is usefull to only provide a pointer to an arbitrary location in the property and initialize a GPIO from that.
Diffstat (limited to '')
-rw-r--r--bsps/arm/include/bsp/imx-gpio.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/bsps/arm/include/bsp/imx-gpio.h b/bsps/arm/include/bsp/imx-gpio.h
index 148f62a56e..5cda22972f 100644
--- a/bsps/arm/include/bsp/imx-gpio.h
+++ b/bsps/arm/include/bsp/imx-gpio.h
@@ -77,6 +77,32 @@ struct imx_gpio_pin {
void imx_gpio_init (struct imx_gpio_pin *pin);
/**
+ * Initialize a GPIO pin from the fields in an FDT property.
+ *
+ * If you have for example the following property in an FDT node:
+ *
+ * some-node {
+ * mixed-stuff = <0>, <&some_node 1>, <&gpio4 22 GPIO_ACTIVE_LOW>, <17>;
+ * };
+ *
+ * You can get the property using fdt_getprop(...) in your code, somehow find
+ * the right start position (the phandle &gpio4) and then pass it to this
+ * function.
+ *
+ * If you pass something != NULL to @a next_prop_pointer, you will get a pointer
+ * to the next part in the attribute. In the example above, that will be a
+ * pointer to the <17>.
+ *
+ * NOTE: The information from the third parameter in the FDT (GPIO_ACTIVE_LOW in
+ * the example) is currently ignored.
+ */
+rtems_status_code imx_gpio_init_from_fdt_property_pointer(
+ struct imx_gpio_pin *pin,
+ const uint32_t *prop_pointer,
+ enum imx_gpio_mode mode,
+ const uint32_t **next_prop_pointer);
+
+/**
* Initialize a GPIO pin from a FDT property.
*
* If you have for example the following property in an FDT node: