diff options
author | Ira W. Snyder <iws@ovro.caltech.edu> | 2009-09-23 18:57:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-24 10:21:04 -0400 |
commit | b4846251727a38a7f248e41308c060995371dd05 (patch) | |
tree | 6fc1356be42c88ce3dfc373a8eb9fd97ed1377f7 /drivers/edac/mpc85xx_edac.c | |
parent | a014554e667d702a3a7ae1cf500ebd358e7991be (diff) |
edac: mpc85xx add mpc83xx support
Add support for the Freescale MPC83xx memory controller to the existing
driver for the Freescale MPC85xx memory controller. The only difference
between the two processors are in the CS_BNDS register parsing code, which
has been changed so it will work on both processors.
The L2 cache controller does not exist on the MPC83xx, but the OF
subsystem will not use the driver if the device is not present in the OF
device tree.
I had to change the nr_pages calculation to make the math work out. I
checked it on my board and did the math by hand for a 64GB 85xx using 64K
pages. In both cases, nr_pages * PAGE_SIZE comes out to the correct
value.
Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu>
Signed-off-by: Doug Thompson <dougthompson@xmission.com>
Cc: Kumar Gala <galak@gate.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/edac/mpc85xx_edac.c')
-rw-r--r-- | drivers/edac/mpc85xx_edac.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c index 1dd405e0e55..157f6504f25 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 | ||
43 | static u32 orig_l2_err_disable; | 43 | static u32 orig_l2_err_disable; |
44 | #ifdef CONFIG_MPC85xx | ||
44 | static u32 orig_hid1[2]; | 45 | static 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 | |
1005 | static void __init mpc85xx_mc_clear_rfxe(void *data) | 1009 | static 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 | ||
1012 | static int __init mpc85xx_mc_init(void) | 1016 | static 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 | ||
1053 | module_init(mpc85xx_mc_init); | 1059 | module_init(mpc85xx_mc_init); |
1054 | 1060 | ||
1061 | #ifdef CONFIG_MPC85xx | ||
1055 | static void __exit mpc85xx_mc_restore_hid1(void *data) | 1062 | static 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 | ||
1060 | static void __exit mpc85xx_mc_exit(void) | 1068 | static 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 |