Lines Matching +full:vsc7514 +full:- +full:serdes

1 // SPDX-License-Identifier: (GPL-2.0 OR MIT)
3 * SerDes PHY driver for Microsemi Ocelot
19 #include <dt-bindings/phy/phy-ocelot-serdes.h>
60 static int serdes_init_s6g(struct regmap *regmap, u8 serdes, int mode) in serdes_init_s6g() argument
89 ret = serdes_update_mcb_s6g(regmap, serdes); in serdes_init_s6g()
146 ret = serdes_commit_mcb_s6g(regmap, serdes); in serdes_init_s6g()
222 ret = serdes_commit_mcb_s6g(regmap, serdes); in serdes_init_s6g()
230 ret = serdes_commit_mcb_s6g(regmap, serdes); in serdes_init_s6g()
244 ret = serdes_commit_mcb_s6g(regmap, serdes); in serdes_init_s6g()
292 static int serdes_init_s1g(struct regmap *regmap, u8 serdes) in serdes_init_s1g() argument
296 ret = serdes_update_mcb_s1g(regmap, serdes); in serdes_init_s1g()
318 ret = serdes_commit_mcb_s1g(regmap, serdes); in serdes_init_s1g()
329 ret = serdes_commit_mcb_s1g(regmap, serdes); in serdes_init_s1g()
406 return -EOPNOTSUPP; in serdes_set_mode()
409 if (macro->idx != ocelot_serdes_muxes[i].idx || in serdes_set_mode()
415 macro->port != ocelot_serdes_muxes[i].port) in serdes_set_mode()
418 ret = regmap_update_bits(macro->ctrl->regs, HSIO_HW_CFG, in serdes_set_mode()
424 if (macro->idx <= SERDES1G_MAX) in serdes_set_mode()
425 return serdes_init_s1g(macro->ctrl->regs, macro->idx); in serdes_set_mode()
426 else if (macro->idx <= SERDES6G_MAX) in serdes_set_mode()
427 return serdes_init_s6g(macro->ctrl->regs, in serdes_set_mode()
428 macro->idx - (SERDES1G_MAX + 1), in serdes_set_mode()
432 return -EOPNOTSUPP; in serdes_set_mode()
435 return -EINVAL; in serdes_set_mode()
449 if (args->args_count != 2) in serdes_simple_xlate()
450 return ERR_PTR(-EINVAL); in serdes_simple_xlate()
452 port = args->args[0]; in serdes_simple_xlate()
453 idx = args->args[1]; in serdes_simple_xlate()
456 struct serdes_macro *macro = phy_get_drvdata(ctrl->phys[i]); in serdes_simple_xlate()
458 if (idx != macro->idx) in serdes_simple_xlate()
461 /* SERDES6G(0) is the only SerDes capable of QSGMII */ in serdes_simple_xlate()
462 if (idx != SERDES6G(0) && macro->port >= 0) in serdes_simple_xlate()
463 return ERR_PTR(-EBUSY); in serdes_simple_xlate()
465 macro->port = port; in serdes_simple_xlate()
466 return ctrl->phys[i]; in serdes_simple_xlate()
469 return ERR_PTR(-ENODEV); in serdes_simple_xlate()
476 *phy = devm_phy_create(ctrl->dev, NULL, &serdes_ops); in serdes_phy_create()
480 macro = devm_kzalloc(ctrl->dev, sizeof(*macro), GFP_KERNEL); in serdes_phy_create()
482 return -ENOMEM; in serdes_phy_create()
484 macro->idx = idx; in serdes_phy_create()
485 macro->ctrl = ctrl; in serdes_phy_create()
486 macro->port = -1; in serdes_phy_create()
501 ctrl = devm_kzalloc(&pdev->dev, sizeof(*ctrl), GFP_KERNEL); in serdes_probe()
503 return -ENOMEM; in serdes_probe()
505 ctrl->dev = &pdev->dev; in serdes_probe()
506 ctrl->regs = syscon_node_to_regmap(pdev->dev.parent->of_node); in serdes_probe()
507 if (IS_ERR(ctrl->regs)) { in serdes_probe()
511 ctrl->regs = dev_get_regmap(ctrl->dev->parent, in serdes_probe()
512 res->name); in serdes_probe()
515 if (IS_ERR(ctrl->regs)) in serdes_probe()
516 return PTR_ERR(ctrl->regs); in serdes_probe()
519 ret = serdes_phy_create(ctrl, i, &ctrl->phys[i]); in serdes_probe()
524 dev_set_drvdata(&pdev->dev, ctrl); in serdes_probe()
526 provider = devm_of_phy_provider_register(ctrl->dev, in serdes_probe()
533 { .compatible = "mscc,vsc7514-serdes", },
541 .name = "mscc,ocelot-serdes",
549 MODULE_DESCRIPTION("SerDes driver for Microsemi Ocelot");