[U-Boot] [PATCH] gpio: dwapb_gpio: Add reset ctrl to driver
Ley Foon Tan
ley.foon.tan at intel.com
Wed Aug 15 18:05:53 UTC 2018
Add code to reset all reset signals as in gpio DT node. A reset property
is an optional feature, so only print out a warning and do not fail if a
reset property is not present.
If a reset property is discovered, then use it to deassert, thus
bringing the IP out of reset.
Signed-off-by: Ley Foon Tan <ley.foon.tan at intel.com>
---
drivers/gpio/dwapb_gpio.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/gpio/dwapb_gpio.c b/drivers/gpio/dwapb_gpio.c
index 3b5c181..e2b6e69 100644
--- a/drivers/gpio/dwapb_gpio.c
+++ b/drivers/gpio/dwapb_gpio.c
@@ -15,6 +15,7 @@
#include <dm/lists.h>
#include <dm/root.h>
#include <errno.h>
+#include <reset.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -114,6 +115,20 @@ static int gpio_dwapb_probe(struct udevice *dev)
return 0;
}
+static void gpio_dwapb_reset(struct udevice *dev)
+{
+ struct reset_ctl_bulk reset_bulk;
+ int ret;
+
+ ret = reset_get_bulk(dev, &reset_bulk);
+ if (ret) {
+ dev_warn(dev, "Can't get reset: %d\n", ret);
+ return;
+ }
+
+ reset_deassert_bulk(&reset_bulk);
+}
+
static int gpio_dwapb_bind(struct udevice *dev)
{
struct gpio_dwapb_platdata *plat = dev_get_platdata(dev);
@@ -126,6 +141,8 @@ static int gpio_dwapb_bind(struct udevice *dev)
if (plat)
return 0;
+ gpio_dwapb_reset(dev);
+
base = dev_read_addr(dev);
if (base == FDT_ADDR_T_NONE) {
debug("Can't get the GPIO register base address\n");
--
2.2.2
More information about the U-Boot
mailing list