Lines Matching +full:phy +full:- +full:cadence

1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2017 Cadence
3 // Cadence PCIe controller driver.
4 // Author: Cyrille Pitchen <cyrille.pitchen@free-electrons.com>
9 #include "pcie-cadence.h"
35 u64 sz = 1ULL << fls64(size - 1); in cdns_pcie_set_outbound_region()
76 if (pcie->is_rc) { in cdns_pcie_set_outbound_region()
93 if (pcie->ops->cpu_addr_fixup) in cdns_pcie_set_outbound_region()
94 cpu_addr = pcie->ops->cpu_addr_fixup(pcie, cpu_addr); in cdns_pcie_set_outbound_region()
114 if (pcie->is_rc) { in cdns_pcie_set_outbound_region_for_normal_msg()
123 if (pcie->ops->cpu_addr_fixup) in cdns_pcie_set_outbound_region_for_normal_msg()
124 cpu_addr = pcie->ops->cpu_addr_fixup(pcie, cpu_addr); in cdns_pcie_set_outbound_region_for_normal_msg()
152 int i = pcie->phy_count; in cdns_pcie_disable_phy()
154 while (i--) { in cdns_pcie_disable_phy()
155 phy_power_off(pcie->phy[i]); in cdns_pcie_disable_phy()
156 phy_exit(pcie->phy[i]); in cdns_pcie_disable_phy()
165 for (i = 0; i < pcie->phy_count; i++) { in cdns_pcie_enable_phy()
166 ret = phy_init(pcie->phy[i]); in cdns_pcie_enable_phy()
170 ret = phy_power_on(pcie->phy[i]); in cdns_pcie_enable_phy()
172 phy_exit(pcie->phy[i]); in cdns_pcie_enable_phy()
180 while (--i >= 0) { in cdns_pcie_enable_phy()
181 phy_power_off(pcie->phy[i]); in cdns_pcie_enable_phy()
182 phy_exit(pcie->phy[i]); in cdns_pcie_enable_phy()
190 struct device_node *np = dev->of_node; in cdns_pcie_init_phy()
192 struct phy **phy; in cdns_pcie_init_phy() local
198 phy_count = of_property_count_strings(np, "phy-names"); in cdns_pcie_init_phy()
200 dev_err(dev, "no phy-names. PHY will not be initialized\n"); in cdns_pcie_init_phy()
201 pcie->phy_count = 0; in cdns_pcie_init_phy()
205 phy = devm_kcalloc(dev, phy_count, sizeof(*phy), GFP_KERNEL); in cdns_pcie_init_phy()
206 if (!phy) in cdns_pcie_init_phy()
207 return -ENOMEM; in cdns_pcie_init_phy()
211 return -ENOMEM; in cdns_pcie_init_phy()
214 of_property_read_string_index(np, "phy-names", i, &name); in cdns_pcie_init_phy()
215 phy[i] = devm_phy_get(dev, name); in cdns_pcie_init_phy()
216 if (IS_ERR(phy[i])) { in cdns_pcie_init_phy()
217 ret = PTR_ERR(phy[i]); in cdns_pcie_init_phy()
220 link[i] = device_link_add(dev, &phy[i]->dev, DL_FLAG_STATELESS); in cdns_pcie_init_phy()
222 devm_phy_put(dev, phy[i]); in cdns_pcie_init_phy()
223 ret = -EINVAL; in cdns_pcie_init_phy()
228 pcie->phy_count = phy_count; in cdns_pcie_init_phy()
229 pcie->phy = phy; in cdns_pcie_init_phy()
230 pcie->link = link; in cdns_pcie_init_phy()
239 while (--i >= 0) { in cdns_pcie_init_phy()
241 devm_phy_put(dev, phy[i]); in cdns_pcie_init_phy()
263 dev_err(dev, "failed to enable phy\n"); in cdns_pcie_resume_noirq()