aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac
diff options
context:
space:
mode:
authorThor Thayer <tthayer@opensource.altera.com>2016-06-22 09:58:55 -0400
committerBorislav Petkov <bp@suse.de>2016-06-24 08:18:33 -0400
commit6b300fb953d9a9fc67f5a220c648eadaee289367 (patch)
treef7badd2c3b8faa832961b2477ea90e864904223e /drivers/edac
parent2b083d65ff11e02b967d9f6e68aea7722eba9ea4 (diff)
EDAC, altera: Drop some ifdeffery
Make the IRQ and check_deps() functions available to all the memory buffers by moving them outside of the OCRAM only area. Signed-off-by: Thor Thayer <tthayer@opensource.altera.com> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-edac <linux-edac@vger.kernel.org> Link: http://lkml.kernel.org/r/1466603939-7526-5-git-send-email-tthayer@opensource.altera.com Signed-off-by: Borislav Petkov <bp@suse.de>
Diffstat (limited to 'drivers/edac')
-rw-r--r--drivers/edac/altera_edac.c62
1 files changed, 33 insertions, 29 deletions
diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
index dcedc4a8cd12..2e5940e5801e 100644
--- a/drivers/edac/altera_edac.c
+++ b/drivers/edac/altera_edac.c
@@ -825,16 +825,16 @@ static struct platform_driver altr_edac_device_driver = {
825}; 825};
826module_platform_driver(altr_edac_device_driver); 826module_platform_driver(altr_edac_device_driver);
827 827
828/*********************** OCRAM EDAC Device Functions *********************/ 828/******************* Arria10 Device ECC Shared Functions *****************/
829 829
830#ifdef CONFIG_EDAC_ALTERA_OCRAM
831/* 830/*
832 * Test for memory's ECC dependencies upon entry because platform specific 831 * Test for memory's ECC dependencies upon entry because platform specific
833 * startup should have initialized the memory and enabled the ECC. 832 * startup should have initialized the memory and enabled the ECC.
834 * Can't turn on ECC here because accessing un-initialized memory will 833 * Can't turn on ECC here because accessing un-initialized memory will
835 * cause CE/UE errors possibly causing an ABORT. 834 * cause CE/UE errors possibly causing an ABORT.
836 */ 835 */
837static int altr_check_ecc_deps(struct altr_edac_device_dev *device) 836static int __maybe_unused
837altr_check_ecc_deps(struct altr_edac_device_dev *device)
838{ 838{
839 void __iomem *base = device->base; 839 void __iomem *base = device->base;
840 const struct edac_device_prv_data *prv = device->data; 840 const struct edac_device_prv_data *prv = device->data;
@@ -848,6 +848,36 @@ static int altr_check_ecc_deps(struct altr_edac_device_dev *device)
848 return -ENODEV; 848 return -ENODEV;
849} 849}
850 850
851static irqreturn_t __maybe_unused altr_edac_a10_ecc_irq(int irq, void *dev_id)
852{
853 struct altr_edac_device_dev *dci = dev_id;
854 void __iomem *base = dci->base;
855
856 if (irq == dci->sb_irq) {
857 writel(ALTR_A10_ECC_SERRPENA,
858 base + ALTR_A10_ECC_INTSTAT_OFST);
859 edac_device_handle_ce(dci->edac_dev, 0, 0, dci->edac_dev_name);
860
861 return IRQ_HANDLED;
862 } else if (irq == dci->db_irq) {
863 writel(ALTR_A10_ECC_DERRPENA,
864 base + ALTR_A10_ECC_INTSTAT_OFST);
865 edac_device_handle_ue(dci->edac_dev, 0, 0, dci->edac_dev_name);
866 if (dci->data->panic)
867 panic("\nEDAC:ECC_DEVICE[Uncorrectable errors]\n");
868
869 return IRQ_HANDLED;
870 }
871
872 WARN_ON(1);
873
874 return IRQ_NONE;
875}
876
877/*********************** OCRAM EDAC Device Functions *********************/
878
879#ifdef CONFIG_EDAC_ALTERA_OCRAM
880
851static void *ocram_alloc_mem(size_t size, void **other) 881static void *ocram_alloc_mem(size_t size, void **other)
852{ 882{
853 struct device_node *np; 883 struct device_node *np;
@@ -882,32 +912,6 @@ static void ocram_free_mem(void *p, size_t size, void *other)
882 gen_pool_free((struct gen_pool *)other, (u32)p, size); 912 gen_pool_free((struct gen_pool *)other, (u32)p, size);
883} 913}
884 914
885static irqreturn_t altr_edac_a10_ecc_irq(int irq, void *dev_id)
886{
887 struct altr_edac_device_dev *dci = dev_id;
888 void __iomem *base = dci->base;
889
890 if (irq == dci->sb_irq) {
891 writel(ALTR_A10_ECC_SERRPENA,
892 base + ALTR_A10_ECC_INTSTAT_OFST);
893 edac_device_handle_ce(dci->edac_dev, 0, 0, dci->edac_dev_name);
894
895 return IRQ_HANDLED;
896 } else if (irq == dci->db_irq) {
897 writel(ALTR_A10_ECC_DERRPENA,
898 base + ALTR_A10_ECC_INTSTAT_OFST);
899 edac_device_handle_ue(dci->edac_dev, 0, 0, dci->edac_dev_name);
900 if (dci->data->panic)
901 panic("\nEDAC:ECC_DEVICE[Uncorrectable errors]\n");
902
903 return IRQ_HANDLED;
904 }
905
906 WARN_ON(1);
907
908 return IRQ_NONE;
909}
910
911static const struct edac_device_prv_data ocramecc_data = { 915static const struct edac_device_prv_data ocramecc_data = {
912 .setup = altr_check_ecc_deps, 916 .setup = altr_check_ecc_deps,
913 .ce_clear_mask = (ALTR_OCR_ECC_EN | ALTR_OCR_ECC_SERR), 917 .ce_clear_mask = (ALTR_OCR_ECC_EN | ALTR_OCR_ECC_SERR),