Skip to contentSkip to conversation

Add Altera peripheral memories to EDAC framework

PATCH In review [email protected] 5 participants 22 messages Oct 1, 2014 – Oct 7, 2014 15 messages not in the archive

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover Add Altera peripheral memories to EDAC framework

From: Thor Thayer <[email protected]>

This patch adds the L2 cache and OCRAM peripherals to the EDAC framework using the EDAC device framework. The ECC is enabled early in the boot process in the platform specific code.

Thor Thayer (3):
arm: socfpga: Enable ECC of L2 and OCRAM on startup.
edac: altera: Add Altera L2 Cache and OCRAM EDAC Support
arm: dts: Add Altera L2 Cache and OCRAM EDAC

 .../bindings/arm/altera/socfpga-l2-edac.txt        |   15 ++
 .../bindings/arm/altera/socfpga-ocram-edac.txt     |   16 ++
 MAINTAINERS                                        |    7 +
 arch/arm/boot/dts/socfpga.dtsi                     |   20 +-
 arch/arm/configs/socfpga_defconfig                 |    1 +
 arch/arm/mach-socfpga/Makefile                     |    2 +
 arch/arm/mach-socfpga/l2_cache.c                   |   44 ++++
 arch/arm/mach-socfpga/l2_cache.h                   |   28 +++
 arch/arm/mach-socfpga/ocram.c                      |   84 +++++++
 arch/arm/mach-socfpga/ocram.h                      |   28 +++
 arch/arm/mach-socfpga/socfpga.c                    |   13 +-
 drivers/edac/Kconfig                               |   14 ++
 drivers/edac/Makefile                              |    4 +
 drivers/edac/altera_edac_mgr.c                     |  261 ++++++++++++++++++++
 drivers/edac/altera_edac_mgr.h                     |   56 +++++
 drivers/edac/altera_l2_edac.c                      |  130 ++++++++++
 drivers/edac/altera_ocram_edac.c                   |  107 ++++++++
 17 files changed, 828 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/altera/socfpga-l2-edac.txt
 create mode 100644 Documentation/devicetree/bindings/arm/altera/socfpga-ocram-edac.txt
 create mode 100644 arch/arm/mach-socfpga/l2_cache.c
 create mode 100644 arch/arm/mach-socfpga/l2_cache.h
 create mode 100644 arch/arm/mach-socfpga/ocram.c
 create mode 100644 arch/arm/mach-socfpga/ocram.h
 create mode 100644 drivers/edac/altera_edac_mgr.c
 create mode 100644 drivers/edac/altera_edac_mgr.h
 create mode 100644 drivers/edac/altera_l2_edac.c
 create mode 100644 drivers/edac/altera_ocram_edac.c
Signature · 6 lines
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1412181092-27162-1-git-send-email-tthayer-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org

#2 lore raw

PATCH 1/3 arm: socfpga: Enable ECC of L2 and OCRAM on startup.

From: Thor Thayer <[email protected]>

This patch enables the ECC for L2 cache and OCRAM on machine startup. In both cases, the ECC has to be enabled before data is stored in memory otherwise the ECC will fail on reads.

---
 MAINTAINERS                        |    6 +++
 arch/arm/configs/socfpga_defconfig |    1 +
 arch/arm/mach-socfpga/Makefile     |    2 +
 arch/arm/mach-socfpga/l2_cache.c   |   44 +++++++++++++++++++
 arch/arm/mach-socfpga/l2_cache.h   |   28 ++++++++++++
 arch/arm/mach-socfpga/ocram.c      |   84 ++++++++++++++++++++++++++++++++++++
 arch/arm/mach-socfpga/ocram.h      |   28 ++++++++++++
 arch/arm/mach-socfpga/socfpga.c    |   13 +++++-
 8 files changed, 205 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-socfpga/l2_cache.c
 create mode 100644 arch/arm/mach-socfpga/l2_cache.h
 create mode 100644 arch/arm/mach-socfpga/ocram.c
 create mode 100644 arch/arm/mach-socfpga/ocram.h
MAINTAINERS +6 -0
index 5e7866a..9faf1d3 100644
@@ -1381,6 +1381,12 @@ M:	Dinh Nguyen <[email protected]>
 S:	Maintained
 F:	drivers/clk/socfpga/
 
+ARM/SOCFPGA EDAC SUPPORT
+M:	Thor Thayer <[email protected]>
+S:	Maintained
+F:	arch/arm/mach-socfpga/l2_cache.*
+F:	arch/arm/mach-socfpga/ocram.*
+
 ARM/STI ARCHITECTURE
 M:	Srinivas Kandagatla <[email protected]>
 M:	Maxime Coquelin <[email protected]>
arch/arm/configs/socfpga_defconfig +1 -0
index d7a5855..e757a33 100644
@@ -123,3 +123,4 @@ CONFIG_USB=y
 CONFIG_USB_DWC2=y
 CONFIG_USB_DWC2_HOST=y
 CONFIG_USB_DWC2_PLATFORM=y
+CONFIG_SRAM=y
\ No newline at end of file
arch/arm/mach-socfpga/Makefile +2 -0
index 6dd7a93..851a144 100644
@@ -4,3 +4,5 @@
 
 obj-y					:= socfpga.o
 obj-$(CONFIG_SMP)	+= headsmp.o platsmp.o
+obj-$(CONFIG_EDAC_ALTERA_OCRAM) += ocram.o
+obj-$(CONFIG_EDAC_ALTERA_L2C) += l2_cache.o
arch/arm/mach-socfpga/l2_cache.c new file +44 -0

44 lines not on this page · raw message

arch/arm/mach-socfpga/l2_cache.h new file +28 -0
new file mode 100644
index 0000000..58e140d
@@ -0,0 +1,28 @@
+/*
+ * Copyright Altera Corporation (C) 2014. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MACH_SOCFPGA_L2_CACHE_H
+#define MACH_SOCFPGA_L2_CACHE_H
+
+#ifdef CONFIG_EDAC_ALTERA_L2C
+void socfpga_init_l2_ecc(void);
+#else
+inline void socfpga_init_l2_ecc(void)
+{
+}
+#endif
+
+#endif /* #ifndef MACH_SOCFPGA_L2_CACHE_H */
arch/arm/mach-socfpga/ocram.c new file +84 -0

84 lines not on this page · raw message

arch/arm/mach-socfpga/ocram.h new file +28 -0
new file mode 100644
index 0000000..f93cf84
@@ -0,0 +1,28 @@
+/*
+ * Copyright Altera Corporation (C) 2014. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MACH_SOCFPGA_OCRAM_H
+#define MACH_SOCFPGA_OCRAM_H
+
+#ifdef CONFIG_EDAC_ALTERA_OCRAM
+void socfpga_init_ocram_ecc(void);
+#else
+inline void socfpga_init_ocram_ecc(void)
+{
+}
+#endif
+
+#endif /* #ifndef MACH_SOCFPGA_OCRAM_H */
arch/arm/mach-socfpga/socfpga.c +12 -1
index adbf383..fb41aca 100644
@@ -1,5 +1,5 @@
 /*
- *  Copyright (C) 2012 Altera Corporation
+ *  Copyright (C) 2012;2014 Altera Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -25,6 +25,8 @@
 #include <asm/mach/map.h>
 
 #include "core.h"
+#include "l2_cache.h"
+#include "ocram.h"
 
 void __iomem *socfpga_scu_base_addr = ((void __iomem *)(SOCFPGA_SCU_VIRT_BASE));
 void __iomem *sys_manager_base_addr;
@@ -83,6 +85,7 @@ static void __init socfpga_init_irq(void)
 {
 	irqchip_init();
 	socfpga_sysmgr_init();
+	socfpga_init_l2_ecc();
 }
 
 static void socfpga_cyclone5_restart(enum reboot_mode mode, const char *cmd)
@@ -98,6 +101,13 @@ static void socfpga_cyclone5_restart(enum reboot_mode mode, const char *cmd)
 	writel(temp, rst_manager_base_addr + SOCFPGA_RSTMGR_CTRL);
 }
 
+static void __init socfpga_cyclone5_init(void)
+{
+	of_platform_populate(NULL, of_default_bus_match_table,
+			     NULL, NULL);
+	socfpga_init_ocram_ecc();
+}
+
 static const char *altera_dt_match[] = {
 	"altr,socfpga",
 	NULL
@@ -109,6 +119,7 @@ DT_MACHINE_START(SOCFPGA, "Altera SOCFPGA")
 	.smp		= smp_ops(socfpga_smp_ops),
 	.map_io		= socfpga_map_io,
 	.init_irq	= socfpga_init_irq,
+	.init_machine	= socfpga_cyclone5_init,
 	.restart	= socfpga_cyclone5_restart,
 	.dt_compat	= altera_dt_match,
 MACHINE_END
Signature · 6 lines
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1412181092-27162-2-git-send-email-tthayer-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org

#4 lore raw

Re: [PATCH 1/3] arm: socfpga: Enable ECC of L2 and OCRAM on startup.

Quoted 296 lines · On 10/1/14, 11:31 AM, [email protected]…

From: Thor Thayer <[email protected]>

This patch enables the ECC for L2 cache and OCRAM on machine startup. In both cases, the ECC has to be enabled before data is stored in memory otherwise the ECC will fail on reads.

---
 MAINTAINERS                        |    6 +++
 arch/arm/configs/socfpga_defconfig |    1 +
 arch/arm/mach-socfpga/Makefile     |    2 +
 arch/arm/mach-socfpga/l2_cache.c   |   44 +++++++++++++++++++
 arch/arm/mach-socfpga/l2_cache.h   |   28 ++++++++++++
 arch/arm/mach-socfpga/ocram.c      |   84 ++++++++++++++++++++++++++++++++++++
 arch/arm/mach-socfpga/ocram.h      |   28 ++++++++++++
 arch/arm/mach-socfpga/socfpga.c    |   13 +++++-
 8 files changed, 205 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-socfpga/l2_cache.c
 create mode 100644 arch/arm/mach-socfpga/l2_cache.h
 create mode 100644 arch/arm/mach-socfpga/ocram.c
 create mode 100644 arch/arm/mach-socfpga/ocram.h
MAINTAINERS +6 -0
index 5e7866a..9faf1d3 100644
@@ -1381,6 +1381,12 @@ M:	Dinh Nguyen <[email protected]>
 S:	Maintained
 F:	drivers/clk/socfpga/
 
+ARM/SOCFPGA EDAC SUPPORT
+M:	Thor Thayer <[email protected]>
+S:	Maintained
+F:	arch/arm/mach-socfpga/l2_cache.*
+F:	arch/arm/mach-socfpga/ocram.*
+
 ARM/STI ARCHITECTURE
 M:	Srinivas Kandagatla <[email protected]>
 M:	Maxime Coquelin <[email protected]>
arch/arm/configs/socfpga_defconfig +1 -0
index d7a5855..e757a33 100644
@@ -123,3 +123,4 @@ CONFIG_USB=y
 CONFIG_USB_DWC2=y
 CONFIG_USB_DWC2_HOST=y
 CONFIG_USB_DWC2_PLATFORM=y
+CONFIG_SRAM=y
\ No newline at end of file
arch/arm/mach-socfpga/Makefile +2 -0
index 6dd7a93..851a144 100644
@@ -4,3 +4,5 @@
 
 obj-y					:= socfpga.o
 obj-$(CONFIG_SMP)	+= headsmp.o platsmp.o
+obj-$(CONFIG_EDAC_ALTERA_OCRAM) += ocram.o
+obj-$(CONFIG_EDAC_ALTERA_L2C) += l2_cache.o
arch/arm/mach-socfpga/l2_cache.c new file +44 -0
new file mode 100644
index 0000000..8e109f3
@@ -0,0 +1,44 @@
+/*
+ * Copyright Altera Corporation (C) 2014. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#include <linux/clk-provider.h>
+#include <linux/of_platform.h>
+#include <linux/of_address.h>
+
+#include "l2_cache.h"
+
+void socfpga_init_l2_ecc(void)
+{
+	struct device_node *np;
+	void __iomem  *mapped_l2_edac_addr;
+
+	np = of_find_compatible_node(NULL, NULL, "altr,l2-edac");
+	if (!np) {
+		pr_err("SOCFPGA: Unable to find altr,l2-edac in dtb\n");
+		return;
+	}
+
+	mapped_l2_edac_addr = of_iomap(np, 0);
+	if (!mapped_l2_edac_addr) {
+		pr_err("SOCFPGA: Unable to find L2 ECC mapping in dtb\n");
+		return;
+	}
+
+	/* Enable ECC */
+	writel(0x01, mapped_l2_edac_addr);
+
+	pr_debug("SOCFPGA: Success Initializing L2 cache ECC\n");
+}
+
arch/arm/mach-socfpga/l2_cache.h new file +28 -0
new file mode 100644
index 0000000..58e140d
@@ -0,0 +1,28 @@
+/*
+ * Copyright Altera Corporation (C) 2014. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MACH_SOCFPGA_L2_CACHE_H
+#define MACH_SOCFPGA_L2_CACHE_H
+
+#ifdef CONFIG_EDAC_ALTERA_L2C
+void socfpga_init_l2_ecc(void);
+#else
+inline void socfpga_init_l2_ecc(void)
+{
+}
+#endif
+
+#endif /* #ifndef MACH_SOCFPGA_L2_CACHE_H */
arch/arm/mach-socfpga/ocram.c new file +84 -0
new file mode 100644
index 0000000..26ec113
@@ -0,0 +1,84 @@
+/*
+ * Copyright Altera Corporation (C) 2014. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#include <linux/clk-provider.h>
+#include <linux/genalloc.h>
+#include <linux/of_platform.h>
+
+#include "ocram.h"
+
+void socfpga_init_ocram_ecc(void)
+{
+	struct device_node *np;
+	const __be32 *prop;
+	u32 ocr_edac_addr, iram_addr, len;
+	void __iomem  *mapped_ocr_edac_addr;
+	size_t size;
+	struct gen_pool *gp;
+
+	np = of_find_compatible_node(NULL, NULL, "altr,ocram-edac");
+	if (!np) {
+		pr_err("SOCFPGA: Unable to find altr,ocram-edac in dtb\n");
+		return;
+	}
+
+	prop = of_get_property(np, "reg", &size);
+	ocr_edac_addr = be32_to_cpup(prop++);
+	len = be32_to_cpup(prop);
+	if (!prop || size < sizeof(*prop)) {
+		pr_err("SOCFPGA: Unable to find OCRAM ECC mapping in dtb\n");
+		return;
+	}
+
+	gp = of_get_named_gen_pool(np, "iram", 0);
+	if (!gp) {
+		pr_err("SOCFPGA: OCRAM cannot find gen pool\n");
+		return;
+	}
+
+	np = of_find_compatible_node(NULL, NULL, "mmio-sram");
+	if (!np) {
+		pr_err("SOCFPGA: Unable to find mmio-sram in dtb\n");
+		return;
+	}
+	/* Determine the OCRAM address and size */
+	prop = of_get_property(np, "reg", &size);
+	iram_addr = be32_to_cpup(prop++);
+	len = be32_to_cpup(prop);
+
+	if (!prop || size < sizeof(*prop)) {
+		pr_err("SOCFPGA: Unable to find OCRAM mapping in dtb\n");
+		return;
+	}
+
+	iram_addr = gen_pool_alloc(gp, len);
+	if (iram_addr == 0) {
+		pr_err("SOCFPGA: cannot alloc from gen pool\n");
+		return;
+	}
+
+	memset((void *)iram_addr, 0, len);
+
+	mapped_ocr_edac_addr = ioremap(ocr_edac_addr, 4);
+
+	gen_pool_free(gp, iram_addr, len);
+
+	/* Clear any pending OCRAM ECC interrupts, then enable ECC */
+	writel(0x18, mapped_ocr_edac_addr);
+	writel(0x19, mapped_ocr_edac_addr);
+
+	pr_debug("SOCFPGA: Success Initializing OCRAM\n");
+}
+
arch/arm/mach-socfpga/ocram.h new file +28 -0
new file mode 100644
index 0000000..f93cf84
@@ -0,0 +1,28 @@
+/*
+ * Copyright Altera Corporation (C) 2014. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MACH_SOCFPGA_OCRAM_H
+#define MACH_SOCFPGA_OCRAM_H
+
+#ifdef CONFIG_EDAC_ALTERA_OCRAM
+void socfpga_init_ocram_ecc(void);
+#else
+inline void socfpga_init_ocram_ecc(void)
+{
+}
+#endif
+
+#endif /* #ifndef MACH_SOCFPGA_OCRAM_H */
arch/arm/mach-socfpga/socfpga.c +4 -1
index adbf383..fb41aca 100644
@@ -1,5 +1,5 @@
 /*
- *  Copyright (C) 2012 Altera Corporation
+ *  Copyright (C) 2012;2014 Altera Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -25,6 +25,8 @@
 #include <asm/mach/map.h>
 
 #include "core.h"
+#include "l2_cache.h"
+#include "ocram.h"
 
 void __iomem *socfpga_scu_base_addr = ((void __iomem *)(SOCFPGA_SCU_VIRT_BASE));
 void __iomem *sys_manager_base_addr;
@@ -83,6 +85,7 @@ static void __init socfpga_init_irq(void)
 {
 	irqchip_init();
 	socfpga_sysmgr_init();
+	socfpga_init_l2_ecc();
 }
 
 static void socfpga_cyclone5_restart(enum reboot_mode mode, const char *cmd)

arch/arm/mach-socfpga/socfpga.c static void socfpga_cyclone5_restart(enum reboot_mode mode, const char *cmd) · line 107

Quoted 7 lines
arch/arm/mach-socfpga/socfpga.c +4 -0
@@ -98,6 +101,13 @@ static void socfpga_cyclone5_restart(enum reboot_mode mode, const char *cmd)
 	writel(temp, rst_manager_base_addr + SOCFPGA_RSTMGR_CTRL);
 }
 
+static void __init socfpga_cyclone5_init(void)
+{
+	of_platform_populate(NULL, of_default_bus_match_table,
+			     NULL, NULL);

Why is this needed?

Dinh
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

Re: [PATCH 1/3] arm: socfpga: Enable ECC of L2 and OCRAM on startup.

Quoted 301 lines · Dinh Nguyen
Quoted 299 lines · On 10/1/14, 11:31 AM, [email protected]…

From: Thor Thayer <[email protected]>

This patch enables the ECC for L2 cache and OCRAM on machine startup. In both cases, the ECC has to be enabled before data is stored in memory otherwise the ECC will fail on reads.

---
  MAINTAINERS                        |    6 +++
  arch/arm/configs/socfpga_defconfig |    1 +
  arch/arm/mach-socfpga/Makefile     |    2 +
  arch/arm/mach-socfpga/l2_cache.c   |   44 +++++++++++++++++++
  arch/arm/mach-socfpga/l2_cache.h   |   28 ++++++++++++
  arch/arm/mach-socfpga/ocram.c      |   84 ++++++++++++++++++++++++++++++++++++
  arch/arm/mach-socfpga/ocram.h      |   28 ++++++++++++
  arch/arm/mach-socfpga/socfpga.c    |   13 +++++-
  8 files changed, 205 insertions(+), 1 deletion(-)

create mode 100644 arch/arm/mach-socfpga/l2_cache.c create mode 100644 arch/arm/mach-socfpga/l2_cache.h create mode 100644 arch/arm/mach-socfpga/ocram.c create mode 100644 arch/arm/mach-socfpga/ocram.h

MAINTAINERS +6 -0
index 5e7866a..9faf1d3 100644
@@ -1381,6 +1381,12 @@ M:	Dinh Nguyen <[email protected]>
  S:	Maintained
  F:	drivers/clk/socfpga/
 
+ARM/SOCFPGA EDAC SUPPORT
+M:	Thor Thayer <[email protected]>
+S:	Maintained
+F:	arch/arm/mach-socfpga/l2_cache.*
+F:	arch/arm/mach-socfpga/ocram.*
+
  ARM/STI ARCHITECTURE
  M:	Srinivas Kandagatla <[email protected]>
  M:	Maxime Coquelin <[email protected]>
arch/arm/configs/socfpga_defconfig +1 -0
index d7a5855..e757a33 100644
@@ -123,3 +123,4 @@ CONFIG_USB=y
  CONFIG_USB_DWC2=y
  CONFIG_USB_DWC2_HOST=y
  CONFIG_USB_DWC2_PLATFORM=y
+CONFIG_SRAM=y
\ No newline at end of file
arch/arm/mach-socfpga/Makefile +2 -0
index 6dd7a93..851a144 100644
@@ -4,3 +4,5 @@
 
  obj-y					:= socfpga.o
  obj-$(CONFIG_SMP)	+= headsmp.o platsmp.o
+obj-$(CONFIG_EDAC_ALTERA_OCRAM) += ocram.o
+obj-$(CONFIG_EDAC_ALTERA_L2C) += l2_cache.o
arch/arm/mach-socfpga/l2_cache.c new file +44 -0
new file mode 100644
index 0000000..8e109f3
@@ -0,0 +1,44 @@
+/*
+ * Copyright Altera Corporation (C) 2014. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#include <linux/clk-provider.h>
+#include <linux/of_platform.h>
+#include <linux/of_address.h>
+
+#include "l2_cache.h"
+
+void socfpga_init_l2_ecc(void)
+{
+	struct device_node *np;
+	void __iomem  *mapped_l2_edac_addr;
+
+	np = of_find_compatible_node(NULL, NULL, "altr,l2-edac");
+	if (!np) {
+		pr_err("SOCFPGA: Unable to find altr,l2-edac in dtb\n");
+		return;
+	}
+
+	mapped_l2_edac_addr = of_iomap(np, 0);
+	if (!mapped_l2_edac_addr) {
+		pr_err("SOCFPGA: Unable to find L2 ECC mapping in dtb\n");
+		return;
+	}
+
+	/* Enable ECC */
+	writel(0x01, mapped_l2_edac_addr);
+
+	pr_debug("SOCFPGA: Success Initializing L2 cache ECC\n");
+}
+
arch/arm/mach-socfpga/l2_cache.h new file +28 -0
new file mode 100644
index 0000000..58e140d
@@ -0,0 +1,28 @@
+/*
+ * Copyright Altera Corporation (C) 2014. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MACH_SOCFPGA_L2_CACHE_H
+#define MACH_SOCFPGA_L2_CACHE_H
+
+#ifdef CONFIG_EDAC_ALTERA_L2C
+void socfpga_init_l2_ecc(void);
+#else
+inline void socfpga_init_l2_ecc(void)
+{
+}
+#endif
+
+#endif /* #ifndef MACH_SOCFPGA_L2_CACHE_H */
arch/arm/mach-socfpga/ocram.c new file +84 -0
new file mode 100644
index 0000000..26ec113
@@ -0,0 +1,84 @@
+/*
+ * Copyright Altera Corporation (C) 2014. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#include <linux/clk-provider.h>
+#include <linux/genalloc.h>
+#include <linux/of_platform.h>
+
+#include "ocram.h"
+
+void socfpga_init_ocram_ecc(void)
+{
+	struct device_node *np;
+	const __be32 *prop;
+	u32 ocr_edac_addr, iram_addr, len;
+	void __iomem  *mapped_ocr_edac_addr;
+	size_t size;
+	struct gen_pool *gp;
+
+	np = of_find_compatible_node(NULL, NULL, "altr,ocram-edac");
+	if (!np) {
+		pr_err("SOCFPGA: Unable to find altr,ocram-edac in dtb\n");
+		return;
+	}
+
+	prop = of_get_property(np, "reg", &size);
+	ocr_edac_addr = be32_to_cpup(prop++);
+	len = be32_to_cpup(prop);
+	if (!prop || size < sizeof(*prop)) {
+		pr_err("SOCFPGA: Unable to find OCRAM ECC mapping in dtb\n");
+		return;
+	}
+
+	gp = of_get_named_gen_pool(np, "iram", 0);
+	if (!gp) {
+		pr_err("SOCFPGA: OCRAM cannot find gen pool\n");
+		return;
+	}
+
+	np = of_find_compatible_node(NULL, NULL, "mmio-sram");
+	if (!np) {
+		pr_err("SOCFPGA: Unable to find mmio-sram in dtb\n");
+		return;
+	}
+	/* Determine the OCRAM address and size */
+	prop = of_get_property(np, "reg", &size);
+	iram_addr = be32_to_cpup(prop++);
+	len = be32_to_cpup(prop);
+
+	if (!prop || size < sizeof(*prop)) {
+		pr_err("SOCFPGA: Unable to find OCRAM mapping in dtb\n");
+		return;
+	}
+
+	iram_addr = gen_pool_alloc(gp, len);
+	if (iram_addr == 0) {
+		pr_err("SOCFPGA: cannot alloc from gen pool\n");
+		return;
+	}
+
+	memset((void *)iram_addr, 0, len);
+
+	mapped_ocr_edac_addr = ioremap(ocr_edac_addr, 4);
+
+	gen_pool_free(gp, iram_addr, len);
+
+	/* Clear any pending OCRAM ECC interrupts, then enable ECC */
+	writel(0x18, mapped_ocr_edac_addr);
+	writel(0x19, mapped_ocr_edac_addr);
+
+	pr_debug("SOCFPGA: Success Initializing OCRAM\n");
+}
+
arch/arm/mach-socfpga/ocram.h new file +28 -0
new file mode 100644
index 0000000..f93cf84
@@ -0,0 +1,28 @@
+/*
+ * Copyright Altera Corporation (C) 2014. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MACH_SOCFPGA_OCRAM_H
+#define MACH_SOCFPGA_OCRAM_H
+
+#ifdef CONFIG_EDAC_ALTERA_OCRAM
+void socfpga_init_ocram_ecc(void);
+#else
+inline void socfpga_init_ocram_ecc(void)
+{
+}
+#endif
+
+#endif /* #ifndef MACH_SOCFPGA_OCRAM_H */
arch/arm/mach-socfpga/socfpga.c +4 -1
index adbf383..fb41aca 100644
@@ -1,5 +1,5 @@
  /*
- *  Copyright (C) 2012 Altera Corporation
+ *  Copyright (C) 2012;2014 Altera Corporation
   *
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
@@ -25,6 +25,8 @@
  #include <asm/mach/map.h>
 
  #include "core.h"
+#include "l2_cache.h"
+#include "ocram.h"
 
  void __iomem *socfpga_scu_base_addr = ((void __iomem *)(SOCFPGA_SCU_VIRT_BASE));
  void __iomem *sys_manager_base_addr;
@@ -83,6 +85,7 @@ static void __init socfpga_init_irq(void)
  {
  	irqchip_init();
  	socfpga_sysmgr_init();
+	socfpga_init_l2_ecc();
  }
 
  static void socfpga_cyclone5_restart(enum reboot_mode mode, const char *cmd)
@@ -98,6 +101,13 @@ static void socfpga_cyclone5_restart(enum reboot_mode mode, const char *cmd)
  	writel(temp, rst_manager_base_addr + SOCFPGA_RSTMGR_CTRL);
  }
 
Quoted 7 lines

arch/arm/mach-socfpga/socfpga.c static void socfpga_cyclone5_restart(enum reboot_mode mode, const char *cmd) · line 107

Quoted 4 lines
arch/arm/mach-socfpga/socfpga.c +4 -0
+static void __init socfpga_cyclone5_init(void)
+{
+	of_platform_populate(NULL, of_default_bus_match_table,
+			     NULL, NULL);

Why is this needed?

Dinh

Hi Dinh.

Are you asking why the of_platform_populate() is needed? If so, it is used to kick off discovery of devices at the root of the tree.

If you're asking about the ocram.* and l2-cache.* files, they're used to enable ECC on startup.

Thor
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 542C6CFB.4090809-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org

#8 lore raw

Re: [PATCH 1/3] arm: socfpga: Enable ECC of L2 and OCRAM on startup.

Quoted 6 lines · Thor Thayer
Quoted 4 lines · Dinh Nguyen
Quoted 2 lines · On 10/1/14, 11:31 AM, [email protected]…

From: Thor Thayer <[email protected]>

[...]

Quoted 12 lines
Quoted 12 lines

arch/arm/mach-socfpga/socfpga.c static void socfpga_cyclone5_restart(enum · line 107

Quoted 10 lines

static void socfpga_cyclone5_restart(enum reboot_mode mode, const
char *cmd)

arch/arm/mach-socfpga/socfpga.c +3 -0
@@ -98,6 +101,13 @@ static void socfpga_cyclone5_restart(enum
 reboot_mode mode, const char *cmd)
      writel(temp, rst_manager_base_addr + SOCFPGA_RSTMGR_CTRL);
  }
  +static void __init socfpga_cyclone5_init(void)
+{
+    of_platform_populate(NULL, of_default_bus_match_table,
+                 NULL, NULL);

Why is this needed?

Quoted 5 lines
Quoted 1 line

Dinh

Hi Dinh.

Are you asking why the of_platform_populate() is needed? If so, it is used to kick off discovery of devices at the root of the tree.

I was asking about of_platform populate(). This was removed in this commit:

8b5c18f05 ARM: l2c: socfpga: convert to generic l2c OF initialisation

Just trying to understand what's the need to add it back?

Dinh
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 542C6DBB.9060202-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org

#10 lore raw

Re: [PATCH 1/3] arm: socfpga: Enable ECC of L2 and OCRAM on startup.

Quoted 24 lines · Dinh Nguyen
Quoted 4 lines · Thor Thayer
Quoted 3 lines · Dinh Nguyen
Quoted 2 lines · On 10/1/14, 11:31 AM, [email protected]…

From: Thor Thayer <[email protected]>

[...]

Quoted 12 lines
Quoted 12 lines

Review static void socfpga_cyclone5_restart(enum · line 107

Quoted 10 lines

static void socfpga_cyclone5_restart(enum reboot_mode mode, const
char *cmd)

(quoted diff) +3 -0
@@ -98,6 +101,13 @@ static void socfpga_cyclone5_restart(enum
 reboot_mode mode, const char *cmd)
       writel(temp, rst_manager_base_addr + SOCFPGA_RSTMGR_CTRL);
   }
   +static void __init socfpga_cyclone5_init(void)
+{
+    of_platform_populate(NULL, of_default_bus_match_table,
+                 NULL, NULL);

Why is this needed?

Quoted 5 lines
Quoted 1 line

Dinh

Hi Dinh.

Are you asking why the of_platform_populate() is needed? If so, it is used to kick off discovery of devices at the root of the tree.

Quoted 7 lines

I was asking about of_platform populate(). This was removed in this commit:

8b5c18f05 ARM: l2c: socfpga: convert to generic l2c OF initialisation

Just trying to understand what's the need to add it back?

Dinh

It is used to kick off discovery of devices at the root of the tree. This is needed when .init_machine was defined because we're not using the default implementation (which called this function).

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 542C7DD0.5030601-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org

#12 lore raw

Re: [PATCH 1/3] arm: socfpga: Enable ECC of L2 and OCRAM on startup.

Quoted 29 lines · Thor Thayer
Quoted 27 lines · Dinh Nguyen
Quoted 4 lines · Thor Thayer
Quoted 3 lines · Dinh Nguyen
Quoted 2 lines · On 10/1/14, 11:31 AM, [email protected]…

From: Thor Thayer <[email protected]>

[...]

Quoted 12 lines
Quoted 12 lines

Review static void socfpga_cyclone5_restart(enum · line 107

Quoted 10 lines

static void socfpga_cyclone5_restart(enum reboot_mode mode, const
char *cmd)

(quoted diff) +3 -0
@@ -98,6 +101,13 @@ static void socfpga_cyclone5_restart(enum
 reboot_mode mode, const char *cmd)
       writel(temp, rst_manager_base_addr + SOCFPGA_RSTMGR_CTRL);
   }
   +static void __init socfpga_cyclone5_init(void)
+{
+    of_platform_populate(NULL, of_default_bus_match_table,
+                 NULL, NULL);

Why is this needed?

Quoted 5 lines
Quoted 1 line

Dinh

Hi Dinh.

Are you asking why the of_platform_populate() is needed? If so, it is used to kick off discovery of devices at the root of the tree.

I was asking about of_platform populate(). This was removed in this commit:

Quoted 9 lines
Quoted 5 lines

8b5c18f05 ARM: l2c: socfpga: convert to generic l2c OF initialisation

Just trying to understand what's the need to add it back?

Dinh

It is used to kick off discovery of devices at the root of the tree. This is needed when .init_machine was defined because we're not using the default implementation (which called this function).

Then, can you please add a separate patch to fix up the removal of the call?

Thanks,
Dinh
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 542D3918.3040909-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org

#14 lore raw

Re: [PATCH 1/3] arm: socfpga: Enable ECC of L2 and OCRAM on startup.

Quoted 34 lines · Dinh Nguyen
Quoted 32 lines · Thor Thayer
Quoted 31 lines · Dinh Nguyen
Quoted 4 lines · Thor Thayer
Quoted 3 lines · Dinh Nguyen
Quoted 2 lines · On 10/1/14, 11:31 AM, [email protected]…

From: Thor Thayer <[email protected]>

[...]

Quoted 12 lines
Quoted 12 lines

Review static void socfpga_cyclone5_restart(enum · line 107

Quoted 10 lines

static void socfpga_cyclone5_restart(enum reboot_mode mode, const
char *cmd)

(quoted diff) +3 -0
@@ -98,6 +101,13 @@ static void socfpga_cyclone5_restart(enum
 reboot_mode mode, const char *cmd)
        writel(temp, rst_manager_base_addr + SOCFPGA_RSTMGR_CTRL);
    }
    +static void __init socfpga_cyclone5_init(void)
+{
+    of_platform_populate(NULL, of_default_bus_match_table,
+                 NULL, NULL);

Why is this needed?

Quoted 5 lines
Quoted 1 line

Dinh

Hi Dinh.

Are you asking why the of_platform_populate() is needed? If so, it is used to kick off discovery of devices at the root of the tree.

I was asking about of_platform populate(). This was removed in this commit:

8b5c18f05 ARM: l2c: socfpga: convert to generic l2c OF initialisation

Just trying to understand what's the need to add it back?

Dinh

Quoted 8 lines
Quoted 4 lines

It is used to kick off discovery of devices at the root of the tree. This is needed when .init_machine was defined because we're not using the default implementation (which called this function).

Then, can you please add a separate patch to fix up the removal of the call?

Thanks,
Dinh

I don't understand - maybe I'm missing something. This function call is needed to kick off discovery at the root of the tree.

When I defined a .init_machine function in our platform code, this function needed to be added.

Thor
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#15 lore raw

Re: Re: [PATCH 1/3] arm: socfpga: Enable ECC of L2 and OCRAM on startup.

In reply to a message not in the archive

Hi Dinh,

Quoted 34 lines · Dinh Nguyen
Quoted 33 lines · Thor Thayer
Quoted 31 lines · Dinh Nguyen
Quoted 4 lines · Thor Thayer
Quoted 3 lines · Dinh Nguyen
Quoted 2 lines · On 10/1/14, 11:31 AM, [email protected]…

From: Thor Thayer <[email protected]>

[...]

Quoted 12 lines
Quoted 12 lines

Review static void socfpga_cyclone5_restart(enum · line 107

Quoted 10 lines

static void socfpga_cyclone5_restart(enum reboot_mode mode, const
char *cmd)

(quoted diff) +3 -0
@@ -98,6 +101,13 @@ static void socfpga_cyclone5_restart(enum
 reboot_mode mode, const char *cmd)
       writel(temp, rst_manager_base_addr + SOCFPGA_RSTMGR_CTRL);
   }
   +static void __init socfpga_cyclone5_init(void)
+{
+    of_platform_populate(NULL, of_default_bus_match_table,
+                 NULL, NULL);

Why is this needed?

Quoted 5 lines
Quoted 1 line

Dinh

Hi Dinh.

Are you asking why the of_platform_populate() is needed? If so, it is used to kick off discovery of devices at the root of the tree.

I was asking about of_platform populate(). This was removed in this commit:

8b5c18f05 ARM: l2c: socfpga: convert to generic l2c OF initialisation

Just trying to understand what's the need to add it back?

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Dinh

It is used to kick off discovery of devices at the root of the tree. This is needed when .init_machine was defined because we're not using the default implementation (which called this function).

Then, can you please add a separate patch to fix up the removal of the call?

It seems that this patch does enough reasonable thing.

To initialize ECC on OCRAM, socfpga_init_ocram_ecc() must be invoked while booting. In that case, he might need this function.

8b5c18f05 is to replace l2x0_of_init() with .l2c_aux_* fields, and this patch has a different reason to call another init function in .init_machine. In this case, it is natural to define .init_machine handler in this patch.

IOW, both use same socfpga_cyclone5_init() for the function name, but those have different purpose. I think it is not reviving the old function, but just adding a new function which has same name.

Thank you,

Signature · 10 lines
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: [email protected]


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#17 lore raw

Re: [PATCH 1/3] arm: socfpga: Enable ECC of L2 and OCRAM on startup.

Quoted 47 lines · Masami Hiramatsu

Hi Dinh,

Quoted 34 lines · Dinh Nguyen
Quoted 33 lines · Thor Thayer
Quoted 31 lines · Dinh Nguyen
Quoted 4 lines · Thor Thayer
Quoted 3 lines · Dinh Nguyen
Quoted 2 lines · On 10/1/14, 11:31 AM, [email protected]…

From: Thor Thayer <[email protected]>

[...]

Quoted 12 lines
Quoted 12 lines

Review static void socfpga_cyclone5_restart(enum · line 107

Quoted 10 lines

static void socfpga_cyclone5_restart(enum reboot_mode mode, const
char *cmd)

(quoted diff) +3 -0
@@ -98,6 +101,13 @@ static void socfpga_cyclone5_restart(enum
 reboot_mode mode, const char *cmd)
       writel(temp, rst_manager_base_addr + SOCFPGA_RSTMGR_CTRL);
   }
   +static void __init socfpga_cyclone5_init(void)
+{
+    of_platform_populate(NULL, of_default_bus_match_table,
+                 NULL, NULL);

Why is this needed?

Quoted 5 lines
Quoted 1 line

Dinh

Hi Dinh.

Are you asking why the of_platform_populate() is needed? If so, it is used to kick off discovery of devices at the root of the tree.

I was asking about of_platform populate(). This was removed in this commit:

8b5c18f05 ARM: l2c: socfpga: convert to generic l2c OF initialisation

Just trying to understand what's the need to add it back?

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Dinh

It is used to kick off discovery of devices at the root of the tree. This is needed when .init_machine was defined because we're not using the default implementation (which called this function).

Then, can you please add a separate patch to fix up the removal of the call?

It seems that this patch does enough reasonable thing.

Quoted 7 lines

To initialize ECC on OCRAM, socfpga_init_ocram_ecc() must be invoked while booting. In that case, he might need this function.

8b5c18f05 is to replace l2x0_of_init() with .l2c_aux_* fields, and this patch has a different reason to call another init function in .init_machine. In this case, it is natural to define .init_machine handler in this patch.

8b5c18f05 also removes the need for .init_machine because of_platform_populate() is now called by common arm code.

Quoted 5 lines

IOW, both use same socfpga_cyclone5_init() for the function name, but those have different purpose. I think it is not reviving the old function, but just adding a new function which has same name.

So I'm just wondering if the call to socfpga_init_ocram_ecc() can be done in socfpga_init_irq() along with the call to socfpga_init_l2_ecc(), so that you don't have to bring back the custom init_machine callback.

Dinh

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 542F1833.6070200-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org

#19 lore raw

Re: Re: [PATCH 1/3] arm: socfpga: Enable ECC of L2 and OCRAM on startup.

Quoted 60 lines · Dinh Nguyen
Quoted 47 lines · Masami Hiramatsu

Hi Dinh,

Quoted 34 lines · Dinh Nguyen
Quoted 33 lines · Thor Thayer
Quoted 31 lines · Dinh Nguyen
Quoted 4 lines · Thor Thayer
Quoted 3 lines · Dinh Nguyen
Quoted 2 lines · On 10/1/14, 11:31 AM, [email protected]…

From: Thor Thayer <[email protected]>

[...]

Quoted 12 lines
Quoted 12 lines

Review static void socfpga_cyclone5_restart(enum · line 107

Quoted 10 lines

static void socfpga_cyclone5_restart(enum reboot_mode mode, const
char *cmd)

(quoted diff) +3 -0
@@ -98,6 +101,13 @@ static void socfpga_cyclone5_restart(enum
 reboot_mode mode, const char *cmd)
       writel(temp, rst_manager_base_addr + SOCFPGA_RSTMGR_CTRL);
   }
   +static void __init socfpga_cyclone5_init(void)
+{
+    of_platform_populate(NULL, of_default_bus_match_table,
+                 NULL, NULL);

Why is this needed?

Quoted 5 lines
Quoted 1 line

Dinh

Hi Dinh.

Are you asking why the of_platform_populate() is needed? If so, it is used to kick off discovery of devices at the root of the tree.

I was asking about of_platform populate(). This was removed in this commit:

8b5c18f05 ARM: l2c: socfpga: convert to generic l2c OF initialisation

Just trying to understand what's the need to add it back?

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Dinh

It is used to kick off discovery of devices at the root of the tree. This is needed when .init_machine was defined because we're not using the default implementation (which called this function).

Then, can you please add a separate patch to fix up the removal of the call?

It seems that this patch does enough reasonable thing.

Quoted 7 lines

To initialize ECC on OCRAM, socfpga_init_ocram_ecc() must be invoked while booting. In that case, he might need this function.

8b5c18f05 is to replace l2x0_of_init() with .l2c_aux_* fields, and this patch has a different reason to call another init function in .init_machine. In this case, it is natural to define .init_machine handler in this patch.

8b5c18f05 also removes the need for .init_machine because of_platform_populate() is now called by common arm code.

Quoted 1 line
Quoted 8 lines
Quoted 4 lines

IOW, both use same socfpga_cyclone5_init() for the function name, but those have different purpose. I think it is not reviving the old function, but just adding a new function which has same name.

So I'm just wondering if the call to socfpga_init_ocram_ecc() can be done in socfpga_init_irq() along with the call to socfpga_init_l2_ecc(), so that you don't have to bring back the custom init_machine callback.

Indeed, it will be better and simpler.

Thank you,

Signature · 10 lines
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: [email protected]


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#21 lore raw

Re: [PATCH 1/3] arm: socfpga: Enable ECC of L2 and OCRAM on startup.

Quoted 59 lines · Masami Hiramatsu
Quoted 58 lines · Dinh Nguyen
Quoted 43 lines · Masami Hiramatsu

Hi Dinh,

Quoted 30 lines · Dinh Nguyen
Quoted 29 lines · Thor Thayer
Quoted 28 lines · Dinh Nguyen
Quoted 4 lines · Thor Thayer
Quoted 3 lines · Dinh Nguyen
Quoted 2 lines · On 10/1/14, 11:31 AM,[email protected]…

From: Thor Thayer<[email protected]>

[...]

Quoted 12 lines
Quoted 12 lines

Review static void socfpga_cyclone5_restart(enum · line 107

Quoted 10 lines

static void socfpga_cyclone5_restart(enum reboot_mode mode, const
char *cmd)

(quoted diff) +3 -0
@@ -98,6 +101,13 @@ static void socfpga_cyclone5_restart(enum
 reboot_mode mode, const char *cmd)
        writel(temp, rst_manager_base_addr + SOCFPGA_RSTMGR_CTRL);
    }
    +static void __init socfpga_cyclone5_init(void)
+{
+    of_platform_populate(NULL, of_default_bus_match_table,
+                 NULL, NULL);

Why is this needed?

Quoted 5 lines
Quoted 1 line

Dinh

Hi Dinh.

Are you asking why the of_platform_populate() is needed? If so, it is used to kick off discovery of devices at the root of the tree.

I was asking about of_platform populate(). This was removed in this commit:

8b5c18f05 ARM: l2c: socfpga: convert to generic l2c OF initialisation

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

Just trying to understand what's the need to add it back?

Dinh

It is used to kick off discovery of devices at the root of the tree. This is needed when .init_machine was defined because we're not using the default implementation (which called this function).

Then, can you please add a separate patch to fix up the removal of the call?

It seems that this patch does enough reasonable thing.

Quoted 7 lines

To initialize ECC on OCRAM, socfpga_init_ocram_ecc() must be invoked while booting. In that case, he might need this function.

8b5c18f05 is to replace l2x0_of_init() with .l2c_aux_* fields, and this patch has a different reason to call another init function in .init_machine. In this case, it is natural to define .init_machine handler in this patch.

8b5c18f05 also removes the need for .init_machine because of_platform_populate() is now called by common arm code.

Quoted 4 lines

IOW, both use same socfpga_cyclone5_init() for the function name, but those have different purpose. I think it is not reviving the old function, but just adding a new function which has same name.

Quoted 7 lines
Quoted 3 lines

So I'm just wondering if the call to socfpga_init_ocram_ecc() can be done in socfpga_init_irq() along with the call to socfpga_init_l2_ecc(), so that you don't have to bring back the custom init_machine callback.

Indeed, it will be better and simpler.

Thank you,

Hi. I didn't explain this well in my previous comments.

The call to socfpga_init_ocram_ecc() needs to be in .init_machine because socfpga_init_ocram_ecc() needs the device tree structure to be populated to dereference the sram handle. It is in the .init_machine function that the device tree discovery/population process is kicked off so it makes sense to add it here.

I originally tried adding socfpga_init_ocram_ecc() in the socfpga_init_irq() but the sram phandle couldn't be parsed.

I'm moving the OCRAM addition into a separate patch as requested by Dinh.

Thor

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#22 lore raw

Re: [PATCH 1/3] arm: socfpga: Enable ECC of L2 and OCRAM on startup.

In reply to a message not in the archive
Quoted 49 lines · (2014/10/02 1:31), [email protected]…
arch/arm/mach-socfpga/ocram.c new file +49 -0
+void socfpga_init_ocram_ecc(void)
+{
+	struct device_node *np;
+	const __be32 *prop;
+	u32 ocr_edac_addr, iram_addr, len;
+	void __iomem  *mapped_ocr_edac_addr;
+	size_t size;
+	struct gen_pool *gp;
+
+	np = of_find_compatible_node(NULL, NULL, "altr,ocram-edac");
+	if (!np) {
+		pr_err("SOCFPGA: Unable to find altr,ocram-edac in dtb\n");
+		return;
+	}
+
+	prop = of_get_property(np, "reg", &size);
+	ocr_edac_addr = be32_to_cpup(prop++);
+	len = be32_to_cpup(prop);
+	if (!prop || size < sizeof(*prop)) {
+		pr_err("SOCFPGA: Unable to find OCRAM ECC mapping in dtb\n");
+		return;
+	}
+
+	gp = of_get_named_gen_pool(np, "iram", 0);
+	if (!gp) {
+		pr_err("SOCFPGA: OCRAM cannot find gen pool\n");
+		return;
+	}
+
+	np = of_find_compatible_node(NULL, NULL, "mmio-sram");
+	if (!np) {
+		pr_err("SOCFPGA: Unable to find mmio-sram in dtb\n");
+		return;
+	}
+	/* Determine the OCRAM address and size */
+	prop = of_get_property(np, "reg", &size);
+	iram_addr = be32_to_cpup(prop++);
+	len = be32_to_cpup(prop);
+
+	if (!prop || size < sizeof(*prop)) {
+		pr_err("SOCFPGA: Unable to find OCRAM mapping in dtb\n");
+		return;
+	}
+
+	iram_addr = gen_pool_alloc(gp, len);
+	if (iram_addr == 0) {
+		pr_err("SOCFPGA: cannot alloc from gen pool\n");
+		return;
+	}

arch/arm/mach-socfpga/ocram.c line 80

Quoted 10 lines
arch/arm/mach-socfpga/ocram.c new file +10 -0
+
+	memset((void *)iram_addr, 0, len);
+
+	mapped_ocr_edac_addr = ioremap(ocr_edac_addr, 4);
+
+	gen_pool_free(gp, iram_addr, len);
+
+	/* Clear any pending OCRAM ECC interrupts, then enable ECC */
+	writel(0x18, mapped_ocr_edac_addr);
+	writel(0x19, mapped_ocr_edac_addr);

Should we better iounmap() here?
It seems no one can use mapped_ocr_edac_addr afterwords.

arch/arm/mach-socfpga/ocram.c line 84

Quoted 4 lines
arch/arm/mach-socfpga/ocram.c new file +4 -0
+
+	pr_debug("SOCFPGA: Success Initializing OCRAM\n");
+}
+

Thank you,

Signature · 10 lines
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: [email protected]


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#24 lore raw

Re: [PATCH 1/3] arm: socfpga: Enable ECC of L2 and OCRAM on startup.

Quoted 54 lines · Masami Hiramatsu
Quoted 53 lines · (2014/10/02 1:31), [email protected]…
arch/arm/mach-socfpga/ocram.c new file +53 -0
+void socfpga_init_ocram_ecc(void)
+{
+	struct device_node *np;
+	const __be32 *prop;
+	u32 ocr_edac_addr, iram_addr, len;
+	void __iomem  *mapped_ocr_edac_addr;
+	size_t size;
+	struct gen_pool *gp;
+
+	np = of_find_compatible_node(NULL, NULL, "altr,ocram-edac");
+	if (!np) {
+		pr_err("SOCFPGA: Unable to find altr,ocram-edac in dtb\n");
+		return;
+	}
+
+	prop = of_get_property(np, "reg", &size);
+	ocr_edac_addr = be32_to_cpup(prop++);
+	len = be32_to_cpup(prop);
+	if (!prop || size < sizeof(*prop)) {
+		pr_err("SOCFPGA: Unable to find OCRAM ECC mapping in dtb\n");
+		return;
+	}
+
+	gp = of_get_named_gen_pool(np, "iram", 0);
+	if (!gp) {
+		pr_err("SOCFPGA: OCRAM cannot find gen pool\n");
+		return;
+	}
+
+	np = of_find_compatible_node(NULL, NULL, "mmio-sram");
+	if (!np) {
+		pr_err("SOCFPGA: Unable to find mmio-sram in dtb\n");
+		return;
+	}
+	/* Determine the OCRAM address and size */
+	prop = of_get_property(np, "reg", &size);
+	iram_addr = be32_to_cpup(prop++);
+	len = be32_to_cpup(prop);
+
+	if (!prop || size < sizeof(*prop)) {
+		pr_err("SOCFPGA: Unable to find OCRAM mapping in dtb\n");
+		return;
+	}
+
+	iram_addr = gen_pool_alloc(gp, len);
+	if (iram_addr == 0) {
+		pr_err("SOCFPGA: cannot alloc from gen pool\n");
+		return;
+	}
+
+	memset((void *)iram_addr, 0, len);
+
+	mapped_ocr_edac_addr = ioremap(ocr_edac_addr, 4);
Quoted 9 lines

arch/arm/mach-socfpga/ocram.c line 80

Quoted 6 lines
arch/arm/mach-socfpga/ocram.c new file +6 -0
+
+	gen_pool_free(gp, iram_addr, len);
+
+	/* Clear any pending OCRAM ECC interrupts, then enable ECC */
+	writel(0x18, mapped_ocr_edac_addr);
+	writel(0x19, mapped_ocr_edac_addr);

Should we better iounmap() here?
It seems no one can use mapped_ocr_edac_addr afterwords.

Yes, I will make this change. Thank you!

Quoted 7 lines

arch/arm/mach-socfpga/ocram.c line 84

Quoted 4 lines
arch/arm/mach-socfpga/ocram.c new file +4 -0
+
+	pr_debug("SOCFPGA: Success Initializing OCRAM\n");
+}
+

Thank you,

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#25 lore raw

PATCH 2/3 edac: altera: Add Altera L2 Cache and OCRAM EDAC Support

In reply to a message not in the archive

From: Thor Thayer <[email protected]>

Adding L2 Cache and On-Chip RAM EDAC support for the Altera SoCs using the EDAC_DEVICE framework. The EDAC manager abstracts the common probe functionality and test triggers. The L2 Cache and OCRAM files handle the specific memory functions.

---
 .../bindings/arm/altera/socfpga-l2-edac.txt        |   15 ++
 .../bindings/arm/altera/socfpga-ocram-edac.txt     |   16 ++
 MAINTAINERS                                        |    1 +
 drivers/edac/Kconfig                               |   14 ++
 drivers/edac/Makefile                              |    4 +
 drivers/edac/altera_edac_mgr.c                     |  261 ++++++++++++++++++++
 drivers/edac/altera_edac_mgr.h                     |   56 +++++
 drivers/edac/altera_l2_edac.c                      |  130 ++++++++++
 drivers/edac/altera_ocram_edac.c                   |  107 ++++++++
 9 files changed, 604 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/altera/socfpga-l2-edac.txt
 create mode 100644 Documentation/devicetree/bindings/arm/altera/socfpga-ocram-edac.txt
 create mode 100644 drivers/edac/altera_edac_mgr.c
 create mode 100644 drivers/edac/altera_edac_mgr.h
 create mode 100644 drivers/edac/altera_l2_edac.c
 create mode 100644 drivers/edac/altera_ocram_edac.c
Documentation/devicetree/bindings/arm/altera/socfpga-l2-edac.txt new file +15 -0
new file mode 100644
index 0000000..35b19e3
@@ -0,0 +1,15 @@
+Altera SoCFPGA L2 cache Error Detection and Correction [EDAC]
+
+Required Properties:
+- compatible : Should be "altr,l2-edac"
+- reg : Address and size for ECC error interrupt clear registers.
+- interrupts : Should be single bit error interrupt, then double bit error
+	interrupt. Note the rising edge type.
+
+Example:
+
+	l2edac@ffd08140 {
+		compatible = "altr,l2-edac";
+		reg = <0xffd08140 0x4>;
+		interrupts = <0 36 1>, <0 37 1>;
+	};
Documentation/devicetree/bindings/arm/altera/socfpga-ocram-edac.txt new file +16 -0
new file mode 100644
index 0000000..31ab205
@@ -0,0 +1,16 @@
+Altera SoCFPGA On-Chip RAM Error Detection and Correction [EDAC]
+
+OCRAM ECC Required Properties:
+- compatible : Should be "altr,ocram-edac"
+- reg : Address and size for ECC error interrupt clear registers.
+- iram : phandle to On-Chip RAM definition.
+- interrupts : Should be single bit error interrupt, then double bit error
+	interrupt. Note the rising edge type.
+
+Example:
+	ocramedac@ffd08144 {
+		compatible = "altr,ocram-edac";
+		reg = <0xffd08144 0x4>;
+		iram = <&ocram>;
+		interrupts = <0 178 1>, <0 179 1>;
+	};
MAINTAINERS +1 -0
index 9faf1d3..fe9e361 100644
@@ -1386,6 +1386,7 @@ M:	Thor Thayer <[email protected]>
 S:	Maintained
 F:	arch/arm/mach-socfpga/l2_cache.*
 F:	arch/arm/mach-socfpga/ocram.*
+F:	drivers/edac/altera_*
 
 ARM/STI ARCHITECTURE
 M:	Srinivas Kandagatla <[email protected]>
drivers/edac/Kconfig +14 -0
index fd89ca9..77f691b 100644
@@ -376,4 +376,18 @@ config EDAC_OCTEON_PCI
 	  Support for error detection and correction on the
 	  Cavium Octeon family of SOCs.
 
+config EDAC_ALTERA_L2C
+	bool "Altera L2 Cache EDAC"
+	depends on EDAC_MM_EDAC=y && ARCH_SOCFPGA && CACHE_L2X0
+	help
+	  Support for error detection and correction on the
+	  Altera L2 cache Memory for Altera SoCs.
+
+config EDAC_ALTERA_OCRAM
+	bool "Altera On-Chip RAM EDAC"
+	depends on EDAC_MM_EDAC=y && ARCH_SOCFPGA && SRAM && GENERIC_ALLOCATOR
+	help
+	  Support for error detection and correction on the
+	  Altera On-Chip RAM Memory for Altera SoCs.
+
 endif # EDAC
drivers/edac/Makefile +4 -0
index c479a24..7618a35 100644
@@ -65,3 +65,7 @@ obj-$(CONFIG_EDAC_OCTEON_PC)		+= octeon_edac-pc.o
 obj-$(CONFIG_EDAC_OCTEON_L2C)		+= octeon_edac-l2c.o
 obj-$(CONFIG_EDAC_OCTEON_LMC)		+= octeon_edac-lmc.o
 obj-$(CONFIG_EDAC_OCTEON_PCI)		+= octeon_edac-pci.o
+
+alt_edac_mgr-y				:= altera_edac_mgr.o
+obj-$(CONFIG_EDAC_ALTERA_L2C)		+= alt_edac_mgr.o altera_l2_edac.o
+obj-$(CONFIG_EDAC_ALTERA_OCRAM)		+= alt_edac_mgr.o altera_ocram_edac.o
drivers/edac/altera_edac_mgr.c new file +261 -0

261 lines not on this page · raw message

drivers/edac/altera_edac_mgr.h new file +56 -0

56 lines not on this page · raw message

drivers/edac/altera_l2_edac.c new file +130 -0

130 lines not on this page · raw message

drivers/edac/altera_ocram_edac.c new file +107 -0

107 lines not on this page · raw message

Signature · 6 lines
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1412181092-27162-3-git-send-email-tthayer-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org

#27 lore raw

Re: [PATCH 2/3] edac: altera: Add Altera L2 Cache and OCRAM EDAC Support

Quoted 33 lines · On Wed, Oct 01, 2014 at 05:31:31PM +0100…

From: Thor Thayer <[email protected]>

Adding L2 Cache and On-Chip RAM EDAC support for the Altera SoCs using the EDAC_DEVICE framework. The EDAC manager abstracts the common probe functionality and test triggers. The L2 Cache and OCRAM files handle the specific memory functions.

---
 .../bindings/arm/altera/socfpga-l2-edac.txt        |   15 ++
 .../bindings/arm/altera/socfpga-ocram-edac.txt     |   16 ++
 MAINTAINERS                                        |    1 +
 drivers/edac/Kconfig                               |   14 ++
 drivers/edac/Makefile                              |    4 +
 drivers/edac/altera_edac_mgr.c                     |  261 ++++++++++++++++++++
 drivers/edac/altera_edac_mgr.h                     |   56 +++++
 drivers/edac/altera_l2_edac.c                      |  130 ++++++++++
 drivers/edac/altera_ocram_edac.c                   |  107 ++++++++
 9 files changed, 604 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/altera/socfpga-l2-edac.txt
 create mode 100644 Documentation/devicetree/bindings/arm/altera/socfpga-ocram-edac.txt
 create mode 100644 drivers/edac/altera_edac_mgr.c
 create mode 100644 drivers/edac/altera_edac_mgr.h
 create mode 100644 drivers/edac/altera_l2_edac.c
 create mode 100644 drivers/edac/altera_ocram_edac.c
Documentation/devicetree/bindings/arm/altera/socfpga-l2-edac.txt new file +0 -0
new file mode 100644
index 0000000..35b19e3

Documentation/devicetree/bindings/arm/altera/socfpga-l2-edac.txt line 4

Quoted 4 lines
Documentation/devicetree/bindings/arm/altera/socfpga-l2-edac.txt new file +4 -0
@@ -0,0 +1,15 @@
+Altera SoCFPGA L2 cache Error Detection and Correction [EDAC]
+
+Required Properties:
+- compatible : Should be "altr,l2-edac"

That string looks too generic.

Given the EDAC seems to be a portion of the L2, is there not already an L2 binding?

Just because Linux expects two drivers doesn't mean we should partition the HW description this way.

Quoted 17 lines
Documentation/devicetree/bindings/arm/altera/socfpga-l2-edac.txt new file +11 -0
+- reg : Address and size for ECC error interrupt clear registers.
+- interrupts : Should be single bit error interrupt, then double bit error
+       interrupt. Note the rising edge type.
+
+Example:
+
+       l2edac@ffd08140 {
+               compatible = "altr,l2-edac";
+               reg = <0xffd08140 0x4>;
+               interrupts = <0 36 1>, <0 37 1>;
+       };
Documentation/devicetree/bindings/arm/altera/socfpga-ocram-edac.txt new file +0 -0
new file mode 100644
index 0000000..31ab205

Documentation/devicetree/bindings/arm/altera/socfpga-ocram-edac.txt line 6

Quoted 6 lines
Documentation/devicetree/bindings/arm/altera/socfpga-ocram-edac.txt new file +6 -0
@@ -0,0 +1,16 @@
+Altera SoCFPGA On-Chip RAM Error Detection and Correction [EDAC]
+
+OCRAM ECC Required Properties:
+- compatible : Should be "altr,ocram-edac"
+- reg : Address and size for ECC error interrupt clear registers.
+- iram : phandle to On-Chip RAM definition.

Why not just describe this in the OCRAM node? Surely the register is within the OCRAM controller?

Mark.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#28 lore raw

Re: [PATCH 2/3] edac: altera: Add Altera L2 Cache and OCRAM EDAC Support

Quoted 40 lines · Mark Rutland
Quoted 33 lines · On Wed, Oct 01, 2014 at 05:31:31PM +0100…

From: Thor Thayer <[email protected]>

Adding L2 Cache and On-Chip RAM EDAC support for the Altera SoCs using the EDAC_DEVICE framework. The EDAC manager abstracts the common probe functionality and test triggers. The L2 Cache and OCRAM files handle the specific memory functions.

---
  .../bindings/arm/altera/socfpga-l2-edac.txt        |   15 ++
  .../bindings/arm/altera/socfpga-ocram-edac.txt     |   16 ++
  MAINTAINERS                                        |    1 +
  drivers/edac/Kconfig                               |   14 ++
  drivers/edac/Makefile                              |    4 +
  drivers/edac/altera_edac_mgr.c                     |  261 ++++++++++++++++++++
  drivers/edac/altera_edac_mgr.h                     |   56 +++++
  drivers/edac/altera_l2_edac.c                      |  130 ++++++++++
  drivers/edac/altera_ocram_edac.c                   |  107 ++++++++
  9 files changed, 604 insertions(+)

create mode 100644 Documentation/devicetree/bindings/arm/altera/socfpga-l2-edac.txt create mode 100644 Documentation/devicetree/bindings/arm/altera/socfpga-ocram-edac.txt create mode 100644 drivers/edac/altera_edac_mgr.c
create mode 100644 drivers/edac/altera_edac_mgr.h
create mode 100644 drivers/edac/altera_l2_edac.c
create mode 100644 drivers/edac/altera_ocram_edac.c

Documentation/devicetree/bindings/arm/altera/socfpga-l2-edac.txt new file +0 -0
new file mode 100644
index 0000000..35b19e3

Documentation/devicetree/bindings/arm/altera/socfpga-l2-edac.txt line 4

Quoted 4 lines
Documentation/devicetree/bindings/arm/altera/socfpga-l2-edac.txt new file +4 -0
@@ -0,0 +1,15 @@
+Altera SoCFPGA L2 cache Error Detection and Correction [EDAC]
+
+Required Properties:
+- compatible : Should be "altr,l2-edac"

That string looks too generic.

Quoted 5 lines

Given the EDAC seems to be a portion of the L2, is there not already an L2 binding?

Just because Linux expects two drivers doesn't mean we should partition the HW description this way.

Thank you for the quick feedback.
What should the string look like? I was trying to keep it short with the altr, prefix but I don't mind changing it to something better.
We're using the ARM PL310 L2 cache controller. The ECC is separate from the PL310 IP and is part of the System Manager. This is true of ECC for both the L2 and OCRAM. I followed the Calxeda Highbank L2 EDAC implementation since ours is similar. The Calxeda Highbank implementation had a separate binding file and a device node under soc.

Quoted 17 lines
Quoted 17 lines
Documentation/devicetree/bindings/arm/altera/socfpga-l2-edac.txt new file +11 -0
+- reg : Address and size for ECC error interrupt clear registers.
+- interrupts : Should be single bit error interrupt, then double bit error
+       interrupt. Note the rising edge type.
+
+Example:
+
+       l2edac@ffd08140 {
+               compatible = "altr,l2-edac";
+               reg = <0xffd08140 0x4>;
+               interrupts = <0 36 1>, <0 37 1>;
+       };
Documentation/devicetree/bindings/arm/altera/socfpga-ocram-edac.txt new file +0 -0
new file mode 100644
index 0000000..31ab205
@@ -0,0 +1,16 @@
Quoted 8 lines

Documentation/devicetree/bindings/arm/altera/socfpga-ocram-edac.txt line 6

Quoted 6 lines
Documentation/devicetree/bindings/arm/altera/socfpga-ocram-edac.txt new file +6 -0
+Altera SoCFPGA On-Chip RAM Error Detection and Correction [EDAC]
+
+OCRAM ECC Required Properties:
+- compatible : Should be "altr,ocram-edac"
+- reg : Address and size for ECC error interrupt clear registers.
+- iram : phandle to On-Chip RAM definition.

Why not just describe this in the OCRAM node? Surely the register is within the OCRAM controller?

The ECC registers not in the OCRAM controller but they are in the System Manager. Maybe both the L2 cache and OCRAM ECC bindings should live there and the device tree node for System Manager would have OCRAM and L2 cache sub-nodes.

Thanks,

Thor

Quoted 1 line

Mark.

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 542C51BC.5050004-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org

#30 lore raw

Re: [PATCH 2/3] edac: altera: Add Altera L2 Cache and OCRAM EDAC Support

Quoted 11 lines
Quoted 11 lines

Documentation/devicetree/bindings/arm/altera/socfpga-l2-edac.txt line 4

Quoted 6 lines

+++ b/Documentation/devicetree/bindings/arm/altera/socfpga-l2-edac.txt

Documentation/devicetree/bindings/arm/altera/socfpga-l2-edac.txt new file +4 -0
@@ -0,0 +1,15 @@
+Altera SoCFPGA L2 cache Error Detection and Correction [EDAC]
+
+Required Properties:
+- compatible : Should be "altr,l2-edac"

That string looks too generic.

Given the EDAC seems to be a portion of the L2, is there not already an L2 binding?

Quoted 8 lines
Quoted 2 lines

Just because Linux expects two drivers doesn't mean we should partition the HW description this way.

Thank you for the quick feedback.
What should the string look like? I was trying to keep it short with the altr, prefix but I don't mind changing it to something better. We're using the ARM PL310 L2 cache controller. The ECC is separate from the PL310 IP and is part of the System Manager. This is true of ECC for both the L2 and OCRAM.

Ah, I see. Apologies, I assumed that this was part of the L2C.

[...]

Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
Documentation/devicetree/bindings/arm/altera/socfpga-ocram-edac.txt new file +0 -0
new file mode 100644
index 0000000..31ab205
@@ -0,0 +1,16 @@
Quoted 8 lines

Documentation/devicetree/bindings/arm/altera/socfpga-ocram-edac.txt line 6

Quoted 6 lines
Documentation/devicetree/bindings/arm/altera/socfpga-ocram-edac.txt new file +6 -0
+Altera SoCFPGA On-Chip RAM Error Detection and Correction [EDAC]
+
+OCRAM ECC Required Properties:
+- compatible : Should be "altr,ocram-edac"
+- reg : Address and size for ECC error interrupt clear registers.
+- iram : phandle to On-Chip RAM definition.

Why not just describe this in the OCRAM node? Surely the register is within the OCRAM controller?

Quoted 4 lines

The ECC registers not in the OCRAM controller but they are in the System Manager. Maybe both the L2 cache and OCRAM ECC bindings should live there and the device tree node for System Manager would have OCRAM and L2 cache sub-nodes.

It certainly sounds like the ECC registers should be described as a portion of the system manager somehow.

Thanks,
Mark.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#31 lore raw

Re: [PATCH 2/3] edac: altera: Add Altera L2 Cache and OCRAM EDAC Support

Quoted 41 lines · Mark Rutland
Quoted 11 lines
Quoted 11 lines

Documentation/devicetree/bindings/arm/altera/socfpga-l2-edac.txt line 4

Quoted 6 lines

+++ b/Documentation/devicetree/bindings/arm/altera/socfpga-l2-edac.txt

Documentation/devicetree/bindings/arm/altera/socfpga-l2-edac.txt new file +4 -0
@@ -0,0 +1,15 @@
+Altera SoCFPGA L2 cache Error Detection and Correction [EDAC]
+
+Required Properties:
+- compatible : Should be "altr,l2-edac"

That string looks too generic.

Given the EDAC seems to be a portion of the L2, is there not already an L2 binding?

Quoted 8 lines
Quoted 2 lines

Just because Linux expects two drivers doesn't mean we should partition the HW description this way.

Thank you for the quick feedback.
What should the string look like? I was trying to keep it short with the altr, prefix but I don't mind changing it to something better. We're using the ARM PL310 L2 cache controller. The ECC is separate from the PL310 IP and is part of the System Manager. This is true of ECC for both the L2 and OCRAM.

Ah, I see. Apologies, I assumed that this was part of the L2C.

[...]

Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
Documentation/devicetree/bindings/arm/altera/socfpga-ocram-edac.txt new file +0 -0
new file mode 100644
index 0000000..31ab205
@@ -0,0 +1,16 @@
Quoted 8 lines

Documentation/devicetree/bindings/arm/altera/socfpga-ocram-edac.txt line 6

Quoted 6 lines
Documentation/devicetree/bindings/arm/altera/socfpga-ocram-edac.txt new file +6 -0
+Altera SoCFPGA On-Chip RAM Error Detection and Correction [EDAC]
+
+OCRAM ECC Required Properties:
+- compatible : Should be "altr,ocram-edac"
+- reg : Address and size for ECC error interrupt clear registers.
+- iram : phandle to On-Chip RAM definition.

Why not just describe this in the OCRAM node? Surely the register is within the OCRAM controller?

Quoted 4 lines

The ECC registers not in the OCRAM controller but they are in the System Manager. Maybe both the L2 cache and OCRAM ECC bindings should live there and the device tree node for System Manager would have OCRAM and L2 cache sub-nodes.

Quoted 5 lines

It certainly sounds like the ECC registers should be described as a portion of the system manager somehow.

Thanks,
Mark.

Hi Mark.

After looking at this, it still seems like adding individual nodes as shown in this patch makes the most sense.

We don't currently have another driver to use as a parent so I'd need to create a driver (System Manager) that only probed these drivers. Although that would make the device tree look nicer, it isn't a clean solution overall.

Thanks for looking this over and I appreciate your feedback - it made me mull over other alternatives.

Thor
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#32 lore raw

PATCH 3/3 arm: dts: Add Altera L2 Cache and OCRAM EDAC

In reply to a message not in the archive

From: Thor Thayer <[email protected]>

Adding the device tree entries needed to support the Altera L2 cache and OCRAM EDAC.

---
 arch/arm/boot/dts/socfpga.dtsi |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
arch/arm/boot/dts/socfpga.dtsi +19 -1
index 4d77ad6..f186957 100644
@@ -608,7 +608,7 @@
 		};
 
 		L2: l2-cache@fffef000 {
-			compatible = "arm,pl310-cache";
+			compatible = "arm,pl310-cache", "syscon";
 			reg = <0xfffef000 0x1000>;
 			interrupts = <0 38 0x04>;
 			cache-unified;
@@ -628,6 +628,24 @@
 			clock-names = "biu", "ciu";
 		};
 
+		ocram: sram@ffff0000 {
+			compatible = "mmio-sram";
+			reg = <0xffff0000 0x10000>;
+		};
+
+		l2edac@xffd08140 {
+			compatible = "altr,l2-edac";
+			reg = <0xffd08140 0x4>;
+			interrupts = <0 36 1>, <0 37 1>;
+		};
+
+		ocramedac@ffd08144 {
+			compatible = "altr,ocram-edac";
+			reg = <0xffd08144 0x4>;
+			iram = <&ocram>;
+			interrupts = <0 178 1>, <0 179 1>;
+		};
+
 		/* Local timer */
 		timer@fffec600 {
 			compatible = "arm,cortex-a9-twd-timer";
Signature · 6 lines
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1412181092-27162-4-git-send-email-tthayer-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org

#34 lore raw

Re: [PATCH 3/3] arm: dts: Add Altera L2 Cache and OCRAM EDAC

Quoted 24 lines · On 10/1/14, 11:31 AM, [email protected]…

From: Thor Thayer <[email protected]>

Adding the device tree entries needed to support the Altera L2 cache and OCRAM EDAC.

---
 arch/arm/boot/dts/socfpga.dtsi |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
arch/arm/boot/dts/socfpga.dtsi +1 -1
index 4d77ad6..f186957 100644
@@ -608,7 +608,7 @@
 		};
 
 		L2: l2-cache@fffef000 {
-			compatible = "arm,pl310-cache";
+			compatible = "arm,pl310-cache", "syscon";
 			reg = <0xfffef000 0x1000>;
 			interrupts = <0 38 0x04>;
 			cache-unified;

arch/arm/boot/dts/socfpga.dtsi line 635

Quoted 8 lines
arch/arm/boot/dts/socfpga.dtsi +5 -0
@@ -628,6 +628,24 @@
 			clock-names = "biu", "ciu";
 		};
 
+		ocram: sram@ffff0000 {
+			compatible = "mmio-sram";
+			reg = <0xffff0000 0x10000>;
+		};
+

I sent a patch to add the OCRAM node:
http://www.spinics.net/lists/devicetree/msg51117.html

arch/arm/boot/dts/socfpga.dtsi line 636

Quoted 1 line
arch/arm/boot/dts/socfpga.dtsi +1 -0
+		l2edac@xffd08140 {

Remove the 'x'.

Quoted 6 lines
arch/arm/boot/dts/socfpga.dtsi +5 -0
+			compatible = "altr,l2-edac";
+			reg = <0xffd08140 0x4>;
+			interrupts = <0 36 1>, <0 37 1>;
+		};
+

arch/arm/boot/dts/socfpga.dtsi line 651

Quoted 10 lines
arch/arm/boot/dts/socfpga.dtsi +7 -0
+		ocramedac@ffd08144 {
+			compatible = "altr,ocram-edac";
+			reg = <0xffd08144 0x4>;
+			iram = <&ocram>;
+			interrupts = <0 178 1>, <0 179 1>;
+		};
+
 		/* Local timer */
 		timer@fffec600 {
 			compatible = "arm,cortex-a9-twd-timer";

The documentation for these bindings should be included with this patch.

Dinh
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#36 lore raw

Re: [PATCH 3/3] arm: dts: Add Altera L2 Cache and OCRAM EDAC

Quoted 29 lines · Dinh Nguyen
Quoted 27 lines · On 10/1/14, 11:31 AM, [email protected]…

From: Thor Thayer <[email protected]>

Adding the device tree entries needed to support the Altera L2 cache and OCRAM EDAC.

---
  arch/arm/boot/dts/socfpga.dtsi |   20 +++++++++++++++++++-
  1 file changed, 19 insertions(+), 1 deletion(-)
arch/arm/boot/dts/socfpga.dtsi +1 -1
index 4d77ad6..f186957 100644
@@ -608,7 +608,7 @@
  		};
 
  		L2: l2-cache@fffef000 {
-			compatible = "arm,pl310-cache";
+			compatible = "arm,pl310-cache", "syscon";
  			reg = <0xfffef000 0x1000>;
  			interrupts = <0 38 0x04>;
  			cache-unified;
@@ -628,6 +628,24 @@
  			clock-names = "biu", "ciu";
  		};
 
Quoted 8 lines

arch/arm/boot/dts/socfpga.dtsi line 635

Quoted 5 lines
arch/arm/boot/dts/socfpga.dtsi +5 -0
+		ocram: sram@ffff0000 {
+			compatible = "mmio-sram";
+			reg = <0xffff0000 0x10000>;
+		};
+

I sent a patch to add the OCRAM node:
http://www.spinics.net/lists/devicetree/msg51117.html

OK. Thanks.

Quoted 2 lines

arch/arm/boot/dts/socfpga.dtsi line 636

Quoted 1 line
arch/arm/boot/dts/socfpga.dtsi +1 -0
+		l2edac@xffd08140 {

Remove the 'x'.

Thanks.

Quoted 9 lines
Quoted 9 lines
arch/arm/boot/dts/socfpga.dtsi +9 -0
+			compatible = "altr,l2-edac";
+			reg = <0xffd08140 0x4>;
+			interrupts = <0 36 1>, <0 37 1>;
+		};
+
+		ocramedac@ffd08144 {
+			compatible = "altr,ocram-edac";
+			reg = <0xffd08144 0x4>;
+			iram = <&ocram>;
Quoted 8 lines

arch/arm/boot/dts/socfpga.dtsi line 651

Quoted 7 lines
arch/arm/boot/dts/socfpga.dtsi +3 -0
+			interrupts = <0 178 1>, <0 179 1>;
+		};
+
  		/* Local timer */
  		timer@fffec600 {
  			compatible = "arm,cortex-a9-twd-timer";

The documentation for these bindings should be included with this patch.

OK. Thanks.

Quoted 2 lines

Dinh

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html