public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: andrew.murray@arm.com (Andrew Murray)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 11/11] RFC: ARM: get PCI device IRQs from device tree
Date: Fri, 12 Apr 2013 09:22:29 +0100	[thread overview]
Message-ID: <20130412082229.GA30593@arm.com> (raw)
In-Reply-To: <CACRpkdZhPYqxgUuffTabN+RZkTBY2w0t-OmJ8Wsew8qOWTRQ7A@mail.gmail.com>

On Thu, Apr 11, 2013 at 09:27:53PM +0100, Linus Walleij wrote:
> On Thu, Apr 4, 2013 at 5:01 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
> 
> > This currently bugs out - when trying to get the IRQs for
> > devices of_irq_map_pci() reads the IRQ pin from the PCI config
> > space successfully, then comes to trying to look up the parent
> > PCI device by checking pdev->bus->self, which is NULL, then
> > tries to treat it as a bridge doing pci_bus_to_OF_node(pdev->bus)
> > which also results in NULL and it bails out.
> >
> > No clue why this is so - some problem with the parent of this
> > bus not being a PCI device in itself? Help.
> 
> Tracked this down to a point where in drivers/pci/of.c
> pci_set_bus_of_node() is called on the root bus, at which
> point it calls pcibios_get_phb_of_node() which has no clue
> on how to obtain the DT node for the root hub. (Only bridges.)
> 
> Inserting this na?ve fragment into the PCI driver makes things
> tick:
> 
> +struct device_node *static_root;
> +
> +struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
> +{
> +       return static_root;
> +}
> +
> 
> In probe():
> +       static_root = np;
> 
> It'll override the weak symbol and make things work.
> 
> I guess this is something for kernel/bios32.c to implement
> if we want to support DT on these PCI adapters, so looking
> into that next...
> 
> But how do others get their things to work? Not using bios32?
> I wonder...

I think there are a mix of solutions out here, let me try and remember...

* I originally [1] implemented a pcibios_get_phb_of_node function
  in arch/arm/bios32.c this used a new .of_node field from sysdata.
  The idea being that pcibios_init_hw populates .of_node from a field
  of the same name provided by the driver in hw_pci.

* I believe Thierry's approach was to reuse the existing pcibios_get_phb_of_node
  function [2], to do this some changes were needed elsewhere I'm not sure the
  full details of this, I never got around to testing it. But I understand it's
  an approach that Thomas also used. It believe it requries a custom
  implementation of hw->scan such that instead of using pcibios_init_hw's default
  implementation of pci_scan_root_bus (which passes a NULL) your custom
  implementation calls pci_create_root_bus instead and passes a suitable struct
  device.

* I recall having some issues with weak symbols when playing around with
  pcibios_get_phb_of_node - there seems to be some changes in this area [3].

I don't think any of these solutions are ideal - perhaps pcibios_init_hw needs
to be changed... there are patches around which involve passing additional
private data in sys_data/hw_pci see [1] and [4] if this additional data
contains struct device or struct device_node then perhaps they can be plumbed
into the default call to pci_scan_root_bus in bios32? If every ARM DT host
bridge driver needs to implement their own scan function then something isn't
quite right.

I hope that helps.

Andrew Murray

[1] http://patchwork.ozlabs.org/patch/213570
[2] http://www.spinics.net/lists/linux-pci/msg19917.html
[3] http://patchwork1.kernel.org/patch/2394451
[4] http://patchwork.kernel.org/patch/2129431

  reply	other threads:[~2013-04-12  8:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1365087696-9548-1-git-send-email-linus.walleij@linaro.org>
     [not found] ` <1365087696-9548-2-git-send-email-linus.walleij@linaro.org>
     [not found]   ` <1365087696-9548-3-git-send-email-linus.walleij@linaro.org>
     [not found]     ` <1365087696-9548-4-git-send-email-linus.walleij@linaro.org>
     [not found]       ` <1365087696-9548-5-git-send-email-linus.walleij@linaro.org>
     [not found]         ` <1365087696-9548-6-git-send-email-linus.walleij@linaro.org>
     [not found]           ` <1365087696-9548-7-git-send-email-linus.walleij@linaro.org>
     [not found]             ` <1365087696-9548-8-git-send-email-linus.walleij@linaro.org>
     [not found]               ` <1365087696-9548-9-git-send-email-linus.walleij@linaro.org>
     [not found] ` <1365087696-9548-11-git-send-email-linus.walleij@linaro.org>
     [not found]   ` <1365087696-9548-12-git-send-email-linus.walleij@linaro.org>
2013-04-04 15:27     ` [PATCH 11/11] RFC: ARM: get PCI device IRQs from device tree Arnd Bergmann
2013-04-07 18:43       ` Linus Walleij
2013-04-11 20:27     ` Linus Walleij
2013-04-12  8:22       ` Andrew Murray [this message]
2013-04-12  8:51         ` Linus Walleij
2013-04-04 15:29 ` [PATCH 00/11] ARM: integrator PCI DT adaption Arnd Bergmann

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=20130412082229.GA30593@arm.com \
    --to=andrew.murray@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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