Lines Matching +full:strong +full:- +full:pull +full:- +full:up
1 // SPDX-License-Identifier: GPL-2.0-or-later
17 #include <linux/pinctrl/pinconf-generic.h>
19 #include <dt-bindings/pinctrl/k210-fpioa.h>
23 #include "pinctrl-utils.h"
50 #define K210_PC_PU BIT(16) /* Pull Up */
51 #define K210_PC_PD BIT(17) /* Pull Down */
52 /* Strong pull up not implemented on K210 */
79 * @pins: 48 32-bits IO pin registers
130 * no pins 48-55).
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()
787 dev_err(pctldev->dev, "%pOF: could not parse node property\n", in k210_pinctrl_dt_subnode_to_map()
804 ret = -EINVAL; in k210_pinctrl_dt_subnode_to_map()
811 dev_dbg(pctldev->dev, "Pinmux %s: pin %u func %s\n", in k210_pinctrl_dt_subnode_to_map()
812 np->name, pin, func_name); in k210_pinctrl_dt_subnode_to_map()
818 dev_err(pctldev->dev, "%pOF add mux map failed %d\n", in k210_pinctrl_dt_subnode_to_map()
829 dev_err(pctldev->dev, in k210_pinctrl_dt_subnode_to_map()
886 .name = "k210-pinctrl",
898 struct k210_fpioa __iomem *fpioa = pdata->fpioa; in k210_fpioa_init_ties()
902 dev_dbg(pdata->dev, "Init pin ties\n"); in k210_fpioa_init_ties()
905 for (i = 0; i < ARRAY_SIZE(fpioa->tie_en); i++) { in k210_fpioa_init_ties()
910 dev_dbg(pdata->dev, in k210_fpioa_init_ties()
919 writel(val, &fpioa->tie_val[i]); in k210_fpioa_init_ties()
920 writel(val, &fpioa->tie_en[i]); in k210_fpioa_init_ties()
926 struct device *dev = &pdev->dev; in k210_fpioa_probe()
927 struct device_node *np = dev->of_node; in k210_fpioa_probe()
935 return -ENOMEM; in k210_fpioa_probe()
937 pdata->dev = dev; in k210_fpioa_probe()
940 pdata->fpioa = devm_platform_ioremap_resource(pdev, 0); in k210_fpioa_probe()
941 if (IS_ERR(pdata->fpioa)) in k210_fpioa_probe()
942 return PTR_ERR(pdata->fpioa); in k210_fpioa_probe()
944 pdata->clk = devm_clk_get(dev, "ref"); in k210_fpioa_probe()
945 if (IS_ERR(pdata->clk)) in k210_fpioa_probe()
946 return PTR_ERR(pdata->clk); in k210_fpioa_probe()
948 ret = clk_prepare_enable(pdata->clk); in k210_fpioa_probe()
952 pdata->pclk = devm_clk_get_optional(dev, "pclk"); in k210_fpioa_probe()
953 if (!IS_ERR(pdata->pclk)) { in k210_fpioa_probe()
954 ret = clk_prepare_enable(pdata->pclk); in k210_fpioa_probe()
959 pdata->sysctl_map = in k210_fpioa_probe()
961 "canaan,k210-sysctl-power", in k210_fpioa_probe()
962 1, &pdata->power_offset); in k210_fpioa_probe()
963 if (IS_ERR(pdata->sysctl_map)) { in k210_fpioa_probe()
964 ret = PTR_ERR(pdata->sysctl_map); in k210_fpioa_probe()
970 pdata->pctl = pinctrl_register(&k210_pinctrl_desc, dev, (void *)pdata); in k210_fpioa_probe()
971 if (IS_ERR(pdata->pctl)) { in k210_fpioa_probe()
972 ret = PTR_ERR(pdata->pctl); in k210_fpioa_probe()
979 clk_disable_unprepare(pdata->pclk); in k210_fpioa_probe()
981 clk_disable_unprepare(pdata->clk); in k210_fpioa_probe()
987 { .compatible = "canaan,k210-fpioa" },
994 .name = "k210-fpioa",