]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
usb: mtu3: fix the issue about SetFeature(U1/U2_Enable)
authorChunfeng Yun <chunfeng.yun@mediatek.com>
Thu, 29 Nov 2018 02:34:34 +0000 (10:34 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Feb 2019 18:46:01 +0000 (19:46 +0100)
[ Upstream commit a0678e2eed41e81004308693ac84ea95614b0920 ]

Fix the issue: device doesn't accept LGO_U1/U2:
1. set SW_U1/U2_ACCEPT_ENABLE to eanble controller to accept LGO_U1/U2
    by default;
2. enable/disable controller to initiate requests for transition into
    U1/U2 by SW_U1/U2_REQUEST_ENABLE instead of SW_U1/U2_ACCEPT_ENABLE;

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/mtu3/mtu3_core.c
drivers/usb/mtu3/mtu3_gadget_ep0.c

index 947579842ad788cd8725b63ded83695908bf1631..95978e3b363e2240572f3ebe8c86f9ce51f6894e 100644 (file)
@@ -564,8 +564,10 @@ static void mtu3_regs_init(struct mtu3 *mtu)
        if (mtu->is_u3_ip) {
                /* disable LGO_U1/U2 by default */
                mtu3_clrbits(mbase, U3D_LINK_POWER_CONTROL,
-                               SW_U1_ACCEPT_ENABLE | SW_U2_ACCEPT_ENABLE |
                                SW_U1_REQUEST_ENABLE | SW_U2_REQUEST_ENABLE);
+               /* enable accept LGO_U1/U2 link command from host */
+               mtu3_setbits(mbase, U3D_LINK_POWER_CONTROL,
+                               SW_U1_ACCEPT_ENABLE | SW_U2_ACCEPT_ENABLE);
                /* device responses to u3_exit from host automatically */
                mtu3_clrbits(mbase, U3D_LTSSM_CTRL, SOFT_U3_EXIT_EN);
                /* automatically build U2 link when U3 detect fail */
index 958d74dd2b789593f06c7744def111b76a38424d..7997cf5f06fc7aa0ade909d9440ee21afc090b18 100644 (file)
@@ -335,9 +335,9 @@ static int ep0_handle_feature_dev(struct mtu3 *mtu,
 
                lpc = mtu3_readl(mbase, U3D_LINK_POWER_CONTROL);
                if (set)
-                       lpc |= SW_U1_ACCEPT_ENABLE;
+                       lpc |= SW_U1_REQUEST_ENABLE;
                else
-                       lpc &= ~SW_U1_ACCEPT_ENABLE;
+                       lpc &= ~SW_U1_REQUEST_ENABLE;
                mtu3_writel(mbase, U3D_LINK_POWER_CONTROL, lpc);
 
                mtu->u1_enable = !!set;
@@ -350,9 +350,9 @@ static int ep0_handle_feature_dev(struct mtu3 *mtu,
 
                lpc = mtu3_readl(mbase, U3D_LINK_POWER_CONTROL);
                if (set)
-                       lpc |= SW_U2_ACCEPT_ENABLE;
+                       lpc |= SW_U2_REQUEST_ENABLE;
                else
-                       lpc &= ~SW_U2_ACCEPT_ENABLE;
+                       lpc &= ~SW_U2_REQUEST_ENABLE;
                mtu3_writel(mbase, U3D_LINK_POWER_CONTROL, lpc);
 
                mtu->u2_enable = !!set;