return devm_add_action_or_reset(qmp->dev, phy_clk_release_provider, np);
}
-static int qmp_combo_create_dp(struct qmp_combo *qmp, struct device_node *np)
+static int qmp_combo_parse_dt_lecacy_dp(struct qmp_combo *qmp, struct device_node *np)
{
struct device *dev = qmp->dev;
- struct phy *generic_phy;
- int ret;
/*
* Get memory resources from the DP child node:
if (IS_ERR(qmp->dp_tx2))
return PTR_ERR(qmp->dp_tx2);
- generic_phy = devm_phy_create(dev, np, &qmp_combo_dp_phy_ops);
- if (IS_ERR(generic_phy)) {
- ret = PTR_ERR(generic_phy);
- dev_err(dev, "failed to create DP PHY: %d\n", ret);
- return ret;
- }
-
- qmp->dp_phy = generic_phy;
- phy_set_drvdata(generic_phy, qmp);
-
return 0;
}
-static int qmp_combo_create_usb(struct qmp_combo *qmp, struct device_node *np)
+static int qmp_combo_parse_dt_lecacy_usb(struct qmp_combo *qmp, struct device_node *np)
{
const struct qmp_phy_cfg *cfg = qmp->cfg;
struct device *dev = qmp->dev;
- struct phy *generic_phy;
- int ret;
/*
* Get memory resources from the USB child node:
"failed to get pipe clock\n");
}
- generic_phy = devm_phy_create(dev, np, &qmp_combo_usb_phy_ops);
- if (IS_ERR(generic_phy)) {
- ret = PTR_ERR(generic_phy);
- dev_err(dev, "failed to create USB PHY: %d\n", ret);
+ return 0;
+}
+
+static int qmp_combo_parse_dt_legacy(struct qmp_combo *qmp, struct device_node *usb_np,
+ struct device_node *dp_np)
+{
+ struct platform_device *pdev = to_platform_device(qmp->dev);
+ int ret;
+
+ qmp->serdes = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(qmp->serdes))
+ return PTR_ERR(qmp->serdes);
+
+ qmp->dp_com = devm_platform_ioremap_resource(pdev, 1);
+ if (IS_ERR(qmp->dp_com))
+ return PTR_ERR(qmp->dp_com);
+
+ qmp->dp_serdes = devm_platform_ioremap_resource(pdev, 2);
+ if (IS_ERR(qmp->dp_serdes))
+ return PTR_ERR(qmp->dp_serdes);
+
+ ret = qmp_combo_parse_dt_lecacy_usb(qmp, usb_np);
+ if (ret)
return ret;
- }
- qmp->usb_phy = generic_phy;
- phy_set_drvdata(generic_phy, qmp);
+ ret = qmp_combo_parse_dt_lecacy_dp(qmp, dp_np);
+ if (ret)
+ return ret;
return 0;
}
if (!qmp->cfg)
return -EINVAL;
- qmp->serdes = devm_platform_ioremap_resource(pdev, 0);
- if (IS_ERR(qmp->serdes))
- return PTR_ERR(qmp->serdes);
-
- qmp->dp_com = devm_platform_ioremap_resource(pdev, 1);
- if (IS_ERR(qmp->dp_com))
- return PTR_ERR(qmp->dp_com);
-
- qmp->dp_serdes = devm_platform_ioremap_resource(pdev, 2);
- if (IS_ERR(qmp->dp_serdes))
- return PTR_ERR(qmp->dp_serdes);
-
mutex_init(&qmp->phy_mutex);
ret = qmp_combo_clk_init(qmp);
return -EINVAL;
}
+ ret = qmp_combo_parse_dt_legacy(qmp, usb_np, dp_np);
+ if (ret)
+ goto err_node_put;
+
pm_runtime_set_active(dev);
ret = devm_pm_runtime_enable(dev);
if (ret)
*/
pm_runtime_forbid(dev);
- ret = qmp_combo_create_usb(qmp, usb_np);
+ ret = phy_pipe_clk_register(qmp, usb_np);
if (ret)
goto err_node_put;
- ret = phy_pipe_clk_register(qmp, usb_np);
+ ret = phy_dp_clks_register(qmp, dp_np);
if (ret)
goto err_node_put;
- ret = qmp_combo_create_dp(qmp, dp_np);
- if (ret)
+ qmp->usb_phy = devm_phy_create(dev, usb_np, &qmp_combo_usb_phy_ops);
+ if (IS_ERR(qmp->usb_phy)) {
+ ret = PTR_ERR(qmp->usb_phy);
+ dev_err(dev, "failed to create USB PHY: %d\n", ret);
goto err_node_put;
+ }
- ret = phy_dp_clks_register(qmp, dp_np);
- if (ret)
+ phy_set_drvdata(qmp->usb_phy, qmp);
+
+ qmp->dp_phy = devm_phy_create(dev, dp_np, &qmp_combo_dp_phy_ops);
+ if (IS_ERR(qmp->dp_phy)) {
+ ret = PTR_ERR(qmp->dp_phy);
+ dev_err(dev, "failed to create DP PHY: %d\n", ret);
goto err_node_put;
+ }
+
+ phy_set_drvdata(qmp->dp_phy, qmp);
phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);