From: Rob Herring <robherring2@gmail.com>
To: Andrew Murray <Andrew.Murray@arm.com>
Cc: rob.herring@calxeda.com, siva.kallam@samsung.com,
linux-pci@vger.kernel.org, Liviu.Dudau@arm.com, paulus@samba.org,
linux-samsung-soc@vger.kernel.org, linux@arm.linux.org.uk,
jg1.han@samsung.com, jgunthorpe@obsidianresearch.com,
devicetree-discuss@lists.ozlabs.org, kgene.kim@samsung.com,
bhelgaas@google.com, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, suren.reddy@samsung.com
Subject: Re: [PATCH v5 3/3] of/pci: mips: convert to common of_pci_range_parser
Date: Wed, 10 Apr 2013 13:28:34 -0500 [thread overview]
Message-ID: <5165AF52.9000001@gmail.com> (raw)
In-Reply-To: <1365578969-30966-4-git-send-email-Andrew.Murray@arm.com>
On 04/10/2013 02:29 AM, Andrew Murray wrote:
> This patch converts the pci_load_of_ranges function to use the new common
> of_pci_range_parser.
>
> Signed-off-by: Andrew Murray <Andrew.Murray@arm.com>
> Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
Reviewed-by: Rob Herring <rob.herring@calxeda.com>
> ---
> arch/mips/pci/pci.c | 50 ++++++++++++++++----------------------------------
> 1 files changed, 16 insertions(+), 34 deletions(-)
>
> diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
> index 0872f12..bee49a4 100644
> --- a/arch/mips/pci/pci.c
> +++ b/arch/mips/pci/pci.c
> @@ -122,51 +122,33 @@ static void pcibios_scanbus(struct pci_controller *hose)
> #ifdef CONFIG_OF
> void pci_load_of_ranges(struct pci_controller *hose, struct device_node *node)
> {
> - const __be32 *ranges;
> - int rlen;
> - int pna = of_n_addr_cells(node);
> - int np = pna + 5;
> + struct of_pci_range_range range;
> + struct of_pci_range_parser parser;
> + u32 res_type;
>
> pr_info("PCI host bridge %s ranges:\n", node->full_name);
> - ranges = of_get_property(node, "ranges", &rlen);
> - if (ranges == NULL)
> - return;
> hose->of_node = node;
>
> - while ((rlen -= np * 4) >= 0) {
> - u32 pci_space;
> + if (of_pci_range_parser(&parser, node))
> + return;
> +
> + for_each_of_pci_range(&parser, &range) {
> struct resource *res = NULL;
> - u64 addr, size;
> -
> - pci_space = be32_to_cpup(&ranges[0]);
> - addr = of_translate_address(node, ranges + 3);
> - size = of_read_number(ranges + pna + 3, 2);
> - ranges += np;
> - switch ((pci_space >> 24) & 0x3) {
> - case 1: /* PCI IO space */
> +
> + res_type = range.flags & IORESOURCE_TYPE_BITS;
> + if (res_type == IORESOURCE_IO) {
> pr_info(" IO 0x%016llx..0x%016llx\n",
> - addr, addr + size - 1);
> + range.addr, range.addr + range.size - 1);
> hose->io_map_base =
> - (unsigned long)ioremap(addr, size);
> + (unsigned long)ioremap(range.addr, range.size);
> res = hose->io_resource;
> - res->flags = IORESOURCE_IO;
> - break;
> - case 2: /* PCI Memory space */
> - case 3: /* PCI 64 bits Memory space */
> + } else if (res_type == IORESOURCE_MEM) {
> pr_info(" MEM 0x%016llx..0x%016llx\n",
> - addr, addr + size - 1);
> + range.addr, range.addr + range.size - 1);
> res = hose->mem_resource;
> - res->flags = IORESOURCE_MEM;
> - break;
> - }
> - if (res != NULL) {
> - res->start = addr;
> - res->name = node->full_name;
> - res->end = res->start + size - 1;
> - res->parent = NULL;
> - res->sibling = NULL;
> - res->child = NULL;
> }
> + if (res != NULL)
> + of_pci_range_to_resource(&range, node, res);
> }
> }
> #endif
>
prev parent reply other threads:[~2013-04-10 18:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-10 7:29 [PATCH v5 0/3] of/pci: Provide common support for PCI DT parsing Andrew Murray
2013-04-10 7:29 ` [PATCH v5 1/3] of/pci: Unify pci_process_bridge_OF_ranges from Microblaze and PowerPC Andrew Murray
2013-04-10 13:13 ` Rob Herring
2013-04-10 21:30 ` Thomas Petazzoni
2013-04-11 16:57 ` Linus Walleij
2013-04-11 12:03 ` Andrew Murray
2013-04-10 21:33 ` Thomas Petazzoni
2013-04-10 7:29 ` [PATCH v5 2/3] of/pci: Provide support for parsing PCI DT ranges property Andrew Murray
2013-04-10 18:26 ` Rob Herring
2013-04-11 13:11 ` Andrew Murray
2013-04-10 7:29 ` [PATCH v5 3/3] of/pci: mips: convert to common of_pci_range_parser Andrew Murray
2013-04-10 18:28 ` Rob Herring [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5165AF52.9000001@gmail.com \
--to=robherring2@gmail.com \
--cc=Andrew.Murray@arm.com \
--cc=Liviu.Dudau@arm.com \
--cc=bhelgaas@google.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=jg1.han@samsung.com \
--cc=jgunthorpe@obsidianresearch.com \
--cc=kgene.kim@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=paulus@samba.org \
--cc=rob.herring@calxeda.com \
--cc=siva.kallam@samsung.com \
--cc=suren.reddy@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).