diff options
author | Kishon Vijay Abraham I <kishon@ti.com> | 2015-12-21 03:54:08 -0500 |
---|---|---|
committer | Kishon Vijay Abraham I <kishon@ti.com> | 2015-12-21 03:56:27 -0500 |
commit | 1fe521225a830e159449cba9f7b365ba207e22c9 (patch) | |
tree | 41a8970b80ba3537300f7bffa16ce96892a04488 /drivers/phy | |
parent | 73bbc78e57c96aba9c7d6473ee4ea8374ae257ee (diff) |
phy: ti-pipe3: move mem resource initialization to a separate function
No functional change. Moved mem resource initialization done in
probe to a separate function as part of cleaning up
ti_pipe3_probe.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Diffstat (limited to 'drivers/phy')
-rw-r--r-- | drivers/phy/phy-ti-pipe3.c | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c index 3154da08ff37..1991efdd7d2a 100644 --- a/drivers/phy/phy-ti-pipe3.c +++ b/drivers/phy/phy-ti-pipe3.c | |||
@@ -418,14 +418,42 @@ static int ti_pipe3_get_sysctrl(struct ti_pipe3 *phy) | |||
418 | return 0; | 418 | return 0; |
419 | } | 419 | } |
420 | 420 | ||
421 | static int ti_pipe3_get_pll_base(struct ti_pipe3 *phy) | ||
422 | { | ||
423 | struct resource *res; | ||
424 | const struct of_device_id *match; | ||
425 | struct device *dev = phy->dev; | ||
426 | struct device_node *node = dev->of_node; | ||
427 | struct platform_device *pdev = to_platform_device(dev); | ||
428 | |||
429 | if (of_device_is_compatible(node, "ti,phy-pipe3-pcie")) | ||
430 | return 0; | ||
431 | |||
432 | match = of_match_device(ti_pipe3_id_table, dev); | ||
433 | if (!match) | ||
434 | return -EINVAL; | ||
435 | |||
436 | phy->dpll_map = (struct pipe3_dpll_map *)match->data; | ||
437 | if (!phy->dpll_map) { | ||
438 | dev_err(dev, "no DPLL data\n"); | ||
439 | return -EINVAL; | ||
440 | } | ||
441 | |||
442 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, | ||
443 | "pll_ctrl"); | ||
444 | phy->pll_ctrl_base = devm_ioremap_resource(dev, res); | ||
445 | if (IS_ERR(phy->pll_ctrl_base)) | ||
446 | return PTR_ERR(phy->pll_ctrl_base); | ||
447 | |||
448 | return 0; | ||
449 | } | ||
450 | |||
421 | static int ti_pipe3_probe(struct platform_device *pdev) | 451 | static int ti_pipe3_probe(struct platform_device *pdev) |
422 | { | 452 | { |
423 | struct ti_pipe3 *phy; | 453 | struct ti_pipe3 *phy; |
424 | struct phy *generic_phy; | 454 | struct phy *generic_phy; |
425 | struct phy_provider *phy_provider; | 455 | struct phy_provider *phy_provider; |
426 | struct resource *res; | ||
427 | struct device_node *node = pdev->dev.of_node; | 456 | struct device_node *node = pdev->dev.of_node; |
428 | const struct of_device_id *match; | ||
429 | struct device *dev = &pdev->dev; | 457 | struct device *dev = &pdev->dev; |
430 | int ret; | 458 | int ret; |
431 | 459 | ||
@@ -435,23 +463,9 @@ static int ti_pipe3_probe(struct platform_device *pdev) | |||
435 | 463 | ||
436 | phy->dev = dev; | 464 | phy->dev = dev; |
437 | 465 | ||
438 | if (!of_device_is_compatible(node, "ti,phy-pipe3-pcie")) { | 466 | ret = ti_pipe3_get_pll_base(phy); |
439 | match = of_match_device(ti_pipe3_id_table, dev); | 467 | if (ret) |
440 | if (!match) | 468 | return ret; |
441 | return -EINVAL; | ||
442 | |||
443 | phy->dpll_map = (struct pipe3_dpll_map *)match->data; | ||
444 | if (!phy->dpll_map) { | ||
445 | dev_err(dev, "no DPLL data\n"); | ||
446 | return -EINVAL; | ||
447 | } | ||
448 | |||
449 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, | ||
450 | "pll_ctrl"); | ||
451 | phy->pll_ctrl_base = devm_ioremap_resource(dev, res); | ||
452 | if (IS_ERR(phy->pll_ctrl_base)) | ||
453 | return PTR_ERR(phy->pll_ctrl_base); | ||
454 | } | ||
455 | 469 | ||
456 | ret = ti_pipe3_get_sysctrl(phy); | 470 | ret = ti_pipe3_get_sysctrl(phy); |
457 | if (ret) | 471 | if (ret) |