phy: qcom-qmp-ufs: fix sc8280xp binding
cover phy: qcom-qmp-ufs: fix sc8280xp binding
This series fixes the UFS 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 driver is being fixed here:
https://lore.kernel.org/lkml/[email protected]/
and follow-on series will do corresponding changes to the USB and combo QMP bindings and drivers.
Note that these patches depend on the linux-phy next branch of today and the following two series:
1. [PATCH v2 00/14] phy: qcom-qmp: further prep cleanups
https://lore.kernel.org/lkml/[email protected]
2. [PATCH 00/20] phy: qcom-qmp: further prep fixes and cleanups (set 3)
https://lore.kernel.org/lkml/[email protected]
Johan
Johan Hovold (10):
phy: qcom-qmp-ufs: move device-id table
phy: qcom-qmp-ufs: merge driver data
phy: qcom-qmp-ufs: clean up device-tree parsing
phy: qcom-qmp-ufs: clean up probe initialisation
phy: qcom-qmp-ufs: rename PHY ops structure
phy: qcom-qmp-ufs: clean up PHY init
dt-bindings: phy: qcom,qmp-ufs: rename current bindings
dt-bindings: phy: qcom,qmp-ufs: fix sc8280xp binding
phy: qcom-qmp-ufs: restructure PHY creation
phy: qcom-qmp-ufs: add support for updated sc8280xp binding
...phy.yaml => qcom,msm8996-qmp-ufs-phy.yaml} | 17 +-
.../phy/qcom,sc8280xp-qmp-ufs-phy.yaml | 83 ++++
drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 381 +++++++++---------
3 files changed, 287 insertions(+), 194 deletions(-)
rename Documentation/devicetree/bindings/phy/{qcom,qmp-ufs-phy.yaml => qcom,msm8996-qmp-ufs-phy.yaml} (93%)
create mode 100644 Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-ufs-phy.yamlSignature · 1 line
2.37.3
PATCH 1/10 phy: qcom-qmp-ufs: move device-id table
Move 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-ufs.c | 78 ++++++++++++------------- 1 file changed, 39 insertions(+), 39 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-ufs.c +39 -39
@@ -1081,45 +1081,6 @@ static int qmp_ufs_create(struct device *dev, struct device_node *np, int id,return 0 ; } -static const struct of_device_id qmp_ufs_of_match_table[] = { - { - .compatible ="qcom,msm8996-qmp-ufs-phy" , - .data = &msm8996_ufs_cfg, - }, { - .compatible ="qcom,msm8998-qmp-ufs-phy" , - .data = &sdm845_ufsphy_cfg, - }, { - .compatible ="qcom,sc8180x-qmp-ufs-phy" , - .data = &sm8150_ufsphy_cfg, - }, { - .compatible ="qcom,sc8280xp-qmp-ufs-phy" , - .data = &sm8350_ufsphy_cfg, - }, { - .compatible ="qcom,sdm845-qmp-ufs-phy" , - .data = &sdm845_ufsphy_cfg, - }, { - .compatible ="qcom,sm6115-qmp-ufs-phy" , - .data = &sm6115_ufsphy_cfg, - }, { - .compatible ="qcom,sm6350-qmp-ufs-phy" , - .data = &sdm845_ufsphy_cfg, - }, { - .compatible ="qcom,sm8150-qmp-ufs-phy" , - .data = &sm8150_ufsphy_cfg, - }, { - .compatible ="qcom,sm8250-qmp-ufs-phy" , - .data = &sm8150_ufsphy_cfg, - }, { - .compatible ="qcom,sm8350-qmp-ufs-phy" , - .data = &sm8350_ufsphy_cfg, - }, { - .compatible ="qcom,sm8450-qmp-ufs-phy" , - .data = &sm8450_ufsphy_cfg, - }, - { }, -}; -MODULE_DEVICE_TABLE (of, qmp_ufs_of_match_table); -static int qmp_ufs_probe (struct platform_device *pdev) {struct qcom_qmp *qmp;
@@ -1185,6 +1146,45 @@ static int qmp_ufs_probe(struct platform_device *pdev)return ret; } +static const struct of_device_id qmp_ufs_of_match_table[] = { + { + .compatible ="qcom,msm8996-qmp-ufs-phy" , + .data = &msm8996_ufs_cfg, + }, { + .compatible ="qcom,msm8998-qmp-ufs-phy" , + .data = &sdm845_ufsphy_cfg, + }, { + .compatible ="qcom,sc8180x-qmp-ufs-phy" , + .data = &sm8150_ufsphy_cfg, + }, { + .compatible ="qcom,sc8280xp-qmp-ufs-phy" , + .data = &sm8350_ufsphy_cfg, + }, { + .compatible ="qcom,sdm845-qmp-ufs-phy" , + .data = &sdm845_ufsphy_cfg, + }, { + .compatible ="qcom,sm6115-qmp-ufs-phy" , + .data = &sm6115_ufsphy_cfg, + }, { + .compatible ="qcom,sm6350-qmp-ufs-phy" , + .data = &sdm845_ufsphy_cfg, + }, { + .compatible ="qcom,sm8150-qmp-ufs-phy" , + .data = &sm8150_ufsphy_cfg, + }, { + .compatible ="qcom,sm8250-qmp-ufs-phy" , + .data = &sm8150_ufsphy_cfg, + }, { + .compatible ="qcom,sm8350-qmp-ufs-phy" , + .data = &sm8350_ufsphy_cfg, + }, { + .compatible ="qcom,sm8450-qmp-ufs-phy" , + .data = &sm8450_ufsphy_cfg, + }, + { }, +}; +MODULE_DEVICE_TABLE (of, qmp_ufs_of_match_table); +static struct platform_driver qmp_ufs_driver = { .probe = qmp_ufs_probe, .driver = {
Signature · 7 lines
2.37.3 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 01/10] phy: qcom-qmp-ufs: move device-id table
Quoted 7 lines · Johan Hovold
Move the device-id table below
probe()and next to the driver structure to keep the driver callback functions grouped together.Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 78 ++++++++++++------------- 1 file changed, 39 insertions(+), 39 deletions(-)
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH 2/10 phy: qcom-qmp-ufs: merge driver data
In reply to Johan HovoldThe UFS 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-ufs.c | 171 +++++++++--------------- 1 file changed, 63 insertions(+), 108 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-ufs.c +63 -108
@@ -548,54 +548,24 @@ struct qmp_phy_cfg {bool no_pcs_sw_reset; }; -/** -* 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 -* @qmp: QMP phy to which this lane belongs -*/ -struct qmp_phy { -struct phy *phy; +struct qmp_ufs { +struct device *dev; +const struct qmp_phy_cfg *cfg; +void __iomem *serdes; +void __iomem *pcs; +void __iomem *pcs_misc;void __iomem *tx;void __iomem *rx; -void __iomem *pcs;void __iomem *tx2;void __iomem *rx2; -void __iomem *pcs_misc; -struct qcom_qmp *qmp; -}; - -/** -* struct qcom_qmp - structure holding QMP phy block attributes -* -* @dev: device -* -* @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 -* @ufs_reset: optional UFS PHY reset handle -*/ -struct qcom_qmp { -struct device *dev;struct clk_bulk_data *clks;struct regulator_bulk_data *vregs; - -struct qmp_phy **phys; -struct reset_control *ufs_reset; + +struct phy *phy; };static inline void qphy_setbits (void __iomem *base,u32 offset,u32 val)
@@ -782,10 +752,10 @@ static void qmp_ufs_configure(void __iomem *base,qmp_ufs_configure_lane (base, tbl, num,0xff ); } -static int qmp_ufs_serdes_init (struct qmp_phy *qphy) +static int qmp_ufs_serdes_init (struct qmp_ufs *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;
@@ -794,11 +764,10 @@ static int qmp_ufs_serdes_init(struct qmp_phy *qphy)return 0 ; } -static int qmp_ufs_com_init (struct qmp_phy *qphy) +static int qmp_ufs_com_init (struct qmp_ufs *qmp) { -struct qcom_qmp *qmp = qphy->qmp; -const struct qmp_phy_cfg *cfg = qphy->cfg; -void __iomem *pcs = qphy->pcs; +const struct qmp_phy_cfg *cfg = qmp->cfg; +void __iomem *pcs = qmp->pcs;int ret; ret =regulator_bulk_enable (cfg->num_vregs, qmp->vregs);
@@ -821,10 +790,9 @@ static int qmp_ufs_com_init(struct qmp_phy *qphy)return ret; } -static int qmp_ufs_com_exit (struct qmp_phy *qphy) +static int qmp_ufs_com_exit (struct qmp_ufs *qmp) { -struct qcom_qmp *qmp = qphy->qmp; -const struct qmp_phy_cfg *cfg = qphy->cfg; +const struct qmp_phy_cfg *cfg = qmp->cfg;reset_control_assert (qmp->ufs_reset);
@@ -837,9 +805,8 @@ static int qmp_ufs_com_exit(struct qmp_phy *qphy)static int qmp_ufs_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; +struct qmp_ufs *qmp =phy_get_drvdata (phy); +const struct qmp_phy_cfg *cfg = qmp->cfg;int ret;dev_vdbg (qmp->dev,"Initializing QMP phy\n" );
@@ -870,7 +837,7 @@ static int qmp_ufs_init(struct phy *phy)return ret; } - ret =qmp_ufs_com_init (qphy); + ret =qmp_ufs_com_init (qmp);if (ret)return ret;
@@ -879,28 +846,27 @@ static int qmp_ufs_init(struct phy *phy)static int qmp_ufs_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_ufs *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_ufs_serdes_init (qphy); +qmp_ufs_serdes_init (qmp);/* Tx, Rx, and PCS configurations */ qmp_ufs_configure_lane (tx, cfg->tx_tbl, cfg->tx_tbl_num,1 );if (cfg->lanes >=2 ) -qmp_ufs_configure_lane (qphy->tx2, cfg->tx_tbl, cfg->tx_tbl_num,2 ); +qmp_ufs_configure_lane (qmp->tx2, cfg->tx_tbl, cfg->tx_tbl_num,2 );qmp_ufs_configure_lane (rx, cfg->rx_tbl, cfg->rx_tbl_num,1 );if (cfg->lanes >=2 ) -qmp_ufs_configure_lane (qphy->rx2, cfg->rx_tbl, cfg->rx_tbl_num,2 ); +qmp_ufs_configure_lane (qmp->rx2, cfg->rx_tbl, cfg->rx_tbl_num,2 );qmp_ufs_configure (pcs, cfg->pcs_tbl, cfg->pcs_tbl_num);
@@ -928,18 +894,18 @@ static int qmp_ufs_power_on(struct phy *phy)static int qmp_ufs_power_off (struct phy *phy) { -struct qmp_phy *qphy =phy_get_drvdata (phy); -const struct qmp_phy_cfg *cfg = qphy->cfg; +struct qmp_ufs *qmp =phy_get_drvdata (phy); +const struct qmp_phy_cfg *cfg = qmp->cfg;/* PHY reset */ if (!cfg->no_pcs_sw_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 */ -qphy_clrbits (qphy->pcs, cfg->regs[QPHY_START_CTRL ],SERDES_START ); +qphy_clrbits (qmp->pcs, cfg->regs[QPHY_START_CTRL ],SERDES_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 ;
@@ -947,9 +913,9 @@ static int qmp_ufs_power_off(struct phy *phy)static int qmp_ufs_exit (struct phy *phy) { -struct qmp_phy *qphy =phy_get_drvdata (phy); +struct qmp_ufs *qmp =phy_get_drvdata (phy); -qmp_ufs_com_exit (qphy); +qmp_ufs_com_exit (qmp);return 0 ; }
@@ -981,7 +947,7 @@ static int qmp_ufs_disable(struct phy *phy)static int qmp_ufs_vreg_init (struct device *dev,const struct qmp_phy_cfg *cfg) { -struct qcom_qmp *qmp =dev_get_drvdata (dev); +struct qmp_ufs *qmp =dev_get_drvdata (dev);int num = cfg->num_vregs;int i;
@@ -997,7 +963,7 @@ static int qmp_ufs_vreg_init(struct device *dev, const struct qmp_phy_cfg *cfg)static int qmp_ufs_clk_init (struct device *dev,const struct qmp_phy_cfg *cfg) { -struct qcom_qmp *qmp =dev_get_drvdata (dev); +struct qmp_ufs *qmp =dev_get_drvdata (dev);int num = cfg->num_clks;int i;
@@ -1017,78 +983,71 @@ static const struct phy_ops qcom_qmp_ufs_ops = { .owner = THIS_MODULE, }; -static int qmp_ufs_create (struct device *dev,struct device_node *np,int id, +static int qmp_ufs_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_ufs *qmp =dev_get_drvdata (dev);struct phy *generic_phy; -struct qmp_phy *qphy;int ret; - 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 =devm_of_iomap (dev, np,2 ,NULL ); -if (IS_ERR (qphy->pcs)) -return PTR_ERR (qphy->pcs); + qmp->pcs =devm_of_iomap (dev, np,2 ,NULL ); +if (IS_ERR (qmp->pcs)) +return PTR_ERR (qmp->pcs);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" ); generic_phy =devm_phy_create (dev, np, &qcom_qmp_ufs_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_ufs_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_ufs *qmp;int num, id;int ret;
@@ -1120,14 +1079,10 @@ static int qmp_ufs_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 ; - id =0 ;for_each_available_child_of_node (dev->of_node, child) {/* Create per-lane phy */ - ret =qmp_ufs_create (dev, child, id, serdes, cfg); + ret =qmp_ufs_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
Re: [PATCH 02/10] phy: qcom-qmp-ufs: merge driver data
Quoted 8 lines · Johan Hovold
The UFS QMP PHY driver only manages a single PHY so merge the old
qcom_qmpandqmp_phystructures and drop the PHY array.Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 171 +++++++++--------------- 1 file changed, 63 insertions(+), 108 deletions(-)
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH 3/10 phy: qcom-qmp-ufs: 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-ufs.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-ufs.c +6 -15
@@ -1048,7 +1048,6 @@ static int qmp_ufs_probe(struct platform_device *pdev)void __iomem *serdes;const struct qmp_phy_cfg *cfg =NULL ;struct qmp_ufs *qmp; -int num, id;int ret; qmp =devm_kzalloc (dev,sizeof (*qmp),GFP_KERNEL );
@@ -1074,23 +1073,15 @@ static int qmp_ufs_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 ; - id =0 ; -for_each_available_child_of_node (dev->of_node, child) { -/* Create per-lane phy */ - ret =qmp_ufs_create (dev, child, serdes, cfg); -if (ret) { -dev_err (dev,"failed to create lane%d phy, %d\n" , - id, ret); - goto err_node_put; - } + ret =qmp_ufs_create (dev, child, serdes, cfg); +if (ret) + goto err_node_put; - id++; - } +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
Re: [PATCH 03/10] phy: qcom-qmp-ufs: clean up device-tree parsing
Quoted 10 lines · Johan Hovold
Since 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.
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH 4/10 phy: qcom-qmp-ufs: 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-ufs.c | 37 ++++++++++++------------- 1 file changed, 17 insertions(+), 20 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-ufs.c +17 -20
@@ -945,9 +945,10 @@ static int qmp_ufs_disable(struct phy *phy)return qmp_ufs_exit (phy); } -static int qmp_ufs_vreg_init (struct device *dev,const struct qmp_phy_cfg *cfg) +static int qmp_ufs_vreg_init (struct qmp_ufs *qmp) { -struct qmp_ufs *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;
@@ -961,9 +962,10 @@ static int qmp_ufs_vreg_init(struct device *dev, const struct qmp_phy_cfg *cfg)return devm_regulator_bulk_get (dev, num, qmp->vregs); } -static int qmp_ufs_clk_init (struct device *dev,const struct qmp_phy_cfg *cfg) +static int qmp_ufs_clk_init (struct qmp_ufs *qmp) { -struct qmp_ufs *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;
@@ -983,15 +985,13 @@ static const struct phy_ops qcom_qmp_ufs_ops = { .owner = THIS_MODULE, }; -static int qmp_ufs_create (struct device *dev,struct device_node *np, -void __iomem *serdes,const struct qmp_phy_cfg *cfg) +static int qmp_ufs_create (struct qmp_ufs *qmp,struct device_node *np) { -struct qmp_ufs *qmp =dev_get_drvdata (dev); +const struct qmp_phy_cfg *cfg = qmp->cfg; +struct device *dev = qmp->dev;struct phy *generic_phy;int ret; - qmp->cfg = cfg; - qmp->serdes = serdes;/* * Get memory resources for the PHY: * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2.
@@ -1045,8 +1045,6 @@ static int qmp_ufs_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_ufs *qmp;int ret;
@@ -1055,21 +1053,20 @@ static int qmp_ufs_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); - ret =qmp_ufs_clk_init (dev, cfg); + ret =qmp_ufs_clk_init (qmp);if (ret)return ret; - ret =qmp_ufs_vreg_init (dev, cfg); + ret =qmp_ufs_vreg_init (qmp);if (ret)return ret;
@@ -1077,7 +1074,7 @@ static int qmp_ufs_probe(struct platform_device *pdev)if (!child)return -EINVAL ; - ret =qmp_ufs_create (dev, child, serdes, cfg); + ret =qmp_ufs_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
Re: [PATCH 04/10] phy: qcom-qmp-ufs: clean up probe initialisation
Quoted 7 lines · Johan Hovold
Stop abusing the driver data pointer and instead pass the driver state structure directly to the initialisation helpers during probe.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 37 ++++++++++++------------- 1 file changed, 17 insertions(+), 20 deletions(-)
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH 5/10 phy: qcom-qmp-ufs: 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-ufs.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-ufs.c +7 -7
@@ -945,6 +945,12 @@ static int qmp_ufs_disable(struct phy *phy)return qmp_ufs_exit (phy); } +static const struct phy_ops qcom_qmp_ufs_phy_ops = { + .power_on = qmp_ufs_enable, + .power_off = qmp_ufs_disable, + .owner =THIS_MODULE , +}; +static int qmp_ufs_vreg_init (struct qmp_ufs *qmp) {const struct qmp_phy_cfg *cfg = qmp->cfg;
@@ -979,12 +985,6 @@ static int qmp_ufs_clk_init(struct qmp_ufs *qmp)return devm_clk_bulk_get (dev, num, qmp->clks); } -static const struct phy_ops qcom_qmp_ufs_ops = { - .power_on = qmp_ufs_enable, - .power_off = qmp_ufs_disable, - .owner =THIS_MODULE , -}; -static int qmp_ufs_create (struct qmp_ufs *qmp,struct device_node *np) {const struct qmp_phy_cfg *cfg = qmp->cfg;
@@ -1027,7 +1027,7 @@ static int qmp_ufs_create(struct qmp_ufs *qmp, struct device_node *np)if (IS_ERR (qmp->pcs_misc))dev_vdbg (dev,"PHY pcs_misc-reg not used\n" ); - generic_phy =devm_phy_create (dev, np, &qcom_qmp_ufs_ops); + generic_phy =devm_phy_create (dev, np, &qcom_qmp_ufs_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
Re: [PATCH 05/10] phy: qcom-qmp-ufs: rename PHY ops structure
Quoted 7 lines · Johan Hovold
Rename the PHY operation structure so that it has a "
phy_ops" suffix and move it next to the implementation.Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH 6/10 phy: qcom-qmp-ufs: clean up PHY init
In reply to Johan HovoldClean up the PHY initialisation somewhat programming both tx and rx for the second lane after the first lane.
--- drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-ufs.c +3 -5
@@ -859,14 +859,12 @@ static int qmp_ufs_power_on(struct phy *phy)/* Tx, Rx, and PCS configurations */ qmp_ufs_configure_lane (tx, cfg->tx_tbl, cfg->tx_tbl_num,1 ); - -if (cfg->lanes >=2 ) -qmp_ufs_configure_lane (qmp->tx2, cfg->tx_tbl, cfg->tx_tbl_num,2 ); -qmp_ufs_configure_lane (rx, cfg->rx_tbl, cfg->rx_tbl_num,1 ); -if (cfg->lanes >=2 ) +if (cfg->lanes >=2 ) { +qmp_ufs_configure_lane (qmp->tx2, cfg->tx_tbl, cfg->tx_tbl_num,2 );qmp_ufs_configure_lane (qmp->rx2, cfg->rx_tbl, cfg->rx_tbl_num,2 ); + }qmp_ufs_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
Re: [PATCH 06/10] phy: qcom-qmp-ufs: clean up PHY init
Quoted 7 lines · Johan Hovold
Clean up the PHY initialisation somewhat programming both tx and rx for the second lane after the first lane.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH 7/10 dt-bindings: phy: qcom,qmp-ufs: rename current bindings
In reply to Johan HovoldThe current QMP UFS 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 UFS 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.
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.
---
...qcom,qmp-ufs-phy.yaml => qcom,msm8996-qmp-ufs-phy.yaml} | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
rename Documentation/devicetree/bindings/phy/{qcom,qmp-ufs-phy.yaml => qcom,msm8996-qmp-ufs-phy.yaml} (95%)Documentation/devicetree/bindings/phy/qcom,msm8996-qmp-ufs-phy.yaml renamed from Documentation/devicetree/bindings/phy/qcom,qmp-ufs-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-ufs-phy.yaml# +$id: http://devicetree.org/schemas/phy/qcom,msm8996-qmp-ufs-phy.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# -title: Qualcomm QMP PHY controller (UFS) +title: Qualcomm QMP PHY controller (UFS, 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-ufs-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
Re: [PATCH 07/10] dt-bindings: phy: qcom,qmp-ufs: rename current bindings
Quoted 17 lines · Johan Hovold
The current QMP UFS 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 UFS 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.
Quoted 6 lines
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.
Signed-off-by Johan Hovold <[email protected]>---
Best regards,
Krzysztof
PATCH 8/10 dt-bindings: phy: qcom,qmp-ufs: fix sc8280xp binding
In reply to Johan HovoldThe current QMP UFS 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 UFS 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.
Add a new binding for the UFS QMP PHYs found on SC8280XP which further bindings can be based on.
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.
--- .../phy/qcom,msm8996-qmp-ufs-phy.yaml | 10 +-- .../phy/qcom,sc8280xp-qmp-ufs-phy.yaml | 83 +++++++++++++++++++ 2 files changed, 87 insertions(+), 6 deletions(-) create mode 100644 Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-ufs-phy.yaml
Documentation/devicetree/bindings/phy/qcom,msm8996-qmp-ufs-phy.yaml +4 -6
@@ -22,7 +22,6 @@ properties: - qcom,msm8996-qmp-ufs-phy - qcom,msm8998-qmp-ufs-phy - qcom,sc8180x-qmp-ufs-phy - - qcom,sc8280xp-qmp-ufs-phy - qcom,sdm845-qmp-ufs-phy - qcom,sm6115-qmp-ufs-phy - qcom,sm6350-qmp-ufs-phy
@@ -122,7 +121,6 @@ allOf: enum: - qcom,msm8998-qmp-ufs-phy - qcom,sc8180x-qmp-ufs-phy - - qcom,sc8280xp-qmp-ufs-phy - qcom,sdm845-qmp-ufs-phy - qcom,sm6115-qmp-ufs-phy - qcom,sm6350-qmp-ufs-phy
@@ -159,7 +157,6 @@ allOf: contains: enum: - qcom,msm8998-qmp-ufs-phy - - qcom,sc8280xp-qmp-ufs-phy - qcom,sdm845-qmp-ufs-phy - qcom,sm6350-qmp-ufs-phy - qcom,sm8150-qmp-ufs-phy
@@ -214,11 +211,12 @@ allOf: examples: - | - #include <dt-bindings/clock/qcom,gcc-sc8280xp.h> + #include <dt-bindings/clock/qcom,gcc-sm8250.h> #include <dt-bindings/clock/qcom,rpmh.h> + phy-wrapper@1d87000 { - compatible = "qcom,sc8280xp-qmp-ufs-phy"; - reg = <0x01d87000 0xe10>; + compatible = "qcom,sm8250-qmp-ufs-phy"; + reg = <0x01d87000 0x1c0>; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x01d87000 0x1000>;
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-ufs-phy.yaml new file +83 -0
83 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 08/10] dt-bindings: phy: qcom,qmp-ufs: fix sc8280xp binding
Quoted 17 lines · Johan Hovold
The current QMP UFS 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 UFS 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.
Quoted 8 lines
Add a new binding for the UFS QMP PHYs found on SC8280XP which further bindings can be based on.
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.
Signed-off-by Johan Hovold <[email protected]>
Best regards,
Krzysztof
PATCH 9/10 phy: qcom-qmp-ufs: 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 resource in what is now the legacy devicetree helper.
--- drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 34 ++++++++++++------------- 1 file changed, 16 insertions(+), 18 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-ufs.c +16 -18
@@ -983,12 +983,15 @@ static int qmp_ufs_clk_init(struct qmp_ufs *qmp)return devm_clk_bulk_get (dev, num, qmp->clks); } -static int qmp_ufs_create (struct qmp_ufs *qmp,struct device_node *np) +static int qmp_ufs_parse_dt_legacy (struct qmp_ufs *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; -int ret; + + qmp->serdes =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (qmp->serdes)) +return PTR_ERR (qmp->serdes);/* * Get memory resources for the PHY:
@@ -1025,16 +1028,6 @@ static int qmp_ufs_create(struct qmp_ufs *qmp, struct device_node *np)if (IS_ERR (qmp->pcs_misc))dev_vdbg (dev,"PHY pcs_misc-reg not used\n" ); - generic_phy =devm_phy_create (dev, np, &qcom_qmp_ufs_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 ; }
@@ -1056,10 +1049,6 @@ static int qmp_ufs_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); - ret =qmp_ufs_clk_init (qmp);if (ret)return ret;
@@ -1072,10 +1061,19 @@ static int qmp_ufs_probe(struct platform_device *pdev)if (!child)return -EINVAL ; - ret =qmp_ufs_create (qmp, child); + ret =qmp_ufs_parse_dt_legacy (qmp, child);if (ret) goto err_node_put; + qmp->phy =devm_phy_create (dev, child, &qcom_qmp_ufs_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
Re: [PATCH 09/10] phy: qcom-qmp-ufs: restructure PHY creation
Quoted 8 lines · Johan Hovold
In preparation for supporting devicetree bindings which do not use a child node, move the PHY creation to
probe()proper and parse the serdes resource in what is now the legacy devicetree helper.Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 34 ++++++++++++------------- 1 file changed, 16 insertions(+), 18 deletions(-)
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH 10/10 phy: qcom-qmp-ufs: 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.
Also note that the driver will continue to accept the old binding, at least for the time being.
--- drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 90 ++++++++++++++++++++++--- 1 file changed, 80 insertions(+), 10 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-ufs.c +80 -10
@@ -520,10 +520,21 @@ static const struct qmp_phy_init_tbl sm8350_ufsphy_pcs_tbl[] = { QMP_PHY_INIT_CFG(QPHY_V5_PCS_UFS_MULTI_LANE_CTRL1, 0x02), }; +struct qmp_ufs_offsets { +u16 serdes; +u16 pcs; +u16 tx; +u16 rx; +u16 tx2; +u16 rx2; +}; +/* struct qmp_phy_cfg - per-PHY initialization config */ struct qmp_phy_cfg {int lanes; +const struct qmp_ufs_offsets *offsets; +/* Init sequence for PHY blocks - serdes, tx, rx, pcs */ const struct qmp_phy_init_tbl *serdes_tbl;int serdes_tbl_num;
@@ -611,6 +622,15 @@ static const char * const qmp_phy_vreg_l[] = { "vdda-phy", "vdda-pll", }; +static const struct qmp_ufs_offsets qmp_ufs_offsets_v5 = { + .serdes =0 , + .pcs =0xc00 , + .tx =0x400 , + .rx =0x600 , + .tx2 =0x800 , + .rx2 =0xa00 , +}; +static const struct qmp_phy_cfg msm8996_ufs_cfg = { .lanes =1 ,
@@ -632,6 +652,26 @@ static const struct qmp_phy_cfg msm8996_ufs_cfg = { .no_pcs_sw_reset = true, }; +static const struct qmp_phy_cfg sc8280xp_ufsphy_cfg = { + .lanes =2 , + + .offsets = &qmp_ufs_offsets_v5, + + .serdes_tbl = sm8350_ufsphy_serdes_tbl, + .serdes_tbl_num =ARRAY_SIZE (sm8350_ufsphy_serdes_tbl), + .tx_tbl = sm8350_ufsphy_tx_tbl, + .tx_tbl_num =ARRAY_SIZE (sm8350_ufsphy_tx_tbl), + .rx_tbl = sm8350_ufsphy_rx_tbl, + .rx_tbl_num =ARRAY_SIZE (sm8350_ufsphy_rx_tbl), + .pcs_tbl = sm8350_ufsphy_pcs_tbl, + .pcs_tbl_num =ARRAY_SIZE (sm8350_ufsphy_pcs_tbl), + .clk_list = sdm845_ufs_phy_clk_l, + .num_clks =ARRAY_SIZE (sdm845_ufs_phy_clk_l), + .vreg_list = qmp_phy_vreg_l, + .num_vregs =ARRAY_SIZE (qmp_phy_vreg_l), + .regs = sm8150_ufsphy_regs_layout, +}; +static const struct qmp_phy_cfg sdm845_ufsphy_cfg = { .lanes =2 ,
@@ -1031,11 +1071,38 @@ static int qmp_ufs_parse_dt_legacy(struct qmp_ufs *qmp, struct device_node *np)return 0 ; } +static int qmp_ufs_parse_dt (struct qmp_ufs *qmp) +{ +struct platform_device *pdev =to_platform_device (qmp->dev); +const struct qmp_phy_cfg *cfg = qmp->cfg; +const struct qmp_ufs_offsets *offs = cfg->offsets; +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->tx = base + offs->tx; + qmp->rx = base + offs->rx; + +if (cfg->lanes >=2 ) { + qmp->tx2 = base + offs->tx2; + qmp->rx2 = base + offs->rx2; + } + +return 0 ; +} +static int qmp_ufs_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_ufs *qmp;int ret;
@@ -1057,15 +1124,18 @@ static int qmp_ufs_probe(struct platform_device *pdev)if (ret)return ret; - child =of_get_next_available_child (dev->of_node,NULL ); -if (!child) -return -EINVAL ; - - ret =qmp_ufs_parse_dt_legacy (qmp, child); +/* Check for legacy binding with child node. */ + np =of_get_next_available_child (dev->of_node,NULL ); +if (np) { + ret =qmp_ufs_parse_dt_legacy (qmp, np); + }else { + np =of_node_get (dev->of_node); + ret =qmp_ufs_parse_dt (qmp); + }if (ret) goto err_node_put; - qmp->phy =devm_phy_create (dev, child, &qcom_qmp_ufs_phy_ops); + qmp->phy =devm_phy_create (dev, np, &qcom_qmp_ufs_phy_ops);if (IS_ERR (qmp->phy)) { ret =PTR_ERR (qmp->phy);dev_err (dev,"failed to create PHY: %d\n" , ret);
@@ -1074,14 +1144,14 @@ static int qmp_ufs_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; }
@@ -1097,7 +1167,7 @@ static const struct of_device_id qmp_ufs_of_match_table[] = { .data = &sm8150_ufsphy_cfg, }, { .compatible = "qcom,sc8280xp-qmp-ufs-phy", - .data = &sm8350_ufsphy_cfg, + .data = &sc8280xp_ufsphy_cfg, }, { .compatible = "qcom,sdm845-qmp-ufs-phy", .data = &sdm845_ufsphy_cfg,
Signature · 7 lines
2.37.3 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 10/10] phy: qcom-qmp-ufs: add support for updated sc8280xp binding
Quoted 5 lines · Johan Hovold
Add 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.
Quoted 7 lines
Also note that the driver will continue to accept the old binding, at least for the time being.
Signed-off-by Johan Hovold <[email protected]>--- drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 90 ++++++++++++++++++++++--- 1 file changed, 80 insertions(+), 10 deletions(-)
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Quoted 7 lines · Johan Hovold
This series fixes the UFS 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.
Quoted 7 lines
The other QMP bindings suffer from similar problems and the PCIe driver is being fixed here:
https://lore.kernel.org/lkml/[email protected]/and follow-on series will do corresponding changes to the USB and combo QMP bindings and drivers.
Great! I'm looking forward to seeing the combo patchset. Then I can probably rebase my regs layout patches on top of your tree.
Quoted 34 lines
Note that these patches depend on the linux-phy next branch of today and the following two series:
1. [PATCH v2 00/14] phy: qcom-qmp: further prep cleanups
https://lore.kernel.org/lkml/[email protected]2. [PATCH 00/20] phy: qcom-qmp: further prep fixes and cleanups (set 3)
https://lore.kernel.org/lkml/[email protected]Johan
Johan Hovold (10):
phy: qcom-qmp-ufs: move device-id table
phy: qcom-qmp-ufs: merge driver data
phy: qcom-qmp-ufs: clean up device-tree parsing
phy: qcom-qmp-ufs: clean up probe initialisation
phy: qcom-qmp-ufs: rename PHY ops structure
phy: qcom-qmp-ufs: clean up PHY init
dt-bindings: phy: qcom,qmp-ufs: rename current bindings
dt-bindings: phy: qcom,qmp-ufs: fix sc8280xp binding
phy: qcom-qmp-ufs: restructure PHY creation
phy: qcom-qmp-ufs: add support for updated sc8280xp binding...phy.yaml => qcom,msm8996-qmp-ufs-phy.yaml} | 17 +- .../phy/qcom,sc8280xp-qmp-ufs-phy.yaml | 83 ++++ drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 381 +++++++++--------- 3 files changed, 287 insertions(+), 194 deletions(-)rename
Documentation/devicetree/bindings/phy/{qcom,qmp-ufs-phy.yaml=> qcom,msm8996-qmp-ufs-phy.yaml} (93%) create mode 100644Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-ufs-phy.yaml
Signature · 8 lines
With best wishes Dmitry -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Quoted 6 lines · Johan Hovold
This series fixes the UFS 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 · 6 lines
~Vinod -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy