linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: Add EDAC platform devices for 85xx
@ 2007-04-25 21:37 Dave Jiang
  2007-04-26  0:08 ` David Gibson
  0 siblings, 1 reply; 30+ messages in thread
From: Dave Jiang @ 2007-04-25 21:37 UTC (permalink / raw)
  To: linuxppc-dev, galak, afleming

Add memory controller and l2-cache controller entries in the dts files for 85xx
platforms. Also adding code to create the platform devices used by EDAC drivers
to claim the resources in order to access the error registers and interrupts. 

Signed-off-by: Dave Jiang <djiang@mvista.com>

---

 arch/powerpc/boot/dts/mpc8540ads.dts |   21 ++++++
 arch/powerpc/boot/dts/mpc8548cds.dts |   21 ++++++
 arch/powerpc/boot/dts/mpc8560ads.dts |   23 +++++++-
 arch/powerpc/sysdev/fsl_soc.c        |  115 ++++++++++++++++++++++++++++++++++
 4 files changed, 179 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc8540ads.dts b/arch/powerpc/boot/dts/mpc8540ads.dts
index f261d64..8bb7593 100644
--- a/arch/powerpc/boot/dts/mpc8540ads.dts
+++ b/arch/powerpc/boot/dts/mpc8540ads.dts
@@ -48,6 +48,27 @@
 		reg = <e0000000 00100000>;	// CCSRBAR 1M
 		bus-frequency = <0>;
 
+		mem-ctrl@2000 {
+			device_type = "mem-ctrl";
+			compatible = "85xx";
+			reg = <2000 1000>;
+			linux,phandle = <2000>;
+			interrupt-parent = <40000>;
+			interrupts = <2 2>;
+		};
+
+		l2-cache@20000 {
+			device_type = "l2-cache";
+			compatible = "85xx";
+			reg = <20000 1000>;
+			cache-line-size = <20>;	// 32 bytes
+			cache-size = <40000>;	// L2, 256K
+			32-bit;
+			linux,phandle = <20000>;
+			interrupt-parent = <40000>;
+			interrupts = <0 2>;
+		};
+
 		i2c@3000 {
 			device_type = "i2c";
 			compatible = "fsl-i2c";
diff --git a/arch/powerpc/boot/dts/mpc8548cds.dts b/arch/powerpc/boot/dts/mpc8548cds.dts
index b2b2200..26c740a 100644
--- a/arch/powerpc/boot/dts/mpc8548cds.dts
+++ b/arch/powerpc/boot/dts/mpc8548cds.dts
@@ -48,6 +48,27 @@
 		reg = <e0000000 00100000>;	// CCSRBAR 1M
 		bus-frequency = <0>;
 
+		mem-ctrl@2000 {
+			device_type = "mem-ctrl";
+			compatible = "85xx";
+			reg = <2000 1000>;
+			linux,phandle = <2000>;
+			interrupt-parent = <40000>;
+			interrupts = <2 2>;
+		};
+
+		l2-cache@20000 {
+			device_type = "l2-cache";
+			compatible = "85xx";
+			reg = <20000 1000>;
+			cache-line-size = <20>;	// 32 bytes
+			cache-size = <40000>;	// L2, 256K
+			32-bit;
+			linux,phandle = <20000>;
+			interrupt-parent = <40000>;
+			interrupts = <0 2>;
+		};
+
 		i2c@3000 {
 			device_type = "i2c";
 			compatible = "fsl-i2c";
diff --git a/arch/powerpc/boot/dts/mpc8560ads.dts b/arch/powerpc/boot/dts/mpc8560ads.dts
index 1f2afe9..1bbb54b 100644
--- a/arch/powerpc/boot/dts/mpc8560ads.dts
+++ b/arch/powerpc/boot/dts/mpc8560ads.dts
@@ -48,6 +48,27 @@
 		reg = <e0000000 00000200>;
 		bus-frequency = <13ab6680>;
 
+		mem-ctrl@2000 {
+			device_type = "mem-ctrl";
+			compatible = "85xx";
+			reg = <2000 1000>;
+			linux,phandle = <2000>;
+			interrupt-parent = <40000>;
+			interrupts = <2 2>;
+		};
+
+		l2-cache@20000 {
+			device_type = "l2-cache";
+			compatible = "85xx";
+			reg = <20000 1000>;
+			cache-line-size = <20>;	// 32 bytes
+			cache-size = <40000>;	// L2, 256K
+			32-bit;
+			linux,phandle = <20000>;
+			interrupt-parent = <40000>;
+			interrupts = <0 2>;
+		};
+
 		mdio@24520 {
 			device_type = "mdio";
 			compatible = "gianfar";
@@ -110,7 +131,7 @@
 			#address-cells = <3>;
 			compatible = "85xx";
 			device_type = "pci";
-			reg = <8000 400>;
+			reg = <8000 1000>;
 			clock-frequency = <3f940aa>;
 			interrupt-map-mask = <f800 0 0 7>;
 			interrupt-map = <
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 8a123c7..a0beb8b 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -1103,3 +1103,118 @@ err:
 arch_initcall(cpm_smc_uart_of_init);
 
 #endif /* CONFIG_8xx */
+
+/* platform device setup for EDAC */
+#ifdef CONFIG_PPC_85xx
+static int __init mpc85xx_mc_err_init(void)
+{
+	struct resource r[2];
+	struct device_node *np;
+	struct platform_device *pdev;
+	int ret = 0;
+
+	memset(r, 0, sizeof(r));
+
+	np = of_find_compatible_node(NULL, "mem-ctrl", "85xx");
+	if (!np)
+		return 0;
+
+	ret = of_address_to_resource(np, 0, &r[0]);
+	if (ret)
+		goto err;
+
+	of_irq_to_resource(np, 0, &r[1]);
+
+	of_node_put(np);
+
+	pdev = platform_device_register_simple("mpc85xx_mc_err", 0, r, 2);
+	if (IS_ERR(pdev))
+		return PTR_ERR(pdev);
+
+	return 0;
+
+err:
+	of_node_put(np);
+	printk(KERN_WARNING "mpc85xx-mem-ctrl setup failed\n");
+	return 0;
+}
+arch_initcall(mpc85xx_mc_err_init);
+
+static int __init mpc85xx_l2_err_init(void)
+{
+	struct resource r[2];
+	struct device_node *np;
+	struct platform_device *pdev;
+	int ret = 0;
+
+	memset(r, 0, sizeof(r));
+
+	np = of_find_compatible_node(NULL, "l2-cache", "85xx");
+	if (!np)
+		return 0;
+
+	ret = of_address_to_resource(np, 0, &r[0]);
+	if (ret)
+		goto err;
+	
+	/* we only need access to the error registers */
+	r[0].start += 0xe00;
+
+	of_irq_to_resource(np, 0, &r[1]);
+
+	of_node_put(np);
+
+	pdev = platform_device_register_simple("mpc85xx_l2_err", 0, r, 2);
+	if (IS_ERR(pdev))
+		return PTR_ERR(pdev);
+
+	return 0;
+
+err:
+	of_node_put(np);
+	printk(KERN_WARNING "mpc85xx-l2 setup failed\n");
+	return 0;
+}
+arch_initcall(mpc85xx_l2_err_init);
+
+static int __init mpc85xx_pci_err_init(void)
+{
+	struct resource r[2];
+	struct device_node *np = NULL;
+	struct platform_device *pdev;
+	int i;
+	int ret = 0;
+
+	for (i = 0;
+		(np = of_find_compatible_node(np, "pci", "85xx"));
+		i++) {
+		memset(r, 0, sizeof(r));
+
+		ret = of_address_to_resource(np, 0, &r[0]);
+		if (ret)
+			goto err;
+	
+		/* we only need access to the error registers */
+		r[0].start += 0xe00;
+
+		of_irq_to_resource(np, 0, &r[1]);
+
+		pdev = platform_device_register_simple("mpc85xx_pci_err", 
+				i, r, 2);
+		if (IS_ERR(pdev)) {
+			ret = PTR_ERR(pdev);
+			goto err;
+		}
+
+	}
+
+	return 0;
+
+err:
+	of_node_put(np);
+	printk(KERN_WARNING "mpc85xx-pci setup failed\n");
+	return ret;
+}
+arch_initcall(mpc85xx_pci_err_init);
+
+#endif /* CONFIG_PPC_85xx */

^ permalink raw reply related	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2007-05-15 18:25 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-25 21:37 [PATCH] powerpc: Add EDAC platform devices for 85xx Dave Jiang
2007-04-26  0:08 ` David Gibson
2007-04-26  0:37   ` Dave Jiang
2007-04-26 14:31     ` Kumar Gala
2007-04-26 16:56       ` Dave Jiang
2007-04-26 18:56         ` Segher Boessenkool
2007-05-01 15:11           ` RFC: new device types in the device tree (RE: [PATCH] powerpc: Add EDAC platform devices for 85xx) Yoder Stuart-B08248
2007-05-02  0:34             ` Segher Boessenkool
2007-05-02  1:19               ` David Gibson
2007-05-02 19:04                 ` Yoder Stuart-B08248
2007-05-03  0:17                   ` David Gibson
2007-05-03  0:55                     ` Segher Boessenkool
2007-05-04 15:29                     ` Yoder Stuart-B08248
2007-05-03  0:54                   ` Segher Boessenkool
2007-05-02 18:50               ` Yoder Stuart-B08248
2007-05-03  0:48                 ` Segher Boessenkool
2007-05-04 15:16                   ` Yoder Stuart-B08248
2007-05-05  0:07                     ` Segher Boessenkool
2007-04-30 17:37       ` [PATCH] powerpc: Add EDAC platform devices for 85xx Dave Jiang
2007-05-01 18:32       ` [PATCH] powerpc: publish 85xx soc devices as of_device on cds and ads Dave Jiang
2007-05-07 23:26         ` [PATCH] powerpc: add dts entries to 85xx for EDAC Dave Jiang
2007-05-08  3:42           ` Olof Johansson
2007-05-08 17:34             ` Dave Jiang
2007-05-08 13:16           ` Kumar Gala
2007-05-08 17:08             ` Dave Jiang
2007-05-09 14:40               ` Segher Boessenkool
2007-05-09 16:53                 ` Dave Jiang
2007-05-10  5:25                   ` Kumar Gala
2007-05-10 17:03                     ` Dave Jiang
2007-05-15 18:20                       ` Kumar Gala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).