[PATCH] gpio: pca953x_gpio: support optional reset-gpios property
Rasmus Villemoes
rasmus.villemoes at prevas.dk
Wed Apr 10 13:11:08 CEST 2024
The DT bindings for the pca953x family has an optional reset-gpios
property. If present, ensure that the device is taken out of reset
before attempting to read from it.
Signed-off-by: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
---
drivers/gpio/pca953x_gpio.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/gpio/pca953x_gpio.c b/drivers/gpio/pca953x_gpio.c
index b0c66d18317..24b0732f89a 100644
--- a/drivers/gpio/pca953x_gpio.c
+++ b/drivers/gpio/pca953x_gpio.c
@@ -306,6 +306,7 @@ static int pca953x_probe(struct udevice *dev)
struct pca953x_info *info = dev_get_plat(dev);
struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
char name[32], label[8], *str;
+ struct gpio_desc reset;
int addr;
ulong driver_data;
int ret;
@@ -321,6 +322,13 @@ static int pca953x_probe(struct udevice *dev)
driver_data = dev_get_driver_data(dev);
+ /* If a reset-gpios property is present, take the device out of reset. */
+ ret = gpio_request_by_name(dev, "reset-gpios", 0, &reset, GPIOD_IS_OUT);
+ if (ret && ret != -ENOENT) {
+ dev_err(dev, "requesting reset-gpios failed: %d\n", ret);
+ return ret;
+ }
+
info->gpio_count = driver_data & PCA_GPIO_MASK;
if (info->gpio_count > MAX_BANK * BANK_SZ) {
dev_err(dev, "Max support %d pins now\n", MAX_BANK * BANK_SZ);
--
2.40.1.1.g1c60b9335d
More information about the U-Boot
mailing list