* [PATCH 0/2] phy: qcom-qmp-pcie: Add support to keep refclk always on
@ 2023-11-06 11:52 Krishna chaitanya chundru
2023-11-06 11:52 ` [PATCH 1/2] dt-bindings: phy: qcom,qmp: Add PCIe qcom,refclk-always-on property Krishna chaitanya chundru
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Krishna chaitanya chundru @ 2023-11-06 11:52 UTC (permalink / raw)
To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Vinod Koul,
Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: linux-arm-msm, linux-phy, devicetree, linux-kernel,
quic_vbadigan, quic_ramkri, quic_nitegupt, quic_skananth,
quic_vpernami, quic_parass, Krishna chaitanya chundru
This series adds support to provide refclk to endpoint even in low
power states.
Due to some platform specific issues with CLKREQ signal, it is not being
propagated to the host and as host doesn't know the clkreq signal host is
not sending refclk. Due to this endpoint is seeing linkdown and going
to bad state.
To avoid those ref clk should be provided always to the endpoint. The
issue is coming only when ep intiates the L1.1 or L1.2 exit and clkreq
is not being propagated properly to the host.
Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
---
Krishna chaitanya chundru (2):
dt-bindings: phy: qcom,qmp: Add PCIe qcom,refclk-always-on property
phy: qcom-qmp-pcie: Add support for keeping refclk always on
.../bindings/phy/qcom,sc8280xp-qmp-pcie-phy.yaml | 5 +++++
drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 21 +++++++++++++++++----
2 files changed, 22 insertions(+), 4 deletions(-)
---
base-commit: 71e68e182e382e951d6248bccc3c960dcec5a718
change-id: 20231106-refclk_always_on-9beae8297cb8
Best regards,
--
Krishna chaitanya chundru <quic_krichai@quicinc.com>
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH 1/2] dt-bindings: phy: qcom,qmp: Add PCIe qcom,refclk-always-on property 2023-11-06 11:52 [PATCH 0/2] phy: qcom-qmp-pcie: Add support to keep refclk always on Krishna chaitanya chundru @ 2023-11-06 11:52 ` Krishna chaitanya chundru 2023-11-06 16:20 ` Bjorn Andersson 2023-11-06 11:52 ` [PATCH 2/2] phy: qcom-qmp-pcie: Add support for keeping refclk always on Krishna chaitanya chundru 2023-11-06 11:58 ` [PATCH 0/2] phy: qcom-qmp-pcie: Add support to keep " Dmitry Baryshkov 2 siblings, 1 reply; 11+ messages in thread From: Krishna chaitanya chundru @ 2023-11-06 11:52 UTC (permalink / raw) To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Vinod Koul, Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski, Conor Dooley Cc: linux-arm-msm, linux-phy, devicetree, linux-kernel, quic_vbadigan, quic_ramkri, quic_nitegupt, quic_skananth, quic_vpernami, quic_parass, Krishna chaitanya chundru Document qcom,refclk-always-on property which is needed in some platforms to supply refclk even in PCIe low power states. Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com> --- .../devicetree/bindings/phy/qcom,sc8280xp-qmp-pcie-phy.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-pcie-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-pcie-phy.yaml index 2c3d6553a7ba..9daf0556ed3b 100644 --- a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-pcie-phy.yaml +++ b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-pcie-phy.yaml @@ -93,6 +93,11 @@ properties: "#phy-cells": const: 0 + qcom,refclk-always-on: + type: boolean + description: A boolean property indicating the refclk is + always on even in Low power states (optional) + required: - compatible - reg -- 2.42.0 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] dt-bindings: phy: qcom,qmp: Add PCIe qcom,refclk-always-on property 2023-11-06 11:52 ` [PATCH 1/2] dt-bindings: phy: qcom,qmp: Add PCIe qcom,refclk-always-on property Krishna chaitanya chundru @ 2023-11-06 16:20 ` Bjorn Andersson 2023-11-07 9:51 ` Krishna Chaitanya Chundru 0 siblings, 1 reply; 11+ messages in thread From: Bjorn Andersson @ 2023-11-06 16:20 UTC (permalink / raw) To: Krishna chaitanya chundru Cc: Andy Gross, Konrad Dybcio, Vinod Koul, Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski, Conor Dooley, linux-arm-msm, linux-phy, devicetree, linux-kernel, quic_vbadigan, quic_ramkri, quic_nitegupt, quic_skananth, quic_vpernami, quic_parass On Mon, Nov 06, 2023 at 05:22:34PM +0530, Krishna chaitanya chundru wrote: > Document qcom,refclk-always-on property which is needed in some platforms > to supply refclk even in PCIe low power states. > > Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com> > --- > .../devicetree/bindings/phy/qcom,sc8280xp-qmp-pcie-phy.yaml | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-pcie-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-pcie-phy.yaml > index 2c3d6553a7ba..9daf0556ed3b 100644 > --- a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-pcie-phy.yaml > +++ b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-pcie-phy.yaml > @@ -93,6 +93,11 @@ properties: > "#phy-cells": > const: 0 > > + qcom,refclk-always-on: > + type: boolean > + description: A boolean property indicating the refclk is > + always on even in Low power states (optional) As with the driver patch, please improve this description (and use your 80 characters). It would also be preferable to capture (or at least indicate) the problem that this flash is working around - so that future readers doesn't need to go look in the commit history for the phy driver to figure out what this is doing. Regards, Bjorn > + > required: > - compatible > - reg > > -- > 2.42.0 > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] dt-bindings: phy: qcom,qmp: Add PCIe qcom,refclk-always-on property 2023-11-06 16:20 ` Bjorn Andersson @ 2023-11-07 9:51 ` Krishna Chaitanya Chundru 0 siblings, 0 replies; 11+ messages in thread From: Krishna Chaitanya Chundru @ 2023-11-07 9:51 UTC (permalink / raw) To: Bjorn Andersson Cc: Andy Gross, Konrad Dybcio, Vinod Koul, Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski, Conor Dooley, linux-arm-msm, linux-phy, devicetree, linux-kernel, quic_vbadigan, quic_ramkri, quic_nitegupt, quic_skananth, quic_vpernami, quic_parass On 11/6/2023 9:50 PM, Bjorn Andersson wrote: > On Mon, Nov 06, 2023 at 05:22:34PM +0530, Krishna chaitanya chundru wrote: >> Document qcom,refclk-always-on property which is needed in some platforms >> to supply refclk even in PCIe low power states. >> >> Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com> >> --- >> .../devicetree/bindings/phy/qcom,sc8280xp-qmp-pcie-phy.yaml | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-pcie-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-pcie-phy.yaml >> index 2c3d6553a7ba..9daf0556ed3b 100644 >> --- a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-pcie-phy.yaml >> +++ b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-pcie-phy.yaml >> @@ -93,6 +93,11 @@ properties: >> "#phy-cells": >> const: 0 >> >> + qcom,refclk-always-on: >> + type: boolean >> + description: A boolean property indicating the refclk is >> + always on even in Low power states (optional) > As with the driver patch, please improve this description (and use your > 80 characters). > > > It would also be preferable to capture (or at least indicate) the > problem that this flash is working around - so that future readers > doesn't need to go look in the commit history for the phy driver to > figure out what this is doing. > > Regards, > Bjorn Sure I will update this in my next patch. - Krishna Chaitanya. >> + >> required: >> - compatible >> - reg >> >> -- >> 2.42.0 >> ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/2] phy: qcom-qmp-pcie: Add support for keeping refclk always on 2023-11-06 11:52 [PATCH 0/2] phy: qcom-qmp-pcie: Add support to keep refclk always on Krishna chaitanya chundru 2023-11-06 11:52 ` [PATCH 1/2] dt-bindings: phy: qcom,qmp: Add PCIe qcom,refclk-always-on property Krishna chaitanya chundru @ 2023-11-06 11:52 ` Krishna chaitanya chundru 2023-11-06 12:13 ` Dmitry Baryshkov 2023-11-06 16:17 ` Bjorn Andersson 2023-11-06 11:58 ` [PATCH 0/2] phy: qcom-qmp-pcie: Add support to keep " Dmitry Baryshkov 2 siblings, 2 replies; 11+ messages in thread From: Krishna chaitanya chundru @ 2023-11-06 11:52 UTC (permalink / raw) To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Vinod Koul, Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski, Conor Dooley Cc: linux-arm-msm, linux-phy, devicetree, linux-kernel, quic_vbadigan, quic_ramkri, quic_nitegupt, quic_skananth, quic_vpernami, quic_parass, Krishna chaitanya chundru In PCIe low power states like L1.1 or L1.2 the phy will stop supplying refclk to endpoint. If endpoint asserts clkreq to bring back link L0, then RC needs to provide refclk to endpoint. If there is some issues in platform with clkreq signal propagation to host and due to that host will not send refclk which results PCIe link down. For those platforms phy needs to provide refclk even in low power states. Add a flag which indicates refclk is always supplied to endpoint. Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com> --- drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c index a63ca7424974..d7e377a7d96e 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c @@ -43,6 +43,8 @@ /* QPHY_PCS_STATUS bit */ #define PHYSTATUS BIT(6) #define PHYSTATUS_4_20 BIT(7) +/* PCS_PCIE_ENDPOINT_REFCLK_CNTRL */ +#define EPCLK_ALWAYS_ON_EN BIT(6) #define PHY_INIT_COMPLETE_TIMEOUT 10000 @@ -77,6 +79,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 }; @@ -103,10 +106,11 @@ static const unsigned int sdm845_qhp_pciephy_regs_layout[QPHY_LAYOUT_SIZE] = { }; static const unsigned int pciephy_v4_regs_layout[QPHY_LAYOUT_SIZE] = { - [QPHY_SW_RESET] = QPHY_V4_PCS_SW_RESET, - [QPHY_START_CTRL] = QPHY_V4_PCS_START_CONTROL, - [QPHY_PCS_STATUS] = QPHY_V4_PCS_PCS_STATUS1, - [QPHY_PCS_POWER_DOWN_CONTROL] = QPHY_V4_PCS_POWER_DOWN_CONTROL, + [QPHY_SW_RESET] = QPHY_V4_PCS_SW_RESET, + [QPHY_START_CTRL] = QPHY_V4_PCS_START_CONTROL, + [QPHY_PCS_STATUS] = QPHY_V4_PCS_PCS_STATUS1, + [QPHY_PCS_POWER_DOWN_CONTROL] = QPHY_V4_PCS_POWER_DOWN_CONTROL, + [QPHY_PCS_ENDPOINT_REFCLK_CNTRL] = QPHY_V4_PCS_PCIE_ENDPOINT_REFCLK_CNTRL, }; static const unsigned int pciephy_v5_regs_layout[QPHY_LAYOUT_SIZE] = { @@ -2244,6 +2248,8 @@ struct qmp_pcie { struct phy *phy; int mode; + bool refclk_always_on; + struct clk_fixed_rate pipe_clk_fixed; }; @@ -3159,6 +3165,10 @@ static void qmp_pcie_init_registers(struct qmp_pcie *qmp, const struct qmp_phy_c qmp_pcie_configure(pcs, tbls->pcs, tbls->pcs_num); qmp_pcie_configure(pcs_misc, tbls->pcs_misc, tbls->pcs_misc_num); + if (qmp->refclk_always_on && cfg->regs[QPHY_PCS_ENDPOINT_REFCLK_CNTRL]) + qphy_setbits(pcs_misc, cfg->regs[QPHY_PCS_ENDPOINT_REFCLK_CNTRL], + EPCLK_ALWAYS_ON_EN); + if (cfg->lanes >= 4 && qmp->tcsr_4ln_config) { qmp_pcie_configure(serdes, cfg->serdes_4ln_tbl, cfg->serdes_4ln_num); qmp_pcie_init_port_b(qmp, tbls); @@ -3681,6 +3691,9 @@ static int qmp_pcie_probe(struct platform_device *pdev) if (ret) goto err_node_put; + qmp->refclk_always_on = of_property_read_bool(dev->of_node, + "qcom,refclk-always-on"); + ret = phy_pipe_clk_register(qmp, np); if (ret) goto err_node_put; -- 2.42.0 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] phy: qcom-qmp-pcie: Add support for keeping refclk always on 2023-11-06 11:52 ` [PATCH 2/2] phy: qcom-qmp-pcie: Add support for keeping refclk always on Krishna chaitanya chundru @ 2023-11-06 12:13 ` Dmitry Baryshkov 2023-11-06 14:21 ` Krishna Chaitanya Chundru 2023-11-06 16:17 ` Bjorn Andersson 1 sibling, 1 reply; 11+ messages in thread From: Dmitry Baryshkov @ 2023-11-06 12:13 UTC (permalink / raw) To: Krishna chaitanya chundru Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Vinod Koul, Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski, Conor Dooley, linux-arm-msm, linux-phy, devicetree, linux-kernel, quic_vbadigan, quic_ramkri, quic_nitegupt, quic_skananth, quic_vpernami, quic_parass On Mon, 6 Nov 2023 at 13:53, Krishna chaitanya chundru <quic_krichai@quicinc.com> wrote: > > In PCIe low power states like L1.1 or L1.2 the phy will stop > supplying refclk to endpoint. If endpoint asserts clkreq to bring > back link L0, then RC needs to provide refclk to endpoint. > > If there is some issues in platform with clkreq signal propagation > to host and due to that host will not send refclk which results PCIe link > down. For those platforms phy needs to provide refclk even in low power > states. > > Add a flag which indicates refclk is always supplied to endpoint. > > Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com> > --- > drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 21 +++++++++++++++++---- > 1 file changed, 17 insertions(+), 4 deletions(-) > > diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c > index a63ca7424974..d7e377a7d96e 100644 > --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c > +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c > @@ -43,6 +43,8 @@ > /* QPHY_PCS_STATUS bit */ > #define PHYSTATUS BIT(6) > #define PHYSTATUS_4_20 BIT(7) > +/* PCS_PCIE_ENDPOINT_REFCLK_CNTRL */ > +#define EPCLK_ALWAYS_ON_EN BIT(6) > > #define PHY_INIT_COMPLETE_TIMEOUT 10000 > > @@ -77,6 +79,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 > }; > @@ -103,10 +106,11 @@ static const unsigned int sdm845_qhp_pciephy_regs_layout[QPHY_LAYOUT_SIZE] = { > }; > > static const unsigned int pciephy_v4_regs_layout[QPHY_LAYOUT_SIZE] = { > - [QPHY_SW_RESET] = QPHY_V4_PCS_SW_RESET, > - [QPHY_START_CTRL] = QPHY_V4_PCS_START_CONTROL, > - [QPHY_PCS_STATUS] = QPHY_V4_PCS_PCS_STATUS1, > - [QPHY_PCS_POWER_DOWN_CONTROL] = QPHY_V4_PCS_POWER_DOWN_CONTROL, > + [QPHY_SW_RESET] = QPHY_V4_PCS_SW_RESET, > + [QPHY_START_CTRL] = QPHY_V4_PCS_START_CONTROL, > + [QPHY_PCS_STATUS] = QPHY_V4_PCS_PCS_STATUS1, > + [QPHY_PCS_POWER_DOWN_CONTROL] = QPHY_V4_PCS_POWER_DOWN_CONTROL, No unnecessary whitespace changes, please. > + [QPHY_PCS_ENDPOINT_REFCLK_CNTRL] = QPHY_V4_PCS_PCIE_ENDPOINT_REFCLK_CNTRL, Any other platform having this register? > }; > > static const unsigned int pciephy_v5_regs_layout[QPHY_LAYOUT_SIZE] = { > @@ -2244,6 +2248,8 @@ struct qmp_pcie { > struct phy *phy; > int mode; > > + bool refclk_always_on; > + > struct clk_fixed_rate pipe_clk_fixed; > }; > > @@ -3159,6 +3165,10 @@ static void qmp_pcie_init_registers(struct qmp_pcie *qmp, const struct qmp_phy_c > qmp_pcie_configure(pcs, tbls->pcs, tbls->pcs_num); > qmp_pcie_configure(pcs_misc, tbls->pcs_misc, tbls->pcs_misc_num); > > + if (qmp->refclk_always_on && cfg->regs[QPHY_PCS_ENDPOINT_REFCLK_CNTRL]) > + qphy_setbits(pcs_misc, cfg->regs[QPHY_PCS_ENDPOINT_REFCLK_CNTRL], > + EPCLK_ALWAYS_ON_EN); > + > if (cfg->lanes >= 4 && qmp->tcsr_4ln_config) { > qmp_pcie_configure(serdes, cfg->serdes_4ln_tbl, cfg->serdes_4ln_num); > qmp_pcie_init_port_b(qmp, tbls); > @@ -3681,6 +3691,9 @@ static int qmp_pcie_probe(struct platform_device *pdev) > if (ret) > goto err_node_put; > > + qmp->refclk_always_on = of_property_read_bool(dev->of_node, > + "qcom,refclk-always-on"); Error out if !cfg->regs[QPHY_PCS_ENDPOINT_REFCLK_CNTRL]). Otherwise your DT value can be silently ignored. > + > ret = phy_pipe_clk_register(qmp, np); > if (ret) > goto err_node_put; > > -- > 2.42.0 > -- With best wishes Dmitry ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] phy: qcom-qmp-pcie: Add support for keeping refclk always on 2023-11-06 12:13 ` Dmitry Baryshkov @ 2023-11-06 14:21 ` Krishna Chaitanya Chundru 0 siblings, 0 replies; 11+ messages in thread From: Krishna Chaitanya Chundru @ 2023-11-06 14:21 UTC (permalink / raw) To: Dmitry Baryshkov Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Vinod Koul, Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski, Conor Dooley, linux-arm-msm, linux-phy, devicetree, linux-kernel, quic_vbadigan, quic_ramkri, quic_nitegupt, quic_skananth, quic_vpernami, quic_parass On 11/6/2023 5:43 PM, Dmitry Baryshkov wrote: > On Mon, 6 Nov 2023 at 13:53, Krishna chaitanya chundru > <quic_krichai@quicinc.com> wrote: >> In PCIe low power states like L1.1 or L1.2 the phy will stop >> supplying refclk to endpoint. If endpoint asserts clkreq to bring >> back link L0, then RC needs to provide refclk to endpoint. >> >> If there is some issues in platform with clkreq signal propagation >> to host and due to that host will not send refclk which results PCIe link >> down. For those platforms phy needs to provide refclk even in low power >> states. >> >> Add a flag which indicates refclk is always supplied to endpoint. >> >> Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com> >> --- >> drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 21 +++++++++++++++++---- >> 1 file changed, 17 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c >> index a63ca7424974..d7e377a7d96e 100644 >> --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c >> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c >> @@ -43,6 +43,8 @@ >> /* QPHY_PCS_STATUS bit */ >> #define PHYSTATUS BIT(6) >> #define PHYSTATUS_4_20 BIT(7) >> +/* PCS_PCIE_ENDPOINT_REFCLK_CNTRL */ >> +#define EPCLK_ALWAYS_ON_EN BIT(6) > >> #define PHY_INIT_COMPLETE_TIMEOUT 10000 >> >> @@ -77,6 +79,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 >> }; >> @@ -103,10 +106,11 @@ static const unsigned int sdm845_qhp_pciephy_regs_layout[QPHY_LAYOUT_SIZE] = { >> }; >> >> static const unsigned int pciephy_v4_regs_layout[QPHY_LAYOUT_SIZE] = { >> - [QPHY_SW_RESET] = QPHY_V4_PCS_SW_RESET, >> - [QPHY_START_CTRL] = QPHY_V4_PCS_START_CONTROL, >> - [QPHY_PCS_STATUS] = QPHY_V4_PCS_PCS_STATUS1, >> - [QPHY_PCS_POWER_DOWN_CONTROL] = QPHY_V4_PCS_POWER_DOWN_CONTROL, >> + [QPHY_SW_RESET] = QPHY_V4_PCS_SW_RESET, >> + [QPHY_START_CTRL] = QPHY_V4_PCS_START_CONTROL, >> + [QPHY_PCS_STATUS] = QPHY_V4_PCS_PCS_STATUS1, >> + [QPHY_PCS_POWER_DOWN_CONTROL] = QPHY_V4_PCS_POWER_DOWN_CONTROL, > No unnecessary whitespace changes, please. I will remove above white space and keep below change as it is as it is throwing error as white space required there > >> + [QPHY_PCS_ENDPOINT_REFCLK_CNTRL] = QPHY_V4_PCS_PCIE_ENDPOINT_REFCLK_CNTRL, > Any other platform having this register? we have this register for other platforms also I will add that register in which ever versions it exits in next patch > >> }; >> >> static const unsigned int pciephy_v5_regs_layout[QPHY_LAYOUT_SIZE] = { >> @@ -2244,6 +2248,8 @@ struct qmp_pcie { >> struct phy *phy; >> int mode; >> >> + bool refclk_always_on; >> + >> struct clk_fixed_rate pipe_clk_fixed; >> }; >> >> @@ -3159,6 +3165,10 @@ static void qmp_pcie_init_registers(struct qmp_pcie *qmp, const struct qmp_phy_c >> qmp_pcie_configure(pcs, tbls->pcs, tbls->pcs_num); >> qmp_pcie_configure(pcs_misc, tbls->pcs_misc, tbls->pcs_misc_num); >> >> + if (qmp->refclk_always_on && cfg->regs[QPHY_PCS_ENDPOINT_REFCLK_CNTRL]) >> + qphy_setbits(pcs_misc, cfg->regs[QPHY_PCS_ENDPOINT_REFCLK_CNTRL], >> + EPCLK_ALWAYS_ON_EN); >> + >> if (cfg->lanes >= 4 && qmp->tcsr_4ln_config) { >> qmp_pcie_configure(serdes, cfg->serdes_4ln_tbl, cfg->serdes_4ln_num); >> qmp_pcie_init_port_b(qmp, tbls); >> @@ -3681,6 +3691,9 @@ static int qmp_pcie_probe(struct platform_device *pdev) >> if (ret) >> goto err_node_put; >> >> + qmp->refclk_always_on = of_property_read_bool(dev->of_node, >> + "qcom,refclk-always-on"); > Error out if !cfg->regs[QPHY_PCS_ENDPOINT_REFCLK_CNTRL]). > Otherwise your DT value can be silently ignored. sure I will add this in next patch series. - Krishna Chaitanya. >> + >> ret = phy_pipe_clk_register(qmp, np); >> if (ret) >> goto err_node_put; >> >> -- >> 2.42.0 >> > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] phy: qcom-qmp-pcie: Add support for keeping refclk always on 2023-11-06 11:52 ` [PATCH 2/2] phy: qcom-qmp-pcie: Add support for keeping refclk always on Krishna chaitanya chundru 2023-11-06 12:13 ` Dmitry Baryshkov @ 2023-11-06 16:17 ` Bjorn Andersson 2023-11-07 9:53 ` Krishna Chaitanya Chundru 1 sibling, 1 reply; 11+ messages in thread From: Bjorn Andersson @ 2023-11-06 16:17 UTC (permalink / raw) To: Krishna chaitanya chundru Cc: Andy Gross, Konrad Dybcio, Vinod Koul, Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski, Conor Dooley, linux-arm-msm, linux-phy, devicetree, linux-kernel, quic_vbadigan, quic_ramkri, quic_nitegupt, quic_skananth, quic_vpernami, quic_parass On Mon, Nov 06, 2023 at 05:22:35PM +0530, Krishna chaitanya chundru wrote: > In PCIe low power states like L1.1 or L1.2 the phy will stop > supplying refclk to endpoint. If endpoint asserts clkreq to bring > back link L0, then RC needs to provide refclk to endpoint. > > If there is some issues in platform with clkreq signal propagation > to host and due to that host will not send refclk which results PCIe link > down. For those platforms phy needs to provide refclk even in low power Double <space> ------------^^ > states. > > Add a flag which indicates refclk is always supplied to endpoint. > The patch itself look good, the problem description looks good, but if you have an indication that the refclk "is always supplied to the endpoint", then you don't have a problem with refclk and I don't think you need this patch. Something to the tune of "keep refclk always supplied to endpoint" seems to more appropriately describe what this flag is doing. > Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com> > --- > drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 21 +++++++++++++++++---- > 1 file changed, 17 insertions(+), 4 deletions(-) > > diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c > index a63ca7424974..d7e377a7d96e 100644 > --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c > +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c > @@ -43,6 +43,8 @@ > /* QPHY_PCS_STATUS bit */ > #define PHYSTATUS BIT(6) > #define PHYSTATUS_4_20 BIT(7) > +/* PCS_PCIE_ENDPOINT_REFCLK_CNTRL */ > +#define EPCLK_ALWAYS_ON_EN BIT(6) > > #define PHY_INIT_COMPLETE_TIMEOUT 10000 > > @@ -77,6 +79,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 > }; > @@ -103,10 +106,11 @@ static const unsigned int sdm845_qhp_pciephy_regs_layout[QPHY_LAYOUT_SIZE] = { > }; > > static const unsigned int pciephy_v4_regs_layout[QPHY_LAYOUT_SIZE] = { > - [QPHY_SW_RESET] = QPHY_V4_PCS_SW_RESET, > - [QPHY_START_CTRL] = QPHY_V4_PCS_START_CONTROL, > - [QPHY_PCS_STATUS] = QPHY_V4_PCS_PCS_STATUS1, > - [QPHY_PCS_POWER_DOWN_CONTROL] = QPHY_V4_PCS_POWER_DOWN_CONTROL, > + [QPHY_SW_RESET] = QPHY_V4_PCS_SW_RESET, > + [QPHY_START_CTRL] = QPHY_V4_PCS_START_CONTROL, > + [QPHY_PCS_STATUS] = QPHY_V4_PCS_PCS_STATUS1, > + [QPHY_PCS_POWER_DOWN_CONTROL] = QPHY_V4_PCS_POWER_DOWN_CONTROL, > + [QPHY_PCS_ENDPOINT_REFCLK_CNTRL] = QPHY_V4_PCS_PCIE_ENDPOINT_REFCLK_CNTRL, > }; > > static const unsigned int pciephy_v5_regs_layout[QPHY_LAYOUT_SIZE] = { > @@ -2244,6 +2248,8 @@ struct qmp_pcie { > struct phy *phy; > int mode; > > + bool refclk_always_on; > + > struct clk_fixed_rate pipe_clk_fixed; > }; > > @@ -3159,6 +3165,10 @@ static void qmp_pcie_init_registers(struct qmp_pcie *qmp, const struct qmp_phy_c > qmp_pcie_configure(pcs, tbls->pcs, tbls->pcs_num); > qmp_pcie_configure(pcs_misc, tbls->pcs_misc, tbls->pcs_misc_num); > > + if (qmp->refclk_always_on && cfg->regs[QPHY_PCS_ENDPOINT_REFCLK_CNTRL]) > + qphy_setbits(pcs_misc, cfg->regs[QPHY_PCS_ENDPOINT_REFCLK_CNTRL], > + EPCLK_ALWAYS_ON_EN); > + > if (cfg->lanes >= 4 && qmp->tcsr_4ln_config) { > qmp_pcie_configure(serdes, cfg->serdes_4ln_tbl, cfg->serdes_4ln_num); > qmp_pcie_init_port_b(qmp, tbls); > @@ -3681,6 +3691,9 @@ static int qmp_pcie_probe(struct platform_device *pdev) > if (ret) > goto err_node_put; > > + qmp->refclk_always_on = of_property_read_bool(dev->of_node, > + "qcom,refclk-always-on"); Leave this line unwrapped, for readability. Regards, Bjorn > + > ret = phy_pipe_clk_register(qmp, np); > if (ret) > goto err_node_put; > > -- > 2.42.0 > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] phy: qcom-qmp-pcie: Add support for keeping refclk always on 2023-11-06 16:17 ` Bjorn Andersson @ 2023-11-07 9:53 ` Krishna Chaitanya Chundru 0 siblings, 0 replies; 11+ messages in thread From: Krishna Chaitanya Chundru @ 2023-11-07 9:53 UTC (permalink / raw) To: Bjorn Andersson Cc: Andy Gross, Konrad Dybcio, Vinod Koul, Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski, Conor Dooley, linux-arm-msm, linux-phy, devicetree, linux-kernel, quic_vbadigan, quic_ramkri, quic_nitegupt, quic_skananth, quic_vpernami, quic_parass On 11/6/2023 9:47 PM, Bjorn Andersson wrote: > On Mon, Nov 06, 2023 at 05:22:35PM +0530, Krishna chaitanya chundru wrote: >> In PCIe low power states like L1.1 or L1.2 the phy will stop >> supplying refclk to endpoint. If endpoint asserts clkreq to bring >> back link L0, then RC needs to provide refclk to endpoint. >> >> If there is some issues in platform with clkreq signal propagation >> to host and due to that host will not send refclk which results PCIe link >> down. For those platforms phy needs to provide refclk even in low power > Double <space> ------------^^ ACK >> states. >> >> Add a flag which indicates refclk is always supplied to endpoint. >> > The patch itself look good, the problem description looks good, but if > you have an indication that the refclk "is always supplied to the > endpoint", then you don't have a problem with refclk and I don't think > you need this patch. > > Something to the tune of "keep refclk always supplied to endpoint" seems > to more appropriately describe what this flag is doing. Sure I will change it in my next patch. >> Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com> >> --- >> drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 21 +++++++++++++++++---- >> 1 file changed, 17 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c >> index a63ca7424974..d7e377a7d96e 100644 >> --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c >> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c >> @@ -43,6 +43,8 @@ >> /* QPHY_PCS_STATUS bit */ >> #define PHYSTATUS BIT(6) >> #define PHYSTATUS_4_20 BIT(7) >> +/* PCS_PCIE_ENDPOINT_REFCLK_CNTRL */ >> +#define EPCLK_ALWAYS_ON_EN BIT(6) >> >> #define PHY_INIT_COMPLETE_TIMEOUT 10000 >> >> @@ -77,6 +79,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 >> }; >> @@ -103,10 +106,11 @@ static const unsigned int sdm845_qhp_pciephy_regs_layout[QPHY_LAYOUT_SIZE] = { >> }; >> >> static const unsigned int pciephy_v4_regs_layout[QPHY_LAYOUT_SIZE] = { >> - [QPHY_SW_RESET] = QPHY_V4_PCS_SW_RESET, >> - [QPHY_START_CTRL] = QPHY_V4_PCS_START_CONTROL, >> - [QPHY_PCS_STATUS] = QPHY_V4_PCS_PCS_STATUS1, >> - [QPHY_PCS_POWER_DOWN_CONTROL] = QPHY_V4_PCS_POWER_DOWN_CONTROL, >> + [QPHY_SW_RESET] = QPHY_V4_PCS_SW_RESET, >> + [QPHY_START_CTRL] = QPHY_V4_PCS_START_CONTROL, >> + [QPHY_PCS_STATUS] = QPHY_V4_PCS_PCS_STATUS1, >> + [QPHY_PCS_POWER_DOWN_CONTROL] = QPHY_V4_PCS_POWER_DOWN_CONTROL, >> + [QPHY_PCS_ENDPOINT_REFCLK_CNTRL] = QPHY_V4_PCS_PCIE_ENDPOINT_REFCLK_CNTRL, >> }; >> >> static const unsigned int pciephy_v5_regs_layout[QPHY_LAYOUT_SIZE] = { >> @@ -2244,6 +2248,8 @@ struct qmp_pcie { >> struct phy *phy; >> int mode; >> >> + bool refclk_always_on; >> + >> struct clk_fixed_rate pipe_clk_fixed; >> }; >> >> @@ -3159,6 +3165,10 @@ static void qmp_pcie_init_registers(struct qmp_pcie *qmp, const struct qmp_phy_c >> qmp_pcie_configure(pcs, tbls->pcs, tbls->pcs_num); >> qmp_pcie_configure(pcs_misc, tbls->pcs_misc, tbls->pcs_misc_num); >> >> + if (qmp->refclk_always_on && cfg->regs[QPHY_PCS_ENDPOINT_REFCLK_CNTRL]) >> + qphy_setbits(pcs_misc, cfg->regs[QPHY_PCS_ENDPOINT_REFCLK_CNTRL], >> + EPCLK_ALWAYS_ON_EN); >> + >> if (cfg->lanes >= 4 && qmp->tcsr_4ln_config) { >> qmp_pcie_configure(serdes, cfg->serdes_4ln_tbl, cfg->serdes_4ln_num); >> qmp_pcie_init_port_b(qmp, tbls); >> @@ -3681,6 +3691,9 @@ static int qmp_pcie_probe(struct platform_device *pdev) >> if (ret) >> goto err_node_put; >> >> + qmp->refclk_always_on = of_property_read_bool(dev->of_node, >> + "qcom,refclk-always-on"); > Leave this line unwrapped, for readability. > > Regards, > Bjorn sure I will update this in next patch. - Krishna Chaitanya. >> + >> ret = phy_pipe_clk_register(qmp, np); >> if (ret) >> goto err_node_put; >> >> -- >> 2.42.0 >> ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/2] phy: qcom-qmp-pcie: Add support to keep refclk always on 2023-11-06 11:52 [PATCH 0/2] phy: qcom-qmp-pcie: Add support to keep refclk always on Krishna chaitanya chundru 2023-11-06 11:52 ` [PATCH 1/2] dt-bindings: phy: qcom,qmp: Add PCIe qcom,refclk-always-on property Krishna chaitanya chundru 2023-11-06 11:52 ` [PATCH 2/2] phy: qcom-qmp-pcie: Add support for keeping refclk always on Krishna chaitanya chundru @ 2023-11-06 11:58 ` Dmitry Baryshkov 2023-11-06 11:59 ` Krishna Chaitanya Chundru 2 siblings, 1 reply; 11+ messages in thread From: Dmitry Baryshkov @ 2023-11-06 11:58 UTC (permalink / raw) To: Krishna chaitanya chundru Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Vinod Koul, Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski, Conor Dooley, linux-arm-msm, linux-phy, devicetree, linux-kernel, quic_vbadigan, quic_ramkri, quic_nitegupt, quic_skananth, quic_vpernami, quic_parass On Mon, 6 Nov 2023 at 13:53, Krishna chaitanya chundru <quic_krichai@quicinc.com> wrote: > > This series adds support to provide refclk to endpoint even in low > power states. > > Due to some platform specific issues with CLKREQ signal, it is not being > propagated to the host and as host doesn't know the clkreq signal host is > not sending refclk. Due to this endpoint is seeing linkdown and going > to bad state. Is this a board issue or an SoC issue? In the latter case this should go to the PHY configuration structure instead of being specified in the DT. > To avoid those ref clk should be provided always to the endpoint. The > issue is coming only when ep intiates the L1.1 or L1.2 exit and clkreq > is not being propagated properly to the host. > > Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com> > --- > Krishna chaitanya chundru (2): > dt-bindings: phy: qcom,qmp: Add PCIe qcom,refclk-always-on property > phy: qcom-qmp-pcie: Add support for keeping refclk always on > > .../bindings/phy/qcom,sc8280xp-qmp-pcie-phy.yaml | 5 +++++ > drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 21 +++++++++++++++++---- > 2 files changed, 22 insertions(+), 4 deletions(-) > --- > base-commit: 71e68e182e382e951d6248bccc3c960dcec5a718 > change-id: 20231106-refclk_always_on-9beae8297cb8 > > Best regards, > -- > Krishna chaitanya chundru <quic_krichai@quicinc.com> > -- With best wishes Dmitry ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/2] phy: qcom-qmp-pcie: Add support to keep refclk always on 2023-11-06 11:58 ` [PATCH 0/2] phy: qcom-qmp-pcie: Add support to keep " Dmitry Baryshkov @ 2023-11-06 11:59 ` Krishna Chaitanya Chundru 0 siblings, 0 replies; 11+ messages in thread From: Krishna Chaitanya Chundru @ 2023-11-06 11:59 UTC (permalink / raw) To: Dmitry Baryshkov Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Vinod Koul, Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski, Conor Dooley, linux-arm-msm, linux-phy, devicetree, linux-kernel, quic_vbadigan, quic_ramkri, quic_nitegupt, quic_skananth, quic_vpernami, quic_parass On 11/6/2023 5:28 PM, Dmitry Baryshkov wrote: > On Mon, 6 Nov 2023 at 13:53, Krishna chaitanya chundru > <quic_krichai@quicinc.com> wrote: >> This series adds support to provide refclk to endpoint even in low >> power states. >> >> Due to some platform specific issues with CLKREQ signal, it is not being >> propagated to the host and as host doesn't know the clkreq signal host is >> not sending refclk. Due to this endpoint is seeing linkdown and going >> to bad state. > Is this a board issue or an SoC issue? In the latter case this should > go to the PHY configuration structure instead of being specified in > the DT. Hi Dmitry, This is not SOC level issue it is a board issue. - Krishna Chaitanya. >> To avoid those ref clk should be provided always to the endpoint. The >> issue is coming only when ep intiates the L1.1 or L1.2 exit and clkreq >> is not being propagated properly to the host. >> >> Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com> >> --- >> Krishna chaitanya chundru (2): >> dt-bindings: phy: qcom,qmp: Add PCIe qcom,refclk-always-on property >> phy: qcom-qmp-pcie: Add support for keeping refclk always on >> >> .../bindings/phy/qcom,sc8280xp-qmp-pcie-phy.yaml | 5 +++++ >> drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 21 +++++++++++++++++---- >> 2 files changed, 22 insertions(+), 4 deletions(-) >> --- >> base-commit: 71e68e182e382e951d6248bccc3c960dcec5a718 >> change-id: 20231106-refclk_always_on-9beae8297cb8 >> >> Best regards, >> -- >> Krishna chaitanya chundru <quic_krichai@quicinc.com> >> > ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2023-11-07 9:53 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-11-06 11:52 [PATCH 0/2] phy: qcom-qmp-pcie: Add support to keep refclk always on Krishna chaitanya chundru 2023-11-06 11:52 ` [PATCH 1/2] dt-bindings: phy: qcom,qmp: Add PCIe qcom,refclk-always-on property Krishna chaitanya chundru 2023-11-06 16:20 ` Bjorn Andersson 2023-11-07 9:51 ` Krishna Chaitanya Chundru 2023-11-06 11:52 ` [PATCH 2/2] phy: qcom-qmp-pcie: Add support for keeping refclk always on Krishna chaitanya chundru 2023-11-06 12:13 ` Dmitry Baryshkov 2023-11-06 14:21 ` Krishna Chaitanya Chundru 2023-11-06 16:17 ` Bjorn Andersson 2023-11-07 9:53 ` Krishna Chaitanya Chundru 2023-11-06 11:58 ` [PATCH 0/2] phy: qcom-qmp-pcie: Add support to keep " Dmitry Baryshkov 2023-11-06 11:59 ` Krishna Chaitanya Chundru
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®