aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac
diff options
context:
space:
mode:
authorJia Hongtao <B38951@freescale.com>2012-08-28 03:44:08 -0400
committerKumar Gala <galak@kernel.crashing.org>2012-09-12 15:57:12 -0400
commit905e75c46dba5f3061049277e4eb7110beedba43 (patch)
tree3a83c25efa8f93360772520c23f3d8b8b9d9aef1 /drivers/edac
parent9e67886becd7fab36c97ef43bb81515c18a66be1 (diff)
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 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> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'drivers/edac')
-rw-r--r--drivers/edac/mpc85xx_edac.c43
1 files changed, 12 insertions, 31 deletions
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
index a1e791ec25d3..4fe66fa183ec 100644
--- a/drivers/edac/mpc85xx_edac.c
+++ b/drivers/edac/mpc85xx_edac.c
@@ -212,7 +212,7 @@ static irqreturn_t mpc85xx_pci_isr(int irq, void *dev_id)
212 return IRQ_HANDLED; 212 return IRQ_HANDLED;
213} 213}
214 214
215static int __devinit mpc85xx_pci_err_probe(struct platform_device *op) 215int __devinit mpc85xx_pci_err_probe(struct platform_device *op)
216{ 216{
217 struct edac_pci_ctl_info *pci; 217 struct edac_pci_ctl_info *pci;
218 struct mpc85xx_pci_pdata *pdata; 218 struct mpc85xx_pci_pdata *pdata;
@@ -226,6 +226,16 @@ static int __devinit mpc85xx_pci_err_probe(struct platform_device *op)
226 if (!pci) 226 if (!pci)
227 return -ENOMEM; 227 return -ENOMEM;
228 228
229 /* make sure error reporting method is sane */
230 switch (edac_op_state) {
231 case EDAC_OPSTATE_POLL:
232 case EDAC_OPSTATE_INT:
233 break;
234 default:
235 edac_op_state = EDAC_OPSTATE_INT;
236 break;
237 }
238
229 pdata = pci->pvt_info; 239 pdata = pci->pvt_info;
230 pdata->name = "mpc85xx_pci_err"; 240 pdata->name = "mpc85xx_pci_err";
231 pdata->irq = NO_IRQ; 241 pdata->irq = NO_IRQ;
@@ -315,6 +325,7 @@ err:
315 devres_release_group(&op->dev, mpc85xx_pci_err_probe); 325 devres_release_group(&op->dev, mpc85xx_pci_err_probe);
316 return res; 326 return res;
317} 327}
328EXPORT_SYMBOL(mpc85xx_pci_err_probe);
318 329
319static int mpc85xx_pci_err_remove(struct platform_device *op) 330static int mpc85xx_pci_err_remove(struct platform_device *op)
320{ 331{
@@ -338,27 +349,6 @@ static int mpc85xx_pci_err_remove(struct platform_device *op)
338 return 0; 349 return 0;
339} 350}
340 351
341static struct of_device_id mpc85xx_pci_err_of_match[] = {
342 {
343 .compatible = "fsl,mpc8540-pcix",
344 },
345 {
346 .compatible = "fsl,mpc8540-pci",
347 },
348 {},
349};
350MODULE_DEVICE_TABLE(of, mpc85xx_pci_err_of_match);
351
352static struct platform_driver mpc85xx_pci_err_driver = {
353 .probe = mpc85xx_pci_err_probe,
354 .remove = __devexit_p(mpc85xx_pci_err_remove),
355 .driver = {
356 .name = "mpc85xx_pci_err",
357 .owner = THIS_MODULE,
358 .of_match_table = mpc85xx_pci_err_of_match,
359 },
360};
361
362#endif /* CONFIG_PCI */ 352#endif /* CONFIG_PCI */
363 353
364/**************************** L2 Err device ***************************/ 354/**************************** L2 Err device ***************************/
@@ -1210,12 +1200,6 @@ static int __init mpc85xx_mc_init(void)
1210 if (res) 1200 if (res)
1211 printk(KERN_WARNING EDAC_MOD_STR "L2 fails to register\n"); 1201 printk(KERN_WARNING EDAC_MOD_STR "L2 fails to register\n");
1212 1202
1213#ifdef CONFIG_PCI
1214 res = platform_driver_register(&mpc85xx_pci_err_driver);
1215 if (res)
1216 printk(KERN_WARNING EDAC_MOD_STR "PCI fails to register\n");
1217#endif
1218
1219#ifdef CONFIG_FSL_SOC_BOOKE 1203#ifdef CONFIG_FSL_SOC_BOOKE
1220 pvr = mfspr(SPRN_PVR); 1204 pvr = mfspr(SPRN_PVR);
1221 1205
@@ -1252,9 +1236,6 @@ static void __exit mpc85xx_mc_exit(void)
1252 on_each_cpu(mpc85xx_mc_restore_hid1, NULL, 0); 1236 on_each_cpu(mpc85xx_mc_restore_hid1, NULL, 0);
1253 } 1237 }
1254#endif 1238#endif
1255#ifdef CONFIG_PCI
1256 platform_driver_unregister(&mpc85xx_pci_err_driver);
1257#endif
1258 platform_driver_unregister(&mpc85xx_l2_err_driver); 1239 platform_driver_unregister(&mpc85xx_l2_err_driver);
1259 platform_driver_unregister(&mpc85xx_mc_err_driver); 1240 platform_driver_unregister(&mpc85xx_mc_err_driver);
1260} 1241}