Lines Matching refs:p

181 static int faraday_raw_pci_read_config(struct faraday_pci *p, int bus_number,  in faraday_raw_pci_read_config()  argument
187 p->base + FTPCI_CONFIG); in faraday_raw_pci_read_config()
189 *value = readl(p->base + FTPCI_DATA); in faraday_raw_pci_read_config()
202 struct faraday_pci *p = bus->sysdata; in faraday_pci_read_config() local
208 return faraday_raw_pci_read_config(p, bus->number, fn, config, size, value); in faraday_pci_read_config()
211 static int faraday_raw_pci_write_config(struct faraday_pci *p, int bus_number, in faraday_raw_pci_write_config() argument
219 p->base + FTPCI_CONFIG); in faraday_raw_pci_write_config()
223 writel(value, p->base + FTPCI_DATA); in faraday_raw_pci_write_config()
226 writew(value, p->base + FTPCI_DATA + (config & 3)); in faraday_raw_pci_write_config()
229 writeb(value, p->base + FTPCI_DATA + (config & 3)); in faraday_raw_pci_write_config()
241 struct faraday_pci *p = bus->sysdata; in faraday_pci_write_config() local
247 return faraday_raw_pci_write_config(p, bus->number, fn, config, size, in faraday_pci_write_config()
258 struct faraday_pci *p = irq_data_get_irq_chip_data(d); in faraday_pci_ack_irq() local
261 faraday_raw_pci_read_config(p, 0, 0, FARADAY_PCI_CTRL2, 4, &reg); in faraday_pci_ack_irq()
264 faraday_raw_pci_write_config(p, 0, 0, FARADAY_PCI_CTRL2, 4, reg); in faraday_pci_ack_irq()
269 struct faraday_pci *p = irq_data_get_irq_chip_data(d); in faraday_pci_mask_irq() local
272 faraday_raw_pci_read_config(p, 0, 0, FARADAY_PCI_CTRL2, 4, &reg); in faraday_pci_mask_irq()
275 faraday_raw_pci_write_config(p, 0, 0, FARADAY_PCI_CTRL2, 4, reg); in faraday_pci_mask_irq()
280 struct faraday_pci *p = irq_data_get_irq_chip_data(d); in faraday_pci_unmask_irq() local
283 faraday_raw_pci_read_config(p, 0, 0, FARADAY_PCI_CTRL2, 4, &reg); in faraday_pci_unmask_irq()
286 faraday_raw_pci_write_config(p, 0, 0, FARADAY_PCI_CTRL2, 4, reg); in faraday_pci_unmask_irq()
291 struct faraday_pci *p = irq_desc_get_handler_data(desc); in faraday_pci_irq_handler() local
295 faraday_raw_pci_read_config(p, 0, 0, FARADAY_PCI_CTRL2, 4, &reg); in faraday_pci_irq_handler()
303 generic_handle_domain_irq(p->irqdomain, i); in faraday_pci_irq_handler()
329 static int faraday_pci_setup_cascaded_irq(struct faraday_pci *p) in faraday_pci_setup_cascaded_irq() argument
331 struct device_node *intc = of_get_next_child(p->dev->of_node, NULL); in faraday_pci_setup_cascaded_irq()
336 dev_err(p->dev, "missing child interrupt-controller node\n"); in faraday_pci_setup_cascaded_irq()
343 dev_err(p->dev, "failed to get parent IRQ\n"); in faraday_pci_setup_cascaded_irq()
348 p->irqdomain = irq_domain_add_linear(intc, PCI_NUM_INTX, in faraday_pci_setup_cascaded_irq()
349 &faraday_pci_irqdomain_ops, p); in faraday_pci_setup_cascaded_irq()
351 if (!p->irqdomain) { in faraday_pci_setup_cascaded_irq()
352 dev_err(p->dev, "failed to create Gemini PCI IRQ domain\n"); in faraday_pci_setup_cascaded_irq()
356 irq_set_chained_handler_and_data(irq, faraday_pci_irq_handler, p); in faraday_pci_setup_cascaded_irq()
359 irq_create_mapping(p->irqdomain, i); in faraday_pci_setup_cascaded_irq()
364 static int faraday_pci_parse_map_dma_ranges(struct faraday_pci *p) in faraday_pci_parse_map_dma_ranges() argument
366 struct device *dev = p->dev; in faraday_pci_parse_map_dma_ranges()
367 struct pci_host_bridge *bridge = pci_host_bridge_from_priv(p); in faraday_pci_parse_map_dma_ranges()
393 faraday_raw_pci_write_config(p, 0, 0, confreg[i], in faraday_pci_parse_map_dma_ranges()
412 struct faraday_pci *p; in faraday_pci_probe() local
421 host = devm_pci_alloc_host_bridge(dev, sizeof(*p)); in faraday_pci_probe()
426 p = pci_host_bridge_priv(host); in faraday_pci_probe()
427 host->sysdata = p; in faraday_pci_probe()
428 p->dev = dev; in faraday_pci_probe()
434 p->bus_clk = devm_clk_get_enabled(dev, "PCICLK"); in faraday_pci_probe()
435 if (IS_ERR(p->bus_clk)) in faraday_pci_probe()
436 return PTR_ERR(p->bus_clk); in faraday_pci_probe()
438 p->base = devm_platform_ioremap_resource(pdev, 0); in faraday_pci_probe()
439 if (IS_ERR(p->base)) in faraday_pci_probe()
440 return PTR_ERR(p->base); in faraday_pci_probe()
448 writel(val, p->base + FTPCI_IOSIZE); in faraday_pci_probe()
456 val = readl(p->base + FTPCI_CTRL); in faraday_pci_probe()
460 writel(val, p->base + FTPCI_CTRL); in faraday_pci_probe()
462 faraday_raw_pci_write_config(p, 0, 0, FARADAY_PCI_CTRL2 + 2, 2, 0xF000); in faraday_pci_probe()
464 ret = faraday_pci_setup_cascaded_irq(p); in faraday_pci_probe()
472 if (!IS_ERR(p->bus_clk)) { in faraday_pci_probe()
476 faraday_raw_pci_read_config(p, 0, 0, in faraday_pci_probe()
478 rate = clk_get_rate(p->bus_clk); in faraday_pci_probe()
483 ret = clk_set_rate(p->bus_clk, 66000000); in faraday_pci_probe()
492 rate = clk_get_rate(p->bus_clk); in faraday_pci_probe()
499 ret = faraday_pci_parse_map_dma_ranges(p); in faraday_pci_probe()
508 p->bus = host->bus; in faraday_pci_probe()
509 p->bus->max_bus_speed = max_bus_speed; in faraday_pci_probe()
510 p->bus->cur_bus_speed = cur_bus_speed; in faraday_pci_probe()
512 pci_bus_assign_resources(p->bus); in faraday_pci_probe()
513 pci_bus_add_devices(p->bus); in faraday_pci_probe()