Lines Matching +full:pll1 +full:- +full:refclk

1 // SPDX-License-Identifier: GPL-2.0-or-later
191 struct brcm_sata_phy *priv = port->phy_priv; in brcm_sata_ctrl_base()
194 switch (priv->version) { in brcm_sata_ctrl_base()
199 dev_err(priv->dev, "invalid phy version\n"); in brcm_sata_ctrl_base()
203 return priv->ctrl_base + (port->portnum * size); in brcm_sata_ctrl_base()
209 struct brcm_sata_phy *priv = port->phy_priv; in brcm_sata_phy_wr()
210 void __iomem *pcb_base = priv->phy_base; in brcm_sata_phy_wr()
213 if (priv->version == BRCM_SATA_PHY_STB_40NM) in brcm_sata_phy_wr()
214 bank += (port->portnum * SATA_PCB_REG_40NM_SPACE_SIZE); in brcm_sata_phy_wr()
216 pcb_base += (port->portnum * SATA_PCB_REG_28NM_SPACE_SIZE); in brcm_sata_phy_wr()
226 struct brcm_sata_phy *priv = port->phy_priv; in brcm_sata_phy_rd()
227 void __iomem *pcb_base = priv->phy_base; in brcm_sata_phy_rd()
229 if (priv->version == BRCM_SATA_PHY_STB_40NM) in brcm_sata_phy_rd()
230 bank += (port->portnum * SATA_PCB_REG_40NM_SPACE_SIZE); in brcm_sata_phy_rd()
232 pcb_base += (port->portnum * SATA_PCB_REG_28NM_SPACE_SIZE); in brcm_sata_phy_rd()
245 struct brcm_sata_phy *priv = port->phy_priv; in brcm_stb_sata_ssc_init()
258 if (port->ssc_en) { in brcm_stb_sata_ssc_init()
259 dev_info(priv->dev, "enabling SSC on port%d\n", port->portnum); in brcm_stb_sata_ssc_init()
276 switch (port->rxaeq_mode) { in brcm_stb_sata_rxaeq_init()
288 if (port->rxaeq_val > AEQ_FRC_EQ_VAL_MASK) in brcm_stb_sata_rxaeq_init()
289 return -EINVAL; in brcm_stb_sata_rxaeq_init()
290 tmp |= port->rxaeq_val << AEQ_FRC_EQ_VAL_SHIFT; in brcm_stb_sata_rxaeq_init()
325 if (port->ssc_en) in brcm_stb_sata_16nm_ssc_init()
336 if (port->ssc_en) in brcm_stb_sata_16nm_ssc_init()
351 if (port->ssc_en) in brcm_stb_sata_16nm_ssc_init()
364 if (port->ssc_en) in brcm_stb_sata_16nm_ssc_init()
375 if (port->ssc_en) in brcm_stb_sata_16nm_ssc_init()
384 port->ssc_en ? TX_ACTRL5_SSC_EN : 0); in brcm_stb_sata_16nm_ssc_init()
394 /* NS2 SATA PLL1 defaults were characterized by H/W group */
404 struct device *dev = port->phy_priv->dev; in brcm_ns2_sata_init()
428 /* Set oob_clk_sel to refclk/2 */ in brcm_ns2_sata_init()
447 try--; in brcm_ns2_sata_init()
451 dev_err(dev, "port%d PLL did not lock\n", port->portnum); in brcm_ns2_sata_init()
452 return -ETIMEDOUT; in brcm_ns2_sata_init()
455 dev_dbg(dev, "port%d initialized\n", port->portnum); in brcm_ns2_sata_init()
462 struct device *dev = port->phy_priv->dev; in brcm_nsp_sata_init()
467 if (port->portnum == 0) in brcm_nsp_sata_init()
469 else if (port->portnum == 1) in brcm_nsp_sata_init()
472 return -EINVAL; in brcm_nsp_sata_init()
507 while (--try) { in brcm_nsp_sata_init()
516 dev_err(dev, "port%d PLL did not lock\n", port->portnum); in brcm_nsp_sata_init()
517 return -ETIMEDOUT; in brcm_nsp_sata_init()
520 dev_dbg(dev, "port%d initialized\n", port->portnum); in brcm_nsp_sata_init()
528 /* SR PHY PLL1 registers */
535 struct device *dev = port->phy_priv->dev; in brcm_sr_sata_init()
558 try--; in brcm_sr_sata_init()
563 dev_err(dev, "port%d PLL did not lock\n", port->portnum); in brcm_sr_sata_init()
564 return -ETIMEDOUT; in brcm_sr_sata_init()
587 struct device *dev = port->phy_priv->dev; in brcm_dsl_sata_init()
625 try--; in brcm_dsl_sata_init()
630 dev_err(dev, "port%d PLL did not lock\n", port->portnum); in brcm_dsl_sata_init()
631 return -ETIMEDOUT; in brcm_dsl_sata_init()
634 dev_dbg(dev, "port%d initialized\n", port->portnum); in brcm_dsl_sata_init()
644 switch (port->phy_priv->version) { in brcm_sata_phy_init()
665 rc = -ENODEV; in brcm_sata_phy_init()
682 int rc = -EOPNOTSUPP; in brcm_sata_phy_calibrate()
684 switch (port->phy_priv->version) { in brcm_sata_phy_calibrate()
704 { .compatible = "brcm,bcm7216-sata-phy",
706 { .compatible = "brcm,bcm7445-sata-phy",
708 { .compatible = "brcm,bcm7425-sata-phy",
710 { .compatible = "brcm,iproc-ns2-sata-phy",
712 { .compatible = "brcm,iproc-nsp-sata-phy",
714 { .compatible = "brcm,iproc-sr-sata-phy",
716 { .compatible = "brcm,bcm63138-sata-phy",
725 struct device *dev = &pdev->dev; in brcm_sata_phy_probe()
726 struct device_node *dn = dev->of_node, *child; in brcm_sata_phy_probe()
734 return -ENODEV; in brcm_sata_phy_probe()
738 return -ENOMEM; in brcm_sata_phy_probe()
740 priv->dev = dev; in brcm_sata_phy_probe()
743 priv->phy_base = devm_ioremap_resource(dev, res); in brcm_sata_phy_probe()
744 if (IS_ERR(priv->phy_base)) in brcm_sata_phy_probe()
745 return PTR_ERR(priv->phy_base); in brcm_sata_phy_probe()
749 priv->version = (enum brcm_sata_phy_version)of_id->data; in brcm_sata_phy_probe()
751 priv->version = BRCM_SATA_PHY_STB_28NM; in brcm_sata_phy_probe()
753 if (priv->version == BRCM_SATA_PHY_IPROC_NS2) { in brcm_sata_phy_probe()
755 "phy-ctrl"); in brcm_sata_phy_probe()
756 priv->ctrl_base = devm_ioremap_resource(dev, res); in brcm_sata_phy_probe()
757 if (IS_ERR(priv->ctrl_base)) in brcm_sata_phy_probe()
758 return PTR_ERR(priv->ctrl_base); in brcm_sata_phy_probe()
768 ret = -EINVAL; in brcm_sata_phy_probe()
774 ret = -EINVAL; in brcm_sata_phy_probe()
777 if (priv->phys[id].phy) { in brcm_sata_phy_probe()
779 ret = -EINVAL; in brcm_sata_phy_probe()
783 port = &priv->phys[id]; in brcm_sata_phy_probe()
784 port->portnum = id; in brcm_sata_phy_probe()
785 port->phy_priv = priv; in brcm_sata_phy_probe()
786 port->phy = devm_phy_create(dev, child, &phy_ops); in brcm_sata_phy_probe()
787 port->rxaeq_mode = RXAEQ_MODE_OFF; in brcm_sata_phy_probe()
788 if (!of_property_read_string(child, "brcm,rxaeq-mode", in brcm_sata_phy_probe()
790 port->rxaeq_mode = rxaeq_to_val(rxaeq_mode); in brcm_sata_phy_probe()
791 if (port->rxaeq_mode == RXAEQ_MODE_MANUAL) in brcm_sata_phy_probe()
792 of_property_read_u32(child, "brcm,rxaeq-value", in brcm_sata_phy_probe()
793 &port->rxaeq_val); in brcm_sata_phy_probe()
794 port->ssc_en = of_property_read_bool(child, "brcm,enable-ssc"); in brcm_sata_phy_probe()
795 if (IS_ERR(port->phy)) { in brcm_sata_phy_probe()
797 ret = PTR_ERR(port->phy); in brcm_sata_phy_probe()
801 phy_set_drvdata(port->phy, port); in brcm_sata_phy_probe()
823 .name = "brcm-sata-phy",
832 MODULE_ALIAS("platform:phy-brcm-sata");