1 // SPDX-License-Identifier: GPL-2.0+ 2 /* 3 * Copyright 2012 Freescale Semiconductor, Inc. 4 * Copyright (C) 2012 Marek Vasut <marex@denx.de> 5 * on behalf of DENX Software Engineering GmbH 6 */ 7 8 #include <linux/module.h> 9 #include <linux/of_platform.h> 10 #include <linux/platform_device.h> 11 #include <linux/pm_runtime.h> 12 #include <linux/usb/chipidea.h> 13 #include <linux/usb/of.h> 14 #include <linux/clk.h> 15 #include <linux/pinctrl/consumer.h> 16 #include <linux/pm_qos.h> 17 18 #include "ci.h" 19 #include "ci_hdrc_imx.h" 20 21 struct ci_hdrc_imx_platform_flag { 22 unsigned int flags; 23 }; 24 25 static const struct ci_hdrc_imx_platform_flag imx23_usb_data = { 26 .flags = CI_HDRC_TURN_VBUS_EARLY_ON | 27 CI_HDRC_DISABLE_STREAMING, 28 }; 29 30 static const struct ci_hdrc_imx_platform_flag imx27_usb_data = { 31 .flags = CI_HDRC_DISABLE_STREAMING, 32 }; 33 34 static const struct ci_hdrc_imx_platform_flag imx28_usb_data = { 35 .flags = CI_HDRC_IMX28_WRITE_FIX | 36 CI_HDRC_TURN_VBUS_EARLY_ON | 37 CI_HDRC_DISABLE_STREAMING, 38 }; 39 40 static const struct ci_hdrc_imx_platform_flag imx6q_usb_data = { 41 .flags = CI_HDRC_SUPPORTS_RUNTIME_PM | 42 CI_HDRC_TURN_VBUS_EARLY_ON | 43 CI_HDRC_DISABLE_STREAMING, 44 }; 45 46 static const struct ci_hdrc_imx_platform_flag imx6sl_usb_data = { 47 .flags = CI_HDRC_SUPPORTS_RUNTIME_PM | 48 CI_HDRC_TURN_VBUS_EARLY_ON | 49 CI_HDRC_DISABLE_HOST_STREAMING, 50 }; 51 52 static const struct ci_hdrc_imx_platform_flag imx6sx_usb_data = { 53 .flags = CI_HDRC_SUPPORTS_RUNTIME_PM | 54 CI_HDRC_TURN_VBUS_EARLY_ON | 55 CI_HDRC_DISABLE_HOST_STREAMING, 56 }; 57 58 static const struct ci_hdrc_imx_platform_flag imx6ul_usb_data = { 59 .flags = CI_HDRC_SUPPORTS_RUNTIME_PM | 60 CI_HDRC_TURN_VBUS_EARLY_ON, 61 }; 62 63 static const struct ci_hdrc_imx_platform_flag imx7d_usb_data = { 64 .flags = CI_HDRC_SUPPORTS_RUNTIME_PM, 65 }; 66 67 static const struct ci_hdrc_imx_platform_flag imx7ulp_usb_data = { 68 .flags = CI_HDRC_SUPPORTS_RUNTIME_PM | 69 CI_HDRC_PMQOS, 70 }; 71 72 static const struct of_device_id ci_hdrc_imx_dt_ids[] = { 73 { .compatible = "fsl,imx23-usb", .data = &imx23_usb_data}, 74 { .compatible = "fsl,imx28-usb", .data = &imx28_usb_data}, 75 { .compatible = "fsl,imx27-usb", .data = &imx27_usb_data}, 76 { .compatible = "fsl,imx6q-usb", .data = &imx6q_usb_data}, 77 { .compatible = "fsl,imx6sl-usb", .data = &imx6sl_usb_data}, 78 { .compatible = "fsl,imx6sx-usb", .data = &imx6sx_usb_data}, 79 { .compatible = "fsl,imx6ul-usb", .data = &imx6ul_usb_data}, 80 { .compatible = "fsl,imx7d-usb", .data = &imx7d_usb_data}, 81 { .compatible = "fsl,imx7ulp-usb", .data = &imx7ulp_usb_data}, 82 { /* sentinel */ } 83 }; 84 MODULE_DEVICE_TABLE(of, ci_hdrc_imx_dt_ids); 85 86 struct ci_hdrc_imx_data { 87 struct usb_phy *phy; 88 struct platform_device *ci_pdev; 89 struct clk *clk; 90 struct imx_usbmisc_data *usbmisc_data; 91 bool supports_runtime_pm; 92 bool override_phy_control; 93 bool in_lpm; 94 struct pinctrl *pinctrl; 95 struct pinctrl_state *pinctrl_hsic_active; 96 struct regulator *hsic_pad_regulator; 97 /* SoC before i.mx6 (except imx23/imx28) needs three clks */ 98 bool need_three_clks; 99 struct clk *clk_ipg; 100 struct clk *clk_ahb; 101 struct clk *clk_per; 102 /* --------------------------------- */ 103 struct pm_qos_request pm_qos_req; 104 const struct ci_hdrc_imx_platform_flag *plat_data; 105 }; 106 107 /* Common functions shared by usbmisc drivers */ 108 109 static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev) 110 { 111 struct platform_device *misc_pdev; 112 struct device_node *np = dev->of_node; 113 struct of_phandle_args args; 114 struct imx_usbmisc_data *data; 115 int ret; 116 117 /* 118 * In case the fsl,usbmisc property is not present this device doesn't 119 * need usbmisc. Return NULL (which is no error here) 120 */ 121 if (!of_get_property(np, "fsl,usbmisc", NULL)) 122 return NULL; 123 124 data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); 125 if (!data) 126 return ERR_PTR(-ENOMEM); 127 128 ret = of_parse_phandle_with_args(np, "fsl,usbmisc", "#index-cells", 129 0, &args); 130 if (ret) { 131 dev_err(dev, "Failed to parse property fsl,usbmisc, errno %d\n", 132 ret); 133 return ERR_PTR(ret); 134 } 135 136 data->index = args.args[0]; 137 138 misc_pdev = of_find_device_by_node(args.np); 139 of_node_put(args.np); 140 141 if (!misc_pdev || !platform_get_drvdata(misc_pdev)) 142 return ERR_PTR(-EPROBE_DEFER); 143 144 data->dev = &misc_pdev->dev; 145 146 /* 147 * Check the various over current related properties. If over current 148 * detection is disabled we're not interested in the polarity. 149 */ 150 if (of_find_property(np, "disable-over-current", NULL)) { 151 data->disable_oc = 1; 152 } else if (of_find_property(np, "over-current-active-high", NULL)) { 153 data->oc_pol_active_low = 0; 154 data->oc_pol_configured = 1; 155 } else if (of_find_property(np, "over-current-active-low", NULL)) { 156 data->oc_pol_active_low = 1; 157 data->oc_pol_configured = 1; 158 } else { 159 dev_warn(dev, "No over current polarity defined\n"); 160 } 161 162 data->pwr_pol = of_property_read_bool(np, "power-active-high"); 163 data->evdo = of_property_read_bool(np, "external-vbus-divider"); 164 165 if (of_usb_get_phy_mode(np) == USBPHY_INTERFACE_MODE_ULPI) 166 data->ulpi = 1; 167 168 of_property_read_u32(np, "samsung,picophy-pre-emp-curr-control", 169 &data->emp_curr_control); 170 of_property_read_u32(np, "samsung,picophy-dc-vol-level-adjust", 171 &data->dc_vol_level_adjust); 172 173 return data; 174 } 175 176 /* End of common functions shared by usbmisc drivers*/ 177 static int imx_get_clks(struct device *dev) 178 { 179 struct ci_hdrc_imx_data *data = dev_get_drvdata(dev); 180 int ret = 0; 181 182 data->clk_ipg = devm_clk_get(dev, "ipg"); 183 if (IS_ERR(data->clk_ipg)) { 184 /* If the platform only needs one clocks */ 185 data->clk = devm_clk_get(dev, NULL); 186 if (IS_ERR(data->clk)) { 187 ret = PTR_ERR(data->clk); 188 dev_err(dev, 189 "Failed to get clks, err=%ld,%ld\n", 190 PTR_ERR(data->clk), PTR_ERR(data->clk_ipg)); 191 return ret; 192 } 193 return ret; 194 } 195 196 data->clk_ahb = devm_clk_get(dev, "ahb"); 197 if (IS_ERR(data->clk_ahb)) { 198 ret = PTR_ERR(data->clk_ahb); 199 dev_err(dev, 200 "Failed to get ahb clock, err=%d\n", ret); 201 return ret; 202 } 203 204 data->clk_per = devm_clk_get(dev, "per"); 205 if (IS_ERR(data->clk_per)) { 206 ret = PTR_ERR(data->clk_per); 207 dev_err(dev, 208 "Failed to get per clock, err=%d\n", ret); 209 return ret; 210 } 211 212 data->need_three_clks = true; 213 return ret; 214 } 215 216 static int imx_prepare_enable_clks(struct device *dev) 217 { 218 struct ci_hdrc_imx_data *data = dev_get_drvdata(dev); 219 int ret = 0; 220 221 if (data->need_three_clks) { 222 ret = clk_prepare_enable(data->clk_ipg); 223 if (ret) { 224 dev_err(dev, 225 "Failed to prepare/enable ipg clk, err=%d\n", 226 ret); 227 return ret; 228 } 229 230 ret = clk_prepare_enable(data->clk_ahb); 231 if (ret) { 232 dev_err(dev, 233 "Failed to prepare/enable ahb clk, err=%d\n", 234 ret); 235 clk_disable_unprepare(data->clk_ipg); 236 return ret; 237 } 238 239 ret = clk_prepare_enable(data->clk_per); 240 if (ret) { 241 dev_err(dev, 242 "Failed to prepare/enable per clk, err=%d\n", 243 ret); 244 clk_disable_unprepare(data->clk_ahb); 245 clk_disable_unprepare(data->clk_ipg); 246 return ret; 247 } 248 } else { 249 ret = clk_prepare_enable(data->clk); 250 if (ret) { 251 dev_err(dev, 252 "Failed to prepare/enable clk, err=%d\n", 253 ret); 254 return ret; 255 } 256 } 257 258 return ret; 259 } 260 261 static void imx_disable_unprepare_clks(struct device *dev) 262 { 263 struct ci_hdrc_imx_data *data = dev_get_drvdata(dev); 264 265 if (data->need_three_clks) { 266 clk_disable_unprepare(data->clk_per); 267 clk_disable_unprepare(data->clk_ahb); 268 clk_disable_unprepare(data->clk_ipg); 269 } else { 270 clk_disable_unprepare(data->clk); 271 } 272 } 273 274 static int ci_hdrc_imx_notify_event(struct ci_hdrc *ci, unsigned int event) 275 { 276 struct device *dev = ci->dev->parent; 277 struct ci_hdrc_imx_data *data = dev_get_drvdata(dev); 278 int ret = 0; 279 struct imx_usbmisc_data *mdata = data->usbmisc_data; 280 281 switch (event) { 282 case CI_HDRC_IMX_HSIC_ACTIVE_EVENT: 283 if (data->pinctrl) { 284 ret = pinctrl_select_state(data->pinctrl, 285 data->pinctrl_hsic_active); 286 if (ret) 287 dev_err(dev, 288 "hsic_active select failed, err=%d\n", 289 ret); 290 } 291 break; 292 case CI_HDRC_IMX_HSIC_SUSPEND_EVENT: 293 ret = imx_usbmisc_hsic_set_connect(mdata); 294 if (ret) 295 dev_err(dev, 296 "hsic_set_connect failed, err=%d\n", ret); 297 break; 298 case CI_HDRC_CONTROLLER_VBUS_EVENT: 299 if (ci->vbus_active) 300 ret = imx_usbmisc_charger_detection(mdata, true); 301 else 302 ret = imx_usbmisc_charger_detection(mdata, false); 303 if (ci->usb_phy) 304 schedule_work(&ci->usb_phy->chg_work); 305 break; 306 default: 307 break; 308 } 309 310 return ret; 311 } 312 313 static int ci_hdrc_imx_probe(struct platform_device *pdev) 314 { 315 struct ci_hdrc_imx_data *data; 316 struct ci_hdrc_platform_data pdata = { 317 .name = dev_name(&pdev->dev), 318 .capoffset = DEF_CAPOFFSET, 319 .notify_event = ci_hdrc_imx_notify_event, 320 }; 321 int ret; 322 const struct of_device_id *of_id; 323 const struct ci_hdrc_imx_platform_flag *imx_platform_flag; 324 struct device_node *np = pdev->dev.of_node; 325 struct device *dev = &pdev->dev; 326 327 of_id = of_match_device(ci_hdrc_imx_dt_ids, dev); 328 if (!of_id) 329 return -ENODEV; 330 331 imx_platform_flag = of_id->data; 332 333 data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); 334 if (!data) 335 return -ENOMEM; 336 337 data->plat_data = imx_platform_flag; 338 pdata.flags |= imx_platform_flag->flags; 339 platform_set_drvdata(pdev, data); 340 data->usbmisc_data = usbmisc_get_init_data(dev); 341 if (IS_ERR(data->usbmisc_data)) 342 return PTR_ERR(data->usbmisc_data); 343 344 if ((of_usb_get_phy_mode(dev->of_node) == USBPHY_INTERFACE_MODE_HSIC) 345 && data->usbmisc_data) { 346 pdata.flags |= CI_HDRC_IMX_IS_HSIC; 347 data->usbmisc_data->hsic = 1; 348 data->pinctrl = devm_pinctrl_get(dev); 349 if (PTR_ERR(data->pinctrl) == -ENODEV) 350 data->pinctrl = NULL; 351 else if (IS_ERR(data->pinctrl)) { 352 if (PTR_ERR(data->pinctrl) != -EPROBE_DEFER) 353 dev_err(dev, "pinctrl get failed, err=%ld\n", 354 PTR_ERR(data->pinctrl)); 355 return PTR_ERR(data->pinctrl); 356 } 357 358 data->hsic_pad_regulator = 359 devm_regulator_get_optional(dev, "hsic"); 360 if (PTR_ERR(data->hsic_pad_regulator) == -ENODEV) { 361 /* no pad regualator is needed */ 362 data->hsic_pad_regulator = NULL; 363 } else if (IS_ERR(data->hsic_pad_regulator)) { 364 if (PTR_ERR(data->hsic_pad_regulator) != -EPROBE_DEFER) 365 dev_err(dev, 366 "Get HSIC pad regulator error: %ld\n", 367 PTR_ERR(data->hsic_pad_regulator)); 368 return PTR_ERR(data->hsic_pad_regulator); 369 } 370 371 if (data->hsic_pad_regulator) { 372 ret = regulator_enable(data->hsic_pad_regulator); 373 if (ret) { 374 dev_err(dev, 375 "Failed to enable HSIC pad regulator\n"); 376 return ret; 377 } 378 } 379 } 380 381 /* HSIC pinctrl handling */ 382 if (data->pinctrl) { 383 struct pinctrl_state *pinctrl_hsic_idle; 384 385 pinctrl_hsic_idle = pinctrl_lookup_state(data->pinctrl, "idle"); 386 if (IS_ERR(pinctrl_hsic_idle)) { 387 dev_err(dev, 388 "pinctrl_hsic_idle lookup failed, err=%ld\n", 389 PTR_ERR(pinctrl_hsic_idle)); 390 return PTR_ERR(pinctrl_hsic_idle); 391 } 392 393 ret = pinctrl_select_state(data->pinctrl, pinctrl_hsic_idle); 394 if (ret) { 395 dev_err(dev, "hsic_idle select failed, err=%d\n", ret); 396 return ret; 397 } 398 399 data->pinctrl_hsic_active = pinctrl_lookup_state(data->pinctrl, 400 "active"); 401 if (IS_ERR(data->pinctrl_hsic_active)) { 402 dev_err(dev, 403 "pinctrl_hsic_active lookup failed, err=%ld\n", 404 PTR_ERR(data->pinctrl_hsic_active)); 405 return PTR_ERR(data->pinctrl_hsic_active); 406 } 407 } 408 409 if (pdata.flags & CI_HDRC_PMQOS) 410 cpu_latency_qos_add_request(&data->pm_qos_req, 0); 411 412 ret = imx_get_clks(dev); 413 if (ret) 414 goto disable_hsic_regulator; 415 416 ret = imx_prepare_enable_clks(dev); 417 if (ret) 418 goto disable_hsic_regulator; 419 420 data->phy = devm_usb_get_phy_by_phandle(dev, "fsl,usbphy", 0); 421 if (IS_ERR(data->phy)) { 422 ret = PTR_ERR(data->phy); 423 /* Return -EINVAL if no usbphy is available */ 424 if (ret == -ENODEV) 425 data->phy = NULL; 426 else 427 goto err_clk; 428 } 429 430 pdata.usb_phy = data->phy; 431 if (data->usbmisc_data) 432 data->usbmisc_data->usb_phy = data->phy; 433 434 if ((of_device_is_compatible(np, "fsl,imx53-usb") || 435 of_device_is_compatible(np, "fsl,imx51-usb")) && pdata.usb_phy && 436 of_usb_get_phy_mode(np) == USBPHY_INTERFACE_MODE_ULPI) { 437 pdata.flags |= CI_HDRC_OVERRIDE_PHY_CONTROL; 438 data->override_phy_control = true; 439 usb_phy_init(pdata.usb_phy); 440 } 441 442 if (pdata.flags & CI_HDRC_SUPPORTS_RUNTIME_PM) 443 data->supports_runtime_pm = true; 444 445 ret = imx_usbmisc_init(data->usbmisc_data); 446 if (ret) { 447 dev_err(dev, "usbmisc init failed, ret=%d\n", ret); 448 goto err_clk; 449 } 450 451 data->ci_pdev = ci_hdrc_add_device(dev, 452 pdev->resource, pdev->num_resources, 453 &pdata); 454 if (IS_ERR(data->ci_pdev)) { 455 ret = PTR_ERR(data->ci_pdev); 456 if (ret != -EPROBE_DEFER) 457 dev_err(dev, "ci_hdrc_add_device failed, err=%d\n", 458 ret); 459 goto err_clk; 460 } 461 462 if (data->usbmisc_data) { 463 if (!IS_ERR(pdata.id_extcon.edev) || 464 of_property_read_bool(np, "usb-role-switch")) 465 data->usbmisc_data->ext_id = 1; 466 467 if (!IS_ERR(pdata.vbus_extcon.edev) || 468 of_property_read_bool(np, "usb-role-switch")) 469 data->usbmisc_data->ext_vbus = 1; 470 471 /* usbmisc needs to know dr mode to choose wakeup setting */ 472 data->usbmisc_data->available_role = 473 ci_hdrc_query_available_role(data->ci_pdev); 474 } 475 476 ret = imx_usbmisc_init_post(data->usbmisc_data); 477 if (ret) { 478 dev_err(dev, "usbmisc post failed, ret=%d\n", ret); 479 goto disable_device; 480 } 481 482 if (data->supports_runtime_pm) { 483 pm_runtime_set_active(dev); 484 pm_runtime_enable(dev); 485 } 486 487 device_set_wakeup_capable(dev, true); 488 489 return 0; 490 491 disable_device: 492 ci_hdrc_remove_device(data->ci_pdev); 493 err_clk: 494 imx_disable_unprepare_clks(dev); 495 disable_hsic_regulator: 496 if (data->hsic_pad_regulator) 497 /* don't overwrite original ret (cf. EPROBE_DEFER) */ 498 regulator_disable(data->hsic_pad_regulator); 499 if (pdata.flags & CI_HDRC_PMQOS) 500 cpu_latency_qos_remove_request(&data->pm_qos_req); 501 data->ci_pdev = NULL; 502 return ret; 503 } 504 505 static int ci_hdrc_imx_remove(struct platform_device *pdev) 506 { 507 struct ci_hdrc_imx_data *data = platform_get_drvdata(pdev); 508 509 if (data->supports_runtime_pm) { 510 pm_runtime_get_sync(&pdev->dev); 511 pm_runtime_disable(&pdev->dev); 512 pm_runtime_put_noidle(&pdev->dev); 513 } 514 if (data->ci_pdev) 515 ci_hdrc_remove_device(data->ci_pdev); 516 if (data->override_phy_control) 517 usb_phy_shutdown(data->phy); 518 if (data->ci_pdev) { 519 imx_disable_unprepare_clks(&pdev->dev); 520 if (data->plat_data->flags & CI_HDRC_PMQOS) 521 cpu_latency_qos_remove_request(&data->pm_qos_req); 522 if (data->hsic_pad_regulator) 523 regulator_disable(data->hsic_pad_regulator); 524 } 525 526 return 0; 527 } 528 529 static void ci_hdrc_imx_shutdown(struct platform_device *pdev) 530 { 531 ci_hdrc_imx_remove(pdev); 532 } 533 534 static int __maybe_unused imx_controller_suspend(struct device *dev) 535 { 536 struct ci_hdrc_imx_data *data = dev_get_drvdata(dev); 537 int ret = 0; 538 539 dev_dbg(dev, "at %s\n", __func__); 540 541 ret = imx_usbmisc_hsic_set_clk(data->usbmisc_data, false); 542 if (ret) { 543 dev_err(dev, "usbmisc hsic_set_clk failed, ret=%d\n", ret); 544 return ret; 545 } 546 547 imx_disable_unprepare_clks(dev); 548 if (data->plat_data->flags & CI_HDRC_PMQOS) 549 cpu_latency_qos_remove_request(&data->pm_qos_req); 550 551 data->in_lpm = true; 552 553 return 0; 554 } 555 556 static int __maybe_unused imx_controller_resume(struct device *dev) 557 { 558 struct ci_hdrc_imx_data *data = dev_get_drvdata(dev); 559 int ret = 0; 560 561 dev_dbg(dev, "at %s\n", __func__); 562 563 if (!data->in_lpm) { 564 WARN_ON(1); 565 return 0; 566 } 567 568 if (data->plat_data->flags & CI_HDRC_PMQOS) 569 cpu_latency_qos_add_request(&data->pm_qos_req, 0); 570 571 ret = imx_prepare_enable_clks(dev); 572 if (ret) 573 return ret; 574 575 data->in_lpm = false; 576 577 ret = imx_usbmisc_set_wakeup(data->usbmisc_data, false); 578 if (ret) { 579 dev_err(dev, "usbmisc set_wakeup failed, ret=%d\n", ret); 580 goto clk_disable; 581 } 582 583 ret = imx_usbmisc_hsic_set_clk(data->usbmisc_data, true); 584 if (ret) { 585 dev_err(dev, "usbmisc hsic_set_clk failed, ret=%d\n", ret); 586 goto hsic_set_clk_fail; 587 } 588 589 return 0; 590 591 hsic_set_clk_fail: 592 imx_usbmisc_set_wakeup(data->usbmisc_data, true); 593 clk_disable: 594 imx_disable_unprepare_clks(dev); 595 return ret; 596 } 597 598 static int __maybe_unused ci_hdrc_imx_suspend(struct device *dev) 599 { 600 int ret; 601 602 struct ci_hdrc_imx_data *data = dev_get_drvdata(dev); 603 604 if (data->in_lpm) 605 /* The core's suspend doesn't run */ 606 return 0; 607 608 if (device_may_wakeup(dev)) { 609 ret = imx_usbmisc_set_wakeup(data->usbmisc_data, true); 610 if (ret) { 611 dev_err(dev, "usbmisc set_wakeup failed, ret=%d\n", 612 ret); 613 return ret; 614 } 615 } 616 617 ret = imx_controller_suspend(dev); 618 if (ret) 619 return ret; 620 621 pinctrl_pm_select_sleep_state(dev); 622 return ret; 623 } 624 625 static int __maybe_unused ci_hdrc_imx_resume(struct device *dev) 626 { 627 struct ci_hdrc_imx_data *data = dev_get_drvdata(dev); 628 int ret; 629 630 pinctrl_pm_select_default_state(dev); 631 ret = imx_controller_resume(dev); 632 if (!ret && data->supports_runtime_pm) { 633 pm_runtime_disable(dev); 634 pm_runtime_set_active(dev); 635 pm_runtime_enable(dev); 636 } 637 638 return ret; 639 } 640 641 static int __maybe_unused ci_hdrc_imx_runtime_suspend(struct device *dev) 642 { 643 struct ci_hdrc_imx_data *data = dev_get_drvdata(dev); 644 int ret; 645 646 if (data->in_lpm) { 647 WARN_ON(1); 648 return 0; 649 } 650 651 ret = imx_usbmisc_set_wakeup(data->usbmisc_data, true); 652 if (ret) { 653 dev_err(dev, "usbmisc set_wakeup failed, ret=%d\n", ret); 654 return ret; 655 } 656 657 return imx_controller_suspend(dev); 658 } 659 660 static int __maybe_unused ci_hdrc_imx_runtime_resume(struct device *dev) 661 { 662 return imx_controller_resume(dev); 663 } 664 665 static const struct dev_pm_ops ci_hdrc_imx_pm_ops = { 666 SET_SYSTEM_SLEEP_PM_OPS(ci_hdrc_imx_suspend, ci_hdrc_imx_resume) 667 SET_RUNTIME_PM_OPS(ci_hdrc_imx_runtime_suspend, 668 ci_hdrc_imx_runtime_resume, NULL) 669 }; 670 static struct platform_driver ci_hdrc_imx_driver = { 671 .probe = ci_hdrc_imx_probe, 672 .remove = ci_hdrc_imx_remove, 673 .shutdown = ci_hdrc_imx_shutdown, 674 .driver = { 675 .name = "imx_usb", 676 .of_match_table = ci_hdrc_imx_dt_ids, 677 .pm = &ci_hdrc_imx_pm_ops, 678 }, 679 }; 680 681 module_platform_driver(ci_hdrc_imx_driver); 682 683 MODULE_ALIAS("platform:imx-usb"); 684 MODULE_LICENSE("GPL"); 685 MODULE_DESCRIPTION("CI HDRC i.MX USB binding"); 686 MODULE_AUTHOR("Marek Vasut <marex@denx.de>"); 687 MODULE_AUTHOR("Richard Zhao <richard.zhao@freescale.com>"); 688