phy: qcom-qmp-usb: fix sc8280xp binding
v2 cover phy: qcom-qmp-usb: fix sc8280xp binding
[ Resending with devicetree list on CC ]
This series fixes the USB PHY devicetree binding for SC8280XP and adds support for the new updated binding to the driver.
The first half of the series clean up the driver in preparation for supporting SC8280XP and its new binding that drops the legacy child node and the (incomplete) description of register subregions.
The other QMP bindings suffer from similar problems and the PCIe and UFS drivers are being fixed here:
https://lore.kernel.org/lkml/[email protected]/ https://lore.kernel.org/lkml/[email protected]/
and a follow-on series will do corresponding changes to the combo QMP bindings and driver.
Note that these patches depend on the linux-phy next branch of today.
Johan
Changes in v2
- add missing "3" to current bindings file name "qcom,msm8996-qmp-usb3-phy.yaml" to match compatible
- add missing "-uni" infix to new bindings file name "qcom,sc8280xp-qmp-usb3-uni-phy.yaml" to match compatible (Krzysztof)
Johan Hovold (13):
phy: qcom-qmp-usb: fix sc8280xp PCS_USB offset
phy: qcom-qmp-usb: sort device-id table
phy: qcom-qmp-usb: move device-id table
phy: qcom-qmp-usb: move pm ops
phy: qcom-qmp-usb: merge driver data
phy: qcom-qmp-usb: clean up device-tree parsing
phy: qcom-qmp-usb: clean up probe initialisation
phy: qcom-qmp-usb: rename PHY ops structure
phy: qcom-qmp-usb: clean up PHY init
dt-bindings: phy: qcom,qmp-usb: rename current bindings
dt-bindings: phy: qcom,qmp-usb: fix sc8280xp binding
phy: qcom-qmp-usb: restructure PHY creation
phy: qcom-qmp-usb: add support for updated sc8280xp binding
...hy.yaml => qcom,msm8996-qmp-usb3-phy.yaml} | 20 +-
.../phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml | 105 ++++
drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 532 +++++++++---------
3 files changed, 368 insertions(+), 289 deletions(-)
rename Documentation/devicetree/bindings/phy/{qcom,qmp-usb-phy.yaml => qcom,msm8996-qmp-usb3-phy.yaml} (95%)
create mode 100644 Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yamlSignature · 7 lines
2.37.3 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH RESEND v2 1/13 phy: qcom-qmp-usb: fix sc8280xp PCS_USB offset
The PCS_USB register block lives at an offset of 0x1000 from the PCS region on SC8280XP so add the missing offset to avoid corrupting unrelated registers on runtime suspend.
Note that the current binding is broken as it does not describe the PCS_USB region and the PCS register size does not cover PCS_USB and the regions in between. As Linux currently maps full pages, simply adding the offset to driver works until the binding has been fixed.
--- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 1 + 1 file changed, 1 insertion(+)
drivers/phy/qualcomm/phy-qcom-qmp-usb.c +1 -0
@@ -1682,6 +1682,7 @@ static const struct qmp_phy_cfg sc8280xp_usb3_uniphy_cfg = { .vreg_list = qmp_phy_vreg_l, .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), .regs = qmp_v4_usb3phy_regs_layout, + .pcs_usb_offset = 0x1000, };static const struct qmp_phy_cfg qmp_v3_usb3_uniphy_cfg = {
Signature · 7 lines
2.37.3 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH RESEND v2 2/13 phy: qcom-qmp-usb: sort device-id table
In reply to Johan HovoldSort the device-id table by compatible string to make it easier to find and add new entries.
--- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 26 ++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-usb.c +13 -13
@@ -2503,14 +2503,20 @@ int qmp_usb_create(struct device *dev, struct device_node *np, int id,static const struct of_device_id qmp_usb_of_match_table[] = { { + .compatible ="qcom,ipq6018-qmp-usb3-phy" , + .data = &ipq8074_usb3phy_cfg, + }, { .compatible ="qcom,ipq8074-qmp-usb3-phy" , .data = &ipq8074_usb3phy_cfg, }, { .compatible ="qcom,msm8996-qmp-usb3-phy" , .data = &msm8996_usb3phy_cfg, }, { - .compatible ="qcom,ipq6018-qmp-usb3-phy" , - .data = &ipq8074_usb3phy_cfg, + .compatible ="qcom,msm8998-qmp-usb3-phy" , + .data = &msm8998_usb3phy_cfg, + }, { + .compatible ="qcom,qcm2290-qmp-usb3-phy" , + .data = &qcm2290_usb3phy_cfg, }, { .compatible ="qcom,sc7180-qmp-usb3-phy" , .data = &sc7180_usb3phy_cfg,
@@ -2527,8 +2533,11 @@ static const struct of_device_id qmp_usb_of_match_table[] = { .compatible = "qcom,sdm845-qmp-usb3-uni-phy", .data = &qmp_v3_usb3_uniphy_cfg, }, { - .compatible = "qcom,msm8998-qmp-usb3-phy", - .data = &msm8998_usb3phy_cfg, + .compatible = "qcom,sdx55-qmp-usb3-uni-phy", + .data = &sdx55_usb3_uniphy_cfg, + }, { + .compatible = "qcom,sdx65-qmp-usb3-uni-phy", + .data = &sdx65_usb3_uniphy_cfg, }, { .compatible = "qcom,sm8150-qmp-usb3-phy", .data = &sm8150_usb3phy_cfg,
@@ -2541,12 +2550,6 @@ static const struct of_device_id qmp_usb_of_match_table[] = { }, { .compatible = "qcom,sm8250-qmp-usb3-uni-phy", .data = &sm8250_usb3_uniphy_cfg, - }, { - .compatible = "qcom,sdx55-qmp-usb3-uni-phy", - .data = &sdx55_usb3_uniphy_cfg, - }, { - .compatible = "qcom,sdx65-qmp-usb3-uni-phy", - .data = &sdx65_usb3_uniphy_cfg, }, { .compatible = "qcom,sm8350-qmp-usb3-phy", .data = &sm8350_usb3phy_cfg,
@@ -2556,9 +2559,6 @@ static const struct of_device_id qmp_usb_of_match_table[] = { }, { .compatible = "qcom,sm8450-qmp-usb3-phy", .data = &sm8350_usb3phy_cfg, - }, { - .compatible = "qcom,qcm2290-qmp-usb3-phy", - .data = &qcm2290_usb3phy_cfg, }, { }, };
Signature · 7 lines
2.37.3 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH RESEND v2 3/13 phy: qcom-qmp-usb: move device-id table
In reply to Johan HovoldMove the device-id table below probe() and next to the driver structure to keep the driver callback functions grouped together.
--- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 126 ++++++++++++------------ 1 file changed, 63 insertions(+), 63 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-usb.c +63 -63
@@ -2501,69 +2501,6 @@ int qmp_usb_create(struct device *dev, struct device_node *np, int id,return 0 ; } -static const struct of_device_id qmp_usb_of_match_table[] = { - { - .compatible ="qcom,ipq6018-qmp-usb3-phy" , - .data = &ipq8074_usb3phy_cfg, - }, { - .compatible ="qcom,ipq8074-qmp-usb3-phy" , - .data = &ipq8074_usb3phy_cfg, - }, { - .compatible ="qcom,msm8996-qmp-usb3-phy" , - .data = &msm8996_usb3phy_cfg, - }, { - .compatible ="qcom,msm8998-qmp-usb3-phy" , - .data = &msm8998_usb3phy_cfg, - }, { - .compatible ="qcom,qcm2290-qmp-usb3-phy" , - .data = &qcm2290_usb3phy_cfg, - }, { - .compatible ="qcom,sc7180-qmp-usb3-phy" , - .data = &sc7180_usb3phy_cfg, - }, { - .compatible ="qcom,sc8180x-qmp-usb3-phy" , - .data = &sm8150_usb3phy_cfg, - }, { - .compatible ="qcom,sc8280xp-qmp-usb3-uni-phy" , - .data = &sc8280xp_usb3_uniphy_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, - }, { - .compatible ="qcom,sdx55-qmp-usb3-uni-phy" , - .data = &sdx55_usb3_uniphy_cfg, - }, { - .compatible ="qcom,sdx65-qmp-usb3-uni-phy" , - .data = &sdx65_usb3_uniphy_cfg, - }, { - .compatible ="qcom,sm8150-qmp-usb3-phy" , - .data = &sm8150_usb3phy_cfg, - }, { - .compatible ="qcom,sm8150-qmp-usb3-uni-phy" , - .data = &sm8150_usb3_uniphy_cfg, - }, { - .compatible ="qcom,sm8250-qmp-usb3-phy" , - .data = &sm8250_usb3phy_cfg, - }, { - .compatible ="qcom,sm8250-qmp-usb3-uni-phy" , - .data = &sm8250_usb3_uniphy_cfg, - }, { - .compatible ="qcom,sm8350-qmp-usb3-phy" , - .data = &sm8350_usb3phy_cfg, - }, { - .compatible ="qcom,sm8350-qmp-usb3-uni-phy" , - .data = &sm8350_usb3_uniphy_cfg, - }, { - .compatible ="qcom,sm8450-qmp-usb3-phy" , - .data = &sm8350_usb3phy_cfg, - }, - { }, -}; -MODULE_DEVICE_TABLE (of, qmp_usb_of_match_table); -static const struct dev_pm_ops qmp_usb_pm_ops = {SET_RUNTIME_PM_OPS (qmp_usb_runtime_suspend, qmp_usb_runtime_resume,NULL )
@@ -2665,6 +2602,69 @@ static int qmp_usb_probe(struct platform_device *pdev)return ret; } +static const struct of_device_id qmp_usb_of_match_table[] = { + { + .compatible ="qcom,ipq6018-qmp-usb3-phy" , + .data = &ipq8074_usb3phy_cfg, + }, { + .compatible ="qcom,ipq8074-qmp-usb3-phy" , + .data = &ipq8074_usb3phy_cfg, + }, { + .compatible ="qcom,msm8996-qmp-usb3-phy" , + .data = &msm8996_usb3phy_cfg, + }, { + .compatible ="qcom,msm8998-qmp-usb3-phy" , + .data = &msm8998_usb3phy_cfg, + }, { + .compatible ="qcom,qcm2290-qmp-usb3-phy" , + .data = &qcm2290_usb3phy_cfg, + }, { + .compatible ="qcom,sc7180-qmp-usb3-phy" , + .data = &sc7180_usb3phy_cfg, + }, { + .compatible ="qcom,sc8180x-qmp-usb3-phy" , + .data = &sm8150_usb3phy_cfg, + }, { + .compatible ="qcom,sc8280xp-qmp-usb3-uni-phy" , + .data = &sc8280xp_usb3_uniphy_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, + }, { + .compatible ="qcom,sdx55-qmp-usb3-uni-phy" , + .data = &sdx55_usb3_uniphy_cfg, + }, { + .compatible ="qcom,sdx65-qmp-usb3-uni-phy" , + .data = &sdx65_usb3_uniphy_cfg, + }, { + .compatible ="qcom,sm8150-qmp-usb3-phy" , + .data = &sm8150_usb3phy_cfg, + }, { + .compatible ="qcom,sm8150-qmp-usb3-uni-phy" , + .data = &sm8150_usb3_uniphy_cfg, + }, { + .compatible ="qcom,sm8250-qmp-usb3-phy" , + .data = &sm8250_usb3phy_cfg, + }, { + .compatible ="qcom,sm8250-qmp-usb3-uni-phy" , + .data = &sm8250_usb3_uniphy_cfg, + }, { + .compatible ="qcom,sm8350-qmp-usb3-phy" , + .data = &sm8350_usb3phy_cfg, + }, { + .compatible ="qcom,sm8350-qmp-usb3-uni-phy" , + .data = &sm8350_usb3_uniphy_cfg, + }, { + .compatible ="qcom,sm8450-qmp-usb3-phy" , + .data = &sm8350_usb3phy_cfg, + }, + { }, +}; +MODULE_DEVICE_TABLE (of, qmp_usb_of_match_table); +static struct platform_driver qmp_usb_driver = { .probe = qmp_usb_probe, .driver = {
Signature · 7 lines
2.37.3 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH RESEND v2 4/13 phy: qcom-qmp-usb: move pm ops
In reply to Johan HovoldMove the PM ops structure next to the implementation to keep the driver callbacks grouped.
--- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-usb.c +5 -5
@@ -2280,6 +2280,11 @@ static int __maybe_unused qmp_usb_runtime_resume(struct device *dev)return 0 ; } +static const struct dev_pm_ops qmp_usb_pm_ops = { +SET_RUNTIME_PM_OPS (qmp_usb_runtime_suspend, + qmp_usb_runtime_resume,NULL ) +}; +static int qmp_usb_vreg_init (struct device *dev,const struct qmp_phy_cfg *cfg) {struct qcom_qmp *qmp =dev_get_drvdata (dev);
@@ -2501,11 +2506,6 @@ int qmp_usb_create(struct device *dev, struct device_node *np, int id,return 0 ; } -static const struct dev_pm_ops qmp_usb_pm_ops = { -SET_RUNTIME_PM_OPS (qmp_usb_runtime_suspend, - qmp_usb_runtime_resume,NULL ) -}; -static int qmp_usb_probe (struct platform_device *pdev) {struct qcom_qmp *qmp;
Signature · 7 lines
2.37.3 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH RESEND v2 5/13 phy: qcom-qmp-usb: merge driver data
In reply to Johan HovoldThe USB QMP PHY driver only manages a single PHY so merge the old qcom_qmp and qmp_phy structures and drop the PHY array.
--- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 239 ++++++++++-------------- 1 file changed, 96 insertions(+), 143 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-usb.c +96 -143
@@ -1453,60 +1453,30 @@ struct qmp_phy_cfg {unsigned int pcs_usb_offset; }; -/** -* struct qmp_phy - per-lane phy descriptor -* -* @phy: generic phy -* @cfg: phy specific configuration -* @serdes: iomapped memory space for phy's serdes (i.e. PLL) -* @tx: iomapped memory space for lane's tx -* @rx: iomapped memory space for lane's rx -* @pcs: iomapped memory space for lane's pcs -* @tx2: iomapped memory space for second lane's tx (in dual lane PHYs) -* @rx2: iomapped memory space for second lane's rx (in dual lane PHYs) -* @pcs_misc: iomapped memory space for lane's pcs_misc -* @pcs_usb: iomapped memory space for lane's pcs_usb -* @pipe_clk: pipe clock -* @qmp: QMP phy to which this lane belongs -* @mode: current PHY mode -*/ -struct qmp_phy { -struct phy *phy; +struct qmp_usb { +struct device *dev; +const struct qmp_phy_cfg *cfg; +void __iomem *serdes; +void __iomem *pcs; +void __iomem *pcs_misc; +void __iomem *pcs_usb;void __iomem *tx;void __iomem *rx; -void __iomem *pcs;void __iomem *tx2;void __iomem *rx2; -void __iomem *pcs_misc; -void __iomem *pcs_usb; -struct clk *pipe_clk; -struct qcom_qmp *qmp; -enum phy_mode mode; -}; -/** -* struct qcom_qmp - structure holding QMP phy block attributes -* -* @dev: device -* @dp_com: iomapped memory space for phy's dp_com control block -* -* @clks: array of clocks required by phy -* @resets: array of resets required by phy -* @vregs: regulator supplies bulk data -* -* @phys: array of per-lane phy descriptors -*/ -struct qcom_qmp { -struct device *dev;void __iomem *dp_com; +struct clk *pipe_clk;struct clk_bulk_data *clks;struct reset_control_bulk_data *resets;struct regulator_bulk_data *vregs; -struct qmp_phy **phys; +enum phy_mode mode; + +struct phy *phy; };static inline void qphy_setbits (void __iomem *base,u32 offset,u32 val)
@@ -1976,10 +1946,10 @@ static void qmp_usb_configure(void __iomem *base,qmp_usb_configure_lane (base, tbl, num,0xff ); } -static int qmp_usb_serdes_init (struct qmp_phy *qphy) +static int qmp_usb_serdes_init (struct qmp_usb *qmp) { -const struct qmp_phy_cfg *cfg = qphy->cfg; -void __iomem *serdes = qphy->serdes; +const struct qmp_phy_cfg *cfg = qmp->cfg; +void __iomem *serdes = qmp->serdes;const struct qmp_phy_init_tbl *serdes_tbl = cfg->serdes_tbl;int serdes_tbl_num = cfg->serdes_tbl_num;
@@ -1990,10 +1960,9 @@ static int qmp_usb_serdes_init(struct qmp_phy *qphy)static int qmp_usb_init (struct phy *phy) { -struct qmp_phy *qphy =phy_get_drvdata (phy); -struct qcom_qmp *qmp = qphy->qmp; -const struct qmp_phy_cfg *cfg = qphy->cfg; -void __iomem *pcs = qphy->pcs; +struct qmp_usb *qmp =phy_get_drvdata (phy); +const struct qmp_phy_cfg *cfg = qmp->cfg; +void __iomem *pcs = qmp->pcs;void __iomem *dp_com = qmp->dp_com;int ret;
@@ -2056,9 +2025,8 @@ static int qmp_usb_init(struct phy *phy)static int qmp_usb_exit (struct phy *phy) { -struct qmp_phy *qphy =phy_get_drvdata (phy); -struct qcom_qmp *qmp = qphy->qmp; -const struct qmp_phy_cfg *cfg = qphy->cfg; +struct qmp_usb *qmp =phy_get_drvdata (phy); +const struct qmp_phy_cfg *cfg = qmp->cfg;reset_control_bulk_assert (cfg->num_resets, qmp->resets);
@@ -2071,19 +2039,18 @@ static int qmp_usb_exit(struct phy *phy)static int qmp_usb_power_on (struct phy *phy) { -struct qmp_phy *qphy =phy_get_drvdata (phy); -struct qcom_qmp *qmp = qphy->qmp; -const struct qmp_phy_cfg *cfg = qphy->cfg; -void __iomem *tx = qphy->tx; -void __iomem *rx = qphy->rx; -void __iomem *pcs = qphy->pcs; +struct qmp_usb *qmp =phy_get_drvdata (phy); +const struct qmp_phy_cfg *cfg = qmp->cfg; +void __iomem *tx = qmp->tx; +void __iomem *rx = qmp->rx; +void __iomem *pcs = qmp->pcs;void __iomem *status;unsigned int val;int ret; -qmp_usb_serdes_init (qphy); +qmp_usb_serdes_init (qmp); - ret =clk_prepare_enable (qphy->pipe_clk); + ret =clk_prepare_enable (qmp->pipe_clk);if (ret) {dev_err (qmp->dev,"pipe_clk enable failed err=%d\n" , ret);return ret;
@@ -2093,12 +2060,12 @@ static int qmp_usb_power_on(struct phy *phy)qmp_usb_configure_lane (tx, cfg->tx_tbl, cfg->tx_tbl_num,1 );if (cfg->lanes >=2 ) -qmp_usb_configure_lane (qphy->tx2, cfg->tx_tbl, cfg->tx_tbl_num,2 ); +qmp_usb_configure_lane (qmp->tx2, cfg->tx_tbl, cfg->tx_tbl_num,2 );qmp_usb_configure_lane (rx, cfg->rx_tbl, cfg->rx_tbl_num,1 );if (cfg->lanes >=2 ) -qmp_usb_configure_lane (qphy->rx2, cfg->rx_tbl, cfg->rx_tbl_num,2 ); +qmp_usb_configure_lane (qmp->rx2, cfg->rx_tbl, cfg->rx_tbl_num,2 );qmp_usb_configure (pcs, cfg->pcs_tbl, cfg->pcs_tbl_num);
@@ -2122,27 +2089,27 @@ static int qmp_usb_power_on(struct phy *phy)return 0 ; err_disable_pipe_clk: -clk_disable_unprepare (qphy->pipe_clk); +clk_disable_unprepare (qmp->pipe_clk);return ret; }static int qmp_usb_power_off (struct phy *phy) { -struct qmp_phy *qphy =phy_get_drvdata (phy); -const struct qmp_phy_cfg *cfg = qphy->cfg; +struct qmp_usb *qmp =phy_get_drvdata (phy); +const struct qmp_phy_cfg *cfg = qmp->cfg; -clk_disable_unprepare (qphy->pipe_clk); +clk_disable_unprepare (qmp->pipe_clk);/* PHY reset */ -qphy_setbits (qphy->pcs, cfg->regs[QPHY_SW_RESET ],SW_RESET ); +qphy_setbits (qmp->pcs, cfg->regs[QPHY_SW_RESET ],SW_RESET );/* stop SerDes and Phy-Coding-Sublayer */ -qphy_clrbits (qphy->pcs, cfg->regs[QPHY_START_CTRL ], +qphy_clrbits (qmp->pcs, cfg->regs[QPHY_START_CTRL ],SERDES_START |PCS_START );/* Put PHY into POWER DOWN state: active low */ -qphy_clrbits (qphy->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL ], +qphy_clrbits (qmp->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL ],SW_PWRDN );return 0 ;
@@ -2175,22 +2142,22 @@ static int qmp_usb_disable(struct phy *phy)static int qmp_usb_set_mode (struct phy *phy,enum phy_mode mode,int submode) { -struct qmp_phy *qphy =phy_get_drvdata (phy); +struct qmp_usb *qmp =phy_get_drvdata (phy); - qphy->mode = mode; + qmp->mode = mode;return 0 ; } -static void qmp_usb_enable_autonomous_mode (struct qmp_phy *qphy) +static void qmp_usb_enable_autonomous_mode (struct qmp_usb *qmp) { -const struct qmp_phy_cfg *cfg = qphy->cfg; -void __iomem *pcs_usb = qphy->pcs_usb ?: qphy->pcs; -void __iomem *pcs_misc = qphy->pcs_misc; +const struct qmp_phy_cfg *cfg = qmp->cfg; +void __iomem *pcs_usb = qmp->pcs_usb ?: qmp->pcs; +void __iomem *pcs_misc = qmp->pcs_misc;u32 intr_mask; -if (qphy->mode ==PHY_MODE_USB_HOST_SS || - qphy->mode ==PHY_MODE_USB_DEVICE_SS ) +if (qmp->mode ==PHY_MODE_USB_HOST_SS || + qmp->mode ==PHY_MODE_USB_DEVICE_SS ) intr_mask =ARCVR_DTCT_EN |ALFPS_DTCT_EN ;else intr_mask =ARCVR_DTCT_EN |ARCVR_DTCT_EVENT_SEL ;
@@ -2211,11 +2178,11 @@ static void qmp_usb_enable_autonomous_mode(struct qmp_phy *qphy)qphy_clrbits (pcs_misc,QPHY_V3_PCS_MISC_CLAMP_ENABLE ,CLAMP_EN ); } -static void qmp_usb_disable_autonomous_mode (struct qmp_phy *qphy) +static void qmp_usb_disable_autonomous_mode (struct qmp_usb *qmp) { -const struct qmp_phy_cfg *cfg = qphy->cfg; -void __iomem *pcs_usb = qphy->pcs_usb ?: qphy->pcs; -void __iomem *pcs_misc = qphy->pcs_misc; +const struct qmp_phy_cfg *cfg = qmp->cfg; +void __iomem *pcs_usb = qmp->pcs_usb ?: qmp->pcs; +void __iomem *pcs_misc = qmp->pcs_misc;/* Disable i/o clamp_n on resume for normal mode */ if (pcs_misc)
@@ -2231,20 +2198,19 @@ static void qmp_usb_disable_autonomous_mode(struct qmp_phy *qphy)static int __maybe_unused qmp_usb_runtime_suspend (struct device *dev) { -struct qcom_qmp *qmp =dev_get_drvdata (dev); -struct qmp_phy *qphy = qmp->phys[0 ]; -const struct qmp_phy_cfg *cfg = qphy->cfg; +struct qmp_usb *qmp =dev_get_drvdata (dev); +const struct qmp_phy_cfg *cfg = qmp->cfg; -dev_vdbg (dev,"Suspending QMP phy, mode:%d\n" , qphy->mode); +dev_vdbg (dev,"Suspending QMP phy, mode:%d\n" , qmp->mode); -if (!qphy->phy->init_count) { +if (!qmp->phy->init_count) {dev_vdbg (dev,"PHY not initialized, bailing out\n" );return 0 ; } -qmp_usb_enable_autonomous_mode (qphy); +qmp_usb_enable_autonomous_mode (qmp); -clk_disable_unprepare (qphy->pipe_clk); +clk_disable_unprepare (qmp->pipe_clk);clk_bulk_disable_unprepare (cfg->num_clks, qmp->clks);return 0 ;
@@ -2252,14 +2218,13 @@ static int __maybe_unused qmp_usb_runtime_suspend(struct device *dev)static int __maybe_unused qmp_usb_runtime_resume (struct device *dev) { -struct qcom_qmp *qmp =dev_get_drvdata (dev); -struct qmp_phy *qphy = qmp->phys[0 ]; -const struct qmp_phy_cfg *cfg = qphy->cfg; +struct qmp_usb *qmp =dev_get_drvdata (dev); +const struct qmp_phy_cfg *cfg = qmp->cfg;int ret =0 ; -dev_vdbg (dev,"Resuming QMP phy, mode:%d\n" , qphy->mode); +dev_vdbg (dev,"Resuming QMP phy, mode:%d\n" , qmp->mode); -if (!qphy->phy->init_count) { +if (!qmp->phy->init_count) {dev_vdbg (dev,"PHY not initialized, bailing out\n" );return 0 ; }
@@ -2268,14 +2233,14 @@ static int __maybe_unused qmp_usb_runtime_resume(struct device *dev)if (ret)return ret; - ret =clk_prepare_enable (qphy->pipe_clk); + ret =clk_prepare_enable (qmp->pipe_clk);if (ret) {dev_err (dev,"pipe_clk enable failed, err=%d\n" , ret);clk_bulk_disable_unprepare (cfg->num_clks, qmp->clks);return ret; } -qmp_usb_disable_autonomous_mode (qphy); +qmp_usb_disable_autonomous_mode (qmp);return 0 ; }
@@ -2287,7 +2252,7 @@ static const struct dev_pm_ops qmp_usb_pm_ops = {static int qmp_usb_vreg_init (struct device *dev,const struct qmp_phy_cfg *cfg) { -struct qcom_qmp *qmp =dev_get_drvdata (dev); +struct qmp_usb *qmp =dev_get_drvdata (dev);int num = cfg->num_vregs;int i;
@@ -2303,7 +2268,7 @@ static int qmp_usb_vreg_init(struct device *dev, const struct qmp_phy_cfg *cfg)static int qmp_usb_reset_init (struct device *dev,const struct qmp_phy_cfg *cfg) { -struct qcom_qmp *qmp =dev_get_drvdata (dev); +struct qmp_usb *qmp =dev_get_drvdata (dev);int i;int ret;
@@ -2324,7 +2289,7 @@ static int qmp_usb_reset_init(struct device *dev, const struct qmp_phy_cfg *cfg)static int qmp_usb_clk_init (struct device *dev,const struct qmp_phy_cfg *cfg) { -struct qcom_qmp *qmp =dev_get_drvdata (dev); +struct qmp_usb *qmp =dev_get_drvdata (dev);int num = cfg->num_clks;int i;
@@ -2361,7 +2326,7 @@ static void phy_clk_release_provider(void *res)* clk | +-------+ | +-----+ * +---------------+ */ -static int phy_pipe_clk_register (struct qcom_qmp *qmp,struct device_node *np) +static int phy_pipe_clk_register (struct qmp_usb *qmp,struct device_node *np) {struct clk_fixed_rate *fixed;struct clk_init_data init = { };
@@ -2420,13 +2385,11 @@ static void __iomem *qmp_usb_iomap(struct device *dev, struct device_node *np,return devm_of_iomap (dev, np, index,NULL ); } -static -int qmp_usb_create (struct device *dev,struct device_node *np,int id, +static int qmp_usb_create (struct device *dev,struct device_node *np,void __iomem *serdes,const struct qmp_phy_cfg *cfg) { -struct qcom_qmp *qmp =dev_get_drvdata (dev); +struct qmp_usb *qmp =dev_get_drvdata (dev);struct phy *generic_phy; -struct qmp_phy *qphy;bool exclusive = true;int ret;
@@ -2439,81 +2402,75 @@ int qmp_usb_create(struct device *dev, struct device_node *np, int id,if (of_device_is_compatible (dev->of_node,"qcom,sm8350-qmp-usb3-uni-phy" )) exclusive = false; - qphy =devm_kzalloc (dev,sizeof (*qphy),GFP_KERNEL ); -if (!qphy) -return -ENOMEM ; - - qphy->cfg = cfg; - qphy->serdes = serdes; + qmp->cfg = cfg; + qmp->serdes = serdes;/* * Get memory resources for the PHY: * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2. * For dual lane PHYs: tx2 -> 3, rx2 -> 4, pcs_misc (optional) -> 5 * For single lane PHYs: pcs_misc (optional) -> 3. */ - qphy->tx =devm_of_iomap (dev, np,0 ,NULL ); -if (IS_ERR (qphy->tx)) -return PTR_ERR (qphy->tx); + qmp->tx =devm_of_iomap (dev, np,0 ,NULL ); +if (IS_ERR (qmp->tx)) +return PTR_ERR (qmp->tx); - qphy->rx =devm_of_iomap (dev, np,1 ,NULL ); -if (IS_ERR (qphy->rx)) -return PTR_ERR (qphy->rx); + qmp->rx =devm_of_iomap (dev, np,1 ,NULL ); +if (IS_ERR (qmp->rx)) +return PTR_ERR (qmp->rx); - qphy->pcs =qmp_usb_iomap (dev, np,2 , exclusive); -if (IS_ERR (qphy->pcs)) -return PTR_ERR (qphy->pcs); + qmp->pcs =qmp_usb_iomap (dev, np,2 , exclusive); +if (IS_ERR (qmp->pcs)) +return PTR_ERR (qmp->pcs);if (cfg->pcs_usb_offset) - qphy->pcs_usb = qphy->pcs + cfg->pcs_usb_offset; + qmp->pcs_usb = qmp->pcs + cfg->pcs_usb_offset;if (cfg->lanes >=2 ) { - qphy->tx2 =devm_of_iomap (dev, np,3 ,NULL ); -if (IS_ERR (qphy->tx2)) -return PTR_ERR (qphy->tx2); + qmp->tx2 =devm_of_iomap (dev, np,3 ,NULL ); +if (IS_ERR (qmp->tx2)) +return PTR_ERR (qmp->tx2); - qphy->rx2 =devm_of_iomap (dev, np,4 ,NULL ); -if (IS_ERR (qphy->rx2)) -return PTR_ERR (qphy->rx2); + qmp->rx2 =devm_of_iomap (dev, np,4 ,NULL ); +if (IS_ERR (qmp->rx2)) +return PTR_ERR (qmp->rx2); - qphy->pcs_misc =devm_of_iomap (dev, np,5 ,NULL ); + qmp->pcs_misc =devm_of_iomap (dev, np,5 ,NULL ); }else { - qphy->pcs_misc =devm_of_iomap (dev, np,3 ,NULL ); + qmp->pcs_misc =devm_of_iomap (dev, np,3 ,NULL ); } -if (IS_ERR (qphy->pcs_misc)) { +if (IS_ERR (qmp->pcs_misc)) {dev_vdbg (dev,"PHY pcs_misc-reg not used\n" ); - qphy->pcs_misc =NULL ; + qmp->pcs_misc =NULL ; } - qphy->pipe_clk =devm_get_clk_from_child (dev, np,NULL ); -if (IS_ERR (qphy->pipe_clk)) { -return dev_err_probe (dev,PTR_ERR (qphy->pipe_clk), -"failed to get lane%d pipe clock\n" , id); + qmp->pipe_clk =devm_get_clk_from_child (dev, np,NULL ); +if (IS_ERR (qmp->pipe_clk)) { +return dev_err_probe (dev,PTR_ERR (qmp->pipe_clk), +"failed to get pipe clock\n" ); } generic_phy =devm_phy_create (dev, np, &qmp_usb_ops);if (IS_ERR (generic_phy)) { ret =PTR_ERR (generic_phy); -dev_err (dev,"failed to create qphy %d\n" , ret); +dev_err (dev,"failed to create PHY: %d\n" , ret);return ret; } - qphy->phy = generic_phy; - qphy->qmp = qmp; - qmp->phys[id] = qphy; -phy_set_drvdata (generic_phy, qphy); + qmp->phy = generic_phy; +phy_set_drvdata (generic_phy, qmp);return 0 ; }static int qmp_usb_probe (struct platform_device *pdev) { -struct qcom_qmp *qmp;struct device *dev = &pdev->dev;struct device_node *child;struct phy_provider *phy_provider;void __iomem *serdes;const struct qmp_phy_cfg *cfg =NULL ; +struct qmp_usb *qmp;int num, id;int ret;
@@ -2555,10 +2512,6 @@ static int qmp_usb_probe(struct platform_device *pdev)if (num >1 )return -EINVAL ; - qmp->phys =devm_kcalloc (dev, num,sizeof (*qmp->phys),GFP_KERNEL ); -if (!qmp->phys) -return -ENOMEM ; -pm_runtime_set_active (dev); ret =devm_pm_runtime_enable (dev);if (ret)
@@ -2572,7 +2525,7 @@ static int qmp_usb_probe(struct platform_device *pdev) id =0 ;for_each_available_child_of_node (dev->of_node, child) {/* Create per-lane phy */ - ret =qmp_usb_create (dev, child, id, serdes, cfg); + ret =qmp_usb_create (dev, child, serdes, cfg);if (ret) {dev_err (dev,"failed to create lane%d phy, %d\n" , id, ret);
Signature · 7 lines
2.37.3 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH RESEND v2 6/13 phy: qcom-qmp-usb: clean up device-tree parsing
In reply to Johan HovoldSince the QMP driver split there will be at most a single child node so drop the obsolete iteration construct.
While at it, drop the verbose error logging that would have been printed also on probe deferrals.
Note that there's no need to check if there are additional child nodes (the kernel is not a devicetree validator), but let's return an error if there are no child nodes at all for now.
--- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 40 ++++++++----------------- 1 file changed, 12 insertions(+), 28 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-usb.c +12 -28
@@ -2471,7 +2471,6 @@ static int qmp_usb_probe(struct platform_device *pdev)void __iomem *serdes;const struct qmp_phy_cfg *cfg =NULL ;struct qmp_usb *qmp; -int num, id;int ret; qmp =devm_kzalloc (dev,sizeof (*qmp),GFP_KERNEL );
@@ -2507,44 +2506,29 @@ static int qmp_usb_probe(struct platform_device *pdev)if (ret)return ret; - num =of_get_available_child_count (dev->of_node); -/* do we have a rogue child node ? */ -if (num >1 ) + child =of_get_next_available_child (dev->of_node,NULL ); +if (!child)return -EINVAL ;pm_runtime_set_active (dev); ret =devm_pm_runtime_enable (dev);if (ret) -return ret; + goto err_node_put;/* * Prevent runtime pm from being ON by default. Users can enable * it using power/control in sysfs. */ pm_runtime_forbid (dev); - id =0 ; -for_each_available_child_of_node (dev->of_node, child) { -/* Create per-lane phy */ - ret =qmp_usb_create (dev, child, serdes, cfg); -if (ret) { -dev_err (dev,"failed to create lane%d phy, %d\n" , - id, ret); - goto err_node_put; - } - -/* -* Register the pipe clock provided by phy. -* See function description to see details of this pipe clock. -*/ - ret =phy_pipe_clk_register (qmp, child); -if (ret) { -dev_err (qmp->dev, -"failed to register pipe clock source\n" ); - goto err_node_put; - } - - id++; - } + ret =qmp_usb_create (dev, child, serdes, cfg); +if (ret) + goto err_node_put; + + ret =phy_pipe_clk_register (qmp, child); +if (ret) + goto err_node_put; + +of_node_put (child); phy_provider =devm_of_phy_provider_register (dev, of_phy_simple_xlate);
Signature · 7 lines
2.37.3 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH RESEND v2 7/13 phy: qcom-qmp-usb: clean up probe initialisation
In reply to Johan HovoldStop abusing the driver data pointer and instead pass the driver state structure directly to the initialisation helpers during probe.
--- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 46 ++++++++++++------------- 1 file changed, 22 insertions(+), 24 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-usb.c +22 -24
@@ -2250,9 +2250,10 @@ static const struct dev_pm_ops qmp_usb_pm_ops = { qmp_usb_runtime_resume, NULL) }; -static int qmp_usb_vreg_init (struct device *dev,const struct qmp_phy_cfg *cfg) +static int qmp_usb_vreg_init (struct qmp_usb *qmp) { -struct qmp_usb *qmp =dev_get_drvdata (dev); +const struct qmp_phy_cfg *cfg = qmp->cfg; +struct device *dev = qmp->dev;int num = cfg->num_vregs;int i;
@@ -2266,9 +2267,10 @@ static int qmp_usb_vreg_init(struct device *dev, const struct qmp_phy_cfg *cfg)return devm_regulator_bulk_get (dev, num, qmp->vregs); } -static int qmp_usb_reset_init (struct device *dev,const struct qmp_phy_cfg *cfg) +static int qmp_usb_reset_init (struct qmp_usb *qmp) { -struct qmp_usb *qmp =dev_get_drvdata (dev); +const struct qmp_phy_cfg *cfg = qmp->cfg; +struct device *dev = qmp->dev;int i;int ret;
@@ -2287,9 +2289,10 @@ static int qmp_usb_reset_init(struct device *dev, const struct qmp_phy_cfg *cfg)return 0 ; } -static int qmp_usb_clk_init (struct device *dev,const struct qmp_phy_cfg *cfg) +static int qmp_usb_clk_init (struct qmp_usb *qmp) { -struct qmp_usb *qmp =dev_get_drvdata (dev); +const struct qmp_phy_cfg *cfg = qmp->cfg; +struct device *dev = qmp->dev;int num = cfg->num_clks;int i;
@@ -2385,10 +2388,10 @@ static void __iomem *qmp_usb_iomap(struct device *dev, struct device_node *np,return devm_of_iomap (dev, np, index,NULL ); } -static int qmp_usb_create (struct device *dev,struct device_node *np, -void __iomem *serdes,const struct qmp_phy_cfg *cfg) +static int qmp_usb_create (struct qmp_usb *qmp,struct device_node *np) { -struct qmp_usb *qmp =dev_get_drvdata (dev); +const struct qmp_phy_cfg *cfg = qmp->cfg; +struct device *dev = qmp->dev;struct phy *generic_phy;bool exclusive = true;int ret;
@@ -2402,8 +2405,6 @@ static int qmp_usb_create(struct device *dev, struct device_node *np,if (of_device_is_compatible (dev->of_node,"qcom,sm8350-qmp-usb3-uni-phy" )) exclusive = false; - qmp->cfg = cfg; - qmp->serdes = serdes;/* * Get memory resources for the PHY: * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2.
@@ -2468,8 +2469,6 @@ static int qmp_usb_probe(struct platform_device *pdev)struct device *dev = &pdev->dev;struct device_node *child;struct phy_provider *phy_provider; -void __iomem *serdes; -const struct qmp_phy_cfg *cfg =NULL ;struct qmp_usb *qmp;int ret;
@@ -2478,31 +2477,30 @@ static int qmp_usb_probe(struct platform_device *pdev)return -ENOMEM ; qmp->dev = dev; -dev_set_drvdata (dev, qmp); - cfg =of_device_get_match_data (dev); -if (!cfg) + qmp->cfg =of_device_get_match_data (dev); +if (!qmp->cfg)return -EINVAL ; - serdes =devm_platform_ioremap_resource (pdev,0 ); -if (IS_ERR (serdes)) -return PTR_ERR (serdes); + qmp->serdes =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (qmp->serdes)) +return PTR_ERR (qmp->serdes); -if (cfg->has_phy_dp_com_ctrl) { +if (qmp->cfg->has_phy_dp_com_ctrl) { qmp->dp_com =devm_platform_ioremap_resource (pdev,1 );if (IS_ERR (qmp->dp_com))return PTR_ERR (qmp->dp_com); } - ret =qmp_usb_clk_init (dev, cfg); + ret =qmp_usb_clk_init (qmp);if (ret)return ret; - ret =qmp_usb_reset_init (dev, cfg); + ret =qmp_usb_reset_init (qmp);if (ret)return ret; - ret =qmp_usb_vreg_init (dev, cfg); + ret =qmp_usb_vreg_init (qmp);if (ret)return ret;
@@ -2520,7 +2518,7 @@ static int qmp_usb_probe(struct platform_device *pdev)*/ pm_runtime_forbid (dev); - ret =qmp_usb_create (dev, child, serdes, cfg); + ret =qmp_usb_create (qmp, child);if (ret) goto err_node_put;
Signature · 7 lines
2.37.3 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH RESEND v2 8/13 phy: qcom-qmp-usb: rename PHY ops structure
In reply to Johan HovoldRename the PHY operation structure so that it has a "phy_ops" suffix and move it next to the implementation.
--- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-usb.c +8 -8
@@ -2149,6 +2149,13 @@ static int qmp_usb_set_mode(struct phy *phy, enum phy_mode mode, int submode)return 0 ; } +static const struct phy_ops qmp_usb_phy_ops = { + .init = qmp_usb_enable, + .exit = qmp_usb_disable, + .set_mode = qmp_usb_set_mode, + .owner =THIS_MODULE , +}; +static void qmp_usb_enable_autonomous_mode (struct qmp_usb *qmp) {const struct qmp_phy_cfg *cfg = qmp->cfg;
@@ -2366,13 +2373,6 @@ static int phy_pipe_clk_register(struct qmp_usb *qmp, struct device_node *np)return devm_add_action_or_reset (qmp->dev, phy_clk_release_provider, np); } -static const struct phy_ops qmp_usb_ops = { - .init = qmp_usb_enable, - .exit = qmp_usb_disable, - .set_mode = qmp_usb_set_mode, - .owner =THIS_MODULE , -}; -static void __iomem *qmp_usb_iomap (struct device *dev,struct device_node *np,int index,bool exclusive) {
@@ -2451,7 +2451,7 @@ static int qmp_usb_create(struct qmp_usb *qmp, struct device_node *np) "failed to get pipe clock\n"); } - generic_phy =devm_phy_create (dev, np, &qmp_usb_ops); + generic_phy =devm_phy_create (dev, np, &qmp_usb_phy_ops);if (IS_ERR (generic_phy)) { ret =PTR_ERR (generic_phy);dev_err (dev,"failed to create PHY: %d\n" , ret);
Signature · 7 lines
2.37.3 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH RESEND v2 9/13 phy: qcom-qmp-usb: clean up PHY init
In reply to Johan HovoldClean up the PHY initialisation somewhat by programming both tx and rx for the second lane after the first lane.
--- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-usb.c +3 -5
@@ -2058,14 +2058,12 @@ static int qmp_usb_power_on(struct phy *phy)/* Tx, Rx, and PCS configurations */ qmp_usb_configure_lane (tx, cfg->tx_tbl, cfg->tx_tbl_num,1 ); - -if (cfg->lanes >=2 ) -qmp_usb_configure_lane (qmp->tx2, cfg->tx_tbl, cfg->tx_tbl_num,2 ); -qmp_usb_configure_lane (rx, cfg->rx_tbl, cfg->rx_tbl_num,1 ); -if (cfg->lanes >=2 ) +if (cfg->lanes >=2 ) { +qmp_usb_configure_lane (qmp->tx2, cfg->tx_tbl, cfg->tx_tbl_num,2 );qmp_usb_configure_lane (qmp->rx2, cfg->rx_tbl, cfg->rx_tbl_num,2 ); + }qmp_usb_configure (pcs, cfg->pcs_tbl, cfg->pcs_tbl_num);
Signature · 7 lines
2.37.3 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH RESEND v2 10/13 dt-bindings: phy: qcom,qmp-usb: rename current bindings
In reply to Johan HovoldThe current QMP USB PHY bindings are based on the original MSM8996 binding which provided multiple PHYs per IP block and these in turn were described by child nodes.
Later QMP USB PHY blocks only provide a single PHY and the remnant child node does not really reflect the hardware.
The original MSM8996 binding also ended up describing the individual register blocks as belonging to either the wrapper node or the PHY child nodes.
This is an unnecessary level of detail which has lead to problems when later IP blocks using different register layouts have been forced to fit the original mould rather than updating the binding. The bindings are arguable also incomplete as they only the describe register blocks used by the current Linux drivers (e.g. does not include the per lane PCS registers).
In preparation for adding new bindings for SC8280XP which further bindings can be based on, rename the current bindings after MSM8996 and add a reference to the SC8280XP bindings.
---
...com,qmp-usb-phy.yaml => qcom,msm8996-qmp-usb3-phy.yaml} | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
rename Documentation/devicetree/bindings/phy/{qcom,qmp-usb-phy.yaml => qcom,msm8996-qmp-usb3-phy.yaml} (97%)Documentation/devicetree/bindings/phy/qcom,msm8996-qmp-usb3-phy.yaml renamed from Documentation/devicetree/bindings/phy/qcom,qmp-usb-phy.yaml +5 -2
@@ -1,10 +1,10 @@ # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) %YAML 1.2 --- -$id: http://devicetree.org/schemas/phy/qcom,qmp-usb-phy.yaml# +$id: http://devicetree.org/schemas/phy/qcom,msm8996-qmp-usb3-phy.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# -title: Qualcomm QMP PHY controller (USB) +title: Qualcomm QMP PHY controller (USB, MSM8996) maintainers: - Vinod Koul <[email protected]>
@@ -13,6 +13,9 @@ description: QMP PHY controller supports physical layer functionality for a number of controllers on Qualcomm chipsets, such as, PCIe, UFS, and USB. + Note that these bindings are for SoCs up to SC8180X. For newer SoCs, see + qcom,sc8280xp-qmp-usb3-uni-phy.yaml. + properties: compatible: enum:
Signature · 7 lines
2.37.3 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH RESEND v2 11/13 dt-bindings: phy: qcom,qmp-usb: fix sc8280xp binding
In reply to Johan HovoldThe current QMP USB PHY bindings are based on the original MSM8996 PCIe PHY binding which provided multiple PHYs per IP block and these in turn were described by child nodes.
The QMP USB PHY block only provide a single PHY and the remnant child node does not really reflect the hardware.
The original MSM8996 binding also ended up describing the individual register blocks as belonging to either the wrapper node or the PHY child nodes.
This is an unnecessary level of detail which has lead to problems when later IP blocks using different register layouts have been forced to fit the original mould rather than updating the binding. The bindings are arguable also incomplete as they only the describe register blocks used by the current Linux drivers (e.g. does not include the per lane PCS registers).
Note that PCS_USB region is also not described by the current bindings despite being used by the driver and this has led to people increasing the size of the PCS region in the devicetree so that it includes PCS_USB registers even though other regions like TX and RX may lie in between.
Add a new binding for the QMP USB PHYs found on SC8280XP which further bindings can be based on.
Note that this also fixes the SC8280XP "phy_phy" reset name.
Also note that the current binding is simply removed instead of being deprecated as it was only recently merged and support for SC8280XP is still under development. And, specifically, there is no support in mainline for the multiport controller that uses these PHYs.
--- .../phy/qcom,msm8996-qmp-usb3-phy.yaml | 13 --- .../phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml | 105 ++++++++++++++++++ 2 files changed, 105 insertions(+), 13 deletions(-) create mode 100644 Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
Documentation/devicetree/bindings/phy/qcom,msm8996-qmp-usb3-phy.yaml +0 -13
@@ -26,7 +26,6 @@ properties: - qcom,qcm2290-qmp-usb3-phy - qcom,sc7180-qmp-usb3-phy - qcom,sc8180x-qmp-usb3-phy - - qcom,sc8280xp-qmp-usb3-uni-phy - qcom,sdm845-qmp-usb3-phy - qcom,sdm845-qmp-usb3-uni-phy - qcom,sdx55-qmp-usb3-uni-phy
@@ -204,7 +203,6 @@ allOf: compatible: contains: enum: - - qcom,sc8280xp-qmp-usb3-uni-phy - qcom,sm8150-qmp-usb3-phy - qcom,sm8150-qmp-usb3-uni-phy - qcom,sm8250-qmp-usb3-uni-phy
@@ -271,16 +269,6 @@ allOf: - const: phy_phy - const: phy - - if: - properties: - compatible: - contains: - enum: - - qcom,sc8280xp-qmp-usb3-uni-phy - then: - required: - - power-domains - - if: properties: compatible:
@@ -352,7 +340,6 @@ allOf: contains: enum: - qcom,msm8996-qmp-usb3-phy - - qcom,sc8280xp-qmp-usb3-uni-phy - qcom,sm8250-qmp-usb3-uni-phy - qcom,sm8350-qmp-usb3-uni-phy then:
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml new file +105 -0
105 lines not on this page · raw message
Signature · 7 lines
2.37.3 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH RESEND v2 11/13] dt-bindings: phy: qcom,qmp-usb: fix sc8280xp binding
Quoted 33 lines · Johan Hovold
The current QMP USB PHY bindings are based on the original MSM8996 PCIe PHY binding which provided multiple PHYs per IP block and these in turn were described by child nodes.
The QMP USB PHY block only provide a single PHY and the remnant child node does not really reflect the hardware.
The original MSM8996 binding also ended up describing the individual register blocks as belonging to either the wrapper node or the PHY child nodes.
This is an unnecessary level of detail which has lead to problems when later IP blocks using different register layouts have been forced to fit the original mould rather than updating the binding. The bindings are arguable also incomplete as they only the describe register blocks used by the current Linux drivers (e.g. does not include the per lane PCS registers).
Note that
PCS_USBregion is also not described by the current bindings despite being used by the driver and this has led to people increasing the size of the PCS region in the devicetree so that it includesPCS_USBregisters even though other regions like TX and RX may lie in between.Add a new binding for the QMP USB PHYs found on SC8280XP which further bindings can be based on.
Note that this also fixes the SC8280XP "
phy_phy" reset name.Also note that the current binding is simply removed instead of being deprecated as it was only recently merged and support for SC8280XP is still under development. And, specifically, there is no support in mainline for the multiport controller that uses these PHYs.
Quoted 7 lines
Signed-off-by Johan Hovold <[email protected]>--- .../phy/qcom,msm8996-qmp-usb3-phy.yaml | 13 --- .../phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml | 105 ++++++++++++++++++ 2 files changed, 105 insertions(+), 13 deletions(-) create mode 100644 Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
PATCH RESEND v2 12/13 phy: qcom-qmp-usb: restructure PHY creation
In reply to Johan HovoldIn preparation for supporting devicetree bindings which do not use a child node, move the PHY creation to probe() proper and parse the serdes and dp_com resources in what is now the legacy devicetree helper.
--- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 46 ++++++++++++------------- 1 file changed, 22 insertions(+), 24 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-usb.c +22 -24
@@ -2386,13 +2386,22 @@ static void __iomem *qmp_usb_iomap(struct device *dev, struct device_node *np,return devm_of_iomap (dev, np, index,NULL ); } -static int qmp_usb_create (struct qmp_usb *qmp,struct device_node *np) +static int qmp_usb_parse_dt_legacy (struct qmp_usb *qmp,struct device_node *np) { +struct platform_device *pdev =to_platform_device (qmp->dev);const struct qmp_phy_cfg *cfg = qmp->cfg;struct device *dev = qmp->dev; -struct phy *generic_phy;bool exclusive = true; -int ret; + + qmp->serdes =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (qmp->serdes)) +return PTR_ERR (qmp->serdes); + +if (cfg->has_phy_dp_com_ctrl) { + qmp->dp_com =devm_platform_ioremap_resource (pdev,1 ); +if (IS_ERR (qmp->dp_com)) +return PTR_ERR (qmp->dp_com); + }/* * FIXME: These bindings should be fixed to not rely on overlapping
@@ -2449,16 +2458,6 @@ static int qmp_usb_create(struct qmp_usb *qmp, struct device_node *np) "failed to get pipe clock\n"); } - generic_phy =devm_phy_create (dev, np, &qmp_usb_phy_ops); -if (IS_ERR (generic_phy)) { - ret =PTR_ERR (generic_phy); -dev_err (dev,"failed to create PHY: %d\n" , ret); -return ret; - } - - qmp->phy = generic_phy; -phy_set_drvdata (generic_phy, qmp); -return 0 ; }
@@ -2480,16 +2479,6 @@ static int qmp_usb_probe(struct platform_device *pdev)if (!qmp->cfg)return -EINVAL ; - qmp->serdes =devm_platform_ioremap_resource (pdev,0 ); -if (IS_ERR (qmp->serdes)) -return PTR_ERR (qmp->serdes); - -if (qmp->cfg->has_phy_dp_com_ctrl) { - qmp->dp_com =devm_platform_ioremap_resource (pdev,1 ); -if (IS_ERR (qmp->dp_com)) -return PTR_ERR (qmp->dp_com); - } - ret =qmp_usb_clk_init (qmp);if (ret)return ret;
@@ -2516,7 +2505,7 @@ static int qmp_usb_probe(struct platform_device *pdev)*/ pm_runtime_forbid (dev); - ret =qmp_usb_create (qmp, child); + ret =qmp_usb_parse_dt_legacy (qmp, child);if (ret) goto err_node_put;
@@ -2524,6 +2513,15 @@ static int qmp_usb_probe(struct platform_device *pdev)if (ret) goto err_node_put; + qmp->phy =devm_phy_create (dev, child, &qmp_usb_phy_ops); +if (IS_ERR (qmp->phy)) { + ret =PTR_ERR (qmp->phy); +dev_err (dev,"failed to create PHY: %d\n" , ret); + goto err_node_put; + } + +phy_set_drvdata (qmp->phy, qmp); +of_node_put (child); phy_provider =devm_of_phy_provider_register (dev, of_phy_simple_xlate);
Signature · 7 lines
2.37.3 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH RESEND v2 13/13 phy: qcom-qmp-usb: add support for updated sc8280xp binding
In reply to Johan HovoldAdd support for the new SC8280XP binding.
Note that the binding does not try to describe every register subregion and instead the driver holds the corresponding offsets. This includes the PCS_USB region which was initially overlooked.
Note that the driver will no longer accept the old binding due to the fixed "phy_phy" reset name.
--- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 82 ++++++++++++++++++++----- 1 file changed, 67 insertions(+), 15 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-usb.c +67 -15
@@ -1414,10 +1414,20 @@ static const struct qmp_phy_init_tbl sc8280xp_usb3_uniphy_pcs_tbl[] = { QMP_PHY_INIT_CFG(QPHY_V5_PCS_REFGEN_REQ_CONFIG1, 0x21), }; +struct qmp_usb_offsets { +u16 serdes; +u16 pcs; +u16 pcs_usb; +u16 tx; +u16 rx; +}; +/* struct qmp_phy_cfg - per-PHY initialization config */ struct qmp_phy_cfg {int lanes; +const struct qmp_usb_offsets *offsets; +/* Init sequence for PHY blocks - serdes, tx, rx, pcs */ const struct qmp_phy_init_tbl *serdes_tbl;int serdes_tbl_num;
@@ -1548,6 +1558,14 @@ static const char * const qmp_phy_vreg_l[] = { "vdda-phy", "vdda-pll", }; +static const struct qmp_usb_offsets qmp_usb_offsets_v5 = { + .serdes =0 , + .pcs =0x0200 , + .pcs_usb =0x1200 , + .tx =0x0e00 , + .rx =0x1000 , +}; +static const struct qmp_phy_cfg ipq8074_usb3phy_cfg = { .lanes =1 ,
@@ -1637,6 +1655,8 @@ static const struct qmp_phy_cfg sc7180_usb3phy_cfg = {static const struct qmp_phy_cfg sc8280xp_usb3_uniphy_cfg = { .lanes =1 , + .offsets = &qmp_usb_offsets_v5, + .serdes_tbl = sc8280xp_usb3_uniphy_serdes_tbl, .serdes_tbl_num =ARRAY_SIZE (sc8280xp_usb3_uniphy_serdes_tbl), .tx_tbl = sc8280xp_usb3_uniphy_tx_tbl,
@@ -1647,12 +1667,11 @@ static const struct qmp_phy_cfg sc8280xp_usb3_uniphy_cfg = { .pcs_tbl_num = ARRAY_SIZE(sc8280xp_usb3_uniphy_pcs_tbl), .clk_list = qmp_v4_phy_clk_l, .num_clks = ARRAY_SIZE(qmp_v4_phy_clk_l), - .reset_list = msm8996_usb3phy_reset_l, - .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l), + .reset_list = qcm2290_usb3phy_reset_l, + .num_resets = ARRAY_SIZE(qcm2290_usb3phy_reset_l), .vreg_list = qmp_phy_vreg_l, .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), .regs = qmp_v4_usb3phy_regs_layout, - .pcs_usb_offset = 0x1000, };static const struct qmp_phy_cfg qmp_v3_usb3_uniphy_cfg = {
@@ -2461,11 +2480,41 @@ static int qmp_usb_parse_dt_legacy(struct qmp_usb *qmp, struct device_node *np)return 0 ; } +static int qmp_usb_parse_dt (struct qmp_usb *qmp) +{ +struct platform_device *pdev =to_platform_device (qmp->dev); +const struct qmp_phy_cfg *cfg = qmp->cfg; +const struct qmp_usb_offsets *offs = cfg->offsets; +struct device *dev = qmp->dev; +void __iomem *base; + +if (!offs) +return -EINVAL ; + + base =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (base)) +return PTR_ERR (base); + + qmp->serdes = base + offs->serdes; + qmp->pcs = base + offs->pcs; + qmp->pcs_usb = base + offs->pcs_usb; + qmp->tx = base + offs->tx; + qmp->rx = base + offs->rx; + + qmp->pipe_clk =devm_clk_get (dev,"pipe" ); +if (IS_ERR (qmp->pipe_clk)) { +return dev_err_probe (dev,PTR_ERR (qmp->pipe_clk), +"failed to get pipe clock\n" ); + } + +return 0 ; +} +static int qmp_usb_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; -struct device_node *child;struct phy_provider *phy_provider; +struct device_node *np;struct qmp_usb *qmp;int ret;
@@ -2491,9 +2540,16 @@ static int qmp_usb_probe(struct platform_device *pdev)if (ret)return ret; - child =of_get_next_available_child (dev->of_node,NULL ); -if (!child) -return -EINVAL ; +/* Check for legacy binding with child node. */ + np =of_get_next_available_child (dev->of_node,NULL ); +if (np) { + ret =qmp_usb_parse_dt_legacy (qmp, np); + }else { + np =of_node_get (dev->of_node); + ret =qmp_usb_parse_dt (qmp); + } +if (ret) + goto err_node_put;pm_runtime_set_active (dev); ret =devm_pm_runtime_enable (dev);
@@ -2505,15 +2561,11 @@ static int qmp_usb_probe(struct platform_device *pdev)*/ pm_runtime_forbid (dev); - ret =qmp_usb_parse_dt_legacy (qmp, child); -if (ret) - goto err_node_put; - - ret =phy_pipe_clk_register (qmp, child); + ret =phy_pipe_clk_register (qmp, np);if (ret) goto err_node_put; - qmp->phy =devm_phy_create (dev, child, &qmp_usb_phy_ops); + qmp->phy =devm_phy_create (dev, np, &qmp_usb_phy_ops);if (IS_ERR (qmp->phy)) { ret =PTR_ERR (qmp->phy);dev_err (dev,"failed to create PHY: %d\n" , ret);
@@ -2522,14 +2574,14 @@ static int qmp_usb_probe(struct platform_device *pdev)phy_set_drvdata (qmp->phy, qmp); -of_node_put (child); +of_node_put (np); phy_provider =devm_of_phy_provider_register (dev, of_phy_simple_xlate);return PTR_ERR_OR_ZERO (phy_provider); err_node_put: -of_node_put (child); +of_node_put (np);return ret; }
Signature · 7 lines
2.37.3 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Quoted 8 lines · Johan Hovold
[ Resending with devicetree list on CC ]
This series fixes the USB PHY devicetree binding for SC8280XP and adds support for the new updated binding to the driver.
The first half of the series clean up the driver in preparation for supporting SC8280XP and its new binding that drops the legacy child node and the (incomplete) description of register subregions.
Applied, thanks
Signature · 1 line
~Vinod