mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-13 20:33:15 +00:00
PCI: ftpci100: Use inbound resources for setup
Now that the helpers provide the inbound resources in the host bridge 'dma_ranges' resource list, convert Faraday ftpci100 host bridge to use the resource list to setup the inbound addresses. Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Reviewed-by: Andrew Murray <andrew.murray@arm.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: Bjorn Helgaas <bhelgaas@google.com>
This commit is contained in:
parent
331f634571
commit
ea4f718e84
@ -375,12 +375,11 @@ static int faraday_pci_setup_cascaded_irq(struct faraday_pci *p)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int faraday_pci_parse_map_dma_ranges(struct faraday_pci *p,
|
||||
struct device_node *np)
|
||||
static int faraday_pci_parse_map_dma_ranges(struct faraday_pci *p)
|
||||
{
|
||||
struct of_pci_range range;
|
||||
struct of_pci_range_parser parser;
|
||||
struct device *dev = p->dev;
|
||||
struct pci_host_bridge *bridge = pci_host_bridge_from_priv(p);
|
||||
struct resource_entry *entry;
|
||||
u32 confreg[3] = {
|
||||
FARADAY_PCI_MEM1_BASE_SIZE,
|
||||
FARADAY_PCI_MEM2_BASE_SIZE,
|
||||
@ -389,19 +388,13 @@ static int faraday_pci_parse_map_dma_ranges(struct faraday_pci *p,
|
||||
int i = 0;
|
||||
u32 val;
|
||||
|
||||
if (of_pci_dma_range_parser_init(&parser, np)) {
|
||||
dev_err(dev, "missing dma-ranges property\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the dma-ranges from the device tree
|
||||
*/
|
||||
for_each_of_pci_range(&parser, &range) {
|
||||
u64 end = range.pci_addr + range.size - 1;
|
||||
resource_list_for_each_entry(entry, &bridge->dma_ranges) {
|
||||
u64 pci_addr = entry->res->start - entry->offset;
|
||||
u64 end = entry->res->end - entry->offset;
|
||||
int ret;
|
||||
|
||||
ret = faraday_res_to_memcfg(range.pci_addr, range.size, &val);
|
||||
ret = faraday_res_to_memcfg(pci_addr,
|
||||
resource_size(entry->res), &val);
|
||||
if (ret) {
|
||||
dev_err(dev,
|
||||
"DMA range %d: illegal MEM resource size\n", i);
|
||||
@ -409,7 +402,7 @@ static int faraday_pci_parse_map_dma_ranges(struct faraday_pci *p,
|
||||
}
|
||||
|
||||
dev_info(dev, "DMA MEM%d BASE: 0x%016llx -> 0x%016llx config %08x\n",
|
||||
i + 1, range.pci_addr, end, val);
|
||||
i + 1, pci_addr, end, val);
|
||||
if (i <= 2) {
|
||||
faraday_raw_pci_write_config(p, 0, 0, confreg[i],
|
||||
4, val);
|
||||
@ -539,7 +532,7 @@ static int faraday_pci_probe(struct platform_device *pdev)
|
||||
cur_bus_speed = PCI_SPEED_66MHz;
|
||||
}
|
||||
|
||||
ret = faraday_pci_parse_map_dma_ranges(p, dev->of_node);
|
||||
ret = faraday_pci_parse_map_dma_ranges(p);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user