Lines Matching refs:ep

63 static int exynos_pcie_init_clk_resources(struct exynos_pcie *ep)
65 struct device *dev = ep->pci.dev;
68 ret = clk_prepare_enable(ep->clk);
74 ret = clk_prepare_enable(ep->bus_clk);
83 clk_disable_unprepare(ep->clk);
88 static void exynos_pcie_deinit_clk_resources(struct exynos_pcie *ep)
90 clk_disable_unprepare(ep->bus_clk);
91 clk_disable_unprepare(ep->clk);
104 static void exynos_pcie_sideband_dbi_w_mode(struct exynos_pcie *ep, bool on)
108 val = exynos_pcie_readl(ep->elbi_base, PCIE_ELBI_SLV_AWMISC);
113 exynos_pcie_writel(ep->elbi_base, val, PCIE_ELBI_SLV_AWMISC);
116 static void exynos_pcie_sideband_dbi_r_mode(struct exynos_pcie *ep, bool on)
120 val = exynos_pcie_readl(ep->elbi_base, PCIE_ELBI_SLV_ARMISC);
125 exynos_pcie_writel(ep->elbi_base, val, PCIE_ELBI_SLV_ARMISC);
128 static void exynos_pcie_assert_core_reset(struct exynos_pcie *ep)
132 val = exynos_pcie_readl(ep->elbi_base, PCIE_CORE_RESET);
134 exynos_pcie_writel(ep->elbi_base, val, PCIE_CORE_RESET);
135 exynos_pcie_writel(ep->elbi_base, 0, PCIE_STICKY_RESET);
136 exynos_pcie_writel(ep->elbi_base, 0, PCIE_NONSTICKY_RESET);
139 static void exynos_pcie_deassert_core_reset(struct exynos_pcie *ep)
143 val = exynos_pcie_readl(ep->elbi_base, PCIE_CORE_RESET);
146 exynos_pcie_writel(ep->elbi_base, val, PCIE_CORE_RESET);
147 exynos_pcie_writel(ep->elbi_base, 1, PCIE_STICKY_RESET);
148 exynos_pcie_writel(ep->elbi_base, 1, PCIE_NONSTICKY_RESET);
149 exynos_pcie_writel(ep->elbi_base, 1, PCIE_APP_INIT_RESET);
150 exynos_pcie_writel(ep->elbi_base, 0, PCIE_APP_INIT_RESET);
155 struct exynos_pcie *ep = to_exynos_pcie(pci);
158 val = exynos_pcie_readl(ep->elbi_base, PCIE_SW_WAKE);
160 exynos_pcie_writel(ep->elbi_base, val, PCIE_SW_WAKE);
163 exynos_pcie_writel(ep->elbi_base, PCIE_ELBI_LTSSM_ENABLE,
168 static void exynos_pcie_clear_irq_pulse(struct exynos_pcie *ep)
170 u32 val = exynos_pcie_readl(ep->elbi_base, PCIE_IRQ_PULSE);
172 exynos_pcie_writel(ep->elbi_base, val, PCIE_IRQ_PULSE);
177 struct exynos_pcie *ep = arg;
179 exynos_pcie_clear_irq_pulse(ep);
183 static void exynos_pcie_enable_irq_pulse(struct exynos_pcie *ep)
188 exynos_pcie_writel(ep->elbi_base, val, PCIE_IRQ_EN_PULSE);
189 exynos_pcie_writel(ep->elbi_base, 0, PCIE_IRQ_EN_LEVEL);
190 exynos_pcie_writel(ep->elbi_base, 0, PCIE_IRQ_EN_SPECIAL);
196 struct exynos_pcie *ep = to_exynos_pcie(pci);
199 exynos_pcie_sideband_dbi_r_mode(ep, true);
201 exynos_pcie_sideband_dbi_r_mode(ep, false);
208 struct exynos_pcie *ep = to_exynos_pcie(pci);
210 exynos_pcie_sideband_dbi_w_mode(ep, true);
212 exynos_pcie_sideband_dbi_w_mode(ep, false);
246 struct exynos_pcie *ep = to_exynos_pcie(pci);
247 u32 val = exynos_pcie_readl(ep->elbi_base, PCIE_ELBI_RDLH_LINKUP);
255 struct exynos_pcie *ep = to_exynos_pcie(pci);
259 exynos_pcie_assert_core_reset(ep);
261 phy_init(ep->phy);
262 phy_power_on(ep->phy);
264 exynos_pcie_deassert_core_reset(ep);
265 exynos_pcie_enable_irq_pulse(ep);
274 static int exynos_add_pcie_port(struct exynos_pcie *ep,
277 struct dw_pcie *pci = &ep->pci;
287 IRQF_SHARED, "exynos-pcie", ep);
315 struct exynos_pcie *ep;
319 ep = devm_kzalloc(dev, sizeof(*ep), GFP_KERNEL);
320 if (!ep)
323 ep->pci.dev = dev;
324 ep->pci.ops = &dw_pcie_ops;
326 ep->phy = devm_of_phy_get(dev, np, NULL);
327 if (IS_ERR(ep->phy))
328 return PTR_ERR(ep->phy);
331 ep->elbi_base = devm_platform_ioremap_resource_byname(pdev, "elbi");
332 if (IS_ERR(ep->elbi_base))
333 return PTR_ERR(ep->elbi_base);
335 ep->clk = devm_clk_get(dev, "pcie");
336 if (IS_ERR(ep->clk)) {
338 return PTR_ERR(ep->clk);
341 ep->bus_clk = devm_clk_get(dev, "pcie_bus");
342 if (IS_ERR(ep->bus_clk)) {
344 return PTR_ERR(ep->bus_clk);
347 ep->supplies[0].supply = "vdd18";
348 ep->supplies[1].supply = "vdd10";
349 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ep->supplies),
350 ep->supplies);
354 ret = exynos_pcie_init_clk_resources(ep);
358 ret = regulator_bulk_enable(ARRAY_SIZE(ep->supplies), ep->supplies);
362 platform_set_drvdata(pdev, ep);
364 ret = exynos_add_pcie_port(ep, pdev);
371 phy_exit(ep->phy);
372 exynos_pcie_deinit_clk_resources(ep);
373 regulator_bulk_disable(ARRAY_SIZE(ep->supplies), ep->supplies);
380 struct exynos_pcie *ep = platform_get_drvdata(pdev);
382 dw_pcie_host_deinit(&ep->pci.pp);
383 exynos_pcie_assert_core_reset(ep);
384 phy_power_off(ep->phy);
385 phy_exit(ep->phy);
386 exynos_pcie_deinit_clk_resources(ep);
387 regulator_bulk_disable(ARRAY_SIZE(ep->supplies), ep->supplies);
392 struct exynos_pcie *ep = dev_get_drvdata(dev);
394 exynos_pcie_assert_core_reset(ep);
395 phy_power_off(ep->phy);
396 phy_exit(ep->phy);
397 regulator_bulk_disable(ARRAY_SIZE(ep->supplies), ep->supplies);
404 struct exynos_pcie *ep = dev_get_drvdata(dev);
405 struct dw_pcie *pci = &ep->pci;
409 ret = regulator_bulk_enable(ARRAY_SIZE(ep->supplies), ep->supplies);
413 /* exynos_pcie_host_init controls ep->phy */