Lines Matching +full:phy +full:- +full:cadence +full:- +full:sierra

1 // SPDX-License-Identifier: GPL-2.0
3 * Cadence Sierra PHY Driver
5 * Copyright (c) 2018 Cadence Design Systems
6 * Author: Alan Douglas <adouglas@cadence.com>
10 #include <linux/clk-provider.h>
15 #include <linux/phy/phy.h>
23 #include <dt-bindings/phy/phy.h>
24 #include <dt-bindings/phy/phy-cadence.h>
29 /* PHY register offsets */
179 /* PHY PCS common registers */
185 /* PHY PCS lane registers */
192 /* PHY PMA common registers */
197 /* PHY PMA lane registers */
311 struct phy *phy; member
381 u32 offset = reg << ctx->reg_offset_shift; in cdns_regmap_write()
383 writew(val, ctx->base + offset); in cdns_regmap_write()
391 u32 offset = reg << ctx->reg_offset_shift; in cdns_regmap_read()
393 *val = readw(ctx->base + offset); in cdns_regmap_read()
505 static int cdns_sierra_phy_init(struct phy *gphy) in cdns_sierra_phy_init()
508 struct cdns_sierra_phy *phy = dev_get_drvdata(gphy->dev.parent); in cdns_sierra_phy_init() local
509 const struct cdns_sierra_data *init_data = phy->init_data; in cdns_sierra_phy_init()
511 enum cdns_sierra_phy_type phy_type = ins->phy_type; in cdns_sierra_phy_init()
512 enum cdns_sierra_ssc_mode ssc = ins->ssc_mode; in cdns_sierra_phy_init()
520 /* Initialise the PHY registers, unless auto configured */ in cdns_sierra_phy_init()
521 if (phy->autoconf || phy->already_configured || phy->nsubnodes > 1) in cdns_sierra_phy_init()
524 clk_set_rate(phy->input_clks[CMN_REFCLK_DIG_DIV], 25000000); in cdns_sierra_phy_init()
525 clk_set_rate(phy->input_clks[CMN_REFCLK1_DIG_DIV], 25000000); in cdns_sierra_phy_init()
527 /* PHY PCS common registers configurations */ in cdns_sierra_phy_init()
528 pcs_cmn_vals = init_data->pcs_cmn_vals[phy_type][TYPE_NONE][ssc]; in cdns_sierra_phy_init()
530 reg_pairs = pcs_cmn_vals->reg_pairs; in cdns_sierra_phy_init()
531 num_regs = pcs_cmn_vals->num_regs; in cdns_sierra_phy_init()
532 regmap = phy->regmap_phy_pcs_common_cdb; in cdns_sierra_phy_init()
537 /* PHY PMA lane registers configurations */ in cdns_sierra_phy_init()
538 phy_pma_ln_vals = init_data->phy_pma_ln_vals[phy_type][TYPE_NONE][ssc]; in cdns_sierra_phy_init()
540 reg_pairs = phy_pma_ln_vals->reg_pairs; in cdns_sierra_phy_init()
541 num_regs = phy_pma_ln_vals->num_regs; in cdns_sierra_phy_init()
542 for (i = 0; i < ins->num_lanes; i++) { in cdns_sierra_phy_init()
543 regmap = phy->regmap_phy_pma_lane_cdb[i + ins->mlane]; in cdns_sierra_phy_init()
550 pma_cmn_vals = init_data->pma_cmn_vals[phy_type][TYPE_NONE][ssc]; in cdns_sierra_phy_init()
552 reg_pairs = pma_cmn_vals->reg_pairs; in cdns_sierra_phy_init()
553 num_regs = pma_cmn_vals->num_regs; in cdns_sierra_phy_init()
554 regmap = phy->regmap_common_cdb; in cdns_sierra_phy_init()
560 pma_ln_vals = init_data->pma_ln_vals[phy_type][TYPE_NONE][ssc]; in cdns_sierra_phy_init()
562 reg_pairs = pma_ln_vals->reg_pairs; in cdns_sierra_phy_init()
563 num_regs = pma_ln_vals->num_regs; in cdns_sierra_phy_init()
564 for (i = 0; i < ins->num_lanes; i++) { in cdns_sierra_phy_init()
565 regmap = phy->regmap_lane_cdb[i + ins->mlane]; in cdns_sierra_phy_init()
574 static int cdns_sierra_phy_on(struct phy *gphy) in cdns_sierra_phy_on()
576 struct cdns_sierra_phy *sp = dev_get_drvdata(gphy->dev.parent); in cdns_sierra_phy_on()
578 struct device *dev = sp->dev; in cdns_sierra_phy_on()
582 if (sp->nsubnodes == 1) { in cdns_sierra_phy_on()
583 /* Take the PHY out of reset */ in cdns_sierra_phy_on()
584 ret = reset_control_deassert(sp->phy_rst); in cdns_sierra_phy_on()
586 dev_err(dev, "Failed to take the PHY out of reset\n"); in cdns_sierra_phy_on()
591 /* Take the PHY lane group out of reset */ in cdns_sierra_phy_on()
592 ret = reset_control_deassert(ins->lnk_rst); in cdns_sierra_phy_on()
594 dev_err(dev, "Failed to take the PHY lane out of reset\n"); in cdns_sierra_phy_on()
598 if (ins->phy_type == TYPE_PCIE || ins->phy_type == TYPE_USB) { in cdns_sierra_phy_on()
599 ret = regmap_field_read_poll_timeout(sp->phy_iso_link_ctrl_1[ins->mlane], in cdns_sierra_phy_on()
602 dev_err(dev, "Timeout waiting for PHY status ready\n"); in cdns_sierra_phy_on()
611 ret = regmap_field_read_poll_timeout(sp->pma_cmn_ready, val, val, in cdns_sierra_phy_on()
618 ret = regmap_field_read_poll_timeout(sp->pllctrl_lock[ins->mlane], in cdns_sierra_phy_on()
626 static int cdns_sierra_phy_off(struct phy *gphy) in cdns_sierra_phy_off()
630 return reset_control_assert(ins->lnk_rst); in cdns_sierra_phy_off()
633 static int cdns_sierra_phy_reset(struct phy *gphy) in cdns_sierra_phy_reset()
635 struct cdns_sierra_phy *sp = dev_get_drvdata(gphy->dev.parent); in cdns_sierra_phy_reset()
637 reset_control_assert(sp->phy_rst); in cdns_sierra_phy_reset()
638 reset_control_deassert(sp->phy_rst); in cdns_sierra_phy_reset()
650 static int cdns_sierra_noop_phy_on(struct phy *gphy) in cdns_sierra_noop_phy_on()
665 struct regmap_field *plllc1en_field = mux->plllc1en_field; in cdns_sierra_pll_mux_get_parent()
666 struct regmap_field *termen_field = mux->termen_field; in cdns_sierra_pll_mux_get_parent()
667 struct regmap_field *field = mux->pfdclk_sel_preg; in cdns_sierra_pll_mux_get_parent()
689 struct regmap_field *plllc1en_field = mux->plllc1en_field; in cdns_sierra_pll_mux_set_parent()
690 struct regmap_field *termen_field = mux->termen_field; in cdns_sierra_pll_mux_set_parent()
691 struct regmap_field *field = mux->pfdclk_sel_preg; in cdns_sierra_pll_mux_set_parent()
723 struct device *dev = sp->dev; in cdns_sierra_pll_mux_register()
733 return -ENOMEM; in cdns_sierra_pll_mux_register()
738 return -ENOMEM; in cdns_sierra_pll_mux_register()
741 clk = sp->input_clks[pll_mux_parent_index[clk_index][i]]; in cdns_sierra_pll_mux_register()
744 return IS_ERR(clk) ? PTR_ERR(clk) : -ENOENT; in cdns_sierra_pll_mux_register()
751 init = &mux->clk_data; in cdns_sierra_pll_mux_register()
753 init->ops = &cdns_sierra_pll_mux_ops; in cdns_sierra_pll_mux_register()
754 init->flags = CLK_SET_RATE_NO_REPARENT; in cdns_sierra_pll_mux_register()
755 init->parent_names = parent_names; in cdns_sierra_pll_mux_register()
756 init->num_parents = num_parents; in cdns_sierra_pll_mux_register()
757 init->name = clk_name; in cdns_sierra_pll_mux_register()
759 mux->pfdclk_sel_preg = pfdclk1_sel_field; in cdns_sierra_pll_mux_register()
760 mux->plllc1en_field = plllc1en_field; in cdns_sierra_pll_mux_register()
761 mux->termen_field = termen_field; in cdns_sierra_pll_mux_register()
762 mux->hw.init = init; in cdns_sierra_pll_mux_register()
764 clk = devm_clk_register(dev, &mux->hw); in cdns_sierra_pll_mux_register()
768 sp->output_clks[clk_index] = clk; in cdns_sierra_pll_mux_register()
778 struct device *dev = sp->dev; in cdns_sierra_phy_register_pll_mux()
783 pfdclk1_sel_field = sp->cmn_plllc_pfdclk1_sel_preg[i]; in cdns_sierra_phy_register_pll_mux()
784 plllc1en_field = sp->cmn_refrcv_refclk_plllc1en_preg[i]; in cdns_sierra_phy_register_pll_mux()
785 termen_field = sp->cmn_refrcv_refclk_termen_preg[i]; in cdns_sierra_phy_register_pll_mux()
802 regmap_field_write(derived_refclk->cmn_plllc_clk1_en_preg, 0x1); in cdns_sierra_derived_refclk_enable()
805 regmap_field_write(derived_refclk->cmn_plllc_clk1outdiv_preg, 0x2E); in cdns_sierra_derived_refclk_enable()
814 regmap_field_write(derived_refclk->cmn_plllc_clk1_en_preg, 0); in cdns_sierra_derived_refclk_disable()
822 regmap_field_read(derived_refclk->cmn_plllc_clk1_en_preg, &val); in cdns_sierra_derived_refclk_is_enabled()
836 struct device *dev = sp->dev; in cdns_sierra_derived_refclk_register()
845 return -ENOMEM; in cdns_sierra_derived_refclk_register()
850 init = &derived_refclk->clk_data; in cdns_sierra_derived_refclk_register()
852 init->ops = &cdns_sierra_derived_refclk_ops; in cdns_sierra_derived_refclk_register()
853 init->flags = 0; in cdns_sierra_derived_refclk_register()
854 init->name = clk_name; in cdns_sierra_derived_refclk_register()
856 regmap = sp->regmap_common_cdb; in cdns_sierra_derived_refclk_register()
863 derived_refclk->cmn_plllc_clk1outdiv_preg = field; in cdns_sierra_derived_refclk_register()
870 derived_refclk->cmn_plllc_clk1_en_preg = field; in cdns_sierra_derived_refclk_register()
872 derived_refclk->hw.init = init; in cdns_sierra_derived_refclk_register()
874 clk = devm_clk_register(dev, &derived_refclk->hw); in cdns_sierra_derived_refclk_register()
878 sp->output_clks[CDNS_SIERRA_DERIVED_REFCLK] = clk; in cdns_sierra_derived_refclk_register()
885 struct device *dev = sp->dev; in cdns_sierra_clk_unregister()
886 struct device_node *node = dev->of_node; in cdns_sierra_clk_unregister()
893 struct device *dev = sp->dev; in cdns_sierra_clk_register()
894 struct device_node *node = dev->of_node; in cdns_sierra_clk_register()
909 sp->clk_data.clks = sp->output_clks; in cdns_sierra_clk_register()
910 sp->clk_data.clk_num = CDNS_SIERRA_OUTPUT_CLOCKS; in cdns_sierra_clk_register()
911 ret = of_clk_add_provider(node, of_clk_src_onecell_get, &sp->clk_data); in cdns_sierra_clk_register()
913 dev_err(dev, "Failed to add clock provider: %s\n", node->name); in cdns_sierra_clk_register()
923 if (of_property_read_u32(child, "reg", &inst->mlane)) in cdns_sierra_get_optional()
924 return -EINVAL; in cdns_sierra_get_optional()
926 if (of_property_read_u32(child, "cdns,num-lanes", &inst->num_lanes)) in cdns_sierra_get_optional()
927 return -EINVAL; in cdns_sierra_get_optional()
929 if (of_property_read_u32(child, "cdns,phy-type", &phy_type)) in cdns_sierra_get_optional()
930 return -EINVAL; in cdns_sierra_get_optional()
934 inst->phy_type = TYPE_PCIE; in cdns_sierra_get_optional()
937 inst->phy_type = TYPE_USB; in cdns_sierra_get_optional()
940 inst->phy_type = TYPE_QSGMII; in cdns_sierra_get_optional()
943 return -EINVAL; in cdns_sierra_get_optional()
946 inst->ssc_mode = EXTERNAL_SSC; in cdns_sierra_get_optional()
947 of_property_read_u32(child, "cdns,ssc-mode", &inst->ssc_mode); in cdns_sierra_get_optional()
960 return ERR_PTR(-ENOMEM); in cdns_regmap_init()
962 ctx->dev = dev; in cdns_regmap_init()
963 ctx->base = base + block_offset; in cdns_regmap_init()
964 ctx->reg_offset_shift = reg_offset_shift; in cdns_regmap_init()
971 struct device *dev = sp->dev; in cdns_regfield_init()
977 regmap = sp->regmap_common_cdb; in cdns_regfield_init()
983 sp->macro_id_type = field; in cdns_regfield_init()
992 sp->cmn_plllc_pfdclk1_sel_preg[i] = field; in cdns_regfield_init()
1000 sp->cmn_refrcv_refclk_plllc1en_preg[i] = field; in cdns_regfield_init()
1008 sp->cmn_refrcv_refclk_termen_preg[i] = field; in cdns_regfield_init()
1011 regmap = sp->regmap_phy_pcs_common_cdb; in cdns_regfield_init()
1017 sp->phy_pll_cfg_1 = field; in cdns_regfield_init()
1019 regmap = sp->regmap_phy_pma_common_cdb; in cdns_regfield_init()
1025 sp->pma_cmn_ready = field; in cdns_regfield_init()
1028 regmap = sp->regmap_lane_cdb[i]; in cdns_regfield_init()
1034 sp->pllctrl_lock[i] = field; in cdns_regfield_init()
1038 regmap = sp->regmap_phy_pcs_lane_cdb[i]; in cdns_regfield_init()
1044 sp->phy_iso_link_ctrl_1[i] = field; in cdns_regfield_init()
1054 struct device *dev = sp->dev; in cdns_regmap_init_blocks()
1069 sp->regmap_lane_cdb[i] = regmap; in cdns_regmap_init_blocks()
1079 sp->regmap_common_cdb = regmap; in cdns_regmap_init_blocks()
1085 dev_err(dev, "Failed to init PHY PCS common CDB regmap\n"); in cdns_regmap_init_blocks()
1088 sp->regmap_phy_pcs_common_cdb = regmap; in cdns_regmap_init_blocks()
1097 dev_err(dev, "Failed to init PHY PCS lane CDB regmap\n"); in cdns_regmap_init_blocks()
1100 sp->regmap_phy_pcs_lane_cdb[i] = regmap; in cdns_regmap_init_blocks()
1107 dev_err(dev, "Failed to init PHY PMA common CDB regmap\n"); in cdns_regmap_init_blocks()
1110 sp->regmap_phy_pma_common_cdb = regmap; in cdns_regmap_init_blocks()
1119 dev_err(dev, "Failed to init PHY PMA lane CDB regmap\n"); in cdns_regmap_init_blocks()
1122 sp->regmap_phy_pma_lane_cdb[i] = regmap; in cdns_regmap_init_blocks()
1140 sp->input_clks[CMN_REFCLK_DIG_DIV] = clk; in cdns_sierra_phy_get_clocks()
1148 sp->input_clks[CMN_REFCLK1_DIG_DIV] = clk; in cdns_sierra_phy_get_clocks()
1156 sp->input_clks[PLL0_REFCLK] = clk; in cdns_sierra_phy_get_clocks()
1164 sp->input_clks[PLL1_REFCLK] = clk; in cdns_sierra_phy_get_clocks()
1171 struct device *dev = sp->dev; in cdns_sierra_phy_clk()
1180 sp->input_clks[PHY_CLK] = clk; in cdns_sierra_phy_clk()
1182 ret = clk_prepare_enable(sp->input_clks[PHY_CLK]); in cdns_sierra_phy_clk()
1193 ret = clk_prepare_enable(sp->output_clks[CDNS_SIERRA_PLL_CMNLC]); in cdns_sierra_phy_enable_clocks()
1197 ret = clk_prepare_enable(sp->output_clks[CDNS_SIERRA_PLL_CMNLC1]); in cdns_sierra_phy_enable_clocks()
1204 clk_disable_unprepare(sp->output_clks[CDNS_SIERRA_PLL_CMNLC]); in cdns_sierra_phy_enable_clocks()
1211 clk_disable_unprepare(sp->output_clks[CDNS_SIERRA_PLL_CMNLC1]); in cdns_sierra_phy_disable_clocks()
1212 clk_disable_unprepare(sp->output_clks[CDNS_SIERRA_PLL_CMNLC]); in cdns_sierra_phy_disable_clocks()
1213 if (!sp->already_configured) in cdns_sierra_phy_disable_clocks()
1214 clk_disable_unprepare(sp->input_clks[PHY_CLK]); in cdns_sierra_phy_disable_clocks()
1227 sp->phy_rst = rst; in cdns_sierra_phy_get_resets()
1234 sp->apb_rst = rst; in cdns_sierra_phy_get_resets()
1241 const struct cdns_sierra_data *init_data = sp->init_data; in cdns_sierra_phy_configure_multilink()
1253 if (sp->nsubnodes != 2) in cdns_sierra_phy_configure_multilink()
1254 return -EINVAL; in cdns_sierra_phy_configure_multilink()
1256 clk_set_rate(sp->input_clks[CMN_REFCLK_DIG_DIV], 25000000); in cdns_sierra_phy_configure_multilink()
1257 clk_set_rate(sp->input_clks[CMN_REFCLK1_DIG_DIV], 25000000); in cdns_sierra_phy_configure_multilink()
1259 /* PHY configured to use both PLL LC and LC1 */ in cdns_sierra_phy_configure_multilink()
1260 regmap_field_write(sp->phy_pll_cfg_1, 0x1); in cdns_sierra_phy_configure_multilink()
1262 phy_t1 = sp->phys[0].phy_type; in cdns_sierra_phy_configure_multilink()
1263 phy_t2 = sp->phys[1].phy_type; in cdns_sierra_phy_configure_multilink()
1266 * PHY configuration for multi-link operation is done in two steps. in cdns_sierra_phy_configure_multilink()
1267 * e.g. Consider a case for a 4 lane PHY with PCIe using 2 lanes and QSGMII other 2 lanes. in cdns_sierra_phy_configure_multilink()
1268 * Sierra PHY has 2 PLLs, viz. PLLLC and PLLLC1. So in this case, PLLLC is used for PCIe in cdns_sierra_phy_configure_multilink()
1269 * and PLLLC1 is used for QSGMII. PHY is configured in two steps as described below. in cdns_sierra_phy_configure_multilink()
1273 * This will configure PHY registers associated for PCIe (i.e. first protocol) in cdns_sierra_phy_configure_multilink()
1274 * involving PLLLC registers and registers for first 2 lanes of PHY. in cdns_sierra_phy_configure_multilink()
1278 * This will configure PHY registers associated for QSGMII (i.e. second protocol) in cdns_sierra_phy_configure_multilink()
1279 * involving PLLLC1 registers and registers for other 2 lanes of PHY. in cdns_sierra_phy_configure_multilink()
1281 * This completes the PHY configuration for multilink operation. This approach enables in cdns_sierra_phy_configure_multilink()
1282 * dividing the large number of PHY register configurations into protocol specific in cdns_sierra_phy_configure_multilink()
1285 for (node = 0; node < sp->nsubnodes; node++) { in cdns_sierra_phy_configure_multilink()
1288 * If first link with phy_t1 is configured, then configure the PHY for in cdns_sierra_phy_configure_multilink()
1294 mlane = sp->phys[node].mlane; in cdns_sierra_phy_configure_multilink()
1295 ssc = sp->phys[node].ssc_mode; in cdns_sierra_phy_configure_multilink()
1296 num_lanes = sp->phys[node].num_lanes; in cdns_sierra_phy_configure_multilink()
1298 /* PHY PCS common registers configurations */ in cdns_sierra_phy_configure_multilink()
1299 pcs_cmn_vals = init_data->pcs_cmn_vals[phy_t1][phy_t2][ssc]; in cdns_sierra_phy_configure_multilink()
1301 reg_pairs = pcs_cmn_vals->reg_pairs; in cdns_sierra_phy_configure_multilink()
1302 num_regs = pcs_cmn_vals->num_regs; in cdns_sierra_phy_configure_multilink()
1303 regmap = sp->regmap_phy_pcs_common_cdb; in cdns_sierra_phy_configure_multilink()
1308 /* PHY PMA lane registers configurations */ in cdns_sierra_phy_configure_multilink()
1309 phy_pma_ln_vals = init_data->phy_pma_ln_vals[phy_t1][phy_t2][ssc]; in cdns_sierra_phy_configure_multilink()
1311 reg_pairs = phy_pma_ln_vals->reg_pairs; in cdns_sierra_phy_configure_multilink()
1312 num_regs = phy_pma_ln_vals->num_regs; in cdns_sierra_phy_configure_multilink()
1314 regmap = sp->regmap_phy_pma_lane_cdb[i + mlane]; in cdns_sierra_phy_configure_multilink()
1321 pma_cmn_vals = init_data->pma_cmn_vals[phy_t1][phy_t2][ssc]; in cdns_sierra_phy_configure_multilink()
1323 reg_pairs = pma_cmn_vals->reg_pairs; in cdns_sierra_phy_configure_multilink()
1324 num_regs = pma_cmn_vals->num_regs; in cdns_sierra_phy_configure_multilink()
1325 regmap = sp->regmap_common_cdb; in cdns_sierra_phy_configure_multilink()
1331 pma_ln_vals = init_data->pma_ln_vals[phy_t1][phy_t2][ssc]; in cdns_sierra_phy_configure_multilink()
1333 reg_pairs = pma_ln_vals->reg_pairs; in cdns_sierra_phy_configure_multilink()
1334 num_regs = pma_ln_vals->num_regs; in cdns_sierra_phy_configure_multilink()
1336 regmap = sp->regmap_lane_cdb[i + mlane]; in cdns_sierra_phy_configure_multilink()
1343 reset_control_deassert(sp->phys[node].lnk_rst); in cdns_sierra_phy_configure_multilink()
1346 /* Take the PHY out of reset */ in cdns_sierra_phy_configure_multilink()
1347 ret = reset_control_deassert(sp->phy_rst); in cdns_sierra_phy_configure_multilink()
1358 struct device *dev = &pdev->dev; in cdns_sierra_phy_probe()
1363 struct device_node *dn = dev->of_node, *child; in cdns_sierra_phy_probe()
1366 return -ENODEV; in cdns_sierra_phy_probe()
1368 /* Get init data for this PHY */ in cdns_sierra_phy_probe()
1371 return -EINVAL; in cdns_sierra_phy_probe()
1375 return -ENOMEM; in cdns_sierra_phy_probe()
1377 sp->dev = dev; in cdns_sierra_phy_probe()
1378 sp->init_data = data; in cdns_sierra_phy_probe()
1386 ret = cdns_regmap_init_blocks(sp, base, data->block_offset_shift, in cdns_sierra_phy_probe()
1387 data->reg_offset_shift); in cdns_sierra_phy_probe()
1409 regmap_field_read(sp->pma_cmn_ready, &sp->already_configured); in cdns_sierra_phy_probe()
1411 if (!sp->already_configured) { in cdns_sierra_phy_probe()
1421 reset_control_deassert(sp->apb_rst); in cdns_sierra_phy_probe()
1424 /* Check that PHY is present */ in cdns_sierra_phy_probe()
1425 regmap_field_read(sp->macro_id_type, &id_value); in cdns_sierra_phy_probe()
1426 if (sp->init_data->id_value != id_value) { in cdns_sierra_phy_probe()
1427 ret = -EINVAL; in cdns_sierra_phy_probe()
1431 sp->autoconf = of_property_read_bool(dn, "cdns,autoconf"); in cdns_sierra_phy_probe()
1434 struct phy *gphy; in cdns_sierra_phy_probe()
1436 if (!(of_node_name_eq(child, "phy") || in cdns_sierra_phy_probe()
1440 sp->phys[node].lnk_rst = in cdns_sierra_phy_probe()
1443 if (IS_ERR(sp->phys[node].lnk_rst)) { in cdns_sierra_phy_probe()
1445 child->full_name); in cdns_sierra_phy_probe()
1446 ret = PTR_ERR(sp->phys[node].lnk_rst); in cdns_sierra_phy_probe()
1451 if (!sp->autoconf) { in cdns_sierra_phy_probe()
1452 ret = cdns_sierra_get_optional(&sp->phys[node], child); in cdns_sierra_phy_probe()
1455 child->name); in cdns_sierra_phy_probe()
1457 reset_control_put(sp->phys[node].lnk_rst); in cdns_sierra_phy_probe()
1462 sp->num_lanes += sp->phys[node].num_lanes; in cdns_sierra_phy_probe()
1464 if (!sp->already_configured) in cdns_sierra_phy_probe()
1471 reset_control_put(sp->phys[node].lnk_rst); in cdns_sierra_phy_probe()
1474 sp->phys[node].phy = gphy; in cdns_sierra_phy_probe()
1475 phy_set_drvdata(gphy, &sp->phys[node]); in cdns_sierra_phy_probe()
1479 sp->nsubnodes = node; in cdns_sierra_phy_probe()
1481 if (sp->num_lanes > SIERRA_MAX_LANES) { in cdns_sierra_phy_probe()
1482 ret = -EINVAL; in cdns_sierra_phy_probe()
1487 /* If more than one subnode, configure the PHY as multilink */ in cdns_sierra_phy_probe()
1488 if (!sp->already_configured && !sp->autoconf && sp->nsubnodes > 1) { in cdns_sierra_phy_probe()
1504 while (--node >= 0) in cdns_sierra_phy_probe()
1505 reset_control_put(sp->phys[node].lnk_rst); in cdns_sierra_phy_probe()
1507 if (!sp->already_configured) in cdns_sierra_phy_probe()
1508 reset_control_assert(sp->apb_rst); in cdns_sierra_phy_probe()
1518 struct cdns_sierra_phy *phy = platform_get_drvdata(pdev); in cdns_sierra_phy_remove() local
1521 reset_control_assert(phy->phy_rst); in cdns_sierra_phy_remove()
1522 reset_control_assert(phy->apb_rst); in cdns_sierra_phy_remove()
1523 pm_runtime_disable(&pdev->dev); in cdns_sierra_phy_remove()
1525 cdns_sierra_phy_disable_clocks(phy); in cdns_sierra_phy_remove()
1530 for (i = 0; i < phy->nsubnodes; i++) { in cdns_sierra_phy_remove()
1531 reset_control_assert(phy->phys[i].lnk_rst); in cdns_sierra_phy_remove()
1532 reset_control_put(phy->phys[i].lnk_rst); in cdns_sierra_phy_remove()
1535 cdns_sierra_clk_unregister(phy); in cdns_sierra_phy_remove()
1540 /* QSGMII PHY PMA lane configuration */
1606 /* PCIE PHY PCS common configuration */
2510 .compatible = "cdns,sierra-phy-t0",
2514 .compatible = "ti,sierra-phy-t0",
2525 .name = "cdns-sierra-phy",
2532 MODULE_AUTHOR("Cadence Design Systems");
2533 MODULE_DESCRIPTION("CDNS sierra phy driver");