Lines Matching +full:timeout +full:- +full:enable
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
101 #define FUDW_MGMT_READ(_sc, _o) bus_read_4((_sc)->mgmt_res, (_o))
102 #define FUDW_MGMT_WRITE(_sc, _o, _v) bus_write_4((_sc)->mgmt_res, (_o), (_v))
105 { "sifive,fu740-pcie", 1 },
113 unsigned timeout; in fupci_phy_read() local
119 timeout = 10; in fupci_phy_read()
125 } while (--timeout > 0); in fupci_phy_read()
127 if (timeout == 0) { in fupci_phy_read()
128 device_printf(sc->dev, "Timeout waiting for read ACK\n"); in fupci_phy_read()
135 timeout = 10; in fupci_phy_read()
141 } while (--timeout > 0); in fupci_phy_read()
143 if (timeout == 0) { in fupci_phy_read()
144 device_printf(sc->dev, "Timeout waiting for read un-ACK\n"); in fupci_phy_read()
154 unsigned timeout; in fupci_phy_write() local
161 timeout = 10; in fupci_phy_write()
167 } while (--timeout > 0); in fupci_phy_write()
169 if (timeout == 0) { in fupci_phy_write()
170 device_printf(sc->dev, "Timeout waiting for write ACK\n"); in fupci_phy_write()
176 timeout = 10; in fupci_phy_write()
182 } while (--timeout > 0); in fupci_phy_write()
184 if (timeout == 0) { in fupci_phy_write()
185 device_printf(sc->dev, "Timeout waiting for write un-ACK\n"); in fupci_phy_write()
198 dev = sc->dev; in fupci_phy_init()
200 /* Assert core power-on reset (active low) */ in fupci_phy_init()
201 error = gpio_pin_set_active(sc->porst_pin, false); in fupci_phy_init()
203 device_printf(dev, "Cannot assert power-on reset: %d\n", in fupci_phy_init()
211 /* Enable power */ in fupci_phy_init()
212 error = gpio_pin_set_active(sc->pwren_pin, true); in fupci_phy_init()
214 device_printf(dev, "Cannot enable power: %d\n", error); in fupci_phy_init()
218 /* Deassert core power-on reset (active low) */ in fupci_phy_init()
219 error = gpio_pin_set_active(sc->porst_pin, true); in fupci_phy_init()
221 device_printf(dev, "Cannot deassert power-on reset: %d\n", in fupci_phy_init()
226 /* Enable the aux clock */ in fupci_phy_init()
227 error = clk_enable(sc->pcie_aux_clk); in fupci_phy_init()
229 device_printf(dev, "Cannot enable aux clock: %d\n", error); in fupci_phy_init()
237 error = hwreset_deassert(sc->pcie_aux_rst); in fupci_phy_init()
243 /* Enable control register interface */ in fupci_phy_init()
247 /* Wait for enable to take effect */ in fupci_phy_init()
258 error = clk_disable(sc->pcie_aux_clk); in fupci_phy_init()
267 /* Enable the aux clock again */ in fupci_phy_init()
268 error = clk_enable(sc->pcie_aux_clk); in fupci_phy_init()
270 device_printf(dev, "Cannot re-enable aux clock: %d\n", error); in fupci_phy_init()
291 reg = pci_dw_dbi_rd4(sc->dev, DW_MISC_CONTROL_1); in fupci_dbi_protect()
296 pci_dw_dbi_wr4(sc->dev, DW_MISC_CONTROL_1, reg); in fupci_dbi_protect()
302 /* Enable 32-bit I/O window */ in fupci_init()
304 pci_dw_dbi_wr2(sc->dev, PCIR_IOBASEL_1, in fupci_init()
308 /* Enable LTSSM */ in fupci_init()
320 if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) in fupci_probe()
337 sc->dev = dev; in fupci_attach()
340 error = ofw_bus_find_string_index(node, "reg-names", "dbi", &rid); in fupci_attach()
345 sc->dw_sc.dbi_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, in fupci_attach()
347 if (sc->dw_sc.dbi_res == NULL) { in fupci_attach()
354 error = ofw_bus_find_string_index(node, "reg-names", "mgmt", &rid); in fupci_attach()
360 sc->mgmt_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, in fupci_attach()
362 if (sc->mgmt_res == NULL) { in fupci_attach()
368 error = gpio_pin_get_by_ofw_property(dev, node, "reset-gpios", in fupci_attach()
369 &sc->porst_pin); in fupci_attach()
370 /* Old U-Boot device tree uses perstn-gpios */ in fupci_attach()
372 error = gpio_pin_get_by_ofw_property(dev, node, "perstn-gpios", in fupci_attach()
373 &sc->porst_pin); in fupci_attach()
375 device_printf(dev, "Cannot get power-on reset GPIO: %d\n", in fupci_attach()
379 error = gpio_pin_setflags(sc->porst_pin, GPIO_PIN_OUTPUT); in fupci_attach()
381 device_printf(dev, "Cannot configure power-on reset GPIO: %d\n", in fupci_attach()
386 error = gpio_pin_get_by_ofw_property(dev, node, "pwren-gpios", in fupci_attach()
387 &sc->pwren_pin); in fupci_attach()
389 device_printf(dev, "Cannot get power enable GPIO: %d\n", in fupci_attach()
393 error = gpio_pin_setflags(sc->pwren_pin, GPIO_PIN_OUTPUT); in fupci_attach()
395 device_printf(dev, "Cannot configure power enable GPIO: %d\n", in fupci_attach()
400 error = clk_get_by_ofw_name(dev, node, "pcie_aux", &sc->pcie_aux_clk); in fupci_attach()
401 /* Old U-Boot device tree uses pcieaux */ in fupci_attach()
404 &sc->pcie_aux_clk); in fupci_attach()
410 error = hwreset_get_by_ofw_idx(dev, node, 0, &sc->pcie_aux_rst); in fupci_attach()