Lines Matching +full:1 +full:- +full:9 +full:a +full:- +full:e
18 #include <linux/pinctrl/pinconf-generic.h>
24 #include "pinctrl-utils.h"
68 TYPE_ND, /* Normal-drive */
69 TYPE_HD, /* High-drive */
70 TYPE_HS, /* High-speed */
207 #define LPC18XX_ANALOG_ADC(a) ((a >> 5) & 0x3) argument
213 #define LPC_P(port, pin, f0, f1, f2, f3, f4, f5, f6, f7, a, t) \ argument
221 .analog = a, \
225 #define LPC_N(pname, off, f0, f1, f2, f3, f4, f5, f6, f7, a, t) \ argument
233 .analog = a, \
241 LPC_P(0,1, GPIO, SSP1,ENET_ALT,SGPIO, R, R, ENET, I2S1, 0, ND);
242 LPC_P(1,0, GPIO, CTIN, EMC, R, R, SSP0, SGPIO, R, 0, ND);
243 LPC_P(1,1, GPIO, CTOUT, EMC, SGPIO, R, SSP0, R, R, 0, ND);
244 LPC_P(1,2, GPIO, CTOUT, EMC, SGPIO, R, SSP0, R, R, 0, ND);
245 LPC_P(1,3, GPIO, CTOUT, SGPIO, EMC, USB0, SSP1, R, SDMMC, 0, ND);
246 LPC_P(1,4, GPIO, CTOUT, SGPIO, EMC, USB0, SSP1, R, SDMMC, 0, ND);
247 LPC_P(1,5, GPIO, CTOUT, R, EMC, USB0, SSP1, SGPIO, SDMMC, 0, ND);
248 LPC_P(1,6, GPIO, CTIN, R, EMC, R, R, SGPIO, SDMMC, 0, ND);
249 LPC_P(1,7, GPIO, UART1, CTOUT, EMC, USB0, R, R, R, 0, ND);
250 LPC_P(1,8, GPIO, UART1, CTOUT, EMC, R, R, R, SDMMC, 0, ND);
251 LPC_P(1,9, GPIO, UART1, CTOUT, EMC, R, R, R, SDMMC, 0, ND);
252 LPC_P(1,10, GPIO, UART1, CTOUT, EMC, R, R, R, SDMMC, 0, ND);
253 LPC_P(1,11, GPIO, UART1, CTOUT, EMC, R, R, R, SDMMC, 0, ND);
254 LPC_P(1,12, GPIO, UART1, R, EMC, TIMER0, R, SGPIO, SDMMC, 0, ND);
255 LPC_P(1,13, GPIO, UART1, R, EMC, TIMER0, R, SGPIO, SDMMC, 0, ND);
256 LPC_P(1,14, GPIO, UART1, R, EMC, TIMER0, R, SGPIO, R, 0, ND);
257 LPC_P(1,15, GPIO, UART2, SGPIO, ENET, TIMER0, R, R, R, 0, ND);
258 LPC_P(1,16, GPIO, UART2, SGPIO,ENET_ALT,TIMER0, R, R, ENET, 0, ND);
259 LPC_P(1,17, GPIO, UART2, R, ENET, TIMER0, CAN1, SGPIO, R, 0, HD);
260 LPC_P(1,18, GPIO, UART2, R, ENET, TIMER0, CAN1, SGPIO, R, 0, ND);
261 LPC_P(1,19, ENET, SSP1, R, R, CLKOUT, R, I2S0_RX_MCLK,I2S1, 0, ND);
262 LPC_P(1,20, GPIO, SSP1, R, ENET, TIMER0, R, SGPIO, R, 0, ND);
264 LPC_P(2,1, SGPIO, UART0, EMC, USB0, GPIO, R, TIMER3, R, 0, ND);
272 LPC_P(2,9, GPIO, CTOUT, UART3, EMC, R, R, R, R, 0, ND);
278 LPC_P(3,1, I2S0_TX_WS, I2S0_RX_WS,CAN0,USB1,GPIO, R, LCD, R, 0, ND);
287 LPC_P(4,1, GPIO, CTOUT, LCD, R, R, LCD_ALT, UART3, ENET, ADC0|1, ND);
295 LPC_P(4,9, R, CTIN, LCD, R, GPIO, LCD_ALT, CAN1, SGPIO, 0, ND);
298 LPC_P(5,1, GPIO, MCTRL, EMC, R, UART1, TIMER1, R, R, 0, ND);
306 LPC_P(6,1, GPIO, EMC, UART0, I2S0_RX_WS, R, TIMER2, R, R, 0, ND);
314 LPC_P(6,9, GPIO, R, R, EMC, R, TIMER2, R, R, 0, ND);
319 LPC_P(7,1, GPIO, CTOUT,I2S0_TX_WS,LCD,LCD_ALT, R, UART2, SGPIO, 0, ND);
327 LPC_P(8,1, GPIO, USB0, R, MCTRL, SGPIO, R, R, TIMER0, 0, HD);
335 LPC_P(9,0, GPIO, MCTRL, R, R, R, ENET, SGPIO, SSP0, 0, ND);
336 LPC_P(9,1, GPIO, MCTRL, R, R, I2S0_TX_WS,ENET, SGPIO, SSP0, 0, ND);
337 LPC_P(9,2, GPIO, MCTRL, R, R, I2S0_TX_SDA,ENET,SGPIO, SSP0, 0, ND);
338 LPC_P(9,3, GPIO, MCTRL, USB1, R, R, ENET, SGPIO, UART3, 0, ND);
339 LPC_P(9,4, R, MCTRL, USB1, R, GPIO, ENET, SGPIO, UART3, 0, ND);
340 LPC_P(9,5, R, MCTRL, USB1, R, GPIO, ENET, SGPIO, UART0, 0, ND);
341 LPC_P(9,6, GPIO, MCTRL, USB1, R, R, ENET, SGPIO, UART0, 0, ND);
342 LPC_P(a,0, R, R, R, R, R, I2S1, CGU_OUT, R, 0, ND);
343 LPC_P(a,1, GPIO, QEI, R, UART2, R, R, R, R, 0, HD);
344 LPC_P(a,2, GPIO, QEI, R, UART2, R, R, R, R, 0, HD);
345 LPC_P(a,3, GPIO, QEI, R, R, R, R, R, R, 0, HD);
346 LPC_P(a,4, R, CTOUT, R, EMC, GPIO, R, R, R, 0, ND);
348 LPC_P(b,1, R, USB1, LCD, R, GPIO, CTOUT, R, R, 0, ND);
354 LPC_P(c,0, R, USB1, R, ENET, LCD, R, R, SDMMC, ADC1|1, ND);
355 LPC_P(c,1, USB1, R, UART1, ENET, GPIO, R, TIMER3, SDMMC, 0, ND);
363 LPC_P(c,9, R, USB1, R, ENET, GPIO, R, TIMER3, SDMMC, 0, ND);
370 LPC_P(d,1, R, R, EMC, R, GPIO, SDMMC, R, SGPIO, 0, ND);
378 LPC_P(d,9, R, CTOUT, EMC, R, GPIO, R, R, SGPIO, 0, ND);
386 LPC_P(e,0, R, R, R, EMC, GPIO, CAN1, R, R, 0, ND);
387 LPC_P(e,1, R, R, R, EMC, GPIO, CAN1, R, R, 0, ND);
388 LPC_P(e,2,ADCTRIG, CAN0, R, EMC, GPIO, R, R, R, 0, ND);
389 LPC_P(e,3, R, CAN0,ADCTRIG, EMC, GPIO, R, R, R, 0, ND);
390 LPC_P(e,4, R, NMI, R, EMC, GPIO, R, R, R, 0, ND);
391 LPC_P(e,5, R, CTOUT, UART1, EMC, GPIO, R, R, R, 0, ND);
392 LPC_P(e,6, R, CTOUT, UART1, EMC, GPIO, R, R, R, 0, ND);
393 LPC_P(e,7, R, CTOUT, UART1, EMC, GPIO, R, R, R, 0, ND);
394 LPC_P(e,8, R, CTOUT, UART1, EMC, GPIO, R, R, R, 0, ND);
395 LPC_P(e,9, R, CTIN, UART1, EMC, GPIO, R, R, R, 0, ND);
396 LPC_P(e,10, R, CTIN, UART1, EMC, GPIO, R, R, R, 0, ND);
397 LPC_P(e,11, R, CTOUT, UART1, EMC, GPIO, R, R, R, 0, ND);
398 LPC_P(e,12, R, CTOUT, UART1, EMC, GPIO, R, R, R, 0, ND);
399 LPC_P(e,13, R, CTOUT, I2C1, EMC, GPIO, R, R, R, 0, ND);
400 LPC_P(e,14, R, R, R, EMC, GPIO, R, R, R, 0, ND);
401 LPC_P(e,15, R, CTOUT, I2C1, EMC, GPIO, R, R, R, 0, ND);
403 LPC_P(f,1, R, R, SSP0, R, GPIO, R, SGPIO, R, 0, ND);
411 LPC_P(f,9, R, UART0, CTOUT, R, GPIO, R, SGPIO, R, ADC1|2, ND);
451 LPC18XX_PIN_P(0,1),
452 LPC18XX_PIN_P(1,0),
453 LPC18XX_PIN_P(1,1),
454 LPC18XX_PIN_P(1,2),
455 LPC18XX_PIN_P(1,3),
456 LPC18XX_PIN_P(1,4),
457 LPC18XX_PIN_P(1,5),
458 LPC18XX_PIN_P(1,6),
459 LPC18XX_PIN_P(1,7),
460 LPC18XX_PIN_P(1,8),
461 LPC18XX_PIN_P(1,9),
462 LPC18XX_PIN_P(1,10),
463 LPC18XX_PIN_P(1,11),
464 LPC18XX_PIN_P(1,12),
465 LPC18XX_PIN_P(1,13),
466 LPC18XX_PIN_P(1,14),
467 LPC18XX_PIN_P(1,15),
468 LPC18XX_PIN_P(1,16),
469 LPC18XX_PIN_P(1,17),
470 LPC18XX_PIN_P(1,18),
471 LPC18XX_PIN_P(1,19),
472 LPC18XX_PIN_P(1,20),
474 LPC18XX_PIN_P(2,1),
482 LPC18XX_PIN_P(2,9),
488 LPC18XX_PIN_P(3,1),
497 LPC18XX_PIN_P(4,1),
505 LPC18XX_PIN_P(4,9),
508 LPC18XX_PIN_P(5,1),
516 LPC18XX_PIN_P(6,1),
524 LPC18XX_PIN_P(6,9),
529 LPC18XX_PIN_P(7,1),
537 LPC18XX_PIN_P(8,1),
545 LPC18XX_PIN_P(9,0),
546 LPC18XX_PIN_P(9,1),
547 LPC18XX_PIN_P(9,2),
548 LPC18XX_PIN_P(9,3),
549 LPC18XX_PIN_P(9,4),
550 LPC18XX_PIN_P(9,5),
551 LPC18XX_PIN_P(9,6),
552 LPC18XX_PIN_P(a,0),
553 LPC18XX_PIN_P(a,1),
554 LPC18XX_PIN_P(a,2),
555 LPC18XX_PIN_P(a,3),
556 LPC18XX_PIN_P(a,4),
558 LPC18XX_PIN_P(b,1),
565 LPC18XX_PIN_P(c,1),
573 LPC18XX_PIN_P(c,9),
580 LPC18XX_PIN_P(d,1),
588 LPC18XX_PIN_P(d,9),
596 LPC18XX_PIN_P(e,0),
597 LPC18XX_PIN_P(e,1),
598 LPC18XX_PIN_P(e,2),
599 LPC18XX_PIN_P(e,3),
600 LPC18XX_PIN_P(e,4),
601 LPC18XX_PIN_P(e,5),
602 LPC18XX_PIN_P(e,6),
603 LPC18XX_PIN_P(e,7),
604 LPC18XX_PIN_P(e,8),
605 LPC18XX_PIN_P(e,9),
606 LPC18XX_PIN_P(e,10),
607 LPC18XX_PIN_P(e,11),
608 LPC18XX_PIN_P(e,12),
609 LPC18XX_PIN_P(e,13),
610 LPC18XX_PIN_P(e,14),
611 LPC18XX_PIN_P(e,15),
613 LPC18XX_PIN_P(f,1),
621 LPC18XX_PIN_P(f,9),
636 #define PIN_CONFIG_GPIO_PIN_INT (PIN_CONFIG_END + 1)
639 {"nxp,gpio-pin-interrupt", PIN_CONFIG_GPIO_PIN_INT, 0},
655 *arg = 1; in lpc18xx_pconf_get_usb1()
660 return -EINVAL; in lpc18xx_pconf_get_usb1()
665 *arg = 1; in lpc18xx_pconf_get_usb1()
667 return -EINVAL; in lpc18xx_pconf_get_usb1()
671 return -ENOTSUPP; in lpc18xx_pconf_get_usb1()
690 *arg = 1; in lpc18xx_pconf_get_i2c0()
692 return -EINVAL; in lpc18xx_pconf_get_i2c0()
697 *arg = 1; in lpc18xx_pconf_get_i2c0()
711 return -EINVAL; in lpc18xx_pconf_get_i2c0()
713 *arg = 1; in lpc18xx_pconf_get_i2c0()
717 return -ENOTSUPP; in lpc18xx_pconf_get_i2c0()
729 return -EINVAL; in lpc18xx_pin_to_gpio()
731 return pin - range->pin_base + range->base; in lpc18xx_pin_to_gpio()
745 *arg += 1; in lpc18xx_get_pintsel()
748 return -EINVAL; in lpc18xx_get_pintsel()
770 return -ENOTSUPP; in lpc18xx_pconf_get_gpio_pin_int()
775 * Check if this pin has been enabled as a interrupt in any of the two in lpc18xx_pconf_get_gpio_pin_int()
776 * PINTSEL registers. *arg indicates which interrupt number (0-7). in lpc18xx_pconf_get_gpio_pin_int()
779 ret = lpc18xx_get_pintsel(scu->base + LPC18XX_SCU_PINTSEL0, val, arg); in lpc18xx_pconf_get_gpio_pin_int()
783 return lpc18xx_get_pintsel(scu->base + LPC18XX_SCU_PINTSEL1, val, arg); in lpc18xx_pconf_get_gpio_pin_int()
795 return -EINVAL; in lpc18xx_pconf_get_pin()
800 return -EINVAL; in lpc18xx_pconf_get_pin()
802 *arg = 1; in lpc18xx_pconf_get_pin()
807 *arg = 1; in lpc18xx_pconf_get_pin()
809 return -EINVAL; in lpc18xx_pconf_get_pin()
814 *arg = 1; in lpc18xx_pconf_get_pin()
816 return -EINVAL; in lpc18xx_pconf_get_pin()
820 if (pin_cap->type == TYPE_HD) in lpc18xx_pconf_get_pin()
821 return -ENOTSUPP; in lpc18xx_pconf_get_pin()
824 *arg = 1; in lpc18xx_pconf_get_pin()
831 return -EINVAL; in lpc18xx_pconf_get_pin()
833 *arg = 1; in lpc18xx_pconf_get_pin()
837 if (pin_cap->type != TYPE_HD) in lpc18xx_pconf_get_pin()
838 return -ENOTSUPP; in lpc18xx_pconf_get_pin()
846 case 1: *arg += 3; in lpc18xx_pconf_get_pin()
856 return -ENOTSUPP; in lpc18xx_pconf_get_pin()
885 return -EINVAL; in lpc18xx_pconf_get()
887 reg = readl(scu->base + pin_cap->offset); in lpc18xx_pconf_get()
889 if (pin_cap->type == TYPE_I2C0) in lpc18xx_pconf_get()
891 else if (pin_cap->type == TYPE_USB1) in lpc18xx_pconf_get()
925 dev_err(pctldev->dev, "Property not supported\n"); in lpc18xx_pconf_set_usb1()
926 return -ENOTSUPP; in lpc18xx_pconf_set_usb1()
965 return -ENOTSUPP; in lpc18xx_pconf_set_i2c0()
976 dev_err(pctldev->dev, "Property not supported\n"); in lpc18xx_pconf_set_i2c0()
977 return -ENOTSUPP; in lpc18xx_pconf_set_i2c0()
991 return -EINVAL; in lpc18xx_pconf_set_gpio_pin_int()
995 return -ENOTSUPP; in lpc18xx_pconf_set_gpio_pin_int()
1001 reg_val = readl(scu->base + reg_offset); in lpc18xx_pconf_set_gpio_pin_int()
1004 writel(reg_val, scu->base + reg_offset); in lpc18xx_pconf_set_gpio_pin_int()
1035 if (pin_cap->type == TYPE_HD) { in lpc18xx_pconf_set_pin()
1036 dev_err(pctldev->dev, "Slew rate unsupported on high-drive pins\n"); in lpc18xx_pconf_set_pin()
1037 return -ENOTSUPP; in lpc18xx_pconf_set_pin()
1054 if (pin_cap->type != TYPE_HD) { in lpc18xx_pconf_set_pin()
1055 dev_err(pctldev->dev, "Drive strength available only on high-drive pins\n"); in lpc18xx_pconf_set_pin()
1056 return -ENOTSUPP; in lpc18xx_pconf_set_pin()
1061 case 20: param_val -= 5; in lpc18xx_pconf_set_pin()
1063 case 14: param_val -= 5; in lpc18xx_pconf_set_pin()
1065 case 8: param_val -= 3; in lpc18xx_pconf_set_pin()
1067 case 4: param_val -= 4; in lpc18xx_pconf_set_pin()
1070 dev_err(pctldev->dev, "Drive strength %u unsupported\n", param_val); in lpc18xx_pconf_set_pin()
1071 return -ENOTSUPP; in lpc18xx_pconf_set_pin()
1080 dev_err(pctldev->dev, "Property not supported\n"); in lpc18xx_pconf_set_pin()
1081 return -ENOTSUPP; in lpc18xx_pconf_set_pin()
1100 return -EINVAL; in lpc18xx_pconf_set()
1102 reg = readl(scu->base + pin_cap->offset); in lpc18xx_pconf_set()
1108 if (pin_cap->type == TYPE_I2C0) in lpc18xx_pconf_set()
1110 else if (pin_cap->type == TYPE_USB1) in lpc18xx_pconf_set()
1119 writel(reg, scu->base + pin_cap->offset); in lpc18xx_pconf_set()
1148 *groups = scu->func[function].groups; in lpc18xx_pmx_get_func_groups()
1149 *num_groups = scu->func[function].ngroups; in lpc18xx_pmx_get_func_groups()
1163 if (pin->type == TYPE_USB1) { in lpc18xx_pmx_set()
1170 if (pin->type == TYPE_I2C0) { in lpc18xx_pmx_set()
1177 if (function == FUNC_ADC && (pin->analog & LPC18XX_ANALOG_PIN)) { in lpc18xx_pmx_set()
1180 writel(LPC18XX_SCU_ANALOG_PIN_CFG, scu->base + pin->offset); in lpc18xx_pmx_set()
1182 if (LPC18XX_ANALOG_ADC(pin->analog) == 0) in lpc18xx_pmx_set()
1187 reg = readl(scu->base + offset); in lpc18xx_pmx_set()
1188 reg |= pin->analog & LPC18XX_ANALOG_BIT_MASK; in lpc18xx_pmx_set()
1189 writel(reg, scu->base + offset); in lpc18xx_pmx_set()
1194 if (function == FUNC_DAC && (pin->analog & LPC18XX_ANALOG_PIN)) { in lpc18xx_pmx_set()
1195 writel(LPC18XX_SCU_ANALOG_PIN_CFG, scu->base + pin->offset); in lpc18xx_pmx_set()
1197 reg = readl(scu->base + LPC18XX_SCU_REG_ENAIO2); in lpc18xx_pmx_set()
1199 writel(reg, scu->base + LPC18XX_SCU_REG_ENAIO2); in lpc18xx_pmx_set()
1205 if (function == pin->functions[func]) in lpc18xx_pmx_set()
1212 reg = readl(scu->base + pin->offset); in lpc18xx_pmx_set()
1214 writel(reg | func, scu->base + pin->offset); in lpc18xx_pmx_set()
1218 dev_err(pctldev->dev, "Pin %s can't be %s\n", lpc18xx_pins[group].name, in lpc18xx_pmx_set()
1220 return -EINVAL; in lpc18xx_pmx_set()
1247 *num_pins = 1; in lpc18xx_pctl_get_group_pins()
1261 .name = "lpc18xx/43xx-scu",
1280 if (function == FUNC_DAC && p->analog == DAC) in lpc18xx_valid_pin_function()
1283 if (function == FUNC_ADC && p->analog) in lpc18xx_valid_pin_function()
1286 if (function == FUNC_I2C0 && p->type == TYPE_I2C0) in lpc18xx_valid_pin_function()
1289 if (function == FUNC_USB1 && p->type == TYPE_USB1) in lpc18xx_valid_pin_function()
1293 if (function == p->functions[i]) in lpc18xx_valid_pin_function()
1312 scu->func[func].ngroups = ngroups; in lpc18xx_create_group_func_map()
1313 scu->func[func].groups = devm_kcalloc(dev, in lpc18xx_create_group_func_map()
1316 if (!scu->func[func].groups) in lpc18xx_create_group_func_map()
1317 return -ENOMEM; in lpc18xx_create_group_func_map()
1320 scu->func[func].groups[i] = lpc18xx_pins[pins[i]].name; in lpc18xx_create_group_func_map()
1331 scu = devm_kzalloc(&pdev->dev, sizeof(*scu), GFP_KERNEL); in lpc18xx_scu_probe()
1333 return -ENOMEM; in lpc18xx_scu_probe()
1335 scu->base = devm_platform_ioremap_resource(pdev, 0); in lpc18xx_scu_probe()
1336 if (IS_ERR(scu->base)) in lpc18xx_scu_probe()
1337 return PTR_ERR(scu->base); in lpc18xx_scu_probe()
1339 scu->clk = devm_clk_get(&pdev->dev, NULL); in lpc18xx_scu_probe()
1340 if (IS_ERR(scu->clk)) { in lpc18xx_scu_probe()
1341 dev_err(&pdev->dev, "Input clock not found.\n"); in lpc18xx_scu_probe()
1342 return PTR_ERR(scu->clk); in lpc18xx_scu_probe()
1345 ret = lpc18xx_create_group_func_map(&pdev->dev, scu); in lpc18xx_scu_probe()
1347 dev_err(&pdev->dev, "Unable to create group func map.\n"); in lpc18xx_scu_probe()
1351 ret = clk_prepare_enable(scu->clk); in lpc18xx_scu_probe()
1353 dev_err(&pdev->dev, "Unable to enable clock.\n"); in lpc18xx_scu_probe()
1359 scu->pctl = devm_pinctrl_register(&pdev->dev, &lpc18xx_scu_desc, scu); in lpc18xx_scu_probe()
1360 if (IS_ERR(scu->pctl)) { in lpc18xx_scu_probe()
1361 dev_err(&pdev->dev, "Could not register pinctrl driver\n"); in lpc18xx_scu_probe()
1362 clk_disable_unprepare(scu->clk); in lpc18xx_scu_probe()
1363 return PTR_ERR(scu->pctl); in lpc18xx_scu_probe()
1370 { .compatible = "nxp,lpc1850-scu" },
1377 .name = "lpc18xx-scu",