Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <linus.walleij@linaro.org>

+63 -3
+4
Documentation/devicetree/bindings/pinctrl/renesas,rzg2l-pinctrl.yaml
··· 119 119 bias-disable: true 120 120 bias-pull-down: true 121 121 bias-pull-up: true 122 + input-schmitt-enable: true 123 + input-schmitt-disable: true 124 + drive-open-drain: true 125 + drive-push-pull: true 122 126 renesas,output-impedance: 123 127 description: 124 128 Output impedance for pins on the RZ/V2H(P) SoC. The value provided by this
+1
drivers/pinctrl/renesas/Kconfig
··· 41 41 select PINCTRL_PFC_R8A779H0 if ARCH_R8A779H0 42 42 select PINCTRL_RZG2L if ARCH_RZG2L 43 43 select PINCTRL_RZV2M if ARCH_R9A09G011 44 + select PINCTRL_RZG2L if ARCH_R9A09G057 44 45 select PINCTRL_PFC_SH7203 if CPU_SUBTYPE_SH7203 45 46 select PINCTRL_PFC_SH7264 if CPU_SUBTYPE_SH7264 46 47 select PINCTRL_PFC_SH7269 if CPU_SUBTYPE_SH7269
+7
drivers/pinctrl/renesas/pinctrl-rza1.c
··· 19 19 #include <linux/ioport.h> 20 20 #include <linux/module.h> 21 21 #include <linux/of.h> 22 + #include <linux/pinctrl/consumer.h> 22 23 #include <linux/pinctrl/pinconf-generic.h> 23 24 #include <linux/pinctrl/pinctrl.h> 24 25 #include <linux/pinctrl/pinmux.h> ··· 751 750 static int rza1_gpio_request(struct gpio_chip *chip, unsigned int gpio) 752 751 { 753 752 struct rza1_port *port = gpiochip_get_data(chip); 753 + int ret; 754 + 755 + ret = pinctrl_gpio_request(chip, gpio); 756 + if (ret) 757 + return ret; 754 758 755 759 rza1_pin_reset(port, gpio); 756 760 ··· 777 771 struct rza1_port *port = gpiochip_get_data(chip); 778 772 779 773 rza1_pin_reset(port, gpio); 774 + pinctrl_gpio_free(chip, gpio); 780 775 } 781 776 782 777 static int rza1_gpio_get_direction(struct gpio_chip *chip, unsigned int gpio)
+3
drivers/pinctrl/renesas/pinctrl-rza2.c
··· 16 16 #include <linux/module.h> 17 17 #include <linux/mutex.h> 18 18 #include <linux/of.h> 19 + #include <linux/pinctrl/consumer.h> 19 20 #include <linux/pinctrl/pinmux.h> 20 21 #include <linux/platform_device.h> 21 22 ··· 230 229 static struct gpio_chip chip = { 231 230 .names = rza2_gpio_names, 232 231 .base = -1, 232 + .request = pinctrl_gpio_request, 233 + .free = pinctrl_gpio_free, 233 234 .get_direction = rza2_chip_get_direction, 234 235 .direction_input = rza2_chip_direction_input, 235 236 .direction_output = rza2_chip_direction_output,
+48 -3
drivers/pinctrl/renesas/pinctrl-rzg2l.c
··· 139 139 #define IEN(off) (0x1800 + (off) * 8) 140 140 #define PUPD(off) (0x1C00 + (off) * 8) 141 141 #define ISEL(off) (0x2C00 + (off) * 8) 142 + #define NOD(off) (0x3000 + (off) * 8) 143 + #define SMT(off) (0x3400 + (off) * 8) 142 144 #define SD_CH(off, ch) ((off) + (ch) * 4) 143 145 #define ETH_POC(off, ch) ((off) + (ch) * 4) 144 146 #define QSPI (0x3008) ··· 162 160 #define IOLH_MASK 0x03 163 161 #define SR_MASK 0x01 164 162 #define PUPD_MASK 0x03 163 + #define NOD_MASK 0x01 164 + #define SMT_MASK 0x01 165 165 166 166 #define PM_INPUT 0x1 167 167 #define PM_OUTPUT 0x2 ··· 172 168 #define RZG2L_PIN_ID_TO_PIN(id) ((id) % RZG2L_PINS_PER_PORT) 173 169 174 170 #define RZG2L_TINT_MAX_INTERRUPT 32 175 - #define RZG2L_TINT_IRQ_START_INDEX 9 176 171 #define RZG2L_PACK_HWIRQ(t, i) (((t) << 16) | (i)) 177 172 178 173 /* Custom pinconf parameters */ ··· 250 247 * @iolh_groupb_ua: IOLH group B uA specific values 251 248 * @iolh_groupc_ua: IOLH group C uA specific values 252 249 * @iolh_groupb_oi: IOLH group B output impedance specific values 250 + * @tint_start_index: the start index for the TINT interrupts 253 251 * @drive_strength_ua: drive strength in uA is supported (otherwise mA is supported) 254 252 * @func_base: base number for port function (see register PFC) 255 253 * @oen_max_pin: the maximum pin number supporting output enable ··· 262 258 u16 iolh_groupb_ua[RZG2L_IOLH_IDX_MAX]; 263 259 u16 iolh_groupc_ua[RZG2L_IOLH_IDX_MAX]; 264 260 u16 iolh_groupb_oi[4]; 261 + u16 tint_start_index; 265 262 bool drive_strength_ua; 266 263 u8 func_base; 267 264 u8 oen_max_pin; ··· 1342 1337 break; 1343 1338 } 1344 1339 1340 + case PIN_CONFIG_DRIVE_OPEN_DRAIN: 1341 + case PIN_CONFIG_DRIVE_PUSH_PULL: 1342 + if (!(cfg & PIN_CFG_NOD)) 1343 + return -EINVAL; 1344 + 1345 + arg = rzg2l_read_pin_config(pctrl, NOD(off), bit, NOD_MASK); 1346 + if (!arg && param != PIN_CONFIG_DRIVE_PUSH_PULL) 1347 + return -EINVAL; 1348 + if (arg && param != PIN_CONFIG_DRIVE_OPEN_DRAIN) 1349 + return -EINVAL; 1350 + break; 1351 + 1352 + case PIN_CONFIG_INPUT_SCHMITT_ENABLE: 1353 + if (!(cfg & PIN_CFG_SMT)) 1354 + return -EINVAL; 1355 + 1356 + arg = rzg2l_read_pin_config(pctrl, SMT(off), bit, SMT_MASK); 1357 + if (!arg) 1358 + return -EINVAL; 1359 + break; 1360 + 1345 1361 case RENESAS_RZV2H_PIN_CONFIG_OUTPUT_IMPEDANCE: 1346 1362 if (!(cfg & PIN_CFG_IOLH_RZV2H)) 1347 1363 return -EINVAL; ··· 1490 1464 return -EINVAL; 1491 1465 1492 1466 rzg2l_rmw_pin_config(pctrl, IOLH(off), bit, IOLH_MASK, index); 1467 + break; 1468 + 1469 + case PIN_CONFIG_DRIVE_OPEN_DRAIN: 1470 + case PIN_CONFIG_DRIVE_PUSH_PULL: 1471 + if (!(cfg & PIN_CFG_NOD)) 1472 + return -EINVAL; 1473 + 1474 + rzg2l_rmw_pin_config(pctrl, NOD(off), bit, NOD_MASK, 1475 + param == PIN_CONFIG_DRIVE_OPEN_DRAIN ? 1 : 0); 1476 + break; 1477 + 1478 + case PIN_CONFIG_INPUT_SCHMITT_ENABLE: 1479 + if (!(cfg & PIN_CFG_SMT)) 1480 + return -EINVAL; 1481 + 1482 + rzg2l_rmw_pin_config(pctrl, SMT(off), bit, SMT_MASK, arg); 1493 1483 break; 1494 1484 1495 1485 case RENESAS_RZV2H_PIN_CONFIG_OUTPUT_IMPEDANCE: ··· 2421 2379 2422 2380 rzg2l_gpio_irq_endisable(pctrl, child, true); 2423 2381 pctrl->hwirq[irq] = child; 2424 - irq += RZG2L_TINT_IRQ_START_INDEX; 2382 + irq += pctrl->data->hwcfg->tint_start_index; 2425 2383 2426 2384 /* All these interrupts are level high in the CPU */ 2427 2385 *parent_type = IRQ_TYPE_LEVEL_HIGH; ··· 2752 2710 2753 2711 ret = pinctrl_enable(pctrl->pctl); 2754 2712 if (ret) 2755 - dev_err_probe(pctrl->dev, ret, "pinctrl enable failed\n"); 2713 + return dev_err_probe(pctrl->dev, ret, "pinctrl enable failed\n"); 2756 2714 2757 2715 ret = rzg2l_gpio_register(pctrl); 2758 2716 if (ret) ··· 3076 3034 [RZG2L_IOLH_IDX_3V3] = 2000, 4000, 8000, 12000, 3077 3035 }, 3078 3036 .iolh_groupb_oi = { 100, 66, 50, 33, }, 3037 + .tint_start_index = 9, 3079 3038 .oen_max_pin = 0, 3080 3039 }; 3081 3040 ··· 3106 3063 /* 3v3 power source */ 3107 3064 [RZG2L_IOLH_IDX_3V3] = 4500, 5200, 5700, 6050, 3108 3065 }, 3066 + .tint_start_index = 9, 3109 3067 .drive_strength_ua = true, 3110 3068 .func_base = 1, 3111 3069 .oen_max_pin = 1, /* Pin 1 of P0 and P7 is the maximum OEN pin. */ ··· 3117 3073 .regs = { 3118 3074 .pwpr = 0x3c04, 3119 3075 }, 3076 + .tint_start_index = 17, 3120 3077 }; 3121 3078 3122 3079 static struct rzg2l_pinctrl_data r9a07g043_data = {