Commit dae95d7f authored by Johan Hovold's avatar Johan Hovold Committed by Vinod Koul

phy: qcom-qmp-combo: clean up serdes initialisation

Clean up serdes initialisation somewhat by making the current helper a
dedicated helper for the DP part of the PHY.

Note that no error is currently returned for non-supported link rates.
Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20221114110621.4639-12-johan+linaro@kernel.orgSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 3ade3ede
...@@ -1313,7 +1313,7 @@ static void qmp_combo_configure(void __iomem *base, ...@@ -1313,7 +1313,7 @@ static void qmp_combo_configure(void __iomem *base,
qmp_combo_configure_lane(base, tbl, num, 0xff); qmp_combo_configure_lane(base, tbl, num, 0xff);
} }
static int qmp_combo_serdes_init(struct qmp_phy *qphy) static int qmp_combo_dp_serdes_init(struct qmp_phy *qphy)
{ {
const struct qmp_phy_cfg *cfg = qphy->cfg; const struct qmp_phy_cfg *cfg = qphy->cfg;
void __iomem *serdes = qphy->serdes; void __iomem *serdes = qphy->serdes;
...@@ -1323,28 +1323,26 @@ static int qmp_combo_serdes_init(struct qmp_phy *qphy) ...@@ -1323,28 +1323,26 @@ static int qmp_combo_serdes_init(struct qmp_phy *qphy)
qmp_combo_configure(serdes, serdes_tbl, serdes_tbl_num); qmp_combo_configure(serdes, serdes_tbl, serdes_tbl_num);
if (cfg->type == PHY_TYPE_DP) { switch (dp_opts->link_rate) {
switch (dp_opts->link_rate) { case 1620:
case 1620: qmp_combo_configure(serdes, cfg->serdes_tbl_rbr,
qmp_combo_configure(serdes, cfg->serdes_tbl_rbr, cfg->serdes_tbl_rbr_num);
cfg->serdes_tbl_rbr_num); break;
break; case 2700:
case 2700: qmp_combo_configure(serdes, cfg->serdes_tbl_hbr,
qmp_combo_configure(serdes, cfg->serdes_tbl_hbr, cfg->serdes_tbl_hbr_num);
cfg->serdes_tbl_hbr_num); break;
break; case 5400:
case 5400: qmp_combo_configure(serdes, cfg->serdes_tbl_hbr2,
qmp_combo_configure(serdes, cfg->serdes_tbl_hbr2, cfg->serdes_tbl_hbr2_num);
cfg->serdes_tbl_hbr2_num); break;
break; case 8100:
case 8100: qmp_combo_configure(serdes, cfg->serdes_tbl_hbr3,
qmp_combo_configure(serdes, cfg->serdes_tbl_hbr3, cfg->serdes_tbl_hbr3_num);
cfg->serdes_tbl_hbr3_num); break;
break; default:
default: /* Other link rates aren't supported */
/* Other link rates aren't supported */ return -EINVAL;
return -EINVAL;
}
} }
return 0; return 0;
...@@ -1994,7 +1992,7 @@ static int qmp_combo_dp_power_on(struct phy *phy) ...@@ -1994,7 +1992,7 @@ static int qmp_combo_dp_power_on(struct phy *phy)
const struct qmp_phy_cfg *cfg = qphy->cfg; const struct qmp_phy_cfg *cfg = qphy->cfg;
void __iomem *tx = qphy->tx; void __iomem *tx = qphy->tx;
qmp_combo_serdes_init(qphy); qmp_combo_dp_serdes_init(qphy);
qmp_combo_configure_lane(tx, cfg->tx_tbl, cfg->tx_tbl_num, 1); qmp_combo_configure_lane(tx, cfg->tx_tbl, cfg->tx_tbl_num, 1);
...@@ -2025,6 +2023,7 @@ static int qmp_combo_usb_power_on(struct phy *phy) ...@@ -2025,6 +2023,7 @@ static int qmp_combo_usb_power_on(struct phy *phy)
struct qmp_phy *qphy = phy_get_drvdata(phy); struct qmp_phy *qphy = phy_get_drvdata(phy);
struct qcom_qmp *qmp = qphy->qmp; struct qcom_qmp *qmp = qphy->qmp;
const struct qmp_phy_cfg *cfg = qphy->cfg; const struct qmp_phy_cfg *cfg = qphy->cfg;
void __iomem *serdes = qphy->serdes;
void __iomem *tx = qphy->tx; void __iomem *tx = qphy->tx;
void __iomem *rx = qphy->rx; void __iomem *rx = qphy->rx;
void __iomem *pcs = qphy->pcs; void __iomem *pcs = qphy->pcs;
...@@ -2032,7 +2031,7 @@ static int qmp_combo_usb_power_on(struct phy *phy) ...@@ -2032,7 +2031,7 @@ static int qmp_combo_usb_power_on(struct phy *phy)
unsigned int val; unsigned int val;
int ret; int ret;
qmp_combo_serdes_init(qphy); qmp_combo_configure(serdes, cfg->serdes_tbl, cfg->serdes_tbl_num);
ret = clk_prepare_enable(qphy->pipe_clk); ret = clk_prepare_enable(qphy->pipe_clk);
if (ret) { if (ret) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment