Skip to contentSkip to conversation

Add support for Rev. B of PowerPC 440SPe

PATCH Superseded Roland Dreier 4 participants 11 messages Nov 13, 2006 – Nov 16, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add support for Rev. B of PowerPC 440SPe

This is mostly updating the PCI Express code to work with the new core in the Rev. B chip, which unfortunately has different undocumented restrictions on the PLB addresses that can be used from the Rev. A core.

Also, when adding the cputable entry for 440SPe Rev. B, we need to adjust the entry for 440SP Rev. A so that it looks at more bits of the PVR. The 440SPe Rev. B has PVR 53421891, which would have matched the old 440SP pattern of 53xxx891.

---
Matt, please queue for a 2.6.20 merge.

 arch/powerpc/kernel/cputable.c           |   21 ++-
 arch/ppc/platforms/4xx/davinci_sc.c      |    5 -
 arch/ppc/syslib/ppc440spe_pcie.c         |  258 ++++++++++++++++++++++--------
 drivers/infiniband/hw/mthca/mthca_main.c |    4 +-
 4 files changed, 206 insertions(+), 82 deletions(-)
arch/powerpc/kernel/cputable.c +16 -5
index bfd499e..04559be 100644
@@ -1073,8 +1073,8 @@ #ifdef CONFIG_44x
 		.platform		= "ppc440",
 	},
 	{ /* 440SP Rev. A */
-		.pvr_mask		= 0xff000fff,
-		.pvr_value		= 0x53000891,
+		.pvr_mask		= 0xfff00fff,
+		.pvr_value		= 0x53200891,
 		.cpu_name		= "440SP Rev. A",
 		.cpu_features		= CPU_FTRS_44X,
 		.cpu_user_features	= COMMON_USER_BOOKE,
@@ -1083,9 +1083,20 @@ #ifdef CONFIG_44x
 		.platform		= "ppc440",
 	},
 	{ /* 440SPe Rev. A */
-		.pvr_mask		= 0xff000fff,
-		.pvr_value		= 0x53000890,
-		.cpu_name		= "440SPe Rev. A",
+		.pvr_mask               = 0xfff00fff,
+		.pvr_value              = 0x53400890,
+		.cpu_name               = "440SPe Rev. A",
+		.cpu_features           = CPU_FTR_SPLIT_ID_CACHE |
+			CPU_FTR_USE_TB,
+		.cpu_user_features      = COMMON_USER_BOOKE,
+		.icache_bsize           = 32,
+		.dcache_bsize           = 32,
+		.platform               = "ppc440",
+	},
+	{ /* 440SPe Rev. B */
+		.pvr_mask		= 0xfff00fff,
+		.pvr_value		= 0x53400891,
+		.cpu_name		= "440SPe Rev. B",
 		.cpu_features		= CPU_FTR_SPLIT_ID_CACHE |
 			CPU_FTR_USE_TB,
 		.cpu_user_features	= COMMON_USER_BOOKE,
arch/ppc/platforms/4xx/davinci_sc.c +0 -5
index 623988f..3dbedda 100644
@@ -172,11 +172,6 @@ davinci_sc_setup_hoses(void)
 	char name[20];
 	int i;
 
-	if (0 && ppc440spe_init_pcie()) {
-		printk(KERN_WARNING "PPC440SPe PCI Express initialization failed\n");
-		return;
-	}
-
 	for (i = 0; i <= 2; ++i) {
 		if (!davinci_sc_pcie_card_present(i))
 			continue;
arch/ppc/syslib/ppc440spe_pcie.c +188 -70

390 lines not on this page · raw message

Signature · 1 line
1.4.3.2
#1 lore raw
Quoted 10 lines · In message <[email protected]> you wrote:

This is mostly updating the PCI Express code to work with the new core in the Rev. B chip, which unfortunately has different undocumented restrictions on the PLB addresses that can be used from the Rev. A core.

Also, when adding the cputable entry for 440SPe Rev. B, we need to adjust the entry for 440SP Rev. A so that it looks at more bits of the PVR. The 440SPe Rev. B has PVR 53421891, which would have matched the old 440SP pattern of 53xxx891.

Just for the record:

This patch is _heavily_ borrowed on code by Rafal Jaworowski; see
http://www.denx.de/cgi-bin/gitweb.cgi?p=linux-2.6-denx.git;a=commit;h=30e3e3be8863902f508af74fdc61ec9b80756bc0

Please add correct attribution.

Best regards,

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected]
"In Christianity neither morality nor religion come into contact with
reality at any point."                          - Friedrich Nietzsche
#2 lore raw

Roland did u are working on a settop box? with PPC440

Quoted 28 lines

From: Wolfgang Denk <[email protected]>
To: Roland Dreier <[email protected]>
CC: [email protected]
Subject: Re: [PATCH] [POWERPC] Add support for Rev. B of PowerPC 440SPe Date: Mon, 13 Nov 2006 23:27:25 +0100

Quoted 10 lines · In message <[email protected]> you wrote:

This is mostly updating the PCI Express code to work with the new core in the Rev. B chip, which unfortunately has different undocumented restrictions on the PLB addresses that can be used from the Rev. A core.

Also, when adding the cputable entry for 440SPe Rev. B, we need to adjust the entry for 440SP Rev. A so that it looks at more bits of the PVR. The 440SPe Rev. B has PVR 53421891, which would have matched the old 440SP pattern of 53xxx891.

Just for the record:

This patch is _heavily_ borrowed on code by Rafal Jaworowski; see
http://www.denx.de/cgi-bin/gitweb.cgi?p=linux-2.6-denx.git;a=commit;h=30e3e3be8863902f508af74fdc61ec9b80756bc0

Please add correct attribution.

Best regards,

Wolfgang Denk

Quoted 9 lines

--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected] "In Christianity neither morality nor religion come into contact with
reality at any point." - Friedrich Nietzsche
_______________________________________________
Linuxppc-embedded mailing list [email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-embedded

_________________________________________________________________
Try Search Survival Kits: Fix up your home and better handle your cash with Live Search! http://imagine-windowslive.com/search/kits/default.aspx?kit=improve&locale=en-US&source=hmtagline

#3 lore raw
In reply to Wolfgang Denk
Quoted 1 line

This patch is _heavily_ borrowed on code by Rafal Jaworowski

Indeed -- I meant to add that to the change log and just forgot. I will resend now.

On the other hand it might have been nice for you to submit this upstream rather than letting it sit in your tree for months and months...

- R.

#4 lore raw

PATCH v2 1/1 Add support for Rev. B of PowerPC 440SPe

In reply to Roland Dreier

This is mostly updating the PCI Express code to work with the new core in the Rev. B chip, which unfortunately has different undocumented restrictions on the PLB addresses that can be used from the Rev. A core.

Also, when adding the cputable entry for 440SPe Rev. B, we need to adjust the entry for 440SP Rev. A so that it looks at more bits of the PVR. The 440SPe Rev. B has PVR 53421891, which would have matched the old 440SP pattern of 53xxx891.

This is a cleaned up version of the original work done by Rafal Jaworowski <[email protected]>, who actually suffered through figuring out how to avoid the Rev. B chip locking up when using PCIe.

---
Matt, please apply this version, which gives proper credit for the patch.

 arch/powerpc/kernel/cputable.c           |   21 ++-
 arch/ppc/platforms/4xx/davinci_sc.c      |    5 -
 arch/ppc/syslib/ppc440spe_pcie.c         |  258 ++++++++++++++++++++++--------
 drivers/infiniband/hw/mthca/mthca_main.c |    4 +-
 4 files changed, 206 insertions(+), 82 deletions(-)
arch/powerpc/kernel/cputable.c +16 -5
index bfd499e..04559be 100644
@@ -1073,8 +1073,8 @@ #ifdef CONFIG_44x
 		.platform		= "ppc440",
 	},
 	{ /* 440SP Rev. A */
-		.pvr_mask		= 0xff000fff,
-		.pvr_value		= 0x53000891,
+		.pvr_mask		= 0xfff00fff,
+		.pvr_value		= 0x53200891,
 		.cpu_name		= "440SP Rev. A",
 		.cpu_features		= CPU_FTRS_44X,
 		.cpu_user_features	= COMMON_USER_BOOKE,
@@ -1083,9 +1083,20 @@ #ifdef CONFIG_44x
 		.platform		= "ppc440",
 	},
 	{ /* 440SPe Rev. A */
-		.pvr_mask		= 0xff000fff,
-		.pvr_value		= 0x53000890,
-		.cpu_name		= "440SPe Rev. A",
+		.pvr_mask               = 0xfff00fff,
+		.pvr_value              = 0x53400890,
+		.cpu_name               = "440SPe Rev. A",
+		.cpu_features           = CPU_FTR_SPLIT_ID_CACHE |
+			CPU_FTR_USE_TB,
+		.cpu_user_features      = COMMON_USER_BOOKE,
+		.icache_bsize           = 32,
+		.dcache_bsize           = 32,
+		.platform               = "ppc440",
+	},
+	{ /* 440SPe Rev. B */
+		.pvr_mask		= 0xfff00fff,
+		.pvr_value		= 0x53400891,
+		.cpu_name		= "440SPe Rev. B",
 		.cpu_features		= CPU_FTR_SPLIT_ID_CACHE |
 			CPU_FTR_USE_TB,
 		.cpu_user_features	= COMMON_USER_BOOKE,
arch/ppc/platforms/4xx/davinci_sc.c +0 -5
index 623988f..3dbedda 100644
@@ -172,11 +172,6 @@ davinci_sc_setup_hoses(void)
 	char name[20];
 	int i;
 
-	if (0 && ppc440spe_init_pcie()) {
-		printk(KERN_WARNING "PPC440SPe PCI Express initialization failed\n");
-		return;
-	}
-
 	for (i = 0; i <= 2; ++i) {
 		if (!davinci_sc_pcie_card_present(i))
 			continue;
arch/ppc/syslib/ppc440spe_pcie.c +188 -70

390 lines not on this page · raw message

drivers/infiniband/hw/mthca/mthca_main.c +2 -2
index 47ea021..c499b90 100644
@@ -87,9 +87,9 @@ static const char mthca_version[] __devi
 	DRV_VERSION " (" DRV_RELDATE ")\n";
 
 static struct mthca_profile default_profile = {
-	.num_qp		   = 1 << 16,
+	.num_qp		   = 1 << 11,
 	.rdb_per_qp	   = 4,
-	.num_cq		   = 1 << 16,
+	.num_cq		   = 1 << 11,
 	.num_mcg	   = 1 << 13,
 	.num_mpt	   = 1 << 17,
 	.num_mtt	   = 1 << 20,
Signature · 1 line
1.4.3.2
#5 lore raw
Quoted 14 lines · Roland Dreier

This is mostly updating the PCI Express code to work with the new core in the Rev. B chip, which unfortunately has different undocumented restrictions on the PLB addresses that can be used from the Rev. A core.

Also, when adding the cputable entry for 440SPe Rev. B, we need to adjust the entry for 440SP Rev. A so that it looks at more bits of the PVR. The 440SPe Rev. B has PVR 53421891, which would have matched the old 440SP pattern of 53xxx891.

This is a cleaned up version of the original work done by Rafal Jaworowski <[email protected]>, who actually suffered through figuring out how to avoid the Rev. B chip locking up when using PCIe.

[snip]

Quoted 18 lines
arch/ppc/syslib/ppc440spe_pcie.c +18 -0
+static void ppc440spe_setup_utl(int port)
+{
+	void __iomem *utl_base;
+
+	/*
+	 * Map UTL registers at 0xc_1000_0n00
+	 */
+	switch (port) {
+	case 0:
+		mtdcr(DCRN_PEGPL_REGBAH(PCIE0), 0x0000000c);
+		mtdcr(DCRN_PEGPL_REGBAL(PCIE0), 0x10000000);
+		mtdcr(DCRN_PEGPL_REGMSK(PCIE0), 0x00007001);
+		mtdcr(DCRN_PEGPL_SPECIAL(PCIE0), 0x68782800);
+		break;
+
+	case 1:
+		mtdcr(DCRN_PEGPL_REGBAH(PCIE1), 0x0000000c);
+		mtdcr(DCRN_PEGPL_REGBAL(PCIE1), 0x10001000);

arch/ppc/syslib/ppc440spe_pcie.c int ppc440spe_init_pcie(void) · line 235

Quoted 10 lines
arch/ppc/syslib/ppc440spe_pcie.c +10 -0
+		mtdcr(DCRN_PEGPL_REGMSK(PCIE1), 0x00007001);
+		mtdcr(DCRN_PEGPL_SPECIAL(PCIE1), 0x68782800);
+		break;
+
+	case 2:
+		mtdcr(DCRN_PEGPL_REGBAH(PCIE2), 0x0000000c);
+		mtdcr(DCRN_PEGPL_REGBAL(PCIE2), 0x10002000);
+		mtdcr(DCRN_PEGPL_REGMSK(PCIE2), 0x00007001);
+		mtdcr(DCRN_PEGPL_SPECIAL(PCIE2), 0x68782800);
+	}

Can this be collapsed into 4 writes instead of 12? DCR accessors have supported run-time specified parameters for quite some time.

[snip]

arch/ppc/syslib/ppc440spe_pcie.c int ppc440spe_init_pcie_rootport(int por · line 353

Quoted 3 lines
arch/ppc/syslib/ppc440spe_pcie.c +3 -0
+	case 0: val = SDR_READ(PESDR0_LOOP); break;
+	case 1: val = SDR_READ(PESDR1_LOOP); break;
+	case 2: val = SDR_READ(PESDR2_LOOP); break;

I'm curious, why do we need a switch here?
SDR_READ() also supports run-time parameters.

[snip]

Quoted 30 lines
arch/ppc/syslib/ppc440spe_pcie.c +14 -6
 	switch (port) {
 	case 0:
-		mtdcr(DCRN_PEGPL_CFGBAH(PCIE0), 0x0000000c);
-		mtdcr(DCRN_PEGPL_CFGBAL(PCIE0), 0x40000000);
+		if (core_rev == REV_A) {
+			mtdcr(DCRN_PEGPL_CFGBAH(PCIE0), 0x0000000c);
+			mtdcr(DCRN_PEGPL_CFGBAL(PCIE0), 0x40000000);
+		} else {
+			mtdcr(DCRN_PEGPL_CFGBAH(PCIE0), 0x0000000d);
+			mtdcr(DCRN_PEGPL_CFGBAL(PCIE0), 0x00000000);
+		}
 		mtdcr(DCRN_PEGPL_CFGMSK(PCIE0), 0xe0000001); /* 512MB region, valid */
 		break;
 
 	case 1:
-		mtdcr(DCRN_PEGPL_CFGBAH(PCIE1), 0x0000000c);
-		mtdcr(DCRN_PEGPL_CFGBAL(PCIE1), 0x80000000);
+		if (core_rev == REV_A) {
+			mtdcr(DCRN_PEGPL_CFGBAH(PCIE1), 0x0000000c);
+			mtdcr(DCRN_PEGPL_CFGBAL(PCIE1), 0x80000000);
+		} else {
+			mtdcr(DCRN_PEGPL_CFGBAH(PCIE1), 0x0000000d);
+			mtdcr(DCRN_PEGPL_CFGBAL(PCIE1), 0x20000000);
+		}
 		mtdcr(DCRN_PEGPL_CFGMSK(PCIE1), 0xe0000001); /* 512MB region, valid */
 		break;
 
 	case 2:
-		mtdcr(DCRN_PEGPL_CFGBAH(PCIE2), 0x0000000c);
-		mtdcr(DCRN_PEGPL_CFGBAL(PCIE2), 0xc0000000);

arch/ppc/syslib/ppc440spe_pcie.c int ppc440spe_init_pcie_rootport(int por · line 422

Quoted 10 lines
arch/ppc/syslib/ppc440spe_pcie.c +7 -0
+		if (core_rev == REV_A) {
+			mtdcr(DCRN_PEGPL_CFGBAH(PCIE2), 0x0000000c);
+			mtdcr(DCRN_PEGPL_CFGBAL(PCIE2), 0xc0000000);
+		} else {
+			mtdcr(DCRN_PEGPL_CFGBAH(PCIE2), 0x0000000d);
+			mtdcr(DCRN_PEGPL_CFGBAL(PCIE2), 0x40000000);
+		}
 		mtdcr(DCRN_PEGPL_CFGMSK(PCIE2), 0xe0000001); /* 512MB region, valid */
 		break;
 	}

Can we get rid of this switch as well?

There are other places like this in the patch but I think you got my idea :).

Signature · 1 line
Eugene
#6 lore raw
Quoted 4 lines

Can we get rid of this switch as well?

There are other places like this in the patch but I think you got my idea :).

Makes sense -- I'll rework the patch to cut down on the code duplication (which is already there in my code that went upstream). I think there have to be switches (or equivalently, look-up tables) since there's no regularity in where the DCRs/SDRs for the different PCIe ports are.

- R.

#7 lore raw

On Wed, Nov 15, 2006 at 02:29:51PM -0800, Roland Dreier wrote:

[snip]

Quoted 3 lines

I think there have to be switches (or equivalently, look-up tables) since there's no regularity in where the DCRs/SDRs for the different PCIe ports are.

Uhh, I was afraid you were gonna say this. HW guys don't make our life easier :).

I think look-up tables are fine. It's not a fast path, is it?

Signature · 1 line
Eugene
#8 lore raw
Quoted 1 line

I think look-up tables are fine. It's not a fast path, is it?

Nope, that would be fine. I'll definitely cut down on the code duplication -- I'm just not sure what will end up being cleanest. I don't see that much difference between a switch and a look-up table for finding the base DCR index for a particular port.

#9 lore raw
Quoted 6 lines · Roland Dreier
Quoted 1 line

I think look-up tables are fine. It's not a fast path, is it?

Nope, that would be fine. I'll definitely cut down on the code duplication -- I'm just not sure what will end up being cleanest. I don't see that much difference between a switch and a look-up table for finding the base DCR index for a particular port.

OK, I was just wanted to make sure you were aware that mfdcr/mtdcr supported run-time specified DCR number (from that code it wasn't clear).

Signature · 1 line
Eugene
#10 lore raw
Quoted 3 lines

OK, I was just wanted to make sure you were aware that mfdcr/mtdcr supported run-time specified DCR number (from that code it wasn't clear).

I actually didn't until you pointed it out -- mfdcr looks enough like assembly to confuse my small brain, and I guess I'm way behind the times (since the support for run-time numbers predates the beginning of git history, so it's been a _long_ time).

- R.