Skip to content

Commit 9d75b70

Browse files
prabhakarladgeertu
authored andcommitted
pinctrl: renesas: rzg2l: Add support for enabling/disabling open-drain outputs
Add support for enabling and disabling open-drain outputs. Signed-off-by: Lad Prabhakar <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Tested-by: Claudiu Beznea <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Geert Uytterhoeven <[email protected]>
1 parent f07e2b6 commit 9d75b70

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

drivers/pinctrl/renesas/pinctrl-rzg2l.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@
139139
#define IEN(off) (0x1800 + (off) * 8)
140140
#define PUPD(off) (0x1C00 + (off) * 8)
141141
#define ISEL(off) (0x2C00 + (off) * 8)
142+
#define NOD(off) (0x3000 + (off) * 8)
142143
#define SD_CH(off, ch) ((off) + (ch) * 4)
143144
#define ETH_POC(off, ch) ((off) + (ch) * 4)
144145
#define QSPI (0x3008)
@@ -160,6 +161,7 @@
160161
#define IOLH_MASK 0x03
161162
#define SR_MASK 0x01
162163
#define PUPD_MASK 0x03
164+
#define NOD_MASK 0x01
163165

164166
#define PM_INPUT 0x1
165167
#define PM_OUTPUT 0x2
@@ -1338,6 +1340,18 @@ static int rzg2l_pinctrl_pinconf_get(struct pinctrl_dev *pctldev,
13381340
break;
13391341
}
13401342

1343+
case PIN_CONFIG_DRIVE_OPEN_DRAIN:
1344+
case PIN_CONFIG_DRIVE_PUSH_PULL:
1345+
if (!(cfg & PIN_CFG_NOD))
1346+
return -EINVAL;
1347+
1348+
arg = rzg2l_read_pin_config(pctrl, NOD(off), bit, NOD_MASK);
1349+
if (!arg && param != PIN_CONFIG_DRIVE_PUSH_PULL)
1350+
return -EINVAL;
1351+
if (arg && param != PIN_CONFIG_DRIVE_OPEN_DRAIN)
1352+
return -EINVAL;
1353+
break;
1354+
13411355
case RENESAS_RZV2H_PIN_CONFIG_OUTPUT_IMPEDANCE:
13421356
if (!(cfg & PIN_CFG_IOLH_RZV2H))
13431357
return -EINVAL;
@@ -1467,6 +1481,15 @@ static int rzg2l_pinctrl_pinconf_set(struct pinctrl_dev *pctldev,
14671481
rzg2l_rmw_pin_config(pctrl, IOLH(off), bit, IOLH_MASK, index);
14681482
break;
14691483

1484+
case PIN_CONFIG_DRIVE_OPEN_DRAIN:
1485+
case PIN_CONFIG_DRIVE_PUSH_PULL:
1486+
if (!(cfg & PIN_CFG_NOD))
1487+
return -EINVAL;
1488+
1489+
rzg2l_rmw_pin_config(pctrl, NOD(off), bit, NOD_MASK,
1490+
param == PIN_CONFIG_DRIVE_OPEN_DRAIN ? 1 : 0);
1491+
break;
1492+
14701493
case RENESAS_RZV2H_PIN_CONFIG_OUTPUT_IMPEDANCE:
14711494
if (!(cfg & PIN_CFG_IOLH_RZV2H))
14721495
return -EINVAL;

0 commit comments

Comments
 (0)