e269f80cf46f3f0ccc9ba5e31ef6cafd83b37c19
[openwrt/staging/pepe2k.git] /
1 From ece5ffd9e15e9c8471e58b581a098032a679d34e Mon Sep 17 00:00:00 2001
2 From: Al Cooper <alcooperx@gmail.com>
3 Date: Fri, 3 Jan 2020 13:18:00 -0500
4 Subject: [PATCH] phy: usb: Get all drivers that use USB clks using correct
5 enable/disable
6
7 The BRCM USB Phy, ohci, ehci and xhci drivers all use the USB clocks
8 but not all drivers use the clk_prepare_enable/clk_disable_unprepare
9 versions to enable/disable the clocks. This change gets all drivers
10 using the prepare version.
11
12 Signed-off-by: Al Cooper <alcooperx@gmail.com>
13 Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
14 Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
15 ---
16 drivers/phy/broadcom/phy-brcm-usb.c | 28 ++++++++++++++--------------
17 1 file changed, 14 insertions(+), 14 deletions(-)
18
19 --- a/drivers/phy/broadcom/phy-brcm-usb.c
20 +++ b/drivers/phy/broadcom/phy-brcm-usb.c
21 @@ -74,8 +74,8 @@ static int brcm_usb_phy_init(struct phy
22 */
23 mutex_lock(&priv->mutex);
24 if (priv->init_count++ == 0) {
25 - clk_enable(priv->usb_20_clk);
26 - clk_enable(priv->usb_30_clk);
27 + clk_prepare_enable(priv->usb_20_clk);
28 + clk_prepare_enable(priv->usb_30_clk);
29 brcm_usb_init_common(&priv->ini);
30 }
31 mutex_unlock(&priv->mutex);
32 @@ -106,8 +106,8 @@ static int brcm_usb_phy_exit(struct phy
33 mutex_lock(&priv->mutex);
34 if (--priv->init_count == 0) {
35 brcm_usb_uninit_common(&priv->ini);
36 - clk_disable(priv->usb_20_clk);
37 - clk_disable(priv->usb_30_clk);
38 + clk_disable_unprepare(priv->usb_20_clk);
39 + clk_disable_unprepare(priv->usb_30_clk);
40 }
41 mutex_unlock(&priv->mutex);
42 phy->inited = false;
43 @@ -360,8 +360,8 @@ static int brcm_usb_phy_probe(struct pla
44 if (priv->has_eohci)
45 brcm_usb_uninit_eohci(&priv->ini);
46 brcm_usb_uninit_common(&priv->ini);
47 - clk_disable(priv->usb_20_clk);
48 - clk_disable(priv->usb_30_clk);
49 + clk_disable_unprepare(priv->usb_20_clk);
50 + clk_disable_unprepare(priv->usb_30_clk);
51
52 phy_provider = devm_of_phy_provider_register(dev, brcm_usb_phy_xlate);
53
54 @@ -381,8 +381,8 @@ static int brcm_usb_phy_suspend(struct d
55 struct brcm_usb_phy_data *priv = dev_get_drvdata(dev);
56
57 if (priv->init_count) {
58 - clk_disable(priv->usb_20_clk);
59 - clk_disable(priv->usb_30_clk);
60 + clk_disable_unprepare(priv->usb_20_clk);
61 + clk_disable_unprepare(priv->usb_30_clk);
62 }
63 return 0;
64 }
65 @@ -391,8 +391,8 @@ static int brcm_usb_phy_resume(struct de
66 {
67 struct brcm_usb_phy_data *priv = dev_get_drvdata(dev);
68
69 - clk_enable(priv->usb_20_clk);
70 - clk_enable(priv->usb_30_clk);
71 + clk_prepare_enable(priv->usb_20_clk);
72 + clk_prepare_enable(priv->usb_30_clk);
73 brcm_usb_init_ipp(&priv->ini);
74
75 /*
76 @@ -405,13 +405,13 @@ static int brcm_usb_phy_resume(struct de
77 brcm_usb_init_eohci(&priv->ini);
78 } else if (priv->has_eohci) {
79 brcm_usb_uninit_eohci(&priv->ini);
80 - clk_disable(priv->usb_20_clk);
81 + clk_disable_unprepare(priv->usb_20_clk);
82 }
83 if (priv->phys[BRCM_USB_PHY_3_0].inited) {
84 brcm_usb_init_xhci(&priv->ini);
85 } else if (priv->has_xhci) {
86 brcm_usb_uninit_xhci(&priv->ini);
87 - clk_disable(priv->usb_30_clk);
88 + clk_disable_unprepare(priv->usb_30_clk);
89 }
90 } else {
91 if (priv->has_xhci)
92 @@ -419,8 +419,8 @@ static int brcm_usb_phy_resume(struct de
93 if (priv->has_eohci)
94 brcm_usb_uninit_eohci(&priv->ini);
95 brcm_usb_uninit_common(&priv->ini);
96 - clk_disable(priv->usb_20_clk);
97 - clk_disable(priv->usb_30_clk);
98 + clk_disable_unprepare(priv->usb_20_clk);
99 + clk_disable_unprepare(priv->usb_30_clk);
100 }
101
102 return 0;