Lines Matching +full:mdio +full:- +full:gpio0
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 /* --------- ase related code --------- */
115 MFP_XWAY(GPIO0, GPIO, EXIN, MII, TDM),
139 MFP_XWAY(GPIO24, GPIO, EBU, EBU2, MDIO),
142 MFP_XWAY(GPIO27, GPIO, EBU, NONE, MDIO),
149 static const unsigned ase_exin_pin_map[] = {GPIO6, GPIO29, GPIO0};
153 static const unsigned ase_pins_exin2[] = {GPIO0};
201 GRP_MUX("mdio", MDIO, ase_pins_mdio),
213 static const char * const ase_mdio_grps[] = {"mdio"};
233 {"mdio", ARRAY_AND_SIZE(ase_mdio_grps)},
238 /* --------- danube related code --------- */
243 MFP_XWAY(GPIO0, GPIO, EXIN, SDIO, TDM),
277 static const unsigned danube_exin_pin_map[] = {GPIO0, GPIO1, GPIO2};
279 static const unsigned danube_pins_exin0[] = {GPIO0};
413 /* --------- xrx100 related code --------- */
418 MFP_XWAY(GPIO0, GPIO, EXIN, SDIO, TDM),
460 MFP_XWAY(GPIO42, GPIO, MDIO, NONE, NONE),
461 MFP_XWAY(GPIO43, GPIO, MDIO, NONE, NONE),
476 static const unsigned xrx100_exin_pin_map[] = {GPIO0, GPIO1, GPIO2, GPIO39, GPIO10, GPIO9};
478 static const unsigned xrx100_pins_exin0[] = {GPIO0};
581 GRP_MUX("mdio", MDIO, xrx100_pins_mdio),
609 static const char * const xrx100_mdio_grps[] = {"mdio"};
622 {"mdio", ARRAY_AND_SIZE(xrx100_mdio_grps)},
626 /* --------- xrx200 related code --------- */
631 MFP_XWAY(GPIO0, GPIO, EXIN, SDIO, TDM),
673 MFP_XWAY(GPIO42, GPIO, MDIO, NONE, NONE),
674 MFP_XWAY(GPIO43, GPIO, MDIO, NONE, NONE),
683 static const unsigned xrx200_exin_pin_map[] = {GPIO0, GPIO1, GPIO2, GPIO39, GPIO10, GPIO9};
685 static const unsigned xrx200_pins_exin0[] = {GPIO0};
821 GRP_MUX("mdio", MDIO, xrx200_pins_mdio),
861 static const char * const xrx200_mdio_grps[] = {"mdio"};
877 {"mdio", ARRAY_AND_SIZE(xrx200_mdio_grps)},
882 /* --------- xrx300 related code --------- */
887 MFP_XWAY(GPIO0, GPIO, EXIN, EPHY, NONE),
929 MFP_XWAY(GPIO42, GPIO, MDIO, NONE, NONE),
930 MFP_XWAY(GPIO43, GPIO, MDIO, NONE, NONE),
953 static const unsigned xrx300_exin_pin_map[] = {GPIO0, GPIO1, GPIO16, GPIO10, GPIO9};
955 static const unsigned xrx300_pins_exin0[] = {GPIO0};
1050 GRP_MUX("mdio", MDIO, xrx300_pins_mdio),
1078 static const char * const xrx300_mdio_grps[] = {"mdio"};
1090 {"mdio", ARRAY_AND_SIZE(xrx300_mdio_grps)},
1095 /* --------- pinconf related code --------- */
1112 !gpio_getbit(info->membase[0], reg, PORT_PIN(pin))); in xway_pinconf_get()
1120 if (!gpio_getbit(info->membase[0], reg, PORT_PIN(pin))) { in xway_pinconf_get()
1129 if (!gpio_getbit(info->membase[0], reg, PORT_PIN(pin))) in xway_pinconf_get()
1138 gpio_getbit(info->membase[0], reg, PORT_PIN(pin))); in xway_pinconf_get()
1141 dev_err(pctldev->dev, "Invalid config param %04x\n", param); in xway_pinconf_get()
1142 return -ENOTSUPP; in xway_pinconf_get()
1170 gpio_setbit(info->membase[0], in xway_pinconf_set()
1174 gpio_clearbit(info->membase[0], in xway_pinconf_set()
1185 gpio_clearbit(info->membase[0], in xway_pinconf_set()
1190 gpio_setbit(info->membase[0], reg, PORT_PIN(pin)); in xway_pinconf_set()
1197 gpio_clearbit(info->membase[0], in xway_pinconf_set()
1201 gpio_setbit(info->membase[0], in xway_pinconf_set()
1205 dev_err(pctldev->dev, in xway_pinconf_set()
1212 gpio_clearbit(info->membase[0], in xway_pinconf_set()
1216 gpio_setbit(info->membase[0], in xway_pinconf_set()
1222 dev_err(pctldev->dev, in xway_pinconf_set()
1224 return -ENOTSUPP; in xway_pinconf_set()
1239 for (i = 0; i < info->grps[selector].npins && !ret; i++) in xway_pinconf_group_set()
1241 info->grps[selector].pins[i], in xway_pinconf_group_set()
1270 gpio_setbit(info->membase[0], GPIO_ALT0(pin), PORT_PIN(pin)); in xway_mux_apply()
1272 gpio_clearbit(info->membase[0], GPIO_ALT0(pin), PORT_PIN(pin)); in xway_mux_apply()
1275 gpio_setbit(info->membase[0], alt1_reg, PORT_PIN(pin)); in xway_mux_apply()
1277 gpio_clearbit(info->membase[0], alt1_reg, PORT_PIN(pin)); in xway_mux_apply()
1284 {"lantiq,open-drain", LTQ_PINCONF_PARAM_OPEN_DRAIN},
1295 /* --------- gpio_chip related code --------- */
1298 struct ltq_pinmux_info *info = dev_get_drvdata(chip->parent); in xway_gpio_set()
1301 gpio_setbit(info->membase[0], GPIO_OUT(pin), PORT_PIN(pin)); in xway_gpio_set()
1303 gpio_clearbit(info->membase[0], GPIO_OUT(pin), PORT_PIN(pin)); in xway_gpio_set()
1308 struct ltq_pinmux_info *info = dev_get_drvdata(chip->parent); in xway_gpio_get()
1310 return !!gpio_getbit(info->membase[0], GPIO_IN(pin), PORT_PIN(pin)); in xway_gpio_get()
1315 struct ltq_pinmux_info *info = dev_get_drvdata(chip->parent); in xway_gpio_dir_in()
1317 gpio_clearbit(info->membase[0], GPIO_DIR(pin), PORT_PIN(pin)); in xway_gpio_dir_in()
1324 struct ltq_pinmux_info *info = dev_get_drvdata(chip->parent); in xway_gpio_dir_out()
1327 gpio_setbit(info->membase[0], GPIO3_OD, PORT_PIN(pin)); in xway_gpio_dir_out()
1329 gpio_setbit(info->membase[0], GPIO_OD(pin), PORT_PIN(pin)); in xway_gpio_dir_out()
1330 gpio_setbit(info->membase[0], GPIO_DIR(pin), PORT_PIN(pin)); in xway_gpio_dir_out()
1342 struct ltq_pinmux_info *info = dev_get_drvdata(chip->parent); in xway_gpio_to_irq()
1345 for (i = 0; i < info->num_exin; i++) in xway_gpio_to_irq()
1346 if (info->exin[i] == offset) in xway_gpio_to_irq()
1349 return -1; in xway_gpio_to_irq()
1353 .label = "gpio-xway",
1361 .base = -1,
1365 /* --------- register the pinctrl layer --------- */
1443 { .compatible = "lantiq,ase-pinctrl", .data = &ase_pinctrl},
1444 { .compatible = "lantiq,danube-pinctrl", .data = &danube_pinctrl},
1445 { .compatible = "lantiq,xrx100-pinctrl", .data = &xrx100_pinctrl},
1446 { .compatible = "lantiq,xrx200-pinctrl", .data = &xrx200_pinctrl},
1447 { .compatible = "lantiq,xrx300-pinctrl", .data = &xrx300_pinctrl},
1462 xway_soc = device_get_match_data(&pdev->dev); in pinmux_xway_probe()
1467 xway_chip.ngpio = xway_soc->pin_count; in pinmux_xway_probe()
1470 xway_info.pads = devm_kcalloc(&pdev->dev, in pinmux_xway_probe()
1474 return -ENOMEM; in pinmux_xway_probe()
1477 char *name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "io%d", i); in pinmux_xway_probe()
1480 return -ENOMEM; in pinmux_xway_probe()
1482 xway_info.pads[i].number = GPIO0 + i; in pinmux_xway_probe()
1488 xway_pctrl_desc.name = dev_name(&pdev->dev); in pinmux_xway_probe()
1493 xway_info.mfp = xway_soc->mfp; in pinmux_xway_probe()
1494 xway_info.grps = xway_soc->grps; in pinmux_xway_probe()
1495 xway_info.num_grps = xway_soc->num_grps; in pinmux_xway_probe()
1496 xway_info.funcs = xway_soc->funcs; in pinmux_xway_probe()
1497 xway_info.num_funcs = xway_soc->num_funcs; in pinmux_xway_probe()
1498 xway_info.exin = xway_soc->exin; in pinmux_xway_probe()
1499 xway_info.num_exin = xway_soc->num_exin; in pinmux_xway_probe()
1504 dev_err(&pdev->dev, "Failed to register pinctrl driver\n"); in pinmux_xway_probe()
1509 xway_chip.parent = &pdev->dev; in pinmux_xway_probe()
1511 ret = devm_gpiochip_add_data(&pdev->dev, &xway_chip, NULL); in pinmux_xway_probe()
1513 dev_err(&pdev->dev, "Failed to register gpio chip\n"); in pinmux_xway_probe()
1518 * For DeviceTree-supported systems, the gpio core checks the in pinmux_xway_probe()
1519 * pinctrl's device node for the "gpio-ranges" property. in pinmux_xway_probe()
1524 * files which don't set the "gpio-ranges" property or systems that in pinmux_xway_probe()
1527 if (!of_property_read_bool(pdev->dev.of_node, "gpio-ranges")) { in pinmux_xway_probe()
1534 dev_info(&pdev->dev, "Init done\n"); in pinmux_xway_probe()
1541 .name = "pinctrl-xway",