mediatek: Add support for Xiaomi Redmi Router AX6S
[openwrt/staging/chunkeey.git] / target / linux / bcm4908 / patches-5.4 / 084-v5.6-0010-phy-usb-PHY-s-MDIO-registers-not-accessible-without-.patch
1 From fc430aea02068150d053ef24bc424db3dd1357d4 Mon Sep 17 00:00:00 2001
2 From: Al Cooper <alcooperx@gmail.com>
3 Date: Fri, 3 Jan 2020 13:18:08 -0500
4 Subject: [PATCH] phy: usb: PHY's MDIO registers not accessible without device
5 installed
6
7 When there is no device connected and FSM is enabled, the XHCI puts
8 the PHY into suspend mode. When the PHY is put into suspend mode
9 the USB LDO powers down the PHY. This causes the MDIO to be
10 inaccessible and its registers reset to default. The fix is to
11 disable FSM.
12
13 Signed-off-by: Al Cooper <alcooperx@gmail.com>
14 Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
15 Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
16 ---
17 drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c | 9 +++++++++
18 1 file changed, 9 insertions(+)
19
20 --- a/drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c
21 +++ b/drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c
22 @@ -56,6 +56,7 @@
23 #define USB_PHY_PLL_LDO_CTL 0x08
24 #define USB_PHY_PLL_LDO_CTL_AFE_CORERDY_MASK 0x00000004
25 #define USB_PHY_UTMI_CTL_1 0x04
26 +#define USB_PHY_UTMI_CTL_1_POWER_UP_FSM_EN_MASK 0x00000800
27 #define USB_PHY_UTMI_CTL_1_PHY_MODE_MASK 0x0000000c
28 #define USB_PHY_UTMI_CTL_1_PHY_MODE_SHIFT 2
29 #define USB_PHY_STATUS 0x20
30 @@ -229,6 +230,14 @@ static void usb_init_common_7211b0(struc
31
32 usb_init_common(params);
33
34 + /*
35 + * Disable FSM, otherwise the PHY will auto suspend when no
36 + * device is connected and will be reset on resume.
37 + */
38 + reg = brcm_usb_readl(usb_phy + USB_PHY_UTMI_CTL_1);
39 + reg &= ~USB_PHY_UTMI_CTL_1_POWER_UP_FSM_EN_MASK;
40 + brcm_usb_writel(reg, usb_phy + USB_PHY_UTMI_CTL_1);
41 +
42 usb2_eye_fix_7211b0(params);
43 }
44