From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Murray Subject: Re: [PATCH v5 01/17] of/pci: Provide support for parsing PCI DT ranges property Date: Fri, 22 Mar 2013 10:00:37 +0000 Message-ID: <20130322100037.GA1401@arm.com> References: <1363887025-19931-1-git-send-email-thomas.petazzoni@free-electrons.com> <1363887025-19931-2-git-send-email-thomas.petazzoni@free-electrons.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1363887025-19931-2-git-send-email-thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org Sender: "devicetree-discuss" To: Thomas Petazzoni Cc: Lior Amsalem , Andrew Lunn , Russell King , Jason Cooper , "linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org" , Liviu Dudau , Maen Suleiman , Bjorn Helgaas , Tawfik Bayouk , Mitch Bradley , "linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" , Jason Gunthorpe List-Id: devicetree@vger.kernel.org On Thu, Mar 21, 2013 at 05:30:09PM +0000, Thomas Petazzoni wrote: > From: Andrew Murray > > 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 > Signed-off-by: Liviu Dudau > Signed-off-by: Thomas Petazzoni > --- > > 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from fw-tnat.cambridge.arm.com ([217.140.96.21]:59298 "EHLO cam-smtp0.cambridge.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753658Ab3CVKCQ (ORCPT ); Fri, 22 Mar 2013 06:02:16 -0400 Date: Fri, 22 Mar 2013 10:00:37 +0000 From: Andrew Murray To: Thomas Petazzoni Cc: Bjorn Helgaas , Grant Likely , Russell King , "linux-pci@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "devicetree-discuss@lists.ozlabs.org" , Lior Amsalem , Andrew Lunn , Jason Cooper , Arnd Bergmann , Maen Suleiman , Thierry Reding , Gregory Clement , Ezequiel Garcia , Olof Johansson , Tawfik Bayouk , Jason Gunthorpe , Mitch Bradley , Liviu Dudau Subject: Re: [PATCH v5 01/17] of/pci: Provide support for parsing PCI DT ranges property Message-ID: <20130322100037.GA1401@arm.com> References: <1363887025-19931-1-git-send-email-thomas.petazzoni@free-electrons.com> <1363887025-19931-2-git-send-email-thomas.petazzoni@free-electrons.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 In-Reply-To: <1363887025-19931-2-git-send-email-thomas.petazzoni@free-electrons.com> Sender: linux-pci-owner@vger.kernel.org List-ID: On Thu, Mar 21, 2013 at 05:30:09PM +0000, Thomas Petazzoni wrote: > From: Andrew Murray > > 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 > Signed-off-by: Liviu Dudau > Signed-off-by: Thomas Petazzoni > --- > > 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: andrew.murray@arm.com (Andrew Murray) Date: Fri, 22 Mar 2013 10:00:37 +0000 Subject: [PATCH v5 01/17] of/pci: Provide support for parsing PCI DT ranges property In-Reply-To: <1363887025-19931-2-git-send-email-thomas.petazzoni@free-electrons.com> References: <1363887025-19931-1-git-send-email-thomas.petazzoni@free-electrons.com> <1363887025-19931-2-git-send-email-thomas.petazzoni@free-electrons.com> Message-ID: <20130322100037.GA1401@arm.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Thu, Mar 21, 2013 at 05:30:09PM +0000, Thomas Petazzoni wrote: > From: Andrew Murray > > 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 > Signed-off-by: Liviu Dudau > Signed-off-by: Thomas Petazzoni > --- > > 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