aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/mpc85xx_edac.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/edac/mpc85xx_edac.c')
-rw-r--r--drivers/edac/mpc85xx_edac.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
index 1dd405e0e550..157f6504f25e 100644
--- a/drivers/edac/mpc85xx_edac.c
+++ b/drivers/edac/mpc85xx_edac.c
@@ -41,7 +41,9 @@ static u32 orig_pci_err_en;
41#endif 41#endif
42 42
43static u32 orig_l2_err_disable; 43static u32 orig_l2_err_disable;
44#ifdef CONFIG_MPC85xx
44static u32 orig_hid1[2]; 45static u32 orig_hid1[2];
46#endif
45 47
46/************************ MC SYSFS parts ***********************************/ 48/************************ MC SYSFS parts ***********************************/
47 49
@@ -789,19 +791,20 @@ static void __devinit mpc85xx_init_csrows(struct mem_ctl_info *mci)
789 csrow = &mci->csrows[index]; 791 csrow = &mci->csrows[index];
790 cs_bnds = in_be32(pdata->mc_vbase + MPC85XX_MC_CS_BNDS_0 + 792 cs_bnds = in_be32(pdata->mc_vbase + MPC85XX_MC_CS_BNDS_0 +
791 (index * MPC85XX_MC_CS_BNDS_OFS)); 793 (index * MPC85XX_MC_CS_BNDS_OFS));
792 start = (cs_bnds & 0xfff0000) << 4; 794
793 end = ((cs_bnds & 0xfff) << 20); 795 start = (cs_bnds & 0xffff0000) >> 16;
794 if (start) 796 end = (cs_bnds & 0x0000ffff);
795 start |= 0xfffff;
796 if (end)
797 end |= 0xfffff;
798 797
799 if (start == end) 798 if (start == end)
800 continue; /* not populated */ 799 continue; /* not populated */
801 800
801 start <<= (24 - PAGE_SHIFT);
802 end <<= (24 - PAGE_SHIFT);
803 end |= (1 << (24 - PAGE_SHIFT)) - 1;
804
802 csrow->first_page = start >> PAGE_SHIFT; 805 csrow->first_page = start >> PAGE_SHIFT;
803 csrow->last_page = end >> PAGE_SHIFT; 806 csrow->last_page = end >> PAGE_SHIFT;
804 csrow->nr_pages = csrow->last_page + 1 - csrow->first_page; 807 csrow->nr_pages = end + 1 - start;
805 csrow->grain = 8; 808 csrow->grain = 8;
806 csrow->mtype = mtype; 809 csrow->mtype = mtype;
807 csrow->dtype = DEV_UNKNOWN; 810 csrow->dtype = DEV_UNKNOWN;
@@ -985,6 +988,7 @@ static struct of_device_id mpc85xx_mc_err_of_match[] = {
985 { .compatible = "fsl,mpc8560-memory-controller", }, 988 { .compatible = "fsl,mpc8560-memory-controller", },
986 { .compatible = "fsl,mpc8568-memory-controller", }, 989 { .compatible = "fsl,mpc8568-memory-controller", },
987 { .compatible = "fsl,mpc8572-memory-controller", }, 990 { .compatible = "fsl,mpc8572-memory-controller", },
991 { .compatible = "fsl,mpc8349-memory-controller", },
988 { .compatible = "fsl,p2020-memory-controller", }, 992 { .compatible = "fsl,p2020-memory-controller", },
989 {}, 993 {},
990}; 994};
@@ -1001,13 +1005,13 @@ static struct of_platform_driver mpc85xx_mc_err_driver = {
1001 }, 1005 },
1002}; 1006};
1003 1007
1004 1008#ifdef CONFIG_MPC85xx
1005static void __init mpc85xx_mc_clear_rfxe(void *data) 1009static void __init mpc85xx_mc_clear_rfxe(void *data)
1006{ 1010{
1007 orig_hid1[smp_processor_id()] = mfspr(SPRN_HID1); 1011 orig_hid1[smp_processor_id()] = mfspr(SPRN_HID1);
1008 mtspr(SPRN_HID1, (orig_hid1[smp_processor_id()] & ~0x20000)); 1012 mtspr(SPRN_HID1, (orig_hid1[smp_processor_id()] & ~0x20000));
1009} 1013}
1010 1014#endif
1011 1015
1012static int __init mpc85xx_mc_init(void) 1016static int __init mpc85xx_mc_init(void)
1013{ 1017{
@@ -1040,26 +1044,32 @@ static int __init mpc85xx_mc_init(void)
1040 printk(KERN_WARNING EDAC_MOD_STR "PCI fails to register\n"); 1044 printk(KERN_WARNING EDAC_MOD_STR "PCI fails to register\n");
1041#endif 1045#endif
1042 1046
1047#ifdef CONFIG_MPC85xx
1043 /* 1048 /*
1044 * need to clear HID1[RFXE] to disable machine check int 1049 * need to clear HID1[RFXE] to disable machine check int
1045 * so we can catch it 1050 * so we can catch it
1046 */ 1051 */
1047 if (edac_op_state == EDAC_OPSTATE_INT) 1052 if (edac_op_state == EDAC_OPSTATE_INT)
1048 on_each_cpu(mpc85xx_mc_clear_rfxe, NULL, 0); 1053 on_each_cpu(mpc85xx_mc_clear_rfxe, NULL, 0);
1054#endif
1049 1055
1050 return 0; 1056 return 0;
1051} 1057}
1052 1058
1053module_init(mpc85xx_mc_init); 1059module_init(mpc85xx_mc_init);
1054 1060
1061#ifdef CONFIG_MPC85xx
1055static void __exit mpc85xx_mc_restore_hid1(void *data) 1062static void __exit mpc85xx_mc_restore_hid1(void *data)
1056{ 1063{
1057 mtspr(SPRN_HID1, orig_hid1[smp_processor_id()]); 1064 mtspr(SPRN_HID1, orig_hid1[smp_processor_id()]);
1058} 1065}
1066#endif
1059 1067
1060static void __exit mpc85xx_mc_exit(void) 1068static void __exit mpc85xx_mc_exit(void)
1061{ 1069{
1070#ifdef CONFIG_MPC85xx
1062 on_each_cpu(mpc85xx_mc_restore_hid1, NULL, 0); 1071 on_each_cpu(mpc85xx_mc_restore_hid1, NULL, 0);
1072#endif
1063#ifdef CONFIG_PCI 1073#ifdef CONFIG_PCI
1064 of_unregister_platform_driver(&mpc85xx_pci_err_driver); 1074 of_unregister_platform_driver(&mpc85xx_pci_err_driver);
1065#endif 1075#endif