Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie initialization code

From: Scott Wood <[email-masked]>
Date: Thu, 2 Aug 2012 15:18:42 -0500

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 <[email-masked]>
> Signed-off-by: Li Yang <[email-masked]>
> Signed-off-by: Chunhe Lan <[email-masked]>
> ---
>  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