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.12-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers into devel

pinctrl: renesas: Updates for v6.12 (take two)

- Miscellaneous fixes and improvements.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

+28 -50
+26 -46
drivers/pinctrl/renesas/pinctrl-rzg2l.c
··· 16 16 #include <linux/of.h> 17 17 #include <linux/of_irq.h> 18 18 #include <linux/platform_device.h> 19 + #include <linux/property.h> 19 20 #include <linux/seq_file.h> 20 21 #include <linux/spinlock.h> 21 22 ··· 52 51 #define PIN_CFG_IO_VMC_QSPI BIT(7) 53 52 #define PIN_CFG_IO_VMC_ETH0 BIT(8) 54 53 #define PIN_CFG_IO_VMC_ETH1 BIT(9) 55 - #define PIN_CFG_FILONOFF BIT(10) 56 - #define PIN_CFG_FILNUM BIT(11) 57 - #define PIN_CFG_FILCLKSEL BIT(12) 58 - #define PIN_CFG_IOLH_C BIT(13) 59 - #define PIN_CFG_SOFT_PS BIT(14) 60 - #define PIN_CFG_OEN BIT(15) 61 - #define PIN_CFG_NOGPIO_INT BIT(16) 62 - #define PIN_CFG_NOD BIT(17) /* N-ch Open Drain */ 63 - #define PIN_CFG_SMT BIT(18) /* Schmitt-trigger input control */ 64 - #define PIN_CFG_ELC BIT(19) 65 - #define PIN_CFG_IOLH_RZV2H BIT(20) 54 + #define PIN_CFG_NF BIT(10) /* Digital noise filter */ 55 + #define PIN_CFG_IOLH_C BIT(11) 56 + #define PIN_CFG_SOFT_PS BIT(12) 57 + #define PIN_CFG_OEN BIT(13) 58 + #define PIN_CFG_NOGPIO_INT BIT(14) 59 + #define PIN_CFG_NOD BIT(15) /* N-ch Open Drain */ 60 + #define PIN_CFG_SMT BIT(16) /* Schmitt-trigger input control */ 61 + #define PIN_CFG_ELC BIT(17) 62 + #define PIN_CFG_IOLH_RZV2H BIT(18) 66 63 67 64 #define RZG2L_SINGLE_PIN BIT_ULL(63) /* Dedicated pin */ 68 65 #define RZG2L_VARIABLE_CFG BIT_ULL(62) /* Variable cfg for port pins */ ··· 68 69 #define RZG2L_MPXED_COMMON_PIN_FUNCS(group) \ 69 70 (PIN_CFG_IOLH_##group | \ 70 71 PIN_CFG_PUPD | \ 71 - PIN_CFG_FILONOFF | \ 72 - PIN_CFG_FILNUM | \ 73 - PIN_CFG_FILCLKSEL) 72 + PIN_CFG_NF) 74 73 75 74 #define RZG2L_MPXED_PIN_FUNCS (RZG2L_MPXED_COMMON_PIN_FUNCS(A) | \ 76 75 PIN_CFG_SR) ··· 81 84 PIN_CFG_SR | \ 82 85 PIN_CFG_SMT) 83 86 84 - #define RZG2L_MPXED_ETH_PIN_FUNCS(x) ((x) | \ 85 - PIN_CFG_FILONOFF | \ 86 - PIN_CFG_FILNUM | \ 87 - PIN_CFG_FILCLKSEL) 87 + #define RZG2L_MPXED_ETH_PIN_FUNCS(x) ((x) | PIN_CFG_NF) 88 88 89 89 #define PIN_CFG_PIN_MAP_MASK GENMASK_ULL(61, 54) 90 90 #define PIN_CFG_PIN_REG_MASK GENMASK_ULL(53, 46) ··· 388 394 #ifdef CONFIG_RISCV 389 395 static const u64 r9a07g043f_variable_pin_cfg[] = { 390 396 RZG2L_VARIABLE_PIN_CFG_PACK(20, 0, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | 391 - PIN_CFG_FILONOFF | PIN_CFG_FILNUM | PIN_CFG_FILCLKSEL | 397 + PIN_CFG_NF | 392 398 PIN_CFG_IEN | PIN_CFG_NOGPIO_INT), 393 399 RZG2L_VARIABLE_PIN_CFG_PACK(20, 1, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | 394 - PIN_CFG_FILONOFF | PIN_CFG_FILNUM | PIN_CFG_FILCLKSEL | 400 + PIN_CFG_NF | 395 401 PIN_CFG_IEN | PIN_CFG_NOGPIO_INT), 396 402 RZG2L_VARIABLE_PIN_CFG_PACK(20, 2, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | 397 - PIN_CFG_FILONOFF | PIN_CFG_FILNUM | PIN_CFG_FILCLKSEL | 403 + PIN_CFG_NF | 398 404 PIN_CFG_IEN | PIN_CFG_NOGPIO_INT), 399 405 RZG2L_VARIABLE_PIN_CFG_PACK(20, 3, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | 400 406 PIN_CFG_IEN | PIN_CFG_NOGPIO_INT), ··· 425 431 RZG2L_VARIABLE_PIN_CFG_PACK(24, 4, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | 426 432 PIN_CFG_NOGPIO_INT), 427 433 RZG2L_VARIABLE_PIN_CFG_PACK(24, 5, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | 428 - PIN_CFG_FILONOFF | PIN_CFG_FILNUM | PIN_CFG_FILCLKSEL | 434 + PIN_CFG_NF | 429 435 PIN_CFG_NOGPIO_INT), 430 436 }; 431 437 #endif ··· 522 528 { 523 529 unsigned long *cfgs; 524 530 525 - cfgs = kmemdup(configs, num_configs * sizeof(*cfgs), 526 - GFP_KERNEL); 531 + cfgs = kmemdup_array(configs, num_configs, sizeof(*cfgs), GFP_KERNEL); 527 532 if (!cfgs) 528 533 return -ENOMEM; 529 534 ··· 1385 1392 1386 1393 for (i = 0; i < num_configs; i++) { 1387 1394 param = pinconf_to_config_param(_configs[i]); 1395 + arg = pinconf_to_config_argument(_configs[i]); 1388 1396 switch (param) { 1389 1397 case PIN_CONFIG_INPUT_ENABLE: 1390 - arg = pinconf_to_config_argument(_configs[i]); 1391 1398 1392 1399 if (!(cfg & PIN_CFG_IEN)) 1393 1400 return -EINVAL; ··· 1396 1403 break; 1397 1404 1398 1405 case PIN_CONFIG_OUTPUT_ENABLE: 1399 - arg = pinconf_to_config_argument(_configs[i]); 1400 1406 if (!(cfg & PIN_CFG_OEN)) 1401 1407 return -EINVAL; 1402 1408 if (!pctrl->data->oen_write) ··· 1406 1414 break; 1407 1415 1408 1416 case PIN_CONFIG_POWER_SOURCE: 1409 - settings.power_source = pinconf_to_config_argument(_configs[i]); 1417 + settings.power_source = arg; 1410 1418 break; 1411 1419 1412 1420 case PIN_CONFIG_SLEW_RATE: 1413 - arg = pinconf_to_config_argument(_configs[i]); 1414 - 1415 1421 if (!(cfg & PIN_CFG_SR) || arg > 1) 1416 1422 return -EINVAL; 1417 1423 ··· 1430 1440 break; 1431 1441 1432 1442 case PIN_CONFIG_DRIVE_STRENGTH: 1433 - arg = pinconf_to_config_argument(_configs[i]); 1434 - 1435 1443 if (!(cfg & PIN_CFG_IOLH_A) || hwcfg->drive_strength_ua) 1436 1444 return -EINVAL; 1437 1445 ··· 1449 1461 !hwcfg->drive_strength_ua) 1450 1462 return -EINVAL; 1451 1463 1452 - settings.drive_strength_ua = pinconf_to_config_argument(_configs[i]); 1464 + settings.drive_strength_ua = arg; 1453 1465 break; 1454 1466 1455 1467 case PIN_CONFIG_OUTPUT_IMPEDANCE_OHMS: 1456 - arg = pinconf_to_config_argument(_configs[i]); 1457 - 1458 1468 if (!(cfg & PIN_CFG_IOLH_B) || !hwcfg->iolh_groupb_oi[0]) 1459 1469 return -EINVAL; 1460 1470 ··· 1470 1484 if (!(cfg & PIN_CFG_IOLH_RZV2H)) 1471 1485 return -EINVAL; 1472 1486 1473 - arg = pinconf_to_config_argument(_configs[i]); 1474 1487 if (arg > 3) 1475 1488 return -EINVAL; 1476 1489 rzg2l_rmw_pin_config(pctrl, IOLH(off), bit, IOLH_MASK, arg); ··· 1872 1887 #ifdef CONFIG_RISCV 1873 1888 /* Below additional port pins (P19 - P28) are exclusively available on RZ/Five SoC only */ 1874 1889 RZG2L_GPIO_PORT_SPARSE_PACK(0x2, 0x06, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | 1875 - PIN_CFG_FILONOFF | PIN_CFG_FILNUM | PIN_CFG_FILCLKSEL | 1876 - PIN_CFG_IEN | PIN_CFG_NOGPIO_INT), /* P19 */ 1890 + PIN_CFG_NF | PIN_CFG_IEN | PIN_CFG_NOGPIO_INT), /* P19 */ 1877 1891 RZG2L_GPIO_PORT_PACK_VARIABLE(8, 0x07), /* P20 */ 1878 1892 RZG2L_GPIO_PORT_SPARSE_PACK(0x2, 0x08, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | 1879 1893 PIN_CFG_IEN | PIN_CFG_NOGPIO_INT), /* P21 */ ··· 1880 1896 PIN_CFG_IEN | PIN_CFG_NOGPIO_INT), /* P22 */ 1881 1897 RZG2L_GPIO_PORT_SPARSE_PACK_VARIABLE(0x3e, 0x0a), /* P23 */ 1882 1898 RZG2L_GPIO_PORT_PACK_VARIABLE(6, 0x0b), /* P24 */ 1883 - RZG2L_GPIO_PORT_SPARSE_PACK(0x2, 0x0c, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_FILONOFF | 1884 - PIN_CFG_FILNUM | PIN_CFG_FILCLKSEL | 1899 + RZG2L_GPIO_PORT_SPARSE_PACK(0x2, 0x0c, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_NF | 1885 1900 PIN_CFG_NOGPIO_INT), /* P25 */ 1886 1901 0x0, /* P26 */ 1887 1902 0x0, /* P27 */ ··· 1958 1975 struct rzg2l_dedicated_configs rzg2l_pins[7]; 1959 1976 } rzg2l_dedicated_pins = { 1960 1977 .common = { 1961 - { "NMI", RZG2L_SINGLE_PIN_PACK(0x1, 0, 1962 - (PIN_CFG_FILONOFF | PIN_CFG_FILNUM | PIN_CFG_FILCLKSEL)) }, 1978 + { "NMI", RZG2L_SINGLE_PIN_PACK(0x1, 0, PIN_CFG_NF) }, 1963 1979 { "TMS/SWDIO", RZG2L_SINGLE_PIN_PACK(0x2, 0, 1964 1980 (PIN_CFG_IOLH_A | PIN_CFG_SR | PIN_CFG_IEN)) }, 1965 1981 { "TDO", RZG2L_SINGLE_PIN_PACK(0x3, 0, ··· 2039 2057 }; 2040 2058 2041 2059 static const struct rzg2l_dedicated_configs rzg3s_dedicated_pins[] = { 2042 - { "NMI", RZG2L_SINGLE_PIN_PACK(0x0, 0, (PIN_CFG_FILONOFF | PIN_CFG_FILNUM | 2043 - PIN_CFG_FILCLKSEL)) }, 2060 + { "NMI", RZG2L_SINGLE_PIN_PACK(0x0, 0, PIN_CFG_NF) }, 2044 2061 { "TMS/SWDIO", RZG2L_SINGLE_PIN_PACK(0x1, 0, (PIN_CFG_IOLH_A | PIN_CFG_IEN | 2045 2062 PIN_CFG_SOFT_PS)) }, 2046 2063 { "TDO", RZG2L_SINGLE_PIN_PACK(0x1, 1, (PIN_CFG_IOLH_A | PIN_CFG_SOFT_PS)) }, ··· 2078 2097 }; 2079 2098 2080 2099 static struct rzg2l_dedicated_configs rzv2h_dedicated_pins[] = { 2081 - { "NMI", RZG2L_SINGLE_PIN_PACK(0x1, 0, (PIN_CFG_FILONOFF | PIN_CFG_FILNUM | 2082 - PIN_CFG_FILCLKSEL)) }, 2100 + { "NMI", RZG2L_SINGLE_PIN_PACK(0x1, 0, PIN_CFG_NF) }, 2083 2101 { "TMS_SWDIO", RZG2L_SINGLE_PIN_PACK(0x3, 0, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | 2084 2102 PIN_CFG_IEN)) }, 2085 2103 { "TDO", RZG2L_SINGLE_PIN_PACK(0x3, 2, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR)) }, ··· 2604 2624 2605 2625 girq = &chip->irq; 2606 2626 gpio_irq_chip_set_chip(girq, &rzg2l_gpio_irqchip); 2607 - girq->fwnode = of_node_to_fwnode(np); 2627 + girq->fwnode = dev_fwnode(pctrl->dev); 2608 2628 girq->parent_domain = parent_domain; 2609 2629 girq->child_to_parent_hwirq = rzg2l_gpio_child_to_parent_hwirq; 2610 2630 girq->populate_parent_alloc_arg = rzg2l_gpio_populate_parent_fwspec;
+1 -2
drivers/pinctrl/renesas/pinctrl-rzv2m.c
··· 196 196 { 197 197 unsigned long *cfgs; 198 198 199 - cfgs = kmemdup(configs, num_configs * sizeof(*cfgs), 200 - GFP_KERNEL); 199 + cfgs = kmemdup_array(configs, num_configs, sizeof(*cfgs), GFP_KERNEL); 201 200 if (!cfgs) 202 201 return -ENOMEM; 203 202
+1 -2
drivers/pinctrl/renesas/pinctrl.c
··· 83 83 { 84 84 unsigned long *cfgs; 85 85 86 - cfgs = kmemdup(configs, num_configs * sizeof(*cfgs), 87 - GFP_KERNEL); 86 + cfgs = kmemdup_array(configs, num_configs, sizeof(*cfgs), GFP_KERNEL); 88 87 if (cfgs == NULL) 89 88 return -ENOMEM; 90 89