diff options
author | Charles Perry <charles.perry@savoirfairelinux.com> | 2024-03-21 23:04:36 +0100 |
---|---|---|
committer | Xu Yilun <yilun.xu@linux.intel.com> | 2024-03-31 16:48:13 +0200 |
commit | 4a1f12b5b50dd7d8ad681be701b2b00521c9d201 (patch) | |
tree | cdc04470a71635c8238d3e0cc5be9341922f0769 /drivers/fpga | |
parent | fpga: xilinx-selectmap: add new driver (diff) | |
download | linux-4a1f12b5b50dd7d8ad681be701b2b00521c9d201.tar.xz linux-4a1f12b5b50dd7d8ad681be701b2b00521c9d201.zip |
fpga: xilinx-core: add new gpio names for prog and init
Old names (prog_b and init-b) are used as a fallback for hardware
compatible with the "xlnx,fpga-slave-serial" string.
Signed-off-by: Charles Perry <charles.perry@savoirfairelinux.com>
Acked-by: Xu Yilun <yilun.xu@intel.com>
Link: https://lore.kernel.org/r/20240321220447.3260065-5-charles.perry@savoirfairelinux.com
Signed-off-by: Xu Yilun <yilun.xu@linux.intel.com>
Diffstat (limited to 'drivers/fpga')
-rw-r--r-- | drivers/fpga/xilinx-core.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/fpga/xilinx-core.c b/drivers/fpga/xilinx-core.c index a35c43382dd5..39aeacf2e4f1 100644 --- a/drivers/fpga/xilinx-core.c +++ b/drivers/fpga/xilinx-core.c @@ -171,6 +171,20 @@ static int xilinx_core_write_complete(struct fpga_manager *mgr, return -ETIMEDOUT; } +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 && + of_device_is_compatible(dev->of_node, "xlnx,fpga-slave-serial")) + 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 +200,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"); |