powerpc/fsl-pci: Unify pci/pcie initialization code
Subsystems (2)
PATCH v2 1/4 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.
--- arch/powerpc/sysdev/fsl_pci.c | 59 +++++++++++++++++++++++++++++++++++++++++ arch/powerpc/sysdev/fsl_pci.h | 1 + 2 files changed, 60 insertions(+), 0 deletions(-)
arch/powerpc/sysdev/fsl_pci.c +59 -0
@@ -807,3 +807,62 @@ 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,mpc8641-pcie" , }, + { .compatible ="fsl,p1022-pcie" , }, + { .compatible ="fsl,p1010-pcie" , }, + { .compatible ="fsl,p1023-pcie" , }, + { .compatible ="fsl,p4080-pcie" , }, + { .compatible ="fsl,qoriq-pcie-v2.3" , }, + { .compatible ="fsl,qoriq-pcie-v2.2" , }, + {}, +}; + +int primary_phb_addr; +static int __devinit fsl_pci_probe (struct platform_device *pdev) +{ +struct pci_controller *hose; +int ret; +bool is_primary; + +if (of_match_node (pci_ids, pdev->dev.of_node)) { +struct resource rsrc; +of_address_to_resource (pdev->dev.of_node,0 , &rsrc); + is_primary = ((rsrc.start &0xfffff ) == primary_phb_addr); + ret =fsl_add_bridge (pdev->dev.of_node, is_primary); + +#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);
arch/powerpc/sysdev/fsl_pci.h +1 -0
@@ -88,6 +88,7 @@ struct ccsr_pci {__be32 pex_err_cap_r3;/* 0x.e34 - PCIE error capture register 0 */ }; +extern int primary_phb_addr;extern int fsl_add_bridge (struct device_node *dev,int is_primary);extern void fsl_pcibios_fixup_bus (struct pci_bus *bus);extern int mpc83xx_add_bridge (struct device_node *dev);
Signature · 1 line
1.7.5.1
PATCH v2 2/4 powerpc/fsl-pci: Using common pci/pcie initialization for all boards
Including all 85xx and 86xx platforms.
--- arch/powerpc/platforms/85xx/common.c | 18 ++++++++ arch/powerpc/platforms/85xx/corenet_ds.c | 27 +------------ arch/powerpc/platforms/85xx/corenet_ds.h | 1 + arch/powerpc/platforms/85xx/ge_imp3a.c | 34 +-------------- arch/powerpc/platforms/85xx/mpc8536_ds.c | 40 ++++------------- arch/powerpc/platforms/85xx/mpc85xx.h | 1 + arch/powerpc/platforms/85xx/mpc85xx_ads.c | 17 ++++---- arch/powerpc/platforms/85xx/mpc85xx_cds.c | 24 ++++------ arch/powerpc/platforms/85xx/mpc85xx_ds.c | 33 ++------------ arch/powerpc/platforms/85xx/mpc85xx_mds.c | 62 +++++++++++++-------------- arch/powerpc/platforms/85xx/mpc85xx_rdb.c | 13 ++---- arch/powerpc/platforms/85xx/p1010rdb.c | 13 +----- arch/powerpc/platforms/85xx/p1022_ds.c | 29 +------------ arch/powerpc/platforms/85xx/p1023_rds.c | 6 +-- arch/powerpc/platforms/85xx/p2041_rdb.c | 1 + arch/powerpc/platforms/85xx/p3041_ds.c | 1 + arch/powerpc/platforms/85xx/p3060_qds.c | 1 + arch/powerpc/platforms/85xx/p4080_ds.c | 1 + arch/powerpc/platforms/85xx/p5020_ds.c | 1 + arch/powerpc/platforms/85xx/sbc8548.c | 27 ++++-------- arch/powerpc/platforms/85xx/sbc8560.c | 19 ++++---- arch/powerpc/platforms/85xx/socrates.c | 16 +++---- arch/powerpc/platforms/85xx/stx_gp3.c | 19 ++++---- arch/powerpc/platforms/85xx/tqm85xx.c | 29 ++++--------- arch/powerpc/platforms/85xx/xes_mpc85xx.c | 25 ++--------- arch/powerpc/platforms/86xx/gef_ppc9a.c | 24 +++++++---- arch/powerpc/platforms/86xx/gef_sbc310.c | 24 +++++++---- arch/powerpc/platforms/86xx/gef_sbc610.c | 24 +++++++---- arch/powerpc/platforms/86xx/mpc8610_hpcd.c | 31 +++++++------- arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 45 +++++++------------- arch/powerpc/platforms/86xx/sbc8641d.c | 20 +++++---- 31 files changed, 237 insertions(+), 389 deletions(-)
arch/powerpc/platforms/85xx/common.c +18 -0
@@ -28,6 +28,24 @@ int __init mpc85xx_common_publish_devices(void) {return of_platform_bus_probe (NULL , mpc85xx_common_ids,NULL ); } + +static struct of_device_id __initdata mpc85xx_pci_ids[] = { + { .compatible ="fsl,mpc8540-pci" , }, + { .compatible ="fsl,mpc8548-pcie" , }, + { .compatible ="fsl,p1022-pcie" , }, + { .compatible ="fsl,p1010-pcie" , }, + { .compatible ="fsl,p1023-pcie" , }, + { .compatible ="fsl,p4080-pcie" , }, + { .compatible ="fsl,qoriq-pcie-v2.3" , }, + { .compatible ="fsl,qoriq-pcie-v2.2" , }, + {}, +}; + +int __init mpc85xx_pci_publish_devices (void ) +{ +return of_platform_bus_probe (NULL , mpc85xx_pci_ids,NULL ); +} +#ifdef CONFIG_CPM2 static void cpm2_cascade (unsigned int irq,struct irq_desc *desc) {
arch/powerpc/platforms/85xx/corenet_ds.c +1 -26
@@ -53,36 +53,17 @@ void __init corenet_ds_pic_init(void)*/ void __init corenet_ds_setup_arch (void ) { -#ifdef CONFIG_PCI -struct device_node *np; -struct pci_controller *hose; -#endif -dma_addr_t max =0xffffffff ; -mpc85xx_smp_init ();#ifdef CONFIG_PCI -for_each_node_by_type (np,"pci" ) { -if (of_device_is_compatible (np,"fsl,p4080-pcie" ) || -of_device_is_compatible (np,"fsl,qoriq-pcie-v2.2" )) { -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); - } - } -#ifdef CONFIG_PPC64 pci_devs_phb_init ();#endif #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 ("%s board from Freescale Semiconductor\n" , ppc_md.name); }
@@ -94,12 +75,6 @@ static const struct of_device_id of_device_ids[] __devinitconst = { { .compatible = "fsl,srio", }, - { - .compatible = "fsl,p4080-pcie", - }, - { - .compatible = "fsl,qoriq-pcie-v2.2", - },/* The following two are for the Freescale hypervisor */ { .name = "hypervisor",
arch/powerpc/platforms/85xx/corenet_ds.h +1 -0
@@ -15,5 +15,6 @@extern void __init corenet_ds_pic_init (void );extern void __init corenet_ds_setup_arch (void );extern int __init corenet_ds_publish_devices (void ); +extern int __init mpc85xx_pci_publish_devices (void );#endif
arch/powerpc/platforms/85xx/ge_imp3a.c +2 -32
@@ -85,52 +85,21 @@ void __init ge_imp3a_pic_init(void)of_node_put (cascade_node); } -#ifdef CONFIG_PCI -static int primary_phb_addr; -#endif /* CONFIG_PCI */ -/* * Setup the architecture */ static void __init ge_imp3a_setup_arch (void ) {struct device_node *regs; -#ifdef CONFIG_PCI -struct device_node *np; -struct pci_controller *hose; -#endif -dma_addr_t max =0xffffffff ;if (ppc_md.progress) ppc_md.progress ("ge_imp3a_setup_arch()" ,0 ); -#ifdef CONFIG_PCI -for_each_node_by_type (np,"pci" ) { -if (of_device_is_compatible (np,"fsl,mpc8540-pci" ) || -of_device_is_compatible (np,"fsl,mpc8548-pcie" ) || -of_device_is_compatible (np,"fsl,p2020-pcie" )) { -struct resource rsrc; -of_address_to_resource (np,0 , &rsrc); -if ((rsrc.start &0xfffff ) == primary_phb_addr) -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 -mpc85xx_smp_init ();#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 /* Remap basic board registers */
@@ -226,6 +195,7 @@ static int __init ge_imp3a_probe(void)return 0 ; } +machine_arch_initcall (p1022_ds, mpc85xx_pci_publish_devices);machine_device_initcall (ge_imp3a, mpc85xx_common_publish_devices);machine_arch_initcall (ge_imp3a, swiotlb_setup_bus_notifier);
arch/powerpc/platforms/85xx/mpc8536_ds.c +10 -30
@@ -47,40 +47,12 @@ void __init mpc8536_ds_pic_init(void)*/ static void __init mpc8536_ds_setup_arch (void ) { -#ifdef CONFIG_PCI -struct device_node *np; -struct pci_controller *hose; -#endif -dma_addr_t max =0xffffffff ; -if (ppc_md.progress) ppc_md.progress ("mpc8536_ds_setup_arch()" ,0 ); -#ifdef CONFIG_PCI -for_each_node_by_type (np,"pci" ) { -if (of_device_is_compatible (np,"fsl,mpc8540-pci" ) || -of_device_is_compatible (np,"fsl,mpc8548-pcie" )) { -struct resource rsrc; -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 -#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 printk ("MPC8536 DS board from Freescale Semiconductor\n" );
@@ -88,6 +60,7 @@ static void __init mpc8536_ds_setup_arch(void)machine_device_initcall (mpc8536_ds, mpc85xx_common_publish_devices); +machine_arch_initcall (mpc8536_ds, mpc85xx_pci_publish_devices);machine_arch_initcall (mpc8536_ds, swiotlb_setup_bus_notifier);/*
@@ -97,7 +70,14 @@ static int __init mpc8536_ds_probe(void) {unsigned long root =of_get_flat_dt_root (); -return of_flat_dt_is_compatible (root,"fsl,mpc8536ds" ); +if (of_flat_dt_is_compatible (root,"fsl,mpc8536ds" )) { +#ifdef CONFIG_PCI + primary_phb_addr =0x8000 ; +#endif +return 1 ; + } + +return 0 ; }define_machine (mpc8536_ds) {
arch/powerpc/platforms/85xx/mpc85xx.h +1 -0
@@ -1,6 +1,7 @@#ifndef MPC85xx_H#define MPC85xx_Hextern int mpc85xx_common_publish_devices (void ); +extern int mpc85xx_pci_publish_devices (void );#ifdef CONFIG_CPM2 extern void mpc85xx_cpm2_pic_init (void );
arch/powerpc/platforms/85xx/mpc85xx_ads.c +9 -8
@@ -138,10 +138,6 @@ static void __init init_ioports(void)static void __init mpc85xx_ads_setup_arch (void ) { -#ifdef CONFIG_PCI -struct device_node *np; -#endif -if (ppc_md.progress) ppc_md.progress ("mpc85xx_ads_setup_arch()" ,0 );
@@ -151,9 +147,6 @@ static void __init mpc85xx_ads_setup_arch(void)#endif #ifdef CONFIG_PCI -for_each_compatible_node (np,"pci" ,"fsl,mpc8540-pci" ) -fsl_add_bridge (np,1 ); - ppc_md.pci_exclude_device = mpc85xx_exclude_device;#endif }
@@ -174,6 +167,7 @@ static void mpc85xx_ads_show_cpuinfo(struct seq_file *m)seq_printf (m,"PLL setting\t: 0x%x\n" , ((phid1 >>24 ) &0x3f )); } +machine_arch_initcall (mpc85xx_ads, mpc85xx_pci_publish_devices);machine_device_initcall (mpc85xx_ads, mpc85xx_common_publish_devices);/*
@@ -183,7 +177,14 @@ static int __init mpc85xx_ads_probe(void) {unsigned long root =of_get_flat_dt_root (); -return of_flat_dt_is_compatible (root,"MPC85xxADS" ); +if (of_flat_dt_is_compatible (root,"MPC85xxADS" )) { +#ifdef CONFIG_PCI + primary_phb_addr =0x8000 ; +#endif +return 1 ; + } + +return 0 ; }define_machine (mpc85xx_ads) {
arch/powerpc/platforms/85xx/mpc85xx_cds.c +10 -14
@@ -310,18 +310,6 @@ static void __init mpc85xx_cds_setup_arch(void) }#ifdef CONFIG_PCI -for_each_node_by_type (np,"pci" ) { -if (of_device_is_compatible (np,"fsl,mpc8540-pci" ) || -of_device_is_compatible (np,"fsl,mpc8548-pcie" )) { -struct resource rsrc; -of_address_to_resource (np,0 , &rsrc); -if ((rsrc.start &0xfffff ) ==0x8000 ) -fsl_add_bridge (np,1 ); -else -fsl_add_bridge (np,0 ); - } - } - ppc_md.pci_irq_fixup = mpc85xx_cds_pci_irq_fixup; ppc_md.pci_exclude_device = mpc85xx_exclude_device;#endif
@@ -351,12 +339,20 @@ static void mpc85xx_cds_show_cpuinfo(struct seq_file *m)*/ static int __init mpc85xx_cds_probe (void ) { -unsigned long root =of_get_flat_dt_root (); +unsigned long root =of_get_flat_dt_root (); -return of_flat_dt_is_compatible (root,"MPC85xxCDS" ); +if (of_flat_dt_is_compatible (root,"MPC85xxCDS" )) { +#ifdef CONFIG_PCI + primary_phb_addr =0x8000 ; +#endif +return 1 ; + } + +return 0 ; }machine_device_initcall (mpc85xx_cds, mpc85xx_common_publish_devices); +machine_arch_initcall (mpc85xx_cds, mpc85xx_pci_publish_devices);define_machine (mpc85xx_cds) { .name = "MPC85xx CDS",
arch/powerpc/platforms/85xx/mpc85xx_ds.c +5 -28
@@ -115,7 +115,6 @@ void __init mpc85xx_ds_pic_init(void) }#ifdef CONFIG_PCI -static int primary_phb_addr;extern int uli_exclude_device (struct pci_controller *hose,u_char bus,u_char devfn);
@@ -141,44 +140,18 @@ static int mpc85xx_exclude_device(struct pci_controller *hose,*/ static void __init mpc85xx_ds_setup_arch (void ) { -#ifdef CONFIG_PCI -struct device_node *np; -struct pci_controller *hose; -#endif -dma_addr_t max =0xffffffff ; -if (ppc_md.progress) ppc_md.progress ("mpc85xx_ds_setup_arch()" ,0 );#ifdef CONFIG_PCI -for_each_node_by_type (np,"pci" ) { -if (of_device_is_compatible (np,"fsl,mpc8540-pci" ) || -of_device_is_compatible (np,"fsl,mpc8548-pcie" ) || -of_device_is_compatible (np,"fsl,p2020-pcie" )) { -struct resource rsrc; -of_address_to_resource (np,0 , &rsrc); -if ((rsrc.start &0xfffff ) == primary_phb_addr) -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); - } - } - ppc_md.pci_exclude_device = mpc85xx_exclude_device;#endif mpc85xx_smp_init ();#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 printk ("MPC85xx DS board from Freescale Semiconductor\n" );
@@ -205,6 +178,10 @@ machine_device_initcall(mpc8544_ds, mpc85xx_common_publish_devices);machine_device_initcall (mpc8572_ds, mpc85xx_common_publish_devices);machine_device_initcall (p2020_ds, mpc85xx_common_publish_devices); +machine_arch_initcall (mpc8544_ds, mpc85xx_pci_publish_devices); +machine_arch_initcall (mpc8572_ds, mpc85xx_pci_publish_devices); +machine_arch_initcall (p2020_ds, mpc85xx_pci_publish_devices); +machine_arch_initcall (mpc8544_ds, swiotlb_setup_bus_notifier);machine_arch_initcall (mpc8572_ds, swiotlb_setup_bus_notifier);machine_arch_initcall (p2020_ds, swiotlb_setup_bus_notifier);
arch/powerpc/platforms/85xx/mpc85xx_mds.c +30 -32
102 lines not on this page · raw message
arch/powerpc/platforms/85xx/mpc85xx_rdb.c +4 -9
@@ -87,21 +87,13 @@ void __init mpc85xx_rdb_pic_init(void)*/ static void __init mpc85xx_rdb_setup_arch (void ) { -#if defined(CONFIG_PCI ) || defined(CONFIG_QUICC_ENGINE ) +#ifdef CONFIG_QUICC_ENGINE struct device_node *np;#endif if (ppc_md.progress) ppc_md.progress ("mpc85xx_rdb_setup_arch()" ,0 ); -#ifdef CONFIG_PCI -for_each_node_by_type (np,"pci" ) { -if (of_device_is_compatible (np,"fsl,mpc8548-pcie" )) -fsl_add_bridge (np,0 ); - } - -#endif -mpc85xx_smp_init ();#ifdef CONFIG_QUICC_ENGINE
@@ -171,6 +163,9 @@ machine_device_initcall(p1020_utm_pc, mpc85xx_common_publish_devices);machine_device_initcall (p1021_rdb_pc, mpc85xx_common_publish_devices);machine_device_initcall (p1025_rdb, mpc85xx_common_publish_devices); +machine_arch_initcall (p2020_rdb, mpc85xx_pci_publish_devices); +machine_arch_initcall (p1020_rdb, mpc85xx_pci_publish_devices); +/* * Called very early, device-tree isn't unflattened */
arch/powerpc/platforms/85xx/p1010rdb.c +1 -12
@@ -47,25 +47,14 @@ void __init p1010_rdb_pic_init(void)*/ static void __init p1010_rdb_setup_arch (void ) { -#ifdef CONFIG_PCI -struct device_node *np; -#endif -if (ppc_md.progress) ppc_md.progress ("p1010_rdb_setup_arch()" ,0 ); -#ifdef CONFIG_PCI -for_each_node_by_type (np,"pci" ) { -if (of_device_is_compatible (np,"fsl,p1010-pcie" )) -fsl_add_bridge (np,0 ); - } - -#endif -printk (KERN_INFO "P1010 RDB board from Freescale Semiconductor\n" ); }machine_device_initcall (p1010_rdb, mpc85xx_common_publish_devices); +machine_arch_initcall (p1010_rdb, mpc85xx_pci_publish_devices);machine_arch_initcall (p1010_rdb, swiotlb_setup_bus_notifier);/*
arch/powerpc/platforms/85xx/p1022_ds.c +2 -27
@@ -385,32 +385,9 @@ early_param("video", early_video_setup);*/ 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;
@@ -450,11 +427,8 @@ static void __init p1022_ds_setup_arch(void)mpc85xx_smp_init ();#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" );
@@ -473,6 +447,7 @@ static int __init p1022_ds_publish_devices(void) }machine_device_initcall (p1022_ds, p1022_ds_publish_devices); +machine_arch_initcall (p1022_ds, mpc85xx_pci_publish_devices);machine_arch_initcall (p1022_ds, swiotlb_setup_bus_notifier);/*
arch/powerpc/platforms/85xx/p1023_rds.c +1 -5
@@ -81,15 +81,11 @@ static void __init mpc85xx_rds_setup_arch(void) } } -#ifdef CONFIG_PCI -for_each_compatible_node (np,"pci" ,"fsl,p1023-pcie" ) -fsl_add_bridge (np,0 ); -#endif -mpc85xx_smp_init (); }machine_device_initcall (p1023_rds, mpc85xx_common_publish_devices); +machine_arch_initcall (p1023_rds, mpc85xx_pci_publish_devices);static void __init mpc85xx_rds_pic_init (void ) {
arch/powerpc/platforms/85xx/p2041_rdb.c +1 -0
@@ -81,6 +81,7 @@ define_machine(p2041_rdb) { .power_save = e500_idle, }; +machine_arch_initcall (p2041_rdb, mpc85xx_pci_publish_devices);machine_device_initcall (p2041_rdb, corenet_ds_publish_devices);#ifdef CONFIG_SWIOTLB
arch/powerpc/platforms/85xx/p3041_ds.c +1 -0
@@ -83,6 +83,7 @@ define_machine(p3041_ds) { .power_save = e500_idle, }; +machine_arch_initcall (p3041_ds, mpc85xx_pci_publish_devices);machine_device_initcall (p3041_ds, corenet_ds_publish_devices);#ifdef CONFIG_SWIOTLB
arch/powerpc/platforms/85xx/p3060_qds.c +1 -0
@@ -70,6 +70,7 @@ define_machine(p3060_qds) { .power_save = e500_idle, }; +machine_arch_initcall (p3060_qds, mpc85xx_pci_publish_devices);machine_device_initcall (p3060_qds, corenet_ds_publish_devices);#ifdef CONFIG_SWIOTLB
arch/powerpc/platforms/85xx/p4080_ds.c +1 -0
@@ -82,6 +82,7 @@ define_machine(p4080_ds) { .power_save = e500_idle, }; +machine_arch_initcall (p4080_ds, mpc85xx_pci_publish_devices);machine_device_initcall (p4080_ds, corenet_ds_publish_devices);#ifdef CONFIG_SWIOTLB machine_arch_initcall (p4080_ds, swiotlb_setup_bus_notifier);
arch/powerpc/platforms/85xx/p5020_ds.c +1 -0
@@ -92,6 +92,7 @@ define_machine(p5020_ds) {#endif }; +machine_arch_initcall (p5020_ds, mpc85xx_pci_publish_devices);machine_device_initcall (p5020_ds, corenet_ds_publish_devices);#ifdef CONFIG_SWIOTLB
arch/powerpc/platforms/85xx/sbc8548.c +9 -18
@@ -89,26 +89,9 @@ static int __init sbc8548_hw_rev(void)*/ static void __init sbc8548_setup_arch (void ) { -#ifdef CONFIG_PCI -struct device_node *np; -#endif -if (ppc_md.progress) ppc_md.progress ("sbc8548_setup_arch()" ,0 ); -#ifdef CONFIG_PCI -for_each_node_by_type (np,"pci" ) { -if (of_device_is_compatible (np,"fsl,mpc8540-pci" ) || -of_device_is_compatible (np,"fsl,mpc8548-pcie" )) { -struct resource rsrc; -of_address_to_resource (np,0 , &rsrc); -if ((rsrc.start &0xfffff ) ==0x8000 ) -fsl_add_bridge (np,1 ); -else -fsl_add_bridge (np,0 ); - } - } -#endif sbc_rev =sbc8548_hw_rev (); }
@@ -129,6 +112,7 @@ static void sbc8548_show_cpuinfo(struct seq_file *m)seq_printf (m,"PLL setting\t: 0x%x\n" , ((phid1 >>24 ) &0x3f )); } +machine_arch_initcall (sbc8548, mpc85xx_pci_publish_devices);machine_device_initcall (sbc8548, mpc85xx_common_publish_devices);/*
@@ -138,7 +122,14 @@ static int __init sbc8548_probe(void) {unsigned long root =of_get_flat_dt_root (); -return of_flat_dt_is_compatible (root,"SBC8548" ); +if (of_flat_dt_is_compatible (root,"SBC8548" )) { +#ifdef CONFIG_PCI + primary_phb_addr =0x8000 ; +#endif +return 1 ; + } + +return 0 ; }define_machine (sbc8548) {
arch/powerpc/platforms/85xx/sbc8560.c +9 -10
@@ -127,10 +127,6 @@ static void __init init_ioports(void)static void __init sbc8560_setup_arch (void ) { -#ifdef CONFIG_PCI -struct device_node *np; -#endif -if (ppc_md.progress) ppc_md.progress ("sbc8560_setup_arch()" ,0 );
@@ -138,11 +134,6 @@ static void __init sbc8560_setup_arch(void)cpm2_reset ();init_ioports ();#endif - -#ifdef CONFIG_PCI -for_each_compatible_node (np,"pci" ,"fsl,mpc8540-pci" ) -fsl_add_bridge (np,1 ); -#endif }static void sbc8560_show_cpuinfo (struct seq_file *m)
@@ -161,6 +152,7 @@ static void sbc8560_show_cpuinfo(struct seq_file *m)seq_printf (m,"PLL setting\t: 0x%x\n" , ((phid1 >>24 ) &0x3f )); } +machine_arch_initcall (sbc8560, mpc85xx_pci_publish_devices);machine_device_initcall (sbc8560, mpc85xx_common_publish_devices);/*
@@ -170,7 +162,14 @@ static int __init sbc8560_probe(void) {unsigned long root =of_get_flat_dt_root (); -return of_flat_dt_is_compatible (root,"SBC8560" ); +if (of_flat_dt_is_compatible (root,"SBC8560" )) { +#ifdef CONFIG_PCI + primary_phb_addr =0x8000 ; +#endif +return 1 ; + } + +return 0 ; }#ifdef CONFIG_RTC_DRV_M48T59
arch/powerpc/platforms/85xx/socrates.c +6 -10
@@ -67,19 +67,11 @@ static void __init socrates_pic_init(void)*/ static void __init socrates_setup_arch (void ) { -#ifdef CONFIG_PCI -struct device_node *np; -#endif -if (ppc_md.progress) ppc_md.progress ("socrates_setup_arch()" ,0 ); - -#ifdef CONFIG_PCI -for_each_compatible_node (np,"pci" ,"fsl,mpc8540-pci" ) -fsl_add_bridge (np,1 ); -#endif } +machine_arch_initcall (socrates, mpc85xx_pci_publish_devices);machine_device_initcall (socrates, mpc85xx_common_publish_devices);/*
@@ -89,8 +81,12 @@ static int __init socrates_probe(void) {unsigned long root =of_get_flat_dt_root (); -if (of_flat_dt_is_compatible (root,"abb,socrates" )) +if (of_flat_dt_is_compatible (root,"abb,socrates" )) { +#ifdef CONFIG_PCI + primary_phb_addr =0x8000 ; +#endif return 1 ; + }return 0 ; }
arch/powerpc/platforms/85xx/stx_gp3.c +9 -10
@@ -61,21 +61,12 @@ static void __init stx_gp3_pic_init(void)*/ static void __init stx_gp3_setup_arch (void ) { -#ifdef CONFIG_PCI -struct device_node *np; -#endif -if (ppc_md.progress) ppc_md.progress ("stx_gp3_setup_arch()" ,0 );#ifdef CONFIG_CPM2 cpm2_reset ();#endif - -#ifdef CONFIG_PCI -for_each_compatible_node (np,"pci" ,"fsl,mpc8540-pci" ) -fsl_add_bridge (np,1 ); -#endif }static void stx_gp3_show_cpuinfo (struct seq_file *m)
@@ -94,6 +85,7 @@ static void stx_gp3_show_cpuinfo(struct seq_file *m)seq_printf (m,"PLL setting\t: 0x%x\n" , ((phid1 >>24 ) &0x3f )); } +machine_arch_initcall (stx_gp3, mpc85xx_pci_publish_devices);machine_device_initcall (stx_gp3, mpc85xx_common_publish_devices);/*
@@ -103,7 +95,14 @@ static int __init stx_gp3_probe(void) {unsigned long root =of_get_flat_dt_root (); -return of_flat_dt_is_compatible (root,"stx,gp3-8560" ); +if (of_flat_dt_is_compatible (root,"stx,gp3-8560" )) { +#ifdef CONFIG_PCI + primary_phb_addr =0x8000 ; +#endif +return 1 ; + } + +return 0 ; }define_machine (stx_gp3) {
arch/powerpc/platforms/85xx/tqm85xx.c +9 -20
@@ -60,31 +60,12 @@ static void __init tqm85xx_pic_init(void)*/ static void __init tqm85xx_setup_arch (void ) { -#ifdef CONFIG_PCI -struct device_node *np; -#endif -if (ppc_md.progress) ppc_md.progress ("tqm85xx_setup_arch()" ,0 );#ifdef CONFIG_CPM2 cpm2_reset ();#endif - -#ifdef CONFIG_PCI -for_each_node_by_type (np,"pci" ) { -if (of_device_is_compatible (np,"fsl,mpc8540-pci" ) || -of_device_is_compatible (np,"fsl,mpc8548-pcie" )) { -struct resource rsrc; -if (!of_address_to_resource (np,0 , &rsrc)) { -if ((rsrc.start &0xfffff ) ==0x8000 ) -fsl_add_bridge (np,1 ); -else -fsl_add_bridge (np,0 ); - } - } - } -#endif }static void tqm85xx_show_cpuinfo (struct seq_file *m)
@@ -124,6 +105,7 @@ static void __init tqm85xx_ti1520_fixup(struct pci_dev *pdev)DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_TI ,PCI_DEVICE_ID_TI_1520 , tqm85xx_ti1520_fixup); +machine_arch_initcall (tqm85xx, mpc85xx_pci_publish_devices);machine_device_initcall (tqm85xx, mpc85xx_common_publish_devices);static const char *board[]__initdata = {
@@ -140,7 +122,14 @@ static const char *board[] __initdata = {*/ static int __init tqm85xx_probe (void ) { -return of_flat_dt_match (of_get_flat_dt_root (), board); +if (of_flat_dt_match (of_get_flat_dt_root (), board)) { +#ifdef CONFIG_PCI + primary_phb_addr =0x8000 ; +#endif +return 1 ; + } + +return 0 ; }define_machine (tqm85xx) {
arch/powerpc/platforms/85xx/xes_mpc85xx.c +4 -21
@@ -112,18 +112,11 @@ static void xes_mpc85xx_fixups(void) } } -#ifdef CONFIG_PCI -static int primary_phb_addr; -#endif -/* * Setup the architecture */ static void __init xes_mpc85xx_setup_arch (void ) { -#ifdef CONFIG_PCI -struct device_node *np; -#endif struct device_node *root;const char *model ="Unknown" ;
@@ -138,20 +131,6 @@ static void __init xes_mpc85xx_setup_arch(void)xes_mpc85xx_fixups (); -#ifdef CONFIG_PCI -for_each_node_by_type (np,"pci" ) { -if (of_device_is_compatible (np,"fsl,mpc8540-pci" ) || -of_device_is_compatible (np,"fsl,mpc8548-pcie" )) { -struct resource rsrc; -of_address_to_resource (np,0 , &rsrc); -if ((rsrc.start &0xfffff ) == primary_phb_addr) -fsl_add_bridge (np,1 ); -else -fsl_add_bridge (np,0 ); - } - } -#endif -mpc85xx_smp_init (); }
@@ -159,6 +138,10 @@ machine_device_initcall(xes_mpc8572, mpc85xx_common_publish_devices);machine_device_initcall (xes_mpc8548, mpc85xx_common_publish_devices);machine_device_initcall (xes_mpc8540, mpc85xx_common_publish_devices); +machine_arch_initcall (xes_mpc8572, mpc85xx_pci_publish_devices); +machine_arch_initcall (xes_mpc8548, mpc85xx_pci_publish_devices); +machine_arch_initcall (xes_mpc8540, mpc85xx_pci_publish_devices); +/* * Called very early, device-tree isn't unflattened */
arch/powerpc/platforms/86xx/gef_ppc9a.c +16 -8
@@ -74,13 +74,6 @@ static void __init gef_ppc9a_init_irq(void)static void __init gef_ppc9a_setup_arch (void ) {struct device_node *regs; -#ifdef CONFIG_PCI -struct device_node *np; - -for_each_compatible_node (np,"pci" ,"fsl,mpc8641-pcie" ) { -fsl_add_bridge (np,1 ); - } -#endif printk (KERN_INFO "GE Intelligent Platforms PPC9A 6U VME SBC\n" );
@@ -197,8 +190,12 @@ static int __init gef_ppc9a_probe(void) {unsigned long root =of_get_flat_dt_root (); -if (of_flat_dt_is_compatible (root,"gef,ppc9a" )) +if (of_flat_dt_is_compatible (root,"gef,ppc9a" )) { +#ifdef CONFIG_PCI + primary_phb_addr =0x8000 ; +#endif return 1 ; + }return 0 ; }
@@ -219,6 +216,17 @@ static long __init mpc86xx_time_init(void)return 0 ; } +static struct of_device_id __initdata gef_ppc9a_pci_ids[] = { + { .compatible ="fsl,mpc8641-pcie" , }, + {}, +}; + +static int __init gef_ppc9a_publish_pci_device (void ) +{ +return of_platform_bus_probe (NULL , gef_ppc9a_pci_ids,NULL ); +} +machine_arch_initcall (gef_ppc9a, gef_ppc9a_publish_pci_device); +static __initdata struct of_device_id of_bus_ids[] = { { .compatible ="simple-bus" , }, { .compatible ="gianfar" , },
arch/powerpc/platforms/86xx/gef_sbc310.c +16 -8
@@ -74,13 +74,6 @@ static void __init gef_sbc310_init_irq(void)static void __init gef_sbc310_setup_arch (void ) {struct device_node *regs; -#ifdef CONFIG_PCI -struct device_node *np; - -for_each_compatible_node (np,"pci" ,"fsl,mpc8641-pcie" ) { -fsl_add_bridge (np,1 ); - } -#endif printk (KERN_INFO "GE Intelligent Platforms SBC310 6U VPX SBC\n" );
@@ -185,8 +178,12 @@ static int __init gef_sbc310_probe(void) {unsigned long root =of_get_flat_dt_root (); -if (of_flat_dt_is_compatible (root,"gef,sbc310" )) +if (of_flat_dt_is_compatible (root,"gef,sbc310" )) { +#ifdef CONFIG_PCI + primary_phb_addr =0x8000 ; +#endif return 1 ; + }return 0 ; }
@@ -207,6 +204,17 @@ static long __init mpc86xx_time_init(void)return 0 ; } +static struct of_device_id __initdata gef_sbc310_pci_ids[] = { + { .compatible ="fsl,mpc8641-pcie" , }, + {}, +}; + +static int __init gef_sbc310_publish_pci_device (void ) +{ +return of_platform_bus_probe (NULL , gef_sbc310_pci_ids,NULL ); +} +machine_arch_initcall (gef_sbc310, gef_sbc310_publish_pci_device); +static __initdata struct of_device_id of_bus_ids[] = { { .compatible ="simple-bus" , }, { .compatible ="gianfar" , },
arch/powerpc/platforms/86xx/gef_sbc610.c +16 -8
@@ -74,13 +74,6 @@ static void __init gef_sbc610_init_irq(void)static void __init gef_sbc610_setup_arch (void ) {struct device_node *regs; -#ifdef CONFIG_PCI -struct device_node *np; - -for_each_compatible_node (np,"pci" ,"fsl,mpc8641-pcie" ) { -fsl_add_bridge (np,1 ); - } -#endif printk (KERN_INFO "GE Intelligent Platforms SBC610 6U VPX SBC\n" );
@@ -174,8 +167,12 @@ static int __init gef_sbc610_probe(void) {unsigned long root =of_get_flat_dt_root (); -if (of_flat_dt_is_compatible (root,"gef,sbc610" )) +if (of_flat_dt_is_compatible (root,"gef,sbc610" )) { +#ifdef CONFIG_PCI + primary_phb_addr =0x8000 ; +#endif return 1 ; + }return 0 ; }
@@ -196,6 +193,17 @@ static long __init mpc86xx_time_init(void)return 0 ; } +static struct of_device_id __initdata gef_sbc610_pci_ids[] = { + { .compatible ="fsl,mpc8641-pcie" , }, + {}, +}; + +static int __init gef_sbc610_publish_pci_device (void ) +{ +return of_platform_bus_probe (NULL , gef_sbc610_pci_ids,NULL ); +} +machine_arch_initcall (gef_sbc610, gef_sbc610_publish_pci_device); +static __initdata struct of_device_id of_bus_ids[] = { { .compatible ="simple-bus" , }, { .compatible ="gianfar" , },
arch/powerpc/platforms/86xx/mpc8610_hpcd.c +16 -15
@@ -86,6 +86,17 @@ static void __init mpc8610_suspend_init(void)static inline void mpc8610_suspend_init (void ) { }#endif /* CONFIG_SUSPEND */ +static struct of_device_id __initdata mpc86xx_hpcd_pci_ids[] = { + { .compatible ="fsl,mpc8641-pcie" , }, + {}, +}; + +static int __init mpc86xx_hpcd_publish_pci_device (void ) +{ +return of_platform_bus_probe (NULL , mpc86xx_hpcd_pci_ids,NULL ); +} +machine_arch_initcall (mpc86xx_hpcd, mpc86xx_hpcd_publish_pci_device); +static struct of_device_id __initdata mpc8610_ids[] = { { .compatible ="fsl,mpc8610-immr" , }, { .compatible ="fsl,mpc8610-guts" , },
@@ -279,25 +290,11 @@ mpc8610hpcd_valid_monitor_port(enum fsl_diu_monitor_port port)static void __init mpc86xx_hpcd_setup_arch (void ) {struct resource r; -struct device_node *np;unsigned char *pixis;if (ppc_md.progress) ppc_md.progress ("mpc86xx_hpcd_setup_arch()" ,0 ); -#ifdef CONFIG_PCI -for_each_node_by_type (np,"pci" ) { -if (of_device_is_compatible (np,"fsl,mpc8610-pci" ) - ||of_device_is_compatible (np,"fsl,mpc8641-pcie" )) { -struct resource rsrc; -of_address_to_resource (np,0 , &rsrc); -if ((rsrc.start &0xfffff ) ==0xa000 ) -fsl_add_bridge (np,1 ); -else -fsl_add_bridge (np,0 ); - } - } -#endif #if defined(CONFIG_FB_FSL_DIU ) || defined(CONFIG_FB_FSL_DIU_MODULE ) diu_ops.get_pixel_format = mpc8610hpcd_get_pixel_format; diu_ops.set_gamma_table = mpc8610hpcd_set_gamma_table;
@@ -331,8 +328,12 @@ static int __init mpc86xx_hpcd_probe(void) {unsigned long root =of_get_flat_dt_root (); -if (of_flat_dt_is_compatible (root,"fsl,MPC8610HPCD" )) +if (of_flat_dt_is_compatible (root,"fsl,MPC8610HPCD" )) { +#ifdef CONFIG_PCI + primary_phb_addr =0xa000 ; +#endif return 1 ;/* Looks good */ + }return 0 ; }
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c +16 -29
75 lines not on this page · raw message
arch/powerpc/platforms/86xx/sbc8641d.c +11 -9
@@ -39,18 +39,9 @@static void __init sbc8641_setup_arch (void ) { -#ifdef CONFIG_PCI -struct device_node *np; -#endif -if (ppc_md.progress) ppc_md.progress ("sbc8641_setup_arch()" ,0 ); -#ifdef CONFIG_PCI -for_each_compatible_node (np,"pci" ,"fsl,mpc8641-pcie" ) -fsl_add_bridge (np,0 ); -#endif -printk ("SBC8641 board from Wind River\n" );#ifdef CONFIG_SMP
@@ -100,6 +91,17 @@ mpc86xx_time_init(void)return 0 ; } +static struct of_device_id __initdata sbc8641_pci_ids[] = { + { .compatible ="fsl,mpc8641-pcie" , }, + {}, +}; + +static int __init sbc8641_publish_pci_device (void ) +{ +return of_platform_bus_probe (NULL , sbc8641_pci_ids,NULL ); +} +machine_arch_initcall (sbc8641, sbc8641_publish_pci_device); +static __initdata struct of_device_id of_bus_ids[] = { { .compatible ="simple-bus" , }, { .compatible ="gianfar" , },
Signature · 1 line
1.7.5.1
PATCH v2 3/4 powerpc/fsl-pci: Only scan PCI bus if configured as a host
In reply to Jia HongtaoIf we're an agent/end-point or fsl_add_bridge doesn't succeed due to some resource failure we should not scan the PCI bus. We change fsl_add_bridge() to return -ENODEV in the case we're an agent/end-point.
--- arch/powerpc/sysdev/fsl_pci.c | 27 +++++++++++++++------------ 1 files changed, 15 insertions(+), 12 deletions(-)
arch/powerpc/sysdev/fsl_pci.c +15 -12
@@ -465,7 +465,7 @@ int __init fsl_add_bridge(struct device_node *dev, int is_primary)iounmap (hose->cfg_data);iounmap (hose->cfg_addr);pcibios_free_controller (hose); -return 0 ; +return -ENODEV ; }setup_pci_cmd (hose);
@@ -835,17 +835,20 @@ static int __devinit fsl_pci_probe(struct platform_device *pdev) ret =fsl_add_bridge (pdev->dev.of_node, is_primary);#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; +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 () > 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 }
Signature · 1 line
1.7.5.1
PATCH v2 4/4 powerpc/fsl-pci: Add pci inbound/outbound PM support
In reply to Jia HongtaoPower supply for PCI inbound/outbound window registers is off when system go to deep-sleep state. We save the values of registers before suspend and restore to registers after resume.
--- arch/powerpc/include/asm/pci-bridge.h | 2 +- arch/powerpc/sysdev/fsl_pci.c | 121 +++++++++++++++++++++++++++++++++ arch/powerpc/sysdev/fsl_pci.h | 10 +++ 3 files changed, 132 insertions(+), 1 deletions(-)
arch/powerpc/include/asm/pci-bridge.h +1 -1
@@ -89,9 +89,9 @@ struct pci_controller {#ifdef CONFIG_PPC64 unsigned long buid; +#endif /* CONFIG_PPC64 */ void *private_data; -#endif /* CONFIG_PPC64 */ };/* These are used for config access before all the PCI probing
arch/powerpc/sysdev/fsl_pci.c +121 -0
133 lines not on this page · raw message
arch/powerpc/sysdev/fsl_pci.h +10 -0
@@ -88,6 +88,16 @@ struct ccsr_pci {__be32 pex_err_cap_r3;/* 0x.e34 - PCIE error capture register 0 */ }; + +#ifdef CONFIG_SUSPEND +struct fsl_pci_private_data { +int inbound_num; +struct pci_outbound_window_regs __iomem *pci_pow; +struct pci_inbound_window_regs __iomem *pci_piw; +void *saved_regs; +}; +#endif +extern int primary_phb_addr;extern int fsl_add_bridge (struct device_node *dev,int is_primary);extern void fsl_pcibios_fixup_bus (struct pci_bus *bus);
Signature · 1 line
1.7.5.1