From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nommos.sslcatacombnetworking.com (nommos.sslcatacombnetworking.com [67.18.224.114]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTP id BEBADDDF4B for ; Fri, 27 Apr 2007 00:32:29 +1000 (EST) In-Reply-To: <20070426003748.GA30730@blade.az.mvista.com> References: <20070425213700.GA8814@blade.az.mvista.com> <20070426000852.GA2193@localhost.localdomain> <20070426003748.GA30730@blade.az.mvista.com> Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <9903F55A-5E4E-42CE-8C27-6B7143B9FE25@kernel.crashing.org> From: Kumar Gala Subject: Re: [PATCH] powerpc: Add EDAC platform devices for 85xx Date: Thu, 26 Apr 2007 09:31:31 -0500 To: Dave Jiang Cc: linuxppc-dev@ozlabs.org, bluesmoke-devel@lists.sourceforge.net, david@gibson.dropbear.id.au List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Apr 25, 2007, at 7:37 PM, Dave Jiang wrote: > 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 > > --- > > 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 = ; // CCSRBAR 1M > bus-frequency = <0>; > > + mem-ctrl@2000 { > + device_type = "mem-ctrl"; > + compatible = "85xx"; I'm concerned this is too generic. > + 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; Why the 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 = ; // 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 = ; > 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 = ; > 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 */ Why not have the EDAC code for 85xx use of_device? > +#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 */