]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
EDAC, altera: Add Arria10 NAND support
authorThor Thayer <tthayer@opensource.altera.com>
Thu, 14 Jul 2016 16:06:43 +0000 (11:06 -0500)
committerBorislav Petkov <bp@suse.de>
Mon, 8 Aug 2016 03:59:35 +0000 (05:59 +0200)
Add Altera Arria10 NAND FIFO memory support.

Signed-off-by: Thor Thayer <tthayer@opensource.altera.com>
Cc: dinguyen@opensource.altera.com
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-edac <linux-edac@vger.kernel.org>
Link: http://lkml.kernel.org/r/1468512408-5156-6-git-send-email-tthayer@opensource.altera.com
[ Reformat loop in altr_edac_a10_probe() for better readability. ]
Signed-off-by: Borislav Petkov <bp@suse.de>
drivers/edac/Kconfig
drivers/edac/altera_edac.c

index d0c1dab9b435480bef9d6c61f42cac9dbea0107f..47378b30c8c35f12412a33a8aff260cca433a747 100644 (file)
@@ -398,6 +398,13 @@ config EDAC_ALTERA_ETHERNET
          Support for error detection and correction on the
          Altera Ethernet FIFO Memory for Altera SoCs.
 
+config EDAC_ALTERA_NAND
+       bool "Altera NAND FIFO ECC"
+       depends on EDAC_ALTERA=y && MTD_NAND_DENALI
+       help
+         Support for error detection and correction on the
+         Altera NAND FIFO Memory for Altera SoCs.
+
 config EDAC_SYNOPSYS
        tristate "Synopsys DDR Memory Controller"
        depends on EDAC_MM_EDAC && ARCH_ZYNQ
index 2398d0701f5b0dad1f5eb98a32f093a668c95844..fe6374236bd96ab0cb20a88f3802a41627242057 100644 (file)
@@ -1285,6 +1285,33 @@ early_initcall(socfpga_init_ethernet_ecc);
 
 #endif /* CONFIG_EDAC_ALTERA_ETHERNET */
 
+/********************** NAND Device Functions **********************/
+
+#ifdef CONFIG_EDAC_ALTERA_NAND
+
+static const struct edac_device_prv_data a10_nandecc_data = {
+       .setup = altr_check_ecc_deps,
+       .ce_clear_mask = ALTR_A10_ECC_SERRPENA,
+       .ue_clear_mask = ALTR_A10_ECC_DERRPENA,
+       .dbgfs_name = "altr_trigger",
+       .ecc_enable_mask = ALTR_A10_COMMON_ECC_EN_CTL,
+       .ecc_en_ofst = ALTR_A10_ECC_CTRL_OFST,
+       .ce_set_mask = ALTR_A10_ECC_TSERRA,
+       .ue_set_mask = ALTR_A10_ECC_TDERRA,
+       .set_err_ofst = ALTR_A10_ECC_INTTEST_OFST,
+       .ecc_irq_handler = altr_edac_a10_ecc_irq,
+       .inject_fops = &altr_edac_a10_device_inject_fops,
+};
+
+static int __init socfpga_init_nand_ecc(void)
+{
+       return altr_init_a10_ecc_device_type("altr,socfpga-nand-ecc");
+}
+
+early_initcall(socfpga_init_nand_ecc);
+
+#endif /* CONFIG_EDAC_ALTERA_NAND */
+
 /********************* Arria10 EDAC Device Functions *************************/
 static const struct of_device_id altr_edac_a10_device_of_match[] = {
 #ifdef CONFIG_EDAC_ALTERA_L2C
@@ -1297,6 +1324,9 @@ static const struct of_device_id altr_edac_a10_device_of_match[] = {
 #ifdef CONFIG_EDAC_ALTERA_ETHERNET
        { .compatible = "altr,socfpga-eth-mac-ecc",
          .data = &a10_enetecc_data },
+#endif
+#ifdef CONFIG_EDAC_ALTERA_NAND
+       { .compatible = "altr,socfpga-nand-ecc", .data = &a10_nandecc_data },
 #endif
        {},
 };
@@ -1584,15 +1614,15 @@ static int altr_edac_a10_probe(struct platform_device *pdev)
        for_each_child_of_node(pdev->dev.of_node, child) {
                if (!of_device_is_available(child))
                        continue;
-               if (of_device_is_compatible(child, "altr,socfpga-a10-l2-ecc"))
-                       altr_edac_a10_device_add(edac, child);
-               else if ((of_device_is_compatible(child,
-                                       "altr,socfpga-a10-ocram-ecc")) ||
-                        (of_device_is_compatible(child,
-                                       "altr,socfpga-eth-mac-ecc")))
+
+               if (of_device_is_compatible(child, "altr,socfpga-a10-l2-ecc") || 
+                   of_device_is_compatible(child, "altr,socfpga-a10-ocram-ecc") ||
+                   of_device_is_compatible(child, "altr,socfpga-eth-mac-ecc") ||
+                   of_device_is_compatible(child, "altr,socfpga-nand-ecc"))
+
                        altr_edac_a10_device_add(edac, child);
-               else if (of_device_is_compatible(child,
-                                                "altr,sdram-edac-a10"))
+
+               else if (of_device_is_compatible(child, "altr,sdram-edac-a10"))
                        of_platform_populate(pdev->dev.of_node,
                                             altr_sdram_ctrl_of_match,
                                             NULL, &pdev->dev);