Skip to contentSkip to conversation

SMSC LAN911x and LAN921x vendor driver

PATCH In review Steve Glendinning 3 participants 7 messages Jul 16, 2007 – Aug 7, 2007

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

PATCH 1/1 SMSC LAN911x and LAN921x vendor driver

Attached is a driver for SMSC's LAN911x and LAN921x families of embedded ethernet controllers.

There is an existing smc911x driver in the tree; this is intended to replace it. Dustin McIntire (the author of the smc911x driver) has expressed his support for switching to this driver.

This driver contains workarounds for all known hardware issues, and has been tested on all flavours of the chip on multiple architectures.

---
 drivers/net/Kconfig    |   13 +
 drivers/net/Makefile   |    1 +
 drivers/net/smsc911x.c | 2173 ++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/net/smsc911x.h |  385 +++++++++
 4 files changed, 2572 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/smsc911x.c
 create mode 100644 drivers/net/smsc911x.h
drivers/net/Kconfig +13 -0
index 713ab05..048ce55 100644
@@ -883,6 +883,19 @@ config NET_NETX
 	  <file:Documentation/networking/net-modules.txt>. The module
 	  will be called netx-eth.
 
+config SMSC911X
+	tristate "SMSC LAN911x/LAN921x families embedded ethernet support"
+	depends on NET_ETHERNET
+	select CRC32
+	select MII
+	---help---
+	  Say Y here if you want support for SMSC LAN911x and LAN921x families
+	  of ethernet controllers.
+
+	  To compile this driver as a module, choose M here and read
+	  <file:Documentation/networking/net-modules.txt>. The module
+	  will be called smsc911x.
+
 config DM9000
 	tristate "DM9000 support"
 	depends on ARM || BLACKFIN || MIPS
drivers/net/Makefile +1 -0
index eb41676..44008e7 100644
@@ -198,6 +198,7 @@ obj-$(CONFIG_S2IO) += s2io.o
 obj-$(CONFIG_MYRI10GE) += myri10ge/
 obj-$(CONFIG_SMC91X) += smc91x.o
 obj-$(CONFIG_SMC911X) += smc911x.o
+obj-$(CONFIG_SMSC911X) += smsc911x.o
 obj-$(CONFIG_DM9000) += dm9000.o
 obj-$(CONFIG_FEC_8XX) += fec_8xx/
 obj-$(CONFIG_PASEMI_MAC) += pasemi_mac.o
drivers/net/smsc911x.c new file +2173 -0

2,173 lines not on this page · raw message

drivers/net/smsc911x.h new file +385 -0

385 lines not on this page · raw message

Signature · 1 line
1.5.2.2
#1 lore raw

Where is the hard_start_xmit/TX-completion locking?

#2 lore raw

Hi Jeff,

Quoted 1 line

Where is the hard_start_xmit/TX-completion locking?

The entire PIO Tx operation is performed within hard_start_xmit, so should be covered by netif_tx_lock.

Regards,
--
Steve Glendinning
SMSC GmbH
m: +44 777 933 9124
e: [email protected]

#3 lore raw
In reply to Steve Glendinning
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Steve" == Steve Glendinning <[email protected]> writes:

Hi,

Steve> Attached is a driver for SMSC's LAN911x and LAN921x families Steve> of embedded ethernet controllers.

Steve> There is an existing smc911x driver in the tree; this is intended to Steve> replace it. Dustin McIntire (the author of the smc911x driver) has Steve> expressed his support for switching to this driver.

What's the problem with Dustin's driver? It seems to work fine here with a lan9117. Why not just add lan921x support to the existing driver?

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

Hi Peter,

Quoted 3 lines

What's the problem with Dustin's driver? It seems to work fine here with a lan9117. Why not just add lan921x support to the existing driver?

I have heard Dustin's driver works very well on PXA, but on others it doesn't even compile (hence why it depends on ARCH_PXA).

Dustin's driver was based on the smc91x code, but these two ethernet devices share nothing other than a similar name. smsc911x is a new, completely platform-independent driver with workarounds for several hardware issues, and it doesn't suffer from quite as much macro abuse :-)

Regards,
--
Steve Glendinning
SMSC GmbH
m: +44 777 933 9124
e: [email protected]

#5 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Steve" == Steve Glendinning <[email protected]> writes:

Hi,

Quoted 3 lines
Quoted 3 lines

What's the problem with Dustin's driver? It seems to work fine here with a lan9117. Why not just add lan921x support to the existing driver?

Steve> I have heard Dustin's driver works very well on PXA, but on Steve> others it doesn't even compile (hence why it depends on Steve> ARCH_PXA).

I'm using it on PPC.

Steve> Dustin's driver was based on the smc91x code, but these two Steve> ethernet devices share nothing other than a similar name. Steve> smsc911x is a new, completely platform-independent driver with Steve> workarounds for several hardware issues, and it doesn't suffer Steve> from quite as much macro abuse :-)

The macros are not that bad as the hw people sligtly misconnected the chip, so I need special access routines (enable the big endian mode, not byteswap on normal registar access and byteswap on fifo access).

I'll give your driver a try and report back.

Signature · 1 line
Bye, Peter Korsgaard
#6 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Korsgaard <[email protected]> writes:

Hi,

Peter> I'll give your driver a try and report back.

Ok, the driver seems to be working (after fixing up the accessor routines for my hw setup) and performance is comparable to Dustin's driver.

It would be nice if the driver would enable the byte swapping support in the hw if it detects the wrong endian - Like this:

drivers/net/smsc911x.c +7 -0
Index: linux/drivers/net/smsc911x.c
===================================================================
@@ -1787,6 +1787,13 @@
 		return -ENODEV;
 	}
 
+	/* check endian */
+	if (smsc911x_reg_read(pdata, BYTE_TEST) == 0x43218765) {
+		SMSC_TRACE("Byte test looks swapped, inverting");
+		smsc911x_reg_write(~smsc911x_reg_read(pdata, ENDIAN),
+				   pdata, ENDIAN);
+	}
+
 	/* Default generation to zero (all workarounds apply) */
 	pdata->generation = 0;
 
Signature · 1 line
Bye, Peter Korsgaard