Lines Matching +full:out +full:-

1 // SPDX-License-Identifier: GPL-2.0-or-later
16 #include <linux/pinctrl/pinconf-generic.h>
21 #include <dt-bindings/pinctrl/k210-fpioa.h>
25 #include "pinctrl-utils.h"
50 #define K210_PC_DO_OE BIT(14) /* set Data Out to Output Enable sig */
81 * @pins: 48 32-bits IO pin registers
130 * no pins 48-55).
176 K210_PC_DEFAULT(OUT),
204 K210_FUNC(JTAG_TDO, OUT),
213 K210_FUNC(SPI0_SS0, OUT),
214 K210_FUNC(SPI0_SS1, OUT),
215 K210_FUNC(SPI0_SS2, OUT),
216 K210_FUNC(SPI0_SS3, OUT),
218 K210_FUNC(SPI0_SCLK, OUT),
220 K210_FUNC(UARTHS_TX, OUT),
223 K210_FUNC(CLK_SPI1, OUT),
224 K210_FUNC(CLK_I2C1, OUT),
266 K210_FUNC(UART1_TX, OUT),
268 K210_FUNC(UART2_TX, OUT),
270 K210_FUNC(UART3_TX, OUT),
279 K210_FUNC(SPI1_SS0, OUT),
280 K210_FUNC(SPI1_SS1, OUT),
281 K210_FUNC(SPI1_SS2, OUT),
282 K210_FUNC(SPI1_SS3, OUT),
284 K210_FUNC(SPI1_SCLK, OUT),
288 K210_FUNC(I2S0_MCLK, OUT),
289 K210_FUNC(I2S0_SCLK, OUT),
290 K210_FUNC(I2S0_WS, OUT),
295 K210_FUNC(I2S0_OUT_D0, OUT),
296 K210_FUNC(I2S0_OUT_D1, OUT),
297 K210_FUNC(I2S0_OUT_D2, OUT),
298 K210_FUNC(I2S0_OUT_D3, OUT),
299 K210_FUNC(I2S1_MCLK, OUT),
300 K210_FUNC(I2S1_SCLK, OUT),
301 K210_FUNC(I2S1_WS, OUT),
306 K210_FUNC(I2S1_OUT_D0, OUT),
307 K210_FUNC(I2S1_OUT_D1, OUT),
308 K210_FUNC(I2S1_OUT_D2, OUT),
309 K210_FUNC(I2S1_OUT_D3, OUT),
310 K210_FUNC(I2S2_MCLK, OUT),
311 K210_FUNC(I2S2_SCLK, OUT),
312 K210_FUNC(I2S2_WS, OUT),
317 K210_FUNC(I2S2_OUT_D0, OUT),
318 K210_FUNC(I2S2_OUT_D1, OUT),
319 K210_FUNC(I2S2_OUT_D2, OUT),
320 K210_FUNC(I2S2_OUT_D3, OUT),
333 K210_FUNC(DVP_XCLK, OUT),
334 K210_FUNC(DVP_RST, OUT),
335 K210_FUNC(DVP_PWDN, OUT),
354 K210_FUNC(UART1_DTR, OUT),
355 K210_FUNC(UART1_RTS, OUT),
356 K210_FUNC(UART1_OUT2, OUT),
357 K210_FUNC(UART1_OUT1, OUT),
358 K210_FUNC(UART1_SIR_OUT, OUT),
359 K210_FUNC(UART1_BAUD, OUT),
360 K210_FUNC(UART1_RE, OUT),
361 K210_FUNC(UART1_DE, OUT),
362 K210_FUNC(UART1_RS485_EN, OUT),
368 K210_FUNC(UART2_DTR, OUT),
369 K210_FUNC(UART2_RTS, OUT),
370 K210_FUNC(UART2_OUT2, OUT),
371 K210_FUNC(UART2_OUT1, OUT),
372 K210_FUNC(UART2_SIR_OUT, OUT),
373 K210_FUNC(UART2_BAUD, OUT),
374 K210_FUNC(UART2_RE, OUT),
375 K210_FUNC(UART2_DE, OUT),
376 K210_FUNC(UART2_RS485_EN, OUT),
382 K210_FUNC(UART3_DTR, OUT),
383 K210_FUNC(UART3_RTS, OUT),
384 K210_FUNC(UART3_OUT2, OUT),
385 K210_FUNC(UART3_OUT1, OUT),
386 K210_FUNC(UART3_SIR_OUT, OUT),
387 K210_FUNC(UART3_BAUD, OUT),
388 K210_FUNC(UART3_RE, OUT),
389 K210_FUNC(UART3_DE, OUT),
390 K210_FUNC(UART3_RS485_EN, OUT),
391 K210_FUNC(TIMER0_TOGGLE1, OUT),
392 K210_FUNC(TIMER0_TOGGLE2, OUT),
393 K210_FUNC(TIMER0_TOGGLE3, OUT),
394 K210_FUNC(TIMER0_TOGGLE4, OUT),
395 K210_FUNC(TIMER1_TOGGLE1, OUT),
396 K210_FUNC(TIMER1_TOGGLE2, OUT),
397 K210_FUNC(TIMER1_TOGGLE3, OUT),
398 K210_FUNC(TIMER1_TOGGLE4, OUT),
399 K210_FUNC(TIMER2_TOGGLE1, OUT),
400 K210_FUNC(TIMER2_TOGGLE2, OUT),
401 K210_FUNC(TIMER2_TOGGLE3, OUT),
402 K210_FUNC(TIMER2_TOGGLE4, OUT),
403 K210_FUNC(CLK_SPI2, OUT),
404 K210_FUNC(CLK_I2C2, OUT),
405 K210_FUNC(INTERNAL0, OUT),
406 K210_FUNC(INTERNAL1, OUT),
407 K210_FUNC(INTERNAL2, OUT),
408 K210_FUNC(INTERNAL3, OUT),
409 K210_FUNC(INTERNAL4, OUT),
410 K210_FUNC(INTERNAL5, OUT),
411 K210_FUNC(INTERNAL6, OUT),
412 K210_FUNC(INTERNAL7, OUT),
413 K210_FUNC(INTERNAL8, OUT),
425 K210_FUNC(DEBUG0, OUT),
426 K210_FUNC(DEBUG1, OUT),
427 K210_FUNC(DEBUG2, OUT),
428 K210_FUNC(DEBUG3, OUT),
429 K210_FUNC(DEBUG4, OUT),
430 K210_FUNC(DEBUG5, OUT),
431 K210_FUNC(DEBUG6, OUT),
432 K210_FUNC(DEBUG7, OUT),
433 K210_FUNC(DEBUG8, OUT),
434 K210_FUNC(DEBUG9, OUT),
435 K210_FUNC(DEBUG10, OUT),
436 K210_FUNC(DEBUG11, OUT),
437 K210_FUNC(DEBUG12, OUT),
438 K210_FUNC(DEBUG13, OUT),
439 K210_FUNC(DEBUG14, OUT),
440 K210_FUNC(DEBUG15, OUT),
441 K210_FUNC(DEBUG16, OUT),
442 K210_FUNC(DEBUG17, OUT),
443 K210_FUNC(DEBUG18, OUT),
444 K210_FUNC(DEBUG19, OUT),
445 K210_FUNC(DEBUG20, OUT),
446 K210_FUNC(DEBUG21, OUT),
447 K210_FUNC(DEBUG22, OUT),
448 K210_FUNC(DEBUG23, OUT),
449 K210_FUNC(DEBUG24, OUT),
450 K210_FUNC(DEBUG25, OUT),
451 K210_FUNC(DEBUG26, OUT),
452 K210_FUNC(DEBUG27, OUT),
453 K210_FUNC(DEBUG28, OUT),
454 K210_FUNC(DEBUG29, OUT),
455 K210_FUNC(DEBUG30, OUT),
456 K210_FUNC(DEBUG31, OUT),
463 { "output-polarity-invert", PIN_CONFIG_OUTPUT_INVERT, 1 },
464 { "input-polarity-invert", PIN_CONFIG_INPUT_INVERT, 1 },
485 for (i = K210_PC_DRIVE_MAX; i >= 0; i--) { in k210_pinconf_get_drive()
490 return -EINVAL; in k210_pinconf_get_drive()
498 u32 mode = k210_pinconf_mode_id_to_mode[info->mode_id]; in k210_pinmux_set_pin_function()
501 dev_dbg(pdata->dev, "set pin %u function %s (%u) -> 0x%08x\n", in k210_pinmux_set_pin_function()
502 pin, info->name, func, val); in k210_pinmux_set_pin_function()
504 writel(val, &pdata->fpioa->pins[pin]); in k210_pinmux_set_pin_function()
512 u32 val = readl(&pdata->fpioa->pins[pin]); in k210_pinconf_set_param()
515 dev_dbg(pdata->dev, "set pin %u param %u, arg 0x%x\n", in k210_pinconf_set_param()
524 return -EINVAL; in k210_pinconf_set_param()
529 return -EINVAL; in k210_pinconf_set_param()
556 val = readl(&pdata->fpioa->pins[pin]); in k210_pinconf_set_param()
586 return -EINVAL; in k210_pinconf_set_param()
589 writel(val, &pdata->fpioa->pins[pin]); in k210_pinconf_set_param()
601 return -EINVAL; in k210_pinconf_set()
619 seq_printf(s, "%#x", readl(&pdata->fpioa->pins[pin])); in k210_pinconf_dbg_show()
633 return -EINVAL; in k210_pinconf_group_set()
639 return -EINVAL; in k210_pinconf_group_set()
642 bit = BIT(selector - K210_NPINS); in k210_pinconf_group_set()
643 regmap_update_bits(pdata->sysctl_map, in k210_pinconf_group_set()
644 pdata->power_offset, in k210_pinconf_group_set()
662 ret = regmap_read(pdata->sysctl_map, pdata->power_offset, &val); in k210_pinconf_group_dbg_show()
664 dev_err(pdata->dev, "Failed to read power reg\n"); in k210_pinconf_group_dbg_show()
669 val & BIT(selector - K210_NPINS) ? "1.8" : "3.3"); in k210_pinconf_group_dbg_show()
709 return -EINVAL; in k210_pinmux_set_mux()
755 seq_printf(s, "%s", dev_name(pctldev->dev)); in k210_pinctrl_pin_dbg_show()
785 dev_err(pctldev->dev, "%pOF: could not parse node property\n", in k210_pinctrl_dt_subnode_to_map()
802 ret = -EINVAL; in k210_pinctrl_dt_subnode_to_map()
809 dev_dbg(pctldev->dev, "Pinmux %s: pin %u func %s\n", in k210_pinctrl_dt_subnode_to_map()
810 np->name, pin, func_name); in k210_pinctrl_dt_subnode_to_map()
816 dev_err(pctldev->dev, "%pOF add mux map failed %d\n", in k210_pinctrl_dt_subnode_to_map()
827 dev_err(pctldev->dev, in k210_pinctrl_dt_subnode_to_map()
883 .name = "k210-pinctrl",
895 struct k210_fpioa __iomem *fpioa = pdata->fpioa; in k210_fpioa_init_ties()
899 dev_dbg(pdata->dev, "Init pin ties\n"); in k210_fpioa_init_ties()
902 for (i = 0; i < ARRAY_SIZE(fpioa->tie_en); i++) { in k210_fpioa_init_ties()
907 dev_dbg(pdata->dev, in k210_fpioa_init_ties()
916 writel(val, &fpioa->tie_val[i]); in k210_fpioa_init_ties()
917 writel(val, &fpioa->tie_en[i]); in k210_fpioa_init_ties()
923 struct device *dev = &pdev->dev; in k210_fpioa_probe()
924 struct device_node *np = dev->of_node; in k210_fpioa_probe()
932 return -ENOMEM; in k210_fpioa_probe()
934 pdata->dev = dev; in k210_fpioa_probe()
937 pdata->fpioa = devm_platform_ioremap_resource(pdev, 0); in k210_fpioa_probe()
938 if (IS_ERR(pdata->fpioa)) in k210_fpioa_probe()
939 return PTR_ERR(pdata->fpioa); in k210_fpioa_probe()
949 pdata->sysctl_map = in k210_fpioa_probe()
951 "canaan,k210-sysctl-power", in k210_fpioa_probe()
952 1, &pdata->power_offset); in k210_fpioa_probe()
953 if (IS_ERR(pdata->sysctl_map)) in k210_fpioa_probe()
954 return PTR_ERR(pdata->sysctl_map); in k210_fpioa_probe()
958 pdata->pctl = pinctrl_register(&k210_pinctrl_desc, dev, (void *)pdata); in k210_fpioa_probe()
959 if (IS_ERR(pdata->pctl)) in k210_fpioa_probe()
960 return PTR_ERR(pdata->pctl); in k210_fpioa_probe()
966 { .compatible = "canaan,k210-fpioa" },
973 .name = "k210-fpioa",