phy: qcom-qmp-combo: preparatory cleanups (set 2/3)
Subsystems (2)
v2 cover phy: qcom-qmp-combo: preparatory cleanups (set 2/3)
Here's a set of preparatory cleanups needed to fix the devicetree binding and add (proper) support for SC8280XP to the combo driver but that are otherwise self-contained.
The full series is over forty patches and I'll be posting these in three parts of which this is the second. In an effort to get all of these into 6.2, I'll also be submitting all three series before waiting for the previous ones to be applied.
This series specifically separates the USB and DP PHY ops implementations, and merges the USB and DP driver data and configurations.
Johan
Changes in v2
- remove pcs_misc also from comment in DP legacy DT helper as this has never been part of the binding (even if some SoC dtsi got that wrong)
- drop the lanes configuration parameter (new patch)
- drop USB PHY init sequence cleanup (not needed after removing the lanes parameter)
Johan Hovold (22):
phy: qcom-qmp-combo: sort device-id table
phy: qcom-qmp-combo: move device-id table
phy: qcom-qmp-combo: move pm ops
phy: qcom-qmp-combo: rename PHY ops structures
phy: qcom-qmp-combo: drop unused DP PHY mode op
phy: qcom-qmp-combo: rename USB PHY ops
phy: qcom-qmp-combo: drop unnecessary debug message
phy: qcom-qmp-combo: separate USB and DP init ops
phy: qcom-qmp-combo: rename DP PHY ops
phy: qcom-qmp-combo: separate USB and DP power-on ops
phy: qcom-qmp-combo: clean up serdes initialisation
phy: qcom-qmp-combo: separate USB and DP devicetree parsing
phy: qcom-qmp-combo: add dedicated DP iomem pointers
phy: qcom-qmp-combo: clean up DP configurations
phy: qcom-qmp-combo: rename sc8280xp config
phy: qcom-qmp-combo: add DP configuration tables
phy: qcom-qmp-combo: drop lanes config parameter
phy: qcom-qmp-combo: merge USB and DP configurations
phy: qcom-qmp-combo: merge driver data
phy: qcom-qmp-combo: clean up device-tree parsing
phy: qcom-qmp-combo: clean up probe initialisation
phy: qcom-qmp-combo: clean up DP callback names
drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 1344 ++++++++++----------- 1 file changed, 608 insertions(+), 736 deletions(-)
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v2 1/22 phy: qcom-qmp-combo: sort device-id table
Sort the device-id table by compatible string to make it easier to find and add new entries.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +8 -8
@@ -2651,14 +2651,6 @@ static const struct of_device_id qmp_combo_of_match_table[] = { .compatible = "qcom,sc7180-qmp-usb3-dp-phy", .data = &sc7180_usb3dpphy_cfg, }, - { - .compatible = "qcom,sdm845-qmp-usb3-dp-phy", - .data = &sdm845_usb3dpphy_cfg, - }, - { - .compatible = "qcom,sm8250-qmp-usb3-dp-phy", - .data = &sm8250_usb3dpphy_cfg, - }, { .compatible = "qcom,sc8180x-qmp-usb3-dp-phy", .data = &sc8180x_usb3dpphy_cfg,
@@ -2667,6 +2659,14 @@ static const struct of_device_id qmp_combo_of_match_table[] = { .compatible = "qcom,sc8280xp-qmp-usb43dp-phy", .data = &sc8280xp_usb43dpphy_combo_cfg, }, + { + .compatible = "qcom,sdm845-qmp-usb3-dp-phy", + .data = &sdm845_usb3dpphy_cfg, + }, + { + .compatible = "qcom,sm8250-qmp-usb3-dp-phy", + .data = &sm8250_usb3dpphy_cfg, + }, { } };MODULE_DEVICE_TABLE (of, qmp_combo_of_match_table);
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v2 2/22 phy: qcom-qmp-combo: move device-id table
In reply to Johan HovoldMove the device-id table after probe() and next to the driver structure to keep the driver callback functions grouped together.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 50 +++++++++++------------ 1 file changed, 25 insertions(+), 25 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +25 -25
@@ -2646,31 +2646,6 @@ static int qmp_combo_create(struct device *dev, struct device_node *np, int id,return 0 ; } -static const struct of_device_id qmp_combo_of_match_table[] = { - { - .compatible ="qcom,sc7180-qmp-usb3-dp-phy" , - .data = &sc7180_usb3dpphy_cfg, - }, - { - .compatible ="qcom,sc8180x-qmp-usb3-dp-phy" , - .data = &sc8180x_usb3dpphy_cfg, - }, - { - .compatible ="qcom,sc8280xp-qmp-usb43dp-phy" , - .data = &sc8280xp_usb43dpphy_combo_cfg, - }, - { - .compatible ="qcom,sdm845-qmp-usb3-dp-phy" , - .data = &sdm845_usb3dpphy_cfg, - }, - { - .compatible ="qcom,sm8250-qmp-usb3-dp-phy" , - .data = &sm8250_usb3dpphy_cfg, - }, - { } -}; -MODULE_DEVICE_TABLE (of, qmp_combo_of_match_table); -static const struct dev_pm_ops qmp_combo_pm_ops = {SET_RUNTIME_PM_OPS (qmp_combo_runtime_suspend, qmp_combo_runtime_resume,NULL )
@@ -2815,6 +2790,31 @@ static int qmp_combo_probe(struct platform_device *pdev)return ret; } +static const struct of_device_id qmp_combo_of_match_table[] = { + { + .compatible ="qcom,sc7180-qmp-usb3-dp-phy" , + .data = &sc7180_usb3dpphy_cfg, + }, + { + .compatible ="qcom,sc8180x-qmp-usb3-dp-phy" , + .data = &sc8180x_usb3dpphy_cfg, + }, + { + .compatible ="qcom,sc8280xp-qmp-usb43dp-phy" , + .data = &sc8280xp_usb43dpphy_combo_cfg, + }, + { + .compatible ="qcom,sdm845-qmp-usb3-dp-phy" , + .data = &sdm845_usb3dpphy_cfg, + }, + { + .compatible ="qcom,sm8250-qmp-usb3-dp-phy" , + .data = &sm8250_usb3dpphy_cfg, + }, + { } +}; +MODULE_DEVICE_TABLE (of, qmp_combo_of_match_table); +static struct platform_driver qmp_combo_driver = { .probe = qmp_combo_probe, .driver = {
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v2 3/22 phy: qcom-qmp-combo: move pm ops
In reply to Johan HovoldMove the PM ops structure next to the implementation to keep the driver callbacks grouped.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +5 -5
@@ -2216,6 +2216,11 @@ static int __maybe_unused qmp_combo_runtime_resume(struct device *dev)return 0 ; } +static const struct dev_pm_ops qmp_combo_pm_ops = { +SET_RUNTIME_PM_OPS (qmp_combo_runtime_suspend, + qmp_combo_runtime_resume,NULL ) +}; +static int qmp_combo_vreg_init (struct device *dev,const struct qmp_phy_cfg *cfg) {struct qcom_qmp *qmp =dev_get_drvdata (dev);
@@ -2646,11 +2651,6 @@ static int qmp_combo_create(struct device *dev, struct device_node *np, int id,return 0 ; } -static const struct dev_pm_ops qmp_combo_pm_ops = { -SET_RUNTIME_PM_OPS (qmp_combo_runtime_suspend, - qmp_combo_runtime_resume,NULL ) -}; -static int qmp_combo_probe (struct platform_device *pdev) {struct qcom_qmp *qmp;
Signature · 1 line
2.37.4
PATCH v2 4/22 phy: qcom-qmp-combo: rename PHY ops structures
In reply to Johan HovoldRename the PHY operation structures so that they have a "phy_ops" suffix and move them next to the implementation.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 40 +++++++++++------------ 1 file changed, 20 insertions(+), 20 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +20 -20
@@ -2118,6 +2118,24 @@ static int qmp_combo_set_mode(struct phy *phy, enum phy_mode mode, int submode)return 0 ; } +static const struct phy_ops qmp_combo_usb_phy_ops = { + .init = qmp_combo_enable, + .exit = qmp_combo_disable, + .set_mode = qmp_combo_set_mode, + .owner =THIS_MODULE , +}; + +static const struct phy_ops qmp_combo_dp_phy_ops = { + .init = qmp_combo_init, + .configure = qcom_qmp_dp_phy_configure, + .power_on = qmp_combo_power_on, + .calibrate = qcom_qmp_dp_phy_calibrate, + .power_off = qmp_combo_power_off, + .exit = qmp_combo_exit, + .set_mode = qmp_combo_set_mode, + .owner =THIS_MODULE , +}; +static void qmp_combo_enable_autonomous_mode (struct qmp_phy *qphy) {const struct qmp_phy_cfg *cfg = qphy->cfg;
@@ -2542,24 +2560,6 @@ static int phy_dp_clks_register(struct qcom_qmp *qmp, struct qmp_phy *qphy,return devm_add_action_or_reset (qmp->dev, phy_clk_release_provider, np); } -static const struct phy_ops qmp_combo_usb_ops = { - .init = qmp_combo_enable, - .exit = qmp_combo_disable, - .set_mode = qmp_combo_set_mode, - .owner =THIS_MODULE , -}; - -static const struct phy_ops qmp_combo_dp_ops = { - .init = qmp_combo_init, - .configure = qcom_qmp_dp_phy_configure, - .power_on = qmp_combo_power_on, - .calibrate = qcom_qmp_dp_phy_calibrate, - .power_off = qmp_combo_power_off, - .exit = qmp_combo_exit, - .set_mode = qmp_combo_set_mode, - .owner =THIS_MODULE , -}; -static int qmp_combo_create (struct device *dev,struct device_node *np,int id,void __iomem *serdes,const struct qmp_phy_cfg *cfg) {
@@ -2632,9 +2632,9 @@ static int qmp_combo_create(struct device *dev, struct device_node *np, int id, }if (cfg->type ==PHY_TYPE_DP ) - ops = &qmp_combo_dp_ops; + ops = &qmp_combo_dp_phy_ops;else - ops = &qmp_combo_usb_ops; + ops = &qmp_combo_usb_phy_ops; generic_phy =devm_phy_create (dev, np, ops);if (IS_ERR (generic_phy)) {
Signature · 1 line
2.37.4
PATCH v2 5/22 phy: qcom-qmp-combo: drop unused DP PHY mode op
In reply to Johan HovoldThe set-mode operation is currently only used by the USB part of the PHY so drop the corresponding callback from the DP PHY ops.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 1 - 1 file changed, 1 deletion(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +0 -1
@@ -2132,7 +2132,6 @@ static const struct phy_ops qmp_combo_dp_phy_ops = { .calibrate = qcom_qmp_dp_phy_calibrate, .power_off = qmp_combo_power_off, .exit = qmp_combo_exit, - .set_mode = qmp_combo_set_mode, .owner = THIS_MODULE, };
Signature · 1 line
2.37.4
PATCH v2 6/22 phy: qcom-qmp-combo: rename USB PHY ops
In reply to Johan HovoldAdd a "usb" infix to the USB PHY operation functions and name them after the corresponding operations (e.g. "init" rather than "enable").
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +6 -6
@@ -2084,7 +2084,7 @@ static int qmp_combo_exit(struct phy *phy)return 0 ; } -static int qmp_combo_enable (struct phy *phy) +static int qmp_combo_usb_init (struct phy *phy) {int ret;
@@ -2099,7 +2099,7 @@ static int qmp_combo_enable(struct phy *phy)return ret; } -static int qmp_combo_disable (struct phy *phy) +static int qmp_combo_usb_exit (struct phy *phy) {int ret;
@@ -2109,7 +2109,7 @@ static int qmp_combo_disable(struct phy *phy)return qmp_combo_exit (phy); } -static int qmp_combo_set_mode (struct phy *phy,enum phy_mode mode,int submode) +static int qmp_combo_usb_set_mode (struct phy *phy,enum phy_mode mode,int submode) {struct qmp_phy *qphy =phy_get_drvdata (phy);
@@ -2119,9 +2119,9 @@ static int qmp_combo_set_mode(struct phy *phy, enum phy_mode mode, int submode) }static const struct phy_ops qmp_combo_usb_phy_ops = { - .init = qmp_combo_enable, - .exit = qmp_combo_disable, - .set_mode = qmp_combo_set_mode, + .init = qmp_combo_usb_init, + .exit = qmp_combo_usb_exit, + .set_mode = qmp_combo_usb_set_mode, .owner =THIS_MODULE , };
Signature · 1 line
2.37.4
PATCH v2 7/22 phy: qcom-qmp-combo: drop unnecessary debug message
In reply to Johan HovoldDrop the unnecessary (verbose) debug message from the init PHY op.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 2 -- 1 file changed, 2 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +0 -2
@@ -1967,10 +1967,8 @@ static int qmp_combo_com_exit(struct qmp_phy *qphy)static int qmp_combo_init (struct phy *phy) {struct qmp_phy *qphy =phy_get_drvdata (phy); -struct qcom_qmp *qmp = qphy->qmp;const struct qmp_phy_cfg *cfg = qphy->cfg;int ret; -dev_vdbg (qmp->dev,"Initializing QMP phy\n" ); ret =qmp_combo_com_init (qphy);if (ret)
Signature · 1 line
2.37.4
PATCH v2 8/22 phy: qcom-qmp-combo: separate USB and DP init ops
In reply to Johan HovoldSeparate the USB and DP init and exit operations by calling the common initialisation code directly from the USB operation and adding a "dp" infix to the DP callbacks.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 36 ++++++++++++----------- 1 file changed, 19 insertions(+), 17 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +19 -17
@@ -1964,7 +1964,7 @@ static int qmp_combo_com_exit(struct qmp_phy *qphy)return 0 ; } -static int qmp_combo_init (struct phy *phy) +static int qmp_combo_dp_init (struct phy *phy) {struct qmp_phy *qphy =phy_get_drvdata (phy);const struct qmp_phy_cfg *cfg = qphy->cfg;
@@ -1974,8 +1974,16 @@ static int qmp_combo_init(struct phy *phy)if (ret)return ret; -if (cfg->type ==PHY_TYPE_DP ) - cfg->dp_aux_init (qphy); + cfg->dp_aux_init (qphy); + +return 0 ; +} + +static int qmp_combo_dp_exit (struct phy *phy) +{ +struct qmp_phy *qphy =phy_get_drvdata (phy); + +qmp_combo_com_exit (qphy);return 0 ; }
@@ -2073,38 +2081,32 @@ static int qmp_combo_power_off(struct phy *phy)return 0 ; } -static int qmp_combo_exit (struct phy *phy) -{ -struct qmp_phy *qphy =phy_get_drvdata (phy); - -qmp_combo_com_exit (qphy); - -return 0 ; -} -static int qmp_combo_usb_init (struct phy *phy) { +struct qmp_phy *qphy =phy_get_drvdata (phy);int ret; - ret =qmp_combo_init (phy); + ret =qmp_combo_com_init (qphy);if (ret)return ret; ret =qmp_combo_power_on (phy);if (ret) -qmp_combo_exit (phy); +qmp_combo_com_exit (qphy);return ret; }static int qmp_combo_usb_exit (struct phy *phy) { +struct qmp_phy *qphy =phy_get_drvdata (phy);int ret; ret =qmp_combo_power_off (phy);if (ret)return ret; -return qmp_combo_exit (phy); + +return qmp_combo_com_exit (qphy); }static int qmp_combo_usb_set_mode (struct phy *phy,enum phy_mode mode,int submode)
@@ -2124,12 +2126,12 @@ static const struct phy_ops qmp_combo_usb_phy_ops = { };static const struct phy_ops qmp_combo_dp_phy_ops = { - .init = qmp_combo_init, + .init = qmp_combo_dp_init, .configure = qcom_qmp_dp_phy_configure, .power_on = qmp_combo_power_on, .calibrate = qcom_qmp_dp_phy_calibrate, .power_off = qmp_combo_power_off, - .exit = qmp_combo_exit, + .exit = qmp_combo_dp_exit, .owner =THIS_MODULE , };
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v2 9/22 phy: qcom-qmp-combo: rename DP PHY ops
In reply to Johan HovoldRename the configure and calibrate DP PHY ops using the common prefix for consistency.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +4 -4
@@ -1842,7 +1842,7 @@ static int qcom_qmp_v4_dp_phy_calibrate(struct qmp_phy *qphy)return 0 ; } -static int qcom_qmp_dp_phy_configure (struct phy *phy,union phy_configure_opts *opts) +static int qmp_combo_dp_configure (struct phy *phy,union phy_configure_opts *opts) {const struct phy_configure_opts_dp *dp_opts = &opts->dp;struct qmp_phy *qphy =phy_get_drvdata (phy);
@@ -1857,7 +1857,7 @@ static int qcom_qmp_dp_phy_configure(struct phy *phy, union phy_configure_opts *return 0 ; } -static int qcom_qmp_dp_phy_calibrate (struct phy *phy) +static int qmp_combo_dp_calibrate (struct phy *phy) {struct qmp_phy *qphy =phy_get_drvdata (phy);const struct qmp_phy_cfg *cfg = qphy->cfg;
@@ -2127,9 +2127,9 @@ static const struct phy_ops qmp_combo_usb_phy_ops = {static const struct phy_ops qmp_combo_dp_phy_ops = { .init = qmp_combo_dp_init, - .configure = qcom_qmp_dp_phy_configure, + .configure = qmp_combo_dp_configure, .power_on = qmp_combo_power_on, - .calibrate = qcom_qmp_dp_phy_calibrate, + .calibrate = qmp_combo_dp_calibrate, .power_off = qmp_combo_power_off, .exit = qmp_combo_dp_exit, .owner =THIS_MODULE ,
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v2 10/22 phy: qcom-qmp-combo: separate USB and DP power-on ops
In reply to Johan HovoldSeparate the USB and DP power-on and power-off operations in two dedicated implementations.
Note that the pipe clock is only used by the USB part of the PHY and that no DP configuration has a pcs (or rx) table or has has_pwrdn_delay set.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 100 +++++++++++++--------- 1 file changed, 59 insertions(+), 41 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +59 -41
@@ -1988,7 +1988,39 @@ static int qmp_combo_dp_exit(struct phy *phy)return 0 ; } -static int qmp_combo_power_on (struct phy *phy) +static int qmp_combo_dp_power_on (struct phy *phy) +{ +struct qmp_phy *qphy =phy_get_drvdata (phy); +const struct qmp_phy_cfg *cfg = qphy->cfg; +void __iomem *tx = qphy->tx; + +qmp_combo_serdes_init (qphy); + +qmp_combo_configure_lane (tx, cfg->tx_tbl, cfg->tx_tbl_num,1 ); + +if (cfg->lanes >=2 ) +qmp_combo_configure_lane (qphy->tx2, cfg->tx_tbl, cfg->tx_tbl_num,2 ); + +/* Configure special DP tx tunings */ + cfg->configure_dp_tx (qphy); + +/* Configure link rate, swing, etc. */ + cfg->configure_dp_phy (qphy); + +return 0 ; +} + +static int qmp_combo_dp_power_off (struct phy *phy) +{ +struct qmp_phy *qphy =phy_get_drvdata (phy); + +/* Assert DP PHY power down */ +writel (DP_PHY_PD_CTL_PSR_PWRDN , qphy->pcs +QSERDES_DP_PHY_PD_CTL ); + +return 0 ; +} + +static int qmp_combo_usb_power_on (struct phy *phy) {struct qmp_phy *qphy =phy_get_drvdata (phy);struct qcom_qmp *qmp = qphy->qmp;
@@ -2014,39 +2046,30 @@ static int qmp_combo_power_on(struct phy *phy)if (cfg->lanes >=2 )qmp_combo_configure_lane (qphy->tx2, cfg->tx_tbl, cfg->tx_tbl_num,2 ); -/* Configure special DP tx tunings */ -if (cfg->type ==PHY_TYPE_DP ) - cfg->configure_dp_tx (qphy); -qmp_combo_configure_lane (rx, cfg->rx_tbl, cfg->rx_tbl_num,1 );if (cfg->lanes >=2 )qmp_combo_configure_lane (qphy->rx2, cfg->rx_tbl, cfg->rx_tbl_num,2 ); -/* Configure link rate, swing, etc. */ -if (cfg->type ==PHY_TYPE_DP ) - cfg->configure_dp_phy (qphy); -else -qmp_combo_configure (pcs, cfg->pcs_tbl, cfg->pcs_tbl_num); +qmp_combo_configure (pcs, cfg->pcs_tbl, cfg->pcs_tbl_num);if (cfg->has_pwrdn_delay)usleep_range (10 ,20 ); -if (cfg->type !=PHY_TYPE_DP ) { -/* Pull PHY out of reset state */ -qphy_clrbits (pcs, cfg->regs[QPHY_SW_RESET ],SW_RESET ); -/* start SerDes and Phy-Coding-Sublayer */ -qphy_setbits (pcs, cfg->regs[QPHY_START_CTRL ], -SERDES_START |PCS_START ); +/* Pull PHY out of reset state */ +qphy_clrbits (pcs, cfg->regs[QPHY_SW_RESET ],SW_RESET ); - status = pcs + cfg->regs[QPHY_PCS_STATUS ]; - ret =readl_poll_timeout (status, val, !(val &PHYSTATUS ),200 , -PHY_INIT_COMPLETE_TIMEOUT ); -if (ret) { -dev_err (qmp->dev,"phy initialization timed-out\n" ); - goto err_disable_pipe_clk; - } +/* start SerDes and Phy-Coding-Sublayer */ +qphy_setbits (pcs, cfg->regs[QPHY_START_CTRL ],SERDES_START |PCS_START ); + + status = pcs + cfg->regs[QPHY_PCS_STATUS ]; + ret =readl_poll_timeout (status, val, !(val &PHYSTATUS ),200 , +PHY_INIT_COMPLETE_TIMEOUT ); +if (ret) { +dev_err (qmp->dev,"phy initialization timed-out\n" ); + goto err_disable_pipe_clk; } +return 0 ; err_disable_pipe_clk:
@@ -2055,28 +2078,23 @@ static int qmp_combo_power_on(struct phy *phy)return ret; } -static int qmp_combo_power_off (struct phy *phy) +static int qmp_combo_usb_power_off (struct phy *phy) {struct qmp_phy *qphy =phy_get_drvdata (phy);const struct qmp_phy_cfg *cfg = qphy->cfg;clk_disable_unprepare (qphy->pipe_clk); -if (cfg->type ==PHY_TYPE_DP ) { -/* Assert DP PHY power down */ -writel (DP_PHY_PD_CTL_PSR_PWRDN , qphy->pcs +QSERDES_DP_PHY_PD_CTL ); - }else { -/* PHY reset */ -qphy_setbits (qphy->pcs, cfg->regs[QPHY_SW_RESET ],SW_RESET ); +/* PHY reset */ +qphy_setbits (qphy->pcs, cfg->regs[QPHY_SW_RESET ],SW_RESET ); -/* stop SerDes and Phy-Coding-Sublayer */ -qphy_clrbits (qphy->pcs, cfg->regs[QPHY_START_CTRL ], -SERDES_START |PCS_START ); +/* stop SerDes and Phy-Coding-Sublayer */ +qphy_clrbits (qphy->pcs, cfg->regs[QPHY_START_CTRL ], +SERDES_START |PCS_START ); -/* Put PHY into POWER DOWN state: active low */ -qphy_clrbits (qphy->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL ], -SW_PWRDN ); - } +/* Put PHY into POWER DOWN state: active low */ +qphy_clrbits (qphy->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL ], +SW_PWRDN );return 0 ; }
@@ -2090,7 +2108,7 @@ static int qmp_combo_usb_init(struct phy *phy)if (ret)return ret; - ret =qmp_combo_power_on (phy); + ret =qmp_combo_usb_power_on (phy);if (ret)qmp_combo_com_exit (qphy);
@@ -2102,7 +2120,7 @@ static int qmp_combo_usb_exit(struct phy *phy)struct qmp_phy *qphy =phy_get_drvdata (phy);int ret; - ret =qmp_combo_power_off (phy); + ret =qmp_combo_usb_power_off (phy);if (ret)return ret;
@@ -2128,9 +2146,9 @@ static const struct phy_ops qmp_combo_usb_phy_ops = {static const struct phy_ops qmp_combo_dp_phy_ops = { .init = qmp_combo_dp_init, .configure = qmp_combo_dp_configure, - .power_on = qmp_combo_power_on, + .power_on = qmp_combo_dp_power_on, .calibrate = qmp_combo_dp_calibrate, - .power_off = qmp_combo_power_off, + .power_off = qmp_combo_dp_power_off, .exit = qmp_combo_dp_exit, .owner =THIS_MODULE , };
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v2 11/22 phy: qcom-qmp-combo: clean up serdes initialisation
In reply to Johan HovoldClean 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.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 49 +++++++++++------------ 1 file changed, 24 insertions(+), 25 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +24 -25
@@ -1313,7 +1313,7 @@ static void qmp_combo_configure(void __iomem *base,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;void __iomem *serdes = qphy->serdes;
@@ -1323,28 +1323,26 @@ static int qmp_combo_serdes_init(struct qmp_phy *qphy)qmp_combo_configure (serdes, serdes_tbl, serdes_tbl_num); -if (cfg->type ==PHY_TYPE_DP ) { -switch (dp_opts->link_rate) { -case 1620 : -qmp_combo_configure (serdes, cfg->serdes_tbl_rbr, - cfg->serdes_tbl_rbr_num); -break ; -case 2700 : -qmp_combo_configure (serdes, cfg->serdes_tbl_hbr, - cfg->serdes_tbl_hbr_num); -break ; -case 5400 : -qmp_combo_configure (serdes, cfg->serdes_tbl_hbr2, - cfg->serdes_tbl_hbr2_num); -break ; -case 8100 : -qmp_combo_configure (serdes, cfg->serdes_tbl_hbr3, - cfg->serdes_tbl_hbr3_num); -break ; -default : -/* Other link rates aren't supported */ -return -EINVAL ; - } +switch (dp_opts->link_rate) { +case 1620 : +qmp_combo_configure (serdes, cfg->serdes_tbl_rbr, + cfg->serdes_tbl_rbr_num); +break ; +case 2700 : +qmp_combo_configure (serdes, cfg->serdes_tbl_hbr, + cfg->serdes_tbl_hbr_num); +break ; +case 5400 : +qmp_combo_configure (serdes, cfg->serdes_tbl_hbr2, + cfg->serdes_tbl_hbr2_num); +break ; +case 8100 : +qmp_combo_configure (serdes, cfg->serdes_tbl_hbr3, + cfg->serdes_tbl_hbr3_num); +break ; +default : +/* Other link rates aren't supported */ +return -EINVAL ; }return 0 ;
@@ -1994,7 +1992,7 @@ static int qmp_combo_dp_power_on(struct phy *phy)const struct qmp_phy_cfg *cfg = qphy->cfg;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 );
@@ -2025,6 +2023,7 @@ static int qmp_combo_usb_power_on(struct phy *phy)struct qmp_phy *qphy =phy_get_drvdata (phy);struct qcom_qmp *qmp = qphy->qmp;const struct qmp_phy_cfg *cfg = qphy->cfg; +void __iomem *serdes = qphy->serdes;void __iomem *tx = qphy->tx;void __iomem *rx = qphy->rx;void __iomem *pcs = qphy->pcs;
@@ -2032,7 +2031,7 @@ static int qmp_combo_usb_power_on(struct phy *phy)unsigned int val;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);if (ret) {
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v2 12/22 phy: qcom-qmp-combo: separate USB and DP devicetree parsing
In reply to Johan HovoldSeparate the devicetree parsing of the USB and DP child nodes in two dedicated helpers in preparation for merging the driver data.
Note that only the USB part of the PHY has a pipe clock and that the DP implementation only uses the tx/tx2 and pcs register regions.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 82 ++++++++++++++++------- 1 file changed, 58 insertions(+), 24 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +58 -24
@@ -2576,13 +2576,12 @@ static int phy_dp_clks_register(struct qcom_qmp *qmp, struct qmp_phy *qphy,return devm_add_action_or_reset (qmp->dev, phy_clk_release_provider, np); } -static int qmp_combo_create (struct device *dev,struct device_node *np,int id, +static int qmp_combo_create_dp (struct device *dev,struct device_node *np,int id,void __iomem *serdes,const struct qmp_phy_cfg *cfg) {struct qcom_qmp *qmp =dev_get_drvdata (dev);struct phy *generic_phy;struct qmp_phy *qphy; -const struct phy_ops *ops;int ret; qphy =devm_kzalloc (dev,sizeof (*qphy),GFP_KERNEL );
@@ -2592,7 +2591,57 @@ static int qmp_combo_create(struct device *dev, struct device_node *np, int id, qphy->cfg = cfg; qphy->serdes = serdes;/* -* Get memory resources for each PHY: +* Get memory resources from the DP child node: +* Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2. +* For dual lane PHYs: tx2 -> 3, rx2 -> 4 +* +* Note that only tx/tx2 and pcs are used by the DP implementation. +*/ + qphy->tx =devm_of_iomap (dev, np,0 ,NULL ); +if (IS_ERR (qphy->tx)) +return PTR_ERR (qphy->tx); + + qphy->pcs =devm_of_iomap (dev, np,2 ,NULL ); +if (IS_ERR (qphy->pcs)) +return PTR_ERR (qphy->pcs); + +if (cfg->lanes >=2 ) { + qphy->tx2 =devm_of_iomap (dev, np,3 ,NULL ); +if (IS_ERR (qphy->tx2)) +return PTR_ERR (qphy->tx2); + } + + generic_phy =devm_phy_create (dev, np, &qmp_combo_dp_phy_ops); +if (IS_ERR (generic_phy)) { + ret =PTR_ERR (generic_phy); +dev_err (dev,"failed to create DP PHY: %d\n" , ret); +return ret; + } + + qphy->phy = generic_phy; + qphy->qmp = qmp; + qmp->phys[id] = qphy; +phy_set_drvdata (generic_phy, qphy); + +return 0 ; +} + +static int qmp_combo_create_usb (struct device *dev,struct device_node *np,int id, +void __iomem *serdes,const struct qmp_phy_cfg *cfg) +{ +struct qcom_qmp *qmp =dev_get_drvdata (dev); +struct phy *generic_phy; +struct qmp_phy *qphy; +int ret; + + qphy =devm_kzalloc (dev,sizeof (*qphy),GFP_KERNEL ); +if (!qphy) +return -ENOMEM ; + + qphy->cfg = cfg; + qphy->serdes = serdes; +/* +* Get memory resources from the USB child node: * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2. * For dual lane PHYs: tx2 -> 3, rx2 -> 4, pcs_misc (optional) -> 5 * For single lane PHYs: pcs_misc (optional) -> 3.
@@ -2631,31 +2680,16 @@ static int qmp_combo_create(struct device *dev, struct device_node *np, int id, qphy->pcs_misc =NULL ; } -/* -* Get PHY's Pipe clock, if any. USB3 and PCIe are PIPE3 -* based phys, so they essentially have pipe clock. So, -* we return error in case phy is USB3 or PIPE type. -* Otherwise, we initialize pipe clock to NULL for -* all phys that don't need this. -*/ qphy->pipe_clk =devm_get_clk_from_child (dev, np,NULL );if (IS_ERR (qphy->pipe_clk)) { -if (cfg->type ==PHY_TYPE_USB3 ) -return dev_err_probe (dev,PTR_ERR (qphy->pipe_clk), -"failed to get lane%d pipe_clk\n" , - id); - qphy->pipe_clk =NULL ; +return dev_err_probe (dev,PTR_ERR (qphy->pipe_clk), +"failed to get lane%d pipe_clk\n" , id); } -if (cfg->type ==PHY_TYPE_DP ) - ops = &qmp_combo_dp_phy_ops; -else - ops = &qmp_combo_usb_phy_ops; - - generic_phy =devm_phy_create (dev, np, ops); + generic_phy =devm_phy_create (dev, np, &qmp_combo_usb_phy_ops);if (IS_ERR (generic_phy)) { ret =PTR_ERR (generic_phy); -dev_err (dev,"failed to create qphy %d\n" , ret); +dev_err (dev,"failed to create USB PHY: %d\n" , ret);return ret; }
@@ -2752,7 +2786,7 @@ static int qmp_combo_probe(struct platform_device *pdev) serdes = dp_serdes;/* Create per-lane phy */ - ret =qmp_combo_create (dev, child, id, serdes, cfg); + ret =qmp_combo_create_dp (dev, child, id, serdes, cfg);if (ret) {dev_err (dev,"failed to create lane%d phy, %d\n" , id, ret);
@@ -2770,7 +2804,7 @@ static int qmp_combo_probe(struct platform_device *pdev) serdes = usb_serdes;/* Create per-lane phy */ - ret =qmp_combo_create (dev, child, id, serdes, cfg); + ret =qmp_combo_create_usb (dev, child, id, serdes, cfg);if (ret) {dev_err (dev,"failed to create lane%d phy, %d\n" , id, ret);
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v2 13/22 phy: qcom-qmp-combo: add dedicated DP iomem pointers
In reply to Johan HovoldIn preparation for merging the driver data, add separate iomem pointers for the DP part of the PHY.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 246 +++++++++++----------- 1 file changed, 126 insertions(+), 120 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +126 -120
@@ -895,6 +895,12 @@ struct qmp_phy {void __iomem *rx2;void __iomem *pcs_misc;void __iomem *pcs_usb; + +void __iomem *dp_serdes; +void __iomem *dp_tx; +void __iomem *dp_tx2; +void __iomem *dp_pcs; +struct clk *pipe_clk;struct qcom_qmp *qmp;enum phy_mode mode;
@@ -1316,7 +1322,7 @@ static void qmp_combo_configure(void __iomem *base,static int qmp_combo_dp_serdes_init (struct qmp_phy *qphy) {const struct qmp_phy_cfg *cfg = qphy->cfg; -void __iomem *serdes = qphy->serdes; +void __iomem *serdes = qphy->dp_serdes;const struct phy_configure_opts_dp *dp_opts = &qphy->dp_opts;const struct qmp_phy_init_tbl *serdes_tbl = cfg->serdes_tbl;int serdes_tbl_num = cfg->serdes_tbl_num;
@@ -1352,43 +1358,43 @@ static void qcom_qmp_v3_phy_dp_aux_init(struct qmp_phy *qphy) {writel (DP_PHY_PD_CTL_PWRDN |DP_PHY_PD_CTL_AUX_PWRDN |DP_PHY_PD_CTL_PLL_PWRDN |DP_PHY_PD_CTL_DP_CLAMP_EN , - qphy->pcs +QSERDES_DP_PHY_PD_CTL ); + qphy->dp_pcs +QSERDES_DP_PHY_PD_CTL );/* Turn on BIAS current for PHY/PLL */ writel (QSERDES_V3_COM_BIAS_EN |QSERDES_V3_COM_BIAS_EN_MUX |QSERDES_V3_COM_CLKBUF_L_EN |QSERDES_V3_COM_EN_SYSCLK_TX_SEL , - qphy->serdes +QSERDES_V3_COM_BIAS_EN_CLKBUFLR_EN ); + qphy->dp_serdes +QSERDES_V3_COM_BIAS_EN_CLKBUFLR_EN ); -writel (DP_PHY_PD_CTL_PSR_PWRDN , qphy->pcs +QSERDES_DP_PHY_PD_CTL ); +writel (DP_PHY_PD_CTL_PSR_PWRDN , qphy->dp_pcs +QSERDES_DP_PHY_PD_CTL );writel (DP_PHY_PD_CTL_PWRDN |DP_PHY_PD_CTL_AUX_PWRDN |DP_PHY_PD_CTL_LANE_0_1_PWRDN |DP_PHY_PD_CTL_LANE_2_3_PWRDN |DP_PHY_PD_CTL_PLL_PWRDN |DP_PHY_PD_CTL_DP_CLAMP_EN , - qphy->pcs +QSERDES_DP_PHY_PD_CTL ); + qphy->dp_pcs +QSERDES_DP_PHY_PD_CTL );writel (QSERDES_V3_COM_BIAS_EN |QSERDES_V3_COM_BIAS_EN_MUX |QSERDES_V3_COM_CLKBUF_R_EN |QSERDES_V3_COM_CLKBUF_L_EN |QSERDES_V3_COM_EN_SYSCLK_TX_SEL |QSERDES_V3_COM_CLKBUF_RX_DRIVE_L , - qphy->serdes +QSERDES_V3_COM_BIAS_EN_CLKBUFLR_EN ); - -writel (0x00 , qphy->pcs +QSERDES_DP_PHY_AUX_CFG0 ); -writel (0x13 , qphy->pcs +QSERDES_DP_PHY_AUX_CFG1 ); -writel (0x24 , qphy->pcs +QSERDES_DP_PHY_AUX_CFG2 ); -writel (0x00 , qphy->pcs +QSERDES_DP_PHY_AUX_CFG3 ); -writel (0x0a , qphy->pcs +QSERDES_DP_PHY_AUX_CFG4 ); -writel (0x26 , qphy->pcs +QSERDES_DP_PHY_AUX_CFG5 ); -writel (0x0a , qphy->pcs +QSERDES_DP_PHY_AUX_CFG6 ); -writel (0x03 , qphy->pcs +QSERDES_DP_PHY_AUX_CFG7 ); -writel (0xbb , qphy->pcs +QSERDES_DP_PHY_AUX_CFG8 ); -writel (0x03 , qphy->pcs +QSERDES_DP_PHY_AUX_CFG9 ); + qphy->dp_serdes +QSERDES_V3_COM_BIAS_EN_CLKBUFLR_EN ); + +writel (0x00 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG0 ); +writel (0x13 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG1 ); +writel (0x24 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG2 ); +writel (0x00 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG3 ); +writel (0x0a , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG4 ); +writel (0x26 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG5 ); +writel (0x0a , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG6 ); +writel (0x03 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG7 ); +writel (0xbb , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG8 ); +writel (0x03 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG9 ); qphy->dp_aux_cfg =0 ;writel (PHY_AUX_STOP_ERR_MASK |PHY_AUX_DEC_ERR_MASK |PHY_AUX_SYNC_ERR_MASK |PHY_AUX_ALIGN_ERR_MASK |PHY_AUX_REQ_ERR_MASK , - qphy->pcs +QSERDES_V3_DP_PHY_AUX_INTERRUPT_MASK ); + qphy->dp_pcs +QSERDES_V3_DP_PHY_AUX_INTERRUPT_MASK ); } static int qmp_combo_configure_dp_swing(struct qmp_phy *qphy,
@@ -1421,10 +1427,10 @@ static int qmp_combo_configure_dp_swing(struct qmp_phy *qphy, voltage_swing_cfg |= DP_PHY_TXn_TX_DRV_LVL_MUX_EN; pre_emphasis_cfg |= DP_PHY_TXn_TX_EMP_POST1_LVL_MUX_EN; -writel (voltage_swing_cfg, qphy->tx + drv_lvl_reg); -writel (pre_emphasis_cfg, qphy->tx + emp_post_reg); -writel (voltage_swing_cfg, qphy->tx2 + drv_lvl_reg); -writel (pre_emphasis_cfg, qphy->tx2 + emp_post_reg); +writel (voltage_swing_cfg, qphy->dp_tx + drv_lvl_reg); +writel (pre_emphasis_cfg, qphy->dp_tx + emp_post_reg); +writel (voltage_swing_cfg, qphy->dp_tx2 + drv_lvl_reg); +writel (pre_emphasis_cfg, qphy->dp_tx2 + emp_post_reg);return 0 ; }
@@ -1446,10 +1452,10 @@ static void qcom_qmp_v3_phy_configure_dp_tx(struct qmp_phy *qphy) drvr_en =0x10 ; } -writel (drvr_en, qphy->tx +QSERDES_V3_TX_HIGHZ_DRVR_EN ); -writel (bias_en, qphy->tx +QSERDES_V3_TX_TRANSCEIVER_BIAS_EN ); -writel (drvr_en, qphy->tx2 +QSERDES_V3_TX_HIGHZ_DRVR_EN ); -writel (bias_en, qphy->tx2 +QSERDES_V3_TX_TRANSCEIVER_BIAS_EN ); +writel (drvr_en, qphy->dp_tx +QSERDES_V3_TX_HIGHZ_DRVR_EN ); +writel (bias_en, qphy->dp_tx +QSERDES_V3_TX_TRANSCEIVER_BIAS_EN ); +writel (drvr_en, qphy->dp_tx2 +QSERDES_V3_TX_HIGHZ_DRVR_EN ); +writel (bias_en, qphy->dp_tx2 +QSERDES_V3_TX_TRANSCEIVER_BIAS_EN ); }static bool qmp_combo_configure_dp_mode (struct qmp_phy *qphy)
@@ -1472,12 +1478,12 @@ static bool qmp_combo_configure_dp_mode(struct qmp_phy *qphy)* if (lane_cnt == 4 || orientation == ORIENTATION_CC1) * val |= DP_PHY_PD_CTL_LANE_2_3_PWRDN; * if (orientation == ORIENTATION_CC2) -* writel(0x4c, qphy->pcs + QSERDES_V3_DP_PHY_MODE); +* writel(0x4c, qphy->dp_pcs + QSERDES_V3_DP_PHY_MODE); */ val |=DP_PHY_PD_CTL_LANE_2_3_PWRDN ; -writel (val, qphy->pcs +QSERDES_DP_PHY_PD_CTL ); +writel (val, qphy->dp_pcs +QSERDES_DP_PHY_PD_CTL ); -writel (0x5c , qphy->pcs +QSERDES_DP_PHY_MODE ); +writel (0x5c , qphy->dp_pcs +QSERDES_DP_PHY_MODE );return reverse; }
@@ -1491,8 +1497,8 @@ static int qcom_qmp_v3_phy_configure_dp_phy(struct qmp_phy *qphy)qmp_combo_configure_dp_mode (qphy); -writel (0x05 , qphy->pcs +QSERDES_V3_DP_PHY_TX0_TX1_LANE_CTL ); -writel (0x05 , qphy->pcs +QSERDES_V3_DP_PHY_TX2_TX3_LANE_CTL ); +writel (0x05 , qphy->dp_pcs +QSERDES_V3_DP_PHY_TX0_TX1_LANE_CTL ); +writel (0x05 , qphy->dp_pcs +QSERDES_V3_DP_PHY_TX2_TX3_LANE_CTL );switch (dp_opts->link_rate) {case 1620 :
@@ -1515,40 +1521,40 @@ static int qcom_qmp_v3_phy_configure_dp_phy(struct qmp_phy *qphy)/* Other link rates aren't supported */ return -EINVAL ; } -writel (phy_vco_div, qphy->pcs +QSERDES_V3_DP_PHY_VCO_DIV ); +writel (phy_vco_div, qphy->dp_pcs +QSERDES_V3_DP_PHY_VCO_DIV );clk_set_rate (dp_clks->dp_link_hw.clk, dp_opts->link_rate *100000 );clk_set_rate (dp_clks->dp_pixel_hw.clk, pixel_freq); -writel (0x04 , qphy->pcs +QSERDES_DP_PHY_AUX_CFG2 ); -writel (0x01 , qphy->pcs +QSERDES_DP_PHY_CFG ); -writel (0x05 , qphy->pcs +QSERDES_DP_PHY_CFG ); -writel (0x01 , qphy->pcs +QSERDES_DP_PHY_CFG ); -writel (0x09 , qphy->pcs +QSERDES_DP_PHY_CFG ); +writel (0x04 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG2 ); +writel (0x01 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x05 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x01 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x09 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); -writel (0x20 , qphy->serdes +QSERDES_V3_COM_RESETSM_CNTRL ); +writel (0x20 , qphy->dp_serdes +QSERDES_V3_COM_RESETSM_CNTRL ); -if (readl_poll_timeout (qphy->serdes +QSERDES_V3_COM_C_READY_STATUS , +if (readl_poll_timeout (qphy->dp_serdes +QSERDES_V3_COM_C_READY_STATUS , status, ((status &BIT (0 )) >0 ),500 ,10000 ))return -ETIMEDOUT ; -writel (0x19 , qphy->pcs +QSERDES_DP_PHY_CFG ); +writel (0x19 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); -if (readl_poll_timeout (qphy->pcs +QSERDES_V3_DP_PHY_STATUS , +if (readl_poll_timeout (qphy->dp_pcs +QSERDES_V3_DP_PHY_STATUS , status, ((status &BIT (1 )) >0 ),500 ,10000 ))return -ETIMEDOUT ; -writel (0x18 , qphy->pcs +QSERDES_DP_PHY_CFG ); +writel (0x18 , qphy->dp_pcs +QSERDES_DP_PHY_CFG );udelay (2000 ); -writel (0x19 , qphy->pcs +QSERDES_DP_PHY_CFG ); +writel (0x19 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); - return readl_poll_timeout(qphy->pcs + QSERDES_V3_DP_PHY_STATUS, + return readl_poll_timeout(qphy->dp_pcs + QSERDES_V3_DP_PHY_STATUS, status, ((status & BIT(1)) > 0), 500,
@@ -1568,7 +1574,7 @@ static int qcom_qmp_v3_dp_phy_calibrate(struct qmp_phy *qphy) qphy->dp_aux_cfg %=ARRAY_SIZE (cfg1_settings); val = cfg1_settings[qphy->dp_aux_cfg]; -writel (val, qphy->pcs +QSERDES_DP_PHY_AUX_CFG1 ); +writel (val, qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG1 );return 0 ; }
@@ -1577,37 +1583,37 @@ static void qcom_qmp_v4_phy_dp_aux_init(struct qmp_phy *qphy) {writel (DP_PHY_PD_CTL_PWRDN |DP_PHY_PD_CTL_PSR_PWRDN |DP_PHY_PD_CTL_AUX_PWRDN |DP_PHY_PD_CTL_PLL_PWRDN |DP_PHY_PD_CTL_DP_CLAMP_EN , - qphy->pcs +QSERDES_DP_PHY_PD_CTL ); + qphy->dp_pcs +QSERDES_DP_PHY_PD_CTL );/* Turn on BIAS current for PHY/PLL */ -writel (0x17 , qphy->serdes +QSERDES_V4_COM_BIAS_EN_CLKBUFLR_EN ); - -writel (0x00 , qphy->pcs +QSERDES_DP_PHY_AUX_CFG0 ); -writel (0x13 , qphy->pcs +QSERDES_DP_PHY_AUX_CFG1 ); -writel (0xa4 , qphy->pcs +QSERDES_DP_PHY_AUX_CFG2 ); -writel (0x00 , qphy->pcs +QSERDES_DP_PHY_AUX_CFG3 ); -writel (0x0a , qphy->pcs +QSERDES_DP_PHY_AUX_CFG4 ); -writel (0x26 , qphy->pcs +QSERDES_DP_PHY_AUX_CFG5 ); -writel (0x0a , qphy->pcs +QSERDES_DP_PHY_AUX_CFG6 ); -writel (0x03 , qphy->pcs +QSERDES_DP_PHY_AUX_CFG7 ); -writel (0xb7 , qphy->pcs +QSERDES_DP_PHY_AUX_CFG8 ); -writel (0x03 , qphy->pcs +QSERDES_DP_PHY_AUX_CFG9 ); +writel (0x17 , qphy->dp_serdes +QSERDES_V4_COM_BIAS_EN_CLKBUFLR_EN ); + +writel (0x00 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG0 ); +writel (0x13 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG1 ); +writel (0xa4 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG2 ); +writel (0x00 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG3 ); +writel (0x0a , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG4 ); +writel (0x26 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG5 ); +writel (0x0a , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG6 ); +writel (0x03 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG7 ); +writel (0xb7 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG8 ); +writel (0x03 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG9 ); qphy->dp_aux_cfg =0 ;writel (PHY_AUX_STOP_ERR_MASK |PHY_AUX_DEC_ERR_MASK |PHY_AUX_SYNC_ERR_MASK |PHY_AUX_ALIGN_ERR_MASK |PHY_AUX_REQ_ERR_MASK , - qphy->pcs +QSERDES_V4_DP_PHY_AUX_INTERRUPT_MASK ); + qphy->dp_pcs +QSERDES_V4_DP_PHY_AUX_INTERRUPT_MASK ); }static void qcom_qmp_v4_phy_configure_dp_tx (struct qmp_phy *qphy) {/* Program default values before writing proper values */ -writel (0x27 , qphy->tx +QSERDES_V4_TX_TX_DRV_LVL ); -writel (0x27 , qphy->tx2 +QSERDES_V4_TX_TX_DRV_LVL ); +writel (0x27 , qphy->dp_tx +QSERDES_V4_TX_TX_DRV_LVL ); +writel (0x27 , qphy->dp_tx2 +QSERDES_V4_TX_TX_DRV_LVL ); -writel (0x20 , qphy->tx +QSERDES_V4_TX_TX_EMP_POST1_LVL ); -writel (0x20 , qphy->tx2 +QSERDES_V4_TX_TX_EMP_POST1_LVL ); +writel (0x20 , qphy->dp_tx +QSERDES_V4_TX_TX_EMP_POST1_LVL ); +writel (0x20 , qphy->dp_tx2 +QSERDES_V4_TX_TX_EMP_POST1_LVL );qmp_combo_configure_dp_swing (qphy,QSERDES_V4_TX_TX_DRV_LVL ,QSERDES_V4_TX_TX_EMP_POST1_LVL );
@@ -1620,15 +1626,15 @@ static int qcom_qmp_v45_phy_configure_dp_phy(struct qmp_phy *qphy)u32 phy_vco_div, status;unsigned long pixel_freq; -writel (0x0f , qphy->pcs +QSERDES_V4_DP_PHY_CFG_1 ); +writel (0x0f , qphy->dp_pcs +QSERDES_V4_DP_PHY_CFG_1 );qmp_combo_configure_dp_mode (qphy); -writel (0x13 , qphy->pcs +QSERDES_DP_PHY_AUX_CFG1 ); -writel (0xa4 , qphy->pcs +QSERDES_DP_PHY_AUX_CFG2 ); +writel (0x13 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG1 ); +writel (0xa4 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG2 ); -writel (0x05 , qphy->pcs +QSERDES_V4_DP_PHY_TX0_TX1_LANE_CTL ); -writel (0x05 , qphy->pcs +QSERDES_V4_DP_PHY_TX2_TX3_LANE_CTL ); +writel (0x05 , qphy->dp_pcs +QSERDES_V4_DP_PHY_TX0_TX1_LANE_CTL ); +writel (0x05 , qphy->dp_pcs +QSERDES_V4_DP_PHY_TX2_TX3_LANE_CTL );switch (dp_opts->link_rate) {case 1620 :
@@ -1651,49 +1657,49 @@ static int qcom_qmp_v45_phy_configure_dp_phy(struct qmp_phy *qphy)/* Other link rates aren't supported */ return -EINVAL ; } -writel (phy_vco_div, qphy->pcs +QSERDES_V4_DP_PHY_VCO_DIV ); +writel (phy_vco_div, qphy->dp_pcs +QSERDES_V4_DP_PHY_VCO_DIV );clk_set_rate (dp_clks->dp_link_hw.clk, dp_opts->link_rate *100000 );clk_set_rate (dp_clks->dp_pixel_hw.clk, pixel_freq); -writel (0x01 , qphy->pcs +QSERDES_DP_PHY_CFG ); -writel (0x05 , qphy->pcs +QSERDES_DP_PHY_CFG ); -writel (0x01 , qphy->pcs +QSERDES_DP_PHY_CFG ); -writel (0x09 , qphy->pcs +QSERDES_DP_PHY_CFG ); +writel (0x01 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x05 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x01 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x09 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); -writel (0x20 , qphy->serdes +QSERDES_V4_COM_RESETSM_CNTRL ); +writel (0x20 , qphy->dp_serdes +QSERDES_V4_COM_RESETSM_CNTRL ); -if (readl_poll_timeout (qphy->serdes +QSERDES_V4_COM_C_READY_STATUS , +if (readl_poll_timeout (qphy->dp_serdes +QSERDES_V4_COM_C_READY_STATUS , status, ((status &BIT (0 )) >0 ),500 ,10000 ))return -ETIMEDOUT ; -if (readl_poll_timeout (qphy->serdes +QSERDES_V4_COM_CMN_STATUS , +if (readl_poll_timeout (qphy->dp_serdes +QSERDES_V4_COM_CMN_STATUS , status, ((status &BIT (0 )) >0 ),500 ,10000 ))return -ETIMEDOUT ; -if (readl_poll_timeout (qphy->serdes +QSERDES_V4_COM_CMN_STATUS , +if (readl_poll_timeout (qphy->dp_serdes +QSERDES_V4_COM_CMN_STATUS , status, ((status &BIT (1 )) >0 ),500 ,10000 ))return -ETIMEDOUT ; -writel (0x19 , qphy->pcs +QSERDES_DP_PHY_CFG ); +writel (0x19 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); -if (readl_poll_timeout (qphy->pcs +QSERDES_V4_DP_PHY_STATUS , +if (readl_poll_timeout (qphy->dp_pcs +QSERDES_V4_DP_PHY_STATUS , status, ((status &BIT (0 )) >0 ),500 ,10000 ))return -ETIMEDOUT ; - if (readl_poll_timeout(qphy->pcs + QSERDES_V4_DP_PHY_STATUS, + if (readl_poll_timeout(qphy->dp_pcs + QSERDES_V4_DP_PHY_STATUS, status, ((status & BIT(1)) > 0), 500,
@@ -1737,30 +1743,30 @@ static int qcom_qmp_v4_phy_configure_dp_phy(struct qmp_phy *qphy) drvr1_en =0x10 ; } -writel (drvr0_en, qphy->tx +QSERDES_V4_TX_HIGHZ_DRVR_EN ); -writel (bias0_en, qphy->tx +QSERDES_V4_TX_TRANSCEIVER_BIAS_EN ); -writel (drvr1_en, qphy->tx2 +QSERDES_V4_TX_HIGHZ_DRVR_EN ); -writel (bias1_en, qphy->tx2 +QSERDES_V4_TX_TRANSCEIVER_BIAS_EN ); +writel (drvr0_en, qphy->dp_tx +QSERDES_V4_TX_HIGHZ_DRVR_EN ); +writel (bias0_en, qphy->dp_tx +QSERDES_V4_TX_TRANSCEIVER_BIAS_EN ); +writel (drvr1_en, qphy->dp_tx2 +QSERDES_V4_TX_HIGHZ_DRVR_EN ); +writel (bias1_en, qphy->dp_tx2 +QSERDES_V4_TX_TRANSCEIVER_BIAS_EN ); -writel (0x18 , qphy->pcs +QSERDES_DP_PHY_CFG ); +writel (0x18 , qphy->dp_pcs +QSERDES_DP_PHY_CFG );udelay (2000 ); -writel (0x19 , qphy->pcs +QSERDES_DP_PHY_CFG ); +writel (0x19 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); -if (readl_poll_timeout (qphy->pcs +QSERDES_V4_DP_PHY_STATUS , +if (readl_poll_timeout (qphy->dp_pcs +QSERDES_V4_DP_PHY_STATUS , status, ((status &BIT (1 )) >0 ),500 ,10000 ))return -ETIMEDOUT ; -writel (0x0a , qphy->tx +QSERDES_V4_TX_TX_POL_INV ); -writel (0x0a , qphy->tx2 +QSERDES_V4_TX_TX_POL_INV ); +writel (0x0a , qphy->dp_tx +QSERDES_V4_TX_TX_POL_INV ); +writel (0x0a , qphy->dp_tx2 +QSERDES_V4_TX_TX_POL_INV ); -writel (0x27 , qphy->tx +QSERDES_V4_TX_TX_DRV_LVL ); -writel (0x27 , qphy->tx2 +QSERDES_V4_TX_TX_DRV_LVL ); +writel (0x27 , qphy->dp_tx +QSERDES_V4_TX_TX_DRV_LVL ); +writel (0x27 , qphy->dp_tx2 +QSERDES_V4_TX_TX_DRV_LVL ); -writel (0x20 , qphy->tx +QSERDES_V4_TX_TX_EMP_POST1_LVL ); -writel (0x20 , qphy->tx2 +QSERDES_V4_TX_TX_EMP_POST1_LVL ); +writel (0x20 , qphy->dp_tx +QSERDES_V4_TX_TX_EMP_POST1_LVL ); +writel (0x20 , qphy->dp_tx2 +QSERDES_V4_TX_TX_EMP_POST1_LVL );return 0 ; }
@@ -1794,30 +1800,30 @@ static int qcom_qmp_v5_phy_configure_dp_phy(struct qmp_phy *qphy) drvr1_en =0x10 ; } -writel (drvr0_en, qphy->tx +QSERDES_V5_5NM_TX_HIGHZ_DRVR_EN ); -writel (bias0_en, qphy->tx +QSERDES_V5_5NM_TX_TRANSCEIVER_BIAS_EN ); -writel (drvr1_en, qphy->tx2 +QSERDES_V5_5NM_TX_HIGHZ_DRVR_EN ); -writel (bias1_en, qphy->tx2 +QSERDES_V5_5NM_TX_TRANSCEIVER_BIAS_EN ); +writel (drvr0_en, qphy->dp_tx +QSERDES_V5_5NM_TX_HIGHZ_DRVR_EN ); +writel (bias0_en, qphy->dp_tx +QSERDES_V5_5NM_TX_TRANSCEIVER_BIAS_EN ); +writel (drvr1_en, qphy->dp_tx2 +QSERDES_V5_5NM_TX_HIGHZ_DRVR_EN ); +writel (bias1_en, qphy->dp_tx2 +QSERDES_V5_5NM_TX_TRANSCEIVER_BIAS_EN ); -writel (0x18 , qphy->pcs +QSERDES_DP_PHY_CFG ); +writel (0x18 , qphy->dp_pcs +QSERDES_DP_PHY_CFG );udelay (2000 ); -writel (0x19 , qphy->pcs +QSERDES_DP_PHY_CFG ); +writel (0x19 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); -if (readl_poll_timeout (qphy->pcs +QSERDES_V4_DP_PHY_STATUS , +if (readl_poll_timeout (qphy->dp_pcs +QSERDES_V4_DP_PHY_STATUS , status, ((status &BIT (1 )) >0 ),500 ,10000 ))return -ETIMEDOUT ; -writel (0x0a , qphy->tx +QSERDES_V5_5NM_TX_TX_POL_INV ); -writel (0x0a , qphy->tx2 +QSERDES_V5_5NM_TX_TX_POL_INV ); +writel (0x0a , qphy->dp_tx +QSERDES_V5_5NM_TX_TX_POL_INV ); +writel (0x0a , qphy->dp_tx2 +QSERDES_V5_5NM_TX_TX_POL_INV ); -writel (0x27 , qphy->tx +QSERDES_V5_5NM_TX_TX_DRV_LVL ); -writel (0x27 , qphy->tx2 +QSERDES_V5_5NM_TX_TX_DRV_LVL ); +writel (0x27 , qphy->dp_tx +QSERDES_V5_5NM_TX_TX_DRV_LVL ); +writel (0x27 , qphy->dp_tx2 +QSERDES_V5_5NM_TX_TX_DRV_LVL ); -writel (0x20 , qphy->tx +QSERDES_V5_5NM_TX_TX_EMP_POST1_LVL ); -writel (0x20 , qphy->tx2 +QSERDES_V5_5NM_TX_TX_EMP_POST1_LVL ); +writel (0x20 , qphy->dp_tx +QSERDES_V5_5NM_TX_TX_EMP_POST1_LVL ); +writel (0x20 , qphy->dp_tx2 +QSERDES_V5_5NM_TX_TX_EMP_POST1_LVL );return 0 ; }
@@ -1835,7 +1841,7 @@ static int qcom_qmp_v4_dp_phy_calibrate(struct qmp_phy *qphy) qphy->dp_aux_cfg %=ARRAY_SIZE (cfg1_settings); val = cfg1_settings[qphy->dp_aux_cfg]; -writel (val, qphy->pcs +QSERDES_DP_PHY_AUX_CFG1 ); +writel (val, qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG1 );return 0 ; }
@@ -1990,14 +1996,14 @@ static int qmp_combo_dp_power_on(struct phy *phy) {struct qmp_phy *qphy =phy_get_drvdata (phy);const struct qmp_phy_cfg *cfg = qphy->cfg; -void __iomem *tx = qphy->tx; +void __iomem *tx = qphy->dp_tx;qmp_combo_dp_serdes_init (qphy);qmp_combo_configure_lane (tx, cfg->tx_tbl, cfg->tx_tbl_num,1 );if (cfg->lanes >=2 ) -qmp_combo_configure_lane (qphy->tx2, cfg->tx_tbl, cfg->tx_tbl_num,2 ); +qmp_combo_configure_lane (qphy->dp_tx2, cfg->tx_tbl, cfg->tx_tbl_num,2 );/* Configure special DP tx tunings */ cfg->configure_dp_tx (qphy);
@@ -2013,7 +2019,7 @@ static int qmp_combo_dp_power_off(struct phy *phy)struct qmp_phy *qphy =phy_get_drvdata (phy);/* Assert DP PHY power down */ -writel (DP_PHY_PD_CTL_PSR_PWRDN , qphy->pcs +QSERDES_DP_PHY_PD_CTL ); +writel (DP_PHY_PD_CTL_PSR_PWRDN , qphy->dp_pcs +QSERDES_DP_PHY_PD_CTL );return 0 ; }
@@ -2589,7 +2595,7 @@ static int qmp_combo_create_dp(struct device *dev, struct device_node *np, int ireturn -ENOMEM ; qphy->cfg = cfg; - qphy->serdes = serdes; + qphy->dp_serdes = serdes;/* * Get memory resources from the DP child node: * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2.
@@ -2597,18 +2603,18 @@ static int qmp_combo_create_dp(struct device *dev, struct device_node *np, int i* * Note that only tx/tx2 and pcs are used by the DP implementation. */ - qphy->tx =devm_of_iomap (dev, np,0 ,NULL ); -if (IS_ERR (qphy->tx)) -return PTR_ERR (qphy->tx); + qphy->dp_tx =devm_of_iomap (dev, np,0 ,NULL ); +if (IS_ERR (qphy->dp_tx)) +return PTR_ERR (qphy->dp_tx); - qphy->pcs =devm_of_iomap (dev, np,2 ,NULL ); -if (IS_ERR (qphy->pcs)) -return PTR_ERR (qphy->pcs); + qphy->dp_pcs =devm_of_iomap (dev, np,2 ,NULL ); +if (IS_ERR (qphy->dp_pcs)) +return PTR_ERR (qphy->dp_pcs);if (cfg->lanes >=2 ) { - qphy->tx2 =devm_of_iomap (dev, np,3 ,NULL ); -if (IS_ERR (qphy->tx2)) -return PTR_ERR (qphy->tx2); + qphy->dp_tx2 =devm_of_iomap (dev, np,3 ,NULL ); +if (IS_ERR (qphy->dp_tx2)) +return PTR_ERR (qphy->dp_tx2); } generic_phy =devm_phy_create (dev, np, &qmp_combo_dp_phy_ops);
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v2 14/22 phy: qcom-qmp-combo: clean up DP configurations
In reply to Johan HovoldIn preparation for merging the USB and DP configurations, align the initialisations of the DP function pointers.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 40 +++++++++++------------ 1 file changed, 20 insertions(+), 20 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +20 -20
@@ -1049,10 +1049,10 @@ static const struct qmp_phy_cfg sc7180_dpphy_cfg = { .swing_hbr3_hbr2 = &qmp_dp_v3_voltage_swing_hbr3_hbr2, .pre_emphasis_hbr3_hbr2 = &qmp_dp_v3_pre_emphasis_hbr3_hbr2, - .dp_aux_init = qcom_qmp_v3_phy_dp_aux_init, - .configure_dp_tx = qcom_qmp_v3_phy_configure_dp_tx, - .configure_dp_phy = qcom_qmp_v3_phy_configure_dp_phy, - .calibrate_dp_phy = qcom_qmp_v3_dp_phy_calibrate, + .dp_aux_init = qcom_qmp_v3_phy_dp_aux_init, + .configure_dp_tx = qcom_qmp_v3_phy_configure_dp_tx, + .configure_dp_phy = qcom_qmp_v3_phy_configure_dp_phy, + .calibrate_dp_phy = qcom_qmp_v3_dp_phy_calibrate, };static const struct qmp_phy_combo_cfg sc7180_usb3dpphy_cfg = {
@@ -1106,10 +1106,10 @@ static const struct qmp_phy_cfg sdm845_dpphy_cfg = { .swing_hbr3_hbr2 = &qmp_dp_v3_voltage_swing_hbr3_hbr2, .pre_emphasis_hbr3_hbr2 = &qmp_dp_v3_pre_emphasis_hbr3_hbr2, - .dp_aux_init = qcom_qmp_v3_phy_dp_aux_init, - .configure_dp_tx = qcom_qmp_v3_phy_configure_dp_tx, - .configure_dp_phy = qcom_qmp_v3_phy_configure_dp_phy, - .calibrate_dp_phy = qcom_qmp_v3_dp_phy_calibrate, + .dp_aux_init = qcom_qmp_v3_phy_dp_aux_init, + .configure_dp_tx = qcom_qmp_v3_phy_configure_dp_tx, + .configure_dp_phy = qcom_qmp_v3_phy_configure_dp_phy, + .calibrate_dp_phy = qcom_qmp_v3_dp_phy_calibrate, };static const struct qmp_phy_combo_cfg sdm845_usb3dpphy_cfg = {
@@ -1166,10 +1166,10 @@ static const struct qmp_phy_cfg sc8180x_dpphy_cfg = { .swing_hbr3_hbr2 = &qmp_dp_v3_voltage_swing_hbr3_hbr2, .pre_emphasis_hbr3_hbr2 = &qmp_dp_v3_pre_emphasis_hbr3_hbr2, - .dp_aux_init = qcom_qmp_v4_phy_dp_aux_init, - .configure_dp_tx = qcom_qmp_v4_phy_configure_dp_tx, - .configure_dp_phy = qcom_qmp_v4_phy_configure_dp_phy, - .calibrate_dp_phy = qcom_qmp_v4_dp_phy_calibrate, + .dp_aux_init = qcom_qmp_v4_phy_dp_aux_init, + .configure_dp_tx = qcom_qmp_v4_phy_configure_dp_tx, + .configure_dp_phy = qcom_qmp_v4_phy_configure_dp_phy, + .calibrate_dp_phy = qcom_qmp_v4_dp_phy_calibrate, };static const struct qmp_phy_combo_cfg sc8180x_usb3dpphy_cfg = {
@@ -1222,10 +1222,10 @@ static const struct qmp_phy_cfg sc8280xp_usb43dp_dp_cfg = { .swing_hbr3_hbr2 = &qmp_dp_v5_voltage_swing_hbr3_hbr2, .pre_emphasis_hbr3_hbr2 = &qmp_dp_v5_pre_emphasis_hbr3_hbr2, - .dp_aux_init = qcom_qmp_v4_phy_dp_aux_init, - .configure_dp_tx = qcom_qmp_v4_phy_configure_dp_tx, - .configure_dp_phy = qcom_qmp_v5_phy_configure_dp_phy, - .calibrate_dp_phy = qcom_qmp_v4_dp_phy_calibrate, + .dp_aux_init = qcom_qmp_v4_phy_dp_aux_init, + .configure_dp_tx = qcom_qmp_v4_phy_configure_dp_tx, + .configure_dp_phy = qcom_qmp_v5_phy_configure_dp_phy, + .calibrate_dp_phy = qcom_qmp_v4_dp_phy_calibrate, };static const struct qmp_phy_combo_cfg sc8280xp_usb43dpphy_combo_cfg = {
@@ -1282,10 +1282,10 @@ static const struct qmp_phy_cfg sm8250_dpphy_cfg = { .swing_hbr3_hbr2 = &qmp_dp_v3_voltage_swing_hbr3_hbr2, .pre_emphasis_hbr3_hbr2 = &qmp_dp_v3_pre_emphasis_hbr3_hbr2, - .dp_aux_init = qcom_qmp_v4_phy_dp_aux_init, - .configure_dp_tx = qcom_qmp_v4_phy_configure_dp_tx, - .configure_dp_phy = qcom_qmp_v4_phy_configure_dp_phy, - .calibrate_dp_phy = qcom_qmp_v4_dp_phy_calibrate, + .dp_aux_init = qcom_qmp_v4_phy_dp_aux_init, + .configure_dp_tx = qcom_qmp_v4_phy_configure_dp_tx, + .configure_dp_phy = qcom_qmp_v4_phy_configure_dp_phy, + .calibrate_dp_phy = qcom_qmp_v4_dp_phy_calibrate, };static const struct qmp_phy_combo_cfg sm8250_usb3dpphy_cfg = {
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v2 15/22 phy: qcom-qmp-combo: rename sc8280xp config
In reply to Johan HovoldIn preparation for merging the USB and DP configurations, drop the "combo" infix from the SC8280XP combined configuration for consistency with the other platforms.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +2 -2
@@ -1228,7 +1228,7 @@ static const struct qmp_phy_cfg sc8280xp_usb43dp_dp_cfg = { .calibrate_dp_phy = qcom_qmp_v4_dp_phy_calibrate, }; -static const struct qmp_phy_combo_cfg sc8280xp_usb43dpphy_combo_cfg = { +static const struct qmp_phy_combo_cfg sc8280xp_usb43dpphy_cfg = { .usb_cfg = &sc8280xp_usb43dp_usb_cfg, .dp_cfg = &sc8280xp_usb43dp_dp_cfg, };
@@ -2857,7 +2857,7 @@ static const struct of_device_id qmp_combo_of_match_table[] = { }, { .compatible = "qcom,sc8280xp-qmp-usb43dp-phy", - .data = &sc8280xp_usb43dpphy_combo_cfg, + .data = &sc8280xp_usb43dpphy_cfg, }, { .compatible = "qcom,sdm845-qmp-usb3-dp-phy",
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v2 16/22 phy: qcom-qmp-combo: add DP configuration tables
In reply to Johan HovoldIn preparation for merging the USB and DP configurations, add dedicated pointers for the DP serdes and tx tables to the configurations.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 45 ++++++++++++----------- 1 file changed, 24 insertions(+), 21 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +24 -21
@@ -816,6 +816,11 @@ struct qmp_phy_cfg {const struct qmp_phy_init_tbl *pcs_usb_tbl;int pcs_usb_tbl_num; +const struct qmp_phy_init_tbl *dp_serdes_tbl; +int dp_serdes_tbl_num; +const struct qmp_phy_init_tbl *dp_tx_tbl; +int dp_tx_tbl_num; +/* Init sequence for DP PHY block link rates */ const struct qmp_phy_init_tbl *serdes_tbl_rbr;int serdes_tbl_rbr_num;
@@ -1030,10 +1035,10 @@ static const struct qmp_phy_cfg sc7180_dpphy_cfg = { .type = PHY_TYPE_DP, .lanes = 2, - .serdes_tbl = qmp_v3_dp_serdes_tbl, - .serdes_tbl_num = ARRAY_SIZE(qmp_v3_dp_serdes_tbl), - .tx_tbl = qmp_v3_dp_tx_tbl, - .tx_tbl_num = ARRAY_SIZE(qmp_v3_dp_tx_tbl), + .dp_serdes_tbl = qmp_v3_dp_serdes_tbl, + .dp_serdes_tbl_num = ARRAY_SIZE(qmp_v3_dp_serdes_tbl), + .dp_tx_tbl = qmp_v3_dp_tx_tbl, + .dp_tx_tbl_num = ARRAY_SIZE(qmp_v3_dp_tx_tbl), .serdes_tbl_rbr = qmp_v3_dp_serdes_tbl_rbr, .serdes_tbl_rbr_num = ARRAY_SIZE(qmp_v3_dp_serdes_tbl_rbr),
@@ -1147,10 +1152,10 @@ static const struct qmp_phy_cfg sc8180x_dpphy_cfg = { .type = PHY_TYPE_DP, .lanes = 2, - .serdes_tbl = qmp_v4_dp_serdes_tbl, - .serdes_tbl_num = ARRAY_SIZE(qmp_v4_dp_serdes_tbl), - .tx_tbl = qmp_v4_dp_tx_tbl, - .tx_tbl_num = ARRAY_SIZE(qmp_v4_dp_tx_tbl), + .dp_serdes_tbl = qmp_v4_dp_serdes_tbl, + .dp_serdes_tbl_num = ARRAY_SIZE(qmp_v4_dp_serdes_tbl), + .dp_tx_tbl = qmp_v4_dp_tx_tbl, + .dp_tx_tbl_num = ARRAY_SIZE(qmp_v4_dp_tx_tbl), .serdes_tbl_rbr = qmp_v4_dp_serdes_tbl_rbr, .serdes_tbl_rbr_num = ARRAY_SIZE(qmp_v4_dp_serdes_tbl_rbr),
@@ -1203,10 +1208,10 @@ static const struct qmp_phy_cfg sc8280xp_usb43dp_dp_cfg = { .type = PHY_TYPE_DP, .lanes = 2, - .serdes_tbl = qmp_v5_dp_serdes_tbl, - .serdes_tbl_num = ARRAY_SIZE(qmp_v5_dp_serdes_tbl), - .tx_tbl = qmp_v5_5nm_dp_tx_tbl, - .tx_tbl_num = ARRAY_SIZE(qmp_v5_5nm_dp_tx_tbl), + .dp_serdes_tbl = qmp_v5_dp_serdes_tbl, + .dp_serdes_tbl_num = ARRAY_SIZE(qmp_v5_dp_serdes_tbl), + .dp_tx_tbl = qmp_v5_5nm_dp_tx_tbl, + .dp_tx_tbl_num = ARRAY_SIZE(qmp_v5_5nm_dp_tx_tbl), .serdes_tbl_rbr = qmp_v4_dp_serdes_tbl_rbr, .serdes_tbl_rbr_num = ARRAY_SIZE(qmp_v4_dp_serdes_tbl_rbr),
@@ -1263,10 +1268,10 @@ static const struct qmp_phy_cfg sm8250_dpphy_cfg = { .type = PHY_TYPE_DP, .lanes = 2, - .serdes_tbl = qmp_v4_dp_serdes_tbl, - .serdes_tbl_num = ARRAY_SIZE(qmp_v4_dp_serdes_tbl), - .tx_tbl = qmp_v4_dp_tx_tbl, - .tx_tbl_num = ARRAY_SIZE(qmp_v4_dp_tx_tbl), + .dp_serdes_tbl = qmp_v4_dp_serdes_tbl, + .dp_serdes_tbl_num = ARRAY_SIZE(qmp_v4_dp_serdes_tbl), + .dp_tx_tbl = qmp_v4_dp_tx_tbl, + .dp_tx_tbl_num = ARRAY_SIZE(qmp_v4_dp_tx_tbl), .serdes_tbl_rbr = qmp_v4_dp_serdes_tbl_rbr, .serdes_tbl_rbr_num = ARRAY_SIZE(qmp_v4_dp_serdes_tbl_rbr),
@@ -1324,10 +1329,8 @@ static int qmp_combo_dp_serdes_init(struct qmp_phy *qphy)const struct qmp_phy_cfg *cfg = qphy->cfg;void __iomem *serdes = qphy->dp_serdes;const struct phy_configure_opts_dp *dp_opts = &qphy->dp_opts; -const struct qmp_phy_init_tbl *serdes_tbl = cfg->serdes_tbl; -int serdes_tbl_num = cfg->serdes_tbl_num; -qmp_combo_configure (serdes, serdes_tbl, serdes_tbl_num); +qmp_combo_configure (serdes, cfg->dp_serdes_tbl, cfg->dp_serdes_tbl_num);switch (dp_opts->link_rate) {case 1620 :
@@ -2000,10 +2003,10 @@ static int qmp_combo_dp_power_on(struct phy *phy)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->dp_tx_tbl, cfg->dp_tx_tbl_num,1 );if (cfg->lanes >=2 ) -qmp_combo_configure_lane (qphy->dp_tx2, cfg->tx_tbl, cfg->tx_tbl_num,2 ); +qmp_combo_configure_lane (qphy->dp_tx2, cfg->dp_tx_tbl, cfg->dp_tx_tbl_num,2 );/* Configure special DP tx tunings */ cfg->configure_dp_tx (qphy);
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v2 17/22 phy: qcom-qmp-combo: drop lanes config parameter
In reply to Johan HovoldSince the QMP driver split there is really no need for the 'lanes' configuration parameter as all of these USB-C PHYs support dual-lane SuperSpeed USB and quad-lane (uni-directional) DP (even if the driver still only supports CC1 orientation using lanes 2 and 3).
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 62 ++++++++--------------- 1 file changed, 20 insertions(+), 42 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +20 -42
@@ -802,7 +802,6 @@ struct qmp_phy;struct qmp_phy_cfg {/* phy-type - PCIE/UFS/USB */ unsigned int type; -int lanes;/* Init sequence for PHY blocks - serdes, tx, rx, pcs */ const struct qmp_phy_init_tbl *serdes_tbl;
@@ -1010,7 +1009,6 @@ static const char * const sc7180_usb3phy_reset_l[] = {static const struct qmp_phy_cfg sc7180_usb3phy_cfg = { .type =PHY_TYPE_USB3 , - .lanes =2 , .serdes_tbl = qmp_v3_usb3_serdes_tbl, .serdes_tbl_num =ARRAY_SIZE (qmp_v3_usb3_serdes_tbl),
@@ -1033,7 +1031,6 @@ static const struct qmp_phy_cfg sc7180_usb3phy_cfg = {static const struct qmp_phy_cfg sc7180_dpphy_cfg = { .type =PHY_TYPE_DP , - .lanes =2 , .dp_serdes_tbl = qmp_v3_dp_serdes_tbl, .dp_serdes_tbl_num =ARRAY_SIZE (qmp_v3_dp_serdes_tbl),
@@ -1067,7 +1064,6 @@ static const struct qmp_phy_combo_cfg sc7180_usb3dpphy_cfg = {static const struct qmp_phy_cfg sdm845_usb3phy_cfg = { .type =PHY_TYPE_USB3 , - .lanes =2 , .serdes_tbl = qmp_v3_usb3_serdes_tbl, .serdes_tbl_num =ARRAY_SIZE (qmp_v3_usb3_serdes_tbl),
@@ -1090,7 +1086,6 @@ static const struct qmp_phy_cfg sdm845_usb3phy_cfg = {static const struct qmp_phy_cfg sdm845_dpphy_cfg = { .type =PHY_TYPE_DP , - .lanes =2 , .serdes_tbl = qmp_v3_dp_serdes_tbl, .serdes_tbl_num =ARRAY_SIZE (qmp_v3_dp_serdes_tbl),
@@ -1124,7 +1119,6 @@ static const struct qmp_phy_combo_cfg sdm845_usb3dpphy_cfg = {static const struct qmp_phy_cfg sm8150_usb3phy_cfg = { .type =PHY_TYPE_USB3 , - .lanes =2 , .serdes_tbl = sm8150_usb3_serdes_tbl, .serdes_tbl_num =ARRAY_SIZE (sm8150_usb3_serdes_tbl),
@@ -1150,7 +1144,6 @@ static const struct qmp_phy_cfg sm8150_usb3phy_cfg = {static const struct qmp_phy_cfg sc8180x_dpphy_cfg = { .type =PHY_TYPE_DP , - .lanes =2 , .dp_serdes_tbl = qmp_v4_dp_serdes_tbl, .dp_serdes_tbl_num =ARRAY_SIZE (qmp_v4_dp_serdes_tbl),
@@ -1184,7 +1177,6 @@ static const struct qmp_phy_combo_cfg sc8180x_usb3dpphy_cfg = {static const struct qmp_phy_cfg sc8280xp_usb43dp_usb_cfg = { .type =PHY_TYPE_USB3 , - .lanes =2 , .serdes_tbl = sc8280xp_usb43dp_serdes_tbl, .serdes_tbl_num =ARRAY_SIZE (sc8280xp_usb43dp_serdes_tbl),
@@ -1206,7 +1198,6 @@ static const struct qmp_phy_cfg sc8280xp_usb43dp_usb_cfg = {static const struct qmp_phy_cfg sc8280xp_usb43dp_dp_cfg = { .type =PHY_TYPE_DP , - .lanes =2 , .dp_serdes_tbl = qmp_v5_dp_serdes_tbl, .dp_serdes_tbl_num =ARRAY_SIZE (qmp_v5_dp_serdes_tbl),
@@ -1240,7 +1231,6 @@ static const struct qmp_phy_combo_cfg sc8280xp_usb43dpphy_cfg = {static const struct qmp_phy_cfg sm8250_usb3phy_cfg = { .type =PHY_TYPE_USB3 , - .lanes =2 , .serdes_tbl = sm8150_usb3_serdes_tbl, .serdes_tbl_num =ARRAY_SIZE (sm8150_usb3_serdes_tbl),
@@ -1266,7 +1256,6 @@ static const struct qmp_phy_cfg sm8250_usb3phy_cfg = {static const struct qmp_phy_cfg sm8250_dpphy_cfg = { .type =PHY_TYPE_DP , - .lanes =2 , .dp_serdes_tbl = qmp_v4_dp_serdes_tbl, .dp_serdes_tbl_num =ARRAY_SIZE (qmp_v4_dp_serdes_tbl),
@@ -2000,13 +1989,12 @@ static int qmp_combo_dp_power_on(struct phy *phy)struct qmp_phy *qphy =phy_get_drvdata (phy);const struct qmp_phy_cfg *cfg = qphy->cfg;void __iomem *tx = qphy->dp_tx; +void __iomem *tx2 = qphy->dp_tx2;qmp_combo_dp_serdes_init (qphy);qmp_combo_configure_lane (tx, cfg->dp_tx_tbl, cfg->dp_tx_tbl_num,1 ); - -if (cfg->lanes >=2 ) -qmp_combo_configure_lane (qphy->dp_tx2, cfg->dp_tx_tbl, cfg->dp_tx_tbl_num,2 ); +qmp_combo_configure_lane (tx2, cfg->dp_tx_tbl, cfg->dp_tx_tbl_num,2 );/* Configure special DP tx tunings */ cfg->configure_dp_tx (qphy);
@@ -2035,6 +2023,8 @@ static int qmp_combo_usb_power_on(struct phy *phy)void __iomem *serdes = qphy->serdes;void __iomem *tx = qphy->tx;void __iomem *rx = qphy->rx; +void __iomem *tx2 = qphy->tx2; +void __iomem *rx2 = qphy->rx2;void __iomem *pcs = qphy->pcs;void __iomem *status;unsigned int val;
@@ -2050,14 +2040,10 @@ static int qmp_combo_usb_power_on(struct phy *phy)/* Tx, Rx, and PCS configurations */ qmp_combo_configure_lane (tx, cfg->tx_tbl, cfg->tx_tbl_num,1 ); - -if (cfg->lanes >=2 ) -qmp_combo_configure_lane (qphy->tx2, cfg->tx_tbl, cfg->tx_tbl_num,2 ); +qmp_combo_configure_lane (tx2, cfg->tx_tbl, cfg->tx_tbl_num,2 );qmp_combo_configure_lane (rx, cfg->rx_tbl, cfg->rx_tbl_num,1 ); - -if (cfg->lanes >=2 ) -qmp_combo_configure_lane (qphy->rx2, cfg->rx_tbl, cfg->rx_tbl_num,2 ); +qmp_combo_configure_lane (rx2, cfg->rx_tbl, cfg->rx_tbl_num,2 );qmp_combo_configure (pcs, cfg->pcs_tbl, cfg->pcs_tbl_num);
@@ -2601,8 +2587,8 @@ static int qmp_combo_create_dp(struct device *dev, struct device_node *np, int i qphy->dp_serdes = serdes;/* * Get memory resources from the DP child node: -* Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2. -* For dual lane PHYs: tx2 -> 3, rx2 -> 4 +* Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2; +* tx2 -> 3; rx2 -> 4 * * Note that only tx/tx2 and pcs are used by the DP implementation. */
@@ -2614,11 +2600,9 @@ static int qmp_combo_create_dp(struct device *dev, struct device_node *np, int iif (IS_ERR (qphy->dp_pcs))return PTR_ERR (qphy->dp_pcs); -if (cfg->lanes >=2 ) { - qphy->dp_tx2 =devm_of_iomap (dev, np,3 ,NULL ); -if (IS_ERR (qphy->dp_tx2)) -return PTR_ERR (qphy->dp_tx2); - } + qphy->dp_tx2 =devm_of_iomap (dev, np,3 ,NULL ); +if (IS_ERR (qphy->dp_tx2)) +return PTR_ERR (qphy->dp_tx2); generic_phy =devm_phy_create (dev, np, &qmp_combo_dp_phy_ops);if (IS_ERR (generic_phy)) {
@@ -2651,9 +2635,8 @@ static int qmp_combo_create_usb(struct device *dev, struct device_node *np, int qphy->serdes = serdes;/* * Get memory resources from the USB child node: -* Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2. -* For dual lane PHYs: tx2 -> 3, rx2 -> 4, pcs_misc (optional) -> 5 -* For single lane PHYs: pcs_misc (optional) -> 3. +* Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2; +* tx2 -> 3; rx2 -> 4; pcs_misc (optional) -> 5 */ qphy->tx =devm_of_iomap (dev, np,0 ,NULL );if (IS_ERR (qphy->tx))
@@ -2670,20 +2653,15 @@ static int qmp_combo_create_usb(struct device *dev, struct device_node *np, intif (cfg->pcs_usb_offset) qphy->pcs_usb = qphy->pcs + cfg->pcs_usb_offset; -if (cfg->lanes >=2 ) { - qphy->tx2 =devm_of_iomap (dev, np,3 ,NULL ); -if (IS_ERR (qphy->tx2)) -return PTR_ERR (qphy->tx2); + qphy->tx2 =devm_of_iomap (dev, np,3 ,NULL ); +if (IS_ERR (qphy->tx2)) +return PTR_ERR (qphy->tx2); - qphy->rx2 =devm_of_iomap (dev, np,4 ,NULL ); -if (IS_ERR (qphy->rx2)) -return PTR_ERR (qphy->rx2); - - qphy->pcs_misc =devm_of_iomap (dev, np,5 ,NULL ); - }else { - qphy->pcs_misc =devm_of_iomap (dev, np,3 ,NULL ); - } + qphy->rx2 =devm_of_iomap (dev, np,4 ,NULL ); +if (IS_ERR (qphy->rx2)) +return PTR_ERR (qphy->rx2); + qphy->pcs_misc =devm_of_iomap (dev, np,5 ,NULL );if (IS_ERR (qphy->pcs_misc)) {dev_vdbg (dev,"PHY pcs_misc-reg not used\n" ); qphy->pcs_misc =NULL ;
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH v2 17/22] phy: qcom-qmp-combo: drop lanes config parameter
Quoted 6 lines · Johan Hovold
Since the QMP driver split there is really no need for the 'lanes' configuration parameter as all of these USB-C PHYs support dual-lane SuperSpeed USB and quad-lane (uni-directional) DP (even if the driver still only supports CC1 orientation using lanes 2 and 3).
Signed-off-by Johan Hovold <[email protected]>
Quoted 3 lines
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 62 ++++++++--------------- 1 file changed, 20 insertions(+), 42 deletions(-)
Signature · 2 lines
With best wishes Dmitry
PATCH v2 18/22 phy: qcom-qmp-combo: merge USB and DP configurations
In reply to Johan HovoldIt does not really make any sense to keep separate configuration structures for the USB and DP parts of the same PHY so merge them.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 182 +++++++--------------- 1 file changed, 57 insertions(+), 125 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +57 -125
@@ -798,11 +798,7 @@ static const u8 qmp_dp_v5_voltage_swing_hbr_rbr[4][4] = {struct qmp_phy ; -/* struct qmp_phy_cfg - per-PHY initialization config */ struct qmp_phy_cfg { -/* phy-type - PCIE/UFS/USB */ -unsigned int type; -/* Init sequence for PHY blocks - serdes, tx, rx, pcs */ const struct qmp_phy_init_tbl *serdes_tbl;int serdes_tbl_num;
@@ -863,11 +859,6 @@ struct qmp_phy_cfg { }; -struct qmp_phy_combo_cfg { -const struct qmp_phy_cfg *usb_cfg; -const struct qmp_phy_cfg *dp_cfg; -}; -/** * struct qmp_phy - per-lane phy descriptor *
@@ -1007,9 +998,7 @@ static const char * const sc7180_usb3phy_reset_l[] = { "phy", }; -static const struct qmp_phy_cfg sc7180_usb3phy_cfg = { - .type =PHY_TYPE_USB3 , - +static const struct qmp_phy_cfg sc7180_usb3dpphy_cfg = { .serdes_tbl = qmp_v3_usb3_serdes_tbl, .serdes_tbl_num =ARRAY_SIZE (qmp_v3_usb3_serdes_tbl), .tx_tbl = qmp_v3_usb3_tx_tbl,
@@ -1018,19 +1007,6 @@ static const struct qmp_phy_cfg sc7180_usb3phy_cfg = { .rx_tbl_num = ARRAY_SIZE(qmp_v3_usb3_rx_tbl), .pcs_tbl = qmp_v3_usb3_pcs_tbl, .pcs_tbl_num = ARRAY_SIZE(qmp_v3_usb3_pcs_tbl), - .clk_list = qmp_v3_phy_clk_l, - .num_clks = ARRAY_SIZE(qmp_v3_phy_clk_l), - .reset_list = sc7180_usb3phy_reset_l, - .num_resets = ARRAY_SIZE(sc7180_usb3phy_reset_l), - .vreg_list = qmp_phy_vreg_l, - .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), - .regs = qmp_v3_usb3phy_regs_layout, - - .has_pwrdn_delay = true, -}; - -static const struct qmp_phy_cfg sc7180_dpphy_cfg = { - .type =PHY_TYPE_DP , .dp_serdes_tbl = qmp_v3_dp_serdes_tbl, .dp_serdes_tbl_num = ARRAY_SIZE(qmp_v3_dp_serdes_tbl),
@@ -1055,16 +1031,19 @@ static const struct qmp_phy_cfg sc7180_dpphy_cfg = { .configure_dp_tx = qcom_qmp_v3_phy_configure_dp_tx, .configure_dp_phy = qcom_qmp_v3_phy_configure_dp_phy, .calibrate_dp_phy = qcom_qmp_v3_dp_phy_calibrate, -}; -static const struct qmp_phy_combo_cfg sc7180_usb3dpphy_cfg = { - .usb_cfg = &sc7180_usb3phy_cfg, - .dp_cfg = &sc7180_dpphy_cfg, -}; + .clk_list = qmp_v3_phy_clk_l, + .num_clks = ARRAY_SIZE(qmp_v3_phy_clk_l), + .reset_list = sc7180_usb3phy_reset_l, + .num_resets = ARRAY_SIZE(sc7180_usb3phy_reset_l), + .vreg_list = qmp_phy_vreg_l, + .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), + .regs = qmp_v3_usb3phy_regs_layout, -static const struct qmp_phy_cfg sdm845_usb3phy_cfg = { - .type =PHY_TYPE_USB3 , + .has_pwrdn_delay = true, +}; +static const struct qmp_phy_cfg sdm845_usb3dpphy_cfg = { .serdes_tbl = qmp_v3_usb3_serdes_tbl, .serdes_tbl_num =ARRAY_SIZE (qmp_v3_usb3_serdes_tbl), .tx_tbl = qmp_v3_usb3_tx_tbl,
@@ -1073,24 +1052,11 @@ static const struct qmp_phy_cfg sdm845_usb3phy_cfg = { .rx_tbl_num = ARRAY_SIZE(qmp_v3_usb3_rx_tbl), .pcs_tbl = qmp_v3_usb3_pcs_tbl, .pcs_tbl_num = ARRAY_SIZE(qmp_v3_usb3_pcs_tbl), - .clk_list = qmp_v3_phy_clk_l, - .num_clks = ARRAY_SIZE(qmp_v3_phy_clk_l), - .reset_list = msm8996_usb3phy_reset_l, - .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l), - .vreg_list = qmp_phy_vreg_l, - .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), - .regs = qmp_v3_usb3phy_regs_layout, - - .has_pwrdn_delay = true, -}; -static const struct qmp_phy_cfg sdm845_dpphy_cfg = { - .type =PHY_TYPE_DP , - - .serdes_tbl = qmp_v3_dp_serdes_tbl, - .serdes_tbl_num =ARRAY_SIZE (qmp_v3_dp_serdes_tbl), - .tx_tbl = qmp_v3_dp_tx_tbl, - .tx_tbl_num =ARRAY_SIZE (qmp_v3_dp_tx_tbl), + .dp_serdes_tbl = qmp_v3_dp_serdes_tbl, + .dp_serdes_tbl_num = ARRAY_SIZE(qmp_v3_dp_serdes_tbl), + .dp_tx_tbl = qmp_v3_dp_tx_tbl, + .dp_tx_tbl_num = ARRAY_SIZE(qmp_v3_dp_tx_tbl), .serdes_tbl_rbr = qmp_v3_dp_serdes_tbl_rbr, .serdes_tbl_rbr_num = ARRAY_SIZE(qmp_v3_dp_serdes_tbl_rbr),
@@ -1110,16 +1076,19 @@ static const struct qmp_phy_cfg sdm845_dpphy_cfg = { .configure_dp_tx = qcom_qmp_v3_phy_configure_dp_tx, .configure_dp_phy = qcom_qmp_v3_phy_configure_dp_phy, .calibrate_dp_phy = qcom_qmp_v3_dp_phy_calibrate, -}; -static const struct qmp_phy_combo_cfg sdm845_usb3dpphy_cfg = { - .usb_cfg = &sdm845_usb3phy_cfg, - .dp_cfg = &sdm845_dpphy_cfg, -}; + .clk_list = qmp_v3_phy_clk_l, + .num_clks = ARRAY_SIZE(qmp_v3_phy_clk_l), + .reset_list = msm8996_usb3phy_reset_l, + .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l), + .vreg_list = qmp_phy_vreg_l, + .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), + .regs = qmp_v3_usb3phy_regs_layout, -static const struct qmp_phy_cfg sm8150_usb3phy_cfg = { - .type =PHY_TYPE_USB3 , + .has_pwrdn_delay = true, +}; +static const struct qmp_phy_cfg sc8180x_usb3dpphy_cfg = { .serdes_tbl = sm8150_usb3_serdes_tbl, .serdes_tbl_num =ARRAY_SIZE (sm8150_usb3_serdes_tbl), .tx_tbl = sm8150_usb3_tx_tbl,
@@ -1130,20 +1099,6 @@ static const struct qmp_phy_cfg sm8150_usb3phy_cfg = { .pcs_tbl_num = ARRAY_SIZE(sm8150_usb3_pcs_tbl), .pcs_usb_tbl = sm8150_usb3_pcs_usb_tbl, .pcs_usb_tbl_num = ARRAY_SIZE(sm8150_usb3_pcs_usb_tbl), - .clk_list = qmp_v4_phy_clk_l, - .num_clks = ARRAY_SIZE(qmp_v4_phy_clk_l), - .reset_list = msm8996_usb3phy_reset_l, - .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l), - .vreg_list = qmp_phy_vreg_l, - .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), - .regs = qmp_v4_usb3phy_regs_layout, - .pcs_usb_offset = 0x300, - - .has_pwrdn_delay = true, -}; - -static const struct qmp_phy_cfg sc8180x_dpphy_cfg = { - .type =PHY_TYPE_DP , .dp_serdes_tbl = qmp_v4_dp_serdes_tbl, .dp_serdes_tbl_num = ARRAY_SIZE(qmp_v4_dp_serdes_tbl),
@@ -1168,24 +1123,7 @@ static const struct qmp_phy_cfg sc8180x_dpphy_cfg = { .configure_dp_tx = qcom_qmp_v4_phy_configure_dp_tx, .configure_dp_phy = qcom_qmp_v4_phy_configure_dp_phy, .calibrate_dp_phy = qcom_qmp_v4_dp_phy_calibrate, -}; - -static const struct qmp_phy_combo_cfg sc8180x_usb3dpphy_cfg = { - .usb_cfg = &sm8150_usb3phy_cfg, - .dp_cfg = &sc8180x_dpphy_cfg, -}; - -static const struct qmp_phy_cfg sc8280xp_usb43dp_usb_cfg = { - .type =PHY_TYPE_USB3 , - .serdes_tbl = sc8280xp_usb43dp_serdes_tbl, - .serdes_tbl_num =ARRAY_SIZE (sc8280xp_usb43dp_serdes_tbl), - .tx_tbl = sc8280xp_usb43dp_tx_tbl, - .tx_tbl_num =ARRAY_SIZE (sc8280xp_usb43dp_tx_tbl), - .rx_tbl = sc8280xp_usb43dp_rx_tbl, - .rx_tbl_num =ARRAY_SIZE (sc8280xp_usb43dp_rx_tbl), - .pcs_tbl = sc8280xp_usb43dp_pcs_tbl, - .pcs_tbl_num =ARRAY_SIZE (sc8280xp_usb43dp_pcs_tbl), .clk_list = qmp_v4_phy_clk_l, .num_clks = ARRAY_SIZE(qmp_v4_phy_clk_l), .reset_list = msm8996_usb3phy_reset_l,
@@ -1194,10 +1132,19 @@ static const struct qmp_phy_cfg sc8280xp_usb43dp_usb_cfg = { .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), .regs = qmp_v4_usb3phy_regs_layout, .pcs_usb_offset = 0x300, + + .has_pwrdn_delay = true, }; -static const struct qmp_phy_cfg sc8280xp_usb43dp_dp_cfg = { - .type =PHY_TYPE_DP , +static const struct qmp_phy_cfg sc8280xp_usb43dpphy_cfg = { + .serdes_tbl = sc8280xp_usb43dp_serdes_tbl, + .serdes_tbl_num =ARRAY_SIZE (sc8280xp_usb43dp_serdes_tbl), + .tx_tbl = sc8280xp_usb43dp_tx_tbl, + .tx_tbl_num =ARRAY_SIZE (sc8280xp_usb43dp_tx_tbl), + .rx_tbl = sc8280xp_usb43dp_rx_tbl, + .rx_tbl_num =ARRAY_SIZE (sc8280xp_usb43dp_rx_tbl), + .pcs_tbl = sc8280xp_usb43dp_pcs_tbl, + .pcs_tbl_num =ARRAY_SIZE (sc8280xp_usb43dp_pcs_tbl), .dp_serdes_tbl = qmp_v5_dp_serdes_tbl, .dp_serdes_tbl_num =ARRAY_SIZE (qmp_v5_dp_serdes_tbl),
@@ -1222,16 +1169,18 @@ static const struct qmp_phy_cfg sc8280xp_usb43dp_dp_cfg = { .configure_dp_tx = qcom_qmp_v4_phy_configure_dp_tx, .configure_dp_phy = qcom_qmp_v5_phy_configure_dp_phy, .calibrate_dp_phy = qcom_qmp_v4_dp_phy_calibrate, -}; -static const struct qmp_phy_combo_cfg sc8280xp_usb43dpphy_cfg = { - .usb_cfg = &sc8280xp_usb43dp_usb_cfg, - .dp_cfg = &sc8280xp_usb43dp_dp_cfg, + .clk_list = qmp_v4_phy_clk_l, + .num_clks = ARRAY_SIZE(qmp_v4_phy_clk_l), + .reset_list = msm8996_usb3phy_reset_l, + .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l), + .vreg_list = qmp_phy_vreg_l, + .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), + .regs = qmp_v4_usb3phy_regs_layout, + .pcs_usb_offset = 0x300, }; -static const struct qmp_phy_cfg sm8250_usb3phy_cfg = { - .type =PHY_TYPE_USB3 , - +static const struct qmp_phy_cfg sm8250_usb3dpphy_cfg = { .serdes_tbl = sm8150_usb3_serdes_tbl, .serdes_tbl_num =ARRAY_SIZE (sm8150_usb3_serdes_tbl), .tx_tbl = sm8250_usb3_tx_tbl,
@@ -1242,20 +1191,6 @@ static const struct qmp_phy_cfg sm8250_usb3phy_cfg = { .pcs_tbl_num = ARRAY_SIZE(sm8250_usb3_pcs_tbl), .pcs_usb_tbl = sm8250_usb3_pcs_usb_tbl, .pcs_usb_tbl_num = ARRAY_SIZE(sm8250_usb3_pcs_usb_tbl), - .clk_list = qmp_v4_sm8250_usbphy_clk_l, - .num_clks = ARRAY_SIZE(qmp_v4_sm8250_usbphy_clk_l), - .reset_list = msm8996_usb3phy_reset_l, - .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l), - .vreg_list = qmp_phy_vreg_l, - .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), - .regs = qmp_v4_usb3phy_regs_layout, - .pcs_usb_offset = 0x300, - - .has_pwrdn_delay = true, -}; - -static const struct qmp_phy_cfg sm8250_dpphy_cfg = { - .type =PHY_TYPE_DP , .dp_serdes_tbl = qmp_v4_dp_serdes_tbl, .dp_serdes_tbl_num = ARRAY_SIZE(qmp_v4_dp_serdes_tbl),
@@ -1280,11 +1215,17 @@ static const struct qmp_phy_cfg sm8250_dpphy_cfg = { .configure_dp_tx = qcom_qmp_v4_phy_configure_dp_tx, .configure_dp_phy = qcom_qmp_v4_phy_configure_dp_phy, .calibrate_dp_phy = qcom_qmp_v4_dp_phy_calibrate, -}; -static const struct qmp_phy_combo_cfg sm8250_usb3dpphy_cfg = { - .usb_cfg = &sm8250_usb3phy_cfg, - .dp_cfg = &sm8250_dpphy_cfg, + .clk_list = qmp_v4_sm8250_usbphy_clk_l, + .num_clks = ARRAY_SIZE(qmp_v4_sm8250_usbphy_clk_l), + .reset_list = msm8996_usb3phy_reset_l, + .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l), + .vreg_list = qmp_phy_vreg_l, + .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), + .regs = qmp_v4_usb3phy_regs_layout, + .pcs_usb_offset = 0x300, + + .has_pwrdn_delay = true, }; static void qmp_combo_configure_lane(void __iomem *base,
@@ -2697,10 +2638,7 @@ static int qmp_combo_probe(struct platform_device *pdev)void __iomem *serdes;void __iomem *usb_serdes;void __iomem *dp_serdes =NULL ; -const struct qmp_phy_combo_cfg *combo_cfg =NULL ;const struct qmp_phy_cfg *cfg =NULL ; -const struct qmp_phy_cfg *usb_cfg =NULL ; -const struct qmp_phy_cfg *dp_cfg =NULL ;int num, id, expected_phys;int ret;
@@ -2711,13 +2649,10 @@ static int qmp_combo_probe(struct platform_device *pdev) qmp->dev = dev;dev_set_drvdata (dev, qmp); - combo_cfg =of_device_get_match_data (dev); -if (!combo_cfg) + cfg =of_device_get_match_data (dev); +if (!cfg)return -EINVAL ; - usb_cfg = combo_cfg->usb_cfg; - cfg = usb_cfg;/* Setup clks and regulators */ - usb_serdes = serdes =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (serdes))return PTR_ERR (serdes);
@@ -2730,7 +2665,6 @@ static int qmp_combo_probe(struct platform_device *pdev)if (IS_ERR (dp_serdes))return PTR_ERR (dp_serdes); - dp_cfg = combo_cfg->dp_cfg; expected_phys =2 ;mutex_init (&qmp->phy_mutex);
@@ -2769,7 +2703,6 @@ static int qmp_combo_probe(struct platform_device *pdev) id =0 ;for_each_available_child_of_node (dev->of_node, child) {if (of_node_name_eq (child,"dp-phy" )) { - cfg = dp_cfg; serdes = dp_serdes;/* Create per-lane phy */
@@ -2787,7 +2720,6 @@ static int qmp_combo_probe(struct platform_device *pdev) goto err_node_put; } }else if (of_node_name_eq (child,"usb3-phy" )) { - cfg = usb_cfg; serdes = usb_serdes;/* Create per-lane phy */
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v2 19/22 phy: qcom-qmp-combo: merge driver data
In reply to Johan HovoldThe QMP combo driver manages a single PHY (even if it provides two interfaces for USB and DP, respectively) so merge the old qcom_qmp and qmp_phy structures and drop the PHY array.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 688 ++++++++++------------ 1 file changed, 312 insertions(+), 376 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +312 -376
@@ -796,7 +796,7 @@ static const u8 qmp_dp_v5_voltage_swing_hbr_rbr[4][4] = { { 0x3f, 0xff, 0xff, 0xff } }; -struct qmp_phy ; +struct qmp_combo ;struct qmp_phy_cfg {/* Init sequence for PHY blocks - serdes, tx, rx, pcs */
@@ -833,10 +833,10 @@ struct qmp_phy_cfg {const u8 (*pre_emphasis_hbr3_hbr2)[4 ][4 ];/* DP PHY callbacks */ -int (*configure_dp_phy)(struct qmp_phy *qphy); -void (*configure_dp_tx)(struct qmp_phy *qphy); -int (*calibrate_dp_phy)(struct qmp_phy *qphy); -void (*dp_aux_init)(struct qmp_phy *qphy); +int (*configure_dp_phy)(struct qmp_combo *qmp); +void (*configure_dp_tx)(struct qmp_combo *qmp); +int (*calibrate_dp_phy)(struct qmp_combo *qmp); +void (*dp_aux_init)(struct qmp_combo *qmp);/* clock ids to be requested */ const char *const *clk_list;
@@ -859,29 +859,19 @@ struct qmp_phy_cfg { }; -/** -* struct qmp_phy - per-lane phy descriptor -* -* @phy: generic phy -* @cfg: phy specific configuration -* @serdes: iomapped memory space for phy's serdes (i.e. PLL) -* @tx: iomapped memory space for lane's tx -* @rx: iomapped memory space for lane's rx -* @pcs: iomapped memory space for lane's pcs -* @tx2: iomapped memory space for second lane's tx (in dual lane PHYs) -* @rx2: iomapped memory space for second lane's rx (in dual lane PHYs) -* @pcs_misc: iomapped memory space for lane's pcs_misc -* @pcs_usb: iomapped memory space for lane's pcs_usb -* @pipe_clk: pipe clock -* @qmp: QMP phy to which this lane belongs -* @mode: current PHY mode -* @dp_aux_cfg: Display port aux config -* @dp_opts: Display port optional config -* @dp_clks: Display port clocks -*/ -struct qmp_phy { -struct phy *phy; +struct qmp_phy_dp_clks { +struct qmp_combo *qmp; +struct clk_hw dp_link_hw; +struct clk_hw dp_pixel_hw; +}; + +struct qmp_combo { +struct device *dev; +const struct qmp_phy_cfg *cfg; + +void __iomem *dp_com; +void __iomem *serdes;void __iomem *tx;void __iomem *rx;
@@ -897,59 +887,33 @@ struct qmp_phy {void __iomem *dp_pcs;struct clk *pipe_clk; -struct qcom_qmp *qmp; -enum phy_mode mode; -unsigned int dp_aux_cfg; -struct phy_configure_opts_dp dp_opts; -struct qmp_phy_dp_clks *dp_clks; -}; - -struct qmp_phy_dp_clks { -struct qmp_phy *qphy; -struct clk_hw dp_link_hw; -struct clk_hw dp_pixel_hw; -}; - -/** -* struct qcom_qmp - structure holding QMP phy block attributes -* -* @dev: device -* @dp_com: iomapped memory space for phy's dp_com control block -* -* @clks: array of clocks required by phy -* @resets: array of resets required by phy -* @vregs: regulator supplies bulk data -* -* @phys: array of per-lane phy descriptors -* @phy_mutex: mutex lock for PHY common block initialization -* @init_count: phy common block initialization count -*/ -struct qcom_qmp { -struct device *dev; -void __iomem *dp_com; -struct clk_bulk_data *clks;struct reset_control_bulk_data *resets;struct regulator_bulk_data *vregs; -struct qmp_phy **phys; -struct qmp_phy *usb_phy; -struct mutex phy_mutex;int init_count; + +struct phy *usb_phy; +enum phy_mode mode; + +struct phy *dp_phy; +unsigned int dp_aux_cfg; +struct phy_configure_opts_dp dp_opts; +struct qmp_phy_dp_clks *dp_clks; }; -static void qcom_qmp_v3_phy_dp_aux_init (struct qmp_phy *qphy); -static void qcom_qmp_v3_phy_configure_dp_tx (struct qmp_phy *qphy); -static int qcom_qmp_v3_phy_configure_dp_phy (struct qmp_phy *qphy); -static int qcom_qmp_v3_dp_phy_calibrate (struct qmp_phy *qphy); +static void qcom_qmp_v3_phy_dp_aux_init (struct qmp_combo *qmp); +static void qcom_qmp_v3_phy_configure_dp_tx (struct qmp_combo *qmp); +static int qcom_qmp_v3_phy_configure_dp_phy (struct qmp_combo *qmp); +static int qcom_qmp_v3_dp_phy_calibrate (struct qmp_combo *qmp); -static void qcom_qmp_v4_phy_dp_aux_init (struct qmp_phy *qphy); -static void qcom_qmp_v4_phy_configure_dp_tx (struct qmp_phy *qphy); -static int qcom_qmp_v4_phy_configure_dp_phy (struct qmp_phy *qphy); -static int qcom_qmp_v4_dp_phy_calibrate (struct qmp_phy *qphy); +static void qcom_qmp_v4_phy_dp_aux_init (struct qmp_combo *qmp); +static void qcom_qmp_v4_phy_configure_dp_tx (struct qmp_combo *qmp); +static int qcom_qmp_v4_phy_configure_dp_phy (struct qmp_combo *qmp); +static int qcom_qmp_v4_dp_phy_calibrate (struct qmp_combo *qmp); -static int qcom_qmp_v5_phy_configure_dp_phy (struct qmp_phy *qphy); +static int qcom_qmp_v5_phy_configure_dp_phy (struct qmp_combo *qmp);static inline void qphy_setbits (void __iomem *base,u32 offset,u32 val) {
@@ -1254,11 +1218,11 @@ static void qmp_combo_configure(void __iomem *base,qmp_combo_configure_lane (base, tbl, num,0xff ); } -static int qmp_combo_dp_serdes_init (struct qmp_phy *qphy) +static int qmp_combo_dp_serdes_init (struct qmp_combo *qmp) { -const struct qmp_phy_cfg *cfg = qphy->cfg; -void __iomem *serdes = qphy->dp_serdes; -const struct phy_configure_opts_dp *dp_opts = &qphy->dp_opts; +const struct qmp_phy_cfg *cfg = qmp->cfg; +void __iomem *serdes = qmp->dp_serdes; +const struct phy_configure_opts_dp *dp_opts = &qmp->dp_opts;qmp_combo_configure (serdes, cfg->dp_serdes_tbl, cfg->dp_serdes_tbl_num);
@@ -1287,54 +1251,54 @@ static int qmp_combo_dp_serdes_init(struct qmp_phy *qphy)return 0 ; } -static void qcom_qmp_v3_phy_dp_aux_init (struct qmp_phy *qphy) +static void qcom_qmp_v3_phy_dp_aux_init (struct qmp_combo *qmp) {writel (DP_PHY_PD_CTL_PWRDN |DP_PHY_PD_CTL_AUX_PWRDN |DP_PHY_PD_CTL_PLL_PWRDN |DP_PHY_PD_CTL_DP_CLAMP_EN , - qphy->dp_pcs +QSERDES_DP_PHY_PD_CTL ); + qmp->dp_pcs +QSERDES_DP_PHY_PD_CTL );/* Turn on BIAS current for PHY/PLL */ writel (QSERDES_V3_COM_BIAS_EN |QSERDES_V3_COM_BIAS_EN_MUX |QSERDES_V3_COM_CLKBUF_L_EN |QSERDES_V3_COM_EN_SYSCLK_TX_SEL , - qphy->dp_serdes +QSERDES_V3_COM_BIAS_EN_CLKBUFLR_EN ); + qmp->dp_serdes +QSERDES_V3_COM_BIAS_EN_CLKBUFLR_EN ); -writel (DP_PHY_PD_CTL_PSR_PWRDN , qphy->dp_pcs +QSERDES_DP_PHY_PD_CTL ); +writel (DP_PHY_PD_CTL_PSR_PWRDN , qmp->dp_pcs +QSERDES_DP_PHY_PD_CTL );writel (DP_PHY_PD_CTL_PWRDN |DP_PHY_PD_CTL_AUX_PWRDN |DP_PHY_PD_CTL_LANE_0_1_PWRDN |DP_PHY_PD_CTL_LANE_2_3_PWRDN |DP_PHY_PD_CTL_PLL_PWRDN |DP_PHY_PD_CTL_DP_CLAMP_EN , - qphy->dp_pcs +QSERDES_DP_PHY_PD_CTL ); + qmp->dp_pcs +QSERDES_DP_PHY_PD_CTL );writel (QSERDES_V3_COM_BIAS_EN |QSERDES_V3_COM_BIAS_EN_MUX |QSERDES_V3_COM_CLKBUF_R_EN |QSERDES_V3_COM_CLKBUF_L_EN |QSERDES_V3_COM_EN_SYSCLK_TX_SEL |QSERDES_V3_COM_CLKBUF_RX_DRIVE_L , - qphy->dp_serdes +QSERDES_V3_COM_BIAS_EN_CLKBUFLR_EN ); - -writel (0x00 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG0 ); -writel (0x13 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG1 ); -writel (0x24 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG2 ); -writel (0x00 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG3 ); -writel (0x0a , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG4 ); -writel (0x26 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG5 ); -writel (0x0a , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG6 ); -writel (0x03 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG7 ); -writel (0xbb , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG8 ); -writel (0x03 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG9 ); - qphy->dp_aux_cfg =0 ; + qmp->dp_serdes +QSERDES_V3_COM_BIAS_EN_CLKBUFLR_EN ); + +writel (0x00 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG0 ); +writel (0x13 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG1 ); +writel (0x24 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG2 ); +writel (0x00 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG3 ); +writel (0x0a , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG4 ); +writel (0x26 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG5 ); +writel (0x0a , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG6 ); +writel (0x03 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG7 ); +writel (0xbb , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG8 ); +writel (0x03 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG9 ); + qmp->dp_aux_cfg =0 ;writel (PHY_AUX_STOP_ERR_MASK |PHY_AUX_DEC_ERR_MASK |PHY_AUX_SYNC_ERR_MASK |PHY_AUX_ALIGN_ERR_MASK |PHY_AUX_REQ_ERR_MASK , - qphy->dp_pcs +QSERDES_V3_DP_PHY_AUX_INTERRUPT_MASK ); + qmp->dp_pcs +QSERDES_V3_DP_PHY_AUX_INTERRUPT_MASK ); } -static int qmp_combo_configure_dp_swing (struct qmp_phy *qphy, +static int qmp_combo_configure_dp_swing (struct qmp_combo *qmp,unsigned int drv_lvl_reg,unsigned int emp_post_reg) { -const struct phy_configure_opts_dp *dp_opts = &qphy->dp_opts; -const struct qmp_phy_cfg *cfg = qphy->cfg; +const struct phy_configure_opts_dp *dp_opts = &qmp->dp_opts; +const struct qmp_phy_cfg *cfg = qmp->cfg;unsigned int v_level =0 , p_level =0 ;u8 voltage_swing_cfg, pre_emphasis_cfg;int i;
@@ -1360,20 +1324,20 @@ static int qmp_combo_configure_dp_swing(struct qmp_phy *qphy, voltage_swing_cfg |= DP_PHY_TXn_TX_DRV_LVL_MUX_EN; pre_emphasis_cfg |= DP_PHY_TXn_TX_EMP_POST1_LVL_MUX_EN; -writel (voltage_swing_cfg, qphy->dp_tx + drv_lvl_reg); -writel (pre_emphasis_cfg, qphy->dp_tx + emp_post_reg); -writel (voltage_swing_cfg, qphy->dp_tx2 + drv_lvl_reg); -writel (pre_emphasis_cfg, qphy->dp_tx2 + emp_post_reg); +writel (voltage_swing_cfg, qmp->dp_tx + drv_lvl_reg); +writel (pre_emphasis_cfg, qmp->dp_tx + emp_post_reg); +writel (voltage_swing_cfg, qmp->dp_tx2 + drv_lvl_reg); +writel (pre_emphasis_cfg, qmp->dp_tx2 + emp_post_reg);return 0 ; } -static void qcom_qmp_v3_phy_configure_dp_tx (struct qmp_phy *qphy) +static void qcom_qmp_v3_phy_configure_dp_tx (struct qmp_combo *qmp) { -const struct phy_configure_opts_dp *dp_opts = &qphy->dp_opts; +const struct phy_configure_opts_dp *dp_opts = &qmp->dp_opts;u32 bias_en, drvr_en; -if (qmp_combo_configure_dp_swing (qphy,QSERDES_V3_TX_TX_DRV_LVL , +if (qmp_combo_configure_dp_swing (qmp,QSERDES_V3_TX_TX_DRV_LVL ,QSERDES_V3_TX_TX_EMP_POST1_LVL ) <0 )return ;
@@ -1385,13 +1349,13 @@ static void qcom_qmp_v3_phy_configure_dp_tx(struct qmp_phy *qphy) drvr_en =0x10 ; } -writel (drvr_en, qphy->dp_tx +QSERDES_V3_TX_HIGHZ_DRVR_EN ); -writel (bias_en, qphy->dp_tx +QSERDES_V3_TX_TRANSCEIVER_BIAS_EN ); -writel (drvr_en, qphy->dp_tx2 +QSERDES_V3_TX_HIGHZ_DRVR_EN ); -writel (bias_en, qphy->dp_tx2 +QSERDES_V3_TX_TRANSCEIVER_BIAS_EN ); +writel (drvr_en, qmp->dp_tx +QSERDES_V3_TX_HIGHZ_DRVR_EN ); +writel (bias_en, qmp->dp_tx +QSERDES_V3_TX_TRANSCEIVER_BIAS_EN ); +writel (drvr_en, qmp->dp_tx2 +QSERDES_V3_TX_HIGHZ_DRVR_EN ); +writel (bias_en, qmp->dp_tx2 +QSERDES_V3_TX_TRANSCEIVER_BIAS_EN ); } -static bool qmp_combo_configure_dp_mode (struct qmp_phy *qphy) +static bool qmp_combo_configure_dp_mode (struct qmp_combo *qmp) {u32 val;bool reverse = false;
@@ -1411,27 +1375,27 @@ static bool qmp_combo_configure_dp_mode(struct qmp_phy *qphy)* if (lane_cnt == 4 || orientation == ORIENTATION_CC1) * val |= DP_PHY_PD_CTL_LANE_2_3_PWRDN; * if (orientation == ORIENTATION_CC2) -* writel(0x4c, qphy->dp_pcs + QSERDES_V3_DP_PHY_MODE); +* writel(0x4c, qmp->dp_pcs + QSERDES_V3_DP_PHY_MODE); */ val |=DP_PHY_PD_CTL_LANE_2_3_PWRDN ; -writel (val, qphy->dp_pcs +QSERDES_DP_PHY_PD_CTL ); +writel (val, qmp->dp_pcs +QSERDES_DP_PHY_PD_CTL ); -writel (0x5c , qphy->dp_pcs +QSERDES_DP_PHY_MODE ); +writel (0x5c , qmp->dp_pcs +QSERDES_DP_PHY_MODE );return reverse; } -static int qcom_qmp_v3_phy_configure_dp_phy (struct qmp_phy *qphy) +static int qcom_qmp_v3_phy_configure_dp_phy (struct qmp_combo *qmp) { -const struct qmp_phy_dp_clks *dp_clks = qphy->dp_clks; -const struct phy_configure_opts_dp *dp_opts = &qphy->dp_opts; +const struct qmp_phy_dp_clks *dp_clks = qmp->dp_clks; +const struct phy_configure_opts_dp *dp_opts = &qmp->dp_opts;u32 phy_vco_div, status;unsigned long pixel_freq; -qmp_combo_configure_dp_mode (qphy); +qmp_combo_configure_dp_mode (qmp); -writel (0x05 , qphy->dp_pcs +QSERDES_V3_DP_PHY_TX0_TX1_LANE_CTL ); -writel (0x05 , qphy->dp_pcs +QSERDES_V3_DP_PHY_TX2_TX3_LANE_CTL ); +writel (0x05 , qmp->dp_pcs +QSERDES_V3_DP_PHY_TX0_TX1_LANE_CTL ); +writel (0x05 , qmp->dp_pcs +QSERDES_V3_DP_PHY_TX2_TX3_LANE_CTL );switch (dp_opts->link_rate) {case 1620 :
@@ -1454,40 +1418,40 @@ static int qcom_qmp_v3_phy_configure_dp_phy(struct qmp_phy *qphy)/* Other link rates aren't supported */ return -EINVAL ; } -writel (phy_vco_div, qphy->dp_pcs +QSERDES_V3_DP_PHY_VCO_DIV ); +writel (phy_vco_div, qmp->dp_pcs +QSERDES_V3_DP_PHY_VCO_DIV );clk_set_rate (dp_clks->dp_link_hw.clk, dp_opts->link_rate *100000 );clk_set_rate (dp_clks->dp_pixel_hw.clk, pixel_freq); -writel (0x04 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG2 ); -writel (0x01 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); -writel (0x05 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); -writel (0x01 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); -writel (0x09 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x04 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG2 ); +writel (0x01 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x05 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x01 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x09 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); -writel (0x20 , qphy->dp_serdes +QSERDES_V3_COM_RESETSM_CNTRL ); +writel (0x20 , qmp->dp_serdes +QSERDES_V3_COM_RESETSM_CNTRL ); -if (readl_poll_timeout (qphy->dp_serdes +QSERDES_V3_COM_C_READY_STATUS , +if (readl_poll_timeout (qmp->dp_serdes +QSERDES_V3_COM_C_READY_STATUS , status, ((status &BIT (0 )) >0 ),500 ,10000 ))return -ETIMEDOUT ; -writel (0x19 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x19 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); -if (readl_poll_timeout (qphy->dp_pcs +QSERDES_V3_DP_PHY_STATUS , +if (readl_poll_timeout (qmp->dp_pcs +QSERDES_V3_DP_PHY_STATUS , status, ((status &BIT (1 )) >0 ),500 ,10000 ))return -ETIMEDOUT ; -writel (0x18 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x18 , qmp->dp_pcs +QSERDES_DP_PHY_CFG );udelay (2000 ); -writel (0x19 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x19 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); - return readl_poll_timeout(qphy->dp_pcs + QSERDES_V3_DP_PHY_STATUS, + return readl_poll_timeout(qmp->dp_pcs + QSERDES_V3_DP_PHY_STATUS, status, ((status & BIT(1)) > 0), 500,
@@ -1498,76 +1462,76 @@ static int qcom_qmp_v3_phy_configure_dp_phy(struct qmp_phy *qphy)* We need to calibrate the aux setting here as many times * as the caller tries */ -static int qcom_qmp_v3_dp_phy_calibrate (struct qmp_phy *qphy) +static int qcom_qmp_v3_dp_phy_calibrate (struct qmp_combo *qmp) {static const u8 cfg1_settings[] = {0x13 ,0x23 ,0x1d };u8 val; - qphy->dp_aux_cfg++; - qphy->dp_aux_cfg %=ARRAY_SIZE (cfg1_settings); - val = cfg1_settings[qphy->dp_aux_cfg]; + qmp->dp_aux_cfg++; + qmp->dp_aux_cfg %=ARRAY_SIZE (cfg1_settings); + val = cfg1_settings[qmp->dp_aux_cfg]; -writel (val, qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG1 ); +writel (val, qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG1 );return 0 ; } -static void qcom_qmp_v4_phy_dp_aux_init (struct qmp_phy *qphy) +static void qcom_qmp_v4_phy_dp_aux_init (struct qmp_combo *qmp) {writel (DP_PHY_PD_CTL_PWRDN |DP_PHY_PD_CTL_PSR_PWRDN |DP_PHY_PD_CTL_AUX_PWRDN |DP_PHY_PD_CTL_PLL_PWRDN |DP_PHY_PD_CTL_DP_CLAMP_EN , - qphy->dp_pcs +QSERDES_DP_PHY_PD_CTL ); + qmp->dp_pcs +QSERDES_DP_PHY_PD_CTL );/* Turn on BIAS current for PHY/PLL */ -writel (0x17 , qphy->dp_serdes +QSERDES_V4_COM_BIAS_EN_CLKBUFLR_EN ); - -writel (0x00 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG0 ); -writel (0x13 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG1 ); -writel (0xa4 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG2 ); -writel (0x00 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG3 ); -writel (0x0a , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG4 ); -writel (0x26 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG5 ); -writel (0x0a , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG6 ); -writel (0x03 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG7 ); -writel (0xb7 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG8 ); -writel (0x03 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG9 ); - qphy->dp_aux_cfg =0 ; +writel (0x17 , qmp->dp_serdes +QSERDES_V4_COM_BIAS_EN_CLKBUFLR_EN ); + +writel (0x00 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG0 ); +writel (0x13 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG1 ); +writel (0xa4 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG2 ); +writel (0x00 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG3 ); +writel (0x0a , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG4 ); +writel (0x26 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG5 ); +writel (0x0a , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG6 ); +writel (0x03 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG7 ); +writel (0xb7 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG8 ); +writel (0x03 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG9 ); + qmp->dp_aux_cfg =0 ;writel (PHY_AUX_STOP_ERR_MASK |PHY_AUX_DEC_ERR_MASK |PHY_AUX_SYNC_ERR_MASK |PHY_AUX_ALIGN_ERR_MASK |PHY_AUX_REQ_ERR_MASK , - qphy->dp_pcs +QSERDES_V4_DP_PHY_AUX_INTERRUPT_MASK ); + qmp->dp_pcs +QSERDES_V4_DP_PHY_AUX_INTERRUPT_MASK ); } -static void qcom_qmp_v4_phy_configure_dp_tx (struct qmp_phy *qphy) +static void qcom_qmp_v4_phy_configure_dp_tx (struct qmp_combo *qmp) {/* Program default values before writing proper values */ -writel (0x27 , qphy->dp_tx +QSERDES_V4_TX_TX_DRV_LVL ); -writel (0x27 , qphy->dp_tx2 +QSERDES_V4_TX_TX_DRV_LVL ); +writel (0x27 , qmp->dp_tx +QSERDES_V4_TX_TX_DRV_LVL ); +writel (0x27 , qmp->dp_tx2 +QSERDES_V4_TX_TX_DRV_LVL ); -writel (0x20 , qphy->dp_tx +QSERDES_V4_TX_TX_EMP_POST1_LVL ); -writel (0x20 , qphy->dp_tx2 +QSERDES_V4_TX_TX_EMP_POST1_LVL ); +writel (0x20 , qmp->dp_tx +QSERDES_V4_TX_TX_EMP_POST1_LVL ); +writel (0x20 , qmp->dp_tx2 +QSERDES_V4_TX_TX_EMP_POST1_LVL ); -qmp_combo_configure_dp_swing (qphy,QSERDES_V4_TX_TX_DRV_LVL , +qmp_combo_configure_dp_swing (qmp,QSERDES_V4_TX_TX_DRV_LVL ,QSERDES_V4_TX_TX_EMP_POST1_LVL ); } -static int qcom_qmp_v45_phy_configure_dp_phy (struct qmp_phy *qphy) +static int qcom_qmp_v45_phy_configure_dp_phy (struct qmp_combo *qmp) { -const struct qmp_phy_dp_clks *dp_clks = qphy->dp_clks; -const struct phy_configure_opts_dp *dp_opts = &qphy->dp_opts; +const struct qmp_phy_dp_clks *dp_clks = qmp->dp_clks; +const struct phy_configure_opts_dp *dp_opts = &qmp->dp_opts;u32 phy_vco_div, status;unsigned long pixel_freq; -writel (0x0f , qphy->dp_pcs +QSERDES_V4_DP_PHY_CFG_1 ); +writel (0x0f , qmp->dp_pcs +QSERDES_V4_DP_PHY_CFG_1 ); -qmp_combo_configure_dp_mode (qphy); +qmp_combo_configure_dp_mode (qmp); -writel (0x13 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG1 ); -writel (0xa4 , qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG2 ); +writel (0x13 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG1 ); +writel (0xa4 , qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG2 ); -writel (0x05 , qphy->dp_pcs +QSERDES_V4_DP_PHY_TX0_TX1_LANE_CTL ); -writel (0x05 , qphy->dp_pcs +QSERDES_V4_DP_PHY_TX2_TX3_LANE_CTL ); +writel (0x05 , qmp->dp_pcs +QSERDES_V4_DP_PHY_TX0_TX1_LANE_CTL ); +writel (0x05 , qmp->dp_pcs +QSERDES_V4_DP_PHY_TX2_TX3_LANE_CTL );switch (dp_opts->link_rate) {case 1620 :
@@ -1590,49 +1554,49 @@ static int qcom_qmp_v45_phy_configure_dp_phy(struct qmp_phy *qphy)/* Other link rates aren't supported */ return -EINVAL ; } -writel (phy_vco_div, qphy->dp_pcs +QSERDES_V4_DP_PHY_VCO_DIV ); +writel (phy_vco_div, qmp->dp_pcs +QSERDES_V4_DP_PHY_VCO_DIV );clk_set_rate (dp_clks->dp_link_hw.clk, dp_opts->link_rate *100000 );clk_set_rate (dp_clks->dp_pixel_hw.clk, pixel_freq); -writel (0x01 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); -writel (0x05 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); -writel (0x01 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); -writel (0x09 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x01 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x05 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x01 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x09 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); -writel (0x20 , qphy->dp_serdes +QSERDES_V4_COM_RESETSM_CNTRL ); +writel (0x20 , qmp->dp_serdes +QSERDES_V4_COM_RESETSM_CNTRL ); -if (readl_poll_timeout (qphy->dp_serdes +QSERDES_V4_COM_C_READY_STATUS , +if (readl_poll_timeout (qmp->dp_serdes +QSERDES_V4_COM_C_READY_STATUS , status, ((status &BIT (0 )) >0 ),500 ,10000 ))return -ETIMEDOUT ; -if (readl_poll_timeout (qphy->dp_serdes +QSERDES_V4_COM_CMN_STATUS , +if (readl_poll_timeout (qmp->dp_serdes +QSERDES_V4_COM_CMN_STATUS , status, ((status &BIT (0 )) >0 ),500 ,10000 ))return -ETIMEDOUT ; -if (readl_poll_timeout (qphy->dp_serdes +QSERDES_V4_COM_CMN_STATUS , +if (readl_poll_timeout (qmp->dp_serdes +QSERDES_V4_COM_CMN_STATUS , status, ((status &BIT (1 )) >0 ),500 ,10000 ))return -ETIMEDOUT ; -writel (0x19 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x19 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); -if (readl_poll_timeout (qphy->dp_pcs +QSERDES_V4_DP_PHY_STATUS , +if (readl_poll_timeout (qmp->dp_pcs +QSERDES_V4_DP_PHY_STATUS , status, ((status &BIT (0 )) >0 ),500 ,10000 ))return -ETIMEDOUT ; - if (readl_poll_timeout(qphy->dp_pcs + QSERDES_V4_DP_PHY_STATUS, + if (readl_poll_timeout(qmp->dp_pcs + QSERDES_V4_DP_PHY_STATUS, status, ((status & BIT(1)) > 0), 500,
@@ -1642,15 +1606,15 @@ static int qcom_qmp_v45_phy_configure_dp_phy(struct qmp_phy *qphy)return 0 ; } -static int qcom_qmp_v4_phy_configure_dp_phy (struct qmp_phy *qphy) +static int qcom_qmp_v4_phy_configure_dp_phy (struct qmp_combo *qmp) { -const struct phy_configure_opts_dp *dp_opts = &qphy->dp_opts; +const struct phy_configure_opts_dp *dp_opts = &qmp->dp_opts;u32 bias0_en, drvr0_en, bias1_en, drvr1_en;bool reverse = false;u32 status;int ret; - ret =qcom_qmp_v45_phy_configure_dp_phy (qphy); + ret =qcom_qmp_v45_phy_configure_dp_phy (qmp);if (ret <0 )return ret;
@@ -1676,43 +1640,43 @@ static int qcom_qmp_v4_phy_configure_dp_phy(struct qmp_phy *qphy) drvr1_en =0x10 ; } -writel (drvr0_en, qphy->dp_tx +QSERDES_V4_TX_HIGHZ_DRVR_EN ); -writel (bias0_en, qphy->dp_tx +QSERDES_V4_TX_TRANSCEIVER_BIAS_EN ); -writel (drvr1_en, qphy->dp_tx2 +QSERDES_V4_TX_HIGHZ_DRVR_EN ); -writel (bias1_en, qphy->dp_tx2 +QSERDES_V4_TX_TRANSCEIVER_BIAS_EN ); +writel (drvr0_en, qmp->dp_tx +QSERDES_V4_TX_HIGHZ_DRVR_EN ); +writel (bias0_en, qmp->dp_tx +QSERDES_V4_TX_TRANSCEIVER_BIAS_EN ); +writel (drvr1_en, qmp->dp_tx2 +QSERDES_V4_TX_HIGHZ_DRVR_EN ); +writel (bias1_en, qmp->dp_tx2 +QSERDES_V4_TX_TRANSCEIVER_BIAS_EN ); -writel (0x18 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x18 , qmp->dp_pcs +QSERDES_DP_PHY_CFG );udelay (2000 ); -writel (0x19 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x19 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); -if (readl_poll_timeout (qphy->dp_pcs +QSERDES_V4_DP_PHY_STATUS , +if (readl_poll_timeout (qmp->dp_pcs +QSERDES_V4_DP_PHY_STATUS , status, ((status &BIT (1 )) >0 ),500 ,10000 ))return -ETIMEDOUT ; -writel (0x0a , qphy->dp_tx +QSERDES_V4_TX_TX_POL_INV ); -writel (0x0a , qphy->dp_tx2 +QSERDES_V4_TX_TX_POL_INV ); +writel (0x0a , qmp->dp_tx +QSERDES_V4_TX_TX_POL_INV ); +writel (0x0a , qmp->dp_tx2 +QSERDES_V4_TX_TX_POL_INV ); -writel (0x27 , qphy->dp_tx +QSERDES_V4_TX_TX_DRV_LVL ); -writel (0x27 , qphy->dp_tx2 +QSERDES_V4_TX_TX_DRV_LVL ); +writel (0x27 , qmp->dp_tx +QSERDES_V4_TX_TX_DRV_LVL ); +writel (0x27 , qmp->dp_tx2 +QSERDES_V4_TX_TX_DRV_LVL ); -writel (0x20 , qphy->dp_tx +QSERDES_V4_TX_TX_EMP_POST1_LVL ); -writel (0x20 , qphy->dp_tx2 +QSERDES_V4_TX_TX_EMP_POST1_LVL ); +writel (0x20 , qmp->dp_tx +QSERDES_V4_TX_TX_EMP_POST1_LVL ); +writel (0x20 , qmp->dp_tx2 +QSERDES_V4_TX_TX_EMP_POST1_LVL );return 0 ; } -static int qcom_qmp_v5_phy_configure_dp_phy (struct qmp_phy *qphy) +static int qcom_qmp_v5_phy_configure_dp_phy (struct qmp_combo *qmp) { -const struct phy_configure_opts_dp *dp_opts = &qphy->dp_opts; +const struct phy_configure_opts_dp *dp_opts = &qmp->dp_opts;u32 bias0_en, drvr0_en, bias1_en, drvr1_en;bool reverse = false;u32 status;int ret; - ret =qcom_qmp_v45_phy_configure_dp_phy (qphy); + ret =qcom_qmp_v45_phy_configure_dp_phy (qmp);if (ret <0 )return ret;
@@ -1733,30 +1697,30 @@ static int qcom_qmp_v5_phy_configure_dp_phy(struct qmp_phy *qphy) drvr1_en =0x10 ; } -writel (drvr0_en, qphy->dp_tx +QSERDES_V5_5NM_TX_HIGHZ_DRVR_EN ); -writel (bias0_en, qphy->dp_tx +QSERDES_V5_5NM_TX_TRANSCEIVER_BIAS_EN ); -writel (drvr1_en, qphy->dp_tx2 +QSERDES_V5_5NM_TX_HIGHZ_DRVR_EN ); -writel (bias1_en, qphy->dp_tx2 +QSERDES_V5_5NM_TX_TRANSCEIVER_BIAS_EN ); +writel (drvr0_en, qmp->dp_tx +QSERDES_V5_5NM_TX_HIGHZ_DRVR_EN ); +writel (bias0_en, qmp->dp_tx +QSERDES_V5_5NM_TX_TRANSCEIVER_BIAS_EN ); +writel (drvr1_en, qmp->dp_tx2 +QSERDES_V5_5NM_TX_HIGHZ_DRVR_EN ); +writel (bias1_en, qmp->dp_tx2 +QSERDES_V5_5NM_TX_TRANSCEIVER_BIAS_EN ); -writel (0x18 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x18 , qmp->dp_pcs +QSERDES_DP_PHY_CFG );udelay (2000 ); -writel (0x19 , qphy->dp_pcs +QSERDES_DP_PHY_CFG ); +writel (0x19 , qmp->dp_pcs +QSERDES_DP_PHY_CFG ); -if (readl_poll_timeout (qphy->dp_pcs +QSERDES_V4_DP_PHY_STATUS , +if (readl_poll_timeout (qmp->dp_pcs +QSERDES_V4_DP_PHY_STATUS , status, ((status &BIT (1 )) >0 ),500 ,10000 ))return -ETIMEDOUT ; -writel (0x0a , qphy->dp_tx +QSERDES_V5_5NM_TX_TX_POL_INV ); -writel (0x0a , qphy->dp_tx2 +QSERDES_V5_5NM_TX_TX_POL_INV ); +writel (0x0a , qmp->dp_tx +QSERDES_V5_5NM_TX_TX_POL_INV ); +writel (0x0a , qmp->dp_tx2 +QSERDES_V5_5NM_TX_TX_POL_INV ); -writel (0x27 , qphy->dp_tx +QSERDES_V5_5NM_TX_TX_DRV_LVL ); -writel (0x27 , qphy->dp_tx2 +QSERDES_V5_5NM_TX_TX_DRV_LVL ); +writel (0x27 , qmp->dp_tx +QSERDES_V5_5NM_TX_TX_DRV_LVL ); +writel (0x27 , qmp->dp_tx2 +QSERDES_V5_5NM_TX_TX_DRV_LVL ); -writel (0x20 , qphy->dp_tx +QSERDES_V5_5NM_TX_TX_EMP_POST1_LVL ); -writel (0x20 , qphy->dp_tx2 +QSERDES_V5_5NM_TX_TX_EMP_POST1_LVL ); +writel (0x20 , qmp->dp_tx +QSERDES_V5_5NM_TX_TX_EMP_POST1_LVL ); +writel (0x20 , qmp->dp_tx2 +QSERDES_V5_5NM_TX_TX_EMP_POST1_LVL );return 0 ; }
@@ -1765,16 +1729,16 @@ static int qcom_qmp_v5_phy_configure_dp_phy(struct qmp_phy *qphy)* We need to calibrate the aux setting here as many times * as the caller tries */ -static int qcom_qmp_v4_dp_phy_calibrate (struct qmp_phy *qphy) +static int qcom_qmp_v4_dp_phy_calibrate (struct qmp_combo *qmp) {static const u8 cfg1_settings[] = {0x20 ,0x13 ,0x23 ,0x1d };u8 val; - qphy->dp_aux_cfg++; - qphy->dp_aux_cfg %=ARRAY_SIZE (cfg1_settings); - val = cfg1_settings[qphy->dp_aux_cfg]; + qmp->dp_aux_cfg++; + qmp->dp_aux_cfg %=ARRAY_SIZE (cfg1_settings); + val = cfg1_settings[qmp->dp_aux_cfg]; -writel (val, qphy->dp_pcs +QSERDES_DP_PHY_AUX_CFG1 ); +writel (val, qmp->dp_pcs +QSERDES_DP_PHY_AUX_CFG1 );return 0 ; }
@@ -1782,13 +1746,13 @@ static int qcom_qmp_v4_dp_phy_calibrate(struct qmp_phy *qphy)static int qmp_combo_dp_configure (struct phy *phy,union phy_configure_opts *opts) {const struct phy_configure_opts_dp *dp_opts = &opts->dp; -struct qmp_phy *qphy =phy_get_drvdata (phy); -const struct qmp_phy_cfg *cfg = qphy->cfg; +struct qmp_combo *qmp =phy_get_drvdata (phy); +const struct qmp_phy_cfg *cfg = qmp->cfg; -memcpy (&qphy->dp_opts, dp_opts,sizeof (*dp_opts)); -if (qphy->dp_opts.set_voltages) { - cfg->configure_dp_tx (qphy); - qphy->dp_opts.set_voltages =0 ; +memcpy (&qmp->dp_opts, dp_opts,sizeof (*dp_opts)); +if (qmp->dp_opts.set_voltages) { + cfg->configure_dp_tx (qmp); + qmp->dp_opts.set_voltages =0 ; }return 0 ;
@@ -1796,20 +1760,18 @@ static int qmp_combo_dp_configure(struct phy *phy, union phy_configure_opts *optstatic int qmp_combo_dp_calibrate (struct phy *phy) { -struct qmp_phy *qphy =phy_get_drvdata (phy); -const struct qmp_phy_cfg *cfg = qphy->cfg; +struct qmp_combo *qmp =phy_get_drvdata (phy); +const struct qmp_phy_cfg *cfg = qmp->cfg;if (cfg->calibrate_dp_phy) -return cfg->calibrate_dp_phy (qphy); +return cfg->calibrate_dp_phy (qmp);return 0 ; } -static int qmp_combo_com_init (struct qmp_phy *qphy) +static int qmp_combo_com_init (struct qmp_combo *qmp) { -struct qcom_qmp *qmp = qphy->qmp; -struct qmp_phy *usb_phy = qmp->usb_phy; -const struct qmp_phy_cfg *cfg = usb_phy->cfg; +const struct qmp_phy_cfg *cfg = qmp->cfg;void __iomem *dp_com = qmp->dp_com;int ret;
@@ -1861,7 +1823,7 @@ static int qmp_combo_com_init(struct qmp_phy *qphy)qphy_clrbits (dp_com,QPHY_V3_DP_COM_SWI_CTRL ,0x03 );qphy_clrbits (dp_com,QPHY_V3_DP_COM_SW_RESET ,SW_RESET ); -qphy_setbits (usb_phy->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL ], +qphy_setbits (qmp->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL ],SW_PWRDN );mutex_unlock (&qmp->phy_mutex);
@@ -1878,11 +1840,9 @@ static int qmp_combo_com_init(struct qmp_phy *qphy)return ret; } -static int qmp_combo_com_exit (struct qmp_phy *qphy) +static int qmp_combo_com_exit (struct qmp_combo *qmp) { -struct qcom_qmp *qmp = qphy->qmp; -struct qmp_phy *usb_phy = qmp->usb_phy; -const struct qmp_phy_cfg *cfg = usb_phy->cfg; +const struct qmp_phy_cfg *cfg = qmp->cfg;mutex_lock (&qmp->phy_mutex);if (--qmp->init_count) {
@@ -1903,77 +1863,76 @@ static int qmp_combo_com_exit(struct qmp_phy *qphy)static int qmp_combo_dp_init (struct phy *phy) { -struct qmp_phy *qphy =phy_get_drvdata (phy); -const struct qmp_phy_cfg *cfg = qphy->cfg; +struct qmp_combo *qmp =phy_get_drvdata (phy); +const struct qmp_phy_cfg *cfg = qmp->cfg;int ret; - ret =qmp_combo_com_init (qphy); + ret =qmp_combo_com_init (qmp);if (ret)return ret; - cfg->dp_aux_init (qphy); + cfg->dp_aux_init (qmp);return 0 ; }static int qmp_combo_dp_exit (struct phy *phy) { -struct qmp_phy *qphy =phy_get_drvdata (phy); +struct qmp_combo *qmp =phy_get_drvdata (phy); -qmp_combo_com_exit (qphy); +qmp_combo_com_exit (qmp);return 0 ; }static int qmp_combo_dp_power_on (struct phy *phy) { -struct qmp_phy *qphy =phy_get_drvdata (phy); -const struct qmp_phy_cfg *cfg = qphy->cfg; -void __iomem *tx = qphy->dp_tx; -void __iomem *tx2 = qphy->dp_tx2; +struct qmp_combo *qmp =phy_get_drvdata (phy); +const struct qmp_phy_cfg *cfg = qmp->cfg; +void __iomem *tx = qmp->dp_tx; +void __iomem *tx2 = qmp->dp_tx2; -qmp_combo_dp_serdes_init (qphy); +qmp_combo_dp_serdes_init (qmp);qmp_combo_configure_lane (tx, cfg->dp_tx_tbl, cfg->dp_tx_tbl_num,1 );qmp_combo_configure_lane (tx2, cfg->dp_tx_tbl, cfg->dp_tx_tbl_num,2 );/* Configure special DP tx tunings */ - cfg->configure_dp_tx (qphy); + cfg->configure_dp_tx (qmp);/* Configure link rate, swing, etc. */ - cfg->configure_dp_phy (qphy); + cfg->configure_dp_phy (qmp);return 0 ; }static int qmp_combo_dp_power_off (struct phy *phy) { -struct qmp_phy *qphy =phy_get_drvdata (phy); +struct qmp_combo *qmp =phy_get_drvdata (phy);/* Assert DP PHY power down */ -writel (DP_PHY_PD_CTL_PSR_PWRDN , qphy->dp_pcs +QSERDES_DP_PHY_PD_CTL ); +writel (DP_PHY_PD_CTL_PSR_PWRDN , qmp->dp_pcs +QSERDES_DP_PHY_PD_CTL );return 0 ; }static int qmp_combo_usb_power_on (struct phy *phy) { -struct qmp_phy *qphy =phy_get_drvdata (phy); -struct qcom_qmp *qmp = qphy->qmp; -const struct qmp_phy_cfg *cfg = qphy->cfg; -void __iomem *serdes = qphy->serdes; -void __iomem *tx = qphy->tx; -void __iomem *rx = qphy->rx; -void __iomem *tx2 = qphy->tx2; -void __iomem *rx2 = qphy->rx2; -void __iomem *pcs = qphy->pcs; +struct qmp_combo *qmp =phy_get_drvdata (phy); +const struct qmp_phy_cfg *cfg = qmp->cfg; +void __iomem *serdes = qmp->serdes; +void __iomem *tx = qmp->tx; +void __iomem *rx = qmp->rx; +void __iomem *tx2 = qmp->tx2; +void __iomem *rx2 = qmp->rx2; +void __iomem *pcs = qmp->pcs;void __iomem *status;unsigned int val;int ret;qmp_combo_configure (serdes, cfg->serdes_tbl, cfg->serdes_tbl_num); - ret =clk_prepare_enable (qphy->pipe_clk); + ret =clk_prepare_enable (qmp->pipe_clk);if (ret) {dev_err (qmp->dev,"pipe_clk enable failed err=%d\n" , ret);return ret;
@@ -2008,27 +1967,27 @@ static int qmp_combo_usb_power_on(struct phy *phy)return 0 ; err_disable_pipe_clk: -clk_disable_unprepare (qphy->pipe_clk); +clk_disable_unprepare (qmp->pipe_clk);return ret; }static int qmp_combo_usb_power_off (struct phy *phy) { -struct qmp_phy *qphy =phy_get_drvdata (phy); -const struct qmp_phy_cfg *cfg = qphy->cfg; +struct qmp_combo *qmp =phy_get_drvdata (phy); +const struct qmp_phy_cfg *cfg = qmp->cfg; -clk_disable_unprepare (qphy->pipe_clk); +clk_disable_unprepare (qmp->pipe_clk);/* PHY reset */ -qphy_setbits (qphy->pcs, cfg->regs[QPHY_SW_RESET ],SW_RESET ); +qphy_setbits (qmp->pcs, cfg->regs[QPHY_SW_RESET ],SW_RESET );/* stop SerDes and Phy-Coding-Sublayer */ -qphy_clrbits (qphy->pcs, cfg->regs[QPHY_START_CTRL ], +qphy_clrbits (qmp->pcs, cfg->regs[QPHY_START_CTRL ],SERDES_START |PCS_START );/* Put PHY into POWER DOWN state: active low */ -qphy_clrbits (qphy->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL ], +qphy_clrbits (qmp->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL ],SW_PWRDN );return 0 ;
@@ -2036,37 +1995,37 @@ static int qmp_combo_usb_power_off(struct phy *phy)static int qmp_combo_usb_init (struct phy *phy) { -struct qmp_phy *qphy =phy_get_drvdata (phy); +struct qmp_combo *qmp =phy_get_drvdata (phy);int ret; - ret =qmp_combo_com_init (qphy); + ret =qmp_combo_com_init (qmp);if (ret)return ret; ret =qmp_combo_usb_power_on (phy);if (ret) -qmp_combo_com_exit (qphy); +qmp_combo_com_exit (qmp);return ret; }static int qmp_combo_usb_exit (struct phy *phy) { -struct qmp_phy *qphy =phy_get_drvdata (phy); +struct qmp_combo *qmp =phy_get_drvdata (phy);int ret; ret =qmp_combo_usb_power_off (phy);if (ret)return ret; -return qmp_combo_com_exit (qphy); +return qmp_combo_com_exit (qmp); }static int qmp_combo_usb_set_mode (struct phy *phy,enum phy_mode mode,int submode) { -struct qmp_phy *qphy =phy_get_drvdata (phy); +struct qmp_combo *qmp =phy_get_drvdata (phy); - qphy->mode = mode; + qmp->mode = mode;return 0 ; }
@@ -2088,15 +2047,15 @@ static const struct phy_ops qmp_combo_dp_phy_ops = { .owner = THIS_MODULE, }; -static void qmp_combo_enable_autonomous_mode (struct qmp_phy *qphy) +static void qmp_combo_enable_autonomous_mode (struct qmp_combo *qmp) { -const struct qmp_phy_cfg *cfg = qphy->cfg; -void __iomem *pcs_usb = qphy->pcs_usb ?: qphy->pcs; -void __iomem *pcs_misc = qphy->pcs_misc; +const struct qmp_phy_cfg *cfg = qmp->cfg; +void __iomem *pcs_usb = qmp->pcs_usb ?: qmp->pcs; +void __iomem *pcs_misc = qmp->pcs_misc;u32 intr_mask; -if (qphy->mode ==PHY_MODE_USB_HOST_SS || - qphy->mode ==PHY_MODE_USB_DEVICE_SS ) +if (qmp->mode ==PHY_MODE_USB_HOST_SS || + qmp->mode ==PHY_MODE_USB_DEVICE_SS ) intr_mask =ARCVR_DTCT_EN |ALFPS_DTCT_EN ;else intr_mask =ARCVR_DTCT_EN |ARCVR_DTCT_EVENT_SEL ;
@@ -2117,11 +2076,11 @@ static void qmp_combo_enable_autonomous_mode(struct qmp_phy *qphy)qphy_clrbits (pcs_misc,QPHY_V3_PCS_MISC_CLAMP_ENABLE ,CLAMP_EN ); } -static void qmp_combo_disable_autonomous_mode (struct qmp_phy *qphy) +static void qmp_combo_disable_autonomous_mode (struct qmp_combo *qmp) { -const struct qmp_phy_cfg *cfg = qphy->cfg; -void __iomem *pcs_usb = qphy->pcs_usb ?: qphy->pcs; -void __iomem *pcs_misc = qphy->pcs_misc; +const struct qmp_phy_cfg *cfg = qmp->cfg; +void __iomem *pcs_usb = qmp->pcs_usb ?: qmp->pcs; +void __iomem *pcs_misc = qmp->pcs_misc;/* Disable i/o clamp_n on resume for normal mode */ if (pcs_misc)
@@ -2137,20 +2096,19 @@ static void qmp_combo_disable_autonomous_mode(struct qmp_phy *qphy)static int __maybe_unused qmp_combo_runtime_suspend (struct device *dev) { -struct qcom_qmp *qmp =dev_get_drvdata (dev); -struct qmp_phy *qphy = qmp->usb_phy; -const struct qmp_phy_cfg *cfg = qphy->cfg; +struct qmp_combo *qmp =dev_get_drvdata (dev); +const struct qmp_phy_cfg *cfg = qmp->cfg; -dev_vdbg (dev,"Suspending QMP phy, mode:%d\n" , qphy->mode); +dev_vdbg (dev,"Suspending QMP phy, mode:%d\n" , qmp->mode);if (!qmp->init_count) {dev_vdbg (dev,"PHY not initialized, bailing out\n" );return 0 ; } -qmp_combo_enable_autonomous_mode (qphy); +qmp_combo_enable_autonomous_mode (qmp); -clk_disable_unprepare (qphy->pipe_clk); +clk_disable_unprepare (qmp->pipe_clk);clk_bulk_disable_unprepare (cfg->num_clks, qmp->clks);return 0 ;
@@ -2158,12 +2116,11 @@ static int __maybe_unused qmp_combo_runtime_suspend(struct device *dev)static int __maybe_unused qmp_combo_runtime_resume (struct device *dev) { -struct qcom_qmp *qmp =dev_get_drvdata (dev); -struct qmp_phy *qphy = qmp->usb_phy; -const struct qmp_phy_cfg *cfg = qphy->cfg; +struct qmp_combo *qmp =dev_get_drvdata (dev); +const struct qmp_phy_cfg *cfg = qmp->cfg;int ret =0 ; -dev_vdbg (dev,"Resuming QMP phy, mode:%d\n" , qphy->mode); +dev_vdbg (dev,"Resuming QMP phy, mode:%d\n" , qmp->mode);if (!qmp->init_count) {dev_vdbg (dev,"PHY not initialized, bailing out\n" );
@@ -2174,14 +2131,14 @@ static int __maybe_unused qmp_combo_runtime_resume(struct device *dev)if (ret)return ret; - ret =clk_prepare_enable (qphy->pipe_clk); + ret =clk_prepare_enable (qmp->pipe_clk);if (ret) {dev_err (dev,"pipe_clk enable failed, err=%d\n" , ret);clk_bulk_disable_unprepare (cfg->num_clks, qmp->clks);return ret; } -qmp_combo_disable_autonomous_mode (qphy); +qmp_combo_disable_autonomous_mode (qmp);return 0 ; }
@@ -2193,7 +2150,7 @@ static const struct dev_pm_ops qmp_combo_pm_ops = {static int qmp_combo_vreg_init (struct device *dev,const struct qmp_phy_cfg *cfg) { -struct qcom_qmp *qmp =dev_get_drvdata (dev); +struct qmp_combo *qmp =dev_get_drvdata (dev);int num = cfg->num_vregs;int ret, i;
@@ -2225,7 +2182,7 @@ static int qmp_combo_vreg_init(struct device *dev, const struct qmp_phy_cfg *cfgstatic int qmp_combo_reset_init (struct device *dev,const struct qmp_phy_cfg *cfg) { -struct qcom_qmp *qmp =dev_get_drvdata (dev); +struct qmp_combo *qmp =dev_get_drvdata (dev);int i;int ret;
@@ -2246,7 +2203,7 @@ static int qmp_combo_reset_init(struct device *dev, const struct qmp_phy_cfg *cfstatic int qmp_combo_clk_init (struct device *dev,const struct qmp_phy_cfg *cfg) { -struct qcom_qmp *qmp =dev_get_drvdata (dev); +struct qmp_combo *qmp =dev_get_drvdata (dev);int num = cfg->num_clks;int i;
@@ -2283,7 +2240,7 @@ static void phy_clk_release_provider(void *res)* clk | +-------+ | +-----+ * +---------------+ */ -static int phy_pipe_clk_register (struct qcom_qmp *qmp,struct device_node *np) +static int phy_pipe_clk_register (struct qmp_combo *qmp,struct device_node *np) {struct clk_fixed_rate *fixed;struct clk_init_data init = { };
@@ -2386,12 +2343,12 @@ static unsigned long qcom_qmp_dp_pixel_clk_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) { const struct qmp_phy_dp_clks *dp_clks; -const struct qmp_phy *qphy; +const struct qmp_combo *qmp;const struct phy_configure_opts_dp *dp_opts; dp_clks = container_of(hw, struct qmp_phy_dp_clks, dp_pixel_hw); - qphy = dp_clks->qphy; - dp_opts = &qphy->dp_opts; + qmp = dp_clks->qmp; + dp_opts = &qmp->dp_opts;switch (dp_opts->link_rate) {case 1620 :
@@ -2430,12 +2387,12 @@ static unsigned long qcom_qmp_dp_link_clk_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) { const struct qmp_phy_dp_clks *dp_clks; -const struct qmp_phy *qphy; +const struct qmp_combo *qmp;const struct phy_configure_opts_dp *dp_opts; dp_clks = container_of(hw, struct qmp_phy_dp_clks, dp_link_hw); - qphy = dp_clks->qphy; - dp_opts = &qphy->dp_opts; + qmp = dp_clks->qmp; + dp_opts = &qmp->dp_opts;switch (dp_opts->link_rate) {case 1620 :
@@ -2470,8 +2427,7 @@ qcom_qmp_dp_clks_hw_get(struct of_phandle_args *clkspec, void *data)return &dp_clks->dp_pixel_hw; } -static int phy_dp_clks_register (struct qcom_qmp *qmp,struct qmp_phy *qphy, -struct device_node *np) +static int phy_dp_clks_register (struct qmp_combo *qmp,struct device_node *np) {struct clk_init_data init = { };struct qmp_phy_dp_clks *dp_clks;
@@ -2482,8 +2438,8 @@ static int phy_dp_clks_register(struct qcom_qmp *qmp, struct qmp_phy *qphy,if (!dp_clks)return -ENOMEM ; - dp_clks->qphy = qphy; - qphy->dp_clks = dp_clks; + dp_clks->qmp = qmp; + qmp->dp_clks = dp_clks;snprintf (name,sizeof (name),"%s::link_clk" ,dev_name (qmp->dev)); init.ops = &qcom_qmp_dp_link_clk_ops;
@@ -2512,20 +2468,15 @@ static int phy_dp_clks_register(struct qcom_qmp *qmp, struct qmp_phy *qphy,return devm_add_action_or_reset (qmp->dev, phy_clk_release_provider, np); } -static int qmp_combo_create_dp (struct device *dev,struct device_node *np,int id, +static int qmp_combo_create_dp (struct device *dev,struct device_node *np,void __iomem *serdes,const struct qmp_phy_cfg *cfg) { -struct qcom_qmp *qmp =dev_get_drvdata (dev); +struct qmp_combo *qmp =dev_get_drvdata (dev);struct phy *generic_phy; -struct qmp_phy *qphy;int ret; - qphy =devm_kzalloc (dev,sizeof (*qphy),GFP_KERNEL ); -if (!qphy) -return -ENOMEM ; - - qphy->cfg = cfg; - qphy->dp_serdes = serdes; + qmp->cfg = cfg; + qmp->dp_serdes = serdes;/* * Get memory resources from the DP child node: * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2;
@@ -2533,17 +2484,17 @@ static int qmp_combo_create_dp(struct device *dev, struct device_node *np, int i* * Note that only tx/tx2 and pcs are used by the DP implementation. */ - qphy->dp_tx =devm_of_iomap (dev, np,0 ,NULL ); -if (IS_ERR (qphy->dp_tx)) -return PTR_ERR (qphy->dp_tx); + qmp->dp_tx =devm_of_iomap (dev, np,0 ,NULL ); +if (IS_ERR (qmp->dp_tx)) +return PTR_ERR (qmp->dp_tx); - qphy->dp_pcs =devm_of_iomap (dev, np,2 ,NULL ); -if (IS_ERR (qphy->dp_pcs)) -return PTR_ERR (qphy->dp_pcs); + qmp->dp_pcs =devm_of_iomap (dev, np,2 ,NULL ); +if (IS_ERR (qmp->dp_pcs)) +return PTR_ERR (qmp->dp_pcs); - qphy->dp_tx2 =devm_of_iomap (dev, np,3 ,NULL ); -if (IS_ERR (qphy->dp_tx2)) -return PTR_ERR (qphy->dp_tx2); + qmp->dp_tx2 =devm_of_iomap (dev, np,3 ,NULL ); +if (IS_ERR (qmp->dp_tx2)) +return PTR_ERR (qmp->dp_tx2); generic_phy =devm_phy_create (dev, np, &qmp_combo_dp_phy_ops);if (IS_ERR (generic_phy)) {
@@ -2552,66 +2503,59 @@ static int qmp_combo_create_dp(struct device *dev, struct device_node *np, int ireturn ret; } - qphy->phy = generic_phy; - qphy->qmp = qmp; - qmp->phys[id] = qphy; -phy_set_drvdata (generic_phy, qphy); + qmp->dp_phy = generic_phy; +phy_set_drvdata (generic_phy, qmp);return 0 ; } -static int qmp_combo_create_usb (struct device *dev,struct device_node *np,int id, +static int qmp_combo_create_usb (struct device *dev,struct device_node *np,void __iomem *serdes,const struct qmp_phy_cfg *cfg) { -struct qcom_qmp *qmp =dev_get_drvdata (dev); +struct qmp_combo *qmp =dev_get_drvdata (dev);struct phy *generic_phy; -struct qmp_phy *qphy;int ret; - qphy =devm_kzalloc (dev,sizeof (*qphy),GFP_KERNEL ); -if (!qphy) -return -ENOMEM ; - - qphy->cfg = cfg; - qphy->serdes = serdes; + qmp->cfg = cfg; + qmp->serdes = serdes;/* * Get memory resources from the USB child node: * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2; * tx2 -> 3; rx2 -> 4; pcs_misc (optional) -> 5 */ - qphy->tx =devm_of_iomap (dev, np,0 ,NULL ); -if (IS_ERR (qphy->tx)) -return PTR_ERR (qphy->tx); + qmp->tx =devm_of_iomap (dev, np,0 ,NULL ); +if (IS_ERR (qmp->tx)) +return PTR_ERR (qmp->tx); - qphy->rx =devm_of_iomap (dev, np,1 ,NULL ); -if (IS_ERR (qphy->rx)) -return PTR_ERR (qphy->rx); + qmp->rx =devm_of_iomap (dev, np,1 ,NULL ); +if (IS_ERR (qmp->rx)) +return PTR_ERR (qmp->rx); - qphy->pcs =devm_of_iomap (dev, np,2 ,NULL ); -if (IS_ERR (qphy->pcs)) -return PTR_ERR (qphy->pcs); + qmp->pcs =devm_of_iomap (dev, np,2 ,NULL ); +if (IS_ERR (qmp->pcs)) +return PTR_ERR (qmp->pcs);if (cfg->pcs_usb_offset) - qphy->pcs_usb = qphy->pcs + cfg->pcs_usb_offset; + qmp->pcs_usb = qmp->pcs + cfg->pcs_usb_offset; - qphy->tx2 =devm_of_iomap (dev, np,3 ,NULL ); -if (IS_ERR (qphy->tx2)) -return PTR_ERR (qphy->tx2); + qmp->tx2 =devm_of_iomap (dev, np,3 ,NULL ); +if (IS_ERR (qmp->tx2)) +return PTR_ERR (qmp->tx2); - qphy->rx2 =devm_of_iomap (dev, np,4 ,NULL ); -if (IS_ERR (qphy->rx2)) -return PTR_ERR (qphy->rx2); + qmp->rx2 =devm_of_iomap (dev, np,4 ,NULL ); +if (IS_ERR (qmp->rx2)) +return PTR_ERR (qmp->rx2); - qphy->pcs_misc =devm_of_iomap (dev, np,5 ,NULL ); -if (IS_ERR (qphy->pcs_misc)) { + qmp->pcs_misc =devm_of_iomap (dev, np,5 ,NULL ); +if (IS_ERR (qmp->pcs_misc)) {dev_vdbg (dev,"PHY pcs_misc-reg not used\n" ); - qphy->pcs_misc =NULL ; + qmp->pcs_misc =NULL ; } - qphy->pipe_clk =devm_get_clk_from_child (dev, np,NULL ); -if (IS_ERR (qphy->pipe_clk)) { -return dev_err_probe (dev,PTR_ERR (qphy->pipe_clk), -"failed to get lane%d pipe_clk\n" , id); + qmp->pipe_clk =devm_get_clk_from_child (dev, np,NULL ); +if (IS_ERR (qmp->pipe_clk)) { +return dev_err_probe (dev,PTR_ERR (qmp->pipe_clk), +"failed to get pipe clock\n" ); } generic_phy =devm_phy_create (dev, np, &qmp_combo_usb_phy_ops);
@@ -2621,17 +2565,15 @@ static int qmp_combo_create_usb(struct device *dev, struct device_node *np, intreturn ret; } - qphy->phy = generic_phy; - qphy->qmp = qmp; - qmp->phys[id] = qphy; -phy_set_drvdata (generic_phy, qphy); + qmp->usb_phy = generic_phy; +phy_set_drvdata (generic_phy, qmp);return 0 ; }static int qmp_combo_probe (struct platform_device *pdev) { -struct qcom_qmp *qmp; +struct qmp_combo *qmp;struct device *dev = &pdev->dev;struct device_node *child;struct phy_provider *phy_provider;
@@ -2686,10 +2628,6 @@ static int qmp_combo_probe(struct platform_device *pdev)if (num > expected_phys)return -EINVAL ; - qmp->phys =devm_kcalloc (dev, num,sizeof (*qmp->phys),GFP_KERNEL ); -if (!qmp->phys) -return -ENOMEM ; -pm_runtime_set_active (dev); ret =devm_pm_runtime_enable (dev);if (ret)
@@ -2706,14 +2644,14 @@ static int qmp_combo_probe(struct platform_device *pdev) serdes = dp_serdes;/* Create per-lane phy */ - ret =qmp_combo_create_dp (dev, child, id, serdes, cfg); + ret =qmp_combo_create_dp (dev, child, serdes, cfg);if (ret) {dev_err (dev,"failed to create lane%d phy, %d\n" , id, ret); goto err_node_put; } - ret =phy_dp_clks_register (qmp, qmp->phys[id], child); + ret =phy_dp_clks_register (qmp, child);if (ret) {dev_err (qmp->dev,"failed to register DP clock source\n" );
@@ -2723,15 +2661,13 @@ static int qmp_combo_probe(struct platform_device *pdev) serdes = usb_serdes;/* Create per-lane phy */ - ret =qmp_combo_create_usb (dev, child, id, serdes, cfg); + ret =qmp_combo_create_usb (dev, child, serdes, cfg);if (ret) {dev_err (dev,"failed to create lane%d phy, %d\n" , id, ret); goto err_node_put; } - qmp->usb_phy = qmp->phys[id]; -/* * Register the pipe clock provided by phy. * See function description to see details of this pipe clock.
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v2 20/22 phy: qcom-qmp-combo: clean up device-tree parsing
In reply to Johan HovoldSince the QMP driver split there will be precisely two child nodes so drop the obsolete iteration construct.
While at it, drop the verbose error logging that would have been printed also on probe deferrals.
Note that there is no need to check if there are additional child nodes (the kernel is not a devicetree validator), but let's return an error if either child node is missing.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 82 ++++++++--------------- 1 file changed, 28 insertions(+), 54 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +28 -54
@@ -2575,13 +2575,12 @@ static int qmp_combo_probe(struct platform_device *pdev) {struct qmp_combo *qmp;struct device *dev = &pdev->dev; -struct device_node *child; +struct device_node *dp_np, *usb_np;struct phy_provider *phy_provider;void __iomem *serdes;void __iomem *usb_serdes;void __iomem *dp_serdes =NULL ;const struct qmp_phy_cfg *cfg =NULL ; -int num, id, expected_phys;int ret; qmp =devm_kzalloc (dev,sizeof (*qmp),GFP_KERNEL );
@@ -2607,8 +2606,6 @@ static int qmp_combo_probe(struct platform_device *pdev)if (IS_ERR (dp_serdes))return PTR_ERR (dp_serdes); - expected_phys =2 ; -mutex_init (&qmp->phy_mutex); ret =qmp_combo_clk_init (dev, cfg);
@@ -2623,75 +2620,52 @@ static int qmp_combo_probe(struct platform_device *pdev)if (ret)return ret; - num =of_get_available_child_count (dev->of_node); -/* do we have a rogue child node ? */ -if (num > expected_phys) + usb_np =of_get_child_by_name (dev->of_node,"usb3-phy" ); +if (!usb_np) +return -EINVAL ; + + dp_np =of_get_child_by_name (dev->of_node,"dp-phy" ); +if (!dp_np) { +of_node_put (usb_np);return -EINVAL ; + }pm_runtime_set_active (dev); ret =devm_pm_runtime_enable (dev);if (ret) -return ret; + goto err_node_put;/* * Prevent runtime pm from being ON by default. Users can enable * it using power/control in sysfs. */ pm_runtime_forbid (dev); - id =0 ; -for_each_available_child_of_node (dev->of_node, child) { -if (of_node_name_eq (child,"dp-phy" )) { - serdes = dp_serdes; - -/* Create per-lane phy */ - ret =qmp_combo_create_dp (dev, child, serdes, cfg); -if (ret) { -dev_err (dev,"failed to create lane%d phy, %d\n" , - id, ret); - goto err_node_put; - } - - ret =phy_dp_clks_register (qmp, child); -if (ret) { -dev_err (qmp->dev, -"failed to register DP clock source\n" ); - goto err_node_put; - } - }else if (of_node_name_eq (child,"usb3-phy" )) { - serdes = usb_serdes; - -/* Create per-lane phy */ - ret =qmp_combo_create_usb (dev, child, serdes, cfg); -if (ret) { -dev_err (dev,"failed to create lane%d phy, %d\n" , - id, ret); - goto err_node_put; - } - -/* -* Register the pipe clock provided by phy. -* See function description to see details of this pipe clock. -*/ - ret =phy_pipe_clk_register (qmp, child); -if (ret) { -dev_err (qmp->dev, -"failed to register pipe clock source\n" ); - goto err_node_put; - } - } + ret =qmp_combo_create_usb (dev, usb_np, usb_serdes, cfg); +if (ret) + goto err_node_put; - id++; - } + ret =phy_pipe_clk_register (qmp, usb_np); +if (ret) + goto err_node_put; -if (!qmp->usb_phy) -return -EINVAL ; + ret =qmp_combo_create_dp (dev, dp_np, dp_serdes, cfg); +if (ret) + goto err_node_put; + + ret =phy_dp_clks_register (qmp, dp_np); +if (ret) + goto err_node_put; phy_provider =devm_of_phy_provider_register (dev, of_phy_simple_xlate); +of_node_put (usb_np); +of_node_put (dp_np); +return PTR_ERR_OR_ZERO (phy_provider); err_node_put: -of_node_put (child); +of_node_put (usb_np); +of_node_put (dp_np);return ret; }
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v2 21/22 phy: qcom-qmp-combo: clean up probe initialisation
In reply to Johan HovoldStop abusing the driver data pointer and instead pass the driver state structure directly to the initialisation helpers during probe.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 61 ++++++++++------------- 1 file changed, 27 insertions(+), 34 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +27 -34
@@ -2148,9 +2148,10 @@ static const struct dev_pm_ops qmp_combo_pm_ops = { qmp_combo_runtime_resume, NULL) }; -static int qmp_combo_vreg_init (struct device *dev,const struct qmp_phy_cfg *cfg) +static int qmp_combo_vreg_init (struct qmp_combo *qmp) { -struct qmp_combo *qmp =dev_get_drvdata (dev); +const struct qmp_phy_cfg *cfg = qmp->cfg; +struct device *dev = qmp->dev;int num = cfg->num_vregs;int ret, i;
@@ -2180,9 +2181,10 @@ static int qmp_combo_vreg_init(struct device *dev, const struct qmp_phy_cfg *cfgreturn 0 ; } -static int qmp_combo_reset_init (struct device *dev,const struct qmp_phy_cfg *cfg) +static int qmp_combo_reset_init (struct qmp_combo *qmp) { -struct qmp_combo *qmp =dev_get_drvdata (dev); +const struct qmp_phy_cfg *cfg = qmp->cfg; +struct device *dev = qmp->dev;int i;int ret;
@@ -2201,9 +2203,10 @@ static int qmp_combo_reset_init(struct device *dev, const struct qmp_phy_cfg *cfreturn 0 ; } -static int qmp_combo_clk_init (struct device *dev,const struct qmp_phy_cfg *cfg) +static int qmp_combo_clk_init (struct qmp_combo *qmp) { -struct qmp_combo *qmp =dev_get_drvdata (dev); +const struct qmp_phy_cfg *cfg = qmp->cfg; +struct device *dev = qmp->dev;int num = cfg->num_clks;int i;
@@ -2468,15 +2471,12 @@ static int phy_dp_clks_register(struct qmp_combo *qmp, struct device_node *np)return devm_add_action_or_reset (qmp->dev, phy_clk_release_provider, np); } -static int qmp_combo_create_dp (struct device *dev,struct device_node *np, -void __iomem *serdes,const struct qmp_phy_cfg *cfg) +static int qmp_combo_create_dp (struct qmp_combo *qmp,struct device_node *np) { -struct qmp_combo *qmp =dev_get_drvdata (dev); +struct device *dev = qmp->dev;struct phy *generic_phy;int ret; - qmp->cfg = cfg; - qmp->dp_serdes = serdes;/* * Get memory resources from the DP child node: * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2;
@@ -2509,15 +2509,13 @@ static int qmp_combo_create_dp(struct device *dev, struct device_node *np,return 0 ; } -static int qmp_combo_create_usb (struct device *dev,struct device_node *np, -void __iomem *serdes,const struct qmp_phy_cfg *cfg) +static int qmp_combo_create_usb (struct qmp_combo *qmp,struct device_node *np) { -struct qmp_combo *qmp =dev_get_drvdata (dev); +const struct qmp_phy_cfg *cfg = qmp->cfg; +struct device *dev = qmp->dev;struct phy *generic_phy;int ret; - qmp->cfg = cfg; - qmp->serdes = serdes;/* * Get memory resources from the USB child node: * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2;
@@ -2577,10 +2575,6 @@ static int qmp_combo_probe(struct platform_device *pdev)struct device *dev = &pdev->dev;struct device_node *dp_np, *usb_np;struct phy_provider *phy_provider; -void __iomem *serdes; -void __iomem *usb_serdes; -void __iomem *dp_serdes =NULL ; -const struct qmp_phy_cfg *cfg =NULL ;int ret; qmp =devm_kzalloc (dev,sizeof (*qmp),GFP_KERNEL );
@@ -2588,35 +2582,34 @@ static int qmp_combo_probe(struct platform_device *pdev)return -ENOMEM ; qmp->dev = dev; -dev_set_drvdata (dev, qmp); - cfg =of_device_get_match_data (dev); -if (!cfg) + qmp->cfg =of_device_get_match_data (dev); +if (!qmp->cfg)return -EINVAL ; - usb_serdes = serdes =devm_platform_ioremap_resource (pdev,0 ); -if (IS_ERR (serdes)) -return PTR_ERR (serdes); + qmp->serdes =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (qmp->serdes)) +return PTR_ERR (qmp->serdes); qmp->dp_com =devm_platform_ioremap_resource (pdev,1 );if (IS_ERR (qmp->dp_com))return PTR_ERR (qmp->dp_com); - dp_serdes =devm_platform_ioremap_resource (pdev,2 ); -if (IS_ERR (dp_serdes)) -return PTR_ERR (dp_serdes); + qmp->dp_serdes =devm_platform_ioremap_resource (pdev,2 ); +if (IS_ERR (qmp->dp_serdes)) +return PTR_ERR (qmp->dp_serdes);mutex_init (&qmp->phy_mutex); - ret =qmp_combo_clk_init (dev, cfg); + ret =qmp_combo_clk_init (qmp);if (ret)return ret; - ret =qmp_combo_reset_init (dev, cfg); + ret =qmp_combo_reset_init (qmp);if (ret)return ret; - ret =qmp_combo_vreg_init (dev, cfg); + ret =qmp_combo_vreg_init (qmp);if (ret)return ret;
@@ -2640,7 +2633,7 @@ static int qmp_combo_probe(struct platform_device *pdev)*/ pm_runtime_forbid (dev); - ret =qmp_combo_create_usb (dev, usb_np, usb_serdes, cfg); + ret =qmp_combo_create_usb (qmp, usb_np);if (ret) goto err_node_put;
@@ -2648,7 +2641,7 @@ static int qmp_combo_probe(struct platform_device *pdev)if (ret) goto err_node_put; - ret =qmp_combo_create_dp (dev, dp_np, dp_serdes, cfg); + ret =qmp_combo_create_dp (qmp, dp_np);if (ret) goto err_node_put;
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v2 22/22 phy: qcom-qmp-combo: clean up DP callback names
In reply to Johan HovoldClean up and unify the DP callbacks by dropping the redundant "qcom" and "phy" prefix and infix and by using a common naming scheme ("qmp" + version + callback name).
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 82 +++++++++++------------ 1 file changed, 41 insertions(+), 41 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +41 -41
@@ -903,17 +903,17 @@ struct qmp_combo {struct qmp_phy_dp_clks *dp_clks; }; -static void qcom_qmp_v3_phy_dp_aux_init (struct qmp_combo *qmp); -static void qcom_qmp_v3_phy_configure_dp_tx (struct qmp_combo *qmp); -static int qcom_qmp_v3_phy_configure_dp_phy (struct qmp_combo *qmp); -static int qcom_qmp_v3_dp_phy_calibrate (struct qmp_combo *qmp); +static void qmp_v3_dp_aux_init (struct qmp_combo *qmp); +static void qmp_v3_configure_dp_tx (struct qmp_combo *qmp); +static int qmp_v3_configure_dp_phy (struct qmp_combo *qmp); +static int qmp_v3_calibrate_dp_phy (struct qmp_combo *qmp); -static void qcom_qmp_v4_phy_dp_aux_init (struct qmp_combo *qmp); -static void qcom_qmp_v4_phy_configure_dp_tx (struct qmp_combo *qmp); -static int qcom_qmp_v4_phy_configure_dp_phy (struct qmp_combo *qmp); -static int qcom_qmp_v4_dp_phy_calibrate (struct qmp_combo *qmp); +static void qmp_v4_dp_aux_init (struct qmp_combo *qmp); +static void qmp_v4_configure_dp_tx (struct qmp_combo *qmp); +static int qmp_v4_configure_dp_phy (struct qmp_combo *qmp); +static int qmp_v4_calibrate_dp_phy (struct qmp_combo *qmp); -static int qcom_qmp_v5_phy_configure_dp_phy (struct qmp_combo *qmp); +static int qmp_v5_configure_dp_phy (struct qmp_combo *qmp);static inline void qphy_setbits (void __iomem *base,u32 offset,u32 val) {
@@ -991,10 +991,10 @@ static const struct qmp_phy_cfg sc7180_usb3dpphy_cfg = { .swing_hbr3_hbr2 = &qmp_dp_v3_voltage_swing_hbr3_hbr2, .pre_emphasis_hbr3_hbr2 = &qmp_dp_v3_pre_emphasis_hbr3_hbr2, - .dp_aux_init = qcom_qmp_v3_phy_dp_aux_init, - .configure_dp_tx = qcom_qmp_v3_phy_configure_dp_tx, - .configure_dp_phy = qcom_qmp_v3_phy_configure_dp_phy, - .calibrate_dp_phy = qcom_qmp_v3_dp_phy_calibrate, + .dp_aux_init = qmp_v3_dp_aux_init, + .configure_dp_tx = qmp_v3_configure_dp_tx, + .configure_dp_phy = qmp_v3_configure_dp_phy, + .calibrate_dp_phy = qmp_v3_calibrate_dp_phy, .clk_list = qmp_v3_phy_clk_l, .num_clks = ARRAY_SIZE(qmp_v3_phy_clk_l),
@@ -1036,10 +1036,10 @@ static const struct qmp_phy_cfg sdm845_usb3dpphy_cfg = { .swing_hbr3_hbr2 = &qmp_dp_v3_voltage_swing_hbr3_hbr2, .pre_emphasis_hbr3_hbr2 = &qmp_dp_v3_pre_emphasis_hbr3_hbr2, - .dp_aux_init = qcom_qmp_v3_phy_dp_aux_init, - .configure_dp_tx = qcom_qmp_v3_phy_configure_dp_tx, - .configure_dp_phy = qcom_qmp_v3_phy_configure_dp_phy, - .calibrate_dp_phy = qcom_qmp_v3_dp_phy_calibrate, + .dp_aux_init = qmp_v3_dp_aux_init, + .configure_dp_tx = qmp_v3_configure_dp_tx, + .configure_dp_phy = qmp_v3_configure_dp_phy, + .calibrate_dp_phy = qmp_v3_calibrate_dp_phy, .clk_list = qmp_v3_phy_clk_l, .num_clks = ARRAY_SIZE(qmp_v3_phy_clk_l),
@@ -1083,10 +1083,10 @@ static const struct qmp_phy_cfg sc8180x_usb3dpphy_cfg = { .swing_hbr3_hbr2 = &qmp_dp_v3_voltage_swing_hbr3_hbr2, .pre_emphasis_hbr3_hbr2 = &qmp_dp_v3_pre_emphasis_hbr3_hbr2, - .dp_aux_init = qcom_qmp_v4_phy_dp_aux_init, - .configure_dp_tx = qcom_qmp_v4_phy_configure_dp_tx, - .configure_dp_phy = qcom_qmp_v4_phy_configure_dp_phy, - .calibrate_dp_phy = qcom_qmp_v4_dp_phy_calibrate, + .dp_aux_init = qmp_v4_dp_aux_init, + .configure_dp_tx = qmp_v4_configure_dp_tx, + .configure_dp_phy = qmp_v4_configure_dp_phy, + .calibrate_dp_phy = qmp_v4_calibrate_dp_phy, .clk_list = qmp_v4_phy_clk_l, .num_clks = ARRAY_SIZE(qmp_v4_phy_clk_l),
@@ -1129,10 +1129,10 @@ static const struct qmp_phy_cfg sc8280xp_usb43dpphy_cfg = { .swing_hbr3_hbr2 = &qmp_dp_v5_voltage_swing_hbr3_hbr2, .pre_emphasis_hbr3_hbr2 = &qmp_dp_v5_pre_emphasis_hbr3_hbr2, - .dp_aux_init = qcom_qmp_v4_phy_dp_aux_init, - .configure_dp_tx = qcom_qmp_v4_phy_configure_dp_tx, - .configure_dp_phy = qcom_qmp_v5_phy_configure_dp_phy, - .calibrate_dp_phy = qcom_qmp_v4_dp_phy_calibrate, + .dp_aux_init = qmp_v4_dp_aux_init, + .configure_dp_tx = qmp_v4_configure_dp_tx, + .configure_dp_phy = qmp_v5_configure_dp_phy, + .calibrate_dp_phy = qmp_v4_calibrate_dp_phy, .clk_list = qmp_v4_phy_clk_l, .num_clks = ARRAY_SIZE(qmp_v4_phy_clk_l),
@@ -1175,10 +1175,10 @@ static const struct qmp_phy_cfg sm8250_usb3dpphy_cfg = { .swing_hbr3_hbr2 = &qmp_dp_v3_voltage_swing_hbr3_hbr2, .pre_emphasis_hbr3_hbr2 = &qmp_dp_v3_pre_emphasis_hbr3_hbr2, - .dp_aux_init = qcom_qmp_v4_phy_dp_aux_init, - .configure_dp_tx = qcom_qmp_v4_phy_configure_dp_tx, - .configure_dp_phy = qcom_qmp_v4_phy_configure_dp_phy, - .calibrate_dp_phy = qcom_qmp_v4_dp_phy_calibrate, + .dp_aux_init = qmp_v4_dp_aux_init, + .configure_dp_tx = qmp_v4_configure_dp_tx, + .configure_dp_phy = qmp_v4_configure_dp_phy, + .calibrate_dp_phy = qmp_v4_calibrate_dp_phy, .clk_list = qmp_v4_sm8250_usbphy_clk_l, .num_clks = ARRAY_SIZE(qmp_v4_sm8250_usbphy_clk_l),
@@ -1251,7 +1251,7 @@ static int qmp_combo_dp_serdes_init(struct qmp_combo *qmp)return 0 ; } -static void qcom_qmp_v3_phy_dp_aux_init (struct qmp_combo *qmp) +static void qmp_v3_dp_aux_init (struct qmp_combo *qmp) { writel(DP_PHY_PD_CTL_PWRDN | DP_PHY_PD_CTL_AUX_PWRDN | DP_PHY_PD_CTL_PLL_PWRDN | DP_PHY_PD_CTL_DP_CLAMP_EN,
@@ -1332,7 +1332,7 @@ static int qmp_combo_configure_dp_swing(struct qmp_combo *qmp,return 0 ; } -static void qcom_qmp_v3_phy_configure_dp_tx (struct qmp_combo *qmp) +static void qmp_v3_configure_dp_tx (struct qmp_combo *qmp) {const struct phy_configure_opts_dp *dp_opts = &qmp->dp_opts;u32 bias_en, drvr_en;
@@ -1385,7 +1385,7 @@ static bool qmp_combo_configure_dp_mode(struct qmp_combo *qmp)return reverse; } -static int qcom_qmp_v3_phy_configure_dp_phy (struct qmp_combo *qmp) +static int qmp_v3_configure_dp_phy (struct qmp_combo *qmp) {const struct qmp_phy_dp_clks *dp_clks = qmp->dp_clks;const struct phy_configure_opts_dp *dp_opts = &qmp->dp_opts;
@@ -1462,7 +1462,7 @@ static int qcom_qmp_v3_phy_configure_dp_phy(struct qmp_combo *qmp)* We need to calibrate the aux setting here as many times * as the caller tries */ -static int qcom_qmp_v3_dp_phy_calibrate (struct qmp_combo *qmp) +static int qmp_v3_calibrate_dp_phy (struct qmp_combo *qmp) {static const u8 cfg1_settings[] = {0x13 ,0x23 ,0x1d };u8 val;
@@ -1476,7 +1476,7 @@ static int qcom_qmp_v3_dp_phy_calibrate(struct qmp_combo *qmp)return 0 ; } -static void qcom_qmp_v4_phy_dp_aux_init (struct qmp_combo *qmp) +static void qmp_v4_dp_aux_init (struct qmp_combo *qmp) { writel(DP_PHY_PD_CTL_PWRDN | DP_PHY_PD_CTL_PSR_PWRDN | DP_PHY_PD_CTL_AUX_PWRDN | DP_PHY_PD_CTL_PLL_PWRDN | DP_PHY_PD_CTL_DP_CLAMP_EN,
@@ -1503,7 +1503,7 @@ static void qcom_qmp_v4_phy_dp_aux_init(struct qmp_combo *qmp) qmp->dp_pcs + QSERDES_V4_DP_PHY_AUX_INTERRUPT_MASK); } -static void qcom_qmp_v4_phy_configure_dp_tx (struct qmp_combo *qmp) +static void qmp_v4_configure_dp_tx (struct qmp_combo *qmp) {/* Program default values before writing proper values */ writel (0x27 , qmp->dp_tx +QSERDES_V4_TX_TX_DRV_LVL );
@@ -1516,7 +1516,7 @@ static void qcom_qmp_v4_phy_configure_dp_tx(struct qmp_combo *qmp) QSERDES_V4_TX_TX_EMP_POST1_LVL); } -static int qcom_qmp_v45_phy_configure_dp_phy (struct qmp_combo *qmp) +static int qmp_v45_configure_dp_phy (struct qmp_combo *qmp) {const struct qmp_phy_dp_clks *dp_clks = qmp->dp_clks;const struct phy_configure_opts_dp *dp_opts = &qmp->dp_opts;
@@ -1606,7 +1606,7 @@ static int qcom_qmp_v45_phy_configure_dp_phy(struct qmp_combo *qmp)return 0 ; } -static int qcom_qmp_v4_phy_configure_dp_phy (struct qmp_combo *qmp) +static int qmp_v4_configure_dp_phy (struct qmp_combo *qmp) {const struct phy_configure_opts_dp *dp_opts = &qmp->dp_opts;u32 bias0_en, drvr0_en, bias1_en, drvr1_en;
@@ -1614,7 +1614,7 @@ static int qcom_qmp_v4_phy_configure_dp_phy(struct qmp_combo *qmp)u32 status;int ret; - ret =qcom_qmp_v45_phy_configure_dp_phy (qmp); + ret =qmp_v45_configure_dp_phy (qmp);if (ret <0 )return ret;
@@ -1668,7 +1668,7 @@ static int qcom_qmp_v4_phy_configure_dp_phy(struct qmp_combo *qmp)return 0 ; } -static int qcom_qmp_v5_phy_configure_dp_phy (struct qmp_combo *qmp) +static int qmp_v5_configure_dp_phy (struct qmp_combo *qmp) {const struct phy_configure_opts_dp *dp_opts = &qmp->dp_opts;u32 bias0_en, drvr0_en, bias1_en, drvr1_en;
@@ -1676,7 +1676,7 @@ static int qcom_qmp_v5_phy_configure_dp_phy(struct qmp_combo *qmp)u32 status;int ret; - ret =qcom_qmp_v45_phy_configure_dp_phy (qmp); + ret =qmp_v45_configure_dp_phy (qmp);if (ret <0 )return ret;
@@ -1729,7 +1729,7 @@ static int qcom_qmp_v5_phy_configure_dp_phy(struct qmp_combo *qmp)* We need to calibrate the aux setting here as many times * as the caller tries */ -static int qcom_qmp_v4_dp_phy_calibrate (struct qmp_combo *qmp) +static int qmp_v4_calibrate_dp_phy (struct qmp_combo *qmp) {static const u8 cfg1_settings[] = {0x20 ,0x13 ,0x23 ,0x1d };u8 val;
Signature · 7 lines
2.37.4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Quoted 4 lines · Johan Hovold
Here's a set of preparatory cleanups needed to fix the devicetree binding and add (proper) support for SC8280XP to the combo driver but that are otherwise self-contained.
Quoted 8 lines
The full series is over forty patches and I'll be posting these in three parts of which this is the second. In an effort to get all of these into 6.2, I'll also be submitting all three series before waiting for the previous ones to be applied.
This series specifically separates the USB and DP PHY ops implementations, and merges the USB and DP driver data and configurations.
Applied, thanks
Signature · 1 line
~Vinod