diff mbox

[V4,3/3] powerpc/fsl-pci: Unify pci/pcie initialization code

Message ID 1343907741-20589-4-git-send-email-B38951@freescale.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Hongtao Jia Aug. 2, 2012, 11:42 a.m. UTC
We unified the Freescale pci/pcie initialization by changing the fsl_pci
to a platform driver. In previous PCI code architecture the initialization
routine is called at board_setup_arch stage. Now the initialization is done
in probe function which is architectural better. Also It's convenient for
adding PM support for PCI controller in later patch.

Now we registered pci controllers as platform devices. So we combine two
initialization code as one platform driver.

Signed-off-by: Jia Hongtao <B38951@freescale.com>
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
---
 arch/powerpc/platforms/85xx/mpc85xx_ds.c |   32 ++--------
 arch/powerpc/sysdev/fsl_pci.c            |  102 ++++++++++++++++++-----------
 arch/powerpc/sysdev/fsl_pci.h            |    6 +-
 drivers/edac/mpc85xx_edac.c              |   43 ++++---------
 4 files changed, 83 insertions(+), 100 deletions(-)

Comments

Kumar Gala Aug. 2, 2012, 12:23 p.m. UTC | #1
On Aug 2, 2012, at 6:42 AM, Jia Hongtao wrote:

> We unified the Freescale pci/pcie initialization by changing the fsl_pci
> to a platform driver. In previous PCI code architecture the initialization
> routine is called at board_setup_arch stage. Now the initialization is done
> in probe function which is architectural better. Also It's convenient for
> adding PM support for PCI controller in later patch.
> 
> Now we registered pci controllers as platform devices. So we combine two
> initialization code as one platform driver.
> 
> Signed-off-by: Jia Hongtao <B38951@freescale.com>
> Signed-off-by: Li Yang <leoli@freescale.com>
> Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
> ---
> arch/powerpc/platforms/85xx/mpc85xx_ds.c |   32 ++--------
> arch/powerpc/sysdev/fsl_pci.c            |  102 ++++++++++++++++++-----------
> arch/powerpc/sysdev/fsl_pci.h            |    6 +-
> drivers/edac/mpc85xx_edac.c              |   43 ++++---------
> 4 files changed, 83 insertions(+), 100 deletions(-)

You need to convert all boards to use fsl_pci_init before this patch.  Otherwise we'll end up with PCI getting initialized twice on boards.

- k
Scott Wood Aug. 2, 2012, 3:59 p.m. UTC | #2
On 08/02/2012 07:23 AM, Kumar Gala wrote:
> You need to convert all boards to use fsl_pci_init before this patch.  Otherwise we'll end up with PCI getting initialized twice on boards.

Alternatively, don't make fsl_pci_init an initcall until all boards have
been converted.

-Scott
Scott Wood Aug. 2, 2012, 8:18 p.m. UTC | #3
On 08/02/2012 06:42 AM, Jia Hongtao wrote:
> We unified the Freescale pci/pcie initialization by changing the fsl_pci
> to a platform driver. In previous PCI code architecture the initialization
> routine is called at board_setup_arch stage. Now the initialization is done
> in probe function which is architectural better. Also It's convenient for
> adding PM support for PCI controller in later patch.
> 
> Now we registered pci controllers as platform devices. So we combine two
> initialization code as one platform driver.
> 
> Signed-off-by: Jia Hongtao <B38951@freescale.com>
> Signed-off-by: Li Yang <leoli@freescale.com>
> Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
> ---
>  arch/powerpc/platforms/85xx/mpc85xx_ds.c |   32 ++--------
>  arch/powerpc/sysdev/fsl_pci.c            |  102 ++++++++++++++++++-----------
>  arch/powerpc/sysdev/fsl_pci.h            |    6 +-
>  drivers/edac/mpc85xx_edac.c              |   43 ++++---------
>  4 files changed, 83 insertions(+), 100 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
> index 56f8c8f..f2c7b1c 100644
> --- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
> +++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
> @@ -20,7 +20,6 @@
>  #include <linux/seq_file.h>
>  #include <linux/interrupt.h>
>  #include <linux/of_platform.h>
> -#include <linux/memblock.h>
>  
>  #include <asm/time.h>
>  #include <asm/machdep.h>
> @@ -117,40 +116,16 @@ void __init mpc85xx_ds_pic_init(void)
>  extern int uli_exclude_device(struct pci_controller *hose,
>  				u_char bus, u_char devfn);
>  
> -static struct device_node *pci_with_uli;
> -
>  static int mpc85xx_exclude_device(struct pci_controller *hose,
>  				   u_char bus, u_char devfn)
>  {
> -	if (hose->dn == pci_with_uli)
> +	if (hose->dn == fsl_pci_primary)
>  		return uli_exclude_device(hose, bus, devfn);
>  
>  	return PCIBIOS_SUCCESSFUL;
>  }
>  #endif	/* CONFIG_PCI */
>  
> -static void __init mpc85xx_ds_pci_init(void)
> -{
> -#ifdef CONFIG_PCI
> -	struct device_node *node;
> -
> -	fsl_pci_init();
> -
> -	/* See if we have a ULI under the primary */
> -
> -	node = of_find_node_by_name(NULL, "uli1575");
> -	while ((pci_with_uli = of_get_parent(node))) {
> -		of_node_put(node);
> -		node = pci_with_uli;
> -
> -		if (pci_with_uli == fsl_pci_primary) {
> -			ppc_md.pci_exclude_device = mpc85xx_exclude_device;
> -			break;
> -		}
> -	}
> -#endif
> -}
> -
>  /*
>   * Setup the architecture
>   */
> @@ -159,8 +134,11 @@ static void __init mpc85xx_ds_setup_arch(void)
>  	if (ppc_md.progress)
>  		ppc_md.progress("mpc85xx_ds_setup_arch()", 0);
>  
> +#ifdef CONFIG_PCI
> +	ppc_md.pci_exclude_device = mpc85xx_exclude_device;
> +#endif

Why are you eliminating the uli lookup?  We don't want to call
uli_exclude_device on boards that don't have a uli.

-Scott
Hongtao Jia Aug. 3, 2012, 2:20 a.m. UTC | #4
> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Friday, August 03, 2012 4:19 AM
> To: Jia Hongtao-B38951
> Cc: linuxppc-dev@lists.ozlabs.org; galak@kernel.crashing.org; Wood Scott-
> B07421; Li Yang-R58472
> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
> initialization code
> 
> On 08/02/2012 06:42 AM, Jia Hongtao wrote:
> > We unified the Freescale pci/pcie initialization by changing the
> fsl_pci
> > to a platform driver. In previous PCI code architecture the
> initialization
> > routine is called at board_setup_arch stage. Now the initialization is
> done
> > in probe function which is architectural better. Also It's convenient
> for
> > adding PM support for PCI controller in later patch.
> >
> > Now we registered pci controllers as platform devices. So we combine
> two
> > initialization code as one platform driver.
> >
> > Signed-off-by: Jia Hongtao <B38951@freescale.com>
> > Signed-off-by: Li Yang <leoli@freescale.com>
> > Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
> > ---
> >  arch/powerpc/platforms/85xx/mpc85xx_ds.c |   32 ++--------
> >  arch/powerpc/sysdev/fsl_pci.c            |  102 ++++++++++++++++++----
> -------
> >  arch/powerpc/sysdev/fsl_pci.h            |    6 +-
> >  drivers/edac/mpc85xx_edac.c              |   43 ++++---------
> >  4 files changed, 83 insertions(+), 100 deletions(-)
> >
> > diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
> b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
> > index 56f8c8f..f2c7b1c 100644
> > --- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
> > +++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
> > @@ -20,7 +20,6 @@
> >  #include <linux/seq_file.h>
> >  #include <linux/interrupt.h>
> >  #include <linux/of_platform.h>
> > -#include <linux/memblock.h>
> >
> >  #include <asm/time.h>
> >  #include <asm/machdep.h>
> > @@ -117,40 +116,16 @@ void __init mpc85xx_ds_pic_init(void)
> >  extern int uli_exclude_device(struct pci_controller *hose,
> >  				u_char bus, u_char devfn);
> >
> > -static struct device_node *pci_with_uli;
> > -
> >  static int mpc85xx_exclude_device(struct pci_controller *hose,
> >  				   u_char bus, u_char devfn)
> >  {
> > -	if (hose->dn == pci_with_uli)
> > +	if (hose->dn == fsl_pci_primary)
> >  		return uli_exclude_device(hose, bus, devfn);
> >
> >  	return PCIBIOS_SUCCESSFUL;
> >  }
> >  #endif	/* CONFIG_PCI */
> >
> > -static void __init mpc85xx_ds_pci_init(void)
> > -{
> > -#ifdef CONFIG_PCI
> > -	struct device_node *node;
> > -
> > -	fsl_pci_init();
> > -
> > -	/* See if we have a ULI under the primary */
> > -
> > -	node = of_find_node_by_name(NULL, "uli1575");
> > -	while ((pci_with_uli = of_get_parent(node))) {
> > -		of_node_put(node);
> > -		node = pci_with_uli;
> > -
> > -		if (pci_with_uli == fsl_pci_primary) {
> > -			ppc_md.pci_exclude_device = mpc85xx_exclude_device;
> > -			break;
> > -		}
> > -	}
> > -#endif
> > -}
> > -
> >  /*
> >   * Setup the architecture
> >   */
> > @@ -159,8 +134,11 @@ static void __init mpc85xx_ds_setup_arch(void)
> >  	if (ppc_md.progress)
> >  		ppc_md.progress("mpc85xx_ds_setup_arch()", 0);
> >
> > +#ifdef CONFIG_PCI
> > +	ppc_md.pci_exclude_device = mpc85xx_exclude_device;
> > +#endif
> 
> Why are you eliminating the uli lookup?  We don't want to call
> uli_exclude_device on boards that don't have a uli.
> 
> -Scott

I found out that all 85xx_ds boards (mpc8572ds, mpc8544ds, p2020ds) have
ULI. Also in platform driver fsl_pci_primary is determined at arch_initcall
which means at the stage of board_setup_arch fsl_pci_primary is not ready.

-Hongtao.
Hongtao Jia Aug. 3, 2012, 3:39 a.m. UTC | #5
> -----Original Message-----
> From: Kumar Gala [mailto:galak@kernel.crashing.org]
> Sent: Thursday, August 02, 2012 8:24 PM
> To: Jia Hongtao-B38951
> Cc: linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li Yang-R58472
> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
> initialization code
> 
> 
> On Aug 2, 2012, at 6:42 AM, Jia Hongtao wrote:
> 
> > We unified the Freescale pci/pcie initialization by changing the
> fsl_pci
> > to a platform driver. In previous PCI code architecture the
> initialization
> > routine is called at board_setup_arch stage. Now the initialization is
> done
> > in probe function which is architectural better. Also It's convenient
> for
> > adding PM support for PCI controller in later patch.
> >
> > Now we registered pci controllers as platform devices. So we combine
> two
> > initialization code as one platform driver.
> >
> > Signed-off-by: Jia Hongtao <B38951@freescale.com>
> > Signed-off-by: Li Yang <leoli@freescale.com>
> > Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
> > ---
> > arch/powerpc/platforms/85xx/mpc85xx_ds.c |   32 ++--------
> > arch/powerpc/sysdev/fsl_pci.c            |  102 ++++++++++++++++++-----
> ------
> > arch/powerpc/sysdev/fsl_pci.h            |    6 +-
> > drivers/edac/mpc85xx_edac.c              |   43 ++++---------
> > 4 files changed, 83 insertions(+), 100 deletions(-)
> 
> You need to convert all boards to use fsl_pci_init before this patch.
> Otherwise we'll end up with PCI getting initialized twice on boards.
> 
> - k

If we covert all boards with platform driver in this patch PCI will
be initialized only once without converting all boards to use
fsl_pci_init first. 

If we convert all boards to use fsl_pci_init before this patch and
convert them to use platform driver again after this patch. Then
between this patch and next pci will be initialized twice too.

So I think convert all boards in this patch is the key not convert
all boards to use fsl_pci_init first before this patch.

-Hongtao.
Scott Wood Aug. 3, 2012, 4:03 p.m. UTC | #6
On 08/02/2012 10:39 PM, Jia Hongtao-B38951 wrote:
> 
> 
>> -----Original Message-----
>> From: Kumar Gala [mailto:galak@kernel.crashing.org]
>> Sent: Thursday, August 02, 2012 8:24 PM
>> To: Jia Hongtao-B38951
>> Cc: linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li Yang-R58472
>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>> initialization code
>>
>> You need to convert all boards to use fsl_pci_init before this patch.
>> Otherwise we'll end up with PCI getting initialized twice on boards.
>>
>> - k
> 
> If we covert all boards with platform driver in this patch PCI will
> be initialized only once without converting all boards to use
> fsl_pci_init first. 

Then we'd have to pick apart core changes from board changes when reviewing.

> If we convert all boards to use fsl_pci_init before this patch and
> convert them to use platform driver again after this patch. Then
> between this patch and next pci will be initialized twice too.

Why?  That one patch should both create the platform driver and remove
the init from fsl_pci_init() -- except things like primary bus detection
which has to happen globally.

-Scott
Scott Wood Aug. 3, 2012, 4:09 p.m. UTC | #7
On 08/02/2012 09:20 PM, Jia Hongtao-B38951 wrote:
> 
> 
>> -----Original Message-----
>> From: Wood Scott-B07421
>> Sent: Friday, August 03, 2012 4:19 AM
>> To: Jia Hongtao-B38951
>> Cc: linuxppc-dev@lists.ozlabs.org; galak@kernel.crashing.org; Wood Scott-
>> B07421; Li Yang-R58472
>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>> initialization code
>>
>> Why are you eliminating the uli lookup?  We don't want to call
>> uli_exclude_device on boards that don't have a uli.
>>
>> -Scott
> 
> I found out that all 85xx_ds boards (mpc8572ds, mpc8544ds, p2020ds) have
> ULI.

Perhaps all boards currently handled by this file do, but it's not true
for all mpc85xx_ds boards.  I think we could handle mpc8536ds here if we
didn't hardcode the uli assumption.  Not critical, but would be nice to
make this more device tree driven.

p1022ds OTOH is weird enough that it deserves its own board file.

> Also in platform driver fsl_pci_primary is determined at arch_initcall
> which means at the stage of board_setup_arch fsl_pci_primary is not ready.

You could export the primary detection function so that boards can call
it early if they want.

-Scott
Hongtao Jia Aug. 6, 2012, 2:39 a.m. UTC | #8
> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Saturday, August 04, 2012 12:04 AM
> To: Jia Hongtao-B38951
> Cc: Kumar Gala; linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li
> Yang-R58472
> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
> initialization code
> 
> On 08/02/2012 10:39 PM, Jia Hongtao-B38951 wrote:
> >
> >
> >> -----Original Message-----
> >> From: Kumar Gala [mailto:galak@kernel.crashing.org]
> >> Sent: Thursday, August 02, 2012 8:24 PM
> >> To: Jia Hongtao-B38951
> >> Cc: linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li Yang-R58472
> >> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
> >> initialization code
> >>
> >> You need to convert all boards to use fsl_pci_init before this patch.
> >> Otherwise we'll end up with PCI getting initialized twice on boards.
> >>
> >> - k
> >
> > If we covert all boards with platform driver in this patch PCI will
> > be initialized only once without converting all boards to use
> > fsl_pci_init first.
> 
> Then we'd have to pick apart core changes from board changes when
> reviewing.
> 
> > If we convert all boards to use fsl_pci_init before this patch and
> > convert them to use platform driver again after this patch. Then
> > between this patch and next pci will be initialized twice too.
> 
> Why?  That one patch should both create the platform driver and remove
> the init from fsl_pci_init() -- except things like primary bus detection
> which has to happen globally.
> 
> -Scott

"One patch both create the platform driver and remove the init from
fsl_pci_init()" means we should create platform driver and applied to
all boards. If so why not just directly convert all boards using platform
driver? Now in this one patch we create platform driver and remove
fsl_pci_init() from the boards that using it and convert all other boards
that still using old ways. I think it's clear and right.

-Hongtao.
Tabi Timur-B04825 Aug. 6, 2012, 4:11 a.m. UTC | #9
On Fri, Aug 3, 2012 at 11:09 AM, Scott Wood <scottwood@freescale.com> wrote:

> p1022ds OTOH is weird enough that it deserves its own board file.

What's so weird about the P1022DS?

Also, why do we need a default PCI bus if one isn't specified in the
device tree?
Scott Wood Aug. 6, 2012, 2:03 p.m. UTC | #10
On 08/05/2012 11:11 PM, Tabi Timur-B04825 wrote:
> On Fri, Aug 3, 2012 at 11:09 AM, Scott Wood <scottwood@freescale.com> wrote:
> 
>> p1022ds OTOH is weird enough that it deserves its own board file.
> 
> What's so weird about the P1022DS?

The localbus muxing.

> Also, why do we need a default PCI bus if one isn't specified in the
> device tree?

Because there are bugs in the Linux PPC PCI code when you don't have a
primary bus -- see recent upstream linuxppc-dev discussion.

-Scott
Scott Wood Aug. 6, 2012, 3:15 p.m. UTC | #11
On 08/05/2012 09:39 PM, Jia Hongtao-B38951 wrote:
> 
> 
>> -----Original Message-----
>> From: Wood Scott-B07421
>> Sent: Saturday, August 04, 2012 12:04 AM
>> To: Jia Hongtao-B38951
>> Cc: Kumar Gala; linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li
>> Yang-R58472
>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>> initialization code
>>
>> On 08/02/2012 10:39 PM, Jia Hongtao-B38951 wrote:
>>>
>>>
>>>> -----Original Message-----
>>>> From: Kumar Gala [mailto:galak@kernel.crashing.org]
>>>> Sent: Thursday, August 02, 2012 8:24 PM
>>>> To: Jia Hongtao-B38951
>>>> Cc: linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li Yang-R58472
>>>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>>>> initialization code
>>>>
>>>> You need to convert all boards to use fsl_pci_init before this patch.
>>>> Otherwise we'll end up with PCI getting initialized twice on boards.
>>>>
>>>> - k
>>>
>>> If we covert all boards with platform driver in this patch PCI will
>>> be initialized only once without converting all boards to use
>>> fsl_pci_init first.
>>
>> Then we'd have to pick apart core changes from board changes when
>> reviewing.
>>
>>> If we convert all boards to use fsl_pci_init before this patch and
>>> convert them to use platform driver again after this patch. Then
>>> between this patch and next pci will be initialized twice too.
>>
>> Why?  That one patch should both create the platform driver and remove
>> the init from fsl_pci_init() -- except things like primary bus detection
>> which has to happen globally.
>>
>> -Scott
> 
> "One patch both create the platform driver and remove the init from
> fsl_pci_init()" means we should create platform driver and applied to
> all boards. If so why not just directly convert all boards using platform
> driver?

Because it's harder to review when you have a bunch of board code in the
patch in addition to core changes.

Because you might want people to actually test on the boards in question
when converting, especially given the change in how primary buses are
determined, and that some boards may need to provide their own alternative.

-Scott
Hongtao Jia Aug. 7, 2012, 6:23 a.m. UTC | #12
> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Monday, August 06, 2012 11:16 PM
> To: Jia Hongtao-B38951
> Cc: Wood Scott-B07421; Kumar Gala; linuxppc-dev@lists.ozlabs.org; Li
> Yang-R58472
> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
> initialization code
> 
> On 08/05/2012 09:39 PM, Jia Hongtao-B38951 wrote:
> >
> >
> >> -----Original Message-----
> >> From: Wood Scott-B07421
> >> Sent: Saturday, August 04, 2012 12:04 AM
> >> To: Jia Hongtao-B38951
> >> Cc: Kumar Gala; linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li
> >> Yang-R58472
> >> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
> >> initialization code
> >>
> >> On 08/02/2012 10:39 PM, Jia Hongtao-B38951 wrote:
> >>>
> >>>
> >>>> -----Original Message-----
> >>>> From: Kumar Gala [mailto:galak@kernel.crashing.org]
> >>>> Sent: Thursday, August 02, 2012 8:24 PM
> >>>> To: Jia Hongtao-B38951
> >>>> Cc: linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li
> >>>> Yang-R58472
> >>>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
> >>>> initialization code
> >>>>
> >>>> You need to convert all boards to use fsl_pci_init before this patch.
> >>>> Otherwise we'll end up with PCI getting initialized twice on boards.
> >>>>
> >>>> - k
> >>>
> >>> If we covert all boards with platform driver in this patch PCI will
> >>> be initialized only once without converting all boards to use
> >>> fsl_pci_init first.
> >>
> >> Then we'd have to pick apart core changes from board changes when
> >> reviewing.
> >>
> >>> If we convert all boards to use fsl_pci_init before this patch and
> >>> convert them to use platform driver again after this patch. Then
> >>> between this patch and next pci will be initialized twice too.
> >>
> >> Why?  That one patch should both create the platform driver and
> >> remove the init from fsl_pci_init() -- except things like primary bus
> >> detection which has to happen globally.
> >>
> >> -Scott
> >
> > "One patch both create the platform driver and remove the init from
> > fsl_pci_init()" means we should create platform driver and applied to
> > all boards. If so why not just directly convert all boards using
> > platform driver?
> 
> Because it's harder to review when you have a bunch of board code in the
> patch in addition to core changes.
> 
> Because you might want people to actually test on the boards in question
> when converting, especially given the change in how primary buses are
> determined, and that some boards may need to provide their own
> alternative.
> 
> -Scott

But if we separate the core changes and the boards update, between this two
patches PCI will be initialized twice.

-Hongtao.
Scott Wood Aug. 7, 2012, 3:19 p.m. UTC | #13
On 08/07/2012 01:23 AM, Jia Hongtao-B38951 wrote:
>> -----Original Message-----
>> From: Wood Scott-B07421
>> Sent: Monday, August 06, 2012 11:16 PM
>> To: Jia Hongtao-B38951
>> Cc: Wood Scott-B07421; Kumar Gala; linuxppc-dev@lists.ozlabs.org; Li
>> Yang-R58472
>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>> initialization code
>>
>> On 08/05/2012 09:39 PM, Jia Hongtao-B38951 wrote:
>>>
>>>
>>>> -----Original Message-----
>>>> From: Wood Scott-B07421
>>>> Sent: Saturday, August 04, 2012 12:04 AM
>>>> To: Jia Hongtao-B38951
>>>> Cc: Kumar Gala; linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li
>>>> Yang-R58472
>>>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>>>> initialization code
>>>>
>>>> On 08/02/2012 10:39 PM, Jia Hongtao-B38951 wrote:
>>>>>
>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Kumar Gala [mailto:galak@kernel.crashing.org]
>>>>>> Sent: Thursday, August 02, 2012 8:24 PM
>>>>>> To: Jia Hongtao-B38951
>>>>>> Cc: linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li
>>>>>> Yang-R58472
>>>>>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>>>>>> initialization code
>>>>>>
>>>>>> You need to convert all boards to use fsl_pci_init before this patch.
>>>>>> Otherwise we'll end up with PCI getting initialized twice on boards.
>>>>>>
>>>>>> - k
>>>>>
>>>>> If we covert all boards with platform driver in this patch PCI will
>>>>> be initialized only once without converting all boards to use
>>>>> fsl_pci_init first.
>>>>
>>>> Then we'd have to pick apart core changes from board changes when
>>>> reviewing.
>>>>
>>>>> If we convert all boards to use fsl_pci_init before this patch and
>>>>> convert them to use platform driver again after this patch. Then
>>>>> between this patch and next pci will be initialized twice too.
>>>>
>>>> Why?  That one patch should both create the platform driver and
>>>> remove the init from fsl_pci_init() -- except things like primary bus
>>>> detection which has to happen globally.
>>>>
>>>> -Scott
>>>
>>> "One patch both create the platform driver and remove the init from
>>> fsl_pci_init()" means we should create platform driver and applied to
>>> all boards. If so why not just directly convert all boards using
>>> platform driver?
>>
>> Because it's harder to review when you have a bunch of board code in the
>> patch in addition to core changes.
>>
>> Because you might want people to actually test on the boards in question
>> when converting, especially given the change in how primary buses are
>> determined, and that some boards may need to provide their own
>> alternative.
>>
>> -Scott
> 
> But if we separate the core changes and the boards update, between this two
> patches PCI will be initialized twice.

As I said earlier, you can remove the initcall and require boards to
manually call fsl_pci_init() until all boards are converted.

-Scott
Hongtao Jia Aug. 8, 2012, 3:57 a.m. UTC | #14
> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Tuesday, August 07, 2012 11:20 PM
> To: Jia Hongtao-B38951
> Cc: Wood Scott-B07421; Kumar Gala; linuxppc-dev@lists.ozlabs.org; Li
> Yang-R58472
> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
> initialization code
> 
> On 08/07/2012 01:23 AM, Jia Hongtao-B38951 wrote:
> >> -----Original Message-----
> >> From: Wood Scott-B07421
> >> Sent: Monday, August 06, 2012 11:16 PM
> >> To: Jia Hongtao-B38951
> >> Cc: Wood Scott-B07421; Kumar Gala; linuxppc-dev@lists.ozlabs.org; Li
> >> Yang-R58472
> >> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
> >> initialization code
> >>
> >> On 08/05/2012 09:39 PM, Jia Hongtao-B38951 wrote:
> >>>
> >>>
> >>>> -----Original Message-----
> >>>> From: Wood Scott-B07421
> >>>> Sent: Saturday, August 04, 2012 12:04 AM
> >>>> To: Jia Hongtao-B38951
> >>>> Cc: Kumar Gala; linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li
> >>>> Yang-R58472
> >>>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
> >>>> initialization code
> >>>>
> >>>> On 08/02/2012 10:39 PM, Jia Hongtao-B38951 wrote:
> >>>>>
> >>>>>
> >>>>>> -----Original Message-----
> >>>>>> From: Kumar Gala [mailto:galak@kernel.crashing.org]
> >>>>>> Sent: Thursday, August 02, 2012 8:24 PM
> >>>>>> To: Jia Hongtao-B38951
> >>>>>> Cc: linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li
> >>>>>> Yang-R58472
> >>>>>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
> >>>>>> initialization code
> >>>>>>
> >>>>>> You need to convert all boards to use fsl_pci_init before this
> patch.
> >>>>>> Otherwise we'll end up with PCI getting initialized twice on
> boards.
> >>>>>>
> >>>>>> - k
> >>>>>
> >>>>> If we covert all boards with platform driver in this patch PCI will
> >>>>> be initialized only once without converting all boards to use
> >>>>> fsl_pci_init first.
> >>>>
> >>>> Then we'd have to pick apart core changes from board changes when
> >>>> reviewing.
> >>>>
> >>>>> If we convert all boards to use fsl_pci_init before this patch and
> >>>>> convert them to use platform driver again after this patch. Then
> >>>>> between this patch and next pci will be initialized twice too.
> >>>>
> >>>> Why?  That one patch should both create the platform driver and
> >>>> remove the init from fsl_pci_init() -- except things like primary
> bus
> >>>> detection which has to happen globally.
> >>>>
> >>>> -Scott
> >>>
> >>> "One patch both create the platform driver and remove the init from
> >>> fsl_pci_init()" means we should create platform driver and applied to
> >>> all boards. If so why not just directly convert all boards using
> >>> platform driver?
> >>
> >> Because it's harder to review when you have a bunch of board code in
> the
> >> patch in addition to core changes.
> >>
> >> Because you might want people to actually test on the boards in
> question
> >> when converting, especially given the change in how primary buses are
> >> determined, and that some boards may need to provide their own
> >> alternative.
> >>
> >> -Scott
> >
> > But if we separate the core changes and the boards update, between this
> two
> > patches PCI will be initialized twice.
> 
> As I said earlier, you can remove the initcall and require boards to
> manually call fsl_pci_init() until all boards are converted.
> 
> -Scott

As I said earlier, I can do this but it does not solve the twice-init problem.
If I do this first and then add platform driver we also have to convert all
boards using platform driver in the same patch.

We finally using the platform driver so Why do you keep insisting on converting
all boards using fsl_pci_init() first even it does no improvement.

-Hongtao.
Scott Wood Aug. 8, 2012, 3:53 p.m. UTC | #15
On 08/07/2012 10:57 PM, Jia Hongtao-B38951 wrote:
> 
> 
>> -----Original Message-----
>> From: Wood Scott-B07421
>> Sent: Tuesday, August 07, 2012 11:20 PM
>> To: Jia Hongtao-B38951
>> Cc: Wood Scott-B07421; Kumar Gala; linuxppc-dev@lists.ozlabs.org; Li
>> Yang-R58472
>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>> initialization code
>>
>> On 08/07/2012 01:23 AM, Jia Hongtao-B38951 wrote:
>>>> -----Original Message-----
>>>> From: Wood Scott-B07421
>>>> Sent: Monday, August 06, 2012 11:16 PM
>>>> To: Jia Hongtao-B38951
>>>> Cc: Wood Scott-B07421; Kumar Gala; linuxppc-dev@lists.ozlabs.org; Li
>>>> Yang-R58472
>>>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>>>> initialization code
>>>>
>>>> On 08/05/2012 09:39 PM, Jia Hongtao-B38951 wrote:
>>>>>
>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Wood Scott-B07421
>>>>>> Sent: Saturday, August 04, 2012 12:04 AM
>>>>>> To: Jia Hongtao-B38951
>>>>>> Cc: Kumar Gala; linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li
>>>>>> Yang-R58472
>>>>>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>>>>>> initialization code
>>>>>>
>>>>>> On 08/02/2012 10:39 PM, Jia Hongtao-B38951 wrote:
>>>>>>>
>>>>>>>
>>>>>>>> -----Original Message-----
>>>>>>>> From: Kumar Gala [mailto:galak@kernel.crashing.org]
>>>>>>>> Sent: Thursday, August 02, 2012 8:24 PM
>>>>>>>> To: Jia Hongtao-B38951
>>>>>>>> Cc: linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li
>>>>>>>> Yang-R58472
>>>>>>>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>>>>>>>> initialization code
>>>>>>>>
>>>>>>>> You need to convert all boards to use fsl_pci_init before this
>> patch.
>>>>>>>> Otherwise we'll end up with PCI getting initialized twice on
>> boards.
>>>>>>>>
>>>>>>>> - k
>>>>>>>
>>>>>>> If we covert all boards with platform driver in this patch PCI will
>>>>>>> be initialized only once without converting all boards to use
>>>>>>> fsl_pci_init first.
>>>>>>
>>>>>> Then we'd have to pick apart core changes from board changes when
>>>>>> reviewing.
>>>>>>
>>>>>>> If we convert all boards to use fsl_pci_init before this patch and
>>>>>>> convert them to use platform driver again after this patch. Then
>>>>>>> between this patch and next pci will be initialized twice too.
>>>>>>
>>>>>> Why?  That one patch should both create the platform driver and
>>>>>> remove the init from fsl_pci_init() -- except things like primary
>> bus
>>>>>> detection which has to happen globally.
>>>>>>
>>>>>> -Scott
>>>>>
>>>>> "One patch both create the platform driver and remove the init from
>>>>> fsl_pci_init()" means we should create platform driver and applied to
>>>>> all boards. If so why not just directly convert all boards using
>>>>> platform driver?
>>>>
>>>> Because it's harder to review when you have a bunch of board code in
>> the
>>>> patch in addition to core changes.
>>>>
>>>> Because you might want people to actually test on the boards in
>> question
>>>> when converting, especially given the change in how primary buses are
>>>> determined, and that some boards may need to provide their own
>>>> alternative.
>>>>
>>>> -Scott
>>>
>>> But if we separate the core changes and the boards update, between this
>> two
>>> patches PCI will be initialized twice.
>>
>> As I said earlier, you can remove the initcall and require boards to
>> manually call fsl_pci_init() until all boards are converted.
>>
>> -Scott
> 
> As I said earlier, I can do this but it does not solve the twice-init problem.

I must have missed it.  Why does it not solve the problem?  If a board
doesn't call fsl_pci_init(), the platform driver doesn't get registered.

> If I do this first and then add platform driver we also have to convert all
> boards using platform driver in the same patch.
> 
> We finally using the platform driver so Why do you keep insisting on converting
> all boards using fsl_pci_init() first even it does no improvement.

What we're asking for is bisectability (don't have any intermediate
stages where PCI gets initialized twice), and the ability to have a
smooth transition where boards can be converted as people are able to
test them and look into their individual needs regarding primary bus.

-Scott
Hongtao Jia Aug. 9, 2012, 3:52 a.m. UTC | #16
> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Wednesday, August 08, 2012 11:54 PM
> To: Jia Hongtao-B38951
> Cc: Wood Scott-B07421; Kumar Gala; linuxppc-dev@lists.ozlabs.org; Li
> Yang-R58472
> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
> initialization code
> 
> On 08/07/2012 10:57 PM, Jia Hongtao-B38951 wrote:
> >
> >
> >> -----Original Message-----
> >> From: Wood Scott-B07421
> >> Sent: Tuesday, August 07, 2012 11:20 PM
> >> To: Jia Hongtao-B38951
> >> Cc: Wood Scott-B07421; Kumar Gala; linuxppc-dev@lists.ozlabs.org; Li
> >> Yang-R58472
> >> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
> >> initialization code
> >>
> >> On 08/07/2012 01:23 AM, Jia Hongtao-B38951 wrote:
> >>>> -----Original Message-----
> >>>> From: Wood Scott-B07421
> >>>> Sent: Monday, August 06, 2012 11:16 PM
> >>>> To: Jia Hongtao-B38951
> >>>> Cc: Wood Scott-B07421; Kumar Gala; linuxppc-dev@lists.ozlabs.org;
> >>>> Li
> >>>> Yang-R58472
> >>>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
> >>>> initialization code
> >>>>
> >>>> On 08/05/2012 09:39 PM, Jia Hongtao-B38951 wrote:
> >>>>>
> >>>>>
> >>>>>> -----Original Message-----
> >>>>>> From: Wood Scott-B07421
> >>>>>> Sent: Saturday, August 04, 2012 12:04 AM
> >>>>>> To: Jia Hongtao-B38951
> >>>>>> Cc: Kumar Gala; linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421;
> >>>>>> Li
> >>>>>> Yang-R58472
> >>>>>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
> >>>>>> initialization code
> >>>>>>
> >>>>>> On 08/02/2012 10:39 PM, Jia Hongtao-B38951 wrote:
> >>>>>>>
> >>>>>>>
> >>>>>>>> -----Original Message-----
> >>>>>>>> From: Kumar Gala [mailto:galak@kernel.crashing.org]
> >>>>>>>> Sent: Thursday, August 02, 2012 8:24 PM
> >>>>>>>> To: Jia Hongtao-B38951
> >>>>>>>> Cc: linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li
> >>>>>>>> Yang-R58472
> >>>>>>>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
> >>>>>>>> initialization code
> >>>>>>>>
> >>>>>>>> You need to convert all boards to use fsl_pci_init before this
> >> patch.
> >>>>>>>> Otherwise we'll end up with PCI getting initialized twice on
> >> boards.
> >>>>>>>>
> >>>>>>>> - k
> >>>>>>>
> >>>>>>> If we covert all boards with platform driver in this patch PCI
> >>>>>>> will be initialized only once without converting all boards to
> >>>>>>> use fsl_pci_init first.
> >>>>>>
> >>>>>> Then we'd have to pick apart core changes from board changes when
> >>>>>> reviewing.
> >>>>>>
> >>>>>>> If we convert all boards to use fsl_pci_init before this patch
> >>>>>>> and convert them to use platform driver again after this patch.
> >>>>>>> Then between this patch and next pci will be initialized twice
> too.
> >>>>>>
> >>>>>> Why?  That one patch should both create the platform driver and
> >>>>>> remove the init from fsl_pci_init() -- except things like primary
> >> bus
> >>>>>> detection which has to happen globally.
> >>>>>>
> >>>>>> -Scott
> >>>>>
> >>>>> "One patch both create the platform driver and remove the init
> >>>>> from fsl_pci_init()" means we should create platform driver and
> >>>>> applied to all boards. If so why not just directly convert all
> >>>>> boards using platform driver?
> >>>>
> >>>> Because it's harder to review when you have a bunch of board code
> >>>> in
> >> the
> >>>> patch in addition to core changes.
> >>>>
> >>>> Because you might want people to actually test on the boards in
> >> question
> >>>> when converting, especially given the change in how primary buses
> >>>> are determined, and that some boards may need to provide their own
> >>>> alternative.
> >>>>
> >>>> -Scott
> >>>
> >>> But if we separate the core changes and the boards update, between
> >>> this
> >> two
> >>> patches PCI will be initialized twice.
> >>
> >> As I said earlier, you can remove the initcall and require boards to
> >> manually call fsl_pci_init() until all boards are converted.
> >>
> >> -Scott
> >
> > As I said earlier, I can do this but it does not solve the twice-init
> problem.
> 
> I must have missed it.  Why does it not solve the problem?  If a board
> doesn't call fsl_pci_init(), the platform driver doesn't get registered.
> 
> > If I do this first and then add platform driver we also have to
> > convert all boards using platform driver in the same patch.
> >
> > We finally using the platform driver so Why do you keep insisting on
> > converting all boards using fsl_pci_init() first even it does no
> improvement.
> 
> What we're asking for is bisectability (don't have any intermediate
> stages where PCI gets initialized twice), and the ability to have a
> smooth transition where boards can be converted as people are able to
> test them and look into their individual needs regarding primary bus.
> 
> -Scott

In my patch there is no bisectability problem. If you don't think so could
you please give more details?

-Hongtao.
Scott Wood Aug. 10, 2012, 10:59 p.m. UTC | #17
On 08/08/2012 10:52 PM, Jia Hongtao-B38951 wrote:
> 
> 
>> -----Original Message-----
>> From: Wood Scott-B07421
>> Sent: Wednesday, August 08, 2012 11:54 PM
>> To: Jia Hongtao-B38951
>> Cc: Wood Scott-B07421; Kumar Gala; linuxppc-dev@lists.ozlabs.org; Li
>> Yang-R58472
>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>> initialization code
>>
>> On 08/07/2012 10:57 PM, Jia Hongtao-B38951 wrote:
>>>
>>>
>>>> -----Original Message-----
>>>> From: Wood Scott-B07421
>>>> Sent: Tuesday, August 07, 2012 11:20 PM
>>>> To: Jia Hongtao-B38951
>>>> Cc: Wood Scott-B07421; Kumar Gala; linuxppc-dev@lists.ozlabs.org; Li
>>>> Yang-R58472
>>>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>>>> initialization code
>>>>
>>>> On 08/07/2012 01:23 AM, Jia Hongtao-B38951 wrote:
>>>>>> -----Original Message-----
>>>>>> From: Wood Scott-B07421
>>>>>> Sent: Monday, August 06, 2012 11:16 PM
>>>>>> To: Jia Hongtao-B38951
>>>>>> Cc: Wood Scott-B07421; Kumar Gala; linuxppc-dev@lists.ozlabs.org;
>>>>>> Li
>>>>>> Yang-R58472
>>>>>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>>>>>> initialization code
>>>>>>
>>>>>> On 08/05/2012 09:39 PM, Jia Hongtao-B38951 wrote:
>>>>>>>
>>>>>>>
>>>>>>>> -----Original Message-----
>>>>>>>> From: Wood Scott-B07421
>>>>>>>> Sent: Saturday, August 04, 2012 12:04 AM
>>>>>>>> To: Jia Hongtao-B38951
>>>>>>>> Cc: Kumar Gala; linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421;
>>>>>>>> Li
>>>>>>>> Yang-R58472
>>>>>>>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>>>>>>>> initialization code
>>>>>>>>
>>>>>>>> On 08/02/2012 10:39 PM, Jia Hongtao-B38951 wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> -----Original Message-----
>>>>>>>>>> From: Kumar Gala [mailto:galak@kernel.crashing.org]
>>>>>>>>>> Sent: Thursday, August 02, 2012 8:24 PM
>>>>>>>>>> To: Jia Hongtao-B38951
>>>>>>>>>> Cc: linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li
>>>>>>>>>> Yang-R58472
>>>>>>>>>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>>>>>>>>>> initialization code
>>>>>>>>>>
>>>>>>>>>> You need to convert all boards to use fsl_pci_init before this
>>>> patch.
>>>>>>>>>> Otherwise we'll end up with PCI getting initialized twice on
>>>> boards.
>>>>>>>>>>
>>>>>>>>>> - k
>>>>>>>>>
>>>>>>>>> If we covert all boards with platform driver in this patch PCI
>>>>>>>>> will be initialized only once without converting all boards to
>>>>>>>>> use fsl_pci_init first.
>>>>>>>>
>>>>>>>> Then we'd have to pick apart core changes from board changes when
>>>>>>>> reviewing.
>>>>>>>>
>>>>>>>>> If we convert all boards to use fsl_pci_init before this patch
>>>>>>>>> and convert them to use platform driver again after this patch.
>>>>>>>>> Then between this patch and next pci will be initialized twice
>> too.
>>>>>>>>
>>>>>>>> Why?  That one patch should both create the platform driver and
>>>>>>>> remove the init from fsl_pci_init() -- except things like primary
>>>> bus
>>>>>>>> detection which has to happen globally.
>>>>>>>>
>>>>>>>> -Scott
>>>>>>>
>>>>>>> "One patch both create the platform driver and remove the init
>>>>>>> from fsl_pci_init()" means we should create platform driver and
>>>>>>> applied to all boards. If so why not just directly convert all
>>>>>>> boards using platform driver?
>>>>>>
>>>>>> Because it's harder to review when you have a bunch of board code
>>>>>> in
>>>> the
>>>>>> patch in addition to core changes.
>>>>>>
>>>>>> Because you might want people to actually test on the boards in
>>>> question
>>>>>> when converting, especially given the change in how primary buses
>>>>>> are determined, and that some boards may need to provide their own
>>>>>> alternative.
>>>>>>
>>>>>> -Scott
>>>>>
>>>>> But if we separate the core changes and the boards update, between
>>>>> this
>>>> two
>>>>> patches PCI will be initialized twice.
>>>>
>>>> As I said earlier, you can remove the initcall and require boards to
>>>> manually call fsl_pci_init() until all boards are converted.
>>>>
>>>> -Scott
>>>
>>> As I said earlier, I can do this but it does not solve the twice-init
>> problem.
>>
>> I must have missed it.  Why does it not solve the problem?  If a board
>> doesn't call fsl_pci_init(), the platform driver doesn't get registered.
>>
>>> If I do this first and then add platform driver we also have to
>>> convert all boards using platform driver in the same patch.
>>>
>>> We finally using the platform driver so Why do you keep insisting on
>>> converting all boards using fsl_pci_init() first even it does no
>> improvement.
>>
>> What we're asking for is bisectability (don't have any intermediate
>> stages where PCI gets initialized twice), and the ability to have a
>> smooth transition where boards can be converted as people are able to
>> test them and look into their individual needs regarding primary bus.
>>
>> -Scott
> 
> In my patch there is no bisectability problem. If you don't think so could
> you please give more details?

You are registering the PCI platform device with an initcall, but you
haven't updated the unconverted boards to not do the init themselves --
and your proposal to fix that breaks the "smooth transition" request.

-Scott
diff mbox

Patch

diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index 56f8c8f..f2c7b1c 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -20,7 +20,6 @@ 
 #include <linux/seq_file.h>
 #include <linux/interrupt.h>
 #include <linux/of_platform.h>
-#include <linux/memblock.h>
 
 #include <asm/time.h>
 #include <asm/machdep.h>
@@ -117,40 +116,16 @@  void __init mpc85xx_ds_pic_init(void)
 extern int uli_exclude_device(struct pci_controller *hose,
 				u_char bus, u_char devfn);
 
-static struct device_node *pci_with_uli;
-
 static int mpc85xx_exclude_device(struct pci_controller *hose,
 				   u_char bus, u_char devfn)
 {
-	if (hose->dn == pci_with_uli)
+	if (hose->dn == fsl_pci_primary)
 		return uli_exclude_device(hose, bus, devfn);
 
 	return PCIBIOS_SUCCESSFUL;
 }
 #endif	/* CONFIG_PCI */
 
-static void __init mpc85xx_ds_pci_init(void)
-{
-#ifdef CONFIG_PCI
-	struct device_node *node;
-
-	fsl_pci_init();
-
-	/* See if we have a ULI under the primary */
-
-	node = of_find_node_by_name(NULL, "uli1575");
-	while ((pci_with_uli = of_get_parent(node))) {
-		of_node_put(node);
-		node = pci_with_uli;
-
-		if (pci_with_uli == fsl_pci_primary) {
-			ppc_md.pci_exclude_device = mpc85xx_exclude_device;
-			break;
-		}
-	}
-#endif
-}
-
 /*
  * Setup the architecture
  */
@@ -159,8 +134,11 @@  static void __init mpc85xx_ds_setup_arch(void)
 	if (ppc_md.progress)
 		ppc_md.progress("mpc85xx_ds_setup_arch()", 0);
 
+#ifdef CONFIG_PCI
+	ppc_md.pci_exclude_device = mpc85xx_exclude_device;
+#endif
+
 	swiotlb_detect_4g();
-	mpc85xx_ds_pci_init();
 	mpc85xx_smp_init();
 
 	printk("MPC85xx DS board from Freescale Semiconductor\n");
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index da7a3d7..6408d9d 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -826,54 +826,78 @@  static const struct of_device_id pci_ids[] = {
 
 struct device_node *fsl_pci_primary;
 
-void __devinit fsl_pci_init(void)
+/* Checkout if PCI contains ISA node */
+static int of_pci_has_isa(struct device_node *pci_node)
+{
+	struct device_node *np;
+	int ret = 0;
+
+	if (!pci_node)
+		return 0;
+
+	read_lock(&devtree_lock);
+	np = pci_node->allnext;
+
+	/* Only scan the children of PCI node */
+	for (; np != pci_node->sibling; np = np->allnext) {
+		if (np->type && (of_node_cmp(np->type, "isa") == 0)
+		    && of_node_get(np)) {
+			ret = 1;
+			break;
+		}
+	}
+
+	of_node_put(pci_node);
+	read_unlock(&devtree_lock);
+
+	return ret;
+}
+
+static int __devinit fsl_pci_probe(struct platform_device *pdev)
 {
 	int ret;
-	struct device_node *node;
 	struct pci_controller *hose;
-	dma_addr_t max = 0xffffffff;
+	int is_primary = 0;
 
-	/* Callers can specify the primary bus using other means. */
 	if (!fsl_pci_primary) {
-		/* If a PCI host bridge contains an ISA node, it's primary. */
-		node = of_find_node_by_type(NULL, "isa");
-		while ((fsl_pci_primary = of_get_parent(node))) {
-			of_node_put(node);
-			node = fsl_pci_primary;
-
-			if (of_match_node(pci_ids, node))
-				break;
-		}
+		is_primary = of_pci_has_isa(pdev->dev.of_node);
+		if (is_primary)
+			fsl_pci_primary = pdev->dev.of_node;
 	}
 
-	node = NULL;
-	for_each_node_by_type(node, "pci") {
-		if (of_match_node(pci_ids, node)) {
-			/*
-			 * If there's no PCI host bridge with ISA, arbitrarily
-			 * designate one as primary.  This can go away once
-			 * various bugs with primary-less systems are fixed.
-			 */
-			if (!fsl_pci_primary)
-				fsl_pci_primary = node;
-
-			ret = fsl_add_bridge(node, fsl_pci_primary == node);
-			if (ret == 0) {
-				hose = pci_find_hose_for_OF_device(node);
-				max = min(max, hose->dma_window_base_cur +
-						hose->dma_window_size);
-			}
-		}
-	}
+	ret = fsl_add_bridge(pdev->dev.of_node, is_primary);
 
 #ifdef CONFIG_SWIOTLB
-	/*
-	 * if we couldn't map all of DRAM via the dma windows
-	 * we need SWIOTLB to handle buffers located outside of
-	 * dma capable memory region
-	 */
-	if (memblock_end_of_DRAM() - 1 > max)
-		ppc_swiotlb_enable = 1;
+	if (ret == 0) {
+		hose = pci_find_hose_for_OF_device(pdev->dev.of_node);
+
+		/*
+		 * if we couldn't map all of DRAM via the dma windows
+		 * we need SWIOTLB to handle buffers located outside of
+		 * dma capable memory region
+		 */
+		if (memblock_end_of_DRAM() - 1 > hose->dma_window_base_cur +
+				hose->dma_window_size)
+			ppc_swiotlb_enable = 1;
+	}
 #endif
+
+	mpc85xx_pci_err_probe(pdev);
+
+	return 0;
+}
+
+static struct platform_driver fsl_pci_driver = {
+	.driver = {
+		.name = "fsl-pci",
+		.of_match_table = pci_ids,
+	},
+	.probe = fsl_pci_probe,
+};
+
+static int __init fsl_pci_init(void)
+{
+	return platform_driver_register(&fsl_pci_driver);
 }
+arch_initcall(fsl_pci_init);
 #endif
diff --git a/arch/powerpc/sysdev/fsl_pci.h b/arch/powerpc/sysdev/fsl_pci.h
index baa0fd1..e3fcc6c 100644
--- a/arch/powerpc/sysdev/fsl_pci.h
+++ b/arch/powerpc/sysdev/fsl_pci.h
@@ -95,10 +95,10 @@  u64 fsl_pci_immrbar_base(struct pci_controller *hose);
 
 extern struct device_node *fsl_pci_primary;
 
-#ifdef CONFIG_FSL_PCI
-void fsl_pci_init(void);
+#ifdef CONFIG_EDAC_MPC85XX
+int mpc85xx_pci_err_probe(struct platform_device *op);
 #else
-static inline void fsl_pci_init(void) {}
+static inline int mpc85xx_pci_err_probe(struct platform_device *op) {}
 #endif
 
 #endif /* __POWERPC_FSL_PCI_H */
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
index 0e37462..2677883 100644
--- a/drivers/edac/mpc85xx_edac.c
+++ b/drivers/edac/mpc85xx_edac.c
@@ -200,7 +200,7 @@  static irqreturn_t mpc85xx_pci_isr(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static int __devinit mpc85xx_pci_err_probe(struct platform_device *op)
+int __devinit mpc85xx_pci_err_probe(struct platform_device *op)
 {
 	struct edac_pci_ctl_info *pci;
 	struct mpc85xx_pci_pdata *pdata;
@@ -214,6 +214,16 @@  static int __devinit mpc85xx_pci_err_probe(struct platform_device *op)
 	if (!pci)
 		return -ENOMEM;
 
+	/* make sure error reporting method is sane */
+	switch (edac_op_state) {
+	case EDAC_OPSTATE_POLL:
+	case EDAC_OPSTATE_INT:
+		break;
+	default:
+		edac_op_state = EDAC_OPSTATE_INT;
+		break;
+	}
+
 	pdata = pci->pvt_info;
 	pdata->name = "mpc85xx_pci_err";
 	pdata->irq = NO_IRQ;
@@ -303,6 +313,7 @@  err:
 	devres_release_group(&op->dev, mpc85xx_pci_err_probe);
 	return res;
 }
+EXPORT_SYMBOL_GPL(mpc85xx_pci_err_probe);
 
 static int mpc85xx_pci_err_remove(struct platform_device *op)
 {
@@ -326,27 +337,6 @@  static int mpc85xx_pci_err_remove(struct platform_device *op)
 	return 0;
 }
 
-static struct of_device_id mpc85xx_pci_err_of_match[] = {
-	{
-	 .compatible = "fsl,mpc8540-pcix",
-	 },
-	{
-	 .compatible = "fsl,mpc8540-pci",
-	},
-	{},
-};
-MODULE_DEVICE_TABLE(of, mpc85xx_pci_err_of_match);
-
-static struct platform_driver mpc85xx_pci_err_driver = {
-	.probe = mpc85xx_pci_err_probe,
-	.remove = __devexit_p(mpc85xx_pci_err_remove),
-	.driver = {
-		.name = "mpc85xx_pci_err",
-		.owner = THIS_MODULE,
-		.of_match_table = mpc85xx_pci_err_of_match,
-	},
-};
-
 #endif				/* CONFIG_PCI */
 
 /**************************** L2 Err device ***************************/
@@ -1193,12 +1183,6 @@  static int __init mpc85xx_mc_init(void)
 	if (res)
 		printk(KERN_WARNING EDAC_MOD_STR "L2 fails to register\n");
 
-#ifdef CONFIG_PCI
-	res = platform_driver_register(&mpc85xx_pci_err_driver);
-	if (res)
-		printk(KERN_WARNING EDAC_MOD_STR "PCI fails to register\n");
-#endif
-
 #ifdef CONFIG_FSL_SOC_BOOKE
 	pvr = mfspr(SPRN_PVR);
 
@@ -1235,9 +1219,6 @@  static void __exit mpc85xx_mc_exit(void)
 		on_each_cpu(mpc85xx_mc_restore_hid1, NULL, 0);
 	}
 #endif
-#ifdef CONFIG_PCI
-	platform_driver_unregister(&mpc85xx_pci_err_driver);
-#endif
 	platform_driver_unregister(&mpc85xx_l2_err_driver);
 	platform_driver_unregister(&mpc85xx_mc_err_driver);
 }