Re: [PATCH 02/14] MIPS: pci: parse memory ranges from devicetree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 3, 2012 at 7:42 PM, John Crispin <blogic@xxxxxxxxxxx> wrote:
> Implement pci_load_of_ranges on MIPS. Due to lack of test hardware only 32bit
> bus width is supported. This function is based on the implementation found on
> powerpc.

There's no pci_load_of_ranges() in arch/powerpc/?

> +void __devinit 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;
> +
> +       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;
> +               struct resource *res = NULL;
> +               unsigned long long addr, size;

You better use u64, as that's what of_translate_address() and
of_read_number() return.

> +
> +               pci_space = ranges[0];

pci_space = be32_to_cpup(&ranges[0])

> +               addr = of_translate_address(node, ranges + 3);
> +               size = of_read_number(ranges + pna + 3, 2);

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux