Skip to contentSkip to conversation

net: w5100: support W5500

PATCH Applied Akinobu Mita 2 participants 2 messages Apr 26, 2016 – Apr 27, 2016

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

PATCH 1/1 net: w5100: support W5500

This adds support for W5500 chip.

W5500 has similar register and memory organization with W5100 and W5200. There are a few important differences listed below but it is still possible to share common code with W5100 and W5200.

* W5500 register and memory are organized by multiple blocks. Each one is selected by 16bits offset address and 5bits block select bits.

But the existing register access operations take u16 address. This change extends the addess by u32 address and put offset address to lower 16bits and block select bits to upper 16bits.

This change also adds the offset addresses for socket register and TX/RX memory blocks to the driver private data structure in order to reduce conditional switches for each chip.

* W5500 has the different register offset for socket interrupt mask register. Newly added internal functions w5100_enable_intr() and w5100_disable_intr() take care of the diffrence.

* W5500 has the different register offset for retry time-value register. But this register is only used to verify that the reset value is correctly read at initialization. So move the verification to w5100_hw_reset() which already does different things for different chips.

Cc Mike Sinkovsky <[email protected]>
Cc David S. Miller <[email protected]>
---
 drivers/net/ethernet/wiznet/Kconfig     |   2 +-
 drivers/net/ethernet/wiznet/w5100-spi.c | 192 +++++++++++++++++++++++--
 drivers/net/ethernet/wiznet/w5100.c     | 243 +++++++++++++++++++++++---------
 drivers/net/ethernet/wiznet/w5100.h     |  13 +-
 4 files changed, 365 insertions(+), 85 deletions(-)
drivers/net/ethernet/wiznet/Kconfig +1 -1
index f3385a1..1981e88c 100644
@@ -70,7 +70,7 @@ config WIZNET_BUS_ANY
 endchoice
 
 config WIZNET_W5100_SPI
-	tristate "WIZnet W5100/W5200 Ethernet support for SPI mode"
+	tristate "WIZnet W5100/W5200/W5500 Ethernet support for SPI mode"
 	depends on WIZNET_BUS_ANY && WIZNET_W5100
 	depends on SPI
 	---help---
drivers/net/ethernet/wiznet/w5100-spi.c +178 -14

297 lines not on this page · raw message

drivers/net/ethernet/wiznet/w5100.c +179 -64

518 lines not on this page · raw message

drivers/net/ethernet/wiznet/w5100.h +7 -6
index 9b1fa23..f8a16fa 100644
@@ -10,17 +10,18 @@
 enum {
 	W5100,
 	W5200,
+	W5500,
 };
 
 struct w5100_ops {
 	bool may_sleep;
 	int chip_id;
-	int (*read)(struct net_device *ndev, u16 addr);
-	int (*write)(struct net_device *ndev, u16 addr, u8 data);
-	int (*read16)(struct net_device *ndev, u16 addr);
-	int (*write16)(struct net_device *ndev, u16 addr, u16 data);
-	int (*readbulk)(struct net_device *ndev, u16 addr, u8 *buf, int len);
-	int (*writebulk)(struct net_device *ndev, u16 addr, const u8 *buf,
+	int (*read)(struct net_device *ndev, u32 addr);
+	int (*write)(struct net_device *ndev, u32 addr, u8 data);
+	int (*read16)(struct net_device *ndev, u32 addr);
+	int (*write16)(struct net_device *ndev, u32 addr, u16 data);
+	int (*readbulk)(struct net_device *ndev, u32 addr, u8 *buf, int len);
+	int (*writebulk)(struct net_device *ndev, u32 addr, const u8 *buf,
 			 int len);
 	int (*reset)(struct net_device *ndev);
 	int (*init)(struct net_device *ndev);
Signature · 1 line
2.5.0
maintainer Applied
#1 lore raw

From: Akinobu Mita <[email protected]>
Date: Wed, 27 Apr 2016 05:43:48 +0900

Quoted 1 line

This adds support for W5500 chip.

Applied, thanks.