From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout2.samsung.com ([203.254.224.25]:49188 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762904Ab3DDA5g (ORCPT ); Wed, 3 Apr 2013 20:57:36 -0400 From: Jingoo Han To: 'Thierry Reding' , 'Andrew Murray' Cc: 'Bjorn Helgaas' , 'Grant Likely' , 'Russell King - ARM Linux' , 'Thomas Petazzoni' , 'Kukjin Kim' , 'Jason Gunthorpe' , linux-samsung-soc@vger.kernel.org, 'Siva Reddy Kallam' , linux-pci@vger.kernel.org, devicetree-discuss@lists.ozlabs.org, linux-kernel@vger.kernel.org, 'Surendranath Gurivireddy Balla' , 'Thomas Abraham' , linux-arm-kernel@lists.infradead.org, 'Arnd Bergmann' , 'Liviu Dudau' , 'Jingoo Han' References: <20130326162022.GA25625@arm.com> <20130327130418.GA10480@avionic-0098.mockup.avionic-design.de> In-reply-to: <20130327130418.GA10480@avionic-0098.mockup.avionic-design.de> Subject: Re: [PATCH v3] of/pci: Provide support for parsing PCI DT ranges property Date: Thu, 04 Apr 2013 09:57:34 +0900 Message-id: <002b01ce30cf$64da6180$2e8f2480$%han@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Sender: linux-pci-owner@vger.kernel.org List-ID: On Wednesday, March 27, 2013 10:04 PM, Thierry Reding wrote: > > On Tue, Mar 26, 2013 at 04:20:23PM +0000, Andrew Murray wrote: > > This patch factors out common implementation 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_parser parser; > > struct of_pci_range range; > > > > if (of_pci_range_parser(&parser, np)) > > ; //no ranges property > > > > for_each_of_pci_range(&parser, &range) { > > > > /* > > directly access properties of the address range, e.g.: > > range.pci_space, range.pci_addr, range.cpu_addr, > > range.size, range.flags > > > > alternatively obtain a struct resource, e.g.: > > struct resource res; > > of_pci_range_to_resource(&range, 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 > > Tested-by: Thierry Reding It works properly with Exynos5440. Tested-by: Jingoo Han From mboxrd@z Thu Jan 1 00:00:00 1970 From: jg1.han@samsung.com (Jingoo Han) Date: Thu, 04 Apr 2013 09:57:34 +0900 Subject: [PATCH v3] of/pci: Provide support for parsing PCI DT ranges property In-Reply-To: <20130327130418.GA10480@avionic-0098.mockup.avionic-design.de> References: <20130326162022.GA25625@arm.com> <20130327130418.GA10480@avionic-0098.mockup.avionic-design.de> Message-ID: <002b01ce30cf$64da6180$2e8f2480$%han@samsung.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Wednesday, March 27, 2013 10:04 PM, Thierry Reding wrote: > > On Tue, Mar 26, 2013 at 04:20:23PM +0000, Andrew Murray wrote: > > This patch factors out common implementation 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_parser parser; > > struct of_pci_range range; > > > > if (of_pci_range_parser(&parser, np)) > > ; //no ranges property > > > > for_each_of_pci_range(&parser, &range) { > > > > /* > > directly access properties of the address range, e.g.: > > range.pci_space, range.pci_addr, range.cpu_addr, > > range.size, range.flags > > > > alternatively obtain a struct resource, e.g.: > > struct resource res; > > of_pci_range_to_resource(&range, 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 > > Tested-by: Thierry Reding It works properly with Exynos5440. Tested-by: Jingoo Han