Lines Matching +full:wait +full:- +full:on +full:- +full:read

20  * Ported from Linux driver - driver/pci/host/pci-aardvark.c
31 #include <asm-generic/gpio.h>
135 * struct pcie_advk - Advk PCIe controller state
139 * first_busno stores the bus number of the PCIe root-port
140 * number which may vary depending on the PCIe setup
152 writel(val, pcie->base + reg); in advk_writel()
157 return readl(pcie->base + reg); in advk_readl()
161 * pcie_advk_addr_valid() - Check for valid bus address
166 * Return: 1 on valid, 0 on invalid
171 * In PCIE-E only a single device (0) can exist in pcie_advk_addr_valid()
172 * on the local bus. Beyound the local bus, there might be in pcie_advk_addr_valid()
182 * pcie_advk_wait_pio() - Wait for PIO access to be accomplished
186 * Wait up to 1 micro second for PIO access to be accomplished.
208 dev_err(pcie->dev, "config read/write timed out\n"); in pcie_advk_wait_pio()
213 * pcie_advk_check_pio_status() - Validate PIO status and get the read result
216 * @read: Read from or write to configuration space - true(read) false(write)
217 * @read_val: Pointer to the read result, only valid when read is true
221 bool read, in pcie_advk_check_pio_status() argument
238 /* Get the read result */ in pcie_advk_check_pio_status()
239 if (read) in pcie_advk_check_pio_status()
245 if (read) { in pcie_advk_check_pio_status()
254 if (read) { in pcie_advk_check_pio_status()
274 str_posted = "Non-posted"; in pcie_advk_check_pio_status()
278 dev_err(pcie->dev, "%s PIO Response Status: %s, %#x @ %#x\n", in pcie_advk_check_pio_status()
282 return -EFAULT; in pcie_advk_check_pio_status()
286 * pcie_advk_read_config() - Read from configuration space
291 * @valuep: A pointer at which to store the read value
294 * Read a value of size @size from offset @offset within the configuration
296 * on the PCI bus @bus.
298 * Return: 0 on success
308 dev_dbg(pcie->dev, "PCIE CFG read: (b,d,f)=(%2d,%2d,%2d) ", in pcie_advk_read_config()
311 if (!pcie_advk_addr_valid(bdf, pcie->first_busno)) { in pcie_advk_read_config()
312 dev_dbg(pcie->dev, "- out of range\n"); in pcie_advk_read_config()
324 if (PCI_BUS(bdf) == pcie->first_busno) in pcie_advk_read_config()
339 return -EINVAL; in pcie_advk_read_config()
341 /* Check PIO status and get the read result */ in pcie_advk_read_config()
346 dev_dbg(pcie->dev, "(addr,size,val)=(0x%04x, %d, 0x%08x)\n", in pcie_advk_read_config()
354 * pcie_calc_datastrobe() - Calculate data strobe
377 data_strobe = GENMASK(bytes - 1, 0) << (offset & 0x3); in pcie_calc_datastrobe()
383 * pcie_advk_write_config() - Write to configuration space
393 * numbers in @bdf on the PCI bus @bus.
395 * Return: 0 on success
404 dev_dbg(pcie->dev, "PCIE CFG write: (b,d,f)=(%2d,%2d,%2d) ", in pcie_advk_write_config()
406 dev_dbg(pcie->dev, "(addr,size,val)=(0x%04x, %d, 0x%08lx)\n", in pcie_advk_write_config()
409 if (!pcie_advk_addr_valid(bdf, pcie->first_busno)) { in pcie_advk_write_config()
410 dev_dbg(pcie->dev, "- out of range\n"); in pcie_advk_write_config()
421 if (PCI_BUS(bdf) == pcie->first_busno) in pcie_advk_write_config()
431 dev_dbg(pcie->dev, "\tPIO req. - addr = 0x%08x\n", reg); in pcie_advk_write_config()
436 dev_dbg(pcie->dev, "\tPIO req. - val = 0x%08x\n", reg); in pcie_advk_write_config()
441 dev_dbg(pcie->dev, "\tPIO req. - strb = 0x%02x\n", reg); in pcie_advk_write_config()
447 dev_dbg(pcie->dev, "- wait pio timeout\n"); in pcie_advk_write_config()
448 return -EINVAL; in pcie_advk_write_config()
458 * pcie_advk_link_up() - Check if PCIe link is up or not
462 * Return 1 (true) on link up.
463 * Return 0 (false) on link down.
475 * pcie_advk_wait_for_link() - Wait for link training to be accomplished
479 * Wait up to 1 second for link training to be accomplished.
491 printf("PCIE-%d: Link up\n", pcie->first_busno); in pcie_advk_wait_for_link()
498 printf("PCIE-%d: Link down\n", pcie->first_busno); in pcie_advk_wait_for_link()
500 return -ETIMEDOUT; in pcie_advk_wait_for_link()
504 * pcie_advk_setup_hw() - PCIe initailzation
508 * Return: 0 on success
586 /* Wait for PCIe link up */ in pcie_advk_setup_hw()
588 return -ENXIO; in pcie_advk_setup_hw()
600 * pcie_advk_probe() - Probe the PCIe bus for active link
602 * @dev: A pointer to the device being operated on
604 * Probe for an active link on the PCIe bus and configure the controller
607 * Return: 0 on success, else -ENODEV
616 gpio_request_by_name(dev, "reset-gpio", 0, &reset_gpio, in pcie_advk_probe()
619 * Issue reset to add-in card through the dedicated GPIO. in pcie_advk_probe()
625 * FIX-ME: in pcie_advk_probe()
632 dev_dbg(pcie->dev, "Toggle PCIE Reset GPIO ...\n"); in pcie_advk_probe()
638 dev_dbg(pcie->dev, "PCIE Reset on GPIO support is missing\n"); in pcie_advk_probe()
641 pcie->first_busno = dev->seq; in pcie_advk_probe()
642 pcie->dev = pci_get_controller(dev); in pcie_advk_probe()
648 * pcie_advk_ofdata_to_platdata() - Translate from DT to device state
650 * @dev: A pointer to the device being operated on
656 * Return: 0 on success, else -EINVAL
663 pcie->base = (void *)dev_read_addr_index(dev, 0); in pcie_advk_ofdata_to_platdata()
664 if ((fdt_addr_t)pcie->base == FDT_ADDR_T_NONE) in pcie_advk_ofdata_to_platdata()
665 return -EINVAL; in pcie_advk_ofdata_to_platdata()
676 { .compatible = "marvell,armada-37xx-pcie" },