phy: qcom-qmp-combo: preparatory cleanups (set 2/3)
Subsystems (2)
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
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: 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 PHY init
phy: qcom-qmp-combo: clean up DP callback names
drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 1328 ++++++++++----------- 1 file changed, 611 insertions(+), 717 deletions(-)
Signature · 1 line
2.37.4
PATCH 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 · 1 line
2.37.4
Re: [PATCH 01/22] phy: qcom-qmp-combo: sort device-id table
Quoted 7 lines · Johan Hovold
Sort the device-id table by compatible string to make it easier to find and add new entries.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
Signature · 2 lines
With best wishes Dmitry
PATCH 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 · 1 line
2.37.4
Re: [PATCH 02/22] phy: qcom-qmp-combo: move device-id table
Quoted 7 lines · Johan Hovold
Move the device-id table after
probe()and next to the driver structure to keep the driver callback functions grouped together.Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 50 +++++++++++------------ 1 file changed, 25 insertions(+), 25 deletions(-)
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH 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
Re: [PATCH 03/22] phy: qcom-qmp-combo: move pm ops
Quoted 7 lines · Johan Hovold
Move the PM ops structure next to the implementation to keep the driver callbacks grouped.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH 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
Re: [PATCH 04/22] phy: qcom-qmp-combo: rename PHY ops structures
Quoted 7 lines · Johan Hovold
Rename the PHY operation structures so that they have a "
phy_ops" suffix and move them next to the implementation.Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 40 +++++++++++------------ 1 file changed, 20 insertions(+), 20 deletions(-)
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH 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
Re: [PATCH 05/22] phy: qcom-qmp-combo: drop unused DP PHY mode op
Quoted 7 lines · Johan Hovold
The set-mode operation is currently only used by the USB part of the PHY so drop the corresponding callback from the DP PHY ops.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 1 - 1 file changed, 1 deletion(-)
Signature · 2 lines
With best wishes Dmitry
PATCH 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
Re: [PATCH 06/22] phy: qcom-qmp-combo: rename USB PHY ops
Quoted 7 lines · Johan Hovold
Add a "usb" infix to the USB PHY operation functions and name them after the corresponding operations (e.g. "init" rather than "enable").
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
Signature · 2 lines
With best wishes Dmitry
PATCH 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
Re: [PATCH 07/22] phy: qcom-qmp-combo: drop unnecessary debug message
Quoted 6 lines · Johan Hovold
Drop the unnecessary (verbose) debug message from the init PHY op.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 2 -- 1 file changed, 2 deletions(-)
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH 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 · 1 line
2.37.4
Re: [PATCH 08/22] phy: qcom-qmp-combo: separate USB and DP init ops
Quoted 8 lines · Johan Hovold
Separate 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.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 36 ++++++++++++----------- 1 file changed, 19 insertions(+), 17 deletions(-)
Signature · 2 lines
With best wishes Dmitry
PATCH 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 · 1 line
2.37.4
Re: [PATCH 09/22] phy: qcom-qmp-combo: rename DP PHY ops
Quoted 7 lines · Johan Hovold
Rename the configure and calibrate DP PHY ops using the common prefix for consistency.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Signature · 2 lines
With best wishes Dmitry
PATCH 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 · 1 line
2.37.4
Re: [PATCH 10/22] phy: qcom-qmp-combo: separate USB and DP power-on ops
Quoted 11 lines · Johan Hovold
Separate 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_delayset.Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 100 +++++++++++++--------- 1 file changed, 59 insertions(+), 41 deletions(-)
Signature · 2 lines
With best wishes Dmitry
PATCH 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 · 1 line
2.37.4
Re: [PATCH 11/22] phy: qcom-qmp-combo: clean up serdes initialisation
Quoted 9 lines · Johan Hovold
Clean up serdes initialisation somewhat by making the current helper a dedicated helper for the DP part of the PHY.
Note that no error is currently returned for non-supported link rates.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 49 +++++++++++------------ 1 file changed, 24 insertions(+), 25 deletions(-)
Signature · 2 lines
With best wishes Dmitry
PATCH 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 | 81 ++++++++++++++++------- 1 file changed, 58 insertions(+), 23 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +58 -23
@@ -2576,13 +2576,63 @@ 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; +int ret; + + qphy =devm_kzalloc (dev,sizeof (*qphy),GFP_KERNEL ); +if (!qphy) +return -ENOMEM ; + + qphy->cfg = cfg; + qphy->serdes = serdes; +/* +* Get memory resources for each PHY: +* 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. +* +* 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; -const struct phy_ops *ops;int ret; qphy =devm_kzalloc (dev,sizeof (*qphy),GFP_KERNEL );
@@ -2631,31 +2681,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 +2787,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 +2805,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 · 1 line
2.37.4
Re: [PATCH 12/22] phy: qcom-qmp-combo: separate USB and DP devicetree parsing
Quoted 10 lines · Johan Hovold
Separate 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.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 81 ++++++++++++++++------- 1 file changed, 58 insertions(+), 23 deletions(-)
Signature · 2 lines
With best wishes Dmitry
PATCH 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 for each PHY: * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2.
@@ -2598,18 +2604,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 · 1 line
2.37.4
Re: [PATCH 13/22] phy: qcom-qmp-combo: add dedicated DP iomem pointers
Quoted 7 lines · Johan Hovold
In preparation for merging the driver data, add separate iomem pointers for the DP part of the PHY.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 246 +++++++++++----------- 1 file changed, 126 insertions(+), 120 deletions(-)
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH 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 · 1 line
2.37.4
Re: [PATCH 14/22] phy: qcom-qmp-combo: clean up DP configurations
Quoted 7 lines · Johan Hovold
In preparation for merging the USB and DP configurations, align the initialisations of the DP function pointers.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 40 +++++++++++------------ 1 file changed, 20 insertions(+), 20 deletions(-)
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH 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, };
@@ -2858,7 +2858,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 · 1 line
2.37.4
Re: [PATCH 15/22] phy: qcom-qmp-combo: rename sc8280xp config
Quoted 8 lines · Johan Hovold
In preparation for merging the USB and DP configurations, drop the "combo" infix from the SC8280XP combined configuration for consistency with the other platforms.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH 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 · 1 line
2.37.4
Re: [PATCH 16/22] phy: qcom-qmp-combo: add DP configuration tables
Quoted 13 lines · Johan Hovold
In preparation for merging the USB and DP configurations, add dedicated pointers for the DP serdes and tx tables to the configurations.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 45 ++++++++++++----------- 1 file changed, 24 insertions(+), 21 deletions(-)drivers/phy/qualcomm/phy-qcom-qmp-combo.c +0
-0
drivers/phy/qualcomm/phy-qcom-qmp-combo.c struct qmp_phy_cfg { · line 823
Quoted 8 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +5
-0@@ -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; +
I'd prefer to have DP-specific instance of struct qmp_phy_cfg_tbls here instead of having separate dp-specific fields. WDYT?
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH 16/22] phy: qcom-qmp-combo: add DP configuration tables
Quoted 17 lines · Dmitry Baryshkov
Quoted 16 lines · Johan Hovold
In preparation for merging the USB and DP configurations, add dedicated pointers for the DP serdes and tx tables to the configurations.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 45 ++++++++++++----------- 1 file changed, 24 insertions(+), 21 deletions(-)drivers/phy/qualcomm/phy-qcom-qmp-combo.c +0
-0@@ -816,6 +816,11 @@ struct qmp_phy_cfg {const struct qmp_phy_init_tbl *pcs_usb_tbl;int pcs_usb_tbl_num;
Quoted 8 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c struct qmp_phy_cfg { · line 823
Quoted 5 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +5
-0+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; +I'd prefer to have DP-specific instance of struct
qmp_phy_cfg_tblshere instead of having separate dp-specific fields. WDYT?
No, I don't see any good reason for doing so currently.
You may be able to share a few pointers between some of the SoCs but only until it turns out they need to override certain sequences anyway (e.g. sc8280xp which mixes v4 and v5 tables currently).
You'd also need dedicated aggregate table structs for USB and DP and it seems all of this would just make things more opaque for little gain.
Johan
Re: [PATCH 16/22] phy: qcom-qmp-combo: add DP configuration tables
Quoted 27 lines · Johan Hovold
Quoted 17 lines · Dmitry Baryshkov
Quoted 16 lines · Johan Hovold
In preparation for merging the USB and DP configurations, add dedicated pointers for the DP serdes and tx tables to the configurations.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 45 ++++++++++++----------- 1 file changed, 24 insertions(+), 21 deletions(-)drivers/phy/qualcomm/phy-qcom-qmp-combo.c +0
-0@@ -816,6 +816,11 @@ struct qmp_phy_cfg {const struct qmp_phy_init_tbl *pcs_usb_tbl;int pcs_usb_tbl_num;Quoted 8 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c struct qmp_phy_cfg { · line 823
Quoted 5 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +5
-0+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; +I'd prefer to have DP-specific instance of struct
qmp_phy_cfg_tblshere instead of having separate dp-specific fields. WDYT?
Quoted 8 lines
No, I don't see any good reason for doing so currently.
You may be able to share a few pointers between some of the SoCs but only until it turns out they need to override certain sequences anyway (e.g. sc8280xp which mixes v4 and v5 tables currently).
You'd also need dedicated aggregate table structs for USB and DP and it seems all of this would just make things more opaque for little gain.
I was thinking about moving the qmp.*init_registers into the common library. However let's probably finish the cleanup before working on code consolidation.
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Dmitry Baryshkov
Reviewed-byRe: [PATCH 16/22] phy: qcom-qmp-combo: add DP configuration tables
In reply to Johan HovoldQuoted 27 lines · Johan Hovold
Quoted 17 lines · Dmitry Baryshkov
Quoted 16 lines · Johan Hovold
In preparation for merging the USB and DP configurations, add dedicated pointers for the DP serdes and tx tables to the configurations.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 45 ++++++++++++----------- 1 file changed, 24 insertions(+), 21 deletions(-)drivers/phy/qualcomm/phy-qcom-qmp-combo.c +0
-0@@ -816,6 +816,11 @@ struct qmp_phy_cfg {const struct qmp_phy_init_tbl *pcs_usb_tbl;int pcs_usb_tbl_num;Quoted 8 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c struct qmp_phy_cfg { · line 823
Quoted 5 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +5
-0+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; +I'd prefer to have DP-specific instance of struct
qmp_phy_cfg_tblshere instead of having separate dp-specific fields. WDYT?
Quoted 8 lines
No, I don't see any good reason for doing so currently.
You may be able to share a few pointers between some of the SoCs but only until it turns out they need to override certain sequences anyway (e.g. sc8280xp which mixes v4 and v5 tables currently).
You'd also need dedicated aggregate table structs for USB and DP and it seems all of this would just make things more opaque for little gain.
Forgot:
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH 17/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,10 +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;int lanes;/* Init sequence for PHY blocks - serdes, tx, rx, pcs */
@@ -864,11 +861,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 *
@@ -1008,8 +1000,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 = { .lanes =2 , .serdes_tbl = qmp_v3_usb3_serdes_tbl,
@@ -1020,20 +1011,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 , - .lanes =2 , .dp_serdes_tbl = qmp_v3_dp_serdes_tbl, .dp_serdes_tbl_num = ARRAY_SIZE(qmp_v3_dp_serdes_tbl),
@@ -1058,15 +1035,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, + + .has_pwrdn_delay = true, }; -static const struct qmp_phy_cfg sdm845_usb3phy_cfg = { - .type =PHY_TYPE_USB3 , +static const struct qmp_phy_cfg sdm845_usb3dpphy_cfg = { .lanes =2 , .serdes_tbl = qmp_v3_usb3_serdes_tbl,
@@ -1077,25 +1058,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 , - .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),
@@ -1115,15 +1082,18 @@ 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 = { .lanes =2 , .serdes_tbl = sm8150_usb3_serdes_tbl,
@@ -1136,21 +1106,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 , - .lanes =2 , .dp_serdes_tbl = qmp_v4_dp_serdes_tbl, .dp_serdes_tbl_num = ARRAY_SIZE(qmp_v4_dp_serdes_tbl),
@@ -1175,15 +1130,20 @@ 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, + .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 sc8280xp_usb43dp_usb_cfg = { - .type =PHY_TYPE_USB3 , +static const struct qmp_phy_cfg sc8280xp_usb43dpphy_cfg = { .lanes =2 , .serdes_tbl = sc8280xp_usb43dp_serdes_tbl,
@@ -1194,19 +1154,6 @@ static const struct qmp_phy_cfg sc8280xp_usb43dp_usb_cfg = { .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, - .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 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),
@@ -1231,15 +1178,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 = { .lanes =2 , .serdes_tbl = sm8150_usb3_serdes_tbl,
@@ -1252,21 +1202,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 , - .lanes =2 , .dp_serdes_tbl = qmp_v4_dp_serdes_tbl, .dp_serdes_tbl_num = ARRAY_SIZE(qmp_v4_dp_serdes_tbl),
@@ -1291,11 +1226,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,
@@ -2720,10 +2661,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;
@@ -2734,13 +2672,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);
@@ -2753,7 +2688,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);
@@ -2792,7 +2726,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 */
@@ -2810,7 +2743,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 · 1 line
2.37.4
Re: [PATCH 17/22] phy: qcom-qmp-combo: merge USB and DP configurations
Quoted 13 lines · Johan Hovold
It does not really make any sense to keep separate configuration structures for the USB and DP parts of the same PHY so merge them.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 182 +++++++--------------- 1 file changed, 57 insertions(+), 125 deletions(-)drivers/phy/qualcomm/phy-qcom-qmp-combo.c +0
-0
drivers/phy/qualcomm/phy-qcom-qmp-combo.c static const u8 qmp_dp_v5_voltage_swing_hbr_rbr[4][4] = { · line 802
Quoted 8 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +0
-3@@ -798,10 +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;int lanes;
int lanes doesn't really make sense here in my opinion. It should be usb_lanes and dp_lanes.
Quoted 316 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +57
-122/* Init sequence for PHY blocks - serdes, tx, rx, pcs */ @@ -864,11 +861,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 * @@ -1008,8 +1000,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 = { .lanes =2 , .serdes_tbl = qmp_v3_usb3_serdes_tbl,@@ -1020,20 +1011,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 , - .lanes =2 , .dp_serdes_tbl = qmp_v3_dp_serdes_tbl, .dp_serdes_tbl_num = ARRAY_SIZE(qmp_v3_dp_serdes_tbl),@@ -1058,15 +1035,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, + + .has_pwrdn_delay = true, }; -static const struct qmp_phy_cfg sdm845_usb3phy_cfg = { - .type =PHY_TYPE_USB3 , +static const struct qmp_phy_cfg sdm845_usb3dpphy_cfg = { .lanes =2 , .serdes_tbl = qmp_v3_usb3_serdes_tbl,@@ -1077,25 +1058,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 , - .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),@@ -1115,15 +1082,18 @@ 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 = { .lanes =2 , .serdes_tbl = sm8150_usb3_serdes_tbl,@@ -1136,21 +1106,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 , - .lanes =2 , .dp_serdes_tbl = qmp_v4_dp_serdes_tbl, .dp_serdes_tbl_num = ARRAY_SIZE(qmp_v4_dp_serdes_tbl),@@ -1175,15 +1130,20 @@ 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, + .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 sc8280xp_usb43dp_usb_cfg = { - .type =PHY_TYPE_USB3 , +static const struct qmp_phy_cfg sc8280xp_usb43dpphy_cfg = { .lanes =2 , .serdes_tbl = sc8280xp_usb43dp_serdes_tbl,@@ -1194,19 +1154,6 @@ static const struct qmp_phy_cfg sc8280xp_usb43dp_usb_cfg = { .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, - .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 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),@@ -1231,15 +1178,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 = { .lanes =2 , .serdes_tbl = sm8150_usb3_serdes_tbl,@@ -1252,21 +1202,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 , - .lanes =2 , .dp_serdes_tbl = qmp_v4_dp_serdes_tbl, .dp_serdes_tbl_num = ARRAY_SIZE(qmp_v4_dp_serdes_tbl),@@ -1291,11 +1226,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,@@ -2720,10 +2661,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;@@ -2734,13 +2672,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);@@ -2753,7 +2688,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);@@ -2792,7 +2726,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 */ @@ -2810,7 +2743,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 · 2 lines
With best wishes Dmitry
Re: [PATCH 17/22] phy: qcom-qmp-combo: merge USB and DP configurations
Quoted 17 lines · Dmitry Baryshkov
Quoted 16 lines · Johan Hovold
It does not really make any sense to keep separate configuration structures for the USB and DP parts of the same PHY so merge them.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 182 +++++++--------------- 1 file changed, 57 insertions(+), 125 deletions(-)drivers/phy/qualcomm/phy-qcom-qmp-combo.c +0
-0@@ -798,10 +798,7 @@ static const u8 qmp_dp_v5_voltage_swing_hbr_rbr[4][4] = {struct qmp_phy ;
Quoted 8 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c static const u8 qmp_dp_v5_voltage_swing_hbr_rbr[4][4] = { · line 802
Quoted 5 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +0
-3-/* struct qmp_phy_cfg - per-PHY initialization config */ struct qmp_phy_cfg { -/* phy-type - PCIE/UFS/USB */ -unsigned int type;int lanes;int lanes doesn't really make sense here in my opinion. It should be
usb_lanesanddp_lanes.
It doesn't make much less sense than having it here currently do.
All of these USB-C PHYs are dual lane for bi-directional SS USB and quad lane for uni-directional DP (even if only CC1 orientation and lanes 2 and 3 are currently supported).
I should probably just drop the lanes parameter completely, either as a preparatory clean up or as follow-on one (e.g. also a bit depending on if there are other reasons for respinning a v2).
Johan
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 17/22] phy: qcom-qmp-combo: merge USB and DP configurations
Quoted 27 lines · Johan Hovold
Quoted 17 lines · Dmitry Baryshkov
Quoted 16 lines · Johan Hovold
It does not really make any sense to keep separate configuration structures for the USB and DP parts of the same PHY so merge them.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 182 +++++++--------------- 1 file changed, 57 insertions(+), 125 deletions(-)drivers/phy/qualcomm/phy-qcom-qmp-combo.c +0
-0@@ -798,10 +798,7 @@ static const u8 qmp_dp_v5_voltage_swing_hbr_rbr[4][4] = {struct qmp_phy ;Quoted 8 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c static const u8 qmp_dp_v5_voltage_swing_hbr_rbr[4][4] = { · line 802
Quoted 5 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +0
-3-/* struct qmp_phy_cfg - per-PHY initialization config */ struct qmp_phy_cfg { -/* phy-type - PCIE/UFS/USB */ -unsigned int type;int lanes;int lanes doesn't really make sense here in my opinion. It should be
usb_lanesanddp_lanes.
Quoted 5 lines
It doesn't make much less sense than having it here currently do.
All of these USB-C PHYs are dual lane for bi-directional SS USB and quad lane for uni-directional DP (even if only CC1 orientation and lanes 2 and 3 are currently supported).
I was under impression that sdm845 has just a single lane for each of USB and DP. After rechecking the phy/next, I see that it was my mistake (quite logical, SS is two lanes, so the compliant PHY must have two lanes too).
I wander how/if 4-lane DP works. The only thing that we do is programming of the QSERDES_DP_PHY_PD_CTL register, however judging e.g. your 4-lane PCIe changes, one should probably also program the other two lanes. Maybe it is handled automatically inside the hardware.
Quoted 3 lines
I should probably just drop the lanes parameter completely, either as a preparatory clean up or as follow-on one (e.g. also a bit depending on if there are other reasons for respinning a v2).
I think a follow up is enough, but let's get it. Having a single lanes=2 field looks... strange.
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 17/22] phy: qcom-qmp-combo: merge USB and DP configurations
Quoted 26 lines · Dmitry Baryshkov
Quoted 14 lines · Johan Hovold
Quoted 4 lines · Dmitry Baryshkov
Quoted 2 lines · Johan Hovold
It does not really make any sense to keep separate configuration structures for the USB and DP parts of the same PHY so merge them.
Quoted 8 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c static const u8 qmp_dp_v5_voltage_swing_hbr_rbr[4][4] = { · line 802
Quoted 5 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +0
-3-/* struct qmp_phy_cfg - per-PHY initialization config */ struct qmp_phy_cfg { -/* phy-type - PCIE/UFS/USB */ -unsigned int type;int lanes;int lanes doesn't really make sense here in my opinion. It should be
usb_lanesanddp_lanes.Quoted 5 lines
It doesn't make much less sense than having it here currently do.
All of these USB-C PHYs are dual lane for bi-directional SS USB and quad lane for uni-directional DP (even if only CC1 orientation and lanes 2 and 3 are currently supported).
I was under impression that sdm845 has just a single lane for each of USB and DP. After rechecking the phy/next, I see that it was my mistake (quite logical, SS is two lanes, so the compliant PHY must have two lanes too).
Quoted 4 lines
I wander how/if 4-lane DP works. The only thing that we do is programming of the
QSERDES_DP_PHY_PD_CTLregister, however judging e.g. your 4-lane PCIe changes, one should probably also program the other two lanes. Maybe it is handled automatically inside the hardware.
4-lane PCIe on SC8280XP is a different thing entirely (and remember that that's actually 8 uni-directional lanes).
I'm sure there are further problems with the current DP alt mode implementation, but hopefully that can be resolved when adding support for orientation detection. I'm just fixing the obvious bugs and try to stay "bug compatible" otherwise. :)
Quoted 6 lines
Quoted 3 lines
I should probably just drop the lanes parameter completely, either as a preparatory clean up or as follow-on one (e.g. also a bit depending on if there are other reasons for respinning a v2).
I think a follow up is enough, but let's get it. Having a single lanes=2 field looks... strange.
I dropped the lane parameter as a preparatory patch to this one in v2 that I'll post in a bit.
Johan
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 17/22] phy: qcom-qmp-combo: merge USB and DP configurations
In reply to Johan HovoldQuoted 7 lines · Johan Hovold
It does not really make any sense to keep separate configuration structures for the USB and DP parts of the same PHY so merge them.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 182 +++++++--------------- 1 file changed, 57 insertions(+), 125 deletions(-)
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH 18/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 | 690 ++++++++++------------ 1 file changed, 313 insertions(+), 377 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +313 -377
@@ -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 {int lanes;
@@ -835,10 +835,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;
@@ -861,29 +861,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;
@@ -899,59 +889,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) {
@@ -1265,11 +1229,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);
@@ -1298,54 +1262,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;
@@ -1371,20 +1335,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 ;
@@ -1396,13 +1360,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;
@@ -1422,27 +1386,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 :
@@ -1465,40 +1429,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,
@@ -1509,76 +1473,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 :
@@ -1601,49 +1565,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,
@@ -1653,15 +1617,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;
@@ -1687,43 +1651,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;
@@ -1744,30 +1708,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 ; }
@@ -1776,16 +1740,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 ; }
@@ -1793,13 +1757,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 ;
@@ -1807,20 +1771,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;
@@ -1872,7 +1834,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);
@@ -1889,11 +1851,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) {
@@ -1914,76 +1874,75 @@ 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; +struct qmp_combo *qmp =phy_get_drvdata (phy); +const struct qmp_phy_cfg *cfg = qmp->cfg; +void __iomem *tx = qmp->dp_tx; -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 );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 (qmp->dp_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 *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 *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;
@@ -1993,12 +1952,12 @@ static int qmp_combo_usb_power_on(struct phy *phy)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 (qmp->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 (qmp->rx2, cfg->rx_tbl, cfg->rx_tbl_num,2 );qmp_combo_configure (pcs, cfg->pcs_tbl, cfg->pcs_tbl_num);
@@ -2022,27 +1981,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 ;
@@ -2050,37 +2009,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 ; }
@@ -2102,15 +2061,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 ;
@@ -2131,11 +2090,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)
@@ -2151,20 +2110,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 ;
@@ -2172,12 +2130,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" );
@@ -2188,14 +2145,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 ; }
@@ -2207,7 +2164,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;
@@ -2239,7 +2196,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;
@@ -2260,7 +2217,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;
@@ -2297,7 +2254,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 = { };
@@ -2400,12 +2357,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 :
@@ -2444,12 +2401,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 :
@@ -2484,8 +2441,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;
@@ -2496,8 +2452,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;
@@ -2526,20 +2482,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 for each PHY: * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2.
@@ -2548,18 +2499,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->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);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); + 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);
@@ -2569,72 +2520,65 @@ 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 for each PHY: * 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. */ - 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;if (cfg->lanes >=2 ) { - 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 ); + qmp->pcs_misc =devm_of_iomap (dev, np,5 ,NULL ); }else { - qphy->pcs_misc =devm_of_iomap (dev, np,3 ,NULL ); + qmp->pcs_misc =devm_of_iomap (dev, np,3 ,NULL ); } -if (IS_ERR (qphy->pcs_misc)) { +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);
@@ -2644,17 +2588,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;
@@ -2709,10 +2651,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)
@@ -2729,14 +2667,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" );
@@ -2746,15 +2684,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 · 1 line
2.37.4
Re: [PATCH 18/22] phy: qcom-qmp-combo: merge driver data
Quoted 59 lines · Johan Hovold
The QMP combo driver manages a single PHY (even if it provides two interfaces for USB and DP, respectively) so merge the old
qcom_qmpandqmp_phystructures and drop the PHY array.Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 690 ++++++++++------------ 1 file changed, 313 insertions(+), 377 deletions(-)drivers/phy/qualcomm/phy-qcom-qmp-combo.c +5
-23@@ -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 {int lanes;@@ -835,10 +835,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;@@ -861,29 +861,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
drivers/phy/qualcomm/phy-qcom-qmp-combo.c struct qmp_phy_cfg { · line 869
Quoted 10 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +6
-4-* @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; +}; +
It would make sense to keep the kerneldoc here.
Quoted 74 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +18
-39+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;@@ -899,59 +889,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);
drivers/phy/qualcomm/phy-qcom-qmp-combo.c struct qmp_phy { · line 918
Quoted 10 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +5
-4-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);
As you are doing the cleanup anyway, would it make sense to move these functions up to be able to drop these prototypes?
drivers/phy/qualcomm/phy-qcom-qmp-combo.c static void qmp_combo_configure(void __iomem *base,
Quoted 4 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +0
-0static inline void qphy_setbits (void __iomem *base,u32 offset,u32 val) {@@ -1265,11 +1229,11 @@ static void qmp_combo_configure(void __iomem *base,
The rest LGTM
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH 18/22] phy: qcom-qmp-combo: merge driver data
Quoted 33 lines · Dmitry Baryshkov
Quoted 32 lines · Johan Hovold
The QMP combo driver manages a single PHY (even if it provides two interfaces for USB and DP, respectively) so merge the old
qcom_qmpandqmp_phystructures and drop the PHY array.Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 690 ++++++++++------------ 1 file changed, 313 insertions(+), 377 deletions(-)drivers/phy/qualcomm/phy-qcom-qmp-combo.c +0
-22-/** -* 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;
Quoted 8 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c struct qmp_phy_cfg { · line 869
Quoted 6 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +6
-0+struct qmp_phy_dp_clks { +struct qmp_combo *qmp; +struct clk_hw dp_link_hw; +struct clk_hw dp_pixel_hw; +}; +It would make sense to keep the kerneldoc here.
I disagree. The above kernel doc is at best pointless and mostly just restates what can be understood from the field names.
Note how it also incorrect by referring to "memory space for *lane's* ...".
Quoted 82 lines
Quoted 82 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +22
-42+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;@@ -899,59 +889,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);
Quoted 6 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c struct qmp_phy { · line 918
Quoted 2 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +1
-1-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);As you are doing the cleanup anyway, would it make sense to move these functions up to be able to drop these prototypes?
Nah, we want to keep the DP implementation together and for now the configuration structs live at the top of the file.
Quoted 7 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c static void qmp_combo_configure(void __iomem *base,
Quoted 4 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +0
-0static inline void qphy_setbits (void __iomem *base,u32 offset,u32 val) {@@ -1265,11 +1229,11 @@ static void qmp_combo_configure(void __iomem *base,The rest LGTM
Thanks for reviewing all of these these.
Johan
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Dmitry Baryshkov
Reviewed-byRe: [PATCH 18/22] phy: qcom-qmp-combo: merge driver data
Quoted 44 lines · Johan Hovold
Quoted 33 lines · Dmitry Baryshkov
Quoted 32 lines · Johan Hovold
The QMP combo driver manages a single PHY (even if it provides two interfaces for USB and DP, respectively) so merge the old
qcom_qmpandqmp_phystructures and drop the PHY array.Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 690 ++++++++++------------ 1 file changed, 313 insertions(+), 377 deletions(-)drivers/phy/qualcomm/phy-qcom-qmp-combo.c +0
-22-/** -* 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;Quoted 8 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c struct qmp_phy_cfg { · line 869
Quoted 6 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +6
-0+struct qmp_phy_dp_clks { +struct qmp_combo *qmp; +struct clk_hw dp_link_hw; +struct clk_hw dp_pixel_hw; +}; +It would make sense to keep the kerneldoc here.
Quoted 2 lines
I disagree. The above kernel doc is at best pointless and mostly just restates what can be understood from the field names.
Well, if viewed this way, 80% of kerneldocs's are pointless, as most of the fields are self-describing.
In this case I can agree with you though. Especially since the struct is not a part of the public API.
Quoted 2 lines
Note how it also incorrect by referring to "memory space for *lane's*
I assumed that lane's rx' and lane's tx' were ugly wording. But yeah.
Quoted 95 lines
...".
Quoted 82 lines
Quoted 82 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +22
-42+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;@@ -899,59 +889,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);Quoted 6 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c struct qmp_phy { · line 918
Quoted 2 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +1
-1-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);As you are doing the cleanup anyway, would it make sense to move these functions up to be able to drop these prototypes?
Nah, we want to keep the DP implementation together and for now the configuration structs live at the top of the file.
Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 6 lines
Review static void qmp_combo_configure(void __iomem *base,
Quoted 3 lines
static inline void qphy_setbits(void __iomem *base, u32 offset, u32 val) {(quoted diff) +0
-0@@ -1265,11 +1229,11 @@ static void qmp_combo_configure(void __iomem *base,The rest LGTM
Thanks for reviewing all of these these.
Signature · 2 lines
With best wishes Dmitry
PATCH 19/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
@@ -2598,13 +2598,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 );
@@ -2630,8 +2629,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);
@@ -2646,75 +2643,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 · 1 line
2.37.4
Re: [PATCH 19/22] phy: qcom-qmp-combo: clean up device-tree parsing
Quoted 6 lines · Johan Hovold
Since 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.
Quoted 8 lines
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.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 82 ++++++++--------------- 1 file changed, 28 insertions(+), 54 deletions(-)
Signature · 2 lines
With best wishes Dmitry
PATCH 20/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 | 62 ++++++++++------------- 1 file changed, 28 insertions(+), 34 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +28 -34
@@ -2162,9 +2162,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;
@@ -2194,9 +2195,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;
@@ -2215,9 +2217,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;
@@ -2482,15 +2485,13 @@ 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); +const struct qmp_phy_cfg *cfg = qmp->cfg; +struct device *dev = qmp->dev;struct phy *generic_phy;int ret; - qmp->cfg = cfg; - qmp->dp_serdes = serdes;/* * Get memory resources for each PHY: * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2.
@@ -2526,15 +2527,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 for each PHY: * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2.
@@ -2600,10 +2599,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 );
@@ -2611,35 +2606,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;
@@ -2663,7 +2657,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;
@@ -2671,7 +2665,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 · 1 line
2.37.4
Re: [PATCH 20/22] phy: qcom-qmp-combo: clean up probe initialisation
Quoted 8 lines · Johan Hovold
Stop abusing the driver data pointer and instead pass the driver state structure directly to the initialisation helpers during probe.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 62 ++++++++++------------- 1 file changed, 28 insertions(+), 34 deletions(-)
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH 21/22 phy: qcom-qmp-combo: clean up PHY init
In reply to Johan HovoldClean up the USB PHY initialisation somewhat by programming both tx and rx for the second lane after the first lane.
--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +3 -5
@@ -1950,14 +1950,12 @@ 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 (qmp->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 ) +if (cfg->lanes >=2 ) { +qmp_combo_configure_lane (qmp->tx2, cfg->tx_tbl, cfg->tx_tbl_num,2 );qmp_combo_configure_lane (qmp->rx2, cfg->rx_tbl, cfg->rx_tbl_num,2 ); + }qmp_combo_configure (pcs, cfg->pcs_tbl, cfg->pcs_tbl_num);
Signature · 1 line
2.37.4
Re: [PATCH 21/22] phy: qcom-qmp-combo: clean up PHY init
Quoted 7 lines · Johan Hovold
Clean up the USB PHY initialisation somewhat by programming both tx and rx for the second lane after the first lane.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH 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
@@ -905,17 +905,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) {
@@ -995,10 +995,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),
@@ -1042,10 +1042,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),
@@ -1090,10 +1090,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),
@@ -1138,10 +1138,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),
@@ -1186,10 +1186,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),
@@ -1262,7 +1262,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,
@@ -1343,7 +1343,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;
@@ -1396,7 +1396,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;
@@ -1473,7 +1473,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;
@@ -1487,7 +1487,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,
@@ -1514,7 +1514,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 );
@@ -1527,7 +1527,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;
@@ -1617,7 +1617,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;
@@ -1625,7 +1625,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;
@@ -1679,7 +1679,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;
@@ -1687,7 +1687,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;
@@ -1740,7 +1740,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 · 1 line
2.37.4
Re: [PATCH 22/22] phy: qcom-qmp-combo: clean up DP callback names
Quoted 9 lines · Johan Hovold
Clean 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).
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 82 +++++++++++------------ 1 file changed, 41 insertions(+), 41 deletions(-)
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy