[PATCH SDK1.2 1/3] powerpc/fsl-pci: Unify pci/pcie initialization code

Kumar Gala galak at kernel.crashing.org
Sat Mar 17 05:58:46 EST 2012


On Feb 9, 2012, at 8:27 PM, Jia Hongtao-B38951 wrote:

> Hi Kumar,
> This series of patches have been pending for a long time.
> I'd like to know whether they are look good or not so I can do the further work on it.
> It's kind of emergency things for me.
> Thanks a lot for your attention.

I commented some time ago that the patches looked fine, but needed to be done for ALL the boards (include 86xx).

- k

> 
> -----Original Message-----
> From: Jia Hongtao-B38951 
> Sent: Tuesday, January 10, 2012 3:31 PM
> To: Gala Kumar-B11780
> Cc: Li Yang-R58472; Jia Hongtao-B38951; linuxppc-dev at lists.ozlabs.org
> Subject: RE: [PATCH SDK1.2 1/3] powerpc/fsl-pci: Unify pci/pcie initialization code
> 
> Hi Kumar,
> Do you have any idea on this series of patches?
> Looking forward to your answer.
> Thanks.
> 
> --Jia Hongtao.
> 
> -----Original Message-----
> From: Jia Hongtao-B38951
> Sent: Wednesday, December 21, 2011 3:11 PM
> To: linuxppc-dev at lists.ozlabs.org
> Cc: Li Yang-R58472; Gala Kumar-B11780; Jia Hongtao-B38951
> Subject: [PATCH SDK1.2 1/3] powerpc/fsl-pci: Unify pci/pcie initialization code
> 
> We unified the Freescale pci/pcie initialization by changing the fsl_pci to a platform driver.
> 
> In previous version pci/pcie initialization is in platform code which Initialize pci bridge base on EP/RC or host/agent settings.
> 
> Signed-off-by: Jia Hongtao <B38951 at freescale.com>
> Signed-off-by: Li Yang <leoli at freescale.com>
> ---
> arch/powerpc/platforms/85xx/p1022_ds.c |   39 +++++++----------------
> arch/powerpc/sysdev/fsl_pci.c          |   53 ++++++++++++++++++++++++++++++++
> 2 files changed, 65 insertions(+), 27 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/85xx/p1022_ds.c b/arch/powerpc/platforms/85xx/p1022_ds.c
> index 2bf4342..41de2c1 100644
> --- a/arch/powerpc/platforms/85xx/p1022_ds.c
> +++ b/arch/powerpc/platforms/85xx/p1022_ds.c
> @@ -277,32 +277,9 @@ void __init mpc85xx_smp_init(void);
>  */
> static void __init p1022_ds_setup_arch(void)  { -#ifdef CONFIG_PCI
> -	struct device_node *np;
> -#endif
> -	dma_addr_t max = 0xffffffff;
> -
> 	if (ppc_md.progress)
> 		ppc_md.progress("p1022_ds_setup_arch()", 0);
> 
> -#ifdef CONFIG_PCI
> -	for_each_compatible_node(np, "pci", "fsl,p1022-pcie") {
> -		struct resource rsrc;
> -		struct pci_controller *hose;
> -
> -		of_address_to_resource(np, 0, &rsrc);
> -
> -		if ((rsrc.start & 0xfffff) == 0x8000)
> -			fsl_add_bridge(np, 1);
> -		else
> -			fsl_add_bridge(np, 0);
> -
> -		hose = pci_find_hose_for_OF_device(np);
> -		max = min(max, hose->dma_window_base_cur +
> -			  hose->dma_window_size);
> -	}
> -#endif
> -
> #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
> 	diu_ops.get_pixel_format	= p1022ds_get_pixel_format;
> 	diu_ops.set_gamma_table		= p1022ds_set_gamma_table;
> @@ -316,11 +293,8 @@ static void __init p1022_ds_setup_arch(void)  #endif
> 
> #ifdef CONFIG_SWIOTLB
> -	if (memblock_end_of_DRAM() > max) {
> +	if (memblock_end_of_DRAM() > 0xffffffff)
> 		ppc_swiotlb_enable = 1;
> -		set_pci_dma_ops(&swiotlb_dma_ops);
> -		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
> -	}
> #endif
> 
> 	pr_info("Freescale P1022 DS reference board\n"); @@ -339,6 +313,17 @@ static int __init p1022_ds_publish_devices(void)  }  machine_device_initcall(p1022_ds, p1022_ds_publish_devices);
> 
> +static struct of_device_id __initdata p1022_pci_ids[] = {
> +	{ .compatible = "fsl,p1022-pcie", },
> +	{},
> +};
> +
> +static int __init p1022_ds_publish_pci_device(void) {
> +	return of_platform_bus_probe(NULL, p1022_pci_ids, NULL); } 
> +machine_arch_initcall(p1022_ds, p1022_ds_publish_pci_device);
> +
> machine_arch_initcall(p1022_ds, swiotlb_setup_bus_notifier);
> 
> /*
> diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c index 4ce547e..a0f305d 100644
> --- a/arch/powerpc/sysdev/fsl_pci.c
> +++ b/arch/powerpc/sysdev/fsl_pci.c
> @@ -712,3 +712,56 @@ u64 fsl_pci_immrbar_base(struct pci_controller *hose)
> 
> 	return 0;
> }
> +
> +static const struct of_device_id pci_ids[] = {
> +	{ .compatible = "fsl,mpc8540-pci", },
> +	{ .compatible = "fsl,mpc8548-pcie", },
> +	{ .compatible = "fsl,p1022-pcie", },
> +	{},
> +};
> +
> +static int __devinit fsl_pci_probe(struct platform_device *pdev) {
> +	struct pci_controller *hose;
> +
> +	if (of_match_node(pci_ids, pdev->dev.of_node)) {
> +		struct resource rsrc;
> +		of_address_to_resource(pdev->dev.of_node, 0, &rsrc);
> +		if ((rsrc.start & 0xfffff) == 8000)
> +			fsl_add_bridge(pdev->dev.of_node, 1);
> +		else
> +			fsl_add_bridge(pdev->dev.of_node, 0);
> +
> +#ifdef CONFIG_SWIOTLB
> +		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() > hose->dma_window_base_cur
> +				+ hose->dma_window_size) {
> +			ppc_swiotlb_enable = 1;
> +			set_pci_dma_ops(&swiotlb_dma_ops);
> +			ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
> +		}
> +#endif
> +
> +	}
> +
> +	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);
> --
> 1.7.5.1
> 



More information about the Linuxppc-dev mailing list