Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Low] phy: qcom: edp: duplicated v6/v8 definitions and misplaced Nord code - [Low] phy: qcom: edp: asymmetric DRV_LVL writes in qcom_edp_tx_res_config_nord() --
commit d8ce2b9ae0271c780b642dc599049c73dd865127 Author: Ritesh Kumar <[email protected]> phy: qcom: edp: Add Nord eDP/DP PHY support This commit adds eDP/DP PHY support, callbacks, configuration tables, and the qcom,nord-dp-phy compatible string for the Qualcomm Nord SoC. > diff --git a/drivers/phy/qualcomm/phy-qcom-edp.c > b/drivers/phy/qualcomm/phy-qcom-edp.c > index c61e57cc2aa7b..d5de6d322f023 100644 > --- a/drivers/phy/qualcomm/phy-qcom-edp.c > +++ b/drivers/phy/qualcomm/phy-qcom-edp.c > @@ -27,6 +27,7 @@ > #include "phy-qcom-qmp-qserdes-com-v6.h" > > #include "phy-qcom-qmp-qserdes-dp-com-v8.h" > +#include "phy-qcom-qmp-qserdes-dp-com-v8-nord.h" > > /* EDP_PHY registers */ > #define DP_PHY_CFG 0x0010 > @@ -1514,6 +1515,262 @@ static int qcom_edp_phy_probe(struct platform_device > *pdev) > return PTR_ERR_OR_ZERO(phy_provider); > } > > +static const u8 nord_dp_pre_emp_hbr_rbr[4][4] = { [ ... ] > +static const u8 edp_phy_vco_div_cfg_nord[4] = { > + 0x00, 0x00, 0x02, 0x01, > +}; > + > +static int qcom_edp_ldo_config_nord(const struct qcom_edp *edp) > +{ > + const struct phy_configure_opts_dp *dp_opts = &edp->dp_opts; > + > + writel(0xd0, edp->tx0 + TXn_LDO_CONFIG); > + writel(dp_opts->lanes > 2 ? 0xd0 : 0x00, edp->tx1 + TXn_LDO_CONFIG); > + writel(0x03, edp->edp + DP_PHY_LDO_CFG_NORD); > + > + return 0; > +} > + > +static int qcom_edp_tx_res_config_nord(const struct qcom_edp *edp) > +{ > + writel(0x06, edp->tx0 + TXn_RES_CODE_LANE_OFFSET_TX0); > + writel(0x06, edp->tx0 + TXn_RES_CODE_LANE_OFFSET_TX1); > + writel(0x06, edp->tx1 + TXn_RES_CODE_LANE_OFFSET_TX0); > + writel(0x06, edp->tx1 + TXn_RES_CODE_LANE_OFFSET_TX1); > + writel(0x06, edp->tx0 + TXn_TX_EMP_POST1_LVL); > + writel(0x06, edp->tx1 + TXn_TX_EMP_POST1_LVL); > + writel(0x05, edp->tx0 + TXn_TX_BAND_NORD); > + writel(0x05, edp->tx1 + TXn_TX_BAND_NORD); > + writel(0x12, edp->edp + DP_PHY_TX_LN0_DRV_LVL_NORD); > + writel(0x12, edp->edp + DP_PHY_TX_LN1_DRV_LVL_NORD); > + > + return 0; > +} [Severity: Low] As reported by Dmitry Baryshkov on v2 [1], should initial TX drive-level programming be handled symmetrically between qcom_edp_tx_res_config_nord() and qcom_edp_tx_res_config_default()? qcom_edp_tx_res_config_nord() programs DP_PHY_TX_LN0_DRV_LVL_NORD and DP_PHY_TX_LN1_DRV_LVL_NORD, whereas qcom_edp_tx_res_config_default() omits TXn_TX_DRV_LVL and leaves those writes hardcoded in qcom_edp_phy_power_on(): drivers/phy/qualcomm/phy-qcom-edp.c:qcom_edp_phy_power_on() { ... ret = edp->cfg->ver_ops->tx_res_config(edp); if (ret) return ret; writel(0x1f, edp->tx0 + TXn_TX_DRV_LVL); writel(0x1f, edp->tx1 + TXn_TX_DRV_LVL); ... } Because qcom_edp_phy_power_on() unconditionally writes 0x1f to TXn_TX_DRV_LVL after calling tx_res_config(), Nord still executes the legacy TXn_TX_DRV_LVL writes even though it relocates drive-level control to DP_PHY_TX_LN0_DRV_LVL_NORD and DP_PHY_TX_LN1_DRV_LVL_NORD. > + > +static int qcom_edp_phy_power_on_nord(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 + NORD_DP_QSERDES_COM_CMN_STATUS, > + val, val & BIT(7), 5, 200); > +} > + > +static int qcom_edp_phy_com_resetsm_cntrl_nord(const struct qcom_edp *edp) > +{ > + u32 val; > + > + writel(0x20, edp->pll + NORD_DP_QSERDES_COM_RESETSM_CNTRL); > + > + return readl_poll_timeout(edp->pll + NORD_DP_QSERDES_COM_C_READY_STATUS, > + val, val & BIT(0), 500, 10000); > +} [ ... ] > static const struct of_device_id qcom_edp_phy_match_table[] = { > { .compatible = "qcom,glymur-dp-phy", .data = &glymur_phy_cfg, }, > { .compatible = "qcom,sa8775p-edp-phy", .data = &sa8775p_dp_phy_cfg, }, > @@ -1522,6 +1779,7 @@ static const struct of_device_id > qcom_edp_phy_match_table[] = { > { .compatible = "qcom,sc8280xp-dp-phy", .data = &sc8280xp_dp_phy_cfg, }, > { .compatible = "qcom,sc8280xp-edp-phy", .data = &sc8280xp_edp_phy_cfg, > }, > { .compatible = "qcom,x1e80100-dp-phy", .data = &x1e80100_phy_cfg, }, > + { .compatible = "qcom,nord-dp-phy", .data = &nord_edp_phy_cfg, }, > { } > }; > MODULE_DEVICE_TABLE(of, qcom_edp_phy_match_table); [Severity: Low] Can Nord reuse the existing v6 and v8 definitions instead of duplicating them? All 40 NORD_DP_QSERDES_COM_* offsets in phy-qcom-qmp-qserdes-dp-com-v8-nord.h are identical to the QSERDES_V6_COM_* offsets in phy-qcom-qmp-qserdes-com-v6.h, which is already included in this file. Consequently, qcom_edp_phy_power_on_nord() and qcom_edp_phy_com_resetsm_cntrl_nord() are identical to qcom_edp_phy_power_on_v6() and qcom_edp_phy_com_resetsm_cntrl_v6(), and edp_phy_vco_div_cfg_nord is identical to edp_phy_vco_div_cfg_v8. Also, the Nord register macros, configuration tables, and callbacks are placed after qcom_edp_phy_probe() instead of alongside the other SoC definitions earlier in the file, and qcom,nord-dp-phy is appended to the end of the alphabetically sorted qcom_edp_phy_match_table[]. [1] https://lore.kernel.org/r/qqfucmyebsvemdr5px33wabsxxq4owozwmxcqu62sprs5k32bo@kb5pjx2m4ucq -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=11
