aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/mediatek/patches-4.14/0190-usb-xhci-mtk-supports-remote-wakeup-for-mt2712-with-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/mediatek/patches-4.14/0190-usb-xhci-mtk-supports-remote-wakeup-for-mt2712-with-.patch')
-rw-r--r--target/linux/mediatek/patches-4.14/0190-usb-xhci-mtk-supports-remote-wakeup-for-mt2712-with-.patch94
1 files changed, 43 insertions, 51 deletions
diff --git a/target/linux/mediatek/patches-4.14/0190-usb-xhci-mtk-supports-remote-wakeup-for-mt2712-with-.patch b/target/linux/mediatek/patches-4.14/0190-usb-xhci-mtk-supports-remote-wakeup-for-mt2712-with-.patch
index ba7b834f84..2ae76eda17 100644
--- a/target/linux/mediatek/patches-4.14/0190-usb-xhci-mtk-supports-remote-wakeup-for-mt2712-with-.patch
+++ b/target/linux/mediatek/patches-4.14/0190-usb-xhci-mtk-supports-remote-wakeup-for-mt2712-with-.patch
@@ -21,8 +21,6 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-mtk.h | 6 +-
2 files changed, 65 insertions(+), 118 deletions(-)
-diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
-index e5caabe7eebe..8e51b3fec386 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -66,26 +66,21 @@
@@ -67,7 +65,7 @@ index e5caabe7eebe..8e51b3fec386 100644
};
static int xhci_mtk_host_enable(struct xhci_hcd_mtk *mtk)
-@@ -308,112 +303,58 @@ static void xhci_mtk_clks_disable(struct xhci_hcd_mtk *mtk)
+@@ -308,112 +303,58 @@ static void xhci_mtk_clks_disable(struct
}
/* only clocks can be turn off for ip-sleep wakeup mode */
@@ -76,7 +74,8 @@ index e5caabe7eebe..8e51b3fec386 100644
{
- u32 tmp;
- struct regmap *pericfg = mtk->pericfg;
--
++ u32 reg, msk, val;
+
- regmap_read(pericfg, PERI_WK_CTRL1, &tmp);
- tmp &= ~UWK_CTL1_IS_P;
- tmp &= ~(UWK_CTL1_IS_C(0xf));
@@ -87,8 +86,15 @@ index e5caabe7eebe..8e51b3fec386 100644
- regmap_read(pericfg, PERI_WK_CTRL1, &tmp);
- dev_dbg(mtk->dev, "%s(): WK_CTRL1[P6,E25,C26:29]=%#x\n",
- __func__, tmp);
-+ u32 reg, msk, val;
-+
+-}
+-
+-static void usb_wakeup_ip_sleep_dis(struct xhci_hcd_mtk *mtk)
+-{
+- u32 tmp;
+-
+- regmap_read(mtk->pericfg, PERI_WK_CTRL1, &tmp);
+- tmp &= ~UWK_CTL1_IS_E;
+- regmap_write(mtk->pericfg, PERI_WK_CTRL1, tmp);
+ switch (mtk->uwk_vers) {
+ case SSUSB_UWK_V1:
+ reg = mtk->uwk_reg_base + PERI_WK_CTRL1;
@@ -106,29 +112,14 @@ index e5caabe7eebe..8e51b3fec386 100644
+ regmap_update_bits(mtk->uwk, reg, msk, val);
}
--static void usb_wakeup_ip_sleep_dis(struct xhci_hcd_mtk *mtk)
-+static int usb_wakeup_of_property_parse(struct xhci_hcd_mtk *mtk,
-+ struct device_node *dn)
- {
-- u32 tmp;
-+ struct of_phandle_args args;
-+ int ret;
-
-- regmap_read(mtk->pericfg, PERI_WK_CTRL1, &tmp);
-- tmp &= ~UWK_CTL1_IS_E;
-- regmap_write(mtk->pericfg, PERI_WK_CTRL1, tmp);
--}
-+ /* Wakeup function is optional */
-+ mtk->uwk_en = of_property_read_bool(dn, "wakeup-source");
-+ if (!mtk->uwk_en)
-+ return 0;
-
-/*
-* for line-state wakeup mode, phy's power should not power-down
-* and only support cable plug in/out
-*/
-static void usb_wakeup_line_state_en(struct xhci_hcd_mtk *mtk)
--{
++static int usb_wakeup_of_property_parse(struct xhci_hcd_mtk *mtk,
++ struct device_node *dn)
+ {
- u32 tmp;
- struct regmap *pericfg = mtk->pericfg;
-
@@ -140,7 +131,9 @@ index e5caabe7eebe..8e51b3fec386 100644
- regmap_write(pericfg, PERI_WK_CTRL1, tmp);
- regmap_read(pericfg, PERI_WK_CTRL1, &tmp);
- regmap_write(pericfg, PERI_WK_CTRL1, tmp | UWK_CTL1_0P_LS_E);
--
++ struct of_phandle_args args;
++ int ret;
+
- /* line-state of u2-port1 */
- regmap_read(pericfg, PERI_WK_CTRL0, &tmp);
- tmp &= ~(UWK_CTL1_1P_LS_C(0xf));
@@ -148,26 +141,24 @@ index e5caabe7eebe..8e51b3fec386 100644
- regmap_write(pericfg, PERI_WK_CTRL0, tmp);
- regmap_write(pericfg, PERI_WK_CTRL0, tmp | UWK_CTL1_1P_LS_E);
-}
-+ ret = of_parse_phandle_with_fixed_args(dn,
-+ "mediatek,syscon-wakeup", 2, 0, &args);
-+ if (ret)
-+ return ret;
++ /* Wakeup function is optional */
++ mtk->uwk_en = of_property_read_bool(dn, "wakeup-source");
++ if (!mtk->uwk_en)
++ return 0;
-static void usb_wakeup_line_state_dis(struct xhci_hcd_mtk *mtk)
-{
- u32 tmp;
- struct regmap *pericfg = mtk->pericfg;
--
++ ret = of_parse_phandle_with_fixed_args(dn,
++ "mediatek,syscon-wakeup", 2, 0, &args);
++ if (ret)
++ return ret;
+
- /* line-state of u2-port0 */
- regmap_read(pericfg, PERI_WK_CTRL1, &tmp);
- tmp &= ~UWK_CTL1_0P_LS_E;
- regmap_write(pericfg, PERI_WK_CTRL1, tmp);
--
-- /* line-state of u2-port1 */
-- regmap_read(pericfg, PERI_WK_CTRL0, &tmp);
-- tmp &= ~UWK_CTL1_1P_LS_E;
-- regmap_write(pericfg, PERI_WK_CTRL0, tmp);
--}
+ mtk->uwk_reg_base = args.args[0];
+ mtk->uwk_vers = args.args[1];
+ mtk->uwk = syscon_node_to_regmap(args.np);
@@ -175,27 +166,33 @@ index e5caabe7eebe..8e51b3fec386 100644
+ dev_info(mtk->dev, "uwk - reg:0x%x, version:%d\n",
+ mtk->uwk_reg_base, mtk->uwk_vers);
+- /* line-state of u2-port1 */
+- regmap_read(pericfg, PERI_WK_CTRL0, &tmp);
+- tmp &= ~UWK_CTL1_1P_LS_E;
+- regmap_write(pericfg, PERI_WK_CTRL0, tmp);
+-}
++ return PTR_ERR_OR_ZERO(mtk->uwk);
+
-static void usb_wakeup_enable(struct xhci_hcd_mtk *mtk)
-{
- if (mtk->wakeup_src == SSUSB_WK_IP_SLEEP)
- usb_wakeup_ip_sleep_en(mtk);
- else if (mtk->wakeup_src == SSUSB_WK_LINE_STATE)
- usb_wakeup_line_state_en(mtk);
--}
-+ return PTR_ERR_OR_ZERO(mtk->uwk);
+ }
-static void usb_wakeup_disable(struct xhci_hcd_mtk *mtk)
--{
++static void usb_wakeup_set(struct xhci_hcd_mtk *mtk, bool enable)
+ {
- if (mtk->wakeup_src == SSUSB_WK_IP_SLEEP)
- usb_wakeup_ip_sleep_dis(mtk);
- else if (mtk->wakeup_src == SSUSB_WK_LINE_STATE)
- usb_wakeup_line_state_dis(mtk);
- }
-
+-}
+-
-static int usb_wakeup_of_property_parse(struct xhci_hcd_mtk *mtk,
- struct device_node *dn)
-+static void usb_wakeup_set(struct xhci_hcd_mtk *mtk, bool enable)
- {
+-{
- struct device *dev = mtk->dev;
-
- /*
@@ -220,7 +217,7 @@ index e5caabe7eebe..8e51b3fec386 100644
}
static int xhci_mtk_setup(struct usb_hcd *hcd);
-@@ -595,8 +536,10 @@ static int xhci_mtk_probe(struct platform_device *pdev)
+@@ -595,8 +536,10 @@ static int xhci_mtk_probe(struct platfor
&mtk->u3p_dis_msk);
ret = usb_wakeup_of_property_parse(mtk, node);
@@ -232,7 +229,7 @@ index e5caabe7eebe..8e51b3fec386 100644
mtk->num_phys = of_count_phandle_with_args(node,
"phys", "#phy-cells");
-@@ -780,7 +723,7 @@ static int __maybe_unused xhci_mtk_suspend(struct device *dev)
+@@ -780,7 +723,7 @@ static int __maybe_unused xhci_mtk_suspe
xhci_mtk_host_disable(mtk);
xhci_mtk_phy_power_off(mtk);
xhci_mtk_clks_disable(mtk);
@@ -241,7 +238,7 @@ index e5caabe7eebe..8e51b3fec386 100644
return 0;
}
-@@ -790,7 +733,7 @@ static int __maybe_unused xhci_mtk_resume(struct device *dev)
+@@ -790,7 +733,7 @@ static int __maybe_unused xhci_mtk_resum
struct usb_hcd *hcd = mtk->hcd;
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
@@ -250,8 +247,6 @@ index e5caabe7eebe..8e51b3fec386 100644
xhci_mtk_clks_enable(mtk);
xhci_mtk_phy_power_on(mtk);
xhci_mtk_host_enable(mtk);
-diff --git a/drivers/usb/host/xhci-mtk.h b/drivers/usb/host/xhci-mtk.h
-index 45ff5c67efb5..85c007ee1f52 100644
--- a/drivers/usb/host/xhci-mtk.h
+++ b/drivers/usb/host/xhci-mtk.h
@@ -131,8 +131,12 @@ struct xhci_hcd_mtk {
@@ -268,6 +263,3 @@ index 45ff5c67efb5..85c007ee1f52 100644
};
static inline struct xhci_hcd_mtk *hcd_to_mtk(struct usb_hcd *hcd)
---
-2.11.0
-