diff options
Diffstat (limited to 'extras/recipes-kernel/linux/linux-omap-2.6.39/mfd/0003-mfd-Add-omap-usbhs-runtime-PM-support.patch')
-rw-r--r-- | extras/recipes-kernel/linux/linux-omap-2.6.39/mfd/0003-mfd-Add-omap-usbhs-runtime-PM-support.patch | 245 |
1 files changed, 245 insertions, 0 deletions
diff --git a/extras/recipes-kernel/linux/linux-omap-2.6.39/mfd/0003-mfd-Add-omap-usbhs-runtime-PM-support.patch b/extras/recipes-kernel/linux/linux-omap-2.6.39/mfd/0003-mfd-Add-omap-usbhs-runtime-PM-support.patch new file mode 100644 index 00000000..b47deb2c --- /dev/null +++ b/extras/recipes-kernel/linux/linux-omap-2.6.39/mfd/0003-mfd-Add-omap-usbhs-runtime-PM-support.patch | |||
@@ -0,0 +1,245 @@ | |||
1 | From edc881f9c4897fab11542cd5c36a33b288f702be Mon Sep 17 00:00:00 2001 | ||
2 | From: Keshava Munegowda <Keshava_mgowda@ti.com> | ||
3 | Date: Sun, 22 May 2011 22:51:26 +0200 | ||
4 | Subject: [PATCH 03/13] mfd: Add omap-usbhs runtime PM support | ||
5 | |||
6 | The usbhs core driver does not enable/disable the interface and | ||
7 | functional clocks; These clocks are handled by hwmod and runtime pm, | ||
8 | hence insted of the clock enable/disable, the runtime pm APIS are | ||
9 | used. however,the port clocks and tll clocks are handled | ||
10 | by the usbhs core. | ||
11 | |||
12 | Signed-off-by: Keshava Munegowda <keshava_mgowda@ti.com> | ||
13 | Signed-off-by: Samuel Ortiz <sameo@linux.intel.com> | ||
14 | --- | ||
15 | drivers/mfd/omap-usb-host.c | 131 +++---------------------------------------- | ||
16 | 1 files changed, 9 insertions(+), 122 deletions(-) | ||
17 | |||
18 | diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c | ||
19 | index 1717144..8552195 100644 | ||
20 | --- a/drivers/mfd/omap-usb-host.c | ||
21 | +++ b/drivers/mfd/omap-usb-host.c | ||
22 | @@ -26,6 +26,7 @@ | ||
23 | #include <linux/spinlock.h> | ||
24 | #include <linux/gpio.h> | ||
25 | #include <plat/usb.h> | ||
26 | +#include <linux/pm_runtime.h> | ||
27 | |||
28 | #define USBHS_DRIVER_NAME "usbhs-omap" | ||
29 | #define OMAP_EHCI_DEVICE "ehci-omap" | ||
30 | @@ -146,9 +147,6 @@ | ||
31 | |||
32 | |||
33 | struct usbhs_hcd_omap { | ||
34 | - struct clk *usbhost_ick; | ||
35 | - struct clk *usbhost_hs_fck; | ||
36 | - struct clk *usbhost_fs_fck; | ||
37 | struct clk *xclk60mhsp1_ck; | ||
38 | struct clk *xclk60mhsp2_ck; | ||
39 | struct clk *utmi_p1_fck; | ||
40 | @@ -158,8 +156,6 @@ struct usbhs_hcd_omap { | ||
41 | struct clk *usbhost_p2_fck; | ||
42 | struct clk *usbtll_p2_fck; | ||
43 | struct clk *init_60m_fclk; | ||
44 | - struct clk *usbtll_fck; | ||
45 | - struct clk *usbtll_ick; | ||
46 | |||
47 | void __iomem *uhh_base; | ||
48 | void __iomem *tll_base; | ||
49 | @@ -353,46 +349,13 @@ static int __devinit usbhs_omap_probe(struct platform_device *pdev) | ||
50 | omap->platdata.ehci_data = pdata->ehci_data; | ||
51 | omap->platdata.ohci_data = pdata->ohci_data; | ||
52 | |||
53 | - omap->usbhost_ick = clk_get(dev, "usbhost_ick"); | ||
54 | - if (IS_ERR(omap->usbhost_ick)) { | ||
55 | - ret = PTR_ERR(omap->usbhost_ick); | ||
56 | - dev_err(dev, "usbhost_ick failed error:%d\n", ret); | ||
57 | - goto err_end; | ||
58 | - } | ||
59 | - | ||
60 | - omap->usbhost_hs_fck = clk_get(dev, "hs_fck"); | ||
61 | - if (IS_ERR(omap->usbhost_hs_fck)) { | ||
62 | - ret = PTR_ERR(omap->usbhost_hs_fck); | ||
63 | - dev_err(dev, "usbhost_hs_fck failed error:%d\n", ret); | ||
64 | - goto err_usbhost_ick; | ||
65 | - } | ||
66 | - | ||
67 | - omap->usbhost_fs_fck = clk_get(dev, "fs_fck"); | ||
68 | - if (IS_ERR(omap->usbhost_fs_fck)) { | ||
69 | - ret = PTR_ERR(omap->usbhost_fs_fck); | ||
70 | - dev_err(dev, "usbhost_fs_fck failed error:%d\n", ret); | ||
71 | - goto err_usbhost_hs_fck; | ||
72 | - } | ||
73 | - | ||
74 | - omap->usbtll_fck = clk_get(dev, "usbtll_fck"); | ||
75 | - if (IS_ERR(omap->usbtll_fck)) { | ||
76 | - ret = PTR_ERR(omap->usbtll_fck); | ||
77 | - dev_err(dev, "usbtll_fck failed error:%d\n", ret); | ||
78 | - goto err_usbhost_fs_fck; | ||
79 | - } | ||
80 | - | ||
81 | - omap->usbtll_ick = clk_get(dev, "usbtll_ick"); | ||
82 | - if (IS_ERR(omap->usbtll_ick)) { | ||
83 | - ret = PTR_ERR(omap->usbtll_ick); | ||
84 | - dev_err(dev, "usbtll_ick failed error:%d\n", ret); | ||
85 | - goto err_usbtll_fck; | ||
86 | - } | ||
87 | + pm_runtime_enable(&pdev->dev); | ||
88 | |||
89 | omap->utmi_p1_fck = clk_get(dev, "utmi_p1_gfclk"); | ||
90 | if (IS_ERR(omap->utmi_p1_fck)) { | ||
91 | ret = PTR_ERR(omap->utmi_p1_fck); | ||
92 | dev_err(dev, "utmi_p1_gfclk failed error:%d\n", ret); | ||
93 | - goto err_usbtll_ick; | ||
94 | + goto err_end; | ||
95 | } | ||
96 | |||
97 | omap->xclk60mhsp1_ck = clk_get(dev, "xclk60mhsp1_ck"); | ||
98 | @@ -522,22 +485,8 @@ err_xclk60mhsp1_ck: | ||
99 | err_utmi_p1_fck: | ||
100 | clk_put(omap->utmi_p1_fck); | ||
101 | |||
102 | -err_usbtll_ick: | ||
103 | - clk_put(omap->usbtll_ick); | ||
104 | - | ||
105 | -err_usbtll_fck: | ||
106 | - clk_put(omap->usbtll_fck); | ||
107 | - | ||
108 | -err_usbhost_fs_fck: | ||
109 | - clk_put(omap->usbhost_fs_fck); | ||
110 | - | ||
111 | -err_usbhost_hs_fck: | ||
112 | - clk_put(omap->usbhost_hs_fck); | ||
113 | - | ||
114 | -err_usbhost_ick: | ||
115 | - clk_put(omap->usbhost_ick); | ||
116 | - | ||
117 | err_end: | ||
118 | + pm_runtime_disable(&pdev->dev); | ||
119 | kfree(omap); | ||
120 | |||
121 | end_probe: | ||
122 | @@ -571,11 +520,7 @@ static int __devexit usbhs_omap_remove(struct platform_device *pdev) | ||
123 | clk_put(omap->utmi_p2_fck); | ||
124 | clk_put(omap->xclk60mhsp1_ck); | ||
125 | clk_put(omap->utmi_p1_fck); | ||
126 | - clk_put(omap->usbtll_ick); | ||
127 | - clk_put(omap->usbtll_fck); | ||
128 | - clk_put(omap->usbhost_fs_fck); | ||
129 | - clk_put(omap->usbhost_hs_fck); | ||
130 | - clk_put(omap->usbhost_ick); | ||
131 | + pm_runtime_disable(&pdev->dev); | ||
132 | kfree(omap); | ||
133 | |||
134 | return 0; | ||
135 | @@ -695,7 +640,6 @@ static int usbhs_enable(struct device *dev) | ||
136 | struct usbhs_omap_platform_data *pdata = &omap->platdata; | ||
137 | unsigned long flags = 0; | ||
138 | int ret = 0; | ||
139 | - unsigned long timeout; | ||
140 | unsigned reg; | ||
141 | |||
142 | dev_dbg(dev, "starting TI HSUSB Controller\n"); | ||
143 | @@ -708,11 +652,7 @@ static int usbhs_enable(struct device *dev) | ||
144 | if (omap->count > 0) | ||
145 | goto end_count; | ||
146 | |||
147 | - clk_enable(omap->usbhost_ick); | ||
148 | - clk_enable(omap->usbhost_hs_fck); | ||
149 | - clk_enable(omap->usbhost_fs_fck); | ||
150 | - clk_enable(omap->usbtll_fck); | ||
151 | - clk_enable(omap->usbtll_ick); | ||
152 | + pm_runtime_get_sync(dev); | ||
153 | |||
154 | if (pdata->ehci_data->phy_reset) { | ||
155 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) { | ||
156 | @@ -736,50 +676,6 @@ static int usbhs_enable(struct device *dev) | ||
157 | omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION); | ||
158 | dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev); | ||
159 | |||
160 | - /* perform TLL soft reset, and wait until reset is complete */ | ||
161 | - usbhs_write(omap->tll_base, OMAP_USBTLL_SYSCONFIG, | ||
162 | - OMAP_USBTLL_SYSCONFIG_SOFTRESET); | ||
163 | - | ||
164 | - /* Wait for TLL reset to complete */ | ||
165 | - timeout = jiffies + msecs_to_jiffies(1000); | ||
166 | - while (!(usbhs_read(omap->tll_base, OMAP_USBTLL_SYSSTATUS) | ||
167 | - & OMAP_USBTLL_SYSSTATUS_RESETDONE)) { | ||
168 | - cpu_relax(); | ||
169 | - | ||
170 | - if (time_after(jiffies, timeout)) { | ||
171 | - dev_dbg(dev, "operation timed out\n"); | ||
172 | - ret = -EINVAL; | ||
173 | - goto err_tll; | ||
174 | - } | ||
175 | - } | ||
176 | - | ||
177 | - dev_dbg(dev, "TLL RESET DONE\n"); | ||
178 | - | ||
179 | - /* (1<<3) = no idle mode only for initial debugging */ | ||
180 | - usbhs_write(omap->tll_base, OMAP_USBTLL_SYSCONFIG, | ||
181 | - OMAP_USBTLL_SYSCONFIG_ENAWAKEUP | | ||
182 | - OMAP_USBTLL_SYSCONFIG_SIDLEMODE | | ||
183 | - OMAP_USBTLL_SYSCONFIG_AUTOIDLE); | ||
184 | - | ||
185 | - /* Put UHH in NoIdle/NoStandby mode */ | ||
186 | - reg = usbhs_read(omap->uhh_base, OMAP_UHH_SYSCONFIG); | ||
187 | - if (is_omap_usbhs_rev1(omap)) { | ||
188 | - reg |= (OMAP_UHH_SYSCONFIG_ENAWAKEUP | ||
189 | - | OMAP_UHH_SYSCONFIG_SIDLEMODE | ||
190 | - | OMAP_UHH_SYSCONFIG_CACTIVITY | ||
191 | - | OMAP_UHH_SYSCONFIG_MIDLEMODE); | ||
192 | - reg &= ~OMAP_UHH_SYSCONFIG_AUTOIDLE; | ||
193 | - | ||
194 | - | ||
195 | - } else if (is_omap_usbhs_rev2(omap)) { | ||
196 | - reg &= ~OMAP4_UHH_SYSCONFIG_IDLEMODE_CLEAR; | ||
197 | - reg |= OMAP4_UHH_SYSCONFIG_NOIDLE; | ||
198 | - reg &= ~OMAP4_UHH_SYSCONFIG_STDBYMODE_CLEAR; | ||
199 | - reg |= OMAP4_UHH_SYSCONFIG_NOSTDBY; | ||
200 | - } | ||
201 | - | ||
202 | - usbhs_write(omap->uhh_base, OMAP_UHH_SYSCONFIG, reg); | ||
203 | - | ||
204 | reg = usbhs_read(omap->uhh_base, OMAP_UHH_HOSTCONFIG); | ||
205 | /* setup ULPI bypass and burst configurations */ | ||
206 | reg |= (OMAP_UHH_HOSTCONFIG_INCR4_BURST_EN | ||
207 | @@ -919,6 +815,8 @@ end_count: | ||
208 | return 0; | ||
209 | |||
210 | err_tll: | ||
211 | + pm_runtime_put_sync(dev); | ||
212 | + spin_unlock_irqrestore(&omap->lock, flags); | ||
213 | if (pdata->ehci_data->phy_reset) { | ||
214 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) | ||
215 | gpio_free(pdata->ehci_data->reset_gpio_port[0]); | ||
216 | @@ -926,13 +824,6 @@ err_tll: | ||
217 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) | ||
218 | gpio_free(pdata->ehci_data->reset_gpio_port[1]); | ||
219 | } | ||
220 | - | ||
221 | - clk_disable(omap->usbtll_ick); | ||
222 | - clk_disable(omap->usbtll_fck); | ||
223 | - clk_disable(omap->usbhost_fs_fck); | ||
224 | - clk_disable(omap->usbhost_hs_fck); | ||
225 | - clk_disable(omap->usbhost_ick); | ||
226 | - spin_unlock_irqrestore(&omap->lock, flags); | ||
227 | return ret; | ||
228 | } | ||
229 | |||
230 | @@ -1005,11 +896,7 @@ static void usbhs_disable(struct device *dev) | ||
231 | clk_disable(omap->utmi_p1_fck); | ||
232 | } | ||
233 | |||
234 | - clk_disable(omap->usbtll_ick); | ||
235 | - clk_disable(omap->usbtll_fck); | ||
236 | - clk_disable(omap->usbhost_fs_fck); | ||
237 | - clk_disable(omap->usbhost_hs_fck); | ||
238 | - clk_disable(omap->usbhost_ick); | ||
239 | + pm_runtime_put_sync(dev); | ||
240 | |||
241 | /* The gpio_free migh sleep; so unlock the spinlock */ | ||
242 | spin_unlock_irqrestore(&omap->lock, flags); | ||
243 | -- | ||
244 | 1.6.6.1 | ||
245 | |||