Skip to contentSkip to conversation

Add PPC4xx L2-cache support (440GX & 460EX/GT)

PATCH Superseded Stefan Roese 3 participants 5 messages Mar 18, 2008 – Mar 20, 2008

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Add PPC4xx L2-cache support (440GX & 460EX/GT)

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 just a copy of Eugene's code in arch/ppc with small modifications.

Tested on AMCC Taishan 440GX and Canyonlands 460EX.

---
 arch/powerpc/Kconfig               |    3 +
 arch/powerpc/platforms/44x/Kconfig |    2 +
 arch/powerpc/sysdev/Makefile       |    1 +
 arch/powerpc/sysdev/ppc4xx_soc.c   |  174 ++++++++++++++++++++++++++++++++++++
 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 +174 -0

174 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

Hi Stefan,

Just a few trivial things ...

arch/powerpc/sysdev/ppc4xx_soc.c line 74

Quoted 6 lines · On Tue, 18 Mar 2008 14:36:29 +0100 Stefan Roese <[email protected]> wrote:

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

arch/powerpc/sysdev/ppc4xx_soc.c new file +3 -0
+static int __init ppc4xx_l2c_probe(void)
+{
+	struct device_node *np = NULL;

This initialisation is unneeded.

arch/powerpc/sysdev/ppc4xx_soc.c line 88

Quoted 3 lines
arch/powerpc/sysdev/ppc4xx_soc.c new file +3 -0
+	/* Map DCRs */
+	dcrreg = of_get_property(np, "dcr-reg", &len);
+	if (!dcrreg || (len != 4*sizeof(u32))) {

I prefer spaces around binary operators.

arch/powerpc/sysdev/ppc4xx_soc.c line 91

Quoted 3 lines
arch/powerpc/sysdev/ppc4xx_soc.c new file +3 -0
+		printk(KERN_ERR "%s: Can't get DCR register base !",
+		       np->full_name);
+		return -ENODEV;

Since of_find_compatible_node() gets a reference to np, you need an of_node_put(np) before you return.

arch/powerpc/sysdev/ppc4xx_soc.c line 100

Quoted 3 lines
arch/powerpc/sysdev/ppc4xx_soc.c new file +3 -0
+	if (irq == NO_IRQ) {
+		printk(KERN_ERR "irq_of_parse_and_map failed\n");
+		return -ENODEV;

And again.

arch/powerpc/sysdev/ppc4xx_soc.c line 107

Quoted 4 lines
arch/powerpc/sysdev/ppc4xx_soc.c new file +4 -0
+	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");
+		return -ENODEV;

And again.

Review

Quoted 1 line
(quoted diff) +1 -0
+	return 0;

And again.

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
#2 lore raw

Hi Stephan,

Quoted 1 line · Stephen Rothwell

Just a few trivial things ...

Thanks. Will fix and resubmit.

Best regards,
Stefan

#3 lore raw
In reply to Stefan Roese
Quoted 11 lines · Stefan Roese

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 just a copy of Eugene's code in arch/ppc with small modifications.

Tested on AMCC Taishan 440GX and Canyonlands 460EX.

It's my understanding that on some 44x platforms, the l2 needs to be explicitely invalidated on DMAs. Do we know more about that ? I think it depends on something like the number of masters on the PLB4 or so. I don't remember the details.

Ben.

#4 lore raw
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 8 lines · Stefan Roese

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 just a copy of Eugene's code in arch/ppc with small modifications.

Quoted 6 lines
Quoted 3 lines

Tested on AMCC Taishan 440GX and Canyonlands 460EX.

It's my understanding that on some 44x platforms, the l2 needs to be explicitely invalidated on DMAs.

Correct.

Quoted 3 lines

Do we know more about that ? I think it
depends on something like the number of masters on the PLB4 or so. I don't remember the details.

The L2 cache on the 440GX is cache coherent (via snooping). On the 440SP/440SPe the L2 cache is partially coherent. The LL (Low Latency) PLB segment is coherent and the HB (High Bandwidth) PLB segment is unfortunately not. Here an except from the 440SPe users manual:

"
Cache coherency is limited to the Low Latency (LL) PLB bus and is managed by a hardware snoop mechanism or software (software that is similar to the existing CPU L1 cache)
"

So we will need to add something to handle the L2 cache on those platforms correctly. Not needed on 440GX though.

As for 460EX/GT this is currently not clear yet. I'm working on it with AMCC right now.

Best regards,
Stefan