Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

phy: qcom-qmp-usb: restructure PHY creation

In 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.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20221028160435.26948-13-johan+linaro@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Johan Hovold and committed by
Vinod Koul
183462e8 e8e58e29

+22 -24
+22 -24
drivers/phy/qualcomm/phy-qcom-qmp-usb.c
··· 2386 2386 return devm_of_iomap(dev, np, index, NULL); 2387 2387 } 2388 2388 2389 - static int qmp_usb_create(struct qmp_usb *qmp, struct device_node *np) 2389 + static int qmp_usb_parse_dt_legacy(struct qmp_usb *qmp, struct device_node *np) 2390 2390 { 2391 + struct platform_device *pdev = to_platform_device(qmp->dev); 2391 2392 const struct qmp_phy_cfg *cfg = qmp->cfg; 2392 2393 struct device *dev = qmp->dev; 2393 - struct phy *generic_phy; 2394 2394 bool exclusive = true; 2395 - int ret; 2395 + 2396 + qmp->serdes = devm_platform_ioremap_resource(pdev, 0); 2397 + if (IS_ERR(qmp->serdes)) 2398 + return PTR_ERR(qmp->serdes); 2399 + 2400 + if (cfg->has_phy_dp_com_ctrl) { 2401 + qmp->dp_com = devm_platform_ioremap_resource(pdev, 1); 2402 + if (IS_ERR(qmp->dp_com)) 2403 + return PTR_ERR(qmp->dp_com); 2404 + } 2396 2405 2397 2406 /* 2398 2407 * FIXME: These bindings should be fixed to not rely on overlapping ··· 2458 2449 "failed to get pipe clock\n"); 2459 2450 } 2460 2451 2461 - generic_phy = devm_phy_create(dev, np, &qmp_usb_phy_ops); 2462 - if (IS_ERR(generic_phy)) { 2463 - ret = PTR_ERR(generic_phy); 2464 - dev_err(dev, "failed to create PHY: %d\n", ret); 2465 - return ret; 2466 - } 2467 - 2468 - qmp->phy = generic_phy; 2469 - phy_set_drvdata(generic_phy, qmp); 2470 - 2471 2452 return 0; 2472 2453 } 2473 2454 ··· 2478 2479 qmp->cfg = of_device_get_match_data(dev); 2479 2480 if (!qmp->cfg) 2480 2481 return -EINVAL; 2481 - 2482 - qmp->serdes = devm_platform_ioremap_resource(pdev, 0); 2483 - if (IS_ERR(qmp->serdes)) 2484 - return PTR_ERR(qmp->serdes); 2485 - 2486 - if (qmp->cfg->has_phy_dp_com_ctrl) { 2487 - qmp->dp_com = devm_platform_ioremap_resource(pdev, 1); 2488 - if (IS_ERR(qmp->dp_com)) 2489 - return PTR_ERR(qmp->dp_com); 2490 - } 2491 2482 2492 2483 ret = qmp_usb_clk_init(qmp); 2493 2484 if (ret) ··· 2505 2516 */ 2506 2517 pm_runtime_forbid(dev); 2507 2518 2508 - ret = qmp_usb_create(qmp, child); 2519 + ret = qmp_usb_parse_dt_legacy(qmp, child); 2509 2520 if (ret) 2510 2521 goto err_node_put; 2511 2522 2512 2523 ret = phy_pipe_clk_register(qmp, child); 2513 2524 if (ret) 2514 2525 goto err_node_put; 2526 + 2527 + qmp->phy = devm_phy_create(dev, child, &qmp_usb_phy_ops); 2528 + if (IS_ERR(qmp->phy)) { 2529 + ret = PTR_ERR(qmp->phy); 2530 + dev_err(dev, "failed to create PHY: %d\n", ret); 2531 + goto err_node_put; 2532 + } 2533 + 2534 + phy_set_drvdata(qmp->phy, qmp); 2515 2535 2516 2536 of_node_put(child); 2517 2537