Re: [PATCH 07/11] PCI: ftpci100: Use inbound resources for setup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 24, 2019 at 04:46:26PM -0500, Rob Herring wrote:
> 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.
> 
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@xxxxxxx>
> Cc: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
> Signed-off-by: Rob Herring <robh@xxxxxxxxxx>
> ---

Reviewed-by: Andrew Murray <andrew.murray@xxxxxxx>

>  drivers/pci/controller/pci-ftpci100.c | 26 +++++++++-----------------
>  1 file changed, 9 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/pci/controller/pci-ftpci100.c b/drivers/pci/controller/pci-ftpci100.c
> index 3e07a8203736..e37a33ad77d9 100644
> --- a/drivers/pci/controller/pci-ftpci100.c
> +++ b/drivers/pci/controller/pci-ftpci100.c
> @@ -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,12 @@ 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 +401,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);
> @@ -566,7 +558,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;
>  
> -- 
> 2.20.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux