Lines Matching +full:cgu +full:- +full:xway
1 // SPDX-License-Identifier: GPL-2.0-only
3 * linux/drivers/pinctrl/pinmux-xway.c
4 * based on linux/drivers/pinctrl/pinmux-pxa910.c
21 #include "pinctrl-lantiq.h"
110 /* --------- DEPRECATED: xr9 related code --------- */
111 /* ---------- use xrx100/xrx200 instead ---------- */
118 MFP_XWAY(GPIO2, GPIO, CGU, EXIN, GPHY),
119 MFP_XWAY(GPIO3, GPIO, CGU, NONE, PCI),
123 MFP_XWAY(GPIO7, GPIO, CGU, PCI, GPHY),
124 MFP_XWAY(GPIO8, GPIO, CGU, NMI, NONE),
130 MFP_XWAY(GPIO14, GPIO, CGU, PCI, NONE),
266 GRP_MUX("clkout0", CGU, pins_clkout0),
267 GRP_MUX("clkout1", CGU, pins_clkout1),
268 GRP_MUX("clkout2", CGU, pins_clkout2),
269 GRP_MUX("clkout3", CGU, pins_clkout3),
335 {"cgu", ARRAY_AND_SIZE(xway_cgu_grps)},
347 /* --------- ase related code --------- */
363 MFP_XWAY(GPIO11, GPIO, EBU, CGU, JTAG),
365 MFP_XWAY(GPIO13, GPIO, EBU, MII, CGU),
366 MFP_XWAY(GPIO14, GPIO, EBU, SPI, CGU),
374 MFP_XWAY(GPIO22, GPIO, EBU, MII, CGU),
375 MFP_XWAY(GPIO23, GPIO, EBU, MII, CGU),
435 GRP_MUX("clkout0", CGU, ase_pins_clkout0),
436 GRP_MUX("clkout1", CGU, ase_pins_clkout1),
437 GRP_MUX("clkout2", CGU, ase_pins_clkout2),
465 {"cgu", ARRAY_AND_SIZE(ase_cgu_grps)},
475 /* --------- danube related code --------- */
482 MFP_XWAY(GPIO2, GPIO, CGU, EXIN, MII),
483 MFP_XWAY(GPIO3, GPIO, CGU, SDIO, PCI),
487 MFP_XWAY(GPIO7, GPIO, CGU, CBUS, MII),
488 MFP_XWAY(GPIO8, GPIO, CGU, NMI, MII),
494 MFP_XWAY(GPIO14, GPIO, CGU, CBUS, MII),
598 GRP_MUX("clkout0", CGU, danube_pins_clkout0),
599 GRP_MUX("clkout1", CGU, danube_pins_clkout1),
600 GRP_MUX("clkout2", CGU, danube_pins_clkout2),
601 GRP_MUX("clkout3", CGU, danube_pins_clkout3),
639 {"cgu", ARRAY_AND_SIZE(danube_cgu_grps)},
650 /* --------- xrx100 related code --------- */
657 MFP_XWAY(GPIO2, GPIO, CGU, EXIN, NONE),
658 MFP_XWAY(GPIO3, GPIO, CGU, SDIO, PCI),
662 MFP_XWAY(GPIO7, GPIO, CGU, CBUS, NONE),
663 MFP_XWAY(GPIO8, GPIO, CGU, NMI, NONE),
669 MFP_XWAY(GPIO14, GPIO, CGU, NONE, NONE),
674 MFP_XWAY(GPIO19, GPIO, PCI, SDIO, CGU),
806 GRP_MUX("clkout0", CGU, xrx100_pins_clkout0),
807 GRP_MUX("clkout1", CGU, xrx100_pins_clkout1),
808 GRP_MUX("clkout2", CGU, xrx100_pins_clkout2),
809 GRP_MUX("clkout3", CGU, xrx100_pins_clkout3),
852 {"cgu", ARRAY_AND_SIZE(xrx100_cgu_grps)},
863 /* --------- xrx200 related code --------- */
870 MFP_XWAY(GPIO2, GPIO, CGU, EXIN, GPHY),
871 MFP_XWAY(GPIO3, GPIO, CGU, SDIO, PCI),
875 MFP_XWAY(GPIO7, GPIO, CGU, CBUS, GPHY),
876 MFP_XWAY(GPIO8, GPIO, CGU, NMI, NONE),
882 MFP_XWAY(GPIO14, GPIO, CGU, CBUS, USIF),
887 MFP_XWAY(GPIO19, GPIO, PCI, SDIO, CGU),
890 MFP_XWAY(GPIO22, GPIO, SPI, CGU, EBU),
1046 GRP_MUX("clkout0", CGU, xrx200_pins_clkout0),
1047 GRP_MUX("clkout1", CGU, xrx200_pins_clkout1),
1048 GRP_MUX("clkout2", CGU, xrx200_pins_clkout2),
1049 GRP_MUX("clkout3", CGU, xrx200_pins_clkout3),
1107 {"cgu", ARRAY_AND_SIZE(xrx200_cgu_grps)},
1119 /* --------- xrx300 related code --------- */
1127 MFP_XWAY(GPIO3, GPIO, CGU, NONE, NONE),
1132 MFP_XWAY(GPIO8, GPIO, CGU, GPHY, EPHY),
1138 MFP_XWAY(GPIO14, GPIO, CGU, USIF, EPHY),
1286 GRP_MUX("clkout2", CGU, xrx300_pins_clkout2),
1323 {"cgu", ARRAY_AND_SIZE(xrx300_cgu_grps)},
1332 /* --------- pinconf related code --------- */
1349 !gpio_getbit(info->membase[0], reg, PORT_PIN(pin))); in xway_pinconf_get()
1357 if (!gpio_getbit(info->membase[0], reg, PORT_PIN(pin))) { in xway_pinconf_get()
1366 if (!gpio_getbit(info->membase[0], reg, PORT_PIN(pin))) in xway_pinconf_get()
1375 gpio_getbit(info->membase[0], reg, PORT_PIN(pin))); in xway_pinconf_get()
1378 dev_err(pctldev->dev, "Invalid config param %04x\n", param); in xway_pinconf_get()
1379 return -ENOTSUPP; in xway_pinconf_get()
1407 gpio_setbit(info->membase[0], in xway_pinconf_set()
1411 gpio_clearbit(info->membase[0], in xway_pinconf_set()
1422 gpio_clearbit(info->membase[0], in xway_pinconf_set()
1427 gpio_setbit(info->membase[0], reg, PORT_PIN(pin)); in xway_pinconf_set()
1434 gpio_clearbit(info->membase[0], in xway_pinconf_set()
1438 gpio_setbit(info->membase[0], in xway_pinconf_set()
1442 dev_err(pctldev->dev, in xway_pinconf_set()
1449 gpio_clearbit(info->membase[0], in xway_pinconf_set()
1453 gpio_setbit(info->membase[0], in xway_pinconf_set()
1459 dev_err(pctldev->dev, in xway_pinconf_set()
1461 return -ENOTSUPP; in xway_pinconf_set()
1476 for (i = 0; i < info->grps[selector].npins && !ret; i++) in xway_pinconf_group_set()
1478 info->grps[selector].pins[i], in xway_pinconf_group_set()
1507 gpio_setbit(info->membase[0], GPIO_ALT0(pin), PORT_PIN(pin)); in xway_mux_apply()
1509 gpio_clearbit(info->membase[0], GPIO_ALT0(pin), PORT_PIN(pin)); in xway_mux_apply()
1512 gpio_setbit(info->membase[0], alt1_reg, PORT_PIN(pin)); in xway_mux_apply()
1514 gpio_clearbit(info->membase[0], alt1_reg, PORT_PIN(pin)); in xway_mux_apply()
1521 {"lantiq,open-drain", LTQ_PINCONF_PARAM_OPEN_DRAIN},
1532 /* --------- gpio_chip related code --------- */
1535 struct ltq_pinmux_info *info = dev_get_drvdata(chip->parent); in xway_gpio_set()
1538 gpio_setbit(info->membase[0], GPIO_OUT(pin), PORT_PIN(pin)); in xway_gpio_set()
1540 gpio_clearbit(info->membase[0], GPIO_OUT(pin), PORT_PIN(pin)); in xway_gpio_set()
1545 struct ltq_pinmux_info *info = dev_get_drvdata(chip->parent); in xway_gpio_get()
1547 return !!gpio_getbit(info->membase[0], GPIO_IN(pin), PORT_PIN(pin)); in xway_gpio_get()
1552 struct ltq_pinmux_info *info = dev_get_drvdata(chip->parent); in xway_gpio_dir_in()
1554 gpio_clearbit(info->membase[0], GPIO_DIR(pin), PORT_PIN(pin)); in xway_gpio_dir_in()
1561 struct ltq_pinmux_info *info = dev_get_drvdata(chip->parent); in xway_gpio_dir_out()
1564 gpio_setbit(info->membase[0], GPIO3_OD, PORT_PIN(pin)); in xway_gpio_dir_out()
1566 gpio_setbit(info->membase[0], GPIO_OD(pin), PORT_PIN(pin)); in xway_gpio_dir_out()
1567 gpio_setbit(info->membase[0], GPIO_DIR(pin), PORT_PIN(pin)); in xway_gpio_dir_out()
1579 struct ltq_pinmux_info *info = dev_get_drvdata(chip->parent); in xway_gpio_to_irq()
1582 for (i = 0; i < info->num_exin; i++) in xway_gpio_to_irq()
1583 if (info->exin[i] == offset) in xway_gpio_to_irq()
1586 return -1; in xway_gpio_to_irq()
1590 .label = "gpio-xway",
1598 .base = -1,
1602 /* --------- register the pinctrl layer --------- */
1614 /* xway xr9 series (DEPRECATED: Use XWAY xRX100/xRX200 Family) */
1626 /* XWAY AMAZON Family */
1638 /* XWAY DANUBE Family */
1650 /* XWAY xRX100 Family */
1662 /* XWAY xRX200 Family */
1674 /* XWAY xRX300 Family */
1687 .name = "XWAY GPIO",
1692 { .compatible = "lantiq,pinctrl-xway", .data = &danube_pinctrl}, /*DEPRECATED*/
1693 { .compatible = "lantiq,pinctrl-xr9", .data = &xr9_pinctrl}, /*DEPRECATED*/
1694 { .compatible = "lantiq,pinctrl-ase", .data = &ase_pinctrl}, /*DEPRECATED*/
1695 { .compatible = "lantiq,ase-pinctrl", .data = &ase_pinctrl},
1696 { .compatible = "lantiq,danube-pinctrl", .data = &danube_pinctrl},
1697 { .compatible = "lantiq,xrx100-pinctrl", .data = &xrx100_pinctrl},
1698 { .compatible = "lantiq,xrx200-pinctrl", .data = &xrx200_pinctrl},
1699 { .compatible = "lantiq,xrx300-pinctrl", .data = &xrx300_pinctrl},
1715 match = of_match_device(xway_match, &pdev->dev); in pinmux_xway_probe()
1717 xway_soc = (const struct pinctrl_xway_soc *) match->data; in pinmux_xway_probe()
1722 xway_chip.ngpio = xway_soc->pin_count; in pinmux_xway_probe()
1725 xway_info.pads = devm_kcalloc(&pdev->dev, in pinmux_xway_probe()
1729 return -ENOMEM; in pinmux_xway_probe()
1732 char *name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "io%d", i); in pinmux_xway_probe()
1735 return -ENOMEM; in pinmux_xway_probe()
1743 xway_pctrl_desc.name = dev_name(&pdev->dev); in pinmux_xway_probe()
1748 xway_info.mfp = xway_soc->mfp; in pinmux_xway_probe()
1749 xway_info.grps = xway_soc->grps; in pinmux_xway_probe()
1750 xway_info.num_grps = xway_soc->num_grps; in pinmux_xway_probe()
1751 xway_info.funcs = xway_soc->funcs; in pinmux_xway_probe()
1752 xway_info.num_funcs = xway_soc->num_funcs; in pinmux_xway_probe()
1753 xway_info.exin = xway_soc->exin; in pinmux_xway_probe()
1754 xway_info.num_exin = xway_soc->num_exin; in pinmux_xway_probe()
1759 dev_err(&pdev->dev, "Failed to register pinctrl driver\n"); in pinmux_xway_probe()
1764 xway_chip.parent = &pdev->dev; in pinmux_xway_probe()
1766 ret = devm_gpiochip_add_data(&pdev->dev, &xway_chip, NULL); in pinmux_xway_probe()
1768 dev_err(&pdev->dev, "Failed to register gpio chip\n"); in pinmux_xway_probe()
1773 * For DeviceTree-supported systems, the gpio core checks the in pinmux_xway_probe()
1774 * pinctrl's device node for the "gpio-ranges" property. in pinmux_xway_probe()
1779 * files which don't set the "gpio-ranges" property or systems that in pinmux_xway_probe()
1782 if (!of_property_read_bool(pdev->dev.of_node, "gpio-ranges")) { in pinmux_xway_probe()
1789 dev_info(&pdev->dev, "Init done\n"); in pinmux_xway_probe()
1796 .name = "pinctrl-xway",