summaryrefslogtreecommitdiffstats
path: root/drivers/phy
diff options
context:
space:
mode:
authorKishon Vijay Abraham I <kishon@ti.com>2015-12-21 14:24:08 +0530
committerKishon Vijay Abraham I <kishon@ti.com>2015-12-21 14:26:27 +0530
commit1fe521225a830e159449cba9f7b365ba207e22c9 (patch)
tree41a8970b80ba3537300f7bffa16ce96892a04488 /drivers/phy
parent73bbc78e57c96aba9c7d6473ee4ea8374ae257ee (diff)
downloadop-kernel-dev-1fe521225a830e159449cba9f7b365ba207e22c9.zip
op-kernel-dev-1fe521225a830e159449cba9f7b365ba207e22c9.tar.gz
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.c52
1 files changed, 33 insertions, 19 deletions
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
index 3154da0..1991efd 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)
return 0;
}
+static int ti_pipe3_get_pll_base(struct ti_pipe3 *phy)
+{
+ struct resource *res;
+ const struct of_device_id *match;
+ struct device *dev = phy->dev;
+ struct device_node *node = dev->of_node;
+ struct platform_device *pdev = to_platform_device(dev);
+
+ if (of_device_is_compatible(node, "ti,phy-pipe3-pcie"))
+ return 0;
+
+ match = of_match_device(ti_pipe3_id_table, dev);
+ if (!match)
+ return -EINVAL;
+
+ phy->dpll_map = (struct pipe3_dpll_map *)match->data;
+ if (!phy->dpll_map) {
+ dev_err(dev, "no DPLL data\n");
+ return -EINVAL;
+ }
+
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+ "pll_ctrl");
+ phy->pll_ctrl_base = devm_ioremap_resource(dev, res);
+ if (IS_ERR(phy->pll_ctrl_base))
+ return PTR_ERR(phy->pll_ctrl_base);
+
+ return 0;
+}
+
static int ti_pipe3_probe(struct platform_device *pdev)
{
struct ti_pipe3 *phy;
struct phy *generic_phy;
struct phy_provider *phy_provider;
- struct resource *res;
struct device_node *node = pdev->dev.of_node;
- const struct of_device_id *match;
struct device *dev = &pdev->dev;
int ret;
@@ -435,23 +463,9 @@ static int ti_pipe3_probe(struct platform_device *pdev)
phy->dev = dev;
- if (!of_device_is_compatible(node, "ti,phy-pipe3-pcie")) {
- match = of_match_device(ti_pipe3_id_table, dev);
- if (!match)
- return -EINVAL;
-
- phy->dpll_map = (struct pipe3_dpll_map *)match->data;
- if (!phy->dpll_map) {
- dev_err(dev, "no DPLL data\n");
- return -EINVAL;
- }
-
- res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
- "pll_ctrl");
- phy->pll_ctrl_base = devm_ioremap_resource(dev, res);
- if (IS_ERR(phy->pll_ctrl_base))
- return PTR_ERR(phy->pll_ctrl_base);
- }
+ ret = ti_pipe3_get_pll_base(phy);
+ if (ret)
+ return ret;
ret = ti_pipe3_get_sysctrl(phy);
if (ret)
OpenPOWER on IntegriCloud