Skip to contentSkip to conversation

mv643xx_eth: get rid of static variables, allow multiple instances

PATCH New Lennert Buytenhek 1 participant 1 message Mar 19, 2008

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

PATCH 1/4 mv643xx_eth: get rid of static variables, allow multiple instances

Move mv643xx_eth's static state (ethernet register block base address and MII management interface spinlock) into a struct hanging off the shared platform device. This is necessary to support chips that contain multiple mv643xx_eth silicon blocks.

arch/powerpc/platforms/chrp/pegasos_eth.c +4 -0
Index: linux-2.6.25-rc6/arch/powerpc/platforms/chrp/pegasos_eth.c
===================================================================
@@ -58,7 +58,9 @@ static struct resource mv643xx_eth0_reso
 
 
 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,
@@ -88,7 +90,9 @@ static struct resource mv643xx_eth1_reso
 };
 
 static struct mv643xx_eth_platform_data eth1_pd = {
+	.shared		= &mv643xx_eth_shared_device,
 	.port_number	= 1,
+
 	.tx_sram_addr = PEGASOS2_SRAM_BASE_ETH1,
 	.tx_sram_size = PEGASOS2_SRAM_TXRING_SIZE,
 	.tx_queue_size = PEGASOS2_SRAM_TXRING_SIZE/16,
arch/powerpc/sysdev/mv64x60_dev.c +41 -13

92 lines not on this page · raw message

arch/ppc/syslib/mv64x60.c +3 -0
Index: linux-2.6.25-rc6/arch/ppc/syslib/mv64x60.c
===================================================================
@@ -341,6 +341,7 @@ static struct resource mv64x60_eth0_reso
 };
 
 static struct mv643xx_eth_platform_data eth0_pd = {
+	.shared		= &mv64x60_eth_shared_device;
 	.port_number	= 0,
 };
 
@@ -366,6 +367,7 @@ static struct resource mv64x60_eth1_reso
 };
 
 static struct mv643xx_eth_platform_data eth1_pd = {
+	.shared		= &mv64x60_eth_shared_device;
 	.port_number	= 1,
 };
 
@@ -391,6 +393,7 @@ static struct resource mv64x60_eth2_reso
 };
 
 static struct mv643xx_eth_platform_data eth2_pd = {
+	.shared		= &mv64x60_eth_shared_device;
 	.port_number	= 2,
 };
 
drivers/net/mv643xx_eth.c +45 -17

138 lines not on this page · raw message

include/linux/mv643xx_eth.h +3 -0
Index: linux-2.6.25-rc6/include/linux/mv643xx_eth.h
===================================================================
@@ -1,6 +1,7 @@
 /*
  * MV-643XX ethernet platform device data definition file.
  */
+
 #ifndef __LINUX_MV643XX_ETH_H
 #define __LINUX_MV643XX_ETH_H
 
@@ -13,7 +14,9 @@
 #define MV643XX_ETH_BASE_ADDR_ENABLE_REG	0x2290
 
 struct mv643xx_eth_platform_data {
+	struct platform_device	*shared;
 	int		port_number;
+
 	u16		force_phy_addr;	/* force override if phy_addr == 0 */
 	u16		phy_addr;
 

----