Skip to contentSkip to conversation

Add PPC4xx L2-cache support (440GX)

PATCH Superseded Stefan Roese 3 participants 5 messages Mar 22, 2008 – Mar 25, 2008

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 Add PPC4xx L2-cache support (440GX)

This patch adds support for the 256k L2 cache found on some IBM/AMCC 4xx PPC's. It introduces a common 4xx SoC file (sysdev/ppc4xx_soc.c) which currently "only" adds the L2 cache init code. Other common 4xx stuff can be added later here.

The L2 cache handling code is a copy of Eugene's code in arch/ppc with small modifications.

Tested on AMCC Taishan 440GX.

---
Small changes included as suggested by Stephen Rothwell. It also removes mentioning 460EX/GT, since L2 cache handling on these PPC's is not clear right now.

 arch/powerpc/Kconfig               |    3 +
 arch/powerpc/platforms/44x/Kconfig |    2 +
 arch/powerpc/sysdev/Makefile       |    1 +
 arch/powerpc/sysdev/ppc4xx_soc.c   |  178 ++++++++++++++++++++++++++++++++++++
 include/asm-powerpc/dcr-regs.h     |   78 ++++++++++++++++
 5 files changed, 258 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/sysdev/ppc4xx_soc.c
arch/powerpc/Kconfig +3 -0
index 1189d8d..69d4738 100644
@@ -490,6 +490,9 @@ config FSL_PCI
  	bool
 	select PPC_INDIRECT_PCI
 
+config 4xx_SOC
+	bool
+
 # Yes MCA RS/6000s exist but Linux-PPC does not currently support any
 config MCA
 	bool
arch/powerpc/platforms/44x/Kconfig +1 -0
index 83155fe..061ba3c 100644
@@ -120,6 +120,7 @@ config 440GP
 
 config 440GX
 	bool
+	select 4xx_SOC
 	select IBM_NEW_EMAC_EMAC4
 	select IBM_NEW_EMAC_RGMII
 	select IBM_NEW_EMAC_ZMII #test only
arch/powerpc/sysdev/Makefile +1 -0
index 15f3e85..851a0be 100644
@@ -27,6 +27,7 @@ obj-$(CONFIG_PPC_INDIRECT_PCI)	+= indirect_pci.o
 obj-$(CONFIG_PPC_I8259)		+= i8259.o
 obj-$(CONFIG_IPIC)		+= ipic.o
 obj-$(CONFIG_4xx)		+= uic.o
+obj-$(CONFIG_4xx_SOC)		+= ppc4xx_soc.o
 obj-$(CONFIG_XILINX_VIRTEX)	+= xilinx_intc.o
 obj-$(CONFIG_OF_RTC)		+= of_rtc.o
 ifeq ($(CONFIG_PCI),y)
arch/powerpc/sysdev/ppc4xx_soc.c new file +178 -0

178 lines not on this page · raw message

include/asm-powerpc/dcr-regs.h +78 -0

82 lines not on this page · raw message

Signature · 1 line
1.5.4.4
#1 lore raw
Quoted 11 lines · On Sat, 22 Mar 2008 11:28:56 +0100 Stefan Roese <[email protected]> wrote:

This patch adds support for the 256k L2 cache found on some IBM/AMCC 4xx PPC's. It introduces a common 4xx SoC file (sysdev/ppc4xx_soc.c) which currently "only" adds the L2 cache init code. Other common 4xx stuff can be added later here.

The L2 cache handling code is a copy of Eugene's code in arch/ppc with small modifications.

Tested on AMCC Taishan 440GX.

Hi Stefan. Small, very minor issues below.

Quoted 23 lines
arch/powerpc/sysdev/ppc4xx_soc.c new file +17 -0
new file mode 100644
index 0000000..4847555
@@ -0,0 +1,178 @@
+/*
+ * IBM/AMCC PPC4xx SoC setup code
+ *
+ * Copyright 2008 DENX Software Engineering, Stefan Roese <[email protected]>
+ *
+ * L2 cache routines cloned from arch/ppc/syslib/ibm440gx_common.c which is:
+ *   Eugene Surovegin <[email protected]> or <[email protected]>
+ *   Copyright (c) 2003 - 2006 Zultys Technologies
+ *
+ * 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 the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/stddef.h>
+#include <linux/kernel.h>

arch/powerpc/sysdev/ppc4xx_soc.c line 27

Quoted 10 lines
arch/powerpc/sysdev/ppc4xx_soc.c new file +10 -0
+#include <linux/init.h>
+#include <linux/errno.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/of_platform.h>
+
+#include <asm/dcr.h>
+#include <asm/dcr-regs.h>
+
+static u32 dcrbase;

If this file is really intended to have other miscellaneous stuff added to it, perhaps this variable should be renamed l2_dcrbase. I know it's minor, so perhaps we can wait until something else gets added.

Quoted 13 lines
arch/powerpc/sysdev/ppc4xx_soc.c new file +13 -0
+
+/*
+ * L2-cache
+ */
+
+/* Issue L2C diagnostic command */
+static inline u32 l2c_diag(u32 addr)
+{
+	mtdcr(dcrbase + DCRN_L2C0_ADDR, addr);
+	mtdcr(dcrbase + DCRN_L2C0_CMD, L2C_CMD_DIAG);
+	while (!(mfdcr(dcrbase + DCRN_L2C0_SR) & L2C_SR_CC))
+		;
+

arch/powerpc/sysdev/ppc4xx_soc.c line 50

Quoted 10 lines
arch/powerpc/sysdev/ppc4xx_soc.c new file +10 -0
+	return mfdcr(dcrbase + DCRN_L2C0_DATA);
+}
+
+static irqreturn_t l2c_error_handler(int irq, void *dev)
+{
+	u32 sr = mfdcr(dcrbase + DCRN_L2C0_SR);
+
+	if (sr & L2C_SR_CPE) {
+		/* Read cache trapped address */
+		u32 addr = l2c_diag(0x42000000);

What is this magical hex number?

arch/powerpc/sysdev/ppc4xx_soc.c line 56

Quoted 6 lines
arch/powerpc/sysdev/ppc4xx_soc.c new file +6 -0
+		printk(KERN_EMERG "L2C: Cache Parity Error, addr[16:26] = 0x%08x\n",
+		       addr);
+	}
+	if (sr & L2C_SR_TPE) {
+		/* Read tag trapped address */
+		u32 addr = l2c_diag(0x82000000) >> 16;

And here?

Quoted 48 lines
arch/powerpc/sysdev/ppc4xx_soc.c new file +48 -0
+		printk(KERN_EMERG "L2C: Tag Parity Error, addr[16:26] = 0x%08x\n",
+		       addr);
+	}
+
+	/* Clear parity errors */
+	if (sr & (L2C_SR_CPE | L2C_SR_TPE)){
+		mtdcr(dcrbase + DCRN_L2C0_ADDR, 0);
+		mtdcr(dcrbase + DCRN_L2C0_CMD, L2C_CMD_CCP | L2C_CMD_CTE);
+	} else {
+		printk(KERN_EMERG "L2C: LRU error\n");
+	}
+
+	return IRQ_HANDLED;
+}
+
+static int __init ppc4xx_l2c_probe(void)
+{
+	struct device_node *np;
+	u32 r;
+	unsigned long flags;
+	int irq;
+	const u32 *dcrreg;
+	u32 dcrbase_isram;
+	int len;
+
+	np = of_find_compatible_node(np, NULL, "ibm,l2-cache");
+	if (!np)
+		return 0;
+
+	/* Map DCRs */
+	dcrreg = of_get_property(np, "dcr-reg", &len);
+	if (!dcrreg || (len != 4 * sizeof(u32))) {
+		printk(KERN_ERR "%s: Can't get DCR register base !",
+		       np->full_name);
+		of_node_put(np);
+		return -ENODEV;
+	}
+	dcrbase_isram = dcrreg[0];
+	dcrbase = dcrreg[2];
+
+	/* Get and map irq number from device tree */
+	irq = irq_of_parse_and_map(np, 0);
+	if (irq == NO_IRQ) {
+		printk(KERN_ERR "irq_of_parse_and_map failed\n");
+		of_node_put(np);
+		return -ENODEV;
+	}
+

arch/powerpc/sysdev/ppc4xx_soc.c line 114

Quoted 10 lines
arch/powerpc/sysdev/ppc4xx_soc.c new file +10 -0
+	/* Install error handler */
+	if (request_irq(irq, l2c_error_handler, IRQF_DISABLED, "L2C", 0) < 0) {
+		printk(KERN_ERR "Cannot install L2C error handler"
+		       ", cache is not enabled\n");
+		of_node_put(np);
+		return -ENODEV;
+	}
+
+	local_irq_save(flags);
+	asm volatile ("sync" ::: "memory");

Perhaps just call iosync() for these instead of the open coded asm volatile stuff?

Quoted 49 lines
arch/powerpc/sysdev/ppc4xx_soc.c new file +49 -0
+
+	/* Disable SRAM */
+	mtdcr(dcrbase_isram + DCRN_SRAM0_DPC,
+	      mfdcr(dcrbase_isram + DCRN_SRAM0_DPC) & ~SRAM_DPC_ENABLE);
+	mtdcr(dcrbase_isram + DCRN_SRAM0_SB0CR,
+	      mfdcr(dcrbase_isram + DCRN_SRAM0_SB0CR) & ~SRAM_SBCR_BU_MASK);
+	mtdcr(dcrbase_isram + DCRN_SRAM0_SB1CR,
+	      mfdcr(dcrbase_isram + DCRN_SRAM0_SB1CR) & ~SRAM_SBCR_BU_MASK);
+	mtdcr(dcrbase_isram + DCRN_SRAM0_SB2CR,
+	      mfdcr(dcrbase_isram + DCRN_SRAM0_SB2CR) & ~SRAM_SBCR_BU_MASK);
+	mtdcr(dcrbase_isram + DCRN_SRAM0_SB3CR,
+	      mfdcr(dcrbase_isram + DCRN_SRAM0_SB3CR) & ~SRAM_SBCR_BU_MASK);
+
+	/* Enable L2_MODE without ICU/DCU */
+	r = mfdcr(dcrbase + DCRN_L2C0_CFG) &
+		~(L2C_CFG_ICU | L2C_CFG_DCU | L2C_CFG_SS_MASK);
+	r |= L2C_CFG_L2M | L2C_CFG_SS_256;
+	mtdcr(dcrbase + DCRN_L2C0_CFG, r);
+
+	mtdcr(dcrbase + DCRN_L2C0_ADDR, 0);
+
+	/* Hardware Clear Command */
+	mtdcr(dcrbase + DCRN_L2C0_CMD, L2C_CMD_HCC);
+	while (!(mfdcr(dcrbase + DCRN_L2C0_SR) & L2C_SR_CC))
+		;
+
+	/* Clear Cache Parity and Tag Errors */
+	mtdcr(dcrbase + DCRN_L2C0_CMD, L2C_CMD_CCP | L2C_CMD_CTE);
+
+	/* Enable 64G snoop region starting at 0 */
+	r = mfdcr(dcrbase + DCRN_L2C0_SNP0) &
+		~(L2C_SNP_BA_MASK | L2C_SNP_SSR_MASK);
+	r |= L2C_SNP_SSR_32G | L2C_SNP_ESR;
+	mtdcr(dcrbase + DCRN_L2C0_SNP0, r);
+
+	r = mfdcr(dcrbase + DCRN_L2C0_SNP1) &
+		~(L2C_SNP_BA_MASK | L2C_SNP_SSR_MASK);
+	r |= 0x80000000 | L2C_SNP_SSR_32G | L2C_SNP_ESR;
+	mtdcr(dcrbase + DCRN_L2C0_SNP1, r);
+
+	asm volatile ("sync" ::: "memory");
+
+	/* Enable ICU/DCU ports */
+	r = mfdcr(dcrbase + DCRN_L2C0_CFG);
+	r &= ~(L2C_CFG_DCW_MASK | L2C_CFG_PMUX_MASK | L2C_CFG_PMIM
+	       | L2C_CFG_TPEI | L2C_CFG_CPEI | L2C_CFG_NAM | L2C_CFG_NBRM);
+	r |= L2C_CFG_ICU | L2C_CFG_DCU | L2C_CFG_TPC | L2C_CFG_CPC | L2C_CFG_FRAN
+		| L2C_CFG_CPIM | L2C_CFG_TPIM | L2C_CFG_LIM | L2C_CFG_SMCM;
+

arch/powerpc/sysdev/ppc4xx_soc.c line 173

Quoted 10 lines
arch/powerpc/sysdev/ppc4xx_soc.c new file +10 -0
+	/* Check for 460EX/GT special handling */
+	if (of_device_is_compatible(np, "ibm,l2-cache-460ex"))
+		r |= L2C_CFG_RDBW;
+
+	mtdcr(dcrbase + DCRN_L2C0_CFG, r);
+
+	asm volatile ("sync; isync" ::: "memory");
+	local_irq_restore(flags);
+
+	printk(KERN_INFO "256k L2-cache enabled\n");

Should the cache size be derived from the device tree?

josh

#2 lore raw
Quoted 6 lines · Josh Boyer

arch/powerpc/sysdev/ppc4xx_soc.c line 114

Quoted 3 lines
arch/powerpc/sysdev/ppc4xx_soc.c new file +3 -0
+
+     local_irq_save(flags);
+     asm volatile ("sync" ::: "memory");

Perhaps just call iosync() for these instead of the open coded asm volatile stuff?

Not sure about that. iosync() will do a sync but it's not meant at being used for things unrelated to IOs (and who knows... we might make it do something else one day ?).

In low level arch code like that, an open coded sync might be proper especially if it matches some documented sequence.

Cheers,
Ben.

#3 lore raw
Quoted 9 lines · On Tue, 25 Mar 2008 07:59:15 +1100 Benjamin Herrenschmidt…
Quoted 6 lines · Josh Boyer

arch/powerpc/sysdev/ppc4xx_soc.c line 114

Quoted 3 lines
arch/powerpc/sysdev/ppc4xx_soc.c new file +3 -0
+
+     local_irq_save(flags);
+     asm volatile ("sync" ::: "memory");

Perhaps just call iosync() for these instead of the open coded asm volatile stuff?

Quoted 6 lines

Not sure about that. iosync() will do a sync but it's not meant at being used for things unrelated to IOs (and who knows... we might make it do something else one day ?).

In low level arch code like that, an open coded sync might be proper especially if it matches some documented sequence.

Either way, it doesn't matter to me.

josh

#4 lore raw
In reply to Josh Boyer
Quoted 4 lines · Josh Boyer
Quoted 4 lines
(quoted diff) +0 -0

b/arch/powerpc/sysdev/ppc4xx_soc.c new file mode 100644 index 0000000..4847555
--- /dev/null

Quoted 8 lines

arch/powerpc/sysdev/ppc4xx_soc.c line 6

Quoted 8 lines

+++ b/arch/powerpc/sysdev/ppc4xx_soc.c

arch/powerpc/sysdev/ppc4xx_soc.c new file +6 -0
@@ -0,0 +1,178 @@
+/*
+ * IBM/AMCC PPC4xx SoC setup code
+ *
+ * Copyright 2008 DENX Software Engineering, Stefan Roese <[email protected]>
+ *
+ * L2 cache routines cloned from arch/ppc/syslib/ibm440gx_common.c whi=

ch

Quoted 4 lines
Quoted 4 lines

is: + * Eugene Surovegin <[email protected]> or
<[email protected]> + * Copyright (c) 2003 - 2006 Zultys Technologies
+ *
+ * This program is free software; you can redistribute it and/or modi=

fy

Quoted 13 lines
Quoted 13 lines

it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version.
+ */

arch/powerpc/sysdev/ppc4xx_soc.c new file +9 -0
+
+#include <linux/stddef.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/errno.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/of_platform.h>
+
Quoted 8 lines

arch/powerpc/sysdev/ppc4xx_soc.c line 27

Quoted 4 lines
arch/powerpc/sysdev/ppc4xx_soc.c new file +4 -0
+#include <asm/dcr.h>
+#include <asm/dcr-regs.h>
+
+static u32 dcrbase;

If this file is really intended to have other miscellaneous stuff added to it, perhaps this variable should be renamed l2_dcrbase. I know it's minor, so perhaps we can wait until something else gets added.

Right. I'll change this with the next version.

Quoted 17 lines
Quoted 17 lines
arch/powerpc/sysdev/ppc4xx_soc.c new file +17 -0
+
+/*
+ * L2-cache
+ */
+
+/* Issue L2C diagnostic command */
+static inline u32 l2c_diag(u32 addr)
+{
+	mtdcr(dcrbase + DCRN_L2C0_ADDR, addr);
+	mtdcr(dcrbase + DCRN_L2C0_CMD, L2C_CMD_DIAG);
+	while (!(mfdcr(dcrbase + DCRN_L2C0_SR) & L2C_SR_CC))
+		;
+
+	return mfdcr(dcrbase + DCRN_L2C0_DATA);
+}
+
+static irqreturn_t l2c_error_handler(int irq, void *dev)
Quoted 8 lines

arch/powerpc/sysdev/ppc4xx_soc.c

Quoted 6 lines
arch/powerpc/sysdev/ppc4xx_soc.c new file +6 -0
+{
+	u32 sr =3D mfdcr(dcrbase + DCRN_L2C0_SR);
+
+	if (sr & L2C_SR_CPE) {
+		/* Read cache trapped address */
+		u32 addr =3D l2c_diag(0x42000000);

What is this magical hex number?

I have to admit that I didn't check. As mentioned in the commit log, most o= f=20
this L2 cache code is copied directly from arch/ppc done by Eugene Surovegi= n.=20
=46rom my point of view, the comment right above the line should be enough.= =20
Especially since this "magical hex number" isn't used anywhere else in the= =20
code. But I could introduce a define for this. Please give me a short note = if=20
you think it is necessary.

Quoted 1 line

Review

Quoted 1 line
(quoted diff) +1 -0
+		printk(KERN_EMERG "L2C: Cache Parity Error, addr[16:26] =3D 0x%08x\n=

",

Quoted 7 lines

arch/powerpc/sysdev/ppc4xx_soc.c

Quoted 5 lines
arch/powerpc/sysdev/ppc4xx_soc.c new file +5 -0
+		       addr);
+	}
+	if (sr & L2C_SR_TPE) {
+		/* Read tag trapped address */
+		u32 addr =3D l2c_diag(0x82000000) >> 16;

And here?

Same comment as above.

Quoted 42 lines
Quoted 42 lines
arch/powerpc/sysdev/ppc4xx_soc.c new file +42 -0
+		printk(KERN_EMERG "L2C: Tag Parity Error, addr[16:26] =3D 0x%08x\n",
+		       addr);
+	}
+
+	/* Clear parity errors */
+	if (sr & (L2C_SR_CPE | L2C_SR_TPE)){
+		mtdcr(dcrbase + DCRN_L2C0_ADDR, 0);
+		mtdcr(dcrbase + DCRN_L2C0_CMD, L2C_CMD_CCP | L2C_CMD_CTE);
+	} else {
+		printk(KERN_EMERG "L2C: LRU error\n");
+	}
+
+	return IRQ_HANDLED;
+}
+
+static int __init ppc4xx_l2c_probe(void)
+{
+	struct device_node *np;
+	u32 r;
+	unsigned long flags;
+	int irq;
+	const u32 *dcrreg;
+	u32 dcrbase_isram;
+	int len;
+
+	np =3D of_find_compatible_node(np, NULL, "ibm,l2-cache");
+	if (!np)
+		return 0;
+
+	/* Map DCRs */
+	dcrreg =3D of_get_property(np, "dcr-reg", &len);
+	if (!dcrreg || (len !=3D 4 * sizeof(u32))) {
+		printk(KERN_ERR "%s: Can't get DCR register base !",
+		       np->full_name);
+		of_node_put(np);
+		return -ENODEV;
+	}
+	dcrbase_isram =3D dcrreg[0];
+	dcrbase =3D dcrreg[2];
+
+	/* Get and map irq number from device tree */
+	irq =3D irq_of_parse_and_map(np, 0);
Quoted 8 lines

arch/powerpc/sysdev/ppc4xx_soc.c

Quoted 8 lines
arch/powerpc/sysdev/ppc4xx_soc.c new file +8 -0
+	if (irq =3D=3D NO_IRQ) {
+		printk(KERN_ERR "irq_of_parse_and_map failed\n");
+		of_node_put(np);
+		return -ENODEV;
+	}
+
+	/* Install error handler */
+	if (request_irq(irq, l2c_error_handler, IRQF_DISABLED, "L2C", 0) < 0)=

{

Quoted 11 lines

arch/powerpc/sysdev/ppc4xx_soc.c line 114

Quoted 8 lines
arch/powerpc/sysdev/ppc4xx_soc.c new file +8 -0
+		printk(KERN_ERR "Cannot install L2C error handler"
+		       ", cache is not enabled\n");
+		of_node_put(np);
+		return -ENODEV;
+	}
+
+	local_irq_save(flags);
+	asm volatile ("sync" ::: "memory");

Perhaps just call iosync() for these instead of the open coded asm volatile stuff?

With Ben's comments, I'll leave it unchanged.

Quoted 54 lines
Quoted 54 lines
arch/powerpc/sysdev/ppc4xx_soc.c new file +47 -0
+
+	/* Disable SRAM */
+	mtdcr(dcrbase_isram + DCRN_SRAM0_DPC,
+	      mfdcr(dcrbase_isram + DCRN_SRAM0_DPC) & ~SRAM_DPC_ENABLE);
+	mtdcr(dcrbase_isram + DCRN_SRAM0_SB0CR,
+	      mfdcr(dcrbase_isram + DCRN_SRAM0_SB0CR) & ~SRAM_SBCR_BU_MASK);
+	mtdcr(dcrbase_isram + DCRN_SRAM0_SB1CR,
+	      mfdcr(dcrbase_isram + DCRN_SRAM0_SB1CR) & ~SRAM_SBCR_BU_MASK);
+	mtdcr(dcrbase_isram + DCRN_SRAM0_SB2CR,
+	      mfdcr(dcrbase_isram + DCRN_SRAM0_SB2CR) & ~SRAM_SBCR_BU_MASK);
+	mtdcr(dcrbase_isram + DCRN_SRAM0_SB3CR,
+	      mfdcr(dcrbase_isram + DCRN_SRAM0_SB3CR) & ~SRAM_SBCR_BU_MASK);
+
+	/* Enable L2_MODE without ICU/DCU */
+	r =3D mfdcr(dcrbase + DCRN_L2C0_CFG) &
+		~(L2C_CFG_ICU | L2C_CFG_DCU | L2C_CFG_SS_MASK);
+	r |=3D L2C_CFG_L2M | L2C_CFG_SS_256;
+	mtdcr(dcrbase + DCRN_L2C0_CFG, r);
+
+	mtdcr(dcrbase + DCRN_L2C0_ADDR, 0);
+
+	/* Hardware Clear Command */
+	mtdcr(dcrbase + DCRN_L2C0_CMD, L2C_CMD_HCC);
+	while (!(mfdcr(dcrbase + DCRN_L2C0_SR) & L2C_SR_CC))
+		;
+
+	/* Clear Cache Parity and Tag Errors */
+	mtdcr(dcrbase + DCRN_L2C0_CMD, L2C_CMD_CCP | L2C_CMD_CTE);
+
+	/* Enable 64G snoop region starting at 0 */
+	r =3D mfdcr(dcrbase + DCRN_L2C0_SNP0) &
+		~(L2C_SNP_BA_MASK | L2C_SNP_SSR_MASK);
+	r |=3D L2C_SNP_SSR_32G | L2C_SNP_ESR;
+	mtdcr(dcrbase + DCRN_L2C0_SNP0, r);
+
+	r =3D mfdcr(dcrbase + DCRN_L2C0_SNP1) &
+		~(L2C_SNP_BA_MASK | L2C_SNP_SSR_MASK);
+	r |=3D 0x80000000 | L2C_SNP_SSR_32G | L2C_SNP_ESR;
+	mtdcr(dcrbase + DCRN_L2C0_SNP1, r);
+
+	asm volatile ("sync" ::: "memory");
+
+	/* Enable ICU/DCU ports */
+	r =3D mfdcr(dcrbase + DCRN_L2C0_CFG);
+	r &=3D ~(L2C_CFG_DCW_MASK | L2C_CFG_PMUX_MASK | L2C_CFG_PMIM
+	       | L2C_CFG_TPEI | L2C_CFG_CPEI | L2C_CFG_NAM | L2C_CFG_NBRM);
+	r |=3D L2C_CFG_ICU | L2C_CFG_DCU | L2C_CFG_TPC | L2C_CFG_CPC |

L2C_CFG_FRAN + | L2C_CFG_CPIM | L2C_CFG_TPIM | L2C_CFG_LIM |
L2C_CFG_SMCM;

arch/powerpc/sysdev/ppc4xx_soc.c new file +5 -0
+
+	/* Check for 460EX/GT special handling */
+	if (of_device_is_compatible(np, "ibm,l2-cache-460ex"))
+		r |=3D L2C_CFG_RDBW;
+
Quoted 8 lines

arch/powerpc/sysdev/ppc4xx_soc.c line 173

Quoted 6 lines
arch/powerpc/sysdev/ppc4xx_soc.c new file +6 -0
+	mtdcr(dcrbase + DCRN_L2C0_CFG, r);
+
+	asm volatile ("sync; isync" ::: "memory");
+	local_irq_restore(flags);
+
+	printk(KERN_INFO "256k L2-cache enabled\n");

Should the cache size be derived from the device tree?

Right, we should probably do this. Even though currently there doesn't seem=
to=20
be a 4xx with a different L2 cache size than 256k.

Best regards,
Stefan

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: [email protected] =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D