|
|
@@ -18,11 +18,13 @@ Signed-off-by: Álvaro Fernández Rojas <[email protected]>
|
|
|
|
|
|
--- a/src/r8126.h
|
|
|
+++ b/src/r8126.h
|
|
|
-@@ -1740,6 +1740,8 @@ enum RTL8126_register_content {
|
|
|
+@@ -1756,6 +1756,10 @@ enum RTL8126_register_content {
|
|
|
LinkStatus = 0x02,
|
|
|
FullDup = 0x01,
|
|
|
|
|
|
+#define RTL8126_FULL_DUPLEX_MASK (_5000bpsF | _2500bpsF | _1000bpsF | FullDup)
|
|
|
++#define RTL8126_SPEED_1000_MASK (_1000bpsF | _1000bpsL | _2500bpsL)
|
|
|
++#define RTL8126_SPEED_2500_MASK (_2500bpsF | _5000bpsL)
|
|
|
+
|
|
|
/* DBG_reg */
|
|
|
Fix_Nak_1 = (1 << 4),
|
|
|
@@ -37,11 +39,11 @@ Signed-off-by: Álvaro Fernández Rojas <[email protected]>
|
|
|
#include <linux/netdevice.h>
|
|
|
#include <linux/etherdevice.h>
|
|
|
#include <linux/delay.h>
|
|
|
-@@ -4744,6 +4745,40 @@ rtl8126_link_down_patch(struct net_devic
|
|
|
+@@ -4661,6 +4662,40 @@ rtl8126_link_down_patch(struct net_devic
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
-+static unsigned int rtl8126_phy_duplex(u16 status)
|
|
|
++static unsigned int rtl8126_phy_duplex(u32 status)
|
|
|
+{
|
|
|
+ unsigned int duplex = DUPLEX_UNKNOWN;
|
|
|
+
|
|
|
@@ -55,16 +57,16 @@ Signed-off-by: Álvaro Fernández Rojas <[email protected]>
|
|
|
+ return duplex;
|
|
|
+}
|
|
|
+
|
|
|
-+static int rtl8126_phy_speed(u16 status)
|
|
|
++static int rtl8126_phy_speed(u32 status)
|
|
|
+{
|
|
|
+ int speed = SPEED_UNKNOWN;
|
|
|
+
|
|
|
+ if (status & LinkStatus) {
|
|
|
+ if (status & _5000bpsF)
|
|
|
+ speed = SPEED_5000;
|
|
|
-+ else if (status & _2500bpsF)
|
|
|
++ else if (status & RTL8126_SPEED_2500_MASK)
|
|
|
+ speed = SPEED_2500;
|
|
|
-+ else if (status & _1000bpsF)
|
|
|
++ else if (status & RTL8126_SPEED_1000_MASK)
|
|
|
+ speed = SPEED_1000;
|
|
|
+ else if (status & _100bps)
|
|
|
+ speed = SPEED_100;
|
|
|
@@ -78,14 +80,14 @@ Signed-off-by: Álvaro Fernández Rojas <[email protected]>
|
|
|
static void
|
|
|
_rtl8126_check_link_status(struct net_device *dev, unsigned int link_state)
|
|
|
{
|
|
|
-@@ -4756,11 +4791,18 @@ _rtl8126_check_link_status(struct net_de
|
|
|
+@@ -4673,11 +4708,18 @@ _rtl8126_check_link_status(struct net_de
|
|
|
if (link_state == R8126_LINK_STATE_ON) {
|
|
|
rtl8126_link_on_patch(dev);
|
|
|
|
|
|
- if (netif_msg_ifup(tp))
|
|
|
- printk(KERN_INFO PFX "%s: link up\n", dev->name);
|
|
|
+ if (netif_msg_ifup(tp)) {
|
|
|
-+ const u16 phy_status = RTL_R16(tp, PHYstatus);
|
|
|
++ const u32 phy_status = RTL_R32(tp, PHYstatus);
|
|
|
+ const unsigned int phy_duplex = rtl8126_phy_duplex(phy_status);
|
|
|
+ const int phy_speed = rtl8126_phy_speed(phy_status);
|
|
|
+ printk(KERN_INFO PFX "%s: Link is Up - %s/%s\n",
|