blob: 7c9b63064ea07e5308935ddfd5d4cef3504d512b [file] [log] [blame]
Richard Zhao15302802012-07-07 22:56:48 +08001/*
2 * Copyright 2012 Freescale Semiconductor, Inc.
3 * Copyright (C) 2012 Marek Vasut <marex@denx.de>
4 * on behalf of DENX Software Engineering GmbH
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14#include <linux/module.h>
15#include <linux/of_platform.h>
16#include <linux/of_gpio.h>
17#include <linux/platform_device.h>
18#include <linux/pm_runtime.h>
19#include <linux/dma-mapping.h>
20#include <linux/usb/chipidea.h>
21#include <linux/clk.h>
Richard Zhao15302802012-07-07 22:56:48 +080022
23#include "ci.h"
Alexander Shishkin8e229782013-06-24 14:46:36 +030024#include "ci_hdrc_imx.h"
Richard Zhao15302802012-07-07 22:56:48 +080025
Peter Chen10710552014-01-10 13:51:28 +080026struct ci_hdrc_imx_platform_flag {
27 unsigned int flags;
Peter Chene14db482015-02-11 12:44:47 +080028 bool runtime_pm;
Peter Chen10710552014-01-10 13:51:28 +080029};
30
31static const struct ci_hdrc_imx_platform_flag imx27_usb_data = {
Peter Chen0ef877a2014-10-30 11:10:04 +080032 CI_HDRC_DISABLE_STREAMING,
Peter Chen10710552014-01-10 13:51:28 +080033};
34
35static const struct ci_hdrc_imx_platform_flag imx28_usb_data = {
Li Jun6adb9b7b2015-02-11 12:45:01 +080036 .flags = CI_HDRC_IMX28_WRITE_FIX |
Peter Chen0ef877a2014-10-30 11:10:04 +080037 CI_HDRC_TURN_VBUS_EARLY_ON |
38 CI_HDRC_DISABLE_STREAMING,
Peter Chen10710552014-01-10 13:51:28 +080039};
40
Peter Chene14db482015-02-11 12:44:47 +080041static const struct ci_hdrc_imx_platform_flag imx6q_usb_data = {
Li Jun6adb9b7b2015-02-11 12:45:01 +080042 .flags = CI_HDRC_SUPPORTS_RUNTIME_PM |
Peter Chen0ef877a2014-10-30 11:10:04 +080043 CI_HDRC_TURN_VBUS_EARLY_ON |
44 CI_HDRC_DISABLE_STREAMING,
Peter Chene14db482015-02-11 12:44:47 +080045};
46
47static const struct ci_hdrc_imx_platform_flag imx6sl_usb_data = {
Li Jun6adb9b7b2015-02-11 12:45:01 +080048 .flags = CI_HDRC_SUPPORTS_RUNTIME_PM |
Peter Chen0ef877a2014-10-30 11:10:04 +080049 CI_HDRC_TURN_VBUS_EARLY_ON |
50 CI_HDRC_DISABLE_HOST_STREAMING,
Peter Chene14db482015-02-11 12:44:47 +080051};
52
53static const struct ci_hdrc_imx_platform_flag imx6sx_usb_data = {
Li Jun6adb9b7b2015-02-11 12:45:01 +080054 .flags = CI_HDRC_SUPPORTS_RUNTIME_PM |
Peter Chen0ef877a2014-10-30 11:10:04 +080055 CI_HDRC_TURN_VBUS_EARLY_ON |
56 CI_HDRC_DISABLE_HOST_STREAMING,
Peter Chene14db482015-02-11 12:44:47 +080057};
58
Peter Chen52fe5682015-09-16 15:52:32 +080059static const struct ci_hdrc_imx_platform_flag imx6ul_usb_data = {
60 .flags = CI_HDRC_SUPPORTS_RUNTIME_PM |
61 CI_HDRC_TURN_VBUS_EARLY_ON,
62};
63
Peter Chen5cb377c2015-09-09 16:33:02 +080064static const struct ci_hdrc_imx_platform_flag imx7d_usb_data = {
65 .flags = CI_HDRC_SUPPORTS_RUNTIME_PM,
66};
67
Peter Chen10710552014-01-10 13:51:28 +080068static const struct of_device_id ci_hdrc_imx_dt_ids[] = {
69 { .compatible = "fsl,imx28-usb", .data = &imx28_usb_data},
70 { .compatible = "fsl,imx27-usb", .data = &imx27_usb_data},
Peter Chene14db482015-02-11 12:44:47 +080071 { .compatible = "fsl,imx6q-usb", .data = &imx6q_usb_data},
72 { .compatible = "fsl,imx6sl-usb", .data = &imx6sl_usb_data},
Li Jun8315b772015-09-16 14:46:32 +080073 { .compatible = "fsl,imx6sx-usb", .data = &imx6sx_usb_data},
Peter Chen52fe5682015-09-16 15:52:32 +080074 { .compatible = "fsl,imx6ul-usb", .data = &imx6ul_usb_data},
Peter Chen5cb377c2015-09-09 16:33:02 +080075 { .compatible = "fsl,imx7d-usb", .data = &imx7d_usb_data},
Peter Chen10710552014-01-10 13:51:28 +080076 { /* sentinel */ }
77};
78MODULE_DEVICE_TABLE(of, ci_hdrc_imx_dt_ids);
79
Alexander Shishkin8e229782013-06-24 14:46:36 +030080struct ci_hdrc_imx_data {
Richard Zhao15302802012-07-07 22:56:48 +080081 struct usb_phy *phy;
82 struct platform_device *ci_pdev;
83 struct clk *clk;
Sascha Hauer05986ba2013-08-14 12:44:16 +030084 struct imx_usbmisc_data *usbmisc_data;
Peter Chene14db482015-02-11 12:44:47 +080085 bool supports_runtime_pm;
86 bool in_lpm;
Peter Chenae3e57a2015-09-16 09:40:51 +080087 /* SoC before i.mx6 (except imx23/imx28) needs three clks */
88 bool need_three_clks;
89 struct clk *clk_ipg;
90 struct clk *clk_ahb;
91 struct clk *clk_per;
92 /* --------------------------------- */
Richard Zhao15302802012-07-07 22:56:48 +080093};
94
Richard Zhaod142d6b2012-09-12 14:58:05 +030095/* Common functions shared by usbmisc drivers */
96
Sascha Hauer05986ba2013-08-14 12:44:16 +030097static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev)
Richard Zhaod142d6b2012-09-12 14:58:05 +030098{
Stefan Agnerf40017e2014-09-22 08:14:15 +080099 struct platform_device *misc_pdev;
Richard Zhaod142d6b2012-09-12 14:58:05 +0300100 struct device_node *np = dev->of_node;
101 struct of_phandle_args args;
Sascha Hauer05986ba2013-08-14 12:44:16 +0300102 struct imx_usbmisc_data *data;
Richard Zhaod142d6b2012-09-12 14:58:05 +0300103 int ret;
104
Sascha Hauer05986ba2013-08-14 12:44:16 +0300105 /*
106 * In case the fsl,usbmisc property is not present this device doesn't
107 * need usbmisc. Return NULL (which is no error here)
108 */
109 if (!of_get_property(np, "fsl,usbmisc", NULL))
110 return NULL;
111
112 data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
113 if (!data)
114 return ERR_PTR(-ENOMEM);
Richard Zhaod142d6b2012-09-12 14:58:05 +0300115
116 ret = of_parse_phandle_with_args(np, "fsl,usbmisc", "#index-cells",
117 0, &args);
118 if (ret) {
119 dev_err(dev, "Failed to parse property fsl,usbmisc, errno %d\n",
120 ret);
Sascha Hauer05986ba2013-08-14 12:44:16 +0300121 return ERR_PTR(ret);
Richard Zhaod142d6b2012-09-12 14:58:05 +0300122 }
Sascha Hauer05986ba2013-08-14 12:44:16 +0300123
124 data->index = args.args[0];
Stefan Agnerf40017e2014-09-22 08:14:15 +0800125
126 misc_pdev = of_find_device_by_node(args.np);
Richard Zhaod142d6b2012-09-12 14:58:05 +0300127 of_node_put(args.np);
128
Tomeu Vizosoef12da92015-08-06 15:09:54 +0200129 if (!misc_pdev || !platform_get_drvdata(misc_pdev))
Stefan Agnerf40017e2014-09-22 08:14:15 +0800130 return ERR_PTR(-EPROBE_DEFER);
131
132 data->dev = &misc_pdev->dev;
133
Richard Zhaod142d6b2012-09-12 14:58:05 +0300134 if (of_find_property(np, "disable-over-current", NULL))
Sascha Hauer05986ba2013-08-14 12:44:16 +0300135 data->disable_oc = 1;
Richard Zhaod142d6b2012-09-12 14:58:05 +0300136
Michael Grzeschika0685332013-03-30 12:54:01 +0200137 if (of_find_property(np, "external-vbus-divider", NULL))
Sascha Hauer05986ba2013-08-14 12:44:16 +0300138 data->evdo = 1;
Michael Grzeschika0685332013-03-30 12:54:01 +0200139
Sascha Hauer05986ba2013-08-14 12:44:16 +0300140 return data;
Richard Zhaod142d6b2012-09-12 14:58:05 +0300141}
Richard Zhaod142d6b2012-09-12 14:58:05 +0300142
143/* End of common functions shared by usbmisc drivers*/
Peter Chenae3e57a2015-09-16 09:40:51 +0800144static int imx_get_clks(struct device *dev)
145{
146 struct ci_hdrc_imx_data *data = dev_get_drvdata(dev);
147 int ret = 0;
148
149 data->clk_ipg = devm_clk_get(dev, "ipg");
150 if (IS_ERR(data->clk_ipg)) {
151 /* If the platform only needs one clocks */
152 data->clk = devm_clk_get(dev, NULL);
153 if (IS_ERR(data->clk)) {
154 ret = PTR_ERR(data->clk);
155 dev_err(dev,
156 "Failed to get clks, err=%ld,%ld\n",
157 PTR_ERR(data->clk), PTR_ERR(data->clk_ipg));
158 return ret;
159 }
160 return ret;
161 }
162
163 data->clk_ahb = devm_clk_get(dev, "ahb");
164 if (IS_ERR(data->clk_ahb)) {
165 ret = PTR_ERR(data->clk_ahb);
166 dev_err(dev,
167 "Failed to get ahb clock, err=%d\n", ret);
168 return ret;
169 }
170
171 data->clk_per = devm_clk_get(dev, "per");
172 if (IS_ERR(data->clk_per)) {
173 ret = PTR_ERR(data->clk_per);
174 dev_err(dev,
175 "Failed to get per clock, err=%d\n", ret);
176 return ret;
177 }
178
179 data->need_three_clks = true;
180 return ret;
181}
182
183static int imx_prepare_enable_clks(struct device *dev)
184{
185 struct ci_hdrc_imx_data *data = dev_get_drvdata(dev);
186 int ret = 0;
187
188 if (data->need_three_clks) {
189 ret = clk_prepare_enable(data->clk_ipg);
190 if (ret) {
191 dev_err(dev,
192 "Failed to prepare/enable ipg clk, err=%d\n",
193 ret);
194 return ret;
195 }
196
197 ret = clk_prepare_enable(data->clk_ahb);
198 if (ret) {
199 dev_err(dev,
200 "Failed to prepare/enable ahb clk, err=%d\n",
201 ret);
202 clk_disable_unprepare(data->clk_ipg);
203 return ret;
204 }
205
206 ret = clk_prepare_enable(data->clk_per);
207 if (ret) {
208 dev_err(dev,
209 "Failed to prepare/enable per clk, err=%d\n",
210 ret);
211 clk_disable_unprepare(data->clk_ahb);
212 clk_disable_unprepare(data->clk_ipg);
213 return ret;
214 }
215 } else {
216 ret = clk_prepare_enable(data->clk);
217 if (ret) {
218 dev_err(dev,
219 "Failed to prepare/enable clk, err=%d\n",
220 ret);
221 return ret;
222 }
223 }
224
225 return ret;
226}
227
228static void imx_disable_unprepare_clks(struct device *dev)
229{
230 struct ci_hdrc_imx_data *data = dev_get_drvdata(dev);
231
232 if (data->need_three_clks) {
233 clk_disable_unprepare(data->clk_per);
234 clk_disable_unprepare(data->clk_ahb);
235 clk_disable_unprepare(data->clk_ipg);
236 } else {
237 clk_disable_unprepare(data->clk);
238 }
239}
Richard Zhaod142d6b2012-09-12 14:58:05 +0300240
Alexander Shishkin8e229782013-06-24 14:46:36 +0300241static int ci_hdrc_imx_probe(struct platform_device *pdev)
Richard Zhao15302802012-07-07 22:56:48 +0800242{
Alexander Shishkin8e229782013-06-24 14:46:36 +0300243 struct ci_hdrc_imx_data *data;
244 struct ci_hdrc_platform_data pdata = {
Alexander Shiyanc844d6c2014-03-11 13:47:38 +0800245 .name = dev_name(&pdev->dev),
Michael Grzeschikf6a3b3a2013-06-13 17:59:58 +0300246 .capoffset = DEF_CAPOFFSET,
Peter Chen0ef877a2014-10-30 11:10:04 +0800247 .flags = CI_HDRC_SET_NON_ZERO_TTHA,
Michael Grzeschikf6a3b3a2013-06-13 17:59:58 +0300248 };
Richard Zhao15302802012-07-07 22:56:48 +0800249 int ret;
Peter Chen10710552014-01-10 13:51:28 +0800250 const struct of_device_id *of_id =
251 of_match_device(ci_hdrc_imx_dt_ids, &pdev->dev);
252 const struct ci_hdrc_imx_platform_flag *imx_platform_flag = of_id->data;
Richard Zhao15302802012-07-07 22:56:48 +0800253
254 data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
Fabio Estevam73529822014-11-26 13:44:24 +0800255 if (!data)
Richard Zhao15302802012-07-07 22:56:48 +0800256 return -ENOMEM;
Richard Zhao15302802012-07-07 22:56:48 +0800257
Peter Chenae3e57a2015-09-16 09:40:51 +0800258 platform_set_drvdata(pdev, data);
Sascha Hauer05986ba2013-08-14 12:44:16 +0300259 data->usbmisc_data = usbmisc_get_init_data(&pdev->dev);
260 if (IS_ERR(data->usbmisc_data))
261 return PTR_ERR(data->usbmisc_data);
262
Peter Chenae3e57a2015-09-16 09:40:51 +0800263 ret = imx_get_clks(&pdev->dev);
264 if (ret)
Richard Zhao15302802012-07-07 22:56:48 +0800265 return ret;
Peter Chenae3e57a2015-09-16 09:40:51 +0800266
267 ret = imx_prepare_enable_clks(&pdev->dev);
268 if (ret)
269 return ret;
Richard Zhao15302802012-07-07 22:56:48 +0800270
Fabio Estevam046916d2013-06-25 12:58:05 +0300271 data->phy = devm_usb_get_phy_by_phandle(&pdev->dev, "fsl,usbphy", 0);
Peter Chenaf59a8b2013-09-24 12:47:54 +0800272 if (IS_ERR(data->phy)) {
273 ret = PTR_ERR(data->phy);
Markus Pargmann16853d72014-07-22 10:09:43 +0800274 /* Return -EINVAL if no usbphy is available */
275 if (ret == -ENODEV)
276 ret = -EINVAL;
Sascha Hauerea1418b2013-06-13 18:00:00 +0300277 goto err_clk;
Richard Zhao15302802012-07-07 22:56:48 +0800278 }
279
Antoine Tenartef44cb42014-10-30 18:41:16 +0100280 pdata.usb_phy = data->phy;
Peter Chen56040082015-02-11 12:44:42 +0800281 pdata.flags |= imx_platform_flag->flags;
Peter Chene14db482015-02-11 12:44:47 +0800282 if (pdata.flags & CI_HDRC_SUPPORTS_RUNTIME_PM)
283 data->supports_runtime_pm = true;
Peter Chen10710552014-01-10 13:51:28 +0800284
Russell Kinge1fd7342013-06-27 12:36:37 +0100285 ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
Russell King22d9d8e2013-06-10 16:28:49 +0100286 if (ret)
287 goto err_clk;
Richard Zhaod142d6b2012-09-12 14:58:05 +0300288
Peter Chena4cf1b12015-02-11 12:44:44 +0800289 ret = imx_usbmisc_init(data->usbmisc_data);
290 if (ret) {
291 dev_err(&pdev->dev, "usbmisc init failed, ret=%d\n", ret);
292 goto err_clk;
Richard Zhaod142d6b2012-09-12 14:58:05 +0300293 }
294
Alexander Shishkin8e229782013-06-24 14:46:36 +0300295 data->ci_pdev = ci_hdrc_add_device(&pdev->dev,
Richard Zhao15302802012-07-07 22:56:48 +0800296 pdev->resource, pdev->num_resources,
Michael Grzeschikf6a3b3a2013-06-13 17:59:58 +0300297 &pdata);
Fabio Estevam770719d2013-06-13 17:59:48 +0300298 if (IS_ERR(data->ci_pdev)) {
299 ret = PTR_ERR(data->ci_pdev);
Richard Zhao15302802012-07-07 22:56:48 +0800300 dev_err(&pdev->dev,
301 "Can't register ci_hdrc platform device, err=%d\n",
302 ret);
Peter Chenaf59a8b2013-09-24 12:47:54 +0800303 goto err_clk;
Richard Zhao15302802012-07-07 22:56:48 +0800304 }
305
Peter Chena4cf1b12015-02-11 12:44:44 +0800306 ret = imx_usbmisc_init_post(data->usbmisc_data);
307 if (ret) {
308 dev_err(&pdev->dev, "usbmisc post failed, ret=%d\n", ret);
309 goto disable_device;
Michael Grzeschika0685332013-03-30 12:54:01 +0200310 }
311
Peter Chene14db482015-02-11 12:44:47 +0800312 if (data->supports_runtime_pm) {
313 pm_runtime_set_active(&pdev->dev);
314 pm_runtime_enable(&pdev->dev);
315 }
Richard Zhao15302802012-07-07 22:56:48 +0800316
Peter Chen6d653112015-02-11 12:44:49 +0800317 device_set_wakeup_capable(&pdev->dev, true);
318
Richard Zhao15302802012-07-07 22:56:48 +0800319 return 0;
320
Fabio Estevam770719d2013-06-13 17:59:48 +0300321disable_device:
Alexander Shishkin8e229782013-06-24 14:46:36 +0300322 ci_hdrc_remove_device(data->ci_pdev);
Sascha Hauerea1418b2013-06-13 18:00:00 +0300323err_clk:
Peter Chenae3e57a2015-09-16 09:40:51 +0800324 imx_disable_unprepare_clks(&pdev->dev);
Richard Zhao15302802012-07-07 22:56:48 +0800325 return ret;
326}
327
Alexander Shishkin8e229782013-06-24 14:46:36 +0300328static int ci_hdrc_imx_remove(struct platform_device *pdev)
Richard Zhao15302802012-07-07 22:56:48 +0800329{
Alexander Shishkin8e229782013-06-24 14:46:36 +0300330 struct ci_hdrc_imx_data *data = platform_get_drvdata(pdev);
Richard Zhao15302802012-07-07 22:56:48 +0800331
Peter Chene14db482015-02-11 12:44:47 +0800332 if (data->supports_runtime_pm) {
333 pm_runtime_get_sync(&pdev->dev);
334 pm_runtime_disable(&pdev->dev);
335 pm_runtime_put_noidle(&pdev->dev);
336 }
Alexander Shishkin8e229782013-06-24 14:46:36 +0300337 ci_hdrc_remove_device(data->ci_pdev);
Peter Chenae3e57a2015-09-16 09:40:51 +0800338 imx_disable_unprepare_clks(&pdev->dev);
Richard Zhao15302802012-07-07 22:56:48 +0800339
Richard Zhao15302802012-07-07 22:56:48 +0800340 return 0;
341}
342
Peter Chene14db482015-02-11 12:44:47 +0800343#ifdef CONFIG_PM
Peter Chen2558c1f2014-11-26 13:44:30 +0800344static int imx_controller_suspend(struct device *dev)
345{
346 struct ci_hdrc_imx_data *data = dev_get_drvdata(dev);
347
348 dev_dbg(dev, "at %s\n", __func__);
349
Peter Chenae3e57a2015-09-16 09:40:51 +0800350 imx_disable_unprepare_clks(dev);
Peter Chene14db482015-02-11 12:44:47 +0800351 data->in_lpm = true;
Peter Chen2558c1f2014-11-26 13:44:30 +0800352
353 return 0;
354}
355
356static int imx_controller_resume(struct device *dev)
357{
358 struct ci_hdrc_imx_data *data = dev_get_drvdata(dev);
Peter Chene14db482015-02-11 12:44:47 +0800359 int ret = 0;
Peter Chen2558c1f2014-11-26 13:44:30 +0800360
361 dev_dbg(dev, "at %s\n", __func__);
362
Peter Chene14db482015-02-11 12:44:47 +0800363 if (!data->in_lpm) {
364 WARN_ON(1);
365 return 0;
366 }
367
Peter Chenae3e57a2015-09-16 09:40:51 +0800368 ret = imx_prepare_enable_clks(dev);
Peter Chene14db482015-02-11 12:44:47 +0800369 if (ret)
370 return ret;
371
372 data->in_lpm = false;
373
374 ret = imx_usbmisc_set_wakeup(data->usbmisc_data, false);
375 if (ret) {
376 dev_err(dev, "usbmisc set_wakeup failed, ret=%d\n", ret);
377 goto clk_disable;
378 }
379
380 return 0;
381
382clk_disable:
Peter Chenae3e57a2015-09-16 09:40:51 +0800383 imx_disable_unprepare_clks(dev);
Peter Chene14db482015-02-11 12:44:47 +0800384 return ret;
Peter Chen2558c1f2014-11-26 13:44:30 +0800385}
386
Peter Chene14db482015-02-11 12:44:47 +0800387#ifdef CONFIG_PM_SLEEP
Peter Chen2558c1f2014-11-26 13:44:30 +0800388static int ci_hdrc_imx_suspend(struct device *dev)
389{
Peter Chen6d653112015-02-11 12:44:49 +0800390 int ret;
391
Peter Chene14db482015-02-11 12:44:47 +0800392 struct ci_hdrc_imx_data *data = dev_get_drvdata(dev);
393
394 if (data->in_lpm)
395 /* The core's suspend doesn't run */
396 return 0;
397
Peter Chen6d653112015-02-11 12:44:49 +0800398 if (device_may_wakeup(dev)) {
399 ret = imx_usbmisc_set_wakeup(data->usbmisc_data, true);
400 if (ret) {
401 dev_err(dev, "usbmisc set_wakeup failed, ret=%d\n",
402 ret);
403 return ret;
404 }
405 }
406
Peter Chen2558c1f2014-11-26 13:44:30 +0800407 return imx_controller_suspend(dev);
408}
409
410static int ci_hdrc_imx_resume(struct device *dev)
411{
Peter Chene14db482015-02-11 12:44:47 +0800412 struct ci_hdrc_imx_data *data = dev_get_drvdata(dev);
413 int ret;
414
415 ret = imx_controller_resume(dev);
416 if (!ret && data->supports_runtime_pm) {
417 pm_runtime_disable(dev);
418 pm_runtime_set_active(dev);
419 pm_runtime_enable(dev);
420 }
421
422 return ret;
Peter Chen2558c1f2014-11-26 13:44:30 +0800423}
424#endif /* CONFIG_PM_SLEEP */
425
Peter Chene14db482015-02-11 12:44:47 +0800426static int ci_hdrc_imx_runtime_suspend(struct device *dev)
427{
428 struct ci_hdrc_imx_data *data = dev_get_drvdata(dev);
429 int ret;
430
431 if (data->in_lpm) {
432 WARN_ON(1);
433 return 0;
434 }
435
436 ret = imx_usbmisc_set_wakeup(data->usbmisc_data, true);
437 if (ret) {
438 dev_err(dev, "usbmisc set_wakeup failed, ret=%d\n", ret);
439 return ret;
440 }
441
442 return imx_controller_suspend(dev);
443}
444
445static int ci_hdrc_imx_runtime_resume(struct device *dev)
446{
447 return imx_controller_resume(dev);
448}
449
450#endif /* CONFIG_PM */
451
Peter Chen2558c1f2014-11-26 13:44:30 +0800452static const struct dev_pm_ops ci_hdrc_imx_pm_ops = {
453 SET_SYSTEM_SLEEP_PM_OPS(ci_hdrc_imx_suspend, ci_hdrc_imx_resume)
Peter Chene14db482015-02-11 12:44:47 +0800454 SET_RUNTIME_PM_OPS(ci_hdrc_imx_runtime_suspend,
455 ci_hdrc_imx_runtime_resume, NULL)
Peter Chen2558c1f2014-11-26 13:44:30 +0800456};
Alexander Shishkin8e229782013-06-24 14:46:36 +0300457static struct platform_driver ci_hdrc_imx_driver = {
458 .probe = ci_hdrc_imx_probe,
459 .remove = ci_hdrc_imx_remove,
Richard Zhao15302802012-07-07 22:56:48 +0800460 .driver = {
461 .name = "imx_usb",
Alexander Shishkin8e229782013-06-24 14:46:36 +0300462 .of_match_table = ci_hdrc_imx_dt_ids,
Peter Chen2558c1f2014-11-26 13:44:30 +0800463 .pm = &ci_hdrc_imx_pm_ops,
Richard Zhao15302802012-07-07 22:56:48 +0800464 },
465};
466
Alexander Shishkin8e229782013-06-24 14:46:36 +0300467module_platform_driver(ci_hdrc_imx_driver);
Richard Zhao15302802012-07-07 22:56:48 +0800468
469MODULE_ALIAS("platform:imx-usb");
470MODULE_LICENSE("GPL v2");
Alexander Shishkin8e229782013-06-24 14:46:36 +0300471MODULE_DESCRIPTION("CI HDRC i.MX USB binding");
Richard Zhao15302802012-07-07 22:56:48 +0800472MODULE_AUTHOR("Marek Vasut <marex@denx.de>");
473MODULE_AUTHOR("Richard Zhao <richard.zhao@freescale.com>");