]> git.baikalelectronics.ru Git - kernel.git/commitdiff
r8152: disable test IO for RTL8153B
authorHayes Wang <hayeswang@realtek.com>
Wed, 22 Jan 2020 08:02:10 +0000 (16:02 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 23 Jan 2020 10:20:57 +0000 (11:20 +0100)
For RTL8153B with QFN32, disable test IO. Otherwise, it may cause
abnormal behavior for the device randomly.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/r8152.c

index 1fb85c79bd337950414dde78dc96c8812a98044d..7efeddad1fc818d33b63c115f57e0ad3ae1ca1a2 100644 (file)
 /* PLA_PHY_PWR */
 #define TX_10M_IDLE_EN         0x0080
 #define PFM_PWM_SWITCH         0x0040
+#define TEST_IO_OFF            BIT(4)
 
 /* PLA_MAC_PWR_CTRL */
 #define D3_CLK_GATED_EN                0x00004000
@@ -5538,6 +5539,15 @@ static void r8153b_init(struct r8152 *tp)
        ocp_data &= ~PLA_MCU_SPDWN_EN;
        ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3, ocp_data);
 
+       if (tp->version == RTL_VER_09) {
+               /* Disable Test IO for 32QFN */
+               if (ocp_read_byte(tp, MCU_TYPE_PLA, 0xdc00) & BIT(5)) {
+                       ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_PHY_PWR);
+                       ocp_data |= TEST_IO_OFF;
+                       ocp_write_word(tp, MCU_TYPE_PLA, PLA_PHY_PWR, ocp_data);
+               }
+       }
+
        set_bit(GREEN_ETHERNET, &tp->flags);
 
        /* rx aggregation */