3 #include "usbdev_grf_regs.h"
4 #include "dwc_otg_regs.h"
5 static struct dwc_otg_control_usb *control_usb;
7 #ifdef CONFIG_USB20_OTG
8 static void usb20otg_hw_init(void)
10 /* Turn off differential receiver in suspend mode */
11 writel(UOC_HIWORD_UPDATE(0, 1, 2),
12 RK_GRF_VIRT + RK312X_GRF_USBPHY0_CON6);
13 /* Set disconnect detection trigger point to 600mv */
14 writel(UOC_HIWORD_UPDATE(0, 0xf, 11),
15 RK_GRF_VIRT + RK312X_GRF_USBPHY0_CON7);
16 /* other haredware init,include:
17 * DRV_VBUS GPIO init */
18 if (gpio_is_valid(control_usb->otg_gpios->gpio)) {
19 if (gpio_get_value(control_usb->otg_gpios->gpio))
20 gpio_set_value(control_usb->otg_gpios->gpio, 0);
24 static void usb20otg_phy_suspend(void *pdata, int suspend)
26 struct dwc_otg_platform_data *usbpdata = pdata;
29 /* enable soft control */
30 writel(UOC_HIWORD_UPDATE(0x1d1, 0x1ff, 0),
31 RK_GRF_VIRT + RK312X_GRF_UOC0_CON0);
32 usbpdata->phy_status = 1;
35 writel(UOC_HIWORD_UPDATE(0x0, 0x1, 0),
36 RK_GRF_VIRT + RK312X_GRF_UOC0_CON0);
37 usbpdata->phy_status = 0;
41 static void usb20otg_soft_reset(void *pdata, enum rkusb_rst_flag rst_type)
43 struct dwc_otg_platform_data *usbpdata = pdata;
44 struct reset_control *rst_otg_h, *rst_otg_p, *rst_otg_c;
46 rst_otg_h = devm_reset_control_get(usbpdata->dev, "otg_ahb");
47 rst_otg_p = devm_reset_control_get(usbpdata->dev, "otg_phy");
48 rst_otg_c = devm_reset_control_get(usbpdata->dev, "otg_controller");
49 if (IS_ERR(rst_otg_h) || IS_ERR(rst_otg_p) || IS_ERR(rst_otg_c)) {
50 dev_err(usbpdata->dev, "Fail to get reset control from dts\n");
57 writel(UOC_HIWORD_UPDATE(0x1, 0x3, 0),
58 RK_GRF_VIRT + RK312X_GRF_UOC0_CON0);
59 reset_control_assert(rst_otg_p);
61 writel(UOC_HIWORD_UPDATE(0x2, 0x3, 0),
62 RK_GRF_VIRT + RK312X_GRF_UOC0_CON0);
64 reset_control_deassert(rst_otg_p);
67 /* Controller reset */
68 reset_control_assert(rst_otg_c);
69 reset_control_assert(rst_otg_h);
73 reset_control_deassert(rst_otg_c);
74 reset_control_deassert(rst_otg_h);
82 static void usb20otg_clock_init(void *pdata)
84 struct dwc_otg_platform_data *usbpdata = pdata;
85 struct clk *ahbclk, *phyclk;
87 ahbclk = devm_clk_get(usbpdata->dev, "hclk_usb0");
89 dev_err(usbpdata->dev, "Failed to get hclk_usb0\n");
93 phyclk = devm_clk_get(usbpdata->dev, "clk_usbphy0");
95 dev_err(usbpdata->dev, "Failed to get clk_usbphy0\n");
99 usbpdata->phyclk = phyclk;
100 usbpdata->ahbclk = ahbclk;
103 static void usb20otg_clock_enable(void *pdata, int enable)
105 struct dwc_otg_platform_data *usbpdata = pdata;
108 clk_prepare_enable(usbpdata->ahbclk);
109 clk_prepare_enable(usbpdata->phyclk);
111 clk_disable_unprepare(usbpdata->ahbclk);
113 clk_disable_unprepare(usbpdata->phyclk);
118 static int usb20otg_get_status(int id)
121 u32 soc_status0 = readl(RK_GRF_VIRT + RK312X_GRF_SOC_STATUS0);
123 case USB_STATUS_BVABLID:
125 ret = soc_status0 & (0x1 << 5);
127 case USB_STATUS_DPDM:
129 ret = soc_status0 & (0x3 << 6);
133 ret = soc_status0 & (0x1 << 8);
135 case USB_STATUS_UARTMODE:
136 ret = readl(RK_GRF_VIRT + RK312X_GRF_UOC1_CON4) & (1 << 12);
139 ret = control_usb->chip_id;
141 case USB_REMOTE_WAKEUP:
142 ret = control_usb->remote_wakeup;
145 ret = control_usb->usb_irq_wakeup;
153 #ifdef CONFIG_RK_USB_UART
155 * dwc_otg_uart_enabled - check if a usb-uart bypass func is enabled in DT
157 * Returns true if the status property of node "usb_uart" is set to "okay"
158 * or "ok", if this property is absent it will use the default status "ok"
161 static bool dwc_otg_uart_enabled(void)
163 struct device_node *np;
165 np = of_find_node_by_name(NULL, "usb_uart");
166 if (np && of_device_is_available(np))
172 static void dwc_otg_uart_mode(void *pdata, int enter_usb_uart_mode)
174 if ((1 == enter_usb_uart_mode) && dwc_otg_uart_enabled()) {
175 /* bypass dm, enter uart mode */
176 writel(UOC_HIWORD_UPDATE(0x3, 0x3, 12), RK_GRF_VIRT +
177 RK312X_GRF_UOC1_CON4);
179 } else if (0 == enter_usb_uart_mode) {
181 writel(UOC_HIWORD_UPDATE(0x0, 0x3, 12), RK_GRF_VIRT +
182 RK312X_GRF_UOC1_CON4);
186 static void dwc_otg_uart_mode(void *pdata, int enter_usb_uart_mode)
191 static void usb20otg_power_enable(int enable)
194 /* disable otg_drv power */
195 if (gpio_is_valid(control_usb->otg_gpios->gpio))
196 gpio_set_value(control_usb->otg_gpios->gpio, 0);
197 else if (usb20otg_get_status(USB_STATUS_BVABLID))
198 rk_battery_charger_detect_cb(USB_OTG_POWER_OFF);
199 } else if (1 == enable) {
200 /* enable otg_drv power */
201 if (gpio_is_valid(control_usb->otg_gpios->gpio))
202 gpio_set_value(control_usb->otg_gpios->gpio, 1);
203 else if (!usb20otg_get_status(USB_STATUS_BVABLID))
204 rk_battery_charger_detect_cb(USB_OTG_POWER_ON);
207 static void usb20otg_phy_power_down(int power_down)
209 if (power_down == PHY_POWER_DOWN) {
210 if (control_usb->linestate_wakeup) {
211 /* enable otg0_linestate irq */
212 writel(UOC_HIWORD_UPDATE(0x3, 0x3, 14),
213 RK_GRF_VIRT + RK312X_GRF_UOC1_CON5);
214 /* enable otg1_linestate irq */
215 writel(UOC_HIWORD_UPDATE(0x3, 0x3, 12),
216 RK_GRF_VIRT + RK312X_GRF_UOC0_CON0);
218 } else if (power_down == PHY_POWER_UP) {
222 struct dwc_otg_platform_data usb20otg_pdata_rk3126 = {
227 .hw_init = usb20otg_hw_init,
228 .phy_suspend = usb20otg_phy_suspend,
229 .soft_reset = usb20otg_soft_reset,
230 .clock_init = usb20otg_clock_init,
231 .clock_enable = usb20otg_clock_enable,
232 .get_status = usb20otg_get_status,
233 .power_enable = usb20otg_power_enable,
234 .dwc_otg_uart_mode = dwc_otg_uart_mode,
235 .bc_detect_cb = rk_battery_charger_detect_cb,
236 .phy_power_down = usb20otg_phy_power_down,
240 #if defined(CONFIG_USB20_HOST) || defined(CONFIG_USB_EHCI_RK)
241 static void usb20host_hw_init(void)
243 /* Turn off differential receiver in suspend mode */
244 writel(UOC_HIWORD_UPDATE(0, 1, 2),
245 RK_GRF_VIRT + RK312X_GRF_USBPHY1_CON6);
246 /* Set disconnect detection trigger point to 600mv */
247 writel(UOC_HIWORD_UPDATE(1, 0xf, 11),
248 RK_GRF_VIRT + RK312X_GRF_USBPHY1_CON7);
249 /* other haredware init,include:
250 * DRV_VBUS GPIO init */
251 if (gpio_is_valid(control_usb->host_gpios->gpio)) {
252 if (!gpio_get_value(control_usb->host_gpios->gpio))
253 gpio_set_value(control_usb->host_gpios->gpio, 1);
257 static void usb20host_phy_suspend(void *pdata, int suspend)
259 struct dwc_otg_platform_data *usbpdata = pdata;
262 /* enable soft control */
263 writel(UOC_HIWORD_UPDATE(0x1d5, 0x1ff, 0),
264 RK_GRF_VIRT + RK312X_GRF_UOC1_CON5);
265 usbpdata->phy_status = 1;
268 writel(UOC_HIWORD_UPDATE(0x0, 0x1, 0),
269 RK_GRF_VIRT + RK312X_GRF_UOC1_CON5);
270 usbpdata->phy_status = 0;
274 static void usb20host_soft_reset(void *pdata, enum rkusb_rst_flag rst_type)
276 struct dwc_otg_platform_data *usbpdata = pdata;
277 struct reset_control *rst_host_h, *rst_host_p, *rst_host_c;
279 rst_host_h = devm_reset_control_get(usbpdata->dev, "host_ahb");
280 rst_host_p = devm_reset_control_get(usbpdata->dev, "host_phy");
281 rst_host_c = devm_reset_control_get(usbpdata->dev, "host_controller");
282 if (IS_ERR(rst_host_h) || IS_ERR(rst_host_p) || IS_ERR(rst_host_c)) {
283 dev_err(usbpdata->dev, "Fail to get reset control from dts\n");
290 writel(UOC_HIWORD_UPDATE(0x1, 0x3, 0),
291 RK_GRF_VIRT + RK312X_GRF_UOC1_CON5);
292 reset_control_assert(rst_host_p);
294 writel(UOC_HIWORD_UPDATE(0x2, 0x3, 0),
295 RK_GRF_VIRT + RK312X_GRF_UOC1_CON5);
298 reset_control_deassert(rst_host_p);
300 /* Controller reset */
301 reset_control_assert(rst_host_c);
302 reset_control_assert(rst_host_h);
306 reset_control_deassert(rst_host_c);
307 reset_control_deassert(rst_host_h);
315 static void usb20host_clock_init(void *pdata)
317 struct dwc_otg_platform_data *usbpdata = pdata;
318 struct clk *ahbclk, *phyclk;
320 ahbclk = devm_clk_get(usbpdata->dev, "hclk_usb1");
321 if (IS_ERR(ahbclk)) {
322 dev_err(usbpdata->dev, "Failed to get hclk_usb1\n");
326 phyclk = devm_clk_get(usbpdata->dev, "clk_usbphy1");
327 if (IS_ERR(phyclk)) {
328 dev_err(usbpdata->dev, "Failed to get clk_usbphy1\n");
332 usbpdata->phyclk = phyclk;
333 usbpdata->ahbclk = ahbclk;
336 static void usb20host_clock_enable(void *pdata, int enable)
338 struct dwc_otg_platform_data *usbpdata = pdata;
341 clk_prepare_enable(usbpdata->ahbclk);
342 clk_prepare_enable(usbpdata->phyclk);
344 clk_disable_unprepare(usbpdata->ahbclk);
345 clk_disable_unprepare(usbpdata->phyclk);
349 static int usb20host_get_status(int id)
352 u32 soc_status0 = readl(RK_GRF_VIRT + RK312X_GRF_SOC_STATUS0);
355 case USB_STATUS_BVABLID:
357 ret = soc_status0 & (0x1 << 10);
359 case USB_STATUS_DPDM:
361 ret = soc_status0 & (0x3 << 11);
368 ret = control_usb->chip_id;
370 case USB_REMOTE_WAKEUP:
371 ret = control_usb->remote_wakeup;
374 ret = control_usb->usb_irq_wakeup;
382 static void usb20host_power_enable(int enable)
385 /* disable host_drv power */
386 /* do not disable power in default */
387 } else if (1 == enable) {
388 /* enable host_drv power */
389 if (gpio_is_valid(control_usb->host_gpios->gpio))
390 gpio_set_value(control_usb->host_gpios->gpio, 1);
394 struct dwc_otg_platform_data usb20host_pdata_rk3126 = {
399 .hw_init = usb20host_hw_init,
400 .phy_suspend = usb20host_phy_suspend,
401 .soft_reset = usb20host_soft_reset,
402 .clock_init = usb20host_clock_init,
403 .clock_enable = usb20host_clock_enable,
404 .get_status = usb20host_get_status,
405 .power_enable = usb20host_power_enable,
409 #ifdef CONFIG_USB_EHCI_RK
410 static void usb20ehci_phy_suspend(void *pdata, int suspend)
412 struct rkehci_platform_data *usbpdata = pdata;
415 /* enable soft control */
416 writel(UOC_HIWORD_UPDATE(0x1d1, 0x1ff, 0),
417 RK_GRF_VIRT + RK312X_GRF_UOC1_CON5);
418 usbpdata->phy_status = 1;
421 writel(UOC_HIWORD_UPDATE(0x0, 0x1, 0),
422 RK_GRF_VIRT + RK312X_GRF_UOC1_CON5);
423 usbpdata->phy_status = 0;
427 static void usb20ehci_soft_reset(void *pdata, enum rkusb_rst_flag rst_type)
429 struct rkehci_platform_data *usbpdata = pdata;
430 struct reset_control *rst_host_h, *rst_host_p, *rst_host_c;
432 rst_host_h = devm_reset_control_get(usbpdata->dev, "host_ahb");
433 rst_host_p = devm_reset_control_get(usbpdata->dev, "host_phy");
434 rst_host_c = devm_reset_control_get(usbpdata->dev, "host_controller");
435 if (IS_ERR(rst_host_h) || IS_ERR(rst_host_p) || IS_ERR(rst_host_c)) {
436 dev_err(usbpdata->dev, "Fail to get reset control from dts\n");
443 writel(UOC_HIWORD_UPDATE(0x1, 0x3, 0),
444 RK_GRF_VIRT + RK312X_GRF_UOC1_CON5);
445 reset_control_assert(rst_host_p);
447 writel(UOC_HIWORD_UPDATE(0x2, 0x3, 0),
448 RK_GRF_VIRT + RK312X_GRF_UOC1_CON5);
451 reset_control_deassert(rst_host_p);
453 /* Controller reset */
454 reset_control_assert(rst_host_c);
455 reset_control_assert(rst_host_h);
459 reset_control_deassert(rst_host_c);
460 reset_control_deassert(rst_host_h);
468 static void usb20ehci_clock_init(void *pdata)
470 struct rkehci_platform_data *usbpdata = pdata;
471 struct clk *ahbclk, *phyclk;
473 ahbclk = devm_clk_get(usbpdata->dev, "hclk_host0");
474 if (IS_ERR(ahbclk)) {
475 dev_err(usbpdata->dev, "Failed to get hclk_usb1\n");
479 phyclk = devm_clk_get(usbpdata->dev, "clk_usbphy1");
480 if (IS_ERR(phyclk)) {
481 dev_err(usbpdata->dev, "Failed to get clk_usbphy1\n");
485 usbpdata->phyclk = phyclk;
486 usbpdata->ahbclk = ahbclk;
489 static void usb20ehci_clock_enable(void *pdata, int enable)
491 struct rkehci_platform_data *usbpdata = pdata;
494 clk_prepare_enable(usbpdata->ahbclk);
495 clk_prepare_enable(usbpdata->phyclk);
497 clk_disable_unprepare(usbpdata->ahbclk);
498 clk_disable_unprepare(usbpdata->phyclk);
502 struct rkehci_platform_data usb20ehci_pdata_rk3126 = {
506 .hw_init = usb20host_hw_init,
507 .phy_suspend = usb20ehci_phy_suspend,
508 .soft_reset = usb20ehci_soft_reset,
509 .clock_init = usb20ehci_clock_init,
510 .clock_enable = usb20ehci_clock_enable,
511 .get_status = usb20host_get_status,
515 struct dwc_otg_platform_data usb20ohci_pdata_rk3126;
518 static const struct of_device_id rk_usb_control_id_table[] = {
520 .compatible = "rockchip,rk3126-usb-control",
525 /*********************************************************************
526 rk3126 usb detections
527 *********************************************************************/
529 #define WAKE_LOCK_TIMEOUT (HZ * 10)
530 static inline void do_wakeup(struct work_struct *work)
532 /* wake up the system */
533 rk_send_wakeup_key();
536 static void usb_battery_charger_detect_work(struct work_struct *work)
538 rk_battery_charger_detect_cb(usb_battery_charger_detect(1));
541 /********** handler for bvalid irq **********/
542 static irqreturn_t bvalid_irq_handler(int irq, void *dev_id)
545 writel(UOC_HIWORD_UPDATE(0x1, 0x1, 15),
546 RK_GRF_VIRT + RK312X_GRF_UOC0_CON0);
547 #ifdef CONFIG_RK_USB_UART
548 /* usb otg dp/dm switch to usb phy */
549 dwc_otg_uart_mode(NULL, PHY_USB_MODE);
552 if (control_usb->usb_irq_wakeup) {
553 wake_lock_timeout(&control_usb->usb_wakelock,
555 schedule_delayed_work(&control_usb->usb_det_wakeup_work,
559 schedule_delayed_work(&control_usb->usb_charger_det_work, HZ / 10);
564 /********** Handler for linestate irq **********/
565 static irqreturn_t otg0_linestate_irq_handler(int irq, void *dev_id)
568 * Here is a chip hwrdware bug, when disable/enable
569 * linestate irq bit the state machine will not reset
570 * So here have to add a delay to wait the linestate filter
571 * timer run out (linestate filter time had been set to 100us)
575 /* clear and disable irq */
576 writel(UOC_HIWORD_UPDATE(0x2, 0x3, 12),
577 RK_GRF_VIRT + RK312X_GRF_UOC0_CON0);
580 if (control_usb->usb_irq_wakeup) {
581 wake_lock_timeout(&control_usb->usb_wakelock,
588 static irqreturn_t otg1_linestate_irq_handler(int irq, void *dev_id)
591 * Here is a chip hwrdware bug, when disable/enable
592 * linestate irq bit the state machine will not reset
593 * So here have to add a delay to wait the linestate filter
594 * timer run out (linestate filter time had been set to 100us)
598 /* clear and disable irq */
599 writel(UOC_HIWORD_UPDATE(0x2, 0x3, 14),
600 RK_GRF_VIRT + RK312X_GRF_UOC1_CON5);
603 if (control_usb->usb_irq_wakeup) {
604 wake_lock_timeout(&control_usb->usb_wakelock,
611 /************* register usb detection irqs **************/
612 static int otg_irq_detect_init(struct platform_device *pdev)
617 if (control_usb->usb_irq_wakeup) {
618 wake_lock_init(&control_usb->usb_wakelock, WAKE_LOCK_SUSPEND,
620 INIT_DELAYED_WORK(&control_usb->usb_det_wakeup_work, do_wakeup);
623 /* register otg_bvalid irq */
624 irq = platform_get_irq_byname(pdev, "otg_bvalid");
625 if ((irq > 0) && control_usb->usb_irq_wakeup) {
626 ret = request_irq(irq, bvalid_irq_handler,
627 0, "otg_bvalid", NULL);
629 dev_err(&pdev->dev, "request_irq %d failed!\n", irq);
631 /* enable bvalid irq */
632 writel(UOC_HIWORD_UPDATE(0x1, 0x1, 14),
633 RK_GRF_VIRT + RK312X_GRF_UOC0_CON0);
637 if (!control_usb->linestate_wakeup)
640 /* Set otg0&1_linestate_filter time to 100us */
641 writel(UOC_HIWORD_UPDATE(0x0, 0xf, 6), RK_GRF_VIRT + 0x1a0);
643 /* Register otg0_linestate irq */
644 irq = platform_get_irq_byname(pdev, "otg0_linestate");
646 ret = request_irq(irq, otg0_linestate_irq_handler,
647 0, "otg0_linestate", NULL);
649 dev_err(&pdev->dev, "request_irq %d failed!\n", irq);
651 /* Clear otg0_linestate irq */
652 writel(UOC_HIWORD_UPDATE(0x2, 0x3, 12),
653 RK_GRF_VIRT + RK312X_GRF_UOC0_CON0);
657 /* Register otg1_linestate irq */
658 irq = platform_get_irq_byname(pdev, "otg1_linestate");
660 ret = request_irq(irq, otg1_linestate_irq_handler,
661 0, "otg1_linestate", NULL);
663 dev_err(&pdev->dev, "request_irq %d failed!\n", irq);
665 /* Clear otg1_linestate irq */
666 writel(UOC_HIWORD_UPDATE(0x2, 0x3, 14),
667 RK_GRF_VIRT + RK312X_GRF_UOC1_CON5);
673 /********** end of rk3126 usb detections **********/
674 static int rk_usb_control_probe(struct platform_device *pdev)
677 struct device_node *np = pdev->dev.of_node;
681 devm_kzalloc(&pdev->dev, sizeof(*control_usb), GFP_KERNEL);
683 dev_err(&pdev->dev, "unable to alloc memory for control usb\n");
688 control_usb->chip_id = RK3126_USB_CTLR;
689 control_usb->remote_wakeup = of_property_read_bool(np,
690 "rockchip,remote_wakeup");
691 control_usb->usb_irq_wakeup = of_property_read_bool(np,
692 "rockchip,usb_irq_wakeup");
693 control_usb->linestate_wakeup = of_property_read_bool(np,
694 "rockchip,linestate_wakeup");
696 INIT_DELAYED_WORK(&control_usb->usb_charger_det_work,
697 usb_battery_charger_detect_work);
699 control_usb->host_gpios =
700 devm_kzalloc(&pdev->dev, sizeof(struct gpio), GFP_KERNEL);
701 if (!control_usb->host_gpios) {
702 dev_err(&pdev->dev, "unable to alloc memory for host_gpios\n");
707 gpio = of_get_named_gpio(np, "host_drv_gpio", 0);
708 control_usb->host_gpios->gpio = gpio;
710 if (!gpio_is_valid(gpio)) {
711 dev_err(&pdev->dev, "invalid host gpio%d\n", gpio);
713 err = devm_gpio_request(&pdev->dev, gpio, "host_drv_gpio");
716 "failed to request GPIO%d for host_drv\n",
721 gpio_direction_output(control_usb->host_gpios->gpio, 1);
724 control_usb->otg_gpios =
725 devm_kzalloc(&pdev->dev, sizeof(struct gpio), GFP_KERNEL);
726 if (!control_usb->otg_gpios) {
727 dev_err(&pdev->dev, "unable to alloc memory for otg_gpios\n");
732 gpio = of_get_named_gpio(np, "otg_drv_gpio", 0);
733 control_usb->otg_gpios->gpio = gpio;
735 if (!gpio_is_valid(gpio)) {
736 dev_err(&pdev->dev, "invalid otg gpio%d\n", gpio);
738 err = devm_gpio_request(&pdev->dev, gpio, "otg_drv_gpio");
741 "failed to request GPIO%d for otg_drv\n", gpio);
745 gpio_direction_output(control_usb->otg_gpios->gpio, 0);
752 static int rk_usb_control_remove(struct platform_device *pdev)
757 static struct platform_driver rk_usb_control_driver = {
758 .probe = rk_usb_control_probe,
759 .remove = rk_usb_control_remove,
761 .name = "rk3126-usb-control",
762 .owner = THIS_MODULE,
763 .of_match_table = of_match_ptr(rk_usb_control_id_table),
769 static const struct of_device_id dwc_otg_control_usb_id_table[] = {
771 .compatible = "rockchip,rk3126-dwc-control-usb",
777 static int dwc_otg_control_usb_probe(struct platform_device *pdev)
779 struct clk *hclk_usb_peri;
783 dev_err(&pdev->dev, "unable to alloc memory for control usb\n");
788 hclk_usb_peri = devm_clk_get(&pdev->dev, "hclk_usb_peri");
789 if (IS_ERR(hclk_usb_peri)) {
790 dev_err(&pdev->dev, "Failed to get hclk_usb_peri\n");
795 control_usb->hclk_usb_peri = hclk_usb_peri;
796 clk_prepare_enable(hclk_usb_peri);
798 #ifdef CONFIG_USB20_OTG
799 if (usb20otg_get_status(USB_STATUS_BVABLID))
800 schedule_delayed_work(&control_usb->usb_charger_det_work,
804 ret = otg_irq_detect_init(pdev);
811 clk_disable_unprepare(hclk_usb_peri);
816 static int dwc_otg_control_usb_remove(struct platform_device *pdev)
818 clk_disable_unprepare(control_usb->hclk_usb_peri);
822 static struct platform_driver dwc_otg_control_usb_driver = {
823 .probe = dwc_otg_control_usb_probe,
824 .remove = dwc_otg_control_usb_remove,
826 .name = "rk3126-dwc-control-usb",
827 .owner = THIS_MODULE,
828 .of_match_table = of_match_ptr(dwc_otg_control_usb_id_table),
832 static int __init dwc_otg_control_usb_init(void)
836 retval |= platform_driver_register(&rk_usb_control_driver);
837 retval |= platform_driver_register(&dwc_otg_control_usb_driver);
841 subsys_initcall(dwc_otg_control_usb_init);
843 static void __exit dwc_otg_control_usb_exit(void)
845 platform_driver_unregister(&rk_usb_control_driver);
846 platform_driver_unregister(&dwc_otg_control_usb_driver);
849 module_exit(dwc_otg_control_usb_exit);
850 MODULE_ALIAS("platform: dwc_control_usb");
851 MODULE_AUTHOR("RockChip Inc.");
852 MODULE_DESCRIPTION("RockChip Control Module USB Driver");
853 MODULE_LICENSE("GPL v2");