public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Dave Jiang <djiang@mvista•com>
To: linuxppc-dev@ozlabs•org, galak@kernel•crashing.org,
	afleming@freescale•com
Cc: bluesmoke-devel@lists•sourceforge.net, david@gibson•dropbear.id.au
Subject: Re: [PATCH] powerpc: Add EDAC platform devices for 85xx
Date: Wed, 25 Apr 2007 17:37:48 -0700	[thread overview]
Message-ID: <20070426003748.GA30730@blade.az.mvista.com> (raw)
In-Reply-To: <20070426000852.GA2193@localhost.localdomain>

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>

---

Removed explicit phandles as suggested by David Gibson. 

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

diff --git a/arch/powerpc/boot/dts/mpc8540ads.dts b/arch/powerpc/boot/dts/mpc8540ads.dts
index f261d64..63c274d 100644
--- a/arch/powerpc/boot/dts/mpc8540ads.dts
+++ b/arch/powerpc/boot/dts/mpc8540ads.dts
@@ -48,6 +48,25 @@
 		reg = <e0000000 00100000>;	// CCSRBAR 1M
 		bus-frequency = <0>;
 
+		mem-ctrl@2000 {
+			device_type = "mem-ctrl";
+			compatible = "85xx";
+			reg = <2000 1000>;
+			interrupt-parent = <&mpic>;
+			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;
+			interrupt-parent = <&mpic>;
+			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..f8a9f3f 100644
--- a/arch/powerpc/boot/dts/mpc8548cds.dts
+++ b/arch/powerpc/boot/dts/mpc8548cds.dts
@@ -48,6 +48,25 @@
 		reg = <e0000000 00100000>;	// CCSRBAR 1M
 		bus-frequency = <0>;
 
+		mem-ctrl@2000 {
+			device_type = "mem-ctrl";
+			compatible = "85xx";
+			reg = <2000 1000>;
+			interrupt-parent = <&mpic>;
+			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;
+			interrupt-parent = <&mpic>;
+			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..43ee847 100644
--- a/arch/powerpc/boot/dts/mpc8560ads.dts
+++ b/arch/powerpc/boot/dts/mpc8560ads.dts
@@ -48,6 +48,25 @@
 		reg = <e0000000 00000200>;
 		bus-frequency = <13ab6680>;
 
+		mem-ctrl@2000 {
+			device_type = "mem-ctrl";
+			compatible = "85xx";
+			reg = <2000 1000>;
+			interrupt-parent = <&mpic>;
+			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;
+			interrupt-parent = <&mpic>;
+			interrupts = <0 2>;
+		};
+
 		mdio@24520 {
 			device_type = "mdio";
 			compatible = "gianfar";
@@ -110,7 +129,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 */

  reply	other threads:[~2007-04-26  0:35 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070426003748.GA30730@blade.az.mvista.com \
    --to=djiang@mvista$(echo .)com \
    --cc=afleming@freescale$(echo .)com \
    --cc=bluesmoke-devel@lists$(echo .)sourceforge.net \
    --cc=david@gibson$(echo .)dropbear.id.au \
    --cc=galak@kernel$(echo .)crashing.org \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox