From 3d9986a3b87294d500b9390d214f4d950244762f Mon Sep 17 00:00:00 2001 From: Magnus Damm Date: Mon, 27 Apr 2009 21:32:16 +0000 Subject: [PATCH] --- yaml --- r: 150040 b: refs/heads/master c: 833cc67c7722e35863c6aaee9df56b442ef957ae h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/net/smsc911x.c | 13 +++++++++++++ trunk/include/linux/smsc911x.h | 10 ++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index e0b78d8b3b23..83328b20179e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 52fbc1007eb071c40a367462476eee695b412578 +refs/heads/master: 833cc67c7722e35863c6aaee9df56b442ef957ae diff --git a/trunk/drivers/net/smsc911x.c b/trunk/drivers/net/smsc911x.c index eb7db032a780..5113b26fc2d9 100644 --- a/trunk/drivers/net/smsc911x.c +++ b/trunk/drivers/net/smsc911x.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include "smsc911x.h" @@ -175,6 +176,12 @@ static inline void smsc911x_tx_writefifo(struct smsc911x_data *pdata, unsigned int *buf, unsigned int wordcount) { + if (pdata->config.flags & SMSC911X_SWAP_FIFO) { + while (wordcount--) + smsc911x_reg_write(pdata, TX_DATA_FIFO, swab32(*buf++)); + return; + } + if (pdata->config.flags & SMSC911X_USE_32BIT) { writesl(pdata->ioaddr + TX_DATA_FIFO, buf, wordcount); return; @@ -194,6 +201,12 @@ static inline void smsc911x_rx_readfifo(struct smsc911x_data *pdata, unsigned int *buf, unsigned int wordcount) { + if (pdata->config.flags & SMSC911X_SWAP_FIFO) { + while (wordcount--) + *buf++ = swab32(smsc911x_reg_read(pdata, RX_DATA_FIFO)); + return; + } + if (pdata->config.flags & SMSC911X_USE_32BIT) { readsl(pdata->ioaddr + RX_DATA_FIFO, buf, wordcount); return; diff --git a/trunk/include/linux/smsc911x.h b/trunk/include/linux/smsc911x.h index b32725075d71..5241e4fb4eca 100644 --- a/trunk/include/linux/smsc911x.h +++ b/trunk/include/linux/smsc911x.h @@ -47,4 +47,14 @@ struct smsc911x_platform_config { #define SMSC911X_FORCE_EXTERNAL_PHY (BIT(3)) #define SMSC911X_SAVE_MAC_ADDRESS (BIT(4)) +/* + * SMSC911X_SWAP_FIFO: + * Enables software byte swap for fifo data. Should only be used as a + * "last resort" in the case of big endian mode on boards with incorrectly + * routed data bus to older devices such as LAN9118. Newer devices such as + * LAN9221 can handle this in hardware, there are registers to control + * this swapping but the driver doesn't currently use them. + */ +#define SMSC911X_SWAP_FIFO (BIT(5)) + #endif /* __LINUX_SMSC911X_H__ */