Lines Matching full:pcie

3  * PCIe host controller driver for Marvell Armada-8K SoCs
5 * Armada-8K PCIe Glue Layer Source Code
26 #include "pcie-designware.h"
74 static void armada8k_pcie_disable_phys(struct armada8k_pcie *pcie) in armada8k_pcie_disable_phys() argument
79 phy_power_off(pcie->phy[i]); in armada8k_pcie_disable_phys()
80 phy_exit(pcie->phy[i]); in armada8k_pcie_disable_phys()
84 static int armada8k_pcie_enable_phys(struct armada8k_pcie *pcie) in armada8k_pcie_enable_phys() argument
90 ret = phy_init(pcie->phy[i]); in armada8k_pcie_enable_phys()
94 ret = phy_set_mode_ext(pcie->phy[i], PHY_MODE_PCIE, in armada8k_pcie_enable_phys()
95 pcie->phy_count); in armada8k_pcie_enable_phys()
97 phy_exit(pcie->phy[i]); in armada8k_pcie_enable_phys()
101 ret = phy_power_on(pcie->phy[i]); in armada8k_pcie_enable_phys()
103 phy_exit(pcie->phy[i]); in armada8k_pcie_enable_phys()
111 static int armada8k_pcie_setup_phys(struct armada8k_pcie *pcie) in armada8k_pcie_setup_phys() argument
113 struct dw_pcie *pci = pcie->pci; in armada8k_pcie_setup_phys()
120 pcie->phy[i] = devm_of_phy_get_by_index(dev, node, i); in armada8k_pcie_setup_phys()
121 if (IS_ERR(pcie->phy[i])) { in armada8k_pcie_setup_phys()
122 if (PTR_ERR(pcie->phy[i]) != -ENODEV) in armada8k_pcie_setup_phys()
123 return PTR_ERR(pcie->phy[i]); in armada8k_pcie_setup_phys()
125 pcie->phy[i] = NULL; in armada8k_pcie_setup_phys()
129 pcie->phy_count++; in armada8k_pcie_setup_phys()
133 if (!pcie->phy_count) in armada8k_pcie_setup_phys()
136 ret = armada8k_pcie_enable_phys(pcie); in armada8k_pcie_setup_phys()
157 static void armada8k_pcie_establish_link(struct armada8k_pcie *pcie) in armada8k_pcie_establish_link() argument
159 struct dw_pcie *pci = pcie->pci; in armada8k_pcie_establish_link()
175 /* Set the PCIe master AxCache attributes */ in armada8k_pcie_establish_link()
179 /* Set the PCIe master AxDomain attributes */ in armada8k_pcie_establish_link()
211 struct armada8k_pcie *pcie = to_armada8k_pcie(pci); in armada8k_pcie_host_init() local
214 armada8k_pcie_establish_link(pcie); in armada8k_pcie_host_init()
221 struct armada8k_pcie *pcie = arg; in armada8k_pcie_irq_handler() local
222 struct dw_pcie *pci = pcie->pci; in armada8k_pcie_irq_handler()
227 * PCI device. However, they are also latched into the PCIe in armada8k_pcie_irq_handler()
240 static int armada8k_add_pcie_port(struct armada8k_pcie *pcie, in armada8k_add_pcie_port() argument
243 struct dw_pcie *pci = pcie->pci; in armada8k_add_pcie_port()
255 IRQF_SHARED, "armada8k-pcie", pcie); in armada8k_add_pcie_port()
277 struct armada8k_pcie *pcie; in armada8k_pcie_probe() local
282 pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); in armada8k_pcie_probe()
283 if (!pcie) in armada8k_pcie_probe()
293 pcie->pci = pci; in armada8k_pcie_probe()
295 pcie->clk = devm_clk_get(dev, NULL); in armada8k_pcie_probe()
296 if (IS_ERR(pcie->clk)) in armada8k_pcie_probe()
297 return PTR_ERR(pcie->clk); in armada8k_pcie_probe()
299 ret = clk_prepare_enable(pcie->clk); in armada8k_pcie_probe()
303 pcie->clk_reg = devm_clk_get(dev, "reg"); in armada8k_pcie_probe()
304 if (pcie->clk_reg == ERR_PTR(-EPROBE_DEFER)) { in armada8k_pcie_probe()
308 if (!IS_ERR(pcie->clk_reg)) { in armada8k_pcie_probe()
309 ret = clk_prepare_enable(pcie->clk_reg); in armada8k_pcie_probe()
314 /* Get the dw-pcie unit configuration/control registers base. */ in armada8k_pcie_probe()
322 ret = armada8k_pcie_setup_phys(pcie); in armada8k_pcie_probe()
326 platform_set_drvdata(pdev, pcie); in armada8k_pcie_probe()
328 ret = armada8k_add_pcie_port(pcie, pdev); in armada8k_pcie_probe()
335 armada8k_pcie_disable_phys(pcie); in armada8k_pcie_probe()
337 clk_disable_unprepare(pcie->clk_reg); in armada8k_pcie_probe()
339 clk_disable_unprepare(pcie->clk); in armada8k_pcie_probe()
345 { .compatible = "marvell,armada8k-pcie", },
352 .name = "armada8k-pcie",