On Mon, Aug 28, 2017 at 11:13 AM, Mason <slash.tmp@xxxxxxx> wrote: > On 25/08/2017 17:25, Robin Murphy wrote: > >> If your host controller driver needs to discover its windows from DT to >> configure *itself*, it needs to parse dma-ranges itself; see pcie-iproc, >> pcie-rcar, pcie-xgene, etc. for examples. > > $ git grep '"dma-ranges"' drivers/pci/host > drivers/pci/host/pci-ftpci100.c: parser->range = of_get_property(node, "dma-ranges", &rlen); > drivers/pci/host/pci-rcar-gen2.c: parser->range = of_get_property(node, "dma-ranges", &rlen); > drivers/pci/host/pci-xgene.c: parser->range = of_get_property(node, "dma-ranges", &rlen); > drivers/pci/host/pcie-iproc.c: parser->range = of_get_property(node, "dma-ranges", &rlen); > drivers/pci/host/pcie-rcar.c: parser->range = of_get_property(node, "dma-ranges", &rlen); > > These 5 drivers are using the same function: pci_dma_range_parser_init > > pci-ftpci100.c: d3c68e0a7e34a (Linus Walleij 2017-03-12 > pci-rcar-gen2.c: 8d598cabf50d8 (Phil Edworthy 2015-11-03 > pci-xgene.c: 5f6b6ccdbe1cd (Tanmay Inamdar 2014-10-01 > pcie-iproc.c: dd9d4e7498de3 (Ray Jui 2016-10-31 > pcie-rcar.c: c25da4778803b (Phil Edworthy 2014-05-12 > > which seems to be a copy of of_pci_range_parser_init > with "ranges" changed to "dma-ranges" > > drivers/of/address.c 29b635c00f3eb (Andrew Murray 2013-05-16 > > Perhaps pci_dma_range_parser_init() can be factorized? > > Rob, Frank, what do you think of the patch below? I thought I had commented (maybe that was on IRC), but looks fine. This series should also fix a build failure on rcar with !OF, so can you send a proper patch? Rob