* [PATCH v3 00/11] phy: qcom-qmp: more fixes and cleanups (set 1)
@ 2022-10-17 6:50 Johan Hovold
2022-10-17 6:50 ` [PATCH v3 01/11] phy: qcom-qmp: fix obsolete lane comments Johan Hovold
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: Johan Hovold @ 2022-10-17 6:50 UTC (permalink / raw)
To: Vinod Koul
Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Dmitry Baryshkov,
linux-arm-msm, linux-phy, linux-kernel, Johan Hovold
Here's the next batch of QMP driver fixes and cleanups.
Dmitry suggested that the register layout structs could all be using
per-IP version defines, which in principle sounds like a good idea. It
is a separate change though, and one which would require some more work
as it is not always clear which IP version a specific SoC uses (e.g.
some of the IPQ platforms appear to mix and match currently).
As such a change shouldn't block these clean ups, I've dropped the
merging of the IPQ SDM845 PCIe layout structs in v2.
Note that v3 has been rebased on the PCIe EP/RC-mode series to avoid two
minor conflicts:
https://lore.kernel.org/linux-phy/20220927092207.161501-1-dmitry.baryshkov@linaro.org/
Johan
Changes in v3
- rebase on "[PATCH v6 0/5] PCI: qcom: Support using the same PHY for
both RC and EP" to avoid two minor conflicts
Changes in v2
- drop the two patches that dropped the IPC and SDM845 PCIe layout
structs
- move the bogus register fix last in case this one needs some more
discussion
Johan Hovold (11):
phy: qcom-qmp: fix obsolete lane comments
phy: qcom-qmp-combo: drop unused UFS reset
phy: qcom-qmp-pcie: drop unused common-block registers
phy: qcom-qmp-pcie: clean up power-down handling
phy: qcom-qmp-pcie: move power-down update
phy: qcom-qmp-pcie-msm8996: clean up power-down handling
phy: qcom-qmp-combo: clean up power-down handling
phy: qcom-qmp-ufs: clean up power-down handling
phy: qcom-qmp-usb: clean up power-down handling
phy: qcom-qmp-pcie: clean up clock lists
phy: qcom-qmp-pcie: drop bogus register update
drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 30 +++---------
.../phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c | 12 ++---
drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 49 +++++--------------
drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 24 ++++-----
drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 22 +++------
5 files changed, 38 insertions(+), 99 deletions(-)
--
2.37.3
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3 01/11] phy: qcom-qmp: fix obsolete lane comments
2022-10-17 6:50 [PATCH v3 00/11] phy: qcom-qmp: more fixes and cleanups (set 1) Johan Hovold
@ 2022-10-17 6:50 ` Johan Hovold
2022-10-17 6:50 ` [PATCH v3 02/11] phy: qcom-qmp-combo: drop unused UFS reset Johan Hovold
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2022-10-17 6:50 UTC (permalink / raw)
To: Vinod Koul
Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Dmitry Baryshkov,
linux-arm-msm, linux-phy, linux-kernel, Johan Hovold,
Neil Armstrong
All QMP drivers but the MSM8996 and combo ones handle exactly one PHY
and the corresponding memory resources are not per-lane, but per PHY.
Update the obsolete comments.
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 2 +-
drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c | 2 +-
drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 2 +-
drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 2 +-
drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
index 9807c4d935cd..8a2a35c0855b 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
@@ -2669,7 +2669,7 @@ static int qmp_combo_create(struct device *dev, struct device_node *np, int id,
qphy->cfg = cfg;
qphy->serdes = serdes;
/*
- * Get memory resources for each phy lane:
+ * 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.
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c
index 461f0b5d464a..707ec81c7a2a 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c
@@ -777,7 +777,7 @@ static int qmp_pcie_msm8996_create(struct device *dev, struct device_node *np, i
qphy->cfg = cfg;
qphy->serdes = serdes;
/*
- * Get memory resources for each phy lane:
+ * Get memory resources for each PHY:
* Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2.
*/
qphy->tx = devm_of_iomap(dev, np, 0, NULL);
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
index f3f75eda01a6..e0408c423ac6 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
@@ -2319,7 +2319,7 @@ static int qmp_pcie_create(struct device *dev, struct device_node *np, int id,
qphy->cfg = cfg;
qphy->serdes = serdes;
/*
- * Get memory resources for each phy lane:
+ * Get memory resources for the 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.
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c
index c08d34ad1313..db5642e1f715 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c
@@ -1094,7 +1094,7 @@ static int qmp_ufs_create(struct device *dev, struct device_node *np, int id,
qphy->cfg = cfg;
qphy->serdes = serdes;
/*
- * Get memory resources for each phy lane:
+ * Get memory resources for the 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.
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
index b84c0d4b5754..965e486ab87d 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
@@ -2581,7 +2581,7 @@ int qmp_usb_create(struct device *dev, struct device_node *np, int id,
qphy->cfg = cfg;
qphy->serdes = serdes;
/*
- * Get memory resources for each phy lane:
+ * Get memory resources for the 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.
--
2.37.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v3 02/11] phy: qcom-qmp-combo: drop unused UFS reset
2022-10-17 6:50 [PATCH v3 00/11] phy: qcom-qmp: more fixes and cleanups (set 1) Johan Hovold
2022-10-17 6:50 ` [PATCH v3 01/11] phy: qcom-qmp: fix obsolete lane comments Johan Hovold
@ 2022-10-17 6:50 ` Johan Hovold
2022-10-17 6:50 ` [PATCH v3 03/11] phy: qcom-qmp-pcie: drop unused common-block registers Johan Hovold
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2022-10-17 6:50 UTC (permalink / raw)
To: Vinod Koul
Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Dmitry Baryshkov,
linux-arm-msm, linux-phy, linux-kernel, Johan Hovold,
Neil Armstrong
Drop the unused UFS reset code which isn't used since the QMP driver
split.
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
index 8a2a35c0855b..c21512b9ab52 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
@@ -944,7 +944,6 @@ struct qmp_phy_dp_clks {
* @phys: array of per-lane phy descriptors
* @phy_mutex: mutex lock for PHY common block initialization
* @init_count: phy common block initialization count
- * @ufs_reset: optional UFS PHY reset handle
*/
struct qcom_qmp {
struct device *dev;
@@ -958,8 +957,6 @@ struct qcom_qmp {
struct mutex phy_mutex;
int init_count;
-
- struct reset_control *ufs_reset;
};
static void qcom_qmp_v3_phy_dp_aux_init(struct qmp_phy *qphy);
@@ -2027,8 +2024,6 @@ static int qmp_combo_com_exit(struct qmp_phy *qphy)
return 0;
}
- reset_control_assert(qmp->ufs_reset);
-
reset_control_bulk_assert(cfg->num_resets, qmp->resets);
clk_bulk_disable_unprepare(cfg->num_clks, qmp->clks);
@@ -2103,10 +2098,6 @@ static int qmp_combo_power_on(struct phy *phy)
else
qmp_combo_configure(pcs, cfg->regs, cfg->pcs_tbl, cfg->pcs_tbl_num);
- ret = reset_control_deassert(qmp->ufs_reset);
- if (ret)
- goto err_disable_pipe_clk;
-
if (cfg->has_pwrdn_delay)
usleep_range(cfg->pwrdn_delay_min, cfg->pwrdn_delay_max);
--
2.37.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v3 03/11] phy: qcom-qmp-pcie: drop unused common-block registers
2022-10-17 6:50 [PATCH v3 00/11] phy: qcom-qmp: more fixes and cleanups (set 1) Johan Hovold
2022-10-17 6:50 ` [PATCH v3 01/11] phy: qcom-qmp: fix obsolete lane comments Johan Hovold
2022-10-17 6:50 ` [PATCH v3 02/11] phy: qcom-qmp-combo: drop unused UFS reset Johan Hovold
@ 2022-10-17 6:50 ` Johan Hovold
2022-10-17 6:50 ` [PATCH v3 04/11] phy: qcom-qmp-pcie: clean up power-down handling Johan Hovold
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2022-10-17 6:50 UTC (permalink / raw)
To: Vinod Koul
Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Dmitry Baryshkov,
linux-arm-msm, linux-phy, linux-kernel, Johan Hovold,
Neil Armstrong
Drop the common-block register defines that are unused since the QMP
driver split.
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
index e0408c423ac6..bdbd18b89a8c 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
@@ -78,11 +78,6 @@ struct qmp_phy_init_tbl {
/* set of registers with offsets different per-PHY */
enum qphy_reg_layout {
- /* Common block control registers */
- QPHY_COM_SW_RESET,
- QPHY_COM_POWER_DOWN_CONTROL,
- QPHY_COM_START_CONTROL,
- QPHY_COM_PCS_READY_STATUS,
/* PCS registers */
QPHY_SW_RESET,
QPHY_START_CTRL,
@@ -100,10 +95,6 @@ static const unsigned int ipq_pciephy_gen3_regs_layout[QPHY_LAYOUT_SIZE] = {
};
static const unsigned int pciephy_regs_layout[QPHY_LAYOUT_SIZE] = {
- [QPHY_COM_SW_RESET] = 0x400,
- [QPHY_COM_POWER_DOWN_CONTROL] = 0x404,
- [QPHY_COM_START_CONTROL] = 0x408,
- [QPHY_COM_PCS_READY_STATUS] = 0x448,
[QPHY_SW_RESET] = 0x00,
[QPHY_START_CTRL] = 0x08,
[QPHY_PCS_STATUS] = 0x174,
--
2.37.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v3 04/11] phy: qcom-qmp-pcie: clean up power-down handling
2022-10-17 6:50 [PATCH v3 00/11] phy: qcom-qmp: more fixes and cleanups (set 1) Johan Hovold
` (2 preceding siblings ...)
2022-10-17 6:50 ` [PATCH v3 03/11] phy: qcom-qmp-pcie: drop unused common-block registers Johan Hovold
@ 2022-10-17 6:50 ` Johan Hovold
2022-10-17 6:50 ` [PATCH v3 05/11] phy: qcom-qmp-pcie: move power-down update Johan Hovold
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2022-10-17 6:50 UTC (permalink / raw)
To: Vinod Koul
Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Dmitry Baryshkov,
linux-arm-msm, linux-phy, linux-kernel, Johan Hovold
Always define the POWER_DOWN_CONTROL register instead of falling back to
the v2 offset during power on and power off.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 21 +++++++--------------
1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
index bdbd18b89a8c..1105d439828c 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
@@ -98,18 +98,21 @@ static const unsigned int pciephy_regs_layout[QPHY_LAYOUT_SIZE] = {
[QPHY_SW_RESET] = 0x00,
[QPHY_START_CTRL] = 0x08,
[QPHY_PCS_STATUS] = 0x174,
+ [QPHY_PCS_POWER_DOWN_CONTROL] = 0x04,
};
static const unsigned int sdm845_qmp_pciephy_regs_layout[QPHY_LAYOUT_SIZE] = {
[QPHY_SW_RESET] = 0x00,
[QPHY_START_CTRL] = 0x08,
[QPHY_PCS_STATUS] = 0x174,
+ [QPHY_PCS_POWER_DOWN_CONTROL] = 0x04,
};
static const unsigned int sdm845_qhp_pciephy_regs_layout[QPHY_LAYOUT_SIZE] = {
[QPHY_SW_RESET] = 0x00,
[QPHY_START_CTRL] = 0x08,
[QPHY_PCS_STATUS] = 0x2ac,
+ [QPHY_PCS_POWER_DOWN_CONTROL] = 0x04,
};
static const unsigned int sm8250_pcie_regs_layout[QPHY_LAYOUT_SIZE] = {
@@ -1999,13 +2002,8 @@ static int qmp_pcie_init(struct phy *phy)
if (ret)
goto err_assert_reset;
- if (cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL])
- qphy_setbits(pcs,
- cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL],
- cfg->pwrdn_ctrl);
- else
- qphy_setbits(pcs, QPHY_V2_PCS_POWER_DOWN_CONTROL,
- cfg->pwrdn_ctrl);
+ qphy_setbits(pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL],
+ cfg->pwrdn_ctrl);
return 0;
@@ -2112,13 +2110,8 @@ static int qmp_pcie_power_off(struct phy *phy)
qphy_clrbits(qphy->pcs, cfg->regs[QPHY_START_CTRL], cfg->start_ctrl);
/* Put PHY into POWER DOWN state: active low */
- if (cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL]) {
- qphy_clrbits(qphy->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL],
- cfg->pwrdn_ctrl);
- } else {
- qphy_clrbits(qphy->pcs, QPHY_V2_PCS_POWER_DOWN_CONTROL,
- cfg->pwrdn_ctrl);
- }
+ qphy_clrbits(qphy->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL],
+ cfg->pwrdn_ctrl);
return 0;
}
--
2.37.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v3 05/11] phy: qcom-qmp-pcie: move power-down update
2022-10-17 6:50 [PATCH v3 00/11] phy: qcom-qmp: more fixes and cleanups (set 1) Johan Hovold
` (3 preceding siblings ...)
2022-10-17 6:50 ` [PATCH v3 04/11] phy: qcom-qmp-pcie: clean up power-down handling Johan Hovold
@ 2022-10-17 6:50 ` Johan Hovold
2022-10-17 6:50 ` [PATCH v3 06/11] phy: qcom-qmp-pcie-msm8996: clean up power-down handling Johan Hovold
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2022-10-17 6:50 UTC (permalink / raw)
To: Vinod Koul
Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Dmitry Baryshkov,
linux-arm-msm, linux-phy, linux-kernel, Johan Hovold
Move the power-down-control register update that powers on the PHY to
the power-on handler so that it matches the power-off handler.
Note that the power-on handler is currently always called directly
after init.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
index 1105d439828c..b42c5e185228 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
@@ -1976,7 +1976,6 @@ static int qmp_pcie_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;
- void __iomem *pcs = qphy->pcs;
int ret;
/* turn on regulator supplies */
@@ -2002,9 +2001,6 @@ static int qmp_pcie_init(struct phy *phy)
if (ret)
goto err_assert_reset;
- qphy_setbits(pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL],
- cfg->pwrdn_ctrl);
-
return 0;
err_assert_reset:
@@ -2041,6 +2037,9 @@ static int qmp_pcie_power_on(struct phy *phy)
unsigned int mask, val, ready;
int ret;
+ qphy_setbits(pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL],
+ cfg->pwrdn_ctrl);
+
if (qphy->mode == PHY_MODE_PCIE_RC)
mode_tables = cfg->tables_rc;
else
--
2.37.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v3 06/11] phy: qcom-qmp-pcie-msm8996: clean up power-down handling
2022-10-17 6:50 [PATCH v3 00/11] phy: qcom-qmp: more fixes and cleanups (set 1) Johan Hovold
` (4 preceding siblings ...)
2022-10-17 6:50 ` [PATCH v3 05/11] phy: qcom-qmp-pcie: move power-down update Johan Hovold
@ 2022-10-17 6:50 ` Johan Hovold
2022-10-17 6:50 ` [PATCH v3 07/11] phy: qcom-qmp-combo: " Johan Hovold
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2022-10-17 6:50 UTC (permalink / raw)
To: Vinod Koul
Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Dmitry Baryshkov,
linux-arm-msm, linux-phy, linux-kernel, Johan Hovold
This driver uses v2 registers only so drop the unnecessary
POWER_DOWN_CONTROL override.
Note that this register is already hard-coded when powering on the PHY.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c
index 707ec81c7a2a..5fdd85a1dc3e 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c
@@ -91,7 +91,6 @@ enum qphy_reg_layout {
QPHY_SW_RESET,
QPHY_START_CTRL,
QPHY_PCS_STATUS,
- QPHY_PCS_POWER_DOWN_CONTROL,
/* Keep last to ensure regs_layout arrays are properly initialized */
QPHY_LAYOUT_SIZE
};
@@ -591,13 +590,8 @@ static int qmp_pcie_msm8996_power_off(struct phy *phy)
qphy_clrbits(qphy->pcs, cfg->regs[QPHY_START_CTRL], cfg->start_ctrl);
/* Put PHY into POWER DOWN state: active low */
- if (cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL]) {
- qphy_clrbits(qphy->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL],
- cfg->pwrdn_ctrl);
- } else {
- qphy_clrbits(qphy->pcs, QPHY_V2_PCS_POWER_DOWN_CONTROL,
- cfg->pwrdn_ctrl);
- }
+ qphy_clrbits(qphy->pcs, QPHY_V2_PCS_POWER_DOWN_CONTROL,
+ cfg->pwrdn_ctrl);
return 0;
}
--
2.37.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v3 07/11] phy: qcom-qmp-combo: clean up power-down handling
2022-10-17 6:50 [PATCH v3 00/11] phy: qcom-qmp: more fixes and cleanups (set 1) Johan Hovold
` (5 preceding siblings ...)
2022-10-17 6:50 ` [PATCH v3 06/11] phy: qcom-qmp-pcie-msm8996: clean up power-down handling Johan Hovold
@ 2022-10-17 6:50 ` Johan Hovold
2022-10-17 6:50 ` [PATCH v3 08/11] phy: qcom-qmp-ufs: " Johan Hovold
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2022-10-17 6:50 UTC (permalink / raw)
To: Vinod Koul
Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Dmitry Baryshkov,
linux-arm-msm, linux-phy, linux-kernel, Johan Hovold
Always define the POWER_DOWN_CONTROL register instead of falling back to
the v2 (and v3) offset during power on and power off.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
index c21512b9ab52..7b434e2ee640 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
@@ -121,6 +121,7 @@ static const unsigned int qmp_v3_usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = {
[QPHY_SW_RESET] = 0x00,
[QPHY_START_CTRL] = 0x08,
[QPHY_PCS_STATUS] = 0x174,
+ [QPHY_PCS_POWER_DOWN_CONTROL] = 0x04,
[QPHY_PCS_AUTONOMOUS_MODE_CTRL] = 0x0d8,
[QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR] = 0x0dc,
[QPHY_PCS_LFPS_RXTERM_IRQ_STATUS] = 0x170,
@@ -1991,13 +1992,8 @@ 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);
- if (cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL])
- qphy_setbits(pcs,
- cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL],
- cfg->pwrdn_ctrl);
- else
- qphy_setbits(pcs, QPHY_V2_PCS_POWER_DOWN_CONTROL,
- cfg->pwrdn_ctrl);
+ qphy_setbits(pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL],
+ cfg->pwrdn_ctrl);
mutex_unlock(&qmp->phy_mutex);
@@ -2144,13 +2140,8 @@ static int qmp_combo_power_off(struct phy *phy)
qphy_clrbits(qphy->pcs, cfg->regs[QPHY_START_CTRL], cfg->start_ctrl);
/* Put PHY into POWER DOWN state: active low */
- if (cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL]) {
- qphy_clrbits(qphy->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL],
- cfg->pwrdn_ctrl);
- } else {
- qphy_clrbits(qphy->pcs, QPHY_V2_PCS_POWER_DOWN_CONTROL,
- cfg->pwrdn_ctrl);
- }
+ qphy_clrbits(qphy->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL],
+ cfg->pwrdn_ctrl);
}
return 0;
--
2.37.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v3 08/11] phy: qcom-qmp-ufs: clean up power-down handling
2022-10-17 6:50 [PATCH v3 00/11] phy: qcom-qmp: more fixes and cleanups (set 1) Johan Hovold
` (6 preceding siblings ...)
2022-10-17 6:50 ` [PATCH v3 07/11] phy: qcom-qmp-combo: " Johan Hovold
@ 2022-10-17 6:50 ` Johan Hovold
2022-10-17 6:50 ` [PATCH v3 09/11] phy: qcom-qmp-usb: " Johan Hovold
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2022-10-17 6:50 UTC (permalink / raw)
To: Vinod Koul
Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Dmitry Baryshkov,
linux-arm-msm, linux-phy, linux-kernel, Johan Hovold
Always define the POWER_DOWN_CONTROL register instead of falling back to
the v2 (and v4) offset during power on and power off.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 22 ++++++++--------------
1 file changed, 8 insertions(+), 14 deletions(-)
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c
index db5642e1f715..e28c45ab74ea 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c
@@ -89,22 +89,26 @@ enum qphy_reg_layout {
static const unsigned int msm8996_ufsphy_regs_layout[QPHY_LAYOUT_SIZE] = {
[QPHY_START_CTRL] = 0x00,
[QPHY_PCS_READY_STATUS] = 0x168,
+ [QPHY_PCS_POWER_DOWN_CONTROL] = 0x04,
};
static const unsigned int sdm845_ufsphy_regs_layout[QPHY_LAYOUT_SIZE] = {
[QPHY_START_CTRL] = 0x00,
[QPHY_PCS_READY_STATUS] = 0x160,
+ [QPHY_PCS_POWER_DOWN_CONTROL] = 0x04,
};
static const unsigned int sm6115_ufsphy_regs_layout[QPHY_LAYOUT_SIZE] = {
[QPHY_START_CTRL] = 0x00,
[QPHY_PCS_READY_STATUS] = 0x168,
+ [QPHY_PCS_POWER_DOWN_CONTROL] = 0x04,
};
static const unsigned int sm8150_ufsphy_regs_layout[QPHY_LAYOUT_SIZE] = {
[QPHY_START_CTRL] = QPHY_V4_PCS_UFS_PHY_START,
[QPHY_PCS_READY_STATUS] = QPHY_V4_PCS_UFS_READY_STATUS,
[QPHY_SW_RESET] = QPHY_V4_PCS_UFS_SW_RESET,
+ [QPHY_PCS_POWER_DOWN_CONTROL] = QPHY_V4_PCS_UFS_POWER_DOWN_CONTROL,
};
static const struct qmp_phy_init_tbl msm8996_ufs_serdes_tbl[] = {
@@ -856,13 +860,8 @@ static int qmp_ufs_com_init(struct qmp_phy *qphy)
if (ret)
goto err_disable_regulators;
- if (cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL])
- qphy_setbits(pcs,
- cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL],
- cfg->pwrdn_ctrl);
- else
- qphy_setbits(pcs, QPHY_V2_PCS_POWER_DOWN_CONTROL,
- cfg->pwrdn_ctrl);
+ qphy_setbits(pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL],
+ cfg->pwrdn_ctrl);
return 0;
@@ -996,13 +995,8 @@ static int qmp_ufs_power_off(struct phy *phy)
qphy_clrbits(qphy->pcs, cfg->regs[QPHY_START_CTRL], cfg->start_ctrl);
/* Put PHY into POWER DOWN state: active low */
- if (cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL]) {
- qphy_clrbits(qphy->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL],
- cfg->pwrdn_ctrl);
- } else {
- qphy_clrbits(qphy->pcs, QPHY_V2_PCS_POWER_DOWN_CONTROL,
- cfg->pwrdn_ctrl);
- }
+ qphy_clrbits(qphy->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL],
+ cfg->pwrdn_ctrl);
return 0;
}
--
2.37.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v3 09/11] phy: qcom-qmp-usb: clean up power-down handling
2022-10-17 6:50 [PATCH v3 00/11] phy: qcom-qmp: more fixes and cleanups (set 1) Johan Hovold
` (7 preceding siblings ...)
2022-10-17 6:50 ` [PATCH v3 08/11] phy: qcom-qmp-ufs: " Johan Hovold
@ 2022-10-17 6:50 ` Johan Hovold
2022-10-17 6:50 ` [PATCH v3 10/11] phy: qcom-qmp-pcie: clean up clock lists Johan Hovold
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2022-10-17 6:50 UTC (permalink / raw)
To: Vinod Koul
Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Dmitry Baryshkov,
linux-arm-msm, linux-phy, linux-kernel, Johan Hovold
Always define the POWER_DOWN_CONTROL register instead of falling back to
the v2 (and v3) offset during power on and power off.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
index 965e486ab87d..b0b13fb6cb59 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
@@ -126,6 +126,7 @@ static const unsigned int usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = {
[QPHY_PCS_AUTONOMOUS_MODE_CTRL] = 0x0d4,
[QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR] = 0x0d8,
[QPHY_PCS_LFPS_RXTERM_IRQ_STATUS] = 0x178,
+ [QPHY_PCS_POWER_DOWN_CONTROL] = 0x04,
};
static const unsigned int qmp_v3_usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = {
@@ -135,6 +136,7 @@ static const unsigned int qmp_v3_usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = {
[QPHY_PCS_AUTONOMOUS_MODE_CTRL] = 0x0d8,
[QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR] = 0x0dc,
[QPHY_PCS_LFPS_RXTERM_IRQ_STATUS] = 0x170,
+ [QPHY_PCS_POWER_DOWN_CONTROL] = 0x04,
};
static const unsigned int qmp_v4_usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = {
@@ -2164,13 +2166,8 @@ static int qmp_usb_init(struct phy *phy)
qphy_clrbits(dp_com, QPHY_V3_DP_COM_SW_RESET, SW_RESET);
}
- if (cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL])
- qphy_setbits(pcs,
- cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL],
- cfg->pwrdn_ctrl);
- else
- qphy_setbits(pcs, QPHY_V2_PCS_POWER_DOWN_CONTROL,
- cfg->pwrdn_ctrl);
+ qphy_setbits(pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL],
+ cfg->pwrdn_ctrl);
return 0;
@@ -2277,13 +2274,8 @@ static int qmp_usb_power_off(struct phy *phy)
qphy_clrbits(qphy->pcs, cfg->regs[QPHY_START_CTRL], cfg->start_ctrl);
/* Put PHY into POWER DOWN state: active low */
- if (cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL]) {
- qphy_clrbits(qphy->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL],
- cfg->pwrdn_ctrl);
- } else {
- qphy_clrbits(qphy->pcs, QPHY_V2_PCS_POWER_DOWN_CONTROL,
- cfg->pwrdn_ctrl);
- }
+ qphy_clrbits(qphy->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL],
+ cfg->pwrdn_ctrl);
return 0;
}
--
2.37.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v3 10/11] phy: qcom-qmp-pcie: clean up clock lists
2022-10-17 6:50 [PATCH v3 00/11] phy: qcom-qmp: more fixes and cleanups (set 1) Johan Hovold
` (8 preceding siblings ...)
2022-10-17 6:50 ` [PATCH v3 09/11] phy: qcom-qmp-usb: " Johan Hovold
@ 2022-10-17 6:50 ` Johan Hovold
2022-10-17 6:50 ` [PATCH v3 11/11] phy: qcom-qmp-pcie: drop bogus register update Johan Hovold
2022-10-17 8:15 ` [PATCH v3 00/11] phy: qcom-qmp: more fixes and cleanups (set 1) Vinod Koul
11 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2022-10-17 6:50 UTC (permalink / raw)
To: Vinod Koul
Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Dmitry Baryshkov,
linux-arm-msm, linux-phy, linux-kernel, Johan Hovold
Keep the clock lists together and sorted by symbol name.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
index b42c5e185228..cb2128e5a78d 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
@@ -1462,6 +1462,10 @@ static inline void qphy_clrbits(void __iomem *base, u32 offset, u32 val)
}
/* list of clocks required by phy */
+static const char * const ipq8074_pciephy_clk_l[] = {
+ "aux", "cfg_ahb",
+};
+
static const char * const msm8996_phy_clk_l[] = {
"aux", "cfg_ahb", "ref",
};
@@ -1476,10 +1480,6 @@ static const char * const qmp_phy_vreg_l[] = {
"vdda-phy", "vdda-pll",
};
-static const char * const ipq8074_pciephy_clk_l[] = {
- "aux", "cfg_ahb",
-};
-
/* list of resets */
static const char * const ipq8074_pciephy_reset_l[] = {
"phy", "common",
--
2.37.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v3 11/11] phy: qcom-qmp-pcie: drop bogus register update
2022-10-17 6:50 [PATCH v3 00/11] phy: qcom-qmp: more fixes and cleanups (set 1) Johan Hovold
` (9 preceding siblings ...)
2022-10-17 6:50 ` [PATCH v3 10/11] phy: qcom-qmp-pcie: clean up clock lists Johan Hovold
@ 2022-10-17 6:50 ` Johan Hovold
2022-10-17 8:15 ` [PATCH v3 00/11] phy: qcom-qmp: more fixes and cleanups (set 1) Vinod Koul
11 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2022-10-17 6:50 UTC (permalink / raw)
To: Vinod Koul
Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Dmitry Baryshkov,
linux-arm-msm, linux-phy, linux-kernel, Johan Hovold
Since commit 0d58280cf1e6 ("phy: Update PHY power control sequence") the
PHY is powered on before configuring the registers and only the MSM8996
PCIe PHY, which includes the POWER_DOWN_CONTROL register in its PCS
initialisation table, may possibly require a second update afterwards.
To make things worse, the POWER_DOWN_CONTROL register lies at a
different offset on more recent SoCs so that the second update, which
still used a hard-coded offset, would write to an unrelated register
(e.g. a revision-id register on SC8280XP).
As the MSM8996 PCIe PHY is now handled by a separate driver, simply drop
the bogus register update.
Fixes: e4d8b05ad5f9 ("phy: qcom-qmp: Use proper PWRDOWN offset for sm8150 USB") added support
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Tested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> #RB3
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
index cb2128e5a78d..30838ae8f027 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
@@ -2061,12 +2061,6 @@ static int qmp_pcie_power_on(struct phy *phy)
qmp_pcie_pcs_init(qphy, &cfg->tables);
qmp_pcie_pcs_init(qphy, mode_tables);
- /*
- * Pull out PHY from POWER DOWN state.
- * This is active low enable signal to power-down PHY.
- */
- qphy_setbits(pcs, QPHY_V2_PCS_POWER_DOWN_CONTROL, cfg->pwrdn_ctrl);
-
if (cfg->has_pwrdn_delay)
usleep_range(cfg->pwrdn_delay_min, cfg->pwrdn_delay_max);
--
2.37.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v3 00/11] phy: qcom-qmp: more fixes and cleanups (set 1)
2022-10-17 6:50 [PATCH v3 00/11] phy: qcom-qmp: more fixes and cleanups (set 1) Johan Hovold
` (10 preceding siblings ...)
2022-10-17 6:50 ` [PATCH v3 11/11] phy: qcom-qmp-pcie: drop bogus register update Johan Hovold
@ 2022-10-17 8:15 ` Vinod Koul
11 siblings, 0 replies; 13+ messages in thread
From: Vinod Koul @ 2022-10-17 8:15 UTC (permalink / raw)
To: Johan Hovold
Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Dmitry Baryshkov,
linux-arm-msm, linux-phy, linux-kernel
On 17-10-22, 08:50, Johan Hovold wrote:
> Here's the next batch of QMP driver fixes and cleanups.
>
> Dmitry suggested that the register layout structs could all be using
> per-IP version defines, which in principle sounds like a good idea. It
> is a separate change though, and one which would require some more work
> as it is not always clear which IP version a specific SoC uses (e.g.
> some of the IPQ platforms appear to mix and match currently).
>
> As such a change shouldn't block these clean ups, I've dropped the
> merging of the IPQ SDM845 PCIe layout structs in v2.
Applied, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2022-10-17 8:16 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-17 6:50 [PATCH v3 00/11] phy: qcom-qmp: more fixes and cleanups (set 1) Johan Hovold
2022-10-17 6:50 ` [PATCH v3 01/11] phy: qcom-qmp: fix obsolete lane comments Johan Hovold
2022-10-17 6:50 ` [PATCH v3 02/11] phy: qcom-qmp-combo: drop unused UFS reset Johan Hovold
2022-10-17 6:50 ` [PATCH v3 03/11] phy: qcom-qmp-pcie: drop unused common-block registers Johan Hovold
2022-10-17 6:50 ` [PATCH v3 04/11] phy: qcom-qmp-pcie: clean up power-down handling Johan Hovold
2022-10-17 6:50 ` [PATCH v3 05/11] phy: qcom-qmp-pcie: move power-down update Johan Hovold
2022-10-17 6:50 ` [PATCH v3 06/11] phy: qcom-qmp-pcie-msm8996: clean up power-down handling Johan Hovold
2022-10-17 6:50 ` [PATCH v3 07/11] phy: qcom-qmp-combo: " Johan Hovold
2022-10-17 6:50 ` [PATCH v3 08/11] phy: qcom-qmp-ufs: " Johan Hovold
2022-10-17 6:50 ` [PATCH v3 09/11] phy: qcom-qmp-usb: " Johan Hovold
2022-10-17 6:50 ` [PATCH v3 10/11] phy: qcom-qmp-pcie: clean up clock lists Johan Hovold
2022-10-17 6:50 ` [PATCH v3 11/11] phy: qcom-qmp-pcie: drop bogus register update Johan Hovold
2022-10-17 8:15 ` [PATCH v3 00/11] phy: qcom-qmp: more fixes and cleanups (set 1) Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).