Skip to content

Commit 6b11143

Browse files
shradhatbjorn-helgaas
authored andcommitted
PCI: exynos: Adapt to use bulk clock APIs
There is no need to hardcode the clock info in the driver as driver can rely on the devicetree to supply the clocks required for the functioning of the peripheral. Thus, remove the static clock info and obtain the platform supplied clocks. All the clocks supplied are obtained and enabled using the devm_clk_bulk_get_all_enable() API. [kwilczynski: commit log] Link: https://lore.kernel.org/linux-pci/[email protected] Signed-off-by: Shradha Todi <[email protected]> Signed-off-by: Krzysztof Wilczyński <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Alim Akhtar <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]>
1 parent 1613e60 commit 6b11143

File tree

1 file changed

+4
-50
lines changed

1 file changed

+4
-50
lines changed

drivers/pci/controller/dwc/pci-exynos.c

Lines changed: 4 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -54,43 +54,11 @@
5454
struct exynos_pcie {
5555
struct dw_pcie pci;
5656
void __iomem *elbi_base;
57-
struct clk *clk;
58-
struct clk *bus_clk;
57+
struct clk_bulk_data *clks;
5958
struct phy *phy;
6059
struct regulator_bulk_data supplies[2];
6160
};
6261

63-
static int exynos_pcie_init_clk_resources(struct exynos_pcie *ep)
64-
{
65-
struct device *dev = ep->pci.dev;
66-
int ret;
67-
68-
ret = clk_prepare_enable(ep->clk);
69-
if (ret) {
70-
dev_err(dev, "cannot enable pcie rc clock");
71-
return ret;
72-
}
73-
74-
ret = clk_prepare_enable(ep->bus_clk);
75-
if (ret) {
76-
dev_err(dev, "cannot enable pcie bus clock");
77-
goto err_bus_clk;
78-
}
79-
80-
return 0;
81-
82-
err_bus_clk:
83-
clk_disable_unprepare(ep->clk);
84-
85-
return ret;
86-
}
87-
88-
static void exynos_pcie_deinit_clk_resources(struct exynos_pcie *ep)
89-
{
90-
clk_disable_unprepare(ep->bus_clk);
91-
clk_disable_unprepare(ep->clk);
92-
}
93-
9462
static void exynos_pcie_writel(void __iomem *base, u32 val, u32 reg)
9563
{
9664
writel(val, base + reg);
@@ -332,17 +300,9 @@ static int exynos_pcie_probe(struct platform_device *pdev)
332300
if (IS_ERR(ep->elbi_base))
333301
return PTR_ERR(ep->elbi_base);
334302

335-
ep->clk = devm_clk_get(dev, "pcie");
336-
if (IS_ERR(ep->clk)) {
337-
dev_err(dev, "Failed to get pcie rc clock\n");
338-
return PTR_ERR(ep->clk);
339-
}
340-
341-
ep->bus_clk = devm_clk_get(dev, "pcie_bus");
342-
if (IS_ERR(ep->bus_clk)) {
343-
dev_err(dev, "Failed to get pcie bus clock\n");
344-
return PTR_ERR(ep->bus_clk);
345-
}
303+
ret = devm_clk_bulk_get_all_enable(dev, &ep->clks);
304+
if (ret < 0)
305+
return ret;
346306

347307
ep->supplies[0].supply = "vdd18";
348308
ep->supplies[1].supply = "vdd10";
@@ -351,10 +311,6 @@ static int exynos_pcie_probe(struct platform_device *pdev)
351311
if (ret)
352312
return ret;
353313

354-
ret = exynos_pcie_init_clk_resources(ep);
355-
if (ret)
356-
return ret;
357-
358314
ret = regulator_bulk_enable(ARRAY_SIZE(ep->supplies), ep->supplies);
359315
if (ret)
360316
return ret;
@@ -369,7 +325,6 @@ static int exynos_pcie_probe(struct platform_device *pdev)
369325

370326
fail_probe:
371327
phy_exit(ep->phy);
372-
exynos_pcie_deinit_clk_resources(ep);
373328
regulator_bulk_disable(ARRAY_SIZE(ep->supplies), ep->supplies);
374329

375330
return ret;
@@ -383,7 +338,6 @@ static void exynos_pcie_remove(struct platform_device *pdev)
383338
exynos_pcie_assert_core_reset(ep);
384339
phy_power_off(ep->phy);
385340
phy_exit(ep->phy);
386-
exynos_pcie_deinit_clk_resources(ep);
387341
regulator_bulk_disable(ARRAY_SIZE(ep->supplies), ep->supplies);
388342
}
389343

0 commit comments

Comments
 (0)