From nobody Wed Dec 31 06:41:41 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FB77C0032E for ; Tue, 7 Nov 2023 12:39:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234870AbjKGMjv (ORCPT ); Tue, 7 Nov 2023 07:39:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235211AbjKGMia (ORCPT ); Tue, 7 Nov 2023 07:38:30 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6403710DB; Tue, 7 Nov 2023 04:26:42 -0800 (PST) Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3A75xLkQ024972; Tue, 7 Nov 2023 12:26:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : date : subject : mime-version : content-type : content-transfer-encoding : message-id : references : in-reply-to : to : cc; s=qcppdkim1; bh=oMRemMIvwiE2zroFHp2/PLiNZr1IPmhJUQutzi9KI+Y=; b=UqPr873pDPF+owub+WrD4+OII30wyD/QxWGz1A6NVUDdmpGVw3qZFyBM8IZtW+lCS+QQ /fJ2wnMaqsJQ4U3N7EPaS1dk+0ZuU92xQJ82afRx/pDLHimK1CbkWtjYLHZHjQHfxmjV yuA57sU2GXIm+9Qri32ukSdQ6q9Waw2+Rr9H5KRnp1Zeco0avilKkg733dq1fQ3814G5 3+OTbXhRKwlFJ4ix4jbTU23OqUqmHlFZMDu6dbxLAaVDLyD0JN+GqqdgrAf3U/X4Oj0J m/x1k+ugmMzZQnLQNDJ+M6eI6RQyCLaGowCK+rZ/dQcStYZH5aChAbzR4DE56iItzHQd Qw== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3u6wer3dq3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Nov 2023 12:26:37 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3A7CQaM0016385 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 7 Nov 2023 12:26:36 GMT Received: from hu-krichai-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.39; Tue, 7 Nov 2023 04:26:31 -0800 From: Krishna chaitanya chundru Date: Tue, 7 Nov 2023 17:56:14 +0530 Subject: [PATCH v2 2/3] phy: qcom-qmp-pcie: Add endpoint refclk control register offset MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20231107-refclk_always_on-v2-2-de23962fc4b3@quicinc.com> References: <20231107-refclk_always_on-v2-0-de23962fc4b3@quicinc.com> In-Reply-To: <20231107-refclk_always_on-v2-0-de23962fc4b3@quicinc.com> To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley CC: , , , , , , , , , , "Krishna chaitanya chundru" X-Mailer: b4 0.13-dev-83828 X-Developer-Signature: v=1; a=ed25519-sha256; t=1699359980; l=6309; i=quic_krichai@quicinc.com; s=20230907; h=from:subject:message-id; bh=ZdPM6QISDhv70aPcFpN9ct9I8TPBnav28MgwnTR7tPs=; b=purTLvJZKtXB6NKAoaYey0fB4jCChK4BITY0ZK52SYdraTfUNbt8kziz9tq0Tc+pPPTrMBBqo awtofObkP6vDiFhQq5EkB+w6+jyRO4c7xRYkLTMVZe+EspJkbFsZcKx X-Developer-Key: i=quic_krichai@quicinc.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: WEFy6ipp8kuCXrRs8QJIlQFPZNdgJblF X-Proofpoint-GUID: WEFy6ipp8kuCXrRs8QJIlQFPZNdgJblF X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-07_02,2023-11-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 malwarescore=0 spamscore=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 phishscore=0 mlxscore=0 priorityscore=1501 adultscore=0 mlxlogscore=847 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310240000 definitions=main-2311070102 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some platforms needs to keep endpoint refclk always on, for this purpose add this offset for all the applicable phy versions. And also add reg layout for few controllers as we are adding endpoint refclk control register which changes based upon phy version. Signed-off-by: Krishna chaitanya chundru Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 26 ++++++++++++++++++= +--- drivers/phy/qualcomm/phy-qcom-qmp-pcs-pcie-v5.h | 1 + drivers/phy/qualcomm/phy-qcom-qmp-pcs-pcie-v5_20.h | 1 + drivers/phy/qualcomm/phy-qcom-qmp-pcs-pcie-v6_20.h | 1 + 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c b/drivers/phy/qualcom= m/phy-qcom-qmp-pcie.c index a63ca7424974..74d03d217ff2 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c @@ -77,6 +77,7 @@ enum qphy_reg_layout { QPHY_START_CTRL, QPHY_PCS_STATUS, QPHY_PCS_POWER_DOWN_CONTROL, + QPHY_PCS_ENDPOINT_REFCLK_CNTRL, /* Keep last to ensure regs_layout arrays are properly initialized */ QPHY_LAYOUT_SIZE }; @@ -93,6 +94,7 @@ static const unsigned int pciephy_v3_regs_layout[QPHY_LAY= OUT_SIZE] =3D { [QPHY_START_CTRL] =3D QPHY_V3_PCS_START_CONTROL, [QPHY_PCS_STATUS] =3D QPHY_V3_PCS_PCS_STATUS, [QPHY_PCS_POWER_DOWN_CONTROL] =3D QPHY_V3_PCS_POWER_DOWN_CONTROL, + [QPHY_PCS_ENDPOINT_REFCLK_CNTRL] =3D QPHY_V3_PCS_ENDPOINT_REFCLK_CNTRL, }; =20 static const unsigned int sdm845_qhp_pciephy_regs_layout[QPHY_LAYOUT_SIZE]= =3D { @@ -107,6 +109,7 @@ static const unsigned int pciephy_v4_regs_layout[QPHY_L= AYOUT_SIZE] =3D { [QPHY_START_CTRL] =3D QPHY_V4_PCS_START_CONTROL, [QPHY_PCS_STATUS] =3D QPHY_V4_PCS_PCS_STATUS1, [QPHY_PCS_POWER_DOWN_CONTROL] =3D QPHY_V4_PCS_POWER_DOWN_CONTROL, + [QPHY_PCS_ENDPOINT_REFCLK_CNTRL] =3D QPHY_V4_PCS_PCIE_ENDPOINT_REFCLK_CNT= RL, }; =20 static const unsigned int pciephy_v5_regs_layout[QPHY_LAYOUT_SIZE] =3D { @@ -114,6 +117,23 @@ static const unsigned int pciephy_v5_regs_layout[QPHY_= LAYOUT_SIZE] =3D { [QPHY_START_CTRL] =3D QPHY_V5_PCS_START_CONTROL, [QPHY_PCS_STATUS] =3D QPHY_V5_PCS_PCS_STATUS1, [QPHY_PCS_POWER_DOWN_CONTROL] =3D QPHY_V5_PCS_POWER_DOWN_CONTROL, + [QPHY_PCS_ENDPOINT_REFCLK_CNTRL] =3D QPHY_V5_PCS_PCIE_ENDPOINT_REFCLK_CNT= RL, +}; + +static const unsigned int pciephy_v5_20_regs_layout[QPHY_LAYOUT_SIZE] =3D { + [QPHY_SW_RESET] =3D QPHY_V5_PCS_SW_RESET, + [QPHY_START_CTRL] =3D QPHY_V5_PCS_START_CONTROL, + [QPHY_PCS_STATUS] =3D QPHY_V5_PCS_PCS_STATUS1, + [QPHY_PCS_POWER_DOWN_CONTROL] =3D QPHY_V5_PCS_POWER_DOWN_CONTROL, + [QPHY_PCS_ENDPOINT_REFCLK_CNTRL] =3D QPHY_V5_20_PCS_PCIE_ENDPOINT_REFCLK_= CNTRL, +}; + +static const unsigned int pciephy_v6_20_regs_layout[QPHY_LAYOUT_SIZE] =3D { + [QPHY_SW_RESET] =3D QPHY_V5_PCS_SW_RESET, + [QPHY_START_CTRL] =3D QPHY_V5_PCS_START_CONTROL, + [QPHY_PCS_STATUS] =3D QPHY_V5_PCS_PCS_STATUS1, + [QPHY_PCS_POWER_DOWN_CONTROL] =3D QPHY_V5_PCS_POWER_DOWN_CONTROL, + [QPHY_PCS_ENDPOINT_REFCLK_CNTRL] =3D QPHY_PCIE_V6_20_PCS_ENDPOINT_REFCLK_= CNTRL, }; =20 static const struct qmp_phy_init_tbl msm8998_pcie_serdes_tbl[] =3D { @@ -2956,7 +2976,7 @@ static const struct qmp_phy_cfg sm8450_qmp_gen4x2_pci= ephy_cfg =3D { .num_resets =3D ARRAY_SIZE(sdm845_pciephy_reset_l), .vreg_list =3D qmp_phy_vreg_l, .num_vregs =3D ARRAY_SIZE(qmp_phy_vreg_l), - .regs =3D pciephy_v5_regs_layout, + .regs =3D pciephy_v5_20_regs_layout, =20 .pwrdn_ctrl =3D SW_PWRDN | REFCLK_DRV_DSBL, .phy_status =3D PHYSTATUS_4_20, @@ -3012,7 +3032,7 @@ static const struct qmp_phy_cfg sm8550_qmp_gen4x2_pci= ephy_cfg =3D { .num_resets =3D ARRAY_SIZE(sdm845_pciephy_reset_l), .vreg_list =3D sm8550_qmp_phy_vreg_l, .num_vregs =3D ARRAY_SIZE(sm8550_qmp_phy_vreg_l), - .regs =3D pciephy_v5_regs_layout, + .regs =3D pciephy_v6_20_regs_layout, =20 .pwrdn_ctrl =3D SW_PWRDN | REFCLK_DRV_DSBL, .phy_status =3D PHYSTATUS_4_20, @@ -3047,7 +3067,7 @@ static const struct qmp_phy_cfg sa8775p_qmp_gen4x2_pc= iephy_cfg =3D { .num_resets =3D ARRAY_SIZE(sdm845_pciephy_reset_l), .vreg_list =3D qmp_phy_vreg_l, .num_vregs =3D ARRAY_SIZE(qmp_phy_vreg_l), - .regs =3D pciephy_v5_regs_layout, + .regs =3D pciephy_v5_20_regs_layout, =20 .pwrdn_ctrl =3D SW_PWRDN | REFCLK_DRV_DSBL, .phy_status =3D PHYSTATUS_4_20, diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcs-pcie-v5.h b/drivers/phy/= qualcomm/phy-qcom-qmp-pcs-pcie-v5.h index a469ae2a10a1..9b166286afda 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcs-pcie-v5.h +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcs-pcie-v5.h @@ -11,6 +11,7 @@ #define QPHY_V5_PCS_PCIE_POWER_STATE_CONFIG2 0x0c #define QPHY_V5_PCS_PCIE_POWER_STATE_CONFIG4 0x14 #define QPHY_V5_PCS_PCIE_ENDPOINT_REFCLK_DRIVE 0x20 +#define QPHY_V5_PCS_PCIE_ENDPOINT_REFCLK_CNTRL 0x24 #define QPHY_V5_PCS_PCIE_INT_AUX_CLK_CONFIG1 0x54 #define QPHY_V5_PCS_PCIE_OSC_DTCT_ACTIONS 0x94 #define QPHY_V5_PCS_PCIE_EQ_CONFIG2 0xa8 diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcs-pcie-v5_20.h b/drivers/p= hy/qualcomm/phy-qcom-qmp-pcs-pcie-v5_20.h index cdf8c04ea078..8b114e538a07 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcs-pcie-v5_20.h +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcs-pcie-v5_20.h @@ -9,6 +9,7 @@ /* Only for QMP V5_20 PHY - PCIe PCS registers */ #define QPHY_V5_20_PCS_PCIE_POWER_STATE_CONFIG2 0x00c #define QPHY_V5_20_PCS_PCIE_ENDPOINT_REFCLK_DRIVE 0x01c +#define QPHY_V5_20_PCS_PCIE_ENDPOINT_REFCLK_CNTRL 0x020 #define QPHY_V5_20_PCS_PCIE_OSC_DTCT_MODE2_CONFIG5 0x084 #define QPHY_V5_20_PCS_PCIE_OSC_DTCT_ACTIONS 0x090 #define QPHY_V5_20_PCS_PCIE_EQ_CONFIG1 0x0a0 diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcs-pcie-v6_20.h b/drivers/p= hy/qualcomm/phy-qcom-qmp-pcs-pcie-v6_20.h index e3eb08776339..f7abe95c49ad 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcs-pcie-v6_20.h +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcs-pcie-v6_20.h @@ -10,6 +10,7 @@ #define QPHY_PCIE_V6_20_PCS_POWER_STATE_CONFIG2 0x00c #define QPHY_PCIE_V6_20_PCS_TX_RX_CONFIG 0x018 #define QPHY_PCIE_V6_20_PCS_ENDPOINT_REFCLK_DRIVE 0x01c +#define QPHY_PCIE_V6_20_PCS_ENDPOINT_REFCLK_CNTRL 0x020 #define QPHY_PCIE_V6_20_PCS_OSC_DTCT_ATCIONS 0x090 #define QPHY_PCIE_V6_20_PCS_EQ_CONFIG1 0x0a0 #define QPHY_PCIE_V6_20_PCS_EQ_CONFIG5 0x108 --=20 2.42.0