phy: qcom-qmp: Enable pipe_clk before checking USB3 PHY_STATUS
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/6 phy: qcom-qmp: Enable pipe_clk before checking USB3 PHY_STATUS
QMP PHY for USB mode requires pipe_clk for calibration and PLL lock to take place. This lock is output from PHY to GCC clock_ctl and then fed back to QMP PHY and is output from PHY only after PHY is reset and initialized, hence it can't be enabled too early in initialization sequence.
--- drivers/phy/qualcomm/phy-qcom-qmp.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/phy/qualcomm/phy-qcom-qmp.c +18 -0
@@ -797,8 +797,13 @@ static int qcom_qmp_phy_poweron(struct phy *phy) {struct qmp_phy *qphy =phy_get_drvdata (phy);struct qcom_qmp *qmp = qphy->qmp; +const struct qmp_phy_cfg *cfg = qmp->cfg;int ret; +/* Not needed for USB3 PHY as pipe_clk is enabled from phy_init */ +if (cfg->type ==PHY_TYPE_USB3 ) +return 0 ; + ret =clk_prepare_enable (qphy->pipe_clk);if (ret)dev_err (qmp->dev,"pipe_clk enable failed, err=%d\n" , ret);
@@ -1008,6 +1013,19 @@ static int qcom_qmp_phy_init(struct phy *phy) status = pcs + cfg->regs[QPHY_PCS_READY_STATUS ]; mask = cfg->mask_pcs_ready; +/* USB3 PHY requires pipe_clk for PLL lock and calibration */ +if (cfg->type ==PHY_TYPE_USB3 ) { + ret =clk_prepare_enable (qphy->pipe_clk); +if (ret) +dev_err (qmp->dev,"pipe_clk enable err=%d\n" , ret); +/* +* Ignore this error as pipe_clk might take some time to get +* enabled. In any case following check for PHY PLL lock would +* timeout below if there is a fatal error and clock is not fed +* to PHY +*/ + } + ret =readl_poll_timeout (status, val, !(val & mask),1 ,PHY_INIT_COMPLETE_TIMEOUT );if (ret) {
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH 2/6 phy: qcom-qusb2: Fix crash if nvmem cell not specified
In reply to a message not in the archiveDriver currently crashes due to NULL pointer deference while updating PHY tune register if nvmem cell is NULL. Since, fused value for Tune1/2 register is optional, we'd rather bail out.
--- drivers/phy/qualcomm/phy-qcom-qusb2.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/phy/qualcomm/phy-qcom-qusb2.c +4 -0
@@ -315,6 +315,10 @@ static void qusb2_phy_set_tune2_param(struct qusb2_phy *qphy)const struct qusb2_phy_cfg *cfg = qphy->cfg;u8 *val; +/* efuse register is optional */ +if (!qphy->cell) +return ; +/* * Read efuse register having TUNE2/1 parameter's high nibble. * If efuse register shows value as 0x0, or if we fail to find
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH 2/6] phy: qcom-qusb2: Fix crash if nvmem cell not specified
Hi Manu,
Quoted 4 lines · Manu Gautam
Driver currently crashes due to NULL pointer deference while updating PHY tune register if nvmem cell is NULL. Since, fused value for Tune1/2 register is optional, we'd rather bail out.
fixes: ("ca04d9d3e1b1 phy: qcom-qusb2: New driver for QUSB2 PHY on Qcom chips") ? and please CC to stable as well - ver 4.14.
With that,
Thanks
Vivek
Quoted 21 lines
Signed-off-by Manu Gautam <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qusb2.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/phy/qualcomm/phy-qcom-qusb2.c +4
-0@@ -315,6 +315,10 @@ static void qusb2_phy_set_tune2_param(struct qusb2_phy *qphy)const struct qusb2_phy_cfg *cfg = qphy->cfg;u8 *val; +/* efuse register is optional */ +if (!qphy->cell) +return ; +/* * Read efuse register having TUNE2/1 parameter's high nibble. * If efuse register shows value as 0x0, or if we fail to find
PATCH 3/6 dt-bindings: phy-qcom-qmp: Update bindings for sdm845
In reply to a message not in the archiveUpdate compatible strings for USB3 PHYs on SDM845. One is QMPv3 DisplayPort-USB combo PHY and other one is USB UNI PHY which is single lane USB3 PHY without DP capability.
--- Documentation/devicetree/bindings/phy/qcom-qmp-phy.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/phy/qcom-qmp-phy.txt +3 -1
@@ -9,7 +9,9 @@ Required properties: "qcom,ipq8074-qmp-pcie-phy" for PCIe phy on IPQ8074 "qcom,msm8996-qmp-pcie-phy" for 14nm PCIe phy on msm8996, "qcom,msm8996-qmp-usb3-phy" for 14nm USB3 phy on msm8996, - "qcom,qmp-v3-usb3-phy" for USB3 QMP V3 phy. + "qcom,qmp-v3-usb3-phy" for USB3 QMP V3 phy, + "qcom,sdm845-qmp-usb3-phy" for USB3 QMP V3 phy on sdm845, + "qcom,sdm845-qmp-usb3-uni-phy" for USB3 QMP V3 UNI phy on sdm845. - reg: offset and length of register set for PHY's common serdes block.
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH 3/6] dt-bindings: phy-qcom-qmp: Update bindings for sdm845
Quoted 9 lines · Manu Gautam
Update compatible strings for USB3 PHYs on SDM845. One is QMPv3 DisplayPort-USB combo PHY and other one is USB UNI PHY which is single lane USB3 PHY without DP capability.
Signed-off-by Manu Gautam <[email protected]>--- Documentation/devicetree/bindings/phy/qcom-qmp-phy.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
PATCH 4/6 phy: qcom-qmp: Add QMP V3 USB3 UNI PHY support for sdm845
In reply to a message not in the archiveQMP V3 UNI PHY is a single lane USB3 PHY without support for DisplayPort (DP).
Main difference from DP combo QMPv3 PHY is that UNI PHY doesn't have dual RX/TX lanes and no separate DP_COM block for configuration related to type-c or DP. While at it, fix has_pwrdn_delay attribute for USB-DP PHY configuration.
--- drivers/phy/qualcomm/phy-qcom-qmp.c | 148 ++++++++++++++++++++++++++++++++++++ drivers/phy/qualcomm/phy-qcom-qmp.h | 5 ++ 2 files changed, 153 insertions(+)
drivers/phy/qualcomm/phy-qcom-qmp.c +148 -0
@@ -490,6 +490,118 @@ enum qphy_reg_layout { QMP_PHY_INIT_CFG(QPHY_V3_PCS_RXEQTRAINING_RUN_TIME, 0x13), }; +static const struct qmp_phy_init_tbl qmp_v3_usb3_uniphy_serdes_tbl[] = { +QMP_PHY_INIT_CFG (QSERDES_V3_COM_PLL_IVCO ,0x07 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_SYSCLK_EN_SEL ,0x14 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_BIAS_EN_CLKBUFLR_EN ,0x04 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_CLK_SELECT ,0x30 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_SYS_CLK_CTRL ,0x02 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_RESETSM_CNTRL2 ,0x08 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_CMN_CONFIG ,0x06 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_SVS_MODE_CLK_SEL ,0x01 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_HSCLK_SEL ,0x80 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_DEC_START_MODE0 ,0x82 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_DIV_FRAC_START1_MODE0 ,0xab ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_DIV_FRAC_START2_MODE0 ,0xea ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_DIV_FRAC_START3_MODE0 ,0x02 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_CP_CTRL_MODE0 ,0x06 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_PLL_RCTRL_MODE0 ,0x16 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_PLL_CCTRL_MODE0 ,0x36 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_INTEGLOOP_GAIN1_MODE0 ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_INTEGLOOP_GAIN0_MODE0 ,0x3f ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_VCO_TUNE2_MODE0 ,0x01 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_VCO_TUNE1_MODE0 ,0xc9 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_CORECLK_DIV_MODE0 ,0x0a ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_LOCK_CMP3_MODE0 ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_LOCK_CMP2_MODE0 ,0x34 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_LOCK_CMP1_MODE0 ,0x15 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_LOCK_CMP_EN ,0x04 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_CORE_CLK_EN ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_LOCK_CMP_CFG ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_VCO_TUNE_MAP ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_SYSCLK_BUF_ENABLE ,0x0a ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_SSC_EN_CENTER ,0x01 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_SSC_PER1 ,0x31 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_SSC_PER2 ,0x01 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_SSC_ADJ_PER1 ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_SSC_ADJ_PER2 ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_SSC_STEP_SIZE1 ,0x85 ), +QMP_PHY_INIT_CFG (QSERDES_V3_COM_SSC_STEP_SIZE2 ,0x07 ), +}; + +static const struct qmp_phy_init_tbl qmp_v3_usb3_uniphy_tx_tbl[] = { +QMP_PHY_INIT_CFG (QSERDES_V3_TX_HIGHZ_DRVR_EN ,0x10 ), +QMP_PHY_INIT_CFG (QSERDES_V3_TX_RCV_DETECT_LVL_2 ,0x12 ), +QMP_PHY_INIT_CFG (QSERDES_V3_TX_LANE_MODE_1 ,0xc6 ), +QMP_PHY_INIT_CFG (QSERDES_V3_TX_RES_CODE_LANE_OFFSET_RX ,0x06 ), +QMP_PHY_INIT_CFG (QSERDES_V3_TX_RES_CODE_LANE_OFFSET_TX ,0x06 ), +}; + +static const struct qmp_phy_init_tbl qmp_v3_usb3_uniphy_rx_tbl[] = { +QMP_PHY_INIT_CFG (QSERDES_V3_RX_VGA_CAL_CNTRL2 ,0x0c ), +QMP_PHY_INIT_CFG (QSERDES_V3_RX_RX_MODE_00 ,0x50 ), +QMP_PHY_INIT_CFG (QSERDES_V3_RX_UCDR_FASTLOCK_FO_GAIN ,0x0b ), +QMP_PHY_INIT_CFG (QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL2 ,0x0e ), +QMP_PHY_INIT_CFG (QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL3 ,0x4e ), +QMP_PHY_INIT_CFG (QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL4 ,0x18 ), +QMP_PHY_INIT_CFG (QSERDES_V3_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1 ,0x77 ), +QMP_PHY_INIT_CFG (QSERDES_V3_RX_RX_OFFSET_ADAPTOR_CNTRL2 ,0x80 ), +QMP_PHY_INIT_CFG (QSERDES_V3_RX_SIGDET_CNTRL ,0x03 ), +QMP_PHY_INIT_CFG (QSERDES_V3_RX_SIGDET_DEGLITCH_CNTRL ,0x1c ), +QMP_PHY_INIT_CFG (QSERDES_V3_RX_UCDR_SO_SATURATION_AND_ENABLE ,0x75 ), +}; + +static const struct qmp_phy_init_tbl qmp_v3_usb3_uniphy_pcs_tbl[] = { +/* FLL settings */ +QMP_PHY_INIT_CFG (QPHY_V3_PCS_FLL_CNTRL2 ,0x83 ), +QMP_PHY_INIT_CFG (QPHY_V3_PCS_FLL_CNT_VAL_L ,0x09 ), +QMP_PHY_INIT_CFG (QPHY_V3_PCS_FLL_CNT_VAL_H_TOL ,0xa2 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phy_cfg - per-PHY initialization config */ struct qmp_phy_cfg {/* phy-type - PCIE/UFS/USB */
@@ -766,6 +878,7 @@ static inline void qphy_clrbits(void __iomem *base, u32 offset, u32 val) .pwrdn_ctrl = SW_PWRDN, .mask_pcs_ready = PHYSTATUS, + .has_pwrdn_delay = true, .pwrdn_delay_min = POWER_DOWN_DELAY_US_MIN, .pwrdn_delay_max = POWER_DOWN_DELAY_US_MAX,
@@ -774,6 +887,35 @@ static inline void qphy_clrbits(void __iomem *base, u32 offset, u32 val) .rx_b_lane_offset = 0x400, }; +static const struct qmp_phy_cfg qmp_v3_usb3_uniphy_cfg = { + .type =PHY_TYPE_USB3 , + .nlanes =1 , + + .serdes_tbl = qmp_v3_usb3_uniphy_serdes_tbl, + .serdes_tbl_num =ARRAY_SIZE (qmp_v3_usb3_uniphy_serdes_tbl), + .tx_tbl = qmp_v3_usb3_uniphy_tx_tbl, + .tx_tbl_num =ARRAY_SIZE (qmp_v3_usb3_uniphy_tx_tbl), + .rx_tbl = qmp_v3_usb3_uniphy_rx_tbl, + .rx_tbl_num =ARRAY_SIZE (qmp_v3_usb3_uniphy_rx_tbl), + .pcs_tbl = qmp_v3_usb3_uniphy_pcs_tbl, + .pcs_tbl_num =ARRAY_SIZE (qmp_v3_usb3_uniphy_pcs_tbl), + .clk_list = qmp_v3_phy_clk_l, + .num_clks =ARRAY_SIZE (qmp_v3_phy_clk_l), + .reset_list = msm8996_usb3phy_reset_l, + .num_resets =ARRAY_SIZE (msm8996_usb3phy_reset_l), + .vreg_list = msm8996_phy_vreg_l, + .num_vregs =ARRAY_SIZE (msm8996_phy_vreg_l), + .regs = qmp_v3_usb3phy_regs_layout, + + .start_ctrl =SERDES_START |PCS_START , + .pwrdn_ctrl =SW_PWRDN , + .mask_pcs_ready =PHYSTATUS , + + .has_pwrdn_delay = true, + .pwrdn_delay_min =POWER_DOWN_DELAY_US_MIN , + .pwrdn_delay_max =POWER_DOWN_DELAY_US_MAX , +}; + static void qcom_qmp_phy_configure(void __iomem *base, const unsigned int *regs, const struct qmp_phy_init_tbl tbl[],
@@ -1401,6 +1543,12 @@ int qcom_qmp_phy_create(struct device *dev, struct device_node *np, int id) }, { .compatible = "qcom,qmp-v3-usb3-phy", .data = &qmp_v3_usb3phy_cfg, + }, { + .compatible = "qcom,sdm845-qmp-usb3-phy", + .data = &qmp_v3_usb3phy_cfg, + }, { + .compatible = "qcom,sdm845-qmp-usb3-uni-phy", + .data = &qmp_v3_usb3_uniphy_cfg, }, { }, };
drivers/phy/qualcomm/phy-qcom-qmp.h +5 -0
@@ -214,6 +214,8 @@#define QSERDES_V3_RX_UCDR_FASTLOCK_FO_GAIN 0x030#define QSERDES_V3_RX_UCDR_SO_SATURATION_AND_ENABLE 0x034#define QSERDES_V3_RX_RX_TERM_BW 0x07c +#define QSERDES_V3_RX_VGA_CAL_CNTRL1 0x0bc +#define QSERDES_V3_RX_VGA_CAL_CNTRL2 0x0c0#define QSERDES_V3_RX_RX_EQ_GAIN2_LSB 0x0c8#define QSERDES_V3_RX_RX_EQ_GAIN2_MSB 0x0cc#define QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL2 0x0d4
@@ -227,6 +229,7 @@#define QSERDES_V3_RX_SIGDET_DEGLITCH_CNTRL 0x10c#define QSERDES_V3_RX_RX_BAND 0x110#define QSERDES_V3_RX_RX_INTERFACE_MODE 0x11c +#define QSERDES_V3_RX_RX_MODE_00 0x164/* Only for QMP V3 PHY - PCS registers */ #define QPHY_V3_PCS_POWER_DOWN_CONTROL 0x004
@@ -273,6 +276,8 @@#define QPHY_V3_PCS_FLL_CNT_VAL_H_TOL 0x0d0#define QPHY_V3_PCS_FLL_MAN_CODE 0x0d4#define QPHY_V3_PCS_RX_SIGDET_LVL 0x1d8 +#define QPHY_V3_PCS_REFGEN_REQ_CONFIG1 0x20c +#define QPHY_V3_PCS_REFGEN_REQ_CONFIG2 0x210/* Only for QMP V3 PHY - PCS_MISC registers */ #define QPHY_V3_PCS_MISC_CLAMP_ENABLE 0x0c
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH 4/6] phy: qcom-qmp: Add QMP V3 USB3 UNI PHY support for sdm845
Hi Manu,
Quoted 11 lines · Manu Gautam
QMP V3 UNI PHY is a single lane USB3 PHY without support for DisplayPort (DP).
Main difference from DP combo QMPv3 PHY is that UNI PHY doesn't have dual RX/TX lanes and no separateDP_COMblock for configuration related to type-c or DP. While at it, fixhas_pwrdn_delayattribute for USB-DP PHY configuration.Signed-off-by Manu Gautam <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp.c | 148
++++++++++++++++++++++++++++++++++++
Quoted 2 lines
drivers/phy/qualcomm/phy-qcom-qmp.h | 5 ++ 2 files changed, 153 insertions(+)
...
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/phy/qualcomm/phy-qcom-qmp.h
drivers/phy/qualcomm/phy-qcom-qmp.h line 217
Quoted 8 lines
index d1c6905..5d78d43 100644
drivers/phy/qualcomm/phy-qcom-qmp.h +1
-0@@ -214,6 +214,8 @@#define QSERDES_V3_RX_UCDR_FASTLOCK_FO_GAIN 0x030#define QSERDES_V3_RX_UCDR_SO_SATURATION_AND_ENABLE 0x034#define QSERDES_V3_RX_RX_TERM_BW 0x07c +#define QSERDES_V3_RX_VGA_CAL_CNTRL1 0x0bc
I noticed you add this definition, but never use it. Are you missing a QMP_PHY_INIT_CFG line for this register in qmp_v3_usb3_uniphy_rx_tbl[], or is that register "don't care"? It looks important, and while its default value out of reset might be valid, you never know what nutty value boot firmware might set it to.
Quoted 25 lines
drivers/phy/qualcomm/phy-qcom-qmp.h +4
-1+#define QSERDES_V3_RX_VGA_CAL_CNTRL2 0x0c0#define QSERDES_V3_RX_RX_EQ_GAIN2_LSB 0x0c8#define QSERDES_V3_RX_RX_EQ_GAIN2_MSB 0x0cc#define QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL2 0x0d4@@ -227,6 +229,7 @@#define QSERDES_V3_RX_SIGDET_DEGLITCH_CNTRL 0x10c#define QSERDES_V3_RX_RX_BAND 0x110#define QSERDES_V3_RX_RX_INTERFACE_MODE 0x11c +#define QSERDES_V3_RX_RX_MODE_00 0x164/* Only for QMP V3 PHY - PCS registers */ #define QPHY_V3_PCS_POWER_DOWN_CONTROL 0x004@@ -273,6 +276,8 @@#define QPHY_V3_PCS_FLL_CNT_VAL_H_TOL 0x0d0#define QPHY_V3_PCS_FLL_MAN_CODE 0x0d4#define QPHY_V3_PCS_RX_SIGDET_LVL 0x1d8 +#define QPHY_V3_PCS_REFGEN_REQ_CONFIG1 0x20c +#define QPHY_V3_PCS_REFGEN_REQ_CONFIG2 0x210/* Only for QMP V3 PHY - PCS_MISC registers */ #define QPHY_V3_PCS_MISC_CLAMP_ENABLE 0x0c --The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Quoted 2 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm"
in
Quoted 2 lines
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/6] phy: qcom-qmp: Add QMP V3 USB3 UNI PHY support for sdm845
Hi,
Quoted 3 lines · Evan Green
Hi Manu,
On Fri, Mar 16, 2018 at 2:46 AM Manu Gautam <[email protected]> wrote:
[snip]
Quoted 5 lines
Quoted 5 lines
index d1c6905..5d78d43 100644
drivers/phy/qualcomm/phy-qcom-qmp.h +0
-0@@ -214,6 +214,8 @@#define QSERDES_V3_RX_UCDR_FASTLOCK_FO_GAIN 0x030
Quoted 9 lines
drivers/phy/qualcomm/phy-qcom-qmp.h line 217
Quoted 3 lines
drivers/phy/qualcomm/phy-qcom-qmp.h +1
-0#define QSERDES_V3_RX_UCDR_SO_SATURATION_AND_ENABLE 0x034#define QSERDES_V3_RX_RX_TERM_BW 0x07c +#define QSERDES_V3_RX_VGA_CAL_CNTRL1 0x0bcI noticed you add this definition, but never use it. Are you missing a
QMP_PHY_INIT_CFGline for this register in qmp_v3_usb3_uniphy_rx_tbl[], or is that register "don't care"? It looks important, and while its default value out of reset might be valid, you never know what nutty value boot firmware might set it to.
Yes POR value of this register is valid for this soc.
QMP driver resets (asserts and de-asserts reset_control) in probe. So, that should ensure that PHY registers are indeed set to POR value. Left the definition there if different setting needed to be done for a different variant of h/w in future.
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Evan Green
Reviewed-byRe: [PATCH 4/6] phy: qcom-qmp: Add QMP V3 USB3 UNI PHY support for sdm845
Quoted 7 lines · Manu Gautam
Hi,
Quoted 3 lines · Evan Green
Hi Manu,
On Fri, Mar 16, 2018 at 2:46 AM Manu Gautam <[email protected]>
Quoted 11 lines · wrote:
[snip]
Quoted 10 lines
drivers/phy/qualcomm/phy-qcom-qmp.h line 217
Quoted 8 lines
index d1c6905..5d78d43 100644
drivers/phy/qualcomm/phy-qcom-qmp.h +1
-0@@ -214,6 +214,8 @@#define QSERDES_V3_RX_UCDR_FASTLOCK_FO_GAIN 0x030#define QSERDES_V3_RX_UCDR_SO_SATURATION_AND_ENABLE 0x034#define QSERDES_V3_RX_RX_TERM_BW 0x07c +#define QSERDES_V3_RX_VGA_CAL_CNTRL1 0x0bcI noticed you add this definition, but never use it. Are you missing a
QMP_PHY_INIT_CFGline for this register in qmp_v3_usb3_uniphy_rx_tbl[],
or
Quoted 7 lines
Quoted 4 lines
is that register "don't care"? It looks important, and while its default value out of reset might be valid, you never know what nutty value boot firmware might set it to.
Yes POR value of this register is valid for this soc.
QMP driver resets (asserts and de-assertsreset_control) in probe. So,
that should
Quoted 1 line
ensure that PHY registers are indeed set to POR value. Left the
definition there
Quoted 1 line
if different setting needed to be done for a different variant of h/w in
future.
Sounds good. Thanks, Manu.
PATCH 5/6 dt-bindings: phy-qcom-usb2: Update bindings for sdm845
In reply to a message not in the archiveUpdate compatible strings for USB2 PHYs on sdm845. There are two QUSB2 PHYs present on sdm845. Few PHY registers programming is different for these PHYs related to electrical parameters, otherwise both are same.
--- Documentation/devicetree/bindings/phy/qcom-qusb2-phy.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/phy/qcom-qusb2-phy.txt +3 -1
@@ -6,7 +6,9 @@ QUSB2 controller supports LS/FS/HS usb connectivity on Qualcomm chipsets. Required properties: - compatible: compatible list, contains "qcom,msm8996-qusb2-phy" for 14nm PHY on msm8996, - "qcom,qusb2-v2-phy" for QUSB2 V2 PHY. + "qcom,qusb2-v2-phy" for QUSB2 V2 PHY, + "qcom,sdm845-1-qusb2-phy" for primary PHY on sdm845, + "qcom,sdm845-2-qusb2-phy" for secondary PHY on sdm845. - reg: offset and length of the PHY register set. - #phy-cells: must be 0.
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Rob Herring
maintainerRe: [PATCH 5/6] dt-bindings: phy-qcom-usb2: Update bindings for sdm845
Quoted 4 lines · Manu Gautam
Update compatible strings for USB2 PHYs on sdm845. There are two QUSB2 PHYs present on sdm845. Few PHY registers programming is different for these PHYs related to electrical parameters, otherwise both are same.
Register locations are different or tuning values are different? For the latter, is that something that could be DT properties?
Quoted 25 lines
Signed-off-by Manu Gautam <[email protected]>--- Documentation/devicetree/bindings/phy/qcom-qusb2-phy.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/phy/qcom-qusb2-phy.txt +3
-1@@ -6,7 +6,9 @@ QUSB2 controller supports LS/FS/HS usb connectivity on Qualcomm chipsets. Required properties: - compatible: compatible list, contains "qcom,msm8996-qusb2-phy" for 14nm PHY on msm8996, - "qcom,qusb2-v2-phy" for QUSB2 V2 PHY. + "qcom,qusb2-v2-phy" for QUSB2 V2 PHY, + "qcom,sdm845-1-qusb2-phy" for primary PHY on sdm845, + "qcom,sdm845-2-qusb2-phy" for secondary PHY on sdm845. - reg: offset and length of the PHY register set. - #phy-cells: must be 0.Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH 5/6] dt-bindings: phy-qcom-usb2: Update bindings for sdm845
Hi,
Quoted 7 lines · Rob Herring
Quoted 4 lines · Manu Gautam
Update compatible strings for USB2 PHYs on sdm845. There are two QUSB2 PHYs present on sdm845. Few PHY registers programming is different for these PHYs related to electrical parameters, otherwise both are same.
Register locations are different or tuning values are different? For the latter, is that something that could be DT properties?
There are only register values changes. Corresponding driver change:
https://patchwork.kernel.org/patch/10286803/
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH 5/6] dt-bindings: phy-qcom-usb2: Update bindings for sdm845
In reply to Manu GautamHi Manu,
Quoted 15 lines · Manu Gautam
Update compatible strings for USB2 PHYs on sdm845. There are two QUSB2 PHYs present on sdm845. Few PHY registers programming is different for these PHYs related to electrical parameters, otherwise both are same.
Signed-off-by Manu Gautam <[email protected]>--- Documentation/devicetree/bindings/phy/qcom-qusb2-phy.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/phy/qcom-qusb2-phy.txt +0
-0
Documentation/devicetree/bindings/phy/qcom-qusb2-phy.txt QUSB2 controller supports LS/FS/HS usb connectivity on Qualcomm chipsets. · line 11
Quoted 7 lines
Documentation/devicetree/bindings/phy/qcom-qusb2-phy.txt +3
-1@@ -6,7 +6,9 @@ QUSB2 controller supports LS/FS/HS usb connectivity on Qualcomm chipsets. Required properties: - compatible: compatible list, contains "qcom,msm8996-qusb2-phy" for 14nm PHY on msm8996, - "qcom,qusb2-v2-phy" for QUSB2 V2 PHY. + "qcom,qusb2-v2-phy" for QUSB2 V2 PHY, + "qcom,sdm845-1-qusb2-phy" for primary PHY on sdm845, + "qcom,sdm845-2-qusb2-phy" for secondary PHY on sdm845.
Thanks for the patch.
"qcom,sdm845-1/2-qusb2-phy" gives an impression that it is different versions of SoC, and not like two numbers of phy.
May be - "qcom,sdm845-qusb2-phy-1/2"
Regards
Vivek
Quoted 3 lines
Documentation/devicetree/bindings/phy/qcom-qusb2-phy.txt +0
-0- reg: offset and length of the PHY register set. - #phy-cells: must be 0.
Re: [PATCH 5/6] dt-bindings: phy-qcom-usb2: Update bindings for sdm845
Hi,
Quoted 29 lines · Vivek Gautam
Hi Manu,
Quoted 15 lines · Manu Gautam
Update compatible strings for USB2 PHYs on sdm845. There are two QUSB2 PHYs present on sdm845. Few PHY registers programming is different for these PHYs related to electrical parameters, otherwise both are same.
Signed-off-by Manu Gautam <[email protected]>---
Documentation/devicetree/bindings/phy/qcom-qusb2-phy.txt| 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/phy/qcom-qusb2-phy.txt +0
-0@@ -6,7 +6,9 @@ QUSB2 controller supports LS/FS/HS usb connectivity on Qualcomm chipsets.Quoted 7 lines
Required properties:
- compatible: compatible list, contains "qcom,msm8996-qusb2-phy" for 14nm PHY on msm8996, - "qcom,qusb2-v2-phy" for QUSB2 V2 PHY.
+ "qcom,qusb2-v2-phy" for QUSB2 V2 PHY,
+ "qcom,sdm845-1-qusb2-phy" for primary PHY on sdm845, + "qcom,sdm845-2-qusb2-phy" for secondary PHY on sdm845.Thanks for the patch.
Quoted 3 lines
"qcom,sdm845-1/2-qusb2-phy" gives an impression that it is different versions of SoC, and not like two numbers of phy.
May be - "qcom,sdm845-qusb2-phy-1/2"
I agree with that. Will update.
Quoted 8 lines
Regards
VivekQuoted 2 lines
- reg: offset and length of the PHY register set.
- #phy-cells: must be 0.
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH 6/6 phy: qcom-qusb2: Add QUSB2 PHYs support for sdm845
In reply to a message not in the archiveThere are two QUSB2 PHYs present on sdm845. Update PHY registers programming for both the PHYs related to electrical parameters to improve eye diagram.
--- drivers/phy/qualcomm/phy-qcom-qusb2.c | 39 +++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
drivers/phy/qualcomm/phy-qcom-qusb2.c +39 -0
@@ -174,6 +174,27 @@ enum qusb2phy_reg_layout { QUSB2_PHY_INIT_CFG(QUSB2PHY_CHG_CTRL2, 0x0), }; +static const struct qusb2_phy_init_tbl sdm845_init_tbl_1[] = { +QUSB2_PHY_INIT_CFG (QUSB2PHY_PLL_ANALOG_CONTROLS_TWO ,0x03 ), +QUSB2_PHY_INIT_CFG (QUSB2PHY_PLL_CLOCK_INVERTERS ,0x7c ), +QUSB2_PHY_INIT_CFG (QUSB2PHY_PLL_CMODE ,0x80 ), +QUSB2_PHY_INIT_CFG (QUSB2PHY_PLL_LOCK_DELAY ,0x0a ), +QUSB2_PHY_INIT_CFG (QUSB2PHY_PLL_DIGITAL_TIMERS_TWO ,0x19 ), +QUSB2_PHY_INIT_CFG (QUSB2PHY_PLL_BIAS_CONTROL_1 ,0x40 ), +QUSB2_PHY_INIT_CFG (QUSB2PHY_PLL_BIAS_CONTROL_2 ,0x20 ), +QUSB2_PHY_INIT_CFG (QUSB2PHY_PWR_CTRL2 ,0x21 ), +QUSB2_PHY_INIT_CFG (QUSB2PHY_IMP_CTRL1 ,0x8 ), +QUSB2_PHY_INIT_CFG (QUSB2PHY_IMP_CTRL2 ,0x58 ), + +QUSB2_PHY_INIT_CFG_L (QUSB2PHY_PORT_TUNE1 ,0x45 ), +QUSB2_PHY_INIT_CFG_L (QUSB2PHY_PORT_TUNE2 ,0x29 ), +QUSB2_PHY_INIT_CFG_L (QUSB2PHY_PORT_TUNE3 ,0xca ), +QUSB2_PHY_INIT_CFG_L (QUSB2PHY_PORT_TUNE4 ,0x04 ), +QUSB2_PHY_INIT_CFG_L (QUSB2PHY_PORT_TUNE5 ,0x03 ), + +QUSB2_PHY_INIT_CFG (QUSB2PHY_CHG_CTRL2 ,0x0 ), +}; +struct qusb2_phy_cfg {const struct qusb2_phy_init_tbl *tbl;/* number of entries in the table */
@@ -220,6 +241,18 @@ struct qusb2_phy_cfg { .autoresume_en = BIT(0), }; +static const struct qusb2_phy_cfg sdm845_phy_cfg_1 = { + .tbl = sdm845_init_tbl_1, + .tbl_num =ARRAY_SIZE (sdm845_init_tbl_1), + .regs = qusb2_v2_regs_layout, + + .disable_ctrl = (PWR_CTRL1_VREF_SUPPLY_TRIM |PWR_CTRL1_CLAMP_N_EN | +POWER_DOWN ), + .mask_core_ready =CORE_READY_STATUS , + .has_pll_override = true, + .autoresume_en =BIT (0 ), +}; +static const char *const qusb2_phy_vreg_names[] = {"vdda-pll" ,"vdda-phy-dpdm" , };
@@ -649,6 +682,12 @@ static int qusb2_phy_exit(struct phy *phy) }, { .compatible = "qcom,qusb2-v2-phy", .data = &qusb2_v2_phy_cfg, + }, { + .compatible = "qcom,sdm845-1-qusb2-phy", + .data = &sdm845_phy_cfg_1, + }, { + .compatible = "qcom,sdm845-2-qusb2-phy", + .data = &qusb2_v2_phy_cfg, }, { }, };
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project