Skip to contentSkip to conversation

net: Add mii_resolve_flowctrl_fdx()

PATCH In review yuiko.oshino at microchip.com 2 participants 5 messages Aug 11, 2017 – Aug 14, 2017

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

PATCH v4 1/2 net: Add mii_resolve_flowctrl_fdx()

From: Yuiko Oshino <[email protected]>

Add support for Microchip LAN7500, LAN7800 and LAN7850, USB to 10/100/1000 Ethernet Controllers.

---

Changes in v4:
- none.

Changes in v3:
- This patch is added to a series.

Changes in v2:
- The patch's tag is changed to net:.

 include/linux/mii.h | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
include/linux/mii.h +23 -0
index 66b83d8..19afb74 100644
@@ -190,4 +190,27 @@ static inline unsigned int mii_duplex (unsigned int duplex_lock,
 	return 0;
 }
 
+/**
+ * mii_resolve_flowctrl_fdx
+ * @lcladv: value of MII ADVERTISE register
+ * @rmtadv: value of MII LPA register
+ *
+ * Resolve full duplex flow control as per IEEE 802.3-2005 table 28B-3
+ */
+static inline u8 mii_resolve_flowctrl_fdx(u16 lcladv, u16 rmtadv)
+{
+	u8 cap = 0;
+
+	if (lcladv & rmtadv & ADVERTISE_PAUSE_CAP) {
+		cap = FLOW_CTRL_TX | FLOW_CTRL_RX;
+	} else if (lcladv & rmtadv & ADVERTISE_PAUSE_ASYM) {
+		if (lcladv & ADVERTISE_PAUSE_CAP)
+			cap = FLOW_CTRL_RX;
+		else if (rmtadv & ADVERTISE_PAUSE_CAP)
+			cap = FLOW_CTRL_TX;
+	}
+
+	return cap;
+}
+
 #endif /* __LINUX_MII_H__ */
Signature · 1 line
2.7.4
#1 lore raw

PATCH v4 2/2 usb: net: Add support for Microchip LAN75xx and LAN78xx

From: Yuiko Oshino <[email protected]>

Add support for Microchip LAN7500, LAN7800 and LAN7850, USB to 10/100/1000 Ethernet Controllers.

---

Changes in v4:
- Delete lan75xx_read_mac() becasue it is just a wrapper.
- Add debug print the USB device number and ther port number of the device in lan7x_basic_reset().
- Add the USB device number and ther port number to the mdiobus->name so that multiple devices can register the PHY with a non-unique name.

Changes in v3:
- All #ifdef CONFIG_DM_ETH and #endif are removed.
- The lan7x_eth_recv() is modifed to correctly support the Driver Model and returns packet_en.
- Add mii_resolve_flowctrl_fdx() patch in the series.

Changes in v2:
- The wait_for_bit functions copy the real one.
- Uses phylib
- Unnecessary variables are removed
- All return values are checked
- Uses mii_resolve_flowctrl_fdx() from linux/mii.h

 drivers/usb/Kconfig       |   2 +
 drivers/usb/eth/Kconfig   |  17 ++
 drivers/usb/eth/Makefile  |   2 +
 drivers/usb/eth/lan75xx.c | 315 +++++++++++++++++++++++++++++
 drivers/usb/eth/lan78xx.c | 477 ++++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/eth/lan7x.c   | 499 ++++++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/eth/lan7x.h   | 230 +++++++++++++++++++++
 7 files changed, 1542 insertions(+)
 create mode 100644 drivers/usb/eth/Kconfig
 create mode 100644 drivers/usb/eth/lan75xx.c
 create mode 100644 drivers/usb/eth/lan78xx.c
 create mode 100644 drivers/usb/eth/lan7x.c
 create mode 100644 drivers/usb/eth/lan7x.h
drivers/usb/Kconfig +2 -0
index da3ec2f..62126aa 100644
@@ -94,4 +94,6 @@ endif
 
 source "drivers/usb/gadget/Kconfig"
 
+source "drivers/usb/eth/Kconfig"
+
 endif
drivers/usb/eth/Kconfig new file +17 -0
new file mode 100644
index 0000000..14cfa26
@@ -0,0 +1,17 @@
+comment "USB to Ethernet Controller Drivers"
+
+config USB_ETHER_LAN75XX
+	bool "Microchip LAN75XX support"
+	---help---
+	  Say Y here if you would like to support Microchip LAN75XX Hi-Speed
+	  USB 2.0 to 10/100/1000 Gigabit Ethernet controller.
+	  Supports 10Base-T/ 100Base-TX/1000Base-T.
+	  This driver supports the internal PHY.
+
+config USB_ETHER_LAN78XX
+	bool "Microchip LAN78XX support"
+	---help---
+	  Say Y here if you would like to support Microchip LAN78XX USB 3.1
+	  Gen 1 to 10/100/1000 Gigabit Ethernet controller.
+	  Supports 10Base-T/ 100Base-TX/1000Base-T.
+	  This driver supports the internal PHY.
drivers/usb/eth/Makefile +2 -0
index 4c44efc..4b935a3 100644
@@ -9,4 +9,6 @@ obj-$(CONFIG_USB_ETHER_ASIX) += asix.o
 obj-$(CONFIG_USB_ETHER_ASIX88179) += asix88179.o
 obj-$(CONFIG_USB_ETHER_MCS7830) += mcs7830.o
 obj-$(CONFIG_USB_ETHER_SMSC95XX) += smsc95xx.o
+obj-$(CONFIG_USB_ETHER_LAN75XX) += lan7x.o lan75xx.o
+obj-$(CONFIG_USB_ETHER_LAN78XX) += lan7x.o lan78xx.o
 obj-$(CONFIG_USB_ETHER_RTL8152) += r8152.o r8152_fw.o
drivers/usb/eth/lan75xx.c new file +315 -0

315 lines not on this page · raw message

drivers/usb/eth/lan78xx.c new file +477 -0

477 lines not on this page · raw message

drivers/usb/eth/lan7x.c new file +499 -0

499 lines not on this page · raw message

drivers/usb/eth/lan7x.h new file +230 -0

230 lines not on this page · raw message

Signature · 1 line
2.7.4