Skip to contentSkip to conversation

r8152: Add support for MAC address pass through on RTL8153-BD

PATCH In review David Chen 2 participants 3 messages Feb 18, 2019 – Feb 22, 2019

Subsystems (4)
lore
Share & tools
lore

David Chen

author
#0 lore raw

PATCH v2 1/1 r8152: Add support for MAC address pass through on RTL8153-BD

From: David Chen <[email protected]>

RTL8153-BD is used in Dell DA300 type-C dongle.
It should be added to the whitelist of devices to activate MAC address pass through.

Per confirming with Realtek all devices containing RTL8153-BD should activate MAC pass through and there won't use pass through bit on efuse like in RTL8153-AD.

---
 drivers/net/usb/r8152.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/usb/r8152.c +3 -2
index 60dd1ec1665f..86c8c64fbb0f 100644
@@ -557,6 +557,7 @@ enum spd_duplex {
 /* MAC PASSTHRU */
 #define AD_MASK			0xfee0
 #define BND_MASK		0x0004
+#define BD_MASK			0x0001
 #define EFUSE			0xcfdb
 #define PASS_THRU_MASK		0x1
 
@@ -1176,9 +1177,9 @@ static int vendor_mac_passthru_addr_read(struct r8152 *tp, struct sockaddr *sa)
 			return -ENODEV;
 		}
 	} else {
-		/* test for RTL8153-BND */
+		/* test for RTL8153-BND and RTL8153-BD */
 		ocp_data = ocp_read_byte(tp, MCU_TYPE_USB, USB_MISC_1);
-		if ((ocp_data & BND_MASK) == 0) {
+		if ((ocp_data & BND_MASK) == 0 && (ocp_data & BD_MASK) == 0) {
 			netif_dbg(tp, probe, tp->netdev,
 				  "Invalid variant for MAC pass through\n");
 			return -ENODEV;
#1 lore raw
Quoted 28 lines · David Chen

From: David Chen <[email protected]>

RTL8153-BD is used in Dell DA300 type-C dongle.
It should be added to the whitelist of devices to activate MAC address pass through.

Per confirming with Realtek all devices containing RTL8153-BD should activate MAC pass through and there won't use pass through bit on efuse like in RTL8153-AD.

---
 drivers/net/usb/r8152.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/usb/r8152.c +1 -0
index 60dd1ec1665f..86c8c64fbb0f 100644
@@ -557,6 +557,7 @@ enum spd_duplex {
 /* MAC PASSTHRU */
 #define AD_MASK			0xfee0
 #define BND_MASK		0x0004
+#define BD_MASK			0x0001
 #define EFUSE			0xcfdb
 #define PASS_THRU_MASK		0x1
 

drivers/net/usb/r8152.c static int vendor_mac_passthru_addr_read(struct r8152 *tp, struct sockaddr *sa) · line 1182

Quoted 8 lines
drivers/net/usb/r8152.c +2 -2
@@ -1176,9 +1177,9 @@ static int vendor_mac_passthru_addr_read(struct r8152 *tp, struct sockaddr *sa)
 			return -ENODEV;
 		}
 	} else {
-		/* test for RTL8153-BND */
+		/* test for RTL8153-BND and RTL8153-BD */
 		ocp_data = ocp_read_byte(tp, MCU_TYPE_USB, USB_MISC_1);
-		if ((ocp_data & BND_MASK) == 0) {
+		if ((ocp_data & BND_MASK) == 0 && (ocp_data & BD_MASK) == 0) {

Can you ensure that BND won't have the BD's bit set and vice versa? I.e. should the check be something like:
if (isBND() && (ocp_data & BND_MASK) == 0 ||

      isBD() && (ocp_data & BD_MASK) == 0)

instead?

thanks,

author
#2 lore raw

Hi Jiri,

Thanks for your comments. BND_MASK and BD_MASK are defined separately, and I have tested RTL8153-BD and RTL8153-BND devices, both work as expected.

Thanks and Regards,
-David

Quoted 50 lines

Jiri Slaby <[email protected]> 於 2019年2月18日 下午10:22 寫道:

Quoted 29 lines · David Chen

From: David Chen <[email protected]>

RTL8153-BD is used in Dell DA300 type-C dongle.
It should be added to the whitelist of devices to activate MAC address pass through.

Per confirming with Realtek all devices containing RTL8153-BD should activate MAC pass through and there won't use pass through bit on efuse like in RTL8153-AD.

---
drivers/net/usb/r8152.c | 5 +++--

1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/usb/r8152.c +1 -0
index 60dd1ec1665f..86c8c64fbb0f 100644
@@ -557,6 +557,7 @@ enum spd_duplex {
 /* MAC PASSTHRU */
 #define AD_MASK            0xfee0
 #define BND_MASK        0x0004
+#define BD_MASK            0x0001
 #define EFUSE            0xcfdb
 #define PASS_THRU_MASK        0x1
 

drivers/net/usb/r8152.c static int vendor_mac_passthru_addr_read(struct r8152 *tp, struct sockaddr *sa) · line 1182

Quoted 8 lines
drivers/net/usb/r8152.c +2 -2
@@ -1176,9 +1177,9 @@ static int vendor_mac_passthru_addr_read(struct r8152 *tp, struct sockaddr *sa)
           return -ENODEV;
       }
   } else {
-        /* test for RTL8153-BND */
+        /* test for RTL8153-BND and RTL8153-BD */
       ocp_data = ocp_read_byte(tp, MCU_TYPE_USB, USB_MISC_1);
-        if ((ocp_data & BND_MASK) == 0) {
+        if ((ocp_data & BND_MASK) == 0 && (ocp_data & BD_MASK) == 0) {

Can you ensure that BND won't have the BD's bit set and vice versa? I.e. should the check be something like:
if (isBND() && (ocp_data & BND_MASK) == 0 ||

     isBD() && (ocp_data & BD_MASK) == 0)

instead?

thanks,

Signature · 2 lines
js
suse labs