Skip to contentSkip to conversation

mv643xx broken on pegasos

DISCUSSION Applied [email protected] 5 participants 9 messages Jan 15, 2009 – Jan 20, 2009

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

Based on what I can find in the mailing list archives, I'm the last remaining Pegasos owner. (Maybe I was always the only one.) I therefore reluctantly offer myself as the guinea pig to get mv643xx_eth back to normal.

In 2.6.26 it worked. (Detected as eth1, since eth0 is the via-rhine)

In 2.6.27 it was completely broken. It detected the device and said the link was up, but it was not usable. From tcpdump it appears that incoming packets are processed correctly, but outgoing packets are delayed and/or mangled. Occasionally a packet goes through. Workaround: the 2.6.26 version of mv643xx_eth.c still compiles and works if dropped into 2.6.27/drivers/net.

In 2.6.28, it behaves like 2.6.27 with a bonus bug: the port has moved to eth2, and eth1 is now a phantom port with MAC address 00:00:00:00:00:00. And the old 2.6.26 code doesn't compile so the workaround is dead.

To start the investigation, I'm including log excerpts showing what happens when the driver is first loaded in 3 different kernels. Note this interesting
feature: the first one shows a different MAC address than the others, with an unregistered OUI instead of bplan's 00:0b:2f, plus the suspicious string "DEAD"... and this is the driver that works!

2.6.26> MV-643xx 10/100/1000 Ethernet Driver 2.6.26> eth1: port 1 with MAC address 00:2b:2f:de:ad:01 2.6.26> eth1: Scatter Gather Enabled
2.6.26> eth1: TX TCP/IP Checksumming Supported 2.6.26> eth1: RX TCP/UDP Checksum Offload ON 2.6.26> eth1: RX NAPI Enabled
2.6.26> eth1: Using SRAM

2.6.27> MV-643xx 10/100/1000 ethernet driver version 1.3 2.6.27> : no PHY detected at addr 0
2.6.27> net eth1: port 1 with MAC address 00:0b:2f:6b:27:e2 2.6.27> net eth1: scatter/gather enabled
2.6.27> net eth1: tx checksum offload
2.6.27> net eth1: napi enabled
2.6.27> net eth1: configured with sram

2.6.28> MV-643xx 10/100/1000 ethernet driver version 1.4 2.6.28> mv643xx_eth smi: probed
2.6.28> net eth1: port 0 with MAC address 00:00:00:00:00:00 2.6.28> net eth1: configured with sram
2.6.28> eth%d: 0:07 already attached
2.6.28> net eth2: port 1 with MAC address 00:0b:2f:6b:27:e2 2.6.28> net eth2: configured with sram

Signature · 1 line
Alan Curry
#1 lore raw
Quoted 1 line · * [email protected] <[email protected]> [2009-01-14 20:22]:

In 2.6.27 it was completely broken.

I just noticed that this bug has also been reported on the Pegasos
forum: http://www.powerdeveloper.org/forums/viewtopic.php?p=11849
The discussion doesn't contain a lot of information, except for this observation:

"I've been bisecting the problem today and the regression is indeed with one of Lennert's changes, but I would certainly not have bet on the innocent looking "mv643xx_eth: use longer DMA bursts" patch (git commit identifier cd4ccf76bfd2c36d351e68be7e6a597268f98a1a).

With this commit reverted, Gb ethernet is working again with kernel 2.6.27 on Pegasos."

Signature · 2 lines
Martin Michlmayr
http://www.cyrius.com/
maintainer
#2 lore raw

From: Martin Michlmayr <[email protected]>
Date: Thu, 15 Jan 2009 21:32:14 +0100

Quoted 5 lines

I just noticed that this bug has also been reported on the Pegasos
forum: http://www.powerdeveloper.org/forums/viewtopic.php?p=11849
The discussion doesn't contain a lot of information, except for this observation:

Quoted 7 lines

"I've been bisecting the problem today and the regression is indeed with one of Lennert's changes, but I would certainly not have bet on the innocent looking "mv643xx_eth: use longer DMA bursts" patch (git commit identifier cd4ccf76bfd2c36d351e68be7e6a597268f98a1a).

With this commit reverted, Gb ethernet is working again with kernel 2.6.27 on Pegasos."

Lennert, please work to resolve this problem. If you don't have time, I'm just going to revert that DMA burst change.

Thanks.

#3 lore raw
Quoted 10 lines · David Miller
Quoted 10 lines

I just noticed that this bug has also been reported on the Pegasos
forum: http://www.powerdeveloper.org/forums/viewtopic.php?p=11849
The discussion doesn't contain a lot of information, except for this observation:

"I've been bisecting the problem today and the regression is indeed with one of Lennert's changes, but I would certainly not have bet on the innocent looking "mv643xx_eth: use longer DMA bursts" patch (git commit identifier cd4ccf76bfd2c36d351e68be7e6a597268f98a1a).

Quoted 5 lines
Quoted 2 lines

With this commit reverted, Gb ethernet is working again with kernel 2.6.27 on Pegasos."

Lennert, please work to resolve this problem. If you don't have time, I'm just going to revert that DMA burst change.

Hi David,

Reverting indeed seems the right thing to do (commit below), but even with that patch it's apparently still broken in 2.6.28, I'm still looking into that.

thanks,
Lennert

Quoted 1 line

From a8907f45652a3a331b83d8b8b830750a5a82ed23 Mon Sep 17 00:00:00 2001

From: Lennert Buytenhek <[email protected]>
Date: Mon, 19 Jan 2009 10:33:21 +0100
Subject: [PATCH] Revert "mv643xx_eth: use longer DMA bursts".

This reverts commit cd4ccf76bfd2c36d351e68be7e6a597268f98a1a.

On the Pegasos board, we can't do DMA burst that are longer than one cache line. For now, go back to using 32 byte DMA bursts for all mv643xx_eth platforms -- we can switch the ARM-based platforms back to doing long 128 byte bursts in the next development cycle.

---
 drivers/net/mv643xx_eth.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
drivers/net/mv643xx_eth.c +8 -6
index 7253a49..e2aa468 100644
@@ -136,21 +136,23 @@ static char mv643xx_eth_driver_version[] = "1.4";
 /*
  * SDMA configuration register.
  */
+#define RX_BURST_SIZE_4_64BIT		(2 << 1)
 #define RX_BURST_SIZE_16_64BIT		(4 << 1)
 #define BLM_RX_NO_SWAP			(1 << 4)
 #define BLM_TX_NO_SWAP			(1 << 5)
+#define TX_BURST_SIZE_4_64BIT		(2 << 22)
 #define TX_BURST_SIZE_16_64BIT		(4 << 22)
 
 #if defined(__BIG_ENDIAN)
 #define PORT_SDMA_CONFIG_DEFAULT_VALUE		\
-		(RX_BURST_SIZE_16_64BIT	|	\
-		TX_BURST_SIZE_16_64BIT)
+		(RX_BURST_SIZE_4_64BIT	|	\
+		 TX_BURST_SIZE_4_64BIT)
 #elif defined(__LITTLE_ENDIAN)
 #define PORT_SDMA_CONFIG_DEFAULT_VALUE		\
-		(RX_BURST_SIZE_16_64BIT	|	\
-		BLM_RX_NO_SWAP		|	\
-		BLM_TX_NO_SWAP		|	\
-		TX_BURST_SIZE_16_64BIT)
+		(RX_BURST_SIZE_4_64BIT	|	\
+		 BLM_RX_NO_SWAP		|	\
+		 BLM_TX_NO_SWAP		|	\
+		 TX_BURST_SIZE_4_64BIT)
 #else
 #error One of __BIG_ENDIAN or __LITTLE_ENDIAN must be defined
 #endif
Signature · 1 line
1.5.6.4
maintainer Applied
#4 lore raw

From: Lennert Buytenhek <[email protected]>
Date: Mon, 19 Jan 2009 10:45:23 +0100

Quoted 4 lines

Revert "mv643xx_eth: use longer DMA bursts".

This reverts commit cd4ccf76bfd2c36d351e68be7e6a597268f98a1a.

Quoted 8 lines

On the Pegasos board, we can't do DMA burst that are longer than one cache line. For now, go back to using 32 byte DMA bursts for all mv643xx_eth platforms -- we can switch the ARM-based platforms back to doing long 128 byte bursts in the next development cycle.

Applied, thanks everyone.

#5 lore raw
In reply to [email protected]
Quoted 4 lines · On Wed, Jan 14, 2009 at 08:22:32PM -0500, [email protected] wrote:

In 2.6.28, it behaves like 2.6.27 with a bonus bug: the port has moved to eth2, and eth1 is now a phantom port with MAC address 00:00:00:00:00:00. And the old 2.6.26 code doesn't compile so the workaround is dead.

This is probably because mv643xx_eth now no longer fails registration of the interface if no valid PHY could be found. Gabriel Paubert (CC'ed) had a patch for this that basically amounted to removing the initialisation for eth1 (called "eth0" in the Pegasos platform code). He's away for a couple of days but should be back soon.

Also, since the mv643xx_eth phylib conversion, it appears that the PHY on the Pegasos board fails to initialise properly, and this can apparently be worked around by turning the Marvell phylib driver off. Are you seeing this as well?

thanks,
Lennert

#6 lore raw
Quoted 7 lines · Lennert Buytenhek
Quoted 4 lines · On Wed, Jan 14, 2009 at 08:22:32PM -0500, [email protected] wrote:

In 2.6.28, it behaves like 2.6.27 with a bonus bug: the port has moved to eth2, and eth1 is now a phantom port with MAC address 00:00:00:00:00:00. And the old 2.6.26 code doesn't compile so the workaround is dead.

Quoted 5 lines

This is probably because mv643xx_eth now no longer fails registration of the interface if no valid PHY could be found. Gabriel Paubert (CC'ed) had a patch for this that basically amounted to removing the initialisation for eth1 (called "eth0" in the Pegasos platform code). He's away for a couple of days but should be back soon.

Indeed, I'm back. Maybe I should have posted my patches to a mailing list, but since I did not kow which one (linuxppc or netdev), I opted for none.

In the end I have booted a Pegasos with the following patch on top of 2.6.29-rc1. Actually I have slightly amended pegasos_eth.c since my last post on Matt's request and I'm not going to be close to the machine and reboot it until Janurary 20th but it's only a few renames (and at least it builds), but buyer beware (note that the patches to drivers/net/mv643xx_eth.c have already been submitted separately by Lennert through netdev):

arch/powerpc/platforms/chrp/pegasos_eth.c +17 -55
index 130ff72..039fc8e 100644
@@ -21,8 +21,8 @@
 #define PEGASOS2_SRAM_BASE 			(0xf2000000)
 #define PEGASOS2_SRAM_SIZE			(256*1024)
 
-#define PEGASOS2_SRAM_BASE_ETH0			(PEGASOS2_SRAM_BASE)
-#define PEGASOS2_SRAM_BASE_ETH1			(PEGASOS2_SRAM_BASE_ETH0 + (PEGASOS2_SRAM_SIZE / 2) )
+#define PEGASOS2_SRAM_BASE_ETH_PORT0			(PEGASOS2_SRAM_BASE)
+#define PEGASOS2_SRAM_BASE_ETH_PORT1			(PEGASOS2_SRAM_BASE_ETH_PORT0 + (PEGASOS2_SRAM_SIZE / 2) )
 
 
 #define PEGASOS2_SRAM_RXRING_SIZE		(PEGASOS2_SRAM_SIZE/4)
@@ -47,75 +47,42 @@ static struct platform_device mv643xx_eth_shared_device = {
 	.resource	= mv643xx_eth_shared_resources,
 };
 
-static struct resource mv643xx_eth0_resources[] = {
+static struct resource mv643xx_eth_port1_resources[] = {
 	[0] = {
-		.name	= "eth0 irq",
+		.name	= "eth port1 irq",
 		.start	= 9,
 		.end	= 9,
 		.flags	= IORESOURCE_IRQ,
 	},
 };
 
-
-static struct mv643xx_eth_platform_data eth0_pd = {
-	.shared		= &mv643xx_eth_shared_device,
-	.port_number	= 0,
-
-	.tx_sram_addr = PEGASOS2_SRAM_BASE_ETH0,
-	.tx_sram_size = PEGASOS2_SRAM_TXRING_SIZE,
-	.tx_queue_size = PEGASOS2_SRAM_TXRING_SIZE/16,
-
-	.rx_sram_addr = PEGASOS2_SRAM_BASE_ETH0 + PEGASOS2_SRAM_TXRING_SIZE,
-	.rx_sram_size = PEGASOS2_SRAM_RXRING_SIZE,
-	.rx_queue_size = PEGASOS2_SRAM_RXRING_SIZE/16,
-};
-
-static struct platform_device eth0_device = {
-	.name		= MV643XX_ETH_NAME,
-	.id		= 0,
-	.num_resources	= ARRAY_SIZE(mv643xx_eth0_resources),
-	.resource	= mv643xx_eth0_resources,
-	.dev = {
-		.platform_data = &eth0_pd,
-	},
-};
-
-static struct resource mv643xx_eth1_resources[] = {
-	[0] = {
-		.name	= "eth1 irq",
-		.start	= 9,
-		.end	= 9,
-		.flags	= IORESOURCE_IRQ,
-	},
-};
-
-static struct mv643xx_eth_platform_data eth1_pd = {
+static struct mv643xx_eth_platform_data eth_port1_pd = {
 	.shared		= &mv643xx_eth_shared_device,
 	.port_number	= 1,
+	.phy_addr	= MV643XX_ETH_PHY_ADDR(7),
 
-	.tx_sram_addr = PEGASOS2_SRAM_BASE_ETH1,
+	.tx_sram_addr = PEGASOS2_SRAM_BASE_ETH_PORT1,
 	.tx_sram_size = PEGASOS2_SRAM_TXRING_SIZE,
 	.tx_queue_size = PEGASOS2_SRAM_TXRING_SIZE/16,
 
-	.rx_sram_addr = PEGASOS2_SRAM_BASE_ETH1 + PEGASOS2_SRAM_TXRING_SIZE,
+	.rx_sram_addr = PEGASOS2_SRAM_BASE_ETH_PORT1 + PEGASOS2_SRAM_TXRING_SIZE,
 	.rx_sram_size = PEGASOS2_SRAM_RXRING_SIZE,
 	.rx_queue_size = PEGASOS2_SRAM_RXRING_SIZE/16,
 };
 
-static struct platform_device eth1_device = {
+static struct platform_device eth_port1_device = {
 	.name		= MV643XX_ETH_NAME,
 	.id		= 1,
-	.num_resources	= ARRAY_SIZE(mv643xx_eth1_resources),
-	.resource	= mv643xx_eth1_resources,
+	.num_resources	= ARRAY_SIZE(mv643xx_eth_port1_resources),
+	.resource	= mv643xx_eth_port1_resources,
 	.dev = {
-		.platform_data = &eth1_pd,
+		.platform_data = &eth_port1_pd,
 	},
 };
 
 static struct platform_device *mv643xx_eth_pd_devs[] __initdata = {
 	&mv643xx_eth_shared_device,
-	&eth0_device,
-	&eth1_device,
+	&eth_port1_device,
 };
 
 /***********/
@@ -191,15 +158,10 @@ static int __init mv643xx_eth_add_pds(void)
 
 		if ( Enable_SRAM() < 0)
 		{
-			eth0_pd.tx_sram_addr = 0;
-			eth0_pd.tx_sram_size = 0;
-			eth0_pd.rx_sram_addr = 0;
-			eth0_pd.rx_sram_size = 0;
-
-			eth1_pd.tx_sram_addr = 0;
-			eth1_pd.tx_sram_size = 0;
-			eth1_pd.rx_sram_addr = 0;
-			eth1_pd.rx_sram_size = 0;
+			eth_port1_pd.tx_sram_addr = 0;
+			eth_port1_pd.tx_sram_size = 0;
+			eth_port1_pd.rx_sram_addr = 0;
+			eth_port1_pd.rx_sram_size = 0;
 
 #ifdef BE_VERBOSE
 			printk("Pegasos II/Marvell MV64361: Can't enable the "
drivers/net/mv643xx_eth.c +5 -2
index 7253a49..fc8836d 100644
@@ -136,15 +136,17 @@ static char mv643xx_eth_driver_version[] = "1.4";
 /*
  * SDMA configuration register.
  */
+#define RX_BURST_SIZE_4_64BIT		(2 << 1)
 #define RX_BURST_SIZE_16_64BIT		(4 << 1)
 #define BLM_RX_NO_SWAP			(1 << 4)
 #define BLM_TX_NO_SWAP			(1 << 5)
+#define TX_BURST_SIZE_4_64BIT		(2 << 22)
 #define TX_BURST_SIZE_16_64BIT		(4 << 22)
 
 #if defined(__BIG_ENDIAN)
 #define PORT_SDMA_CONFIG_DEFAULT_VALUE		\
-		(RX_BURST_SIZE_16_64BIT	|	\
-		TX_BURST_SIZE_16_64BIT)
+		(RX_BURST_SIZE_4_64BIT	|	\
+		TX_BURST_SIZE_4_64BIT)
 #elif defined(__LITTLE_ENDIAN)
 #define PORT_SDMA_CONFIG_DEFAULT_VALUE		\
 		(RX_BURST_SIZE_16_64BIT	|	\
@@ -2210,6 +2212,7 @@ static int mv643xx_eth_stop(struct net_device *dev)
 	struct mv643xx_eth_private *mp = netdev_priv(dev);
 	int i;
 
+	wrlp(mp, INT_MASK_EXT, 0x00000000);
 	wrlp(mp, INT_MASK, 0x00000000);
 	rdlp(mp, INT_MASK);
 
Quoted 4 lines

Also, since the mv643xx_eth phylib conversion, it appears that the PHY on the Pegasos board fails to initialise properly, and this can apparently be worked around by turning the Marvell phylib driver off. Are you seeing this as well?

At least I experienced this problem. On the Pegasos, the generic PHY driver works, the Marvell specific ones screws up (at least when connected to a 100Mb/s hub, it detects it as 1Gb).

Gabriel

#7 lore raw
In reply to Lennert Buytenhek
Quoted 7 lines · Lennert Buytenhek
Quoted 4 lines · On Wed, Jan 14, 2009 at 08:22:32PM -0500, [email protected] wrote:

In 2.6.28, it behaves like 2.6.27 with a bonus bug: the port has moved to eth2, and eth1 is now a phantom port with MAC address 00:00:00:00:00:00. And the old 2.6.26 code doesn't compile so the workaround is dead.

Quoted 5 lines

This is probably because mv643xx_eth now no longer fails registration of the interface if no valid PHY could be found. Gabriel Paubert (CC'ed) had a patch for this that basically amounted to removing the initialisation for eth1 (called "eth0" in the Pegasos platform code). He's away for a couple of days but should be back soon.

Indeed, I'm back. Maybe I should have posted my patches to a mailing list, but since I did not kow which one (linuxppc or netdev), I opted for none.

In the end I have booted a Pegasos with the following patch on top of 2.6.29-rc1. Actually I have slightly amended pegasos_eth.c since my last post on Matt's request and I'm not going to be close to the machine and reboot it until Janurary 20th but it's only a few renames (and at least it builds), but buyer beware (note that the patches to drivers/net/mv643xx_eth.c have already been submitted separately by Lennert through netdev):

arch/powerpc/platforms/chrp/pegasos_eth.c +17 -55
index 130ff72..039fc8e 100644
@@ -21,8 +21,8 @@
 #define PEGASOS2_SRAM_BASE 			(0xf2000000)
 #define PEGASOS2_SRAM_SIZE			(256*1024)
 
-#define PEGASOS2_SRAM_BASE_ETH0			(PEGASOS2_SRAM_BASE)
-#define PEGASOS2_SRAM_BASE_ETH1			(PEGASOS2_SRAM_BASE_ETH0 + (PEGASOS2_SRAM_SIZE / 2) )
+#define PEGASOS2_SRAM_BASE_ETH_PORT0			(PEGASOS2_SRAM_BASE)
+#define PEGASOS2_SRAM_BASE_ETH_PORT1			(PEGASOS2_SRAM_BASE_ETH_PORT0 + (PEGASOS2_SRAM_SIZE / 2) )
 
 
 #define PEGASOS2_SRAM_RXRING_SIZE		(PEGASOS2_SRAM_SIZE/4)
@@ -47,75 +47,42 @@ static struct platform_device mv643xx_eth_shared_device = {
 	.resource	= mv643xx_eth_shared_resources,
 };
 
-static struct resource mv643xx_eth0_resources[] = {
+static struct resource mv643xx_eth_port1_resources[] = {
 	[0] = {
-		.name	= "eth0 irq",
+		.name	= "eth port1 irq",
 		.start	= 9,
 		.end	= 9,
 		.flags	= IORESOURCE_IRQ,
 	},
 };
 
-
-static struct mv643xx_eth_platform_data eth0_pd = {
-	.shared		= &mv643xx_eth_shared_device,
-	.port_number	= 0,
-
-	.tx_sram_addr = PEGASOS2_SRAM_BASE_ETH0,
-	.tx_sram_size = PEGASOS2_SRAM_TXRING_SIZE,
-	.tx_queue_size = PEGASOS2_SRAM_TXRING_SIZE/16,
-
-	.rx_sram_addr = PEGASOS2_SRAM_BASE_ETH0 + PEGASOS2_SRAM_TXRING_SIZE,
-	.rx_sram_size = PEGASOS2_SRAM_RXRING_SIZE,
-	.rx_queue_size = PEGASOS2_SRAM_RXRING_SIZE/16,
-};
-
-static struct platform_device eth0_device = {
-	.name		= MV643XX_ETH_NAME,
-	.id		= 0,
-	.num_resources	= ARRAY_SIZE(mv643xx_eth0_resources),
-	.resource	= mv643xx_eth0_resources,
-	.dev = {
-		.platform_data = &eth0_pd,
-	},
-};
-
-static struct resource mv643xx_eth1_resources[] = {
-	[0] = {
-		.name	= "eth1 irq",
-		.start	= 9,
-		.end	= 9,
-		.flags	= IORESOURCE_IRQ,
-	},
-};
-
-static struct mv643xx_eth_platform_data eth1_pd = {
+static struct mv643xx_eth_platform_data eth_port1_pd = {
 	.shared		= &mv643xx_eth_shared_device,
 	.port_number	= 1,
+	.phy_addr	= MV643XX_ETH_PHY_ADDR(7),
 
-	.tx_sram_addr = PEGASOS2_SRAM_BASE_ETH1,
+	.tx_sram_addr = PEGASOS2_SRAM_BASE_ETH_PORT1,
 	.tx_sram_size = PEGASOS2_SRAM_TXRING_SIZE,
 	.tx_queue_size = PEGASOS2_SRAM_TXRING_SIZE/16,
 
-	.rx_sram_addr = PEGASOS2_SRAM_BASE_ETH1 + PEGASOS2_SRAM_TXRING_SIZE,
+	.rx_sram_addr = PEGASOS2_SRAM_BASE_ETH_PORT1 + PEGASOS2_SRAM_TXRING_SIZE,
 	.rx_sram_size = PEGASOS2_SRAM_RXRING_SIZE,
 	.rx_queue_size = PEGASOS2_SRAM_RXRING_SIZE/16,
 };
 
-static struct platform_device eth1_device = {
+static struct platform_device eth_port1_device = {
 	.name		= MV643XX_ETH_NAME,
 	.id		= 1,
-	.num_resources	= ARRAY_SIZE(mv643xx_eth1_resources),
-	.resource	= mv643xx_eth1_resources,
+	.num_resources	= ARRAY_SIZE(mv643xx_eth_port1_resources),
+	.resource	= mv643xx_eth_port1_resources,
 	.dev = {
-		.platform_data = &eth1_pd,
+		.platform_data = &eth_port1_pd,
 	},
 };
 
 static struct platform_device *mv643xx_eth_pd_devs[] __initdata = {
 	&mv643xx_eth_shared_device,
-	&eth0_device,
-	&eth1_device,
+	&eth_port1_device,
 };
 
 /***********/
@@ -191,15 +158,10 @@ static int __init mv643xx_eth_add_pds(void)
 
 		if ( Enable_SRAM() < 0)
 		{
-			eth0_pd.tx_sram_addr = 0;
-			eth0_pd.tx_sram_size = 0;
-			eth0_pd.rx_sram_addr = 0;
-			eth0_pd.rx_sram_size = 0;
-
-			eth1_pd.tx_sram_addr = 0;
-			eth1_pd.tx_sram_size = 0;
-			eth1_pd.rx_sram_addr = 0;
-			eth1_pd.rx_sram_size = 0;
+			eth_port1_pd.tx_sram_addr = 0;
+			eth_port1_pd.tx_sram_size = 0;
+			eth_port1_pd.rx_sram_addr = 0;
+			eth_port1_pd.rx_sram_size = 0;
 
 #ifdef BE_VERBOSE
 			printk("Pegasos II/Marvell MV64361: Can't enable the "
drivers/net/mv643xx_eth.c +5 -2
index 7253a49..fc8836d 100644
@@ -136,15 +136,17 @@ static char mv643xx_eth_driver_version[] = "1.4";
 /*
  * SDMA configuration register.
  */
+#define RX_BURST_SIZE_4_64BIT		(2 << 1)
 #define RX_BURST_SIZE_16_64BIT		(4 << 1)
 #define BLM_RX_NO_SWAP			(1 << 4)
 #define BLM_TX_NO_SWAP			(1 << 5)
+#define TX_BURST_SIZE_4_64BIT		(2 << 22)
 #define TX_BURST_SIZE_16_64BIT		(4 << 22)
 
 #if defined(__BIG_ENDIAN)
 #define PORT_SDMA_CONFIG_DEFAULT_VALUE		\
-		(RX_BURST_SIZE_16_64BIT	|	\
-		TX_BURST_SIZE_16_64BIT)
+		(RX_BURST_SIZE_4_64BIT	|	\
+		TX_BURST_SIZE_4_64BIT)
 #elif defined(__LITTLE_ENDIAN)
 #define PORT_SDMA_CONFIG_DEFAULT_VALUE		\
 		(RX_BURST_SIZE_16_64BIT	|	\
@@ -2210,6 +2212,7 @@ static int mv643xx_eth_stop(struct net_device *dev)
 	struct mv643xx_eth_private *mp = netdev_priv(dev);
 	int i;
 
+	wrlp(mp, INT_MASK_EXT, 0x00000000);
 	wrlp(mp, INT_MASK, 0x00000000);
 	rdlp(mp, INT_MASK);
 
Quoted 4 lines

Also, since the mv643xx_eth phylib conversion, it appears that the PHY on the Pegasos board fails to initialise properly, and this can apparently be worked around by turning the Marvell phylib driver off. Are you seeing this as well?

At least I experienced this problem. On the Pegasos, the generic PHY driver works, the Marvell specific ones screws up (at least when connected to a 100Mb/s hub, it detects it as 1Gb).

Gabriel

#8 lore raw
In reply to Lennert Buytenhek
Quoted 7 lines · Lennert Buytenhek
Quoted 4 lines · On Wed, Jan 14, 2009 at 08:22:32PM -0500, [email protected] wrote:

In 2.6.28, it behaves like 2.6.27 with a bonus bug: the port has moved to eth2, and eth1 is now a phantom port with MAC address 00:00:00:00:00:00. And the old 2.6.26 code doesn't compile so the workaround is dead.

Quoted 5 lines

This is probably because mv643xx_eth now no longer fails registration of the interface if no valid PHY could be found. Gabriel Paubert (CC'ed) had a patch for this that basically amounted to removing the initialisation for eth1 (called "eth0" in the Pegasos platform code). He's away for a couple of days but should be back soon.

Indeed, I'm back. Maybe I should have posted my patches to a mailing list, but since I did not kow which one (linuxppc or netdev), I opted for none.

In the end I have booted a Pegasos with the following patch on top of 2.6.29-rc1. Actually I have slightly amended pegasos_eth.c since my last post on Matt's request and I'm not going to be close to the machine and reboot it until Janurary 20th but it's only a few renames (and at least it builds), but buyer beware (note that the patches to drivers/net/mv643xx_eth.c have already been submitted separately by Lennert through netdev):

arch/powerpc/platforms/chrp/pegasos_eth.c +17 -55
index 130ff72..039fc8e 100644
@@ -21,8 +21,8 @@
 #define PEGASOS2_SRAM_BASE 			(0xf2000000)
 #define PEGASOS2_SRAM_SIZE			(256*1024)
 
-#define PEGASOS2_SRAM_BASE_ETH0			(PEGASOS2_SRAM_BASE)
-#define PEGASOS2_SRAM_BASE_ETH1			(PEGASOS2_SRAM_BASE_ETH0 + (PEGASOS2_SRAM_SIZE / 2) )
+#define PEGASOS2_SRAM_BASE_ETH_PORT0			(PEGASOS2_SRAM_BASE)
+#define PEGASOS2_SRAM_BASE_ETH_PORT1			(PEGASOS2_SRAM_BASE_ETH_PORT0 + (PEGASOS2_SRAM_SIZE / 2) )
 
 
 #define PEGASOS2_SRAM_RXRING_SIZE		(PEGASOS2_SRAM_SIZE/4)
@@ -47,75 +47,42 @@ static struct platform_device mv643xx_eth_shared_device = {
 	.resource	= mv643xx_eth_shared_resources,
 };
 
-static struct resource mv643xx_eth0_resources[] = {
+static struct resource mv643xx_eth_port1_resources[] = {
 	[0] = {
-		.name	= "eth0 irq",
+		.name	= "eth port1 irq",
 		.start	= 9,
 		.end	= 9,
 		.flags	= IORESOURCE_IRQ,
 	},
 };
 
-
-static struct mv643xx_eth_platform_data eth0_pd = {
-	.shared		= &mv643xx_eth_shared_device,
-	.port_number	= 0,
-
-	.tx_sram_addr = PEGASOS2_SRAM_BASE_ETH0,
-	.tx_sram_size = PEGASOS2_SRAM_TXRING_SIZE,
-	.tx_queue_size = PEGASOS2_SRAM_TXRING_SIZE/16,
-
-	.rx_sram_addr = PEGASOS2_SRAM_BASE_ETH0 + PEGASOS2_SRAM_TXRING_SIZE,
-	.rx_sram_size = PEGASOS2_SRAM_RXRING_SIZE,
-	.rx_queue_size = PEGASOS2_SRAM_RXRING_SIZE/16,
-};
-
-static struct platform_device eth0_device = {
-	.name		= MV643XX_ETH_NAME,
-	.id		= 0,
-	.num_resources	= ARRAY_SIZE(mv643xx_eth0_resources),
-	.resource	= mv643xx_eth0_resources,
-	.dev = {
-		.platform_data = &eth0_pd,
-	},
-};
-
-static struct resource mv643xx_eth1_resources[] = {
-	[0] = {
-		.name	= "eth1 irq",
-		.start	= 9,
-		.end	= 9,
-		.flags	= IORESOURCE_IRQ,
-	},
-};
-
-static struct mv643xx_eth_platform_data eth1_pd = {
+static struct mv643xx_eth_platform_data eth_port1_pd = {
 	.shared		= &mv643xx_eth_shared_device,
 	.port_number	= 1,
+	.phy_addr	= MV643XX_ETH_PHY_ADDR(7),
 
-	.tx_sram_addr = PEGASOS2_SRAM_BASE_ETH1,
+	.tx_sram_addr = PEGASOS2_SRAM_BASE_ETH_PORT1,
 	.tx_sram_size = PEGASOS2_SRAM_TXRING_SIZE,
 	.tx_queue_size = PEGASOS2_SRAM_TXRING_SIZE/16,
 
-	.rx_sram_addr = PEGASOS2_SRAM_BASE_ETH1 + PEGASOS2_SRAM_TXRING_SIZE,
+	.rx_sram_addr = PEGASOS2_SRAM_BASE_ETH_PORT1 + PEGASOS2_SRAM_TXRING_SIZE,
 	.rx_sram_size = PEGASOS2_SRAM_RXRING_SIZE,
 	.rx_queue_size = PEGASOS2_SRAM_RXRING_SIZE/16,
 };
 
-static struct platform_device eth1_device = {
+static struct platform_device eth_port1_device = {
 	.name		= MV643XX_ETH_NAME,
 	.id		= 1,
-	.num_resources	= ARRAY_SIZE(mv643xx_eth1_resources),
-	.resource	= mv643xx_eth1_resources,
+	.num_resources	= ARRAY_SIZE(mv643xx_eth_port1_resources),
+	.resource	= mv643xx_eth_port1_resources,
 	.dev = {
-		.platform_data = &eth1_pd,
+		.platform_data = &eth_port1_pd,
 	},
 };
 
 static struct platform_device *mv643xx_eth_pd_devs[] __initdata = {
 	&mv643xx_eth_shared_device,
-	&eth0_device,
-	&eth1_device,
+	&eth_port1_device,
 };
 
 /***********/
@@ -191,15 +158,10 @@ static int __init mv643xx_eth_add_pds(void)
 
 		if ( Enable_SRAM() < 0)
 		{
-			eth0_pd.tx_sram_addr = 0;
-			eth0_pd.tx_sram_size = 0;
-			eth0_pd.rx_sram_addr = 0;
-			eth0_pd.rx_sram_size = 0;
-
-			eth1_pd.tx_sram_addr = 0;
-			eth1_pd.tx_sram_size = 0;
-			eth1_pd.rx_sram_addr = 0;
-			eth1_pd.rx_sram_size = 0;
+			eth_port1_pd.tx_sram_addr = 0;
+			eth_port1_pd.tx_sram_size = 0;
+			eth_port1_pd.rx_sram_addr = 0;
+			eth_port1_pd.rx_sram_size = 0;
 
 #ifdef BE_VERBOSE
 			printk("Pegasos II/Marvell MV64361: Can't enable the "
drivers/net/mv643xx_eth.c +5 -2
index 7253a49..fc8836d 100644
@@ -136,15 +136,17 @@ static char mv643xx_eth_driver_version[] = "1.4";
 /*
  * SDMA configuration register.
  */
+#define RX_BURST_SIZE_4_64BIT		(2 << 1)
 #define RX_BURST_SIZE_16_64BIT		(4 << 1)
 #define BLM_RX_NO_SWAP			(1 << 4)
 #define BLM_TX_NO_SWAP			(1 << 5)
+#define TX_BURST_SIZE_4_64BIT		(2 << 22)
 #define TX_BURST_SIZE_16_64BIT		(4 << 22)
 
 #if defined(__BIG_ENDIAN)
 #define PORT_SDMA_CONFIG_DEFAULT_VALUE		\
-		(RX_BURST_SIZE_16_64BIT	|	\
-		TX_BURST_SIZE_16_64BIT)
+		(RX_BURST_SIZE_4_64BIT	|	\
+		TX_BURST_SIZE_4_64BIT)
 #elif defined(__LITTLE_ENDIAN)
 #define PORT_SDMA_CONFIG_DEFAULT_VALUE		\
 		(RX_BURST_SIZE_16_64BIT	|	\
@@ -2210,6 +2212,7 @@ static int mv643xx_eth_stop(struct net_device *dev)
 	struct mv643xx_eth_private *mp = netdev_priv(dev);
 	int i;
 
+	wrlp(mp, INT_MASK_EXT, 0x00000000);
 	wrlp(mp, INT_MASK, 0x00000000);
 	rdlp(mp, INT_MASK);
 
Quoted 4 lines

Also, since the mv643xx_eth phylib conversion, it appears that the PHY on the Pegasos board fails to initialise properly, and this can apparently be worked around by turning the Marvell phylib driver off. Are you seeing this as well?

At least I experienced this problem. On the Pegasos, the generic PHY driver works, the Marvell specific ones screws up (at least when connected to a 100Mb/s hub, it detects it as 1Gb).

Gabriel