diff options
author | Kishon Vijay Abraham I <kishon@ti.com> | 2013-01-24 21:51:49 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-01-25 06:03:10 -0500 |
commit | 0c4c8bbbfdfc61c2ab2cc1026b5a05ae52396c93 (patch) | |
tree | 984c6bebabfe07f1696b7585e7430b5841562fd8 /drivers/usb/phy/omap-usb2.c | |
parent | b16604f2c1dc3f0a326818b282e6bb5f363f725e (diff) |
usb: phy: omap-usb2: enable 960Mhz clock for omap5
"usb_otg_ss_refclk960m" is needed for usb2 phy present in omap5. For
omap4, the clk_get of this clock will fail since it does not have this
clock.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/phy/omap-usb2.c')
-rw-r--r-- | drivers/usb/phy/omap-usb2.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/drivers/usb/phy/omap-usb2.c b/drivers/usb/phy/omap-usb2.c index 0cd88ac0e095..844ab68f08d0 100644 --- a/drivers/usb/phy/omap-usb2.c +++ b/drivers/usb/phy/omap-usb2.c | |||
@@ -166,6 +166,12 @@ static int omap_usb2_probe(struct platform_device *pdev) | |||
166 | } | 166 | } |
167 | clk_prepare(phy->wkupclk); | 167 | clk_prepare(phy->wkupclk); |
168 | 168 | ||
169 | phy->optclk = devm_clk_get(phy->dev, "usb_otg_ss_refclk960m"); | ||
170 | if (IS_ERR(phy->optclk)) | ||
171 | dev_vdbg(&pdev->dev, "unable to get refclk960m\n"); | ||
172 | else | ||
173 | clk_prepare(phy->optclk); | ||
174 | |||
169 | usb_add_phy_dev(&phy->phy); | 175 | usb_add_phy_dev(&phy->phy); |
170 | 176 | ||
171 | platform_set_drvdata(pdev, phy); | 177 | platform_set_drvdata(pdev, phy); |
@@ -180,6 +186,8 @@ static int omap_usb2_remove(struct platform_device *pdev) | |||
180 | struct omap_usb *phy = platform_get_drvdata(pdev); | 186 | struct omap_usb *phy = platform_get_drvdata(pdev); |
181 | 187 | ||
182 | clk_unprepare(phy->wkupclk); | 188 | clk_unprepare(phy->wkupclk); |
189 | if (!IS_ERR(phy->optclk)) | ||
190 | clk_unprepare(phy->optclk); | ||
183 | usb_remove_phy(&phy->phy); | 191 | usb_remove_phy(&phy->phy); |
184 | 192 | ||
185 | return 0; | 193 | return 0; |
@@ -193,6 +201,8 @@ static int omap_usb2_runtime_suspend(struct device *dev) | |||
193 | struct omap_usb *phy = platform_get_drvdata(pdev); | 201 | struct omap_usb *phy = platform_get_drvdata(pdev); |
194 | 202 | ||
195 | clk_disable(phy->wkupclk); | 203 | clk_disable(phy->wkupclk); |
204 | if (!IS_ERR(phy->optclk)) | ||
205 | clk_disable(phy->optclk); | ||
196 | 206 | ||
197 | return 0; | 207 | return 0; |
198 | } | 208 | } |
@@ -204,9 +214,25 @@ static int omap_usb2_runtime_resume(struct device *dev) | |||
204 | struct omap_usb *phy = platform_get_drvdata(pdev); | 214 | struct omap_usb *phy = platform_get_drvdata(pdev); |
205 | 215 | ||
206 | ret = clk_enable(phy->wkupclk); | 216 | ret = clk_enable(phy->wkupclk); |
207 | if (ret < 0) | 217 | if (ret < 0) { |
208 | dev_err(phy->dev, "Failed to enable wkupclk %d\n", ret); | 218 | dev_err(phy->dev, "Failed to enable wkupclk %d\n", ret); |
219 | goto err0; | ||
220 | } | ||
221 | |||
222 | if (!IS_ERR(phy->optclk)) { | ||
223 | ret = clk_enable(phy->optclk); | ||
224 | if (ret < 0) { | ||
225 | dev_err(phy->dev, "Failed to enable optclk %d\n", ret); | ||
226 | goto err1; | ||
227 | } | ||
228 | } | ||
229 | |||
230 | return 0; | ||
231 | |||
232 | err1: | ||
233 | clk_disable(phy->wkupclk); | ||
209 | 234 | ||
235 | err0: | ||
210 | return ret; | 236 | return ret; |
211 | } | 237 | } |
212 | 238 | ||