Linux-PHY Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] phy: qcom: qmp-combo: Fix AON toggle register presence check
@ 2026-12-02  4:48 Elson Serrao
  2026-12-02  4:52 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Elson Serrao @ 2026-12-02  4:48 UTC (permalink / raw)
  To: vkoul, neil.armstrong, mani, abelvesa, konrad.dybcio,
	dmitry.baryshkov
  Cc: linux-arm-msm, linux-phy, linux-kernel, stable

The driver decides whether to clear the AON toggle enable bits by using
the USB AON toggle enable register offset as a presence indicator. On V10
PHYs, that register resides at offset 0x00 in the COM AON register space,
causing the check to evaluate false. As a result, the AON toggle bits are
never cleared.

Add a dedicated flag to indicate the presence of AON toggle registers and
use it to guard the corresponding register accesses. Also rename the
aon_toggle mapping and offsets to com_aon, as they represent the COM AON
register space rather than a single toggle register.

Fixes: eca0e717aab1 ("phy: qualcomm: qmp-combo: Add support for Hawi SoC")
Cc: stable@vger.kernel.org
Signed-off-by: Elson Serrao <elson.serrao@oss.qualcomm.com>
---
 drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 27 +++++++++++++----------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
index 3acf28c7d7b2..35fcf8681c62 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
@@ -2513,7 +2513,7 @@ struct qmp_combo_offsets {
 	u16 dp_txa;
 	u16 dp_txb;
 	u16 dp_dp_phy;
-	u16 aon_toggle;
+	u16 com_aon;
 	u16 usb4_serdes;
 	u16 usb4_pcs;
 };
@@ -2592,6 +2592,7 @@ struct qmp_phy_cfg {
 	unsigned int pcs_usb_offset;
 
 	bool invert_cc_polarity;
+	bool has_aon_toggle;
 };
 
 struct qmp_combo {
@@ -2600,7 +2601,7 @@ struct qmp_combo {
 	const struct qmp_phy_cfg *cfg;
 
 	void __iomem *com;
-	void __iomem *aon_toggle;
+	void __iomem *com_aon;
 
 	void __iomem *serdes;
 	void __iomem *tx;
@@ -2749,7 +2750,7 @@ static const struct qmp_combo_offsets qmp_combo_offsets_v8 = {
 
 static const struct qmp_combo_offsets qmp_combo_offsets_v10 = {
 	.com		= 0x0000,
-	.aon_toggle	= 0x0400,
+	.com_aon	= 0x0400,
 	.txa		= 0x1400,
 	.rxa		= 0x1600,
 	.txb		= 0x1800,
@@ -3065,6 +3066,7 @@ static const struct qmp_phy_cfg hawi_usb3dpphy_cfg = {
 	.pcs_usb_tbl_num	= ARRAY_SIZE(hawi_usb3_pcs_usb_tbl),
 
 	.regs			= qmp_v10_usb3phy_regs_layout,
+	.has_aon_toggle		= true,
 	.reset_list		= msm8996_usb3phy_reset_l,
 	.num_resets		= ARRAY_SIZE(msm8996_usb3phy_reset_l),
 	.vreg_list		= qmp_phy_vreg_l,
@@ -3428,6 +3430,7 @@ static const struct qmp_phy_cfg glymur_usb3dpphy_cfg = {
 	.configure_dp_phy	= qmp_v8_configure_dp_phy,
 
 	.regs			= qmp_v8_n3_usb43dpphy_regs_layout,
+	.has_aon_toggle		= true,
 	.reset_list		= msm8996_usb3phy_reset_l,
 	.num_resets		= ARRAY_SIZE(msm8996_usb3phy_reset_l),
 	.vreg_list		= qmp_phy_vreg_refgen,
@@ -4095,17 +4098,17 @@ static int qmp_combo_com_init(struct qmp_combo *qmp, bool force)
 	void __iomem *pcs_aon = qmp->pcs_aon;
 	void __iomem *pcs = qmp->pcs;
 	void __iomem *com = qmp->com;
-	void __iomem *aon_toggle;
+	void __iomem *aon_base;
 	int ret;
 	u32 val;
 
 	if (!force && qmp->init_count++)
 		return 0;
 
-	if (qmp->aon_toggle)
-		aon_toggle = qmp->aon_toggle;
+	if (qmp->com_aon)
+		aon_base = qmp->com_aon;
 	else
-		aon_toggle = qmp->pcs_aon;
+		aon_base = qmp->pcs_aon;
 
 	if (qmp->qmpphy_mode == QMPPHY_MODE_USB4) {
 		pcs = qmp->usb4_pcs;
@@ -4155,9 +4158,9 @@ static int qmp_combo_com_init(struct qmp_combo *qmp, bool force)
 			SW_USB4PHY_RESET_MUX | SW_USB4PHY_RESET);
 
 	/* override hardware control for reset of qmp phy */
-	if (aon_toggle && cfg->regs[QPHY_AON_TOGGLE_ENABLE]) {
-		qphy_clrbits(aon_toggle, cfg->regs[QPHY_AON_TOGGLE_ENABLE], 0x1);
-		qphy_clrbits(aon_toggle, cfg->regs[QPHY_DP_AON_TOGGLE_ENABLE], 0x1);
+	if (aon_base && cfg->has_aon_toggle) {
+		qphy_clrbits(aon_base, cfg->regs[QPHY_AON_TOGGLE_ENABLE], 0x1);
+		qphy_clrbits(aon_base, cfg->regs[QPHY_DP_AON_TOGGLE_ENABLE], 0x1);
 	}
 
 	/* Use software based port select and switch on typec orientation */
@@ -5386,8 +5389,8 @@ static int qmp_combo_parse_dt(struct qmp_combo *qmp)
 	}
 	qmp->dp_dp_phy = base + offs->dp_dp_phy;
 
-	if (offs->aon_toggle)
-		qmp->aon_toggle = base + offs->aon_toggle;
+	if (offs->com_aon)
+		qmp->com_aon = base + offs->com_aon;
 
 	qmp->usb4_serdes = base + offs->usb4_serdes;
 	qmp->usb4_pcs = base + offs->usb4_pcs;
-- 
2.34.1


-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-02  4:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02  4:48 [PATCH] phy: qcom: qmp-combo: Fix AON toggle register presence check Elson Serrao
2026-12-02  4:52 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox