[PATCH v5 01/17] of/pci: Provide support for parsing PCI DT ranges property

Andrew Murray andrew.murray at arm.com
Fri Mar 22 21:00:37 EST 2013


On Thu, Mar 21, 2013 at 05:30:09PM +0000, Thomas Petazzoni wrote:
> From: Andrew Murray <Andrew.Murray at arm.com>
> 
> This patch factors out common implementations patterns to reduce overall kernel
> code and provide a means for host bridge drivers to directly obtain struct
> resources from the DT's ranges property without relying on architecture specific
> DT handling. This will make it easier to write archiecture independent host bridge
> drivers and mitigate against further duplication of DT parsing code.
> 
> This patch can be used in the following way:
> 
>         struct of_pci_range_iter iter;
>         for_each_of_pci_range(&iter, np) {
> 
>                 //directly access properties of the address range, e.g.:
>                 //iter.pci_space, iter.pci_addr, iter.cpu_addr, iter.size or
>                 //iter.flags
> 
>                 //alternatively obtain a struct resource, e.g.:
>                 //struct resource res;
>                 //range_iter_fill_resource(iter, np, res);
>         }
> 
> Additionally the implementation takes care of adjacent ranges and merges them
> into a single range (as was the case with powerpc and microblaze).
> 
> The modifications to microblaze, mips and powerpc have not been tested.
> 
> Signed-off-by: Andrew Murray <Andrew.Murray at arm.com>
> Signed-off-by: Liviu Dudau <Liviu.Dudau at arm.com>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
> ---
> 
> Compared to the v2 sent by Andrew Murray, Thomas Petazzoni did:
> 
>  * Add a memset() on the struct of_pci_range_iter when starting the
>    for loop in for_each_pci_range(). Otherwise, with an uninitialized
>    of_pci_range_iter, of_pci_process_ranges() may crash.
> 
>  * Add parenthesis around 'res', 'np' and 'iter' in the
>    for_each_of_pci_range macro definitions. Otherwise, passing
>    something like &foobar as 'res' didn't work.
> 
>  * Rebased on top of 3.9-rc2, which required fixing a few conflicts in
>    the Microblaze code.
> 
The changes here against my v2 look good to me.

Acked-by: Andrew Murray <andrew.murray at arm.com>


More information about the devicetree-discuss mailing list