[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240207180142.79625-4-charles.perry@savoirfairelinux.com>
Date: Wed, 7 Feb 2024 13:01:26 -0500
From: Charles Perry <charles.perry@...oirfairelinux.com>
To: mdf@...nel.org
Cc: avandiver@...kem-imaje.com,
bcody@...kem-imaje.com,
Charles Perry <charles.perry@...oirfairelinux.com>,
Wu Hao <hao.wu@...el.com>,
Xu Yilun <yilun.xu@...el.com>,
Tom Rix <trix@...hat.com>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Michal Simek <michal.simek@....com>,
kishore Manne <nava.kishore.manne@....com>,
linux-fpga@...r.kernel.org,
devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org
Subject: [PATCH v3 3/5] fpga: xilinx-core: rename "prog_b" and "init-b" gpios
New bindings use "prog" and "init". The legacy name is used as a
fallback.
Signed-off-by: Charles Perry <charles.perry@...oirfairelinux.com>
---
drivers/fpga/xilinx-core.c | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/drivers/fpga/xilinx-core.c b/drivers/fpga/xilinx-core.c
index 597e8b7a530b7..4d2416e71d59c 100644
--- a/drivers/fpga/xilinx-core.c
+++ b/drivers/fpga/xilinx-core.c
@@ -171,6 +171,28 @@ static int xilinx_core_write_complete(struct fpga_manager *mgr,
return -ETIMEDOUT;
}
+/**
+ * xilinx_core_devm_gpiod_get - Obtain a resource-managed GPIO using a
+ * legacy consumer name fallback.
+ *
+ * @dev: Device managing the GPIO
+ * @con_id: Consumer id
+ * @legacy_con_id: Legacy consumer id
+ * @flags: optional GPIO initialization flags
+ */
+static inline struct gpio_desc *
+xilinx_core_devm_gpiod_get(struct device *dev, const char *con_id,
+ const char *legacy_con_id, enum gpiod_flags flags)
+{
+ struct gpio_desc *desc;
+
+ desc = devm_gpiod_get(dev, con_id, flags);
+ if (IS_ERR(desc) && PTR_ERR(desc) == -ENOENT)
+ desc = devm_gpiod_get(dev, legacy_con_id, flags);
+
+ return desc;
+}
+
static const struct fpga_manager_ops xilinx_core_ops = {
.state = xilinx_core_state,
.write_init = xilinx_core_write_init,
@@ -186,12 +208,14 @@ int xilinx_core_probe(struct xilinx_fpga_core *core)
return -EINVAL;
/* PROGRAM_B is active low */
- core->prog_b = devm_gpiod_get(core->dev, "prog_b", GPIOD_OUT_LOW);
+ core->prog_b = xilinx_core_devm_gpiod_get(core->dev, "prog", "prog_b",
+ GPIOD_OUT_LOW);
if (IS_ERR(core->prog_b))
return dev_err_probe(core->dev, PTR_ERR(core->prog_b),
"Failed to get PROGRAM_B gpio\n");
- core->init_b = devm_gpiod_get_optional(core->dev, "init-b", GPIOD_IN);
+ core->init_b = xilinx_core_devm_gpiod_get(core->dev, "init", "init-b",
+ GPIOD_IN);
if (IS_ERR(core->init_b))
return dev_err_probe(core->dev, PTR_ERR(core->init_b),
"Failed to get INIT_B gpio\n");
--
2.43.0
Powered by blists - more mailing lists