1 // SPDX-License-Identifier: GPL-1.0+
5 * Copyright (C) 2011 Renesas Solutions Corp.
6 * Copyright (C) 2019 Renesas Electronics Corporation
7 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
10 #include <linux/err.h>
11 #include <linux/gpio.h>
13 #include <linux/module.h>
14 #include <linux/of_device.h>
15 #include <linux/of_gpio.h>
16 #include <linux/pm_runtime.h>
17 #include <linux/reset.h>
18 #include <linux/slab.h>
19 #include <linux/sysfs.h>
26 * image of renesas_usbhs
32 * mod_host.c pipe.c fifo.c
34 * +-------+ +-----------+
35 * | pipe0 |------>| fifo pio |
36 * +------------+ +-------+ +-----------+
37 * | mod_gadget |=====> | pipe1 |--+
38 * +------------+ +-------+ | +-----------+
39 * | pipe2 | | +-| fifo dma0 |
40 * +------------+ +-------+ | | +-----------+
41 * | mod_host | | pipe3 |<-|--+
42 * +------------+ +-------+ | +-----------+
43 * | .... | +--->| fifo dma1 |
44 * | .... | +-----------+
50 * renesas usb support platform callback function.
51 * Below macro call it.
52 * if platform doesn't have callback, it return 0 (no error)
54 #define usbhs_platform_call(priv, func, args...)\
55 (!(priv) ? -ENODEV : \
56 !((priv)->pfunc.func) ? 0 : \
57 (priv)->pfunc.func(args))
62 u16 usbhs_read(struct usbhs_priv *priv, u32 reg)
64 return ioread16(priv->base + reg);
67 void usbhs_write(struct usbhs_priv *priv, u32 reg, u16 data)
69 iowrite16(data, priv->base + reg);
72 void usbhs_bset(struct usbhs_priv *priv, u32 reg, u16 mask, u16 data)
74 u16 val = usbhs_read(priv, reg);
79 usbhs_write(priv, reg, val);
82 struct usbhs_priv *usbhs_pdev_to_priv(struct platform_device *pdev)
84 return dev_get_drvdata(&pdev->dev);
90 static void usbhs_sys_clock_ctrl(struct usbhs_priv *priv, int enable)
92 usbhs_bset(priv, SYSCFG, SCKE, enable ? SCKE : 0);
95 void usbhs_sys_host_ctrl(struct usbhs_priv *priv, int enable)
97 u16 mask = DCFM | DRPD | DPRPU | HSE | USBE;
98 u16 val = DCFM | DRPD | HSE | USBE;
104 * - D+ Line/D- Line Pull-down
106 usbhs_bset(priv, SYSCFG, mask, enable ? val : 0);
109 void usbhs_sys_function_ctrl(struct usbhs_priv *priv, int enable)
111 u16 mask = DCFM | DRPD | DPRPU | HSE | USBE;
112 u16 val = HSE | USBE;
114 /* CNEN bit is required for function operation */
115 if (usbhs_get_dparam(priv, has_cnen)) {
123 * - select Function mode
124 * - D+ Line Pull-up is disabled
125 * When D+ Line Pull-up is enabled,
126 * calling usbhs_sys_function_pullup(,1)
128 usbhs_bset(priv, SYSCFG, mask, enable ? val : 0);
131 void usbhs_sys_function_pullup(struct usbhs_priv *priv, int enable)
133 usbhs_bset(priv, SYSCFG, DPRPU, enable ? DPRPU : 0);
136 void usbhs_sys_set_test_mode(struct usbhs_priv *priv, u16 mode)
138 usbhs_write(priv, TESTMODE, mode);
144 int usbhs_frame_get_num(struct usbhs_priv *priv)
146 return usbhs_read(priv, FRMNUM) & FRNM_MASK;
150 * usb request functions
152 void usbhs_usbreq_get_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req)
156 val = usbhs_read(priv, USBREQ);
157 req->bRequest = (val >> 8) & 0xFF;
158 req->bRequestType = (val >> 0) & 0xFF;
160 req->wValue = usbhs_read(priv, USBVAL);
161 req->wIndex = usbhs_read(priv, USBINDX);
162 req->wLength = usbhs_read(priv, USBLENG);
165 void usbhs_usbreq_set_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req)
167 usbhs_write(priv, USBREQ, (req->bRequest << 8) | req->bRequestType);
168 usbhs_write(priv, USBVAL, req->wValue);
169 usbhs_write(priv, USBINDX, req->wIndex);
170 usbhs_write(priv, USBLENG, req->wLength);
172 usbhs_bset(priv, DCPCTR, SUREQ, SUREQ);
178 void usbhs_bus_send_sof_enable(struct usbhs_priv *priv)
180 u16 status = usbhs_read(priv, DVSTCTR) & (USBRST | UACT);
182 if (status != USBRST) {
183 struct device *dev = usbhs_priv_to_dev(priv);
184 dev_err(dev, "usbhs should be reset\n");
187 usbhs_bset(priv, DVSTCTR, (USBRST | UACT), UACT);
190 void usbhs_bus_send_reset(struct usbhs_priv *priv)
192 usbhs_bset(priv, DVSTCTR, (USBRST | UACT), USBRST);
195 int usbhs_bus_get_speed(struct usbhs_priv *priv)
197 u16 dvstctr = usbhs_read(priv, DVSTCTR);
199 switch (RHST & dvstctr) {
201 return USB_SPEED_LOW;
202 case RHST_FULL_SPEED:
203 return USB_SPEED_FULL;
204 case RHST_HIGH_SPEED:
205 return USB_SPEED_HIGH;
208 return USB_SPEED_UNKNOWN;
211 int usbhs_vbus_ctrl(struct usbhs_priv *priv, int enable)
213 struct platform_device *pdev = usbhs_priv_to_pdev(priv);
215 return usbhs_platform_call(priv, set_vbus, pdev, enable);
218 static void usbhsc_bus_init(struct usbhs_priv *priv)
220 usbhs_write(priv, DVSTCTR, 0);
222 usbhs_vbus_ctrl(priv, 0);
226 * device configuration
228 int usbhs_set_device_config(struct usbhs_priv *priv, int devnum,
229 u16 upphub, u16 hubport, u16 speed)
231 struct device *dev = usbhs_priv_to_dev(priv);
233 u32 reg = DEVADD0 + (2 * devnum);
236 dev_err(dev, "cannot set speed to unknown device %d\n", devnum);
241 dev_err(dev, "unsupported hub number %d\n", upphub);
247 usbspd = USBSPD_SPEED_LOW;
250 usbspd = USBSPD_SPEED_FULL;
253 usbspd = USBSPD_SPEED_HIGH;
256 dev_err(dev, "unsupported speed %d\n", speed);
260 usbhs_write(priv, reg, UPPHUB(upphub) |
268 * interrupt functions
270 void usbhs_xxxsts_clear(struct usbhs_priv *priv, u16 sts_reg, u16 bit)
272 u16 pipe_mask = (u16)GENMASK(usbhs_get_dparam(priv, pipe_size), 0);
274 usbhs_write(priv, sts_reg, ~(1 << bit) & pipe_mask);
280 static void usbhsc_set_buswait(struct usbhs_priv *priv)
282 int wait = usbhs_get_dparam(priv, buswait_bwait);
284 /* set bus wait if platform have */
286 usbhs_bset(priv, BUSWAIT, 0x000F, wait);
289 static bool usbhsc_is_multi_clks(struct usbhs_priv *priv)
291 return priv->dparam.multi_clks;
294 static int usbhsc_clk_get(struct device *dev, struct usbhs_priv *priv)
296 if (!usbhsc_is_multi_clks(priv))
299 /* The first clock should exist */
300 priv->clks[0] = of_clk_get(dev_of_node(dev), 0);
301 if (IS_ERR(priv->clks[0]))
302 return PTR_ERR(priv->clks[0]);
305 * To backward compatibility with old DT, this driver checks the return
306 * value if it's -ENOENT or not.
308 priv->clks[1] = of_clk_get(dev_of_node(dev), 1);
309 if (PTR_ERR(priv->clks[1]) == -ENOENT)
310 priv->clks[1] = NULL;
311 else if (IS_ERR(priv->clks[1]))
312 return PTR_ERR(priv->clks[1]);
317 static void usbhsc_clk_put(struct usbhs_priv *priv)
321 if (!usbhsc_is_multi_clks(priv))
324 for (i = 0; i < ARRAY_SIZE(priv->clks); i++)
325 clk_put(priv->clks[i]);
328 static int usbhsc_clk_prepare_enable(struct usbhs_priv *priv)
332 if (!usbhsc_is_multi_clks(priv))
335 for (i = 0; i < ARRAY_SIZE(priv->clks); i++) {
336 ret = clk_prepare_enable(priv->clks[i]);
339 clk_disable_unprepare(priv->clks[i]);
347 static void usbhsc_clk_disable_unprepare(struct usbhs_priv *priv)
351 if (!usbhsc_is_multi_clks(priv))
354 for (i = 0; i < ARRAY_SIZE(priv->clks); i++)
355 clk_disable_unprepare(priv->clks[i]);
359 * platform default param
362 /* commonly used on old SH-Mobile SoCs */
363 static struct renesas_usbhs_driver_pipe_config usbhsc_default_pipe[] = {
364 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_CONTROL, 64, 0x00, false),
365 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_ISOC, 1024, 0x08, false),
366 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_ISOC, 1024, 0x18, false),
367 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x28, true),
368 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x38, true),
369 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x48, true),
370 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x04, false),
371 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x05, false),
372 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x06, false),
373 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x07, false),
376 /* commonly used on newer SH-Mobile and R-Car SoCs */
377 static struct renesas_usbhs_driver_pipe_config usbhsc_new_pipe[] = {
378 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_CONTROL, 64, 0x00, false),
379 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_ISOC, 1024, 0x08, true),
380 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_ISOC, 1024, 0x28, true),
381 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x48, true),
382 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x58, true),
383 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x68, true),
384 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x04, false),
385 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x05, false),
386 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x06, false),
387 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x78, true),
388 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x88, true),
389 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x98, true),
390 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0xa8, true),
391 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0xb8, true),
392 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0xc8, true),
393 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0xd8, true),
399 static void usbhsc_power_ctrl(struct usbhs_priv *priv, int enable)
401 struct platform_device *pdev = usbhs_priv_to_pdev(priv);
402 struct device *dev = usbhs_priv_to_dev(priv);
406 pm_runtime_get_sync(dev);
409 if (usbhsc_clk_prepare_enable(priv))
412 /* enable platform power */
413 usbhs_platform_call(priv, power_ctrl, pdev, priv->base, enable);
416 usbhs_sys_clock_ctrl(priv, enable);
419 usbhs_sys_clock_ctrl(priv, enable);
421 /* disable platform power */
422 usbhs_platform_call(priv, power_ctrl, pdev, priv->base, enable);
425 usbhsc_clk_disable_unprepare(priv);
428 pm_runtime_put_sync(dev);
435 static void usbhsc_hotplug(struct usbhs_priv *priv)
437 struct platform_device *pdev = usbhs_priv_to_pdev(priv);
438 struct usbhs_mod *mod = usbhs_mod_get_current(priv);
445 * get vbus status from platform
447 enable = usbhs_mod_info_call(priv, get_vbus, pdev);
450 * get id from platform
452 id = usbhs_platform_call(priv, get_id, pdev);
454 if (enable && !mod) {
456 cable = extcon_get_state(priv->edev, EXTCON_USB_HOST);
457 if ((cable > 0 && id != USBHS_HOST) ||
458 (!cable && id != USBHS_GADGET)) {
460 "USB cable plugged in doesn't match the selected role!\n");
465 ret = usbhs_mod_change(priv, id);
469 dev_dbg(&pdev->dev, "%s enable\n", __func__);
472 if (usbhs_get_dparam(priv, runtime_pwctrl))
473 usbhsc_power_ctrl(priv, enable);
476 usbhsc_set_buswait(priv);
477 usbhsc_bus_init(priv);
480 usbhs_mod_call(priv, start, priv);
482 } else if (!enable && mod) {
483 dev_dbg(&pdev->dev, "%s disable\n", __func__);
486 usbhs_mod_call(priv, stop, priv);
489 usbhsc_bus_init(priv);
492 if (usbhs_get_dparam(priv, runtime_pwctrl))
493 usbhsc_power_ctrl(priv, enable);
495 usbhs_mod_change(priv, -1);
497 /* reset phy for next connection */
498 usbhs_platform_call(priv, phy_reset, pdev);
505 static void usbhsc_notify_hotplug(struct work_struct *work)
507 struct usbhs_priv *priv = container_of(work,
509 notify_hotplug_work.work);
510 usbhsc_hotplug(priv);
513 int usbhsc_schedule_notify_hotplug(struct platform_device *pdev)
515 struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev);
516 int delay = usbhs_get_dparam(priv, detection_delay);
519 * This functions will be called in interrupt.
520 * To make sure safety context,
521 * use workqueue for usbhs_notify_hotplug
523 schedule_delayed_work(&priv->notify_hotplug_work,
524 msecs_to_jiffies(delay));
528 static const struct usbhs_of_data rcar_gen2_data = {
529 .platform_callback = &usbhs_rcar2_ops,
532 .pipe_configs = usbhsc_new_pipe,
533 .pipe_size = ARRAY_SIZE(usbhsc_new_pipe),
537 static const struct usbhs_of_data rcar_gen3_data = {
538 .platform_callback = &usbhs_rcar3_ops,
542 .pipe_configs = usbhsc_new_pipe,
543 .pipe_size = ARRAY_SIZE(usbhsc_new_pipe),
547 static const struct usbhs_of_data rcar_gen3_with_pll_data = {
548 .platform_callback = &usbhs_rcar3_with_pll_ops,
552 .pipe_configs = usbhsc_new_pipe,
553 .pipe_size = ARRAY_SIZE(usbhsc_new_pipe),
557 static const struct usbhs_of_data rza1_data = {
558 .platform_callback = &usbhs_rza1_ops,
560 .pipe_configs = usbhsc_new_pipe,
561 .pipe_size = ARRAY_SIZE(usbhsc_new_pipe),
565 static const struct usbhs_of_data rza2_data = {
566 .platform_callback = &usbhs_rza2_ops,
569 .cfifo_byte_addr = 1,
570 .pipe_configs = usbhsc_new_pipe,
571 .pipe_size = ARRAY_SIZE(usbhsc_new_pipe),
578 static const struct of_device_id usbhs_of_match[] = {
580 .compatible = "renesas,usbhs-r8a774c0",
581 .data = &rcar_gen3_with_pll_data,
584 .compatible = "renesas,usbhs-r8a7790",
585 .data = &rcar_gen2_data,
588 .compatible = "renesas,usbhs-r8a7791",
589 .data = &rcar_gen2_data,
592 .compatible = "renesas,usbhs-r8a7794",
593 .data = &rcar_gen2_data,
596 .compatible = "renesas,usbhs-r8a7795",
597 .data = &rcar_gen3_data,
600 .compatible = "renesas,usbhs-r8a7796",
601 .data = &rcar_gen3_data,
604 .compatible = "renesas,usbhs-r8a77990",
605 .data = &rcar_gen3_with_pll_data,
608 .compatible = "renesas,usbhs-r8a77995",
609 .data = &rcar_gen3_with_pll_data,
612 .compatible = "renesas,rcar-gen2-usbhs",
613 .data = &rcar_gen2_data,
616 .compatible = "renesas,rcar-gen3-usbhs",
617 .data = &rcar_gen3_data,
620 .compatible = "renesas,rza1-usbhs",
624 .compatible = "renesas,rza2-usbhs",
629 MODULE_DEVICE_TABLE(of, usbhs_of_match);
631 static struct renesas_usbhs_platform_info *usbhs_parse_dt(struct device *dev)
633 struct renesas_usbhs_platform_info *info;
634 struct renesas_usbhs_driver_param *dparam;
635 const struct usbhs_of_data *data;
639 info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
643 data = of_device_get_match_data(dev);
647 dparam = &info->driver_param;
648 *dparam = data->param;
649 info->platform_callback = *data->platform_callback;
651 if (!of_property_read_u32(dev_of_node(dev), "renesas,buswait", &tmp))
652 dparam->buswait_bwait = tmp;
653 gpio = of_get_named_gpio_flags(dev_of_node(dev), "renesas,enable-gpio",
656 dparam->enable_gpio = gpio;
661 static int usbhs_probe(struct platform_device *pdev)
663 struct renesas_usbhs_platform_info *info = renesas_usbhs_get_info(pdev);
664 struct usbhs_priv *priv;
665 struct resource *res, *irq_res;
668 /* check device node */
669 if (dev_of_node(&pdev->dev))
670 info = pdev->dev.platform_data = usbhs_parse_dt(&pdev->dev);
672 /* check platform information */
674 dev_err(&pdev->dev, "no platform information\n");
679 irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
681 dev_err(&pdev->dev, "Not enough Renesas USB platform resources.\n");
685 /* usb private data */
686 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
690 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
691 priv->base = devm_ioremap_resource(&pdev->dev, res);
692 if (IS_ERR(priv->base))
693 return PTR_ERR(priv->base);
695 if (of_property_read_bool(dev_of_node(&pdev->dev), "extcon")) {
696 priv->edev = extcon_get_edev_by_phandle(&pdev->dev, 0);
697 if (IS_ERR(priv->edev))
698 return PTR_ERR(priv->edev);
701 priv->rsts = devm_reset_control_array_get_optional_shared(&pdev->dev);
702 if (IS_ERR(priv->rsts))
703 return PTR_ERR(priv->rsts);
709 priv->dparam = info->driver_param;
711 if (!info->platform_callback.get_id) {
712 dev_err(&pdev->dev, "no platform callbacks");
715 priv->pfunc = info->platform_callback;
717 /* set default param if platform doesn't have */
718 if (!priv->dparam.pipe_configs) {
719 priv->dparam.pipe_configs = usbhsc_default_pipe;
720 priv->dparam.pipe_size = ARRAY_SIZE(usbhsc_default_pipe);
722 if (!priv->dparam.pio_dma_border)
723 priv->dparam.pio_dma_border = 64; /* 64byte */
726 /* runtime power control ? */
727 if (priv->pfunc.get_vbus)
728 usbhs_get_dparam(priv, runtime_pwctrl) = 1;
733 priv->irq = irq_res->start;
734 if (irq_res->flags & IORESOURCE_IRQ_SHAREABLE)
735 priv->irqflags = IRQF_SHARED;
737 INIT_DELAYED_WORK(&priv->notify_hotplug_work, usbhsc_notify_hotplug);
738 spin_lock_init(usbhs_priv_to_lock(priv));
740 /* call pipe and module init */
741 ret = usbhs_pipe_probe(priv);
745 ret = usbhs_fifo_probe(priv);
747 goto probe_end_pipe_exit;
749 ret = usbhs_mod_probe(priv);
751 goto probe_end_fifo_exit;
753 /* dev_set_drvdata should be called after usbhs_mod_init */
754 platform_set_drvdata(pdev, priv);
756 ret = reset_control_deassert(priv->rsts);
760 ret = usbhsc_clk_get(&pdev->dev, priv);
762 goto probe_fail_clks;
765 * deviece reset here because
766 * USB device might be used in boot loader.
768 usbhs_sys_clock_ctrl(priv, 0);
770 /* check GPIO determining if USB function should be enabled */
771 if (priv->dparam.enable_gpio) {
772 gpio_request_one(priv->dparam.enable_gpio, GPIOF_IN, NULL);
773 ret = !gpio_get_value(priv->dparam.enable_gpio);
774 gpio_free(priv->dparam.enable_gpio);
777 "USB function not selected (GPIO %d)\n",
778 priv->dparam.enable_gpio);
780 goto probe_end_mod_exit;
787 * USB phy setup might depend on CPU/Board.
788 * If platform has its callback functions,
791 ret = usbhs_platform_call(priv, hardware_init, pdev);
793 dev_err(&pdev->dev, "platform init failed.\n");
794 goto probe_end_mod_exit;
797 /* reset phy for connection */
798 usbhs_platform_call(priv, phy_reset, pdev);
801 pm_runtime_enable(&pdev->dev);
802 if (!usbhs_get_dparam(priv, runtime_pwctrl)) {
803 usbhsc_power_ctrl(priv, 1);
804 usbhs_mod_autonomy_mode(priv);
806 usbhs_mod_non_autonomy_mode(priv);
810 * manual call notify_hotplug for cold plug
812 usbhsc_schedule_notify_hotplug(pdev);
814 dev_info(&pdev->dev, "probed\n");
819 usbhsc_clk_put(priv);
821 reset_control_assert(priv->rsts);
823 usbhs_mod_remove(priv);
825 usbhs_fifo_remove(priv);
827 usbhs_pipe_remove(priv);
829 dev_info(&pdev->dev, "probe failed (%d)\n", ret);
834 static int usbhs_remove(struct platform_device *pdev)
836 struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev);
838 dev_dbg(&pdev->dev, "usb remove\n");
841 if (!usbhs_get_dparam(priv, runtime_pwctrl))
842 usbhsc_power_ctrl(priv, 0);
844 pm_runtime_disable(&pdev->dev);
846 usbhs_platform_call(priv, hardware_exit, pdev);
847 usbhsc_clk_put(priv);
848 reset_control_assert(priv->rsts);
849 usbhs_mod_remove(priv);
850 usbhs_fifo_remove(priv);
851 usbhs_pipe_remove(priv);
856 static __maybe_unused int usbhsc_suspend(struct device *dev)
858 struct usbhs_priv *priv = dev_get_drvdata(dev);
859 struct usbhs_mod *mod = usbhs_mod_get_current(priv);
862 usbhs_mod_call(priv, stop, priv);
863 usbhs_mod_change(priv, -1);
866 if (mod || !usbhs_get_dparam(priv, runtime_pwctrl))
867 usbhsc_power_ctrl(priv, 0);
872 static __maybe_unused int usbhsc_resume(struct device *dev)
874 struct usbhs_priv *priv = dev_get_drvdata(dev);
875 struct platform_device *pdev = usbhs_priv_to_pdev(priv);
877 if (!usbhs_get_dparam(priv, runtime_pwctrl)) {
878 usbhsc_power_ctrl(priv, 1);
879 usbhs_mod_autonomy_mode(priv);
882 usbhs_platform_call(priv, phy_reset, pdev);
884 usbhsc_schedule_notify_hotplug(pdev);
889 static SIMPLE_DEV_PM_OPS(usbhsc_pm_ops, usbhsc_suspend, usbhsc_resume);
891 static struct platform_driver renesas_usbhs_driver = {
893 .name = "renesas_usbhs",
894 .pm = &usbhsc_pm_ops,
895 .of_match_table = of_match_ptr(usbhs_of_match),
897 .probe = usbhs_probe,
898 .remove = usbhs_remove,
901 module_platform_driver(renesas_usbhs_driver);
903 MODULE_LICENSE("GPL");
904 MODULE_DESCRIPTION("Renesas USB driver");
905 MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>");