aboutsummaryrefslogtreecommitdiff
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorPaul Barker2023-10-16 10:25:33 +0100
committerMarek Vasut2023-10-16 15:46:18 +0200
commit21e4ba153f1f803af58f74eaa5b3778197ffceaf (patch)
tree90531793d8aa96f5edccc07167e9ccf60a26b381 /drivers/pinctrl
parentb378c400e04eab340335a1691a390a93f17f6394 (diff)
gpio: Add RZ/G2L GPIO driver
This driver adds support for the gpio features of the GPIO/PFC module in the Renesas RZ/G2L (R9A07G044) SoC. The new `rzg2l-pfc-gpio` driver is bound to the same device tree node as the `rzg2l-pfc-pinctrl` driver as the same hardware block provides both GPIO and pin multiplexing features. This patch is based on the corresponding Linux v6.5 driver (commit 52e12027d50affbf60c6c9c64db8017391b0c22e). Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/renesas/rzg2l-pfc.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/drivers/pinctrl/renesas/rzg2l-pfc.c b/drivers/pinctrl/renesas/rzg2l-pfc.c
index ce4062ff303..7b045f75d3f 100644
--- a/drivers/pinctrl/renesas/rzg2l-pfc.c
+++ b/drivers/pinctrl/renesas/rzg2l-pfc.c
@@ -566,8 +566,10 @@ static int rzg2l_pfc_bind(struct udevice *parent)
{
struct rzg2l_pfc_driver_data *driver_data;
struct rzg2l_pfc_data *data;
+ struct udevice *pinctrl_dev;
struct driver *drv;
unsigned int i;
+ int ret;
driver_data =
(struct rzg2l_pfc_driver_data *)dev_get_driver_data(parent);
@@ -594,9 +596,25 @@ static int rzg2l_pfc_bind(struct udevice *parent)
if (!drv)
return -ENOENT;
- return device_bind_with_driver_data(parent, drv, parent->name,
- (ulong)data, dev_ofnode(parent),
- NULL);
+ ret = device_bind_with_driver_data(parent, drv, parent->name,
+ (ulong)data, dev_ofnode(parent),
+ &pinctrl_dev);
+
+ if (!ret && IS_ENABLED(CONFIG_RZG2L_GPIO)) {
+ drv = lists_driver_lookup_name("rzg2l-pfc-gpio");
+ if (!drv) {
+ device_unbind(pinctrl_dev);
+ return -ENOENT;
+ }
+
+ ret = device_bind_with_driver_data(parent, drv, parent->name,
+ (ulong)data,
+ dev_ofnode(parent), NULL);
+ if (ret)
+ device_unbind(pinctrl_dev);
+ }
+
+ return ret;
}
U_BOOT_DRIVER(rzg2l_pfc) = {