Skip to content

Commit f8d355b

Browse files
committed
Merge tag 'renesas-pinctrl-for-v6.13-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers into devel
pinctrl: renesas: Updates for v6.13 - Marks GPIOs as used on RZ/A1 and RZ/A2, - Add open-drain and schmitt-trigger support on RZ/V2H(P), - Miscellaneous fixes and improvements. Signed-off-by: Linus Walleij <[email protected]>
2 parents a83c29e + 5dcde51 commit f8d355b

File tree

5 files changed

+63
-3
lines changed

5 files changed

+63
-3
lines changed

Documentation/devicetree/bindings/pinctrl/renesas,rzg2l-pinctrl.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ additionalProperties:
119119
bias-disable: true
120120
bias-pull-down: true
121121
bias-pull-up: true
122+
input-schmitt-enable: true
123+
input-schmitt-disable: true
124+
drive-open-drain: true
125+
drive-push-pull: true
122126
renesas,output-impedance:
123127
description:
124128
Output impedance for pins on the RZ/V2H(P) SoC. The value provided by this

drivers/pinctrl/renesas/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ config PINCTRL_RENESAS
4141
select PINCTRL_PFC_R8A779H0 if ARCH_R8A779H0
4242
select PINCTRL_RZG2L if ARCH_RZG2L
4343
select PINCTRL_RZV2M if ARCH_R9A09G011
44+
select PINCTRL_RZG2L if ARCH_R9A09G057
4445
select PINCTRL_PFC_SH7203 if CPU_SUBTYPE_SH7203
4546
select PINCTRL_PFC_SH7264 if CPU_SUBTYPE_SH7264
4647
select PINCTRL_PFC_SH7269 if CPU_SUBTYPE_SH7269

drivers/pinctrl/renesas/pinctrl-rza1.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/ioport.h>
2020
#include <linux/module.h>
2121
#include <linux/of.h>
22+
#include <linux/pinctrl/consumer.h>
2223
#include <linux/pinctrl/pinconf-generic.h>
2324
#include <linux/pinctrl/pinctrl.h>
2425
#include <linux/pinctrl/pinmux.h>
@@ -750,6 +751,11 @@ static int rza1_pin_mux_single(struct rza1_pinctrl *rza1_pctl,
750751
static int rza1_gpio_request(struct gpio_chip *chip, unsigned int gpio)
751752
{
752753
struct rza1_port *port = gpiochip_get_data(chip);
754+
int ret;
755+
756+
ret = pinctrl_gpio_request(chip, gpio);
757+
if (ret)
758+
return ret;
753759

754760
rza1_pin_reset(port, gpio);
755761

@@ -771,6 +777,7 @@ static void rza1_gpio_free(struct gpio_chip *chip, unsigned int gpio)
771777
struct rza1_port *port = gpiochip_get_data(chip);
772778

773779
rza1_pin_reset(port, gpio);
780+
pinctrl_gpio_free(chip, gpio);
774781
}
775782

776783
static int rza1_gpio_get_direction(struct gpio_chip *chip, unsigned int gpio)

drivers/pinctrl/renesas/pinctrl-rza2.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/module.h>
1717
#include <linux/mutex.h>
1818
#include <linux/of.h>
19+
#include <linux/pinctrl/consumer.h>
1920
#include <linux/pinctrl/pinmux.h>
2021
#include <linux/platform_device.h>
2122

@@ -229,6 +230,8 @@ static const char * const rza2_gpio_names[] = {
229230
static struct gpio_chip chip = {
230231
.names = rza2_gpio_names,
231232
.base = -1,
233+
.request = pinctrl_gpio_request,
234+
.free = pinctrl_gpio_free,
232235
.get_direction = rza2_chip_get_direction,
233236
.direction_input = rza2_chip_direction_input,
234237
.direction_output = rza2_chip_direction_output,

drivers/pinctrl/renesas/pinctrl-rzg2l.c

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@
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)
143+
#define SMT(off) (0x3400 + (off) * 8)
142144
#define SD_CH(off, ch) ((off) + (ch) * 4)
143145
#define ETH_POC(off, ch) ((off) + (ch) * 4)
144146
#define QSPI (0x3008)
@@ -160,6 +162,8 @@
160162
#define IOLH_MASK 0x03
161163
#define SR_MASK 0x01
162164
#define PUPD_MASK 0x03
165+
#define NOD_MASK 0x01
166+
#define SMT_MASK 0x01
163167

164168
#define PM_INPUT 0x1
165169
#define PM_OUTPUT 0x2
@@ -168,7 +172,6 @@
168172
#define RZG2L_PIN_ID_TO_PIN(id) ((id) % RZG2L_PINS_PER_PORT)
169173

170174
#define RZG2L_TINT_MAX_INTERRUPT 32
171-
#define RZG2L_TINT_IRQ_START_INDEX 9
172175
#define RZG2L_PACK_HWIRQ(t, i) (((t) << 16) | (i))
173176

174177
/* Custom pinconf parameters */
@@ -247,6 +250,7 @@ enum rzg2l_iolh_index {
247250
* @iolh_groupb_ua: IOLH group B uA specific values
248251
* @iolh_groupc_ua: IOLH group C uA specific values
249252
* @iolh_groupb_oi: IOLH group B output impedance specific values
253+
* @tint_start_index: the start index for the TINT interrupts
250254
* @drive_strength_ua: drive strength in uA is supported (otherwise mA is supported)
251255
* @func_base: base number for port function (see register PFC)
252256
* @oen_max_pin: the maximum pin number supporting output enable
@@ -258,6 +262,7 @@ struct rzg2l_hwcfg {
258262
u16 iolh_groupb_ua[RZG2L_IOLH_IDX_MAX];
259263
u16 iolh_groupc_ua[RZG2L_IOLH_IDX_MAX];
260264
u16 iolh_groupb_oi[4];
265+
u16 tint_start_index;
261266
bool drive_strength_ua;
262267
u8 func_base;
263268
u8 oen_max_pin;
@@ -1337,6 +1342,27 @@ static int rzg2l_pinctrl_pinconf_get(struct pinctrl_dev *pctldev,
13371342
break;
13381343
}
13391344

1345+
case PIN_CONFIG_DRIVE_OPEN_DRAIN:
1346+
case PIN_CONFIG_DRIVE_PUSH_PULL:
1347+
if (!(cfg & PIN_CFG_NOD))
1348+
return -EINVAL;
1349+
1350+
arg = rzg2l_read_pin_config(pctrl, NOD(off), bit, NOD_MASK);
1351+
if (!arg && param != PIN_CONFIG_DRIVE_PUSH_PULL)
1352+
return -EINVAL;
1353+
if (arg && param != PIN_CONFIG_DRIVE_OPEN_DRAIN)
1354+
return -EINVAL;
1355+
break;
1356+
1357+
case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
1358+
if (!(cfg & PIN_CFG_SMT))
1359+
return -EINVAL;
1360+
1361+
arg = rzg2l_read_pin_config(pctrl, SMT(off), bit, SMT_MASK);
1362+
if (!arg)
1363+
return -EINVAL;
1364+
break;
1365+
13401366
case RENESAS_RZV2H_PIN_CONFIG_OUTPUT_IMPEDANCE:
13411367
if (!(cfg & PIN_CFG_IOLH_RZV2H))
13421368
return -EINVAL;
@@ -1466,6 +1492,22 @@ static int rzg2l_pinctrl_pinconf_set(struct pinctrl_dev *pctldev,
14661492
rzg2l_rmw_pin_config(pctrl, IOLH(off), bit, IOLH_MASK, index);
14671493
break;
14681494

1495+
case PIN_CONFIG_DRIVE_OPEN_DRAIN:
1496+
case PIN_CONFIG_DRIVE_PUSH_PULL:
1497+
if (!(cfg & PIN_CFG_NOD))
1498+
return -EINVAL;
1499+
1500+
rzg2l_rmw_pin_config(pctrl, NOD(off), bit, NOD_MASK,
1501+
param == PIN_CONFIG_DRIVE_OPEN_DRAIN ? 1 : 0);
1502+
break;
1503+
1504+
case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
1505+
if (!(cfg & PIN_CFG_SMT))
1506+
return -EINVAL;
1507+
1508+
rzg2l_rmw_pin_config(pctrl, SMT(off), bit, SMT_MASK, arg);
1509+
break;
1510+
14691511
case RENESAS_RZV2H_PIN_CONFIG_OUTPUT_IMPEDANCE:
14701512
if (!(cfg & PIN_CFG_IOLH_RZV2H))
14711513
return -EINVAL;
@@ -2379,7 +2421,7 @@ static int rzg2l_gpio_child_to_parent_hwirq(struct gpio_chip *gc,
23792421

23802422
rzg2l_gpio_irq_endisable(pctrl, child, true);
23812423
pctrl->hwirq[irq] = child;
2382-
irq += RZG2L_TINT_IRQ_START_INDEX;
2424+
irq += pctrl->data->hwcfg->tint_start_index;
23832425

23842426
/* All these interrupts are level high in the CPU */
23852427
*parent_type = IRQ_TYPE_LEVEL_HIGH;
@@ -2710,7 +2752,7 @@ static int rzg2l_pinctrl_register(struct rzg2l_pinctrl *pctrl)
27102752

27112753
ret = pinctrl_enable(pctrl->pctl);
27122754
if (ret)
2713-
dev_err_probe(pctrl->dev, ret, "pinctrl enable failed\n");
2755+
return dev_err_probe(pctrl->dev, ret, "pinctrl enable failed\n");
27142756

27152757
ret = rzg2l_gpio_register(pctrl);
27162758
if (ret)
@@ -3034,6 +3076,7 @@ static const struct rzg2l_hwcfg rzg2l_hwcfg = {
30343076
[RZG2L_IOLH_IDX_3V3] = 2000, 4000, 8000, 12000,
30353077
},
30363078
.iolh_groupb_oi = { 100, 66, 50, 33, },
3079+
.tint_start_index = 9,
30373080
.oen_max_pin = 0,
30383081
};
30393082

@@ -3063,6 +3106,7 @@ static const struct rzg2l_hwcfg rzg3s_hwcfg = {
30633106
/* 3v3 power source */
30643107
[RZG2L_IOLH_IDX_3V3] = 4500, 5200, 5700, 6050,
30653108
},
3109+
.tint_start_index = 9,
30663110
.drive_strength_ua = true,
30673111
.func_base = 1,
30683112
.oen_max_pin = 1, /* Pin 1 of P0 and P7 is the maximum OEN pin. */
@@ -3073,6 +3117,7 @@ static const struct rzg2l_hwcfg rzv2h_hwcfg = {
30733117
.regs = {
30743118
.pwpr = 0x3c04,
30753119
},
3120+
.tint_start_index = 17,
30763121
};
30773122

30783123
static struct rzg2l_pinctrl_data r9a07g043_data = {

0 commit comments

Comments
 (0)