ppc/85xx: create a platform node for PCI EDAC device
Subsystems (4)
PATCH 1/2 ppc/85xx: create a platform node for PCI EDAC device
As a device for pci node isn't created, create a special platform_device for PCI EDAC device on MPC85xx.
--- arch/powerpc/platforms/85xx/ksi8560.c | 4 +++ arch/powerpc/platforms/85xx/mpc8536_ds.c | 4 +++ arch/powerpc/platforms/85xx/mpc85xx_ads.c | 4 +++ arch/powerpc/platforms/85xx/mpc85xx_cds.c | 4 +++ arch/powerpc/platforms/85xx/mpc85xx_ds.c | 4 +++ arch/powerpc/platforms/85xx/mpc85xx_mds.c | 8 +++++++ arch/powerpc/platforms/85xx/mpc85xx_rdb.c | 4 +++ arch/powerpc/platforms/85xx/p1022_ds.c | 4 +++ arch/powerpc/platforms/85xx/sbc8548.c | 4 +++ arch/powerpc/platforms/85xx/sbc8560.c | 4 +++ arch/powerpc/platforms/85xx/socrates.c | 4 +++ arch/powerpc/platforms/85xx/stx_gp3.c | 4 +++ arch/powerpc/platforms/85xx/tqm85xx.c | 4 +++ arch/powerpc/platforms/85xx/xes_mpc85xx.c | 4 +++ arch/powerpc/sysdev/fsl_pci.c | 32 +++++++++++++++++++++++++++++ arch/powerpc/sysdev/fsl_pci.h | 1 + 16 files changed, 93 insertions(+), 0 deletions(-)
arch/powerpc/platforms/85xx/ksi8560.c +4 -0
@@ -228,6 +228,10 @@ static int __init declare_of_platform_devices(void) {of_platform_bus_probe (NULL , of_bus_ids,NULL ); +#ifdef CONFIG_PCI +fsl_add_pci_err (); +#endif +return 0 ; }machine_device_initcall (ksi8560, declare_of_platform_devices);
arch/powerpc/platforms/85xx/mpc8536_ds.c +4 -0
@@ -114,6 +114,10 @@ static struct of_device_id __initdata mpc8536_ds_ids[] = {static int __init mpc8536_ds_publish_devices (void ) { +#ifdef CONFIG_PCI +fsl_add_pci_err (); +#endif +return of_platform_bus_probe (NULL , mpc8536_ds_ids,NULL ); }machine_device_initcall (mpc8536_ds, mpc8536_ds_publish_devices);
arch/powerpc/platforms/85xx/mpc85xx_ads.c +4 -0
@@ -235,6 +235,10 @@ static int __init declare_of_platform_devices(void) {of_platform_bus_probe (NULL , of_bus_ids,NULL ); +#ifdef CONFIG_PCI +fsl_add_pci_err (); +#endif +return 0 ; }machine_device_initcall (mpc85xx_ads, declare_of_platform_devices);
arch/powerpc/platforms/85xx/mpc85xx_cds.c +4 -0
@@ -341,6 +341,10 @@ static struct of_device_id __initdata of_bus_ids[] = {static int __init declare_of_platform_devices (void ) { +#ifdef CONFIG_PCI +fsl_add_pci_err (); +#endif +return of_platform_bus_probe (NULL , of_bus_ids,NULL ); }machine_device_initcall (mpc85xx_cds, declare_of_platform_devices);
arch/powerpc/platforms/85xx/mpc85xx_ds.c +4 -0
@@ -228,6 +228,10 @@ static struct of_device_id __initdata mpc85xxds_ids[] = {static int __init mpc85xxds_publish_devices (void ) { +#ifdef CONFIG_PCI +fsl_add_pci_err (); +#endif +return of_platform_bus_probe (NULL , mpc85xxds_ids,NULL ); }machine_device_initcall (mpc8544_ds, mpc85xxds_publish_devices);
arch/powerpc/platforms/85xx/mpc85xx_mds.c +8 -0
@@ -455,6 +455,10 @@ static int __init mpc85xx_publish_devices(void)if (machine_is (mpc8569_mds))simple_gpiochip_init ("fsl,mpc8569mds-bcsr-gpio" ); +#ifdef CONFIG_PCI +fsl_add_pci_err (); +#endif +of_platform_bus_probe (NULL , mpc85xx_ids,NULL );mpc85xx_publish_qe_devices ();
@@ -463,6 +467,10 @@ static int __init mpc85xx_publish_devices(void)static int __init p1021_publish_devices (void ) { +#ifdef CONFIG_PCI +fsl_add_pci_err (); +#endif +of_platform_bus_probe (NULL , p1021_ids,NULL );mpc85xx_publish_qe_devices ();
arch/powerpc/platforms/85xx/mpc85xx_rdb.c +4 -0
@@ -118,6 +118,10 @@ static struct of_device_id __initdata mpc85xxrdb_ids[] = {static int __init mpc85xxrdb_publish_devices (void ) { +#ifdef CONFIG_PCI +fsl_add_pci_err (); +#endif +return of_platform_bus_probe (NULL , mpc85xxrdb_ids,NULL ); }machine_device_initcall (p2020_rdb, mpc85xxrdb_publish_devices);
arch/powerpc/platforms/85xx/p1022_ds.c +4 -0
@@ -326,6 +326,10 @@ static struct of_device_id __initdata p1022_ds_ids[] = {static int __init p1022_ds_publish_devices (void ) { +#ifdef CONFIG_PCI +fsl_add_pci_err (); +#endif +return of_platform_bus_probe (NULL , p1022_ds_ids,NULL ); }machine_device_initcall (p1022_ds, p1022_ds_publish_devices);
arch/powerpc/platforms/85xx/sbc8548.c +4 -0
@@ -162,6 +162,10 @@ static int __init declare_of_platform_devices(void) {of_platform_bus_probe (NULL , of_bus_ids,NULL ); +#ifdef CONFIG_PCI +fsl_add_pci_err (); +#endif +return 0 ; }machine_device_initcall (sbc8548, declare_of_platform_devices);
arch/powerpc/platforms/85xx/sbc8560.c +4 -0
@@ -222,6 +222,10 @@ static int __init declare_of_platform_devices(void) {of_platform_bus_probe (NULL , of_bus_ids,NULL ); +#ifdef CONFIG_PCI +fsl_add_pci_err (); +#endif +return 0 ; }machine_device_initcall (sbc8560, declare_of_platform_devices);
arch/powerpc/platforms/85xx/socrates.c +4 -0
@@ -104,6 +104,10 @@ static struct of_device_id __initdata socrates_of_bus_ids[] = {static int __init socrates_publish_devices (void ) { +#ifdef CONFIG_PCI +fsl_add_pci_err (); +#endif +return of_platform_bus_probe (NULL , socrates_of_bus_ids,NULL ); }machine_device_initcall (socrates, socrates_publish_devices);
arch/powerpc/platforms/85xx/stx_gp3.c +4 -0
@@ -154,6 +154,10 @@ static int __init declare_of_platform_devices(void) {of_platform_bus_probe (NULL , of_bus_ids,NULL ); +#ifdef CONFIG_PCI +fsl_add_pci_err (); +#endif +return 0 ; }machine_device_initcall (stx_gp3, declare_of_platform_devices);
arch/powerpc/platforms/85xx/tqm85xx.c +4 -0
@@ -183,6 +183,10 @@ static int __init declare_of_platform_devices(void) {of_platform_bus_probe (NULL , of_bus_ids,NULL ); +#ifdef CONFIG_PCI +fsl_add_pci_err (); +#endif +return 0 ; }machine_device_initcall (tqm85xx, declare_of_platform_devices);
arch/powerpc/platforms/85xx/xes_mpc85xx.c +4 -0
@@ -187,6 +187,10 @@ static struct of_device_id __initdata xes_mpc85xx_ids[] = {static int __init xes_mpc85xx_publish_devices (void ) { +#ifdef CONFIG_PCI +fsl_add_pci_err (); +#endif +return of_platform_bus_probe (NULL , xes_mpc85xx_ids,NULL ); }machine_device_initcall (xes_mpc8572, xes_mpc85xx_publish_devices);
arch/powerpc/sysdev/fsl_pci.c +32 -0
@@ -381,6 +381,38 @@ int __init fsl_add_bridge(struct device_node *dev, int is_primary)return 0 ; } +int __init fsl_add_pci_err (void ) +{ +struct device_node *np; + +for_each_node_by_type (np,"pci" ) { +/* Only PCI, not PCI Express! */ +if (of_device_is_compatible (np,"fsl,mpc8540-pci" )) { +struct resource r[2 ]; + + r[0 ].parent =NULL ; + r[1 ].parent =NULL ; + +if (of_address_to_resource (np,0 , &r[0 ])) { +printk (KERN_WARNING +"Can't get register base for PCI EDAC!\n" ); +return -ENOMEM ; + } + r[0 ].start +=0xe00 ; + +if (of_irq_to_resource (np,0 , &r[1 ]) ==NO_IRQ ) { +printk (KERN_WARNING +"Can't get irq for PCI EDAC!\n" ); +return -ENOMEM ; + } +platform_device_register_simple ("mpc85xx_pci_err" ,-1 , + r,ARRAY_SIZE (r)); + } + } + +return 0 ; +} +DECLARE_PCI_FIXUP_HEADER (0x1957 ,PCI_DEVICE_ID_MPC8548E , quirk_fsl_pcie_header);DECLARE_PCI_FIXUP_HEADER (0x1957 ,PCI_DEVICE_ID_MPC8548 , quirk_fsl_pcie_header);DECLARE_PCI_FIXUP_HEADER (0x1957 ,PCI_DEVICE_ID_MPC8543E , quirk_fsl_pcie_header);
arch/powerpc/sysdev/fsl_pci.h +1 -0
@@ -92,6 +92,7 @@ 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);u64 fsl_pci_immrbar_base (struct pci_controller *hose); +int fsl_add_pci_err (void );#endif /* __POWERPC_FSL_PCI_H */ #endif /* __KERNEL__ */
Signature · 9 lines
1.7.4.4 ------------------------------------------------------------------------------ Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev
PATCH 2/2 mpc85xx_edac: adapt to ppc/85xx changes for mpc85xx_pci_err
Currently mpc85xx_edac fails to bind to PCI host device node. Adapt it to bind to special platform device mpc85xx_pci_err.
--- drivers/edac/mpc85xx_edac.c | 33 ++++++++++++--------------------- 1 files changed, 12 insertions(+), 21 deletions(-)
drivers/edac/mpc85xx_edac.c +12 -21
@@ -204,7 +204,7 @@ static int __devinit mpc85xx_pci_err_probe(struct platform_device *op) {struct edac_pci_ctl_info *pci;struct mpc85xx_pci_pdata *pdata; -struct resource r; +struct resource *r;int res =0 ;if (!devres_open_group (&op->dev, mpc85xx_pci_err_probe,GFP_KERNEL ))
@@ -228,17 +228,15 @@ static int __devinit mpc85xx_pci_err_probe(struct platform_device *op) pdata->edac_idx = edac_pci_idx++; - res =of_address_to_resource (op->dev.of_node,0 , &r); -if (res) { + r =platform_get_resource (op,IORESOURCE_MEM ,0 ); +if (!r) {printk (KERN_ERR "%s: Unable to get resource for " "PCI err regs\n" , __func__); + res = -ENODEV ; goto err; } -/* we only need the error registers */ - r.start +=0xe00 ; - -if (!devm_request_mem_region (&op->dev, r.start,resource_size (&r), +if (!devm_request_mem_region (&op->dev, r->start,resource_size (r), pdata->name)) {printk (KERN_ERR "%s: Error while requesting mem region\n" , __func__);
@@ -246,7 +244,7 @@ static int __devinit mpc85xx_pci_err_probe(struct platform_device *op) goto err; } - pdata->pci_vbase =devm_ioremap (&op->dev, r.start,resource_size (&r)); + pdata->pci_vbase =devm_ioremap (&op->dev, r->start,resource_size (r));if (!pdata->pci_vbase) {printk (KERN_ERR "%s: Unable to setup PCI err regs\n" , __func__); res = -ENOMEM ;
@@ -273,7 +271,11 @@ static int __devinit mpc85xx_pci_err_probe(struct platform_device *op) }if (edac_op_state ==EDAC_OPSTATE_INT ) { - pdata->irq =irq_of_parse_and_map (op->dev.of_node,0 ); + res =platform_get_irq (op,0 ); +if (res >=0 ) + pdata->irq = res; +else + goto err2; res =devm_request_irq (&op->dev, pdata->irq, mpc85xx_pci_isr,IRQF_DISABLED ,"[EDAC] PCI err" , pci);
@@ -281,7 +283,6 @@ static int __devinit mpc85xx_pci_err_probe(struct platform_device *op)printk (KERN_ERR "%s: Unable to requiest irq %d for " "MPC85xx PCI err\n" , __func__, pdata->irq); -irq_dispose_mapping (pdata->irq); res = -ENODEV ; goto err2; }
@@ -326,16 +327,7 @@ 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); +MODULE_ALIAS ("platform:mpc85xx_pci_err" );static struct platform_driver mpc85xx_pci_err_driver = { .probe = mpc85xx_pci_err_probe,
@@ -343,7 +335,6 @@ static struct platform_driver mpc85xx_pci_err_driver = { .driver = { .name = "mpc85xx_pci_err", .owner = THIS_MODULE, - .of_match_table = mpc85xx_pci_err_of_match, }, };
Signature · 9 lines
1.7.4.4 ------------------------------------------------------------------------------ Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev
On Wed, Jun 01, 2011 at 04:28:11PM +0400, Dmitry Eremin-Solenikov wrote:
[...]
arch/powerpc/sysdev/fsl_pci.h extern int fsl_add_bridge(struct device_node *dev, int is_primary); · line 95
Quoted 7 lines
arch/powerpc/sysdev/fsl_pci.h +1
-0@@ -92,6 +92,7 @@ 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);u64 fsl_pci_immrbar_base (struct pci_controller *hose); +int fsl_add_pci_err (void );
With
#ifdef CONFIG_PCI
int fsl_add_pci_err(void);
#else
static inline int fsl_add_pci_err(void) { return -ENODEV; } #endif
You won't need endless ifdefs in the board files:
#ifdef CONFIG_PCI fsl_add_pci_err();
#endif
Also, why not add this call to the fsl_add_bridge(), so you won't need to touch board files at all.
Thanks,
Signature · 2 lines
Anton Vorontsov Email: [email protected]
Quoted 13 lines · Anton Vorontsov
On Wed, Jun 01, 2011 at 04:28:11PM +0400, Dmitry Eremin-Solenikov wrote:
[...]arch/powerpc/sysdev/fsl_pci.h extern int fsl_add_bridge(struct device_node *dev, int · line 96
Quoted 8 lines
arch/powerpc/sysdev/fsl_pci.h +1
-0@@ -92,6 +92,7 @@ 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);u64 fsl_pci_immrbar_base (struct pci_controller *hose); +int fsl_add_pci_err (void );With
Quoted 7 lines
#ifdef
CONFIG_PCI
intfsl_add_pci_err(void);
#else
static inline intfsl_add_pci_err(void){ return-ENODEV; } #endifYou won't need endless ifdefs in the board files:
OK, will redo this patch.
Quoted 7 lines
#ifdef CONFIG_PCI fsl_add_pci_err();#endif
Also, why not add this call to the
fsl_add_bridge(), so you won't need to touch board files at all.
Because fsl_add_bridge is called too early, so allocation of platform device fails.
Signature · 9 lines
With best wishes Dmitry ------------------------------------------------------------------------------ Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev
Quoted 20 lines · Dmitry Eremin-Solenikov
Quoted 19 lines · Anton Vorontsov
On Wed, Jun 01, 2011 at 04:28:11PM +0400, Dmitry Eremin-Solenikov wrote:
[...]arch/powerpc/sysdev/fsl_pci.h extern int fsl_add_bridge(struct device_node *dev, int · line 96
Quoted 8 lines
arch/powerpc/sysdev/fsl_pci.h +1
-0@@ -92,6 +92,7 @@ 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);u64 fsl_pci_immrbar_base (struct pci_controller *hose); +int fsl_add_pci_err (void );With
#ifdef
CONFIG_PCI
intfsl_add_pci_err(void);
#else
static inline intfsl_add_pci_err(void){ return-ENODEV; } #endif
Quoted 3 lines
Quoted 1 line
You won't need endless ifdefs in the board files:
OK, will redo this patch.
Btw, if you don't check return value of fsl_add_pci_err(), then it would probably make sense to return void. And if you do check it somewhere, be sure to include linux/errno.h for -ENODEV. :-)
Thanks,
Signature · 2 lines
Anton Vorontsov Email: [email protected]
PATCH 1/2 ppc/85xx: create a platform node for PCI EDAC device
As a device for pci node isn't created, create a special platform_device for PCI EDAC device on MPC85xx.
--- arch/powerpc/platforms/85xx/ksi8560.c | 2 + arch/powerpc/platforms/85xx/mpc8536_ds.c | 2 + arch/powerpc/platforms/85xx/mpc85xx_ads.c | 2 + arch/powerpc/platforms/85xx/mpc85xx_cds.c | 2 + arch/powerpc/platforms/85xx/mpc85xx_ds.c | 2 + arch/powerpc/platforms/85xx/mpc85xx_mds.c | 4 +++ arch/powerpc/platforms/85xx/mpc85xx_rdb.c | 2 + arch/powerpc/platforms/85xx/p1022_ds.c | 2 + arch/powerpc/platforms/85xx/sbc8548.c | 2 + arch/powerpc/platforms/85xx/sbc8560.c | 2 + arch/powerpc/platforms/85xx/socrates.c | 2 + arch/powerpc/platforms/85xx/stx_gp3.c | 2 + arch/powerpc/platforms/85xx/tqm85xx.c | 2 + arch/powerpc/platforms/85xx/xes_mpc85xx.c | 2 + arch/powerpc/sysdev/fsl_pci.c | 30 +++++++++++++++++++++++++++++ arch/powerpc/sysdev/fsl_pci.h | 5 ++++ 16 files changed, 65 insertions(+), 0 deletions(-)
arch/powerpc/platforms/85xx/ksi8560.c +2 -0
@@ -228,6 +228,8 @@ static int __init declare_of_platform_devices(void) {of_platform_bus_probe (NULL , of_bus_ids,NULL ); +fsl_add_pci_err (); +return 0 ; }machine_device_initcall (ksi8560, declare_of_platform_devices);
arch/powerpc/platforms/85xx/mpc8536_ds.c +2 -0
@@ -114,6 +114,8 @@ static struct of_device_id __initdata mpc8536_ds_ids[] = {static int __init mpc8536_ds_publish_devices (void ) { +fsl_add_pci_err (); +return of_platform_bus_probe (NULL , mpc8536_ds_ids,NULL ); }machine_device_initcall (mpc8536_ds, mpc8536_ds_publish_devices);
arch/powerpc/platforms/85xx/mpc85xx_ads.c +2 -0
@@ -235,6 +235,8 @@ static int __init declare_of_platform_devices(void) {of_platform_bus_probe (NULL , of_bus_ids,NULL ); +fsl_add_pci_err (); +return 0 ; }machine_device_initcall (mpc85xx_ads, declare_of_platform_devices);
arch/powerpc/platforms/85xx/mpc85xx_cds.c +2 -0
@@ -341,6 +341,8 @@ static struct of_device_id __initdata of_bus_ids[] = {static int __init declare_of_platform_devices (void ) { +fsl_add_pci_err (); +return of_platform_bus_probe (NULL , of_bus_ids,NULL ); }machine_device_initcall (mpc85xx_cds, declare_of_platform_devices);
arch/powerpc/platforms/85xx/mpc85xx_ds.c +2 -0
@@ -228,6 +228,8 @@ static struct of_device_id __initdata mpc85xxds_ids[] = {static int __init mpc85xxds_publish_devices (void ) { +fsl_add_pci_err (); +return of_platform_bus_probe (NULL , mpc85xxds_ids,NULL ); }machine_device_initcall (mpc8544_ds, mpc85xxds_publish_devices);
arch/powerpc/platforms/85xx/mpc85xx_mds.c +4 -0
@@ -455,6 +455,8 @@ static int __init mpc85xx_publish_devices(void)if (machine_is (mpc8569_mds))simple_gpiochip_init ("fsl,mpc8569mds-bcsr-gpio" ); +fsl_add_pci_err (); +of_platform_bus_probe (NULL , mpc85xx_ids,NULL );mpc85xx_publish_qe_devices ();
@@ -463,6 +465,8 @@ static int __init mpc85xx_publish_devices(void)static int __init p1021_publish_devices (void ) { +fsl_add_pci_err (); +of_platform_bus_probe (NULL , p1021_ids,NULL );mpc85xx_publish_qe_devices ();
arch/powerpc/platforms/85xx/mpc85xx_rdb.c +2 -0
@@ -118,6 +118,8 @@ static struct of_device_id __initdata mpc85xxrdb_ids[] = {static int __init mpc85xxrdb_publish_devices (void ) { +fsl_add_pci_err (); +return of_platform_bus_probe (NULL , mpc85xxrdb_ids,NULL ); }machine_device_initcall (p2020_rdb, mpc85xxrdb_publish_devices);
arch/powerpc/platforms/85xx/p1022_ds.c +2 -0
@@ -326,6 +326,8 @@ static struct of_device_id __initdata p1022_ds_ids[] = {static int __init p1022_ds_publish_devices (void ) { +fsl_add_pci_err (); +return of_platform_bus_probe (NULL , p1022_ds_ids,NULL ); }machine_device_initcall (p1022_ds, p1022_ds_publish_devices);
arch/powerpc/platforms/85xx/sbc8548.c +2 -0
@@ -162,6 +162,8 @@ static int __init declare_of_platform_devices(void) {of_platform_bus_probe (NULL , of_bus_ids,NULL ); +fsl_add_pci_err (); +return 0 ; }machine_device_initcall (sbc8548, declare_of_platform_devices);
arch/powerpc/platforms/85xx/sbc8560.c +2 -0
@@ -222,6 +222,8 @@ static int __init declare_of_platform_devices(void) {of_platform_bus_probe (NULL , of_bus_ids,NULL ); +fsl_add_pci_err (); +return 0 ; }machine_device_initcall (sbc8560, declare_of_platform_devices);
arch/powerpc/platforms/85xx/socrates.c +2 -0
@@ -104,6 +104,8 @@ static struct of_device_id __initdata socrates_of_bus_ids[] = {static int __init socrates_publish_devices (void ) { +fsl_add_pci_err (); +return of_platform_bus_probe (NULL , socrates_of_bus_ids,NULL ); }machine_device_initcall (socrates, socrates_publish_devices);
arch/powerpc/platforms/85xx/stx_gp3.c +2 -0
@@ -154,6 +154,8 @@ static int __init declare_of_platform_devices(void) {of_platform_bus_probe (NULL , of_bus_ids,NULL ); +fsl_add_pci_err (); +return 0 ; }machine_device_initcall (stx_gp3, declare_of_platform_devices);
arch/powerpc/platforms/85xx/tqm85xx.c +2 -0
@@ -183,6 +183,8 @@ static int __init declare_of_platform_devices(void) {of_platform_bus_probe (NULL , of_bus_ids,NULL ); +fsl_add_pci_err (); +return 0 ; }machine_device_initcall (tqm85xx, declare_of_platform_devices);
arch/powerpc/platforms/85xx/xes_mpc85xx.c +2 -0
@@ -187,6 +187,8 @@ static struct of_device_id __initdata xes_mpc85xx_ids[] = {static int __init xes_mpc85xx_publish_devices (void ) { +fsl_add_pci_err (); +return of_platform_bus_probe (NULL , xes_mpc85xx_ids,NULL ); }machine_device_initcall (xes_mpc8572, xes_mpc85xx_publish_devices);
arch/powerpc/sysdev/fsl_pci.c +30 -0
@@ -381,6 +381,36 @@ int __init fsl_add_bridge(struct device_node *dev, int is_primary)return 0 ; } +void __init fsl_add_pci_err (void ) +{ +struct device_node *np; + +for_each_node_by_type (np,"pci" ) { +/* Only PCI, not PCI Express! */ +if (of_device_is_compatible (np,"fsl,mpc8540-pci" )) { +struct resource r[2 ]; + + r[0 ].parent =NULL ; + r[1 ].parent =NULL ; + +if (of_address_to_resource (np,0 , &r[0 ])) { +printk (KERN_WARNING +"Can't get register base for PCI EDAC!\n" ); +continue ; + } + r[0 ].start +=0xe00 ; + +if (of_irq_to_resource (np,0 , &r[1 ]) ==NO_IRQ ) { +printk (KERN_WARNING +"Can't get irq for PCI EDAC!\n" ); +continue ; + } +platform_device_register_simple ("mpc85xx_pci_err" ,-1 , + r,ARRAY_SIZE (r)); + } + } +} +DECLARE_PCI_FIXUP_HEADER (0x1957 ,PCI_DEVICE_ID_MPC8548E , quirk_fsl_pcie_header);DECLARE_PCI_FIXUP_HEADER (0x1957 ,PCI_DEVICE_ID_MPC8548 , quirk_fsl_pcie_header);DECLARE_PCI_FIXUP_HEADER (0x1957 ,PCI_DEVICE_ID_MPC8543E , quirk_fsl_pcie_header);
arch/powerpc/sysdev/fsl_pci.h +5 -0
@@ -92,6 +92,11 @@ 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);u64 fsl_pci_immrbar_base (struct pci_controller *hose); +#ifdef CONFIG_PCI +void fsl_add_pci_err (void ); +#else +static inline void fsl_add_pci_err (void ) {} +#endif #endif /* __POWERPC_FSL_PCI_H */ #endif /* __KERNEL__ */
Signature · 9 lines
1.7.4.4 ------------------------------------------------------------------------------ Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev
Quoted 8 lines · On Wed, 1 Jun 2011 18:55:35 +0400 Dmitry Eremin-Solenikov…
Quoted 4 lines · Anton Vorontsov
On Wed, Jun 01, 2011 at 04:28:11PM +0400, Dmitry Eremin-Solenikov wrote:
[...]
Also, why not add this call to thefsl_add_bridge(), so you won't need to touch board files at all.Because
fsl_add_bridgeis called too early, so allocation of platform device fails.
That doesn't seem like a good reason for putting more stuff in board files that isn't board-specific. Why not just make fsl_add_pci_err() an initcall? It already only works when a compatible device tree node is found. Is there any case where a board would not want this PCI code to be used, even if the device tree node is present? If so, fsl_add_bridge could set a flag that fsl_add_pci_err() could check -- but I doubt it's needed.
-Scott
------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
PATCH 1/2 ppc/85xx: create a platform node for PCI EDAC device
As a device for pci node isn't created, create a special platform_device for PCI EDAC device on MPC85xx.
--- arch/powerpc/sysdev/fsl_pci.c | 33 +++++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+), 0 deletions(-)
arch/powerpc/sysdev/fsl_pci.c +33 -0
@@ -381,6 +381,39 @@ int __init fsl_add_bridge(struct device_node *dev, int is_primary)return 0 ; } +int __init fsl_add_pci_err (void ) +{ +struct device_node *np; + +for_each_node_by_type (np,"pci" ) { +/* Only PCI, not PCI Express! */ +if (of_device_is_compatible (np,"fsl,mpc8540-pci" )) { +struct resource r[2 ]; + + r[0 ].parent =NULL ; + r[1 ].parent =NULL ; + +if (of_address_to_resource (np,0 , &r[0 ])) { +printk (KERN_WARNING +"Can't get register base for PCI EDAC!\n" ); +continue ; + } + r[0 ].start +=0xe00 ; + +if (of_irq_to_resource (np,0 , &r[1 ]) ==NO_IRQ ) { +printk (KERN_WARNING +"Can't get irq for PCI EDAC!\n" ); +continue ; + } +platform_device_register_simple ("mpc85xx_pci_err" ,-1 , + r,ARRAY_SIZE (r)); + } + } + +return 0 ; +} +device_initcall (fsl_add_pci_err); +DECLARE_PCI_FIXUP_HEADER (0x1957 ,PCI_DEVICE_ID_MPC8548E , quirk_fsl_pcie_header);DECLARE_PCI_FIXUP_HEADER (0x1957 ,PCI_DEVICE_ID_MPC8548 , quirk_fsl_pcie_header);DECLARE_PCI_FIXUP_HEADER (0x1957 ,PCI_DEVICE_ID_MPC8543E , quirk_fsl_pcie_header);
Signature · 9 lines
1.7.4.4 ------------------------------------------------------------------------------ Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev
Quoted 13 lines · Dmitry Eremin-Solenikov
As a device for pci node isn't created, create a special
platform_devicefor PCI EDAC device on MPC85xx.Signed-off-by Dmitry Eremin-Solenikov <[email protected]>--- arch/powerpc/sysdev/fsl_pci.c | 33 +++++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+), 0 deletions(-)arch/powerpc/sysdev/fsl_pci.c +0
-0
arch/powerpc/sysdev/fsl_pci.c int __init fsl_add_bridge(struct device_node *dev, int is_primary) · line 384
Quoted 4 lines
arch/powerpc/sysdev/fsl_pci.c +1
-0@@ -381,6 +381,39 @@ int __init fsl_add_bridge(struct device_node *dev, int is_primary)return 0 ; } +int __init fsl_add_pci_err (void )
static :-)
arch/powerpc/sysdev/fsl_pci.c int __init fsl_add_bridge(struct device_node *dev, int is_primary) · line 391
Quoted 7 lines
arch/powerpc/sysdev/fsl_pci.c +7
-0+{ +struct device_node *np; + +for_each_node_by_type (np,"pci" ) { +/* Only PCI, not PCI Express! */ +if (of_device_is_compatible (np,"fsl,mpc8540-pci" )) { +struct resource r[2 ];
How about '= {};' initializer instead of the '= NULL's down below?
arch/powerpc/sysdev/fsl_pci.c int __init fsl_add_bridge(struct device_node *dev, int is_primary) · line 394
Quoted 3 lines
arch/powerpc/sysdev/fsl_pci.c +3
-0+ + r[0 ].parent =NULL ; + r[1 ].parent =NULL ;
Thanks,
Signature · 2 lines
Anton Vorontsov Email: [email protected]
Quoted 4 lines
Quoted 2 lines
+int
__initfsl_add_pci_err(void)static :-)
and why __ ?
aren't such names reserved in the C language for some purpose.
David
Quoted 34 lines · On Thu, 2 Jun 2011 16:25:02 +0400 Dmitry Eremin-Solenikov…
As a device for pci node isn't created, create a special
platform_devicefor PCI EDAC device on MPC85xx.Signed-off-by Dmitry Eremin-Solenikov <[email protected]>--- arch/powerpc/sysdev/fsl_pci.c | 33 +++++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+), 0 deletions(-)arch/powerpc/sysdev/fsl_pci.c +18
-0@@ -381,6 +381,39 @@ int __init fsl_add_bridge(struct device_node *dev, int is_primary)return 0 ; } +int __init fsl_add_pci_err (void ) +{ +struct device_node *np; + +for_each_node_by_type (np,"pci" ) { +/* Only PCI, not PCI Express! */ +if (of_device_is_compatible (np,"fsl,mpc8540-pci" )) { +struct resource r[2 ]; + + r[0 ].parent =NULL ; + r[1 ].parent =NULL ; + +if (of_address_to_resource (np,0 , &r[0 ])) { +printk (KERN_WARNING +"Can't get register base for PCI EDAC!\n" ); +continue ; + } + r[0 ].start +=0xe00 ;
arch/powerpc/sysdev/fsl_pci.c int __init fsl_add_bridge(struct device_node *dev, int is_primary) · line 411
Quoted 10 lines
arch/powerpc/sysdev/fsl_pci.c +10
-0+ +if (of_irq_to_resource (np,0 , &r[1 ]) ==NO_IRQ ) { +printk (KERN_WARNING +"Can't get irq for PCI EDAC!\n" ); +continue ; + } +platform_device_register_simple ("mpc85xx_pci_err" ,-1 , + r,ARRAY_SIZE (r)); + } + }
This use of device_type is deprecated -- use for_each_compatible_node().
-Scott
------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Discover what all the cheering's about. Get your free trial download today.
http://p.sf.net/sfu/quest-dev2dev2
PATCH 1/2 ppc/85xx: create a platform node for PCI EDAC device
As a device for pci node isn't created, create a special platform_device for PCI EDAC device on MPC85xx.
--- arch/powerpc/sysdev/fsl_pci.c | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-)
arch/powerpc/sysdev/fsl_pci.c +28 -0
@@ -381,6 +381,34 @@ int __init fsl_add_bridge(struct device_node *dev, int is_primary)return 0 ; } +static int __init fsl_add_pci_err (void ) +{ +struct device_node *np; + +/* Only PCI, not PCI Express! */ +for_each_compatible_node (np,"pci" ,"fsl,mpc8540-pci" ) { +struct resource r[2 ] = {}; + +if (of_address_to_resource (np,0 , &r[0 ])) { +printk (KERN_WARNING +"Can't get register base for PCI EDAC!\n" ); +continue ; + } + r[0 ].start +=0xe00 ; + +if (of_irq_to_resource (np,0 , &r[1 ]) ==NO_IRQ ) { +printk (KERN_WARNING +"Can't get irq for PCI EDAC!\n" ); +continue ; + } +platform_device_register_simple ("mpc85xx_pci_err" ,-1 , + r,ARRAY_SIZE (r)); + } + +return 0 ; +} +device_initcall (fsl_add_pci_err); +DECLARE_PCI_FIXUP_HEADER (0x1957 ,PCI_DEVICE_ID_MPC8548E , quirk_fsl_pcie_header);DECLARE_PCI_FIXUP_HEADER (0x1957 ,PCI_DEVICE_ID_MPC8548 , quirk_fsl_pcie_header);DECLARE_PCI_FIXUP_HEADER (0x1957 ,PCI_DEVICE_ID_MPC8543E , quirk_fsl_pcie_header);
Signature · 9 lines
1.7.4.4 ------------------------------------------------------------------------------ Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Discover what all the cheering's about. Get your free trial download today. http://p.sf.net/sfu/quest-dev2dev2