From nobody Tue Dec 16 21:25:29 2025 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DDD7D2FFDF5 for ; Thu, 11 Dec 2025 10:17:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765448263; cv=none; b=u9E4bAVV7OcrgT4/FKTkCs/FjX+paqszfqCVGIyboj1zoRuL2dz4aDeaYEOduOCHRWJ9kHvCAPh8CPuozW1BUgxxPZCGHhQ3XJKKbB2X6ibHApGCvneGTb5z2r7D2hAHQijUCvDIXLV+3KMqRCxpXPus3NnA5jQkporOSPwt8G8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765448263; c=relaxed/simple; bh=RaEn5l93LNR7zqx5r4en+ir39fNyXbHGQpBhRyS2cRs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fyYcRkkEyjkRJJfptcQpNASYLhG1b2FD5GwFqbQmg3GRg0hc2UQci8TVjU8V7IhaQIQHNSYN8Mxin6Vwfo1LeiNxJ9SPGekTWbjq2sq1jdUTMvOFwmGXN/Xt8MZr8+n0jiDoFmNLE6uGpZsoGUrd8vwDcEYxHxXfxYH9EDUf1vo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=SZ1ktmYH; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Z/xdt2K2; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="SZ1ktmYH"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Z/xdt2K2" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5BB9ZOMu545416 for ; Thu, 11 Dec 2025 10:17:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= GgLD6oaM0YkiC5PhLYJmGT8FbnzwNrVVKAjAgG5DbQQ=; b=SZ1ktmYH1CxL60xq FCuPjGNrHoCihYlXgGT07ZpV+Nq8Bzxo/lFx/XA69kPmQsUwY1HsixezEmHKkRDQ qub8qZv/RW6NpTOIHzekA4Gll5PsMsPCpLsSGCf7HcrR8XZvTHUeQMhpxVkjNZsU 9wBjS2Y0Wc4Xup6ZcBgsiL1jA41897u7GoQi5MlYS5swnufJ4z5glGhcv65r6pjA qH2QJRltuztXJ1BKWzyMmvxHlbL02J0b2QuZ8NG0lQSYPnMaozwSl+qUDGheuza7 jjSIptkW8t7CaK5T4nSTbom9/PehdBomhdFgQxreK9t0IBgG6dru6DIcx6Kzr9sD 6yxmkA== Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4aytwj891h-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 11 Dec 2025 10:17:40 +0000 (GMT) Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-4eff973c491so18629011cf.1 for ; Thu, 11 Dec 2025 02:17:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1765448259; x=1766053059; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=GgLD6oaM0YkiC5PhLYJmGT8FbnzwNrVVKAjAgG5DbQQ=; b=Z/xdt2K2kT2xWhg7g/24YFglp+J3fkDXT/1qSJzzq85lBZcUeKx5u5Wihk8iq+Bg4y pCTeJOFctOO5hmk5DKIgK4kZYCAsvbH2//HW2J6vfNtp2DfKcXTSH5yQsteZZr9DpU05 HEUi/MpNewJZ+qN0Hc2qpUjwGsKEcrWz4wtxDf9Rzo2yzxbWF57vCNxgEINNGgh7A99q rGARBBfMCeLR5PozYBdiv7c1/auD6I5IzEuh8O4/+lQbZrkglqaqxsYrkQpMcOtxZo9f UXelmAdgRc9cX8XQ+G+sZFg1RQik5IAOXRBfmKEQXIT7s3u7e1FtgIxndzML1ak/KftI k23g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765448259; x=1766053059; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=GgLD6oaM0YkiC5PhLYJmGT8FbnzwNrVVKAjAgG5DbQQ=; b=dU47/jR87cn6h2ZKtUaf76L7hyP8IF19JSd6GEyBc+IjLatkxTER/Kqg92wBAQuaBK ymbvMTYCWyb8mQdcfi4Y1O6mcC6qty8m0hTraRH8FbP1MmksC/vTlz2z3x9FL0KOlrIF YRYxpBSzCW82UQsoPC5T95IUHrU80rLxrTFCUjR+m7wLqPwQpHjuIFLWB/MB6FwK8lQN PTFZ+4HPOTBpikL4SelM+mYY3WXqjy1Op0jouFk0UZU0+XThZZy6fKQVLJT2Gzpjhg3f pKCNXmWZBShErPKvrJhcto2vgQ8+3ka2H1dXqxDamlzed8p32Rx6uyjXJ/dUQtMV4jgj JQwQ== X-Forwarded-Encrypted: i=1; AJvYcCXMNqN5w1TfIUVyvn+eTGoi3S+3+/sxEuFbqvRCCp2nW9CGSXKtlbbmBjoB332aIMAXEWTDMWrNdD2vDw0=@vger.kernel.org X-Gm-Message-State: AOJu0YzXYIHZP+6fOh+3hsMOiAGvgQ6THTG6tGLtENcvT216YDMXGVAf L0drfrSb1+kfgscNbMMkkbmKep5tvupsXCIY247C1CKW+LlYDD2HQ0Hba1lHEC/LAylfN237ZKk u9EDtbQf3oflTSnwYeluyIR5neIgt+4XRlwNCRCAx/ZBN1lAAsV46PqX8fNFyLx53AsE= X-Gm-Gg: AY/fxX6DPClUigg+zDJiFt4o13PtpmRArSKDn7GwU4uJxvPAQt6GfErScSUbWJQ9ZUA OxEyQZ+ljsdmK8cK5SEUotqj+JvBW605gnB03eb+rwTt/cWpZcJRsDWU5a1hPkpFyJ1BNgQ5L02 /mz+5FtQ9b90VvL7JEqRdY+fMNyjuQrv2f13kwkiVBTn7WS9yHp9NeN3kObYLQFlH9DoZI1on45 3if/HZr9FLwNOPxoWNa2z+DE4hyau0loph1nDRyIl9rweHG+8FORP9atb8I0hsHjI5/i6VA95g7 zyUgcahqqSY2lI3Jrk8HznmqC1xQB1cvUPn+6PhLXFJPClcfhSaugGNxJDp8hPFt8UIJUH81lPn cGqyoMBtzqcOK5S0= X-Received: by 2002:a05:622a:1210:b0:4f1:ab3b:a29a with SMTP id d75a77b69052e-4f1b1b20bb7mr77006061cf.65.1765448258896; Thu, 11 Dec 2025 02:17:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IF+0uD2u7N7HeXWEs/TWc2sJHEmtoBvpweZuxVefZuSIZKGawQM5RE46YfK1m1y4dGhzWmaPQ== X-Received: by 2002:a05:622a:1210:b0:4f1:ab3b:a29a with SMTP id d75a77b69052e-4f1b1b20bb7mr77005771cf.65.1765448258365; Thu, 11 Dec 2025 02:17:38 -0800 (PST) Received: from hackbox.lan ([86.121.7.169]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b7cfa5191efsm225381766b.40.2025.12.11.02.17.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Dec 2025 02:17:37 -0800 (PST) From: Abel Vesa Date: Thu, 11 Dec 2025 12:17:25 +0200 Subject: [PATCH v6 4/4] phy: qcom: edp: Add Glymur platform support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251211-phy-qcom-edp-add-glymur-support-v6-4-5be5b32762b5@oss.qualcomm.com> References: <20251211-phy-qcom-edp-add-glymur-support-v6-0-5be5b32762b5@oss.qualcomm.com> In-Reply-To: <20251211-phy-qcom-edp-add-glymur-support-v6-0-5be5b32762b5@oss.qualcomm.com> To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson Cc: Dmitry Baryshkov , Konrad Dybcio , Neil Armstrong , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Abel Vesa , Abel Vesa X-Mailer: b4 0.15-dev-47773 X-Developer-Signature: v=1; a=openpgp-sha256; l=12602; i=abel.vesa@oss.qualcomm.com; h=from:subject:message-id; bh=3wDDa0y3Nu5j7vScRtA7bGLBMevmnIkgnnn9OsoiXkg=; b=owEBbQKS/ZANAwAKARtfRMkAlRVWAcsmYgBpOpo41GA7lRFBYv4uXmv5Cho853sjy+a2Y8AGm v/r6QMHvzyJAjMEAAEKAB0WIQRO8+4RTnqPKsqn0bgbX0TJAJUVVgUCaTqaOAAKCRAbX0TJAJUV VtiwD/9TSmbV5Rv4XN9y8w59RirsQsJ/kaR3TIjqrkxtUyO9XmWHQ1tG4Eh4vKzKyS80fyLSoab YuVhno6dcSH5aDYCiGjXPPFctqWhcaowSb6V2Q0RlHAtzn1iAPgOMoCj8cTYymgdV3mM9Sgb/Qa N0o7YoEh8fwdFimgRehlZ1TPi14fK6+G/L61LvyzSRUNM9NPN3ybTpis4pNt0CbyUGsSwi6s6NT hYPOje32QAsSIw1R+qW0Op9HVEHwg+nBnqDjqex1H0UmeYl8DME4gqRYehk0kRn/uaOvrkmh6lM 4wclTRdzLU7vUE3lPFDmC4cZ2FkpOFk8lhg/7Y0/TXIc013feDztd5sIbIpDEdl4+bBokxfhZas OmXD72AVY9tW9pOKuQBHtWHAQcKjrCk7N1/oj9JMa7iio+qVO3KilWMYLHMV7b7vpJHuU1ITPYx Xebjooiu5oKVessWXswmtNrE6OsBT+xzr7HqmgzwgniRF8UAKWF5zpouTCA6P82iwUzqKinEuQm 0zYinr2hLTffEhYG+dwIFo8+o3U7zzrgANcicroxRRx+OTHmwtqIVzKXzQ0jK9V/4BhIFLlhanh 7P3mrULOoJTIiEqbAMOJ7rkpKqHclKtN1RLpoh0j4GKYnKqpETyMxY+8SoOXvvVyFQeZn5f9b8s TQXS6InwvwSrZ4w== X-Developer-Key: i=abel.vesa@oss.qualcomm.com; a=openpgp; fpr=6AFF162D57F4223A8770EF5AF7BF214136F41FAE X-Proofpoint-GUID: uYQm91bwQmN2yd38HjUvZSSEBSRa4xTR X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjExMDA3OCBTYWx0ZWRfX9eMUp8+MRBv+ /TwJ8V3Cn6iPZZf6w8rcn0HuJ+Ce+5js4bW76FE+cJ79Vb/GsHJvDeWGKnu1E1dlG9CL4kmfwwm QIzK8y5SikUxym7E4zJRcOLzJsiYC01TzgZBI1lir7FvxDleJViTbmtNP1mN/Kv7lEyUWSWW0XF McNiHu0ou4Zz6UU0KoO/3sK+riSrxgmOD/mjtPOEsqxeXxCRMog2QIsD9zBZ2e/EoBmhuqukol1 AKfgb6q6DcEs8FtRHzF1JfCDDTADTj7zK3fgeAXnd3C0Y1wSqatowrsDJebpJDSTJqDu/3YIzYh 1Uid3mtIFd1H+J/7SaAeVpWk6trIC9D6B6plVVSonlyDvvdkvj6ecemXx43kJlKoKJBv1oLlFCs wB7VDyWuqoZxRoE/E0duEAvvh6Y0kA== X-Authority-Analysis: v=2.4 cv=YokChoYX c=1 sm=1 tr=0 ts=693a9a44 cx=c_pps a=JbAStetqSzwMeJznSMzCyw==:117 a=DdBtMnqNxkYIvXj6ev4VzQ==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=4YCwYE_O2Fn-gSgt1roA:9 a=QEXdDO2ut3YA:10 a=uxP6HrT_eTzRwkO_Te1X:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-ORIG-GUID: uYQm91bwQmN2yd38HjUvZSSEBSRa4xTR X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-10_03,2025-12-09_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 malwarescore=0 lowpriorityscore=0 spamscore=0 clxscore=1015 suspectscore=0 bulkscore=0 impostorscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2512110078 From: Abel Vesa The Qualcomm Glymur platform has the new v8 version of the eDP/DP PHY. So rework the driver to support this new version and add the platform specific configuration data. While at it, add the rest of the AUX_CFG reset values for the v4 and v5 platforms, which makes the handling of the platforms specific array cleaner, as they are single sized now. Signed-off-by: Abel Vesa Signed-off-by: Abel Vesa Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-edp.c | 227 ++++++++++++++++++++++++++++++++= ++-- 1 file changed, 219 insertions(+), 8 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-edp.c b/drivers/phy/qualcomm/phy= -qcom-edp.c index f98fe83de42e..13feab99feec 100644 --- a/drivers/phy/qualcomm/phy-qcom-edp.c +++ b/drivers/phy/qualcomm/phy-qcom-edp.c @@ -26,6 +26,8 @@ #include "phy-qcom-qmp-qserdes-com-v4.h" #include "phy-qcom-qmp-qserdes-com-v6.h" =20 +#include "phy-qcom-qmp-qserdes-dp-com-v8.h" + /* EDP_PHY registers */ #define DP_PHY_CFG 0x0010 #define DP_PHY_CFG_1 0x0014 @@ -76,6 +78,7 @@ struct phy_ver_ops { int (*com_power_on)(const struct qcom_edp *edp); int (*com_resetsm_cntrl)(const struct qcom_edp *edp); int (*com_bias_en_clkbuflr)(const struct qcom_edp *edp); + int (*com_clk_fwd_cfg)(const struct qcom_edp *edp); int (*com_configure_pll)(const struct qcom_edp *edp); int (*com_configure_ssc)(const struct qcom_edp *edp); }; @@ -83,6 +86,7 @@ struct phy_ver_ops { struct qcom_edp_phy_cfg { bool is_edp; const u8 *aux_cfg; + const u8 *vco_div_cfg; const struct qcom_edp_swing_pre_emph_cfg *swing_pre_emph_cfg; const struct phy_ver_ops *ver_ops; }; @@ -181,8 +185,12 @@ static const struct qcom_edp_swing_pre_emph_cfg edp_ph= y_swing_pre_emph_cfg =3D { .pre_emphasis_hbr3_hbr2 =3D &edp_pre_emp_hbr2_hbr3, }; =20 -static const u8 edp_phy_aux_cfg_v4[10] =3D { - 0x00, 0x13, 0x24, 0x00, 0x0a, 0x26, 0x0a, 0x03, 0x37, 0x03 +static const u8 edp_phy_aux_cfg_v4[DP_AUX_CFG_SIZE] =3D { + 0x00, 0x13, 0x24, 0x00, 0x0a, 0x26, 0x0a, 0x03, 0x37, 0x03, 0x02, 0x02, 0= x00, +}; + +static const u8 edp_phy_vco_div_cfg_v4[4] =3D { + 0x01, 0x01, 0x02, 0x00, }; =20 static const u8 edp_pre_emp_hbr_rbr_v5[4][4] =3D { @@ -206,8 +214,16 @@ static const struct qcom_edp_swing_pre_emph_cfg edp_ph= y_swing_pre_emph_cfg_v5 =3D .pre_emphasis_hbr3_hbr2 =3D &edp_pre_emp_hbr2_hbr3_v5, }; =20 -static const u8 edp_phy_aux_cfg_v5[10] =3D { - 0x00, 0x13, 0xa4, 0x00, 0x0a, 0x26, 0x0a, 0x03, 0x37, 0x03 +static const u8 edp_phy_aux_cfg_v5[DP_AUX_CFG_SIZE] =3D { + 0x00, 0x13, 0xa4, 0x00, 0x0a, 0x26, 0x0a, 0x03, 0x37, 0x03, 0x02, 0x02, 0= x00, +}; + +static const u8 edp_phy_aux_cfg_v8[DP_AUX_CFG_SIZE] =3D { + 0x00, 0x00, 0xa0, 0x00, 0x0a, 0x26, 0x0a, 0x03, 0x37, 0x03, 0x02, 0x02, 0= x04, +}; + +static const u8 edp_phy_vco_div_cfg_v8[4] =3D { + 0x00, 0x00, 0x02, 0x01, }; =20 static int qcom_edp_phy_init(struct phy *phy) @@ -226,6 +242,10 @@ static int qcom_edp_phy_init(struct phy *phy) =20 memcpy(aux_cfg, edp->cfg->aux_cfg, sizeof(aux_cfg)); =20 + ret =3D edp->cfg->ver_ops->com_clk_fwd_cfg(edp); + if (ret) + return ret; + 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, edp->edp + DP_PHY_PD_CTL); @@ -345,22 +365,22 @@ static int qcom_edp_set_vco_div(const struct qcom_edp= *edp, unsigned long *pixel =20 switch (dp_opts->link_rate) { case 1620: - vco_div =3D 0x1; + vco_div =3D edp->cfg->vco_div_cfg[0]; *pixel_freq =3D 1620000000UL / 2; break; =20 case 2700: - vco_div =3D 0x1; + vco_div =3D edp->cfg->vco_div_cfg[1]; *pixel_freq =3D 2700000000UL / 2; break; =20 case 5400: - vco_div =3D 0x2; + vco_div =3D edp->cfg->vco_div_cfg[2]; *pixel_freq =3D 5400000000UL / 4; break; =20 case 8100: - vco_div =3D 0x0; + vco_div =3D edp->cfg->vco_div_cfg[3]; *pixel_freq =3D 8100000000UL / 6; break; =20 @@ -398,6 +418,11 @@ static int qcom_edp_phy_com_resetsm_cntrl_v4(const str= uct qcom_edp *edp) val, val & BIT(0), 500, 10000); } =20 +static int qcom_edp_com_clk_fwd_cfg_v4(const struct qcom_edp *edp) +{ + return 0; +} + static int qcom_edp_com_bias_en_clkbuflr_v4(const struct qcom_edp *edp) { /* Turn on BIAS current for PHY/PLL */ @@ -530,6 +555,7 @@ static const struct phy_ver_ops qcom_edp_phy_ops_v4 =3D= { .com_power_on =3D qcom_edp_phy_power_on_v4, .com_resetsm_cntrl =3D qcom_edp_phy_com_resetsm_cntrl_v4, .com_bias_en_clkbuflr =3D qcom_edp_com_bias_en_clkbuflr_v4, + .com_clk_fwd_cfg =3D qcom_edp_com_clk_fwd_cfg_v4, .com_configure_pll =3D qcom_edp_com_configure_pll_v4, .com_configure_ssc =3D qcom_edp_com_configure_ssc_v4, }; @@ -537,17 +563,20 @@ static const struct phy_ver_ops qcom_edp_phy_ops_v4 = =3D { static const struct qcom_edp_phy_cfg sa8775p_dp_phy_cfg =3D { .is_edp =3D false, .aux_cfg =3D edp_phy_aux_cfg_v5, + .vco_div_cfg =3D edp_phy_vco_div_cfg_v4, .swing_pre_emph_cfg =3D &edp_phy_swing_pre_emph_cfg_v5, .ver_ops =3D &qcom_edp_phy_ops_v4, }; =20 static const struct qcom_edp_phy_cfg sc7280_dp_phy_cfg =3D { .aux_cfg =3D edp_phy_aux_cfg_v4, + .vco_div_cfg =3D edp_phy_vco_div_cfg_v4, .ver_ops =3D &qcom_edp_phy_ops_v4, }; =20 static const struct qcom_edp_phy_cfg sc8280xp_dp_phy_cfg =3D { .aux_cfg =3D edp_phy_aux_cfg_v4, + .vco_div_cfg =3D edp_phy_vco_div_cfg_v4, .swing_pre_emph_cfg =3D &dp_phy_swing_pre_emph_cfg, .ver_ops =3D &qcom_edp_phy_ops_v4, }; @@ -555,6 +584,7 @@ static const struct qcom_edp_phy_cfg sc8280xp_dp_phy_cf= g =3D { static const struct qcom_edp_phy_cfg sc8280xp_edp_phy_cfg =3D { .is_edp =3D true, .aux_cfg =3D edp_phy_aux_cfg_v4, + .vco_div_cfg =3D edp_phy_vco_div_cfg_v4, .swing_pre_emph_cfg =3D &edp_phy_swing_pre_emph_cfg, .ver_ops =3D &qcom_edp_phy_ops_v4, }; @@ -734,10 +764,190 @@ static const struct phy_ver_ops qcom_edp_phy_ops_v6 = =3D { =20 static struct qcom_edp_phy_cfg x1e80100_phy_cfg =3D { .aux_cfg =3D edp_phy_aux_cfg_v4, + .vco_div_cfg =3D edp_phy_vco_div_cfg_v4, .swing_pre_emph_cfg =3D &dp_phy_swing_pre_emph_cfg, .ver_ops =3D &qcom_edp_phy_ops_v6, }; =20 +static int qcom_edp_com_configure_ssc_v8(const struct qcom_edp *edp) +{ + const struct phy_configure_opts_dp *dp_opts =3D &edp->dp_opts; + u32 step1; + u32 step2; + + switch (dp_opts->link_rate) { + case 1620: + case 2700: + case 8100: + step1 =3D 0x5b; + step2 =3D 0x02; + break; + + case 5400: + step1 =3D 0x5b; + step2 =3D 0x02; + break; + + default: + /* Other link rates aren't supported */ + return -EINVAL; + } + + writel(0x01, edp->pll + DP_QSERDES_V8_COM_SSC_EN_CENTER); + writel(0x00, edp->pll + DP_QSERDES_V8_COM_SSC_ADJ_PER1); + writel(0x6b, edp->pll + DP_QSERDES_V8_COM_SSC_PER1); + writel(0x02, edp->pll + DP_QSERDES_V8_COM_SSC_PER2); + writel(step1, edp->pll + DP_QSERDES_V8_COM_SSC_STEP_SIZE1_MODE0); + writel(step2, edp->pll + DP_QSERDES_V8_COM_SSC_STEP_SIZE2_MODE0); + + return 0; +} + +static int qcom_edp_com_configure_pll_v8(const struct qcom_edp *edp) +{ + const struct phy_configure_opts_dp *dp_opts =3D &edp->dp_opts; + u32 div_frac_start2_mode0; + u32 div_frac_start3_mode0; + u32 dec_start_mode0; + u32 lock_cmp1_mode0; + u32 lock_cmp2_mode0; + u32 code1_mode0; + u32 code2_mode0; + u32 hsclk_sel; + + switch (dp_opts->link_rate) { + case 1620: + hsclk_sel =3D 0x5; + dec_start_mode0 =3D 0x34; + div_frac_start2_mode0 =3D 0xc0; + div_frac_start3_mode0 =3D 0x0b; + lock_cmp1_mode0 =3D 0x37; + lock_cmp2_mode0 =3D 0x04; + code1_mode0 =3D 0x71; + code2_mode0 =3D 0x0c; + break; + + case 2700: + hsclk_sel =3D 0x3; + dec_start_mode0 =3D 0x34; + div_frac_start2_mode0 =3D 0xc0; + div_frac_start3_mode0 =3D 0x0b; + lock_cmp1_mode0 =3D 0x07; + lock_cmp2_mode0 =3D 0x07; + code1_mode0 =3D 0x71; + code2_mode0 =3D 0x0c; + break; + + case 5400: + case 8100: + hsclk_sel =3D 0x2; + dec_start_mode0 =3D 0x4f; + div_frac_start2_mode0 =3D 0xa0; + div_frac_start3_mode0 =3D 0x01; + lock_cmp1_mode0 =3D 0x18; + lock_cmp2_mode0 =3D 0x15; + code1_mode0 =3D 0x14; + code2_mode0 =3D 0x25; + break; + + default: + /* Other link rates aren't supported */ + return -EINVAL; + } + + writel(0x01, edp->pll + DP_QSERDES_V8_COM_SVS_MODE_CLK_SEL); + writel(0x3b, edp->pll + DP_QSERDES_V8_COM_SYSCLK_EN_SEL); + writel(0x02, edp->pll + DP_QSERDES_V8_COM_SYS_CLK_CTRL); + writel(0x0c, edp->pll + DP_QSERDES_V8_COM_CLK_ENABLE1); + writel(0x06, edp->pll + DP_QSERDES_V8_COM_SYSCLK_BUF_ENABLE); + writel(0x30, edp->pll + DP_QSERDES_V8_COM_CLK_SELECT); + writel(hsclk_sel, edp->pll + DP_QSERDES_V8_COM_HSCLK_SEL_1); + writel(0x07, edp->pll + DP_QSERDES_V8_COM_PLL_IVCO); + writel(0x00, edp->pll + DP_QSERDES_V8_COM_LOCK_CMP_EN); + writel(0x36, edp->pll + DP_QSERDES_V8_COM_PLL_CCTRL_MODE0); + writel(0x16, edp->pll + DP_QSERDES_V8_COM_PLL_RCTRL_MODE0); + writel(0x06, edp->pll + DP_QSERDES_V8_COM_CP_CTRL_MODE0); + writel(dec_start_mode0, edp->pll + DP_QSERDES_V8_COM_DEC_START_MODE0); + writel(0x00, edp->pll + DP_QSERDES_V8_COM_DIV_FRAC_START1_MODE0); + writel(div_frac_start2_mode0, edp->pll + DP_QSERDES_V8_COM_DIV_FRAC_START= 2_MODE0); + writel(div_frac_start3_mode0, edp->pll + DP_QSERDES_V8_COM_DIV_FRAC_START= 3_MODE0); + writel(0x96, edp->pll + DP_QSERDES_V8_COM_CMN_CONFIG_1); + writel(0x3f, edp->pll + DP_QSERDES_V8_COM_INTEGLOOP_GAIN0_MODE0); + writel(0x00, edp->pll + DP_QSERDES_V8_COM_INTEGLOOP_GAIN1_MODE0); + writel(0x00, edp->pll + DP_QSERDES_V8_COM_VCO_TUNE_MAP); + writel(lock_cmp1_mode0, edp->pll + DP_QSERDES_V8_COM_LOCK_CMP1_MODE0); + writel(lock_cmp2_mode0, edp->pll + DP_QSERDES_V8_COM_LOCK_CMP2_MODE0); + + writel(0x0a, edp->pll + DP_QSERDES_V8_COM_BG_TIMER); + writel(0x0a, edp->pll + DP_QSERDES_V8_COM_CORECLK_DIV_MODE0); + writel(0x00, edp->pll + DP_QSERDES_V8_COM_VCO_TUNE_CTRL); + writel(0x1f, edp->pll + DP_QSERDES_V8_COM_BIAS_EN_CLKBUFLR_EN); + writel(0x00, edp->pll + DP_QSERDES_V8_COM_CORE_CLK_EN); + writel(0xa0, edp->pll + DP_QSERDES_V8_COM_VCO_TUNE1_MODE0); + writel(0x01, edp->pll + DP_QSERDES_V8_COM_VCO_TUNE2_MODE0); + + writel(code1_mode0, edp->pll + DP_QSERDES_V8_COM_BIN_VCOCAL_CMP_CODE1_MOD= E0); + writel(code2_mode0, edp->pll + DP_QSERDES_V8_COM_BIN_VCOCAL_CMP_CODE2_MOD= E0); + + return 0; +} + + +static int qcom_edp_phy_com_resetsm_cntrl_v8(const struct qcom_edp *edp) +{ + u32 val; + + writel(0x20, edp->pll + DP_QSERDES_V8_COM_RESETSM_CNTRL); + + return readl_poll_timeout(edp->pll + DP_QSERDES_V8_COM_C_READY_STATUS, + val, val & BIT(0), 500, 10000); +} + +static int qcom_edp_com_clk_fwd_cfg_v8(const struct qcom_edp *edp) +{ + writel(0x3f, edp->pll + DP_QSERDES_V8_COM_CLK_FWD_CONFIG_1); + + return 0; +} + +static int qcom_edp_com_bias_en_clkbuflr_v8(const struct qcom_edp *edp) +{ + /* Turn on BIAS current for PHY/PLL */ + writel(0x1f, edp->pll + DP_QSERDES_V8_COM_BIAS_EN_CLKBUFLR_EN); + + return 0; +} + +static int qcom_edp_phy_power_on_v8(const struct qcom_edp *edp) +{ + u32 val; + + 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, + edp->edp + DP_PHY_PD_CTL); + writel(0xfc, edp->edp + DP_PHY_MODE); + + return readl_poll_timeout(edp->pll + DP_QSERDES_V8_COM_CMN_STATUS, + val, val & BIT(7), 5, 200); +} + +static const struct phy_ver_ops qcom_edp_phy_ops_v8 =3D { + .com_power_on =3D qcom_edp_phy_power_on_v8, + .com_resetsm_cntrl =3D qcom_edp_phy_com_resetsm_cntrl_v8, + .com_bias_en_clkbuflr =3D qcom_edp_com_bias_en_clkbuflr_v8, + .com_clk_fwd_cfg =3D qcom_edp_com_clk_fwd_cfg_v8, + .com_configure_pll =3D qcom_edp_com_configure_pll_v8, + .com_configure_ssc =3D qcom_edp_com_configure_ssc_v8, +}; + +static struct qcom_edp_phy_cfg glymur_phy_cfg =3D { + .aux_cfg =3D edp_phy_aux_cfg_v8, + .vco_div_cfg =3D edp_phy_vco_div_cfg_v8, + .swing_pre_emph_cfg =3D &edp_phy_swing_pre_emph_cfg_v5, + .ver_ops =3D &qcom_edp_phy_ops_v8, +}; + static int qcom_edp_phy_power_on(struct phy *phy) { const struct qcom_edp *edp =3D phy_get_drvdata(phy); @@ -1133,6 +1343,7 @@ static int qcom_edp_phy_probe(struct platform_device = *pdev) } =20 static const struct of_device_id qcom_edp_phy_match_table[] =3D { + { .compatible =3D "qcom,glymur-dp-phy", .data =3D &glymur_phy_cfg, }, { .compatible =3D "qcom,sa8775p-edp-phy", .data =3D &sa8775p_dp_phy_cfg, = }, { .compatible =3D "qcom,sc7280-edp-phy", .data =3D &sc7280_dp_phy_cfg, }, { .compatible =3D "qcom,sc8180x-edp-phy", .data =3D &sc7280_dp_phy_cfg, }, --=20 2.48.1