From: Li Li <r64360@freescale.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Wood Scott <scottwood@freescale.com>,
linuxppc-dev@ozlabs.org,
Phillips Kim <Kim.Phillips@freescale.com>,
Li Tony <Tony.Li@freescale.com>
Subject: Re: [PATCH] powerpc: Add MPC837x PCIE controller RC mode support
Date: Thu, 03 Jan 2008 14:40:40 +0800 [thread overview]
Message-ID: <1199342440.7375.29.camel@Guyver> (raw)
In-Reply-To: <200801021253.08280.arnd@arndb.de>
On Wed, 2008-01-02 at 19:53 +0800, Arnd Bergmann wrote:
> On Wednesday 02 January 2008, Li Li wrote:
> > #ifdef CONFIG_PCI
> > - for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
> > - mpc83xx_add_bridge(np);
> > + for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") {
> > + if (primary_pci_bus) {
> > + mpc83xx_add_bridge(np, PPC_83XX_PCI |
> PPC_83XX_PCI_PRIMARY);
> > + primary_pci_bus = 0;
> > + } else
> > + mpc83xx_add_bridge(np, PPC_83XX_PCI);
> > + }
> > +
> > + for_each_compatible_node(np, "pci", "fsl,mpc8377-pcie") {
> > + if (primary_pci_bus) {
> > + mpc83xx_add_bridge(np, PPC_83XX_PCIE |
> PPC_83XX_PCI_PRIMARY);
> > + primary_pci_bus = 0;
> > + } else
> > + mpc83xx_add_bridge(np, PPC_83XX_PCIE);
> > + }
> > +
> > + ppc_md.pci_exclude_device = mpc837x_exclude_device;
> > #endif
>
> A few comments on how I think this can be improved:
>
> * Instead of duplicating this code across all platforms, make a
> single
> function that does the probing in one place (including the #ifdef
> CONFIG_PCI).
>
This code appears in 834x board in first and then copied from one board
to another. It is a legacy issue. :(
Yes. it is the time to remove this duplicates.
> * Better yet, get rid of mpc83xx_add_bridge and make it possible for
> the
> mpc83xx code to use the of_pci_phb_driver from
> arch/powerpc/kernel/of_platform.c. This used to be impossible because
> of the differences between 32 and 64 bit code for PCI probing, but
> I think with the work than benh put into unifying the two, we should
> be pretty close now.
>
This is really a huge task and almost affects all exist boards. We need
more opinions in here.
> * The detection method for the primary bus is somewhat fragile,
> because
> we depend on the order of the nodes in the device tree, which is not
> specified to have a meaning. /Maybe/ there could be a property in
> (at most) one of the PCI host bridge nodes saying that this specific
> bus
> is the primary one.
>
Put this primary in code is more save than in dts.
The dts lacks error checking function. If provide error dts such as two
pci hosts both has primary property will occur chaos.
> * Since you are using exactly the same probing code for pci and pcie,
> you may want to check for a more generic "compatible" property than
> the specific model, so you can use the same code for both.
>
> Arnd <><
>
next prev parent reply other threads:[~2008-01-03 6:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-02 11:16 [PATCH] powerpc: Add MPC837x PCIE controller RC mode support Li Li
2008-01-02 11:53 ` Arnd Bergmann
2008-01-03 6:40 ` Li Li [this message]
2008-01-03 8:14 ` Arnd Bergmann
2008-01-03 8:31 ` Li Li
2008-01-03 10:14 ` Arnd Bergmann
2008-01-03 10:08 ` Li Li
2008-01-02 15:23 ` Kumar Gala
2008-01-03 5:56 ` Li Li
2008-01-02 15:51 ` Olof Johansson
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=1199342440.7375.29.camel@Guyver \
--to=r64360@freescale.com \
--cc=Kim.Phillips@freescale.com \
--cc=Tony.Li@freescale.com \
--cc=arnd@arndb.de \
--cc=linuxppc-dev@ozlabs.org \
--cc=scottwood@freescale.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).