2 * core.c - DesignWare USB3 DRD Controller Core file
4 * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com
6 * Authors: Felipe Balbi <balbi@ti.com>,
7 * Sebastian Andrzej Siewior <bigeasy@linutronix.de>
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 of
11 * the License as published by the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include <linux/version.h>
23 #include <linux/module.h>
24 #include <linux/kernel.h>
25 #include <linux/slab.h>
26 #include <linux/spinlock.h>
27 #include <linux/platform_device.h>
28 #include <linux/pm_runtime.h>
29 #include <linux/interrupt.h>
30 #include <linux/ioport.h>
32 #include <linux/list.h>
33 #include <linux/delay.h>
34 #include <linux/dma-mapping.h>
36 #include <linux/acpi.h>
37 #include <linux/pinctrl/consumer.h>
39 #include <linux/usb/ch9.h>
40 #include <linux/usb/gadget.h>
41 #include <linux/usb/of.h>
42 #include <linux/usb/otg.h>
50 #define DWC3_DEFAULT_AUTOSUSPEND_DELAY 5000 /* ms */
53 * dwc3_get_dr_mode - Validates and sets dr_mode
54 * @dwc: pointer to our context structure
56 static int dwc3_get_dr_mode(struct dwc3
*dwc
)
58 enum usb_dr_mode mode
;
59 struct device
*dev
= dwc
->dev
;
62 if (dwc
->dr_mode
== USB_DR_MODE_UNKNOWN
)
63 dwc
->dr_mode
= USB_DR_MODE_OTG
;
66 hw_mode
= DWC3_GHWPARAMS0_MODE(dwc
->hwparams
.hwparams0
);
69 case DWC3_GHWPARAMS0_MODE_GADGET
:
70 if (IS_ENABLED(CONFIG_USB_DWC3_HOST
)) {
72 "Controller does not support host mode.\n");
75 mode
= USB_DR_MODE_PERIPHERAL
;
77 case DWC3_GHWPARAMS0_MODE_HOST
:
78 if (IS_ENABLED(CONFIG_USB_DWC3_GADGET
)) {
80 "Controller does not support device mode.\n");
83 mode
= USB_DR_MODE_HOST
;
86 if (IS_ENABLED(CONFIG_USB_DWC3_HOST
))
87 mode
= USB_DR_MODE_HOST
;
88 else if (IS_ENABLED(CONFIG_USB_DWC3_GADGET
))
89 mode
= USB_DR_MODE_PERIPHERAL
;
92 if (mode
!= dwc
->dr_mode
) {
94 "Configuration mismatch. dr_mode forced to %s\n",
95 mode
== USB_DR_MODE_HOST
? "host" : "gadget");
103 static void dwc3_event_buffers_cleanup(struct dwc3
*dwc
);
104 static int dwc3_event_buffers_setup(struct dwc3
*dwc
);
106 static void dwc3_set_prtcap(struct dwc3
*dwc
, u32 mode
)
110 reg
= dwc3_readl(dwc
->regs
, DWC3_GCTL
);
111 reg
&= ~(DWC3_GCTL_PRTCAPDIR(DWC3_GCTL_PRTCAP_OTG
));
112 reg
|= DWC3_GCTL_PRTCAPDIR(mode
);
113 dwc3_writel(dwc
->regs
, DWC3_GCTL
, reg
);
116 static void __dwc3_set_mode(struct work_struct
*work
)
118 struct dwc3
*dwc
= work_to_dwc(work
);
122 if (!dwc
->desired_dr_role
)
125 if (dwc
->desired_dr_role
== dwc
->current_dr_role
)
128 if (dwc
->dr_mode
!= USB_DR_MODE_OTG
)
131 if (dwc
->desired_dr_role
== DWC3_GCTL_PRTCAP_OTG
)
134 switch (dwc
->current_dr_role
) {
135 case DWC3_GCTL_PRTCAP_HOST
:
138 case DWC3_GCTL_PRTCAP_DEVICE
:
139 dwc3_gadget_exit(dwc
);
140 dwc3_event_buffers_cleanup(dwc
);
146 spin_lock_irqsave(&dwc
->lock
, flags
);
148 dwc3_set_prtcap(dwc
, dwc
->desired_dr_role
);
150 dwc
->current_dr_role
= dwc
->desired_dr_role
;
152 spin_unlock_irqrestore(&dwc
->lock
, flags
);
154 switch (dwc
->desired_dr_role
) {
155 case DWC3_GCTL_PRTCAP_HOST
:
156 ret
= dwc3_host_init(dwc
);
158 dev_err(dwc
->dev
, "failed to initialize host\n");
161 otg_set_vbus(dwc
->usb2_phy
->otg
, true);
162 if (dwc
->usb2_generic_phy
)
163 phy_set_mode(dwc
->usb2_generic_phy
, PHY_MODE_USB_HOST
);
167 case DWC3_GCTL_PRTCAP_DEVICE
:
168 dwc3_event_buffers_setup(dwc
);
171 otg_set_vbus(dwc
->usb2_phy
->otg
, false);
172 if (dwc
->usb2_generic_phy
)
173 phy_set_mode(dwc
->usb2_generic_phy
, PHY_MODE_USB_DEVICE
);
175 ret
= dwc3_gadget_init(dwc
);
177 dev_err(dwc
->dev
, "failed to initialize peripheral\n");
184 void dwc3_set_mode(struct dwc3
*dwc
, u32 mode
)
188 spin_lock_irqsave(&dwc
->lock
, flags
);
189 dwc
->desired_dr_role
= mode
;
190 spin_unlock_irqrestore(&dwc
->lock
, flags
);
192 queue_work(system_freezable_wq
, &dwc
->drd_work
);
195 u32
dwc3_core_fifo_space(struct dwc3_ep
*dep
, u8 type
)
197 struct dwc3
*dwc
= dep
->dwc
;
200 dwc3_writel(dwc
->regs
, DWC3_GDBGFIFOSPACE
,
201 DWC3_GDBGFIFOSPACE_NUM(dep
->number
) |
202 DWC3_GDBGFIFOSPACE_TYPE(type
));
204 reg
= dwc3_readl(dwc
->regs
, DWC3_GDBGFIFOSPACE
);
206 return DWC3_GDBGFIFOSPACE_SPACE_AVAILABLE(reg
);
210 * dwc3_core_soft_reset - Issues core soft reset and PHY reset
211 * @dwc: pointer to our context structure
213 static int dwc3_core_soft_reset(struct dwc3
*dwc
)
219 usb_phy_init(dwc
->usb2_phy
);
220 usb_phy_init(dwc
->usb3_phy
);
221 ret
= phy_init(dwc
->usb2_generic_phy
);
225 ret
= phy_init(dwc
->usb3_generic_phy
);
227 phy_exit(dwc
->usb2_generic_phy
);
232 * We're resetting only the device side because, if we're in host mode,
233 * XHCI driver will reset the host block. If dwc3 was configured for
234 * host-only mode, then we can return early.
236 if (dwc
->dr_mode
== USB_DR_MODE_HOST
)
239 reg
= dwc3_readl(dwc
->regs
, DWC3_DCTL
);
240 reg
|= DWC3_DCTL_CSFTRST
;
241 dwc3_writel(dwc
->regs
, DWC3_DCTL
, reg
);
244 reg
= dwc3_readl(dwc
->regs
, DWC3_DCTL
);
245 if (!(reg
& DWC3_DCTL_CSFTRST
))
251 phy_exit(dwc
->usb3_generic_phy
);
252 phy_exit(dwc
->usb2_generic_phy
);
258 * For DWC_usb31 controller, once DWC3_DCTL_CSFTRST bit is cleared,
259 * we must wait at least 50ms before accessing the PHY domain
260 * (synchronization delay). DWC_usb31 programming guide section 1.3.2.
262 if (dwc3_is_usb31(dwc
))
269 * dwc3_frame_length_adjustment - Adjusts frame length if required
270 * @dwc3: Pointer to our controller context structure
272 static void dwc3_frame_length_adjustment(struct dwc3
*dwc
)
277 if (dwc
->revision
< DWC3_REVISION_250A
)
283 reg
= dwc3_readl(dwc
->regs
, DWC3_GFLADJ
);
284 dft
= reg
& DWC3_GFLADJ_30MHZ_MASK
;
285 if (!dev_WARN_ONCE(dwc
->dev
, dft
== dwc
->fladj
,
286 "request value same as default, ignoring\n")) {
287 reg
&= ~DWC3_GFLADJ_30MHZ_MASK
;
288 reg
|= DWC3_GFLADJ_30MHZ_SDBND_SEL
| dwc
->fladj
;
289 dwc3_writel(dwc
->regs
, DWC3_GFLADJ
, reg
);
294 * dwc3_free_one_event_buffer - Frees one event buffer
295 * @dwc: Pointer to our controller context structure
296 * @evt: Pointer to event buffer to be freed
298 static void dwc3_free_one_event_buffer(struct dwc3
*dwc
,
299 struct dwc3_event_buffer
*evt
)
301 dma_free_coherent(dwc
->sysdev
, evt
->length
, evt
->buf
, evt
->dma
);
305 * dwc3_alloc_one_event_buffer - Allocates one event buffer structure
306 * @dwc: Pointer to our controller context structure
307 * @length: size of the event buffer
309 * Returns a pointer to the allocated event buffer structure on success
310 * otherwise ERR_PTR(errno).
312 static struct dwc3_event_buffer
*dwc3_alloc_one_event_buffer(struct dwc3
*dwc
,
315 struct dwc3_event_buffer
*evt
;
317 evt
= devm_kzalloc(dwc
->dev
, sizeof(*evt
), GFP_KERNEL
);
319 return ERR_PTR(-ENOMEM
);
322 evt
->length
= length
;
323 evt
->cache
= devm_kzalloc(dwc
->dev
, length
, GFP_KERNEL
);
325 return ERR_PTR(-ENOMEM
);
327 evt
->buf
= dma_alloc_coherent(dwc
->sysdev
, length
,
328 &evt
->dma
, GFP_KERNEL
);
330 return ERR_PTR(-ENOMEM
);
336 * dwc3_free_event_buffers - frees all allocated event buffers
337 * @dwc: Pointer to our controller context structure
339 static void dwc3_free_event_buffers(struct dwc3
*dwc
)
341 struct dwc3_event_buffer
*evt
;
345 dwc3_free_one_event_buffer(dwc
, evt
);
349 * dwc3_alloc_event_buffers - Allocates @num event buffers of size @length
350 * @dwc: pointer to our controller context structure
351 * @length: size of event buffer
353 * Returns 0 on success otherwise negative errno. In the error case, dwc
354 * may contain some buffers allocated but not all which were requested.
356 static int dwc3_alloc_event_buffers(struct dwc3
*dwc
, unsigned length
)
358 struct dwc3_event_buffer
*evt
;
360 evt
= dwc3_alloc_one_event_buffer(dwc
, length
);
362 dev_err(dwc
->dev
, "can't allocate event buffer\n");
371 * dwc3_event_buffers_setup - setup our allocated event buffers
372 * @dwc: pointer to our controller context structure
374 * Returns 0 on success otherwise negative errno.
376 static int dwc3_event_buffers_setup(struct dwc3
*dwc
)
378 struct dwc3_event_buffer
*evt
;
382 dwc3_writel(dwc
->regs
, DWC3_GEVNTADRLO(0),
383 lower_32_bits(evt
->dma
));
384 dwc3_writel(dwc
->regs
, DWC3_GEVNTADRHI(0),
385 upper_32_bits(evt
->dma
));
386 dwc3_writel(dwc
->regs
, DWC3_GEVNTSIZ(0),
387 DWC3_GEVNTSIZ_SIZE(evt
->length
));
388 dwc3_writel(dwc
->regs
, DWC3_GEVNTCOUNT(0), 0);
393 static void dwc3_event_buffers_cleanup(struct dwc3
*dwc
)
395 struct dwc3_event_buffer
*evt
;
401 dwc3_writel(dwc
->regs
, DWC3_GEVNTADRLO(0), 0);
402 dwc3_writel(dwc
->regs
, DWC3_GEVNTADRHI(0), 0);
403 dwc3_writel(dwc
->regs
, DWC3_GEVNTSIZ(0), DWC3_GEVNTSIZ_INTMASK
404 | DWC3_GEVNTSIZ_SIZE(0));
405 dwc3_writel(dwc
->regs
, DWC3_GEVNTCOUNT(0), 0);
408 static int dwc3_alloc_scratch_buffers(struct dwc3
*dwc
)
410 if (!dwc
->has_hibernation
)
413 if (!dwc
->nr_scratch
)
416 dwc
->scratchbuf
= kmalloc_array(dwc
->nr_scratch
,
417 DWC3_SCRATCHBUF_SIZE
, GFP_KERNEL
);
418 if (!dwc
->scratchbuf
)
424 static int dwc3_setup_scratch_buffers(struct dwc3
*dwc
)
426 dma_addr_t scratch_addr
;
430 if (!dwc
->has_hibernation
)
433 if (!dwc
->nr_scratch
)
436 /* should never fall here */
437 if (!WARN_ON(dwc
->scratchbuf
))
440 scratch_addr
= dma_map_single(dwc
->sysdev
, dwc
->scratchbuf
,
441 dwc
->nr_scratch
* DWC3_SCRATCHBUF_SIZE
,
443 if (dma_mapping_error(dwc
->sysdev
, scratch_addr
)) {
444 dev_err(dwc
->sysdev
, "failed to map scratch buffer\n");
449 dwc
->scratch_addr
= scratch_addr
;
451 param
= lower_32_bits(scratch_addr
);
453 ret
= dwc3_send_gadget_generic_command(dwc
,
454 DWC3_DGCMD_SET_SCRATCHPAD_ADDR_LO
, param
);
458 param
= upper_32_bits(scratch_addr
);
460 ret
= dwc3_send_gadget_generic_command(dwc
,
461 DWC3_DGCMD_SET_SCRATCHPAD_ADDR_HI
, param
);
468 dma_unmap_single(dwc
->sysdev
, dwc
->scratch_addr
, dwc
->nr_scratch
*
469 DWC3_SCRATCHBUF_SIZE
, DMA_BIDIRECTIONAL
);
475 static void dwc3_free_scratch_buffers(struct dwc3
*dwc
)
477 if (!dwc
->has_hibernation
)
480 if (!dwc
->nr_scratch
)
483 /* should never fall here */
484 if (!WARN_ON(dwc
->scratchbuf
))
487 dma_unmap_single(dwc
->sysdev
, dwc
->scratch_addr
, dwc
->nr_scratch
*
488 DWC3_SCRATCHBUF_SIZE
, DMA_BIDIRECTIONAL
);
489 kfree(dwc
->scratchbuf
);
492 static void dwc3_core_num_eps(struct dwc3
*dwc
)
494 struct dwc3_hwparams
*parms
= &dwc
->hwparams
;
496 dwc
->num_eps
= DWC3_NUM_EPS(parms
);
499 static void dwc3_cache_hwparams(struct dwc3
*dwc
)
501 struct dwc3_hwparams
*parms
= &dwc
->hwparams
;
503 parms
->hwparams0
= dwc3_readl(dwc
->regs
, DWC3_GHWPARAMS0
);
504 parms
->hwparams1
= dwc3_readl(dwc
->regs
, DWC3_GHWPARAMS1
);
505 parms
->hwparams2
= dwc3_readl(dwc
->regs
, DWC3_GHWPARAMS2
);
506 parms
->hwparams3
= dwc3_readl(dwc
->regs
, DWC3_GHWPARAMS3
);
507 parms
->hwparams4
= dwc3_readl(dwc
->regs
, DWC3_GHWPARAMS4
);
508 parms
->hwparams5
= dwc3_readl(dwc
->regs
, DWC3_GHWPARAMS5
);
509 parms
->hwparams6
= dwc3_readl(dwc
->regs
, DWC3_GHWPARAMS6
);
510 parms
->hwparams7
= dwc3_readl(dwc
->regs
, DWC3_GHWPARAMS7
);
511 parms
->hwparams8
= dwc3_readl(dwc
->regs
, DWC3_GHWPARAMS8
);
515 * dwc3_phy_setup - Configure USB PHY Interface of DWC3 Core
516 * @dwc: Pointer to our controller context structure
518 * Returns 0 on success. The USB PHY interfaces are configured but not
519 * initialized. The PHY interfaces and the PHYs get initialized together with
520 * the core in dwc3_core_init.
522 static int dwc3_phy_setup(struct dwc3
*dwc
)
527 reg
= dwc3_readl(dwc
->regs
, DWC3_GUSB3PIPECTL(0));
530 * Make sure UX_EXIT_PX is cleared as that causes issues with some
531 * PHYs. Also, this bit is not supposed to be used in normal operation.
533 reg
&= ~DWC3_GUSB3PIPECTL_UX_EXIT_PX
;
536 * Above 1.94a, it is recommended to set DWC3_GUSB3PIPECTL_SUSPHY
537 * to '0' during coreConsultant configuration. So default value
538 * will be '0' when the core is reset. Application needs to set it
539 * to '1' after the core initialization is completed.
541 if (dwc
->revision
> DWC3_REVISION_194A
)
542 reg
|= DWC3_GUSB3PIPECTL_SUSPHY
;
544 if (dwc
->u2ss_inp3_quirk
)
545 reg
|= DWC3_GUSB3PIPECTL_U2SSINP3OK
;
547 if (dwc
->dis_rxdet_inp3_quirk
)
548 reg
|= DWC3_GUSB3PIPECTL_DISRXDETINP3
;
550 if (dwc
->req_p1p2p3_quirk
)
551 reg
|= DWC3_GUSB3PIPECTL_REQP1P2P3
;
553 if (dwc
->del_p1p2p3_quirk
)
554 reg
|= DWC3_GUSB3PIPECTL_DEP1P2P3_EN
;
556 if (dwc
->del_phy_power_chg_quirk
)
557 reg
|= DWC3_GUSB3PIPECTL_DEPOCHANGE
;
559 if (dwc
->lfps_filter_quirk
)
560 reg
|= DWC3_GUSB3PIPECTL_LFPSFILT
;
562 if (dwc
->rx_detect_poll_quirk
)
563 reg
|= DWC3_GUSB3PIPECTL_RX_DETOPOLL
;
565 if (dwc
->tx_de_emphasis_quirk
)
566 reg
|= DWC3_GUSB3PIPECTL_TX_DEEPH(dwc
->tx_de_emphasis
);
568 if (dwc
->dis_u3_susphy_quirk
)
569 reg
&= ~DWC3_GUSB3PIPECTL_SUSPHY
;
571 if (dwc
->dis_del_phy_power_chg_quirk
)
572 reg
&= ~DWC3_GUSB3PIPECTL_DEPOCHANGE
;
574 dwc3_writel(dwc
->regs
, DWC3_GUSB3PIPECTL(0), reg
);
576 reg
= dwc3_readl(dwc
->regs
, DWC3_GUSB2PHYCFG(0));
578 /* Select the HS PHY interface */
579 switch (DWC3_GHWPARAMS3_HSPHY_IFC(dwc
->hwparams
.hwparams3
)) {
580 case DWC3_GHWPARAMS3_HSPHY_IFC_UTMI_ULPI
:
581 if (dwc
->hsphy_interface
&&
582 !strncmp(dwc
->hsphy_interface
, "utmi", 4)) {
583 reg
&= ~DWC3_GUSB2PHYCFG_ULPI_UTMI
;
585 } else if (dwc
->hsphy_interface
&&
586 !strncmp(dwc
->hsphy_interface
, "ulpi", 4)) {
587 reg
|= DWC3_GUSB2PHYCFG_ULPI_UTMI
;
588 dwc3_writel(dwc
->regs
, DWC3_GUSB2PHYCFG(0), reg
);
590 /* Relying on default value. */
591 if (!(reg
& DWC3_GUSB2PHYCFG_ULPI_UTMI
))
595 case DWC3_GHWPARAMS3_HSPHY_IFC_ULPI
:
596 ret
= dwc3_ulpi_init(dwc
);
604 switch (dwc
->hsphy_mode
) {
605 case USBPHY_INTERFACE_MODE_UTMI
:
606 reg
&= ~(DWC3_GUSB2PHYCFG_PHYIF_MASK
|
607 DWC3_GUSB2PHYCFG_USBTRDTIM_MASK
);
608 reg
|= DWC3_GUSB2PHYCFG_PHYIF(UTMI_PHYIF_8_BIT
) |
609 DWC3_GUSB2PHYCFG_USBTRDTIM(USBTRDTIM_UTMI_8_BIT
);
611 case USBPHY_INTERFACE_MODE_UTMIW
:
612 reg
&= ~(DWC3_GUSB2PHYCFG_PHYIF_MASK
|
613 DWC3_GUSB2PHYCFG_USBTRDTIM_MASK
);
614 reg
|= DWC3_GUSB2PHYCFG_PHYIF(UTMI_PHYIF_16_BIT
) |
615 DWC3_GUSB2PHYCFG_USBTRDTIM(USBTRDTIM_UTMI_16_BIT
);
622 * Above 1.94a, it is recommended to set DWC3_GUSB2PHYCFG_SUSPHY to
623 * '0' during coreConsultant configuration. So default value will
624 * be '0' when the core is reset. Application needs to set it to
625 * '1' after the core initialization is completed.
627 if (dwc
->revision
> DWC3_REVISION_194A
)
628 reg
|= DWC3_GUSB2PHYCFG_SUSPHY
;
630 if (dwc
->dis_u2_susphy_quirk
)
631 reg
&= ~DWC3_GUSB2PHYCFG_SUSPHY
;
633 if (dwc
->dis_enblslpm_quirk
)
634 reg
&= ~DWC3_GUSB2PHYCFG_ENBLSLPM
;
636 if (dwc
->dis_u2_freeclk_exists_quirk
)
637 reg
&= ~DWC3_GUSB2PHYCFG_U2_FREECLK_EXISTS
;
639 dwc3_writel(dwc
->regs
, DWC3_GUSB2PHYCFG(0), reg
);
644 static void dwc3_core_exit(struct dwc3
*dwc
)
646 dwc3_event_buffers_cleanup(dwc
);
648 usb_phy_shutdown(dwc
->usb2_phy
);
649 usb_phy_shutdown(dwc
->usb3_phy
);
650 phy_exit(dwc
->usb2_generic_phy
);
651 phy_exit(dwc
->usb3_generic_phy
);
653 usb_phy_set_suspend(dwc
->usb2_phy
, 1);
654 usb_phy_set_suspend(dwc
->usb3_phy
, 1);
655 phy_power_off(dwc
->usb2_generic_phy
);
656 phy_power_off(dwc
->usb3_generic_phy
);
659 static bool dwc3_core_is_valid(struct dwc3
*dwc
)
663 reg
= dwc3_readl(dwc
->regs
, DWC3_GSNPSID
);
665 /* This should read as U3 followed by revision number */
666 if ((reg
& DWC3_GSNPSID_MASK
) == 0x55330000) {
667 /* Detected DWC_usb3 IP */
669 } else if ((reg
& DWC3_GSNPSID_MASK
) == 0x33310000) {
670 /* Detected DWC_usb31 IP */
671 dwc
->revision
= dwc3_readl(dwc
->regs
, DWC3_VER_NUMBER
);
672 dwc
->revision
|= DWC3_REVISION_IS_DWC31
;
680 static void dwc3_core_setup_global_control(struct dwc3
*dwc
)
682 u32 hwparams4
= dwc
->hwparams
.hwparams4
;
685 reg
= dwc3_readl(dwc
->regs
, DWC3_GCTL
);
686 reg
&= ~DWC3_GCTL_SCALEDOWN_MASK
;
688 switch (DWC3_GHWPARAMS1_EN_PWROPT(dwc
->hwparams
.hwparams1
)) {
689 case DWC3_GHWPARAMS1_EN_PWROPT_CLK
:
691 * WORKAROUND: DWC3 revisions between 2.10a and 2.50a have an
692 * issue which would cause xHCI compliance tests to fail.
694 * Because of that we cannot enable clock gating on such
699 * STAR#9000588375: Clock Gating, SOF Issues when ref_clk-Based
702 if ((dwc
->dr_mode
== USB_DR_MODE_HOST
||
703 dwc
->dr_mode
== USB_DR_MODE_OTG
) &&
704 (dwc
->revision
>= DWC3_REVISION_210A
&&
705 dwc
->revision
<= DWC3_REVISION_250A
))
706 reg
|= DWC3_GCTL_DSBLCLKGTNG
| DWC3_GCTL_SOFITPSYNC
;
708 reg
&= ~DWC3_GCTL_DSBLCLKGTNG
;
710 case DWC3_GHWPARAMS1_EN_PWROPT_HIB
:
711 /* enable hibernation here */
712 dwc
->nr_scratch
= DWC3_GHWPARAMS4_HIBER_SCRATCHBUFS(hwparams4
);
715 * REVISIT Enabling this bit so that host-mode hibernation
716 * will work. Device-mode hibernation is not yet implemented.
718 reg
|= DWC3_GCTL_GBLHIBERNATIONEN
;
725 /* check if current dwc3 is on simulation board */
726 if (dwc
->hwparams
.hwparams6
& DWC3_GHWPARAMS6_EN_FPGA
) {
727 dev_info(dwc
->dev
, "Running with FPGA optmizations\n");
731 WARN_ONCE(dwc
->disable_scramble_quirk
&& !dwc
->is_fpga
,
732 "disable_scramble cannot be used on non-FPGA builds\n");
734 if (dwc
->disable_scramble_quirk
&& dwc
->is_fpga
)
735 reg
|= DWC3_GCTL_DISSCRAMBLE
;
737 reg
&= ~DWC3_GCTL_DISSCRAMBLE
;
739 if (dwc
->u2exit_lfps_quirk
)
740 reg
|= DWC3_GCTL_U2EXIT_LFPS
;
743 * WORKAROUND: DWC3 revisions <1.90a have a bug
744 * where the device can fail to connect at SuperSpeed
745 * and falls back to high-speed mode which causes
746 * the device to enter a Connect/Disconnect loop
748 if (dwc
->revision
< DWC3_REVISION_190A
)
749 reg
|= DWC3_GCTL_U2RSTECN
;
751 dwc3_writel(dwc
->regs
, DWC3_GCTL
, reg
);
754 static int dwc3_core_get_phy(struct dwc3
*dwc
);
757 * dwc3_core_init - Low-level initialization of DWC3 Core
758 * @dwc: Pointer to our controller context structure
760 * Returns 0 on success otherwise negative errno.
762 static int dwc3_core_init(struct dwc3
*dwc
)
767 if (!dwc3_core_is_valid(dwc
)) {
768 dev_err(dwc
->dev
, "this is not a DesignWare USB3 DRD Core\n");
774 * Write Linux Version Code to our GUID register so it's easy to figure
775 * out which kernel version a bug was found.
777 dwc3_writel(dwc
->regs
, DWC3_GUID
, LINUX_VERSION_CODE
);
779 /* Handle USB2.0-only core configuration */
780 if (DWC3_GHWPARAMS3_SSPHY_IFC(dwc
->hwparams
.hwparams3
) ==
781 DWC3_GHWPARAMS3_SSPHY_IFC_DIS
) {
782 if (dwc
->maximum_speed
== USB_SPEED_SUPER
)
783 dwc
->maximum_speed
= USB_SPEED_HIGH
;
786 ret
= dwc3_core_get_phy(dwc
);
790 ret
= dwc3_core_soft_reset(dwc
);
794 ret
= dwc3_phy_setup(dwc
);
798 dwc3_core_setup_global_control(dwc
);
799 dwc3_core_num_eps(dwc
);
801 ret
= dwc3_setup_scratch_buffers(dwc
);
805 /* Adjust Frame Length */
806 dwc3_frame_length_adjustment(dwc
);
808 usb_phy_set_suspend(dwc
->usb2_phy
, 0);
809 usb_phy_set_suspend(dwc
->usb3_phy
, 0);
810 ret
= phy_power_on(dwc
->usb2_generic_phy
);
814 ret
= phy_power_on(dwc
->usb3_generic_phy
);
818 ret
= dwc3_event_buffers_setup(dwc
);
820 dev_err(dwc
->dev
, "failed to setup event buffers\n");
825 * ENDXFER polling is available on version 3.10a and later of
826 * the DWC_usb3 controller. It is NOT available in the
827 * DWC_usb31 controller.
829 if (!dwc3_is_usb31(dwc
) && dwc
->revision
>= DWC3_REVISION_310A
) {
830 reg
= dwc3_readl(dwc
->regs
, DWC3_GUCTL2
);
831 reg
|= DWC3_GUCTL2_RST_ACTBITLATER
;
832 dwc3_writel(dwc
->regs
, DWC3_GUCTL2
, reg
);
835 if (dwc
->revision
>= DWC3_REVISION_250A
) {
836 reg
= dwc3_readl(dwc
->regs
, DWC3_GUCTL1
);
839 * Enable hardware control of sending remote wakeup
840 * in HS when the device is in the L1 state.
842 if (dwc
->revision
>= DWC3_REVISION_290A
)
843 reg
|= DWC3_GUCTL1_DEV_L1_EXIT_BY_HW
;
845 if (dwc
->dis_tx_ipgap_linecheck_quirk
)
846 reg
|= DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS
;
848 dwc3_writel(dwc
->regs
, DWC3_GUCTL1
, reg
);
854 phy_power_off(dwc
->usb3_generic_phy
);
857 phy_power_off(dwc
->usb2_generic_phy
);
860 usb_phy_set_suspend(dwc
->usb2_phy
, 1);
861 usb_phy_set_suspend(dwc
->usb3_phy
, 1);
864 usb_phy_shutdown(dwc
->usb2_phy
);
865 usb_phy_shutdown(dwc
->usb3_phy
);
866 phy_exit(dwc
->usb2_generic_phy
);
867 phy_exit(dwc
->usb3_generic_phy
);
873 static int dwc3_core_get_phy(struct dwc3
*dwc
)
875 struct device
*dev
= dwc
->dev
;
876 struct device_node
*node
= dev
->of_node
;
880 dwc
->usb2_phy
= devm_usb_get_phy_by_phandle(dev
, "usb-phy", 0);
881 dwc
->usb3_phy
= devm_usb_get_phy_by_phandle(dev
, "usb-phy", 1);
883 dwc
->usb2_phy
= devm_usb_get_phy(dev
, USB_PHY_TYPE_USB2
);
884 dwc
->usb3_phy
= devm_usb_get_phy(dev
, USB_PHY_TYPE_USB3
);
887 if (IS_ERR(dwc
->usb2_phy
)) {
888 ret
= PTR_ERR(dwc
->usb2_phy
);
889 if (ret
== -ENXIO
|| ret
== -ENODEV
) {
890 dwc
->usb2_phy
= NULL
;
891 } else if (ret
== -EPROBE_DEFER
) {
894 dev_err(dev
, "no usb2 phy configured\n");
899 if (IS_ERR(dwc
->usb3_phy
)) {
900 ret
= PTR_ERR(dwc
->usb3_phy
);
901 if (ret
== -ENXIO
|| ret
== -ENODEV
) {
902 dwc
->usb3_phy
= NULL
;
903 } else if (ret
== -EPROBE_DEFER
) {
906 dev_err(dev
, "no usb3 phy configured\n");
911 dwc
->usb2_generic_phy
= devm_phy_get(dev
, "usb2-phy");
912 if (IS_ERR(dwc
->usb2_generic_phy
)) {
913 ret
= PTR_ERR(dwc
->usb2_generic_phy
);
914 if (ret
== -ENOSYS
|| ret
== -ENODEV
) {
915 dwc
->usb2_generic_phy
= NULL
;
916 } else if (ret
== -EPROBE_DEFER
) {
919 dev_err(dev
, "no usb2 phy configured\n");
924 dwc
->usb3_generic_phy
= devm_phy_get(dev
, "usb3-phy");
925 if (IS_ERR(dwc
->usb3_generic_phy
)) {
926 ret
= PTR_ERR(dwc
->usb3_generic_phy
);
927 if (ret
== -ENOSYS
|| ret
== -ENODEV
) {
928 dwc
->usb3_generic_phy
= NULL
;
929 } else if (ret
== -EPROBE_DEFER
) {
932 dev_err(dev
, "no usb3 phy configured\n");
940 static int dwc3_core_init_mode(struct dwc3
*dwc
)
942 struct device
*dev
= dwc
->dev
;
945 switch (dwc
->dr_mode
) {
946 case USB_DR_MODE_PERIPHERAL
:
947 dwc3_set_prtcap(dwc
, DWC3_GCTL_PRTCAP_DEVICE
);
950 otg_set_vbus(dwc
->usb2_phy
->otg
, false);
951 if (dwc
->usb2_generic_phy
)
952 phy_set_mode(dwc
->usb2_generic_phy
, PHY_MODE_USB_DEVICE
);
954 ret
= dwc3_gadget_init(dwc
);
956 if (ret
!= -EPROBE_DEFER
)
957 dev_err(dev
, "failed to initialize gadget\n");
961 case USB_DR_MODE_HOST
:
962 dwc3_set_prtcap(dwc
, DWC3_GCTL_PRTCAP_HOST
);
965 otg_set_vbus(dwc
->usb2_phy
->otg
, true);
966 if (dwc
->usb2_generic_phy
)
967 phy_set_mode(dwc
->usb2_generic_phy
, PHY_MODE_USB_HOST
);
969 ret
= dwc3_host_init(dwc
);
971 if (ret
!= -EPROBE_DEFER
)
972 dev_err(dev
, "failed to initialize host\n");
976 case USB_DR_MODE_OTG
:
977 INIT_WORK(&dwc
->drd_work
, __dwc3_set_mode
);
978 ret
= dwc3_drd_init(dwc
);
980 if (ret
!= -EPROBE_DEFER
)
981 dev_err(dev
, "failed to initialize dual-role\n");
986 dev_err(dev
, "Unsupported mode of operation %d\n", dwc
->dr_mode
);
993 static void dwc3_core_exit_mode(struct dwc3
*dwc
)
995 switch (dwc
->dr_mode
) {
996 case USB_DR_MODE_PERIPHERAL
:
997 dwc3_gadget_exit(dwc
);
999 case USB_DR_MODE_HOST
:
1000 dwc3_host_exit(dwc
);
1002 case USB_DR_MODE_OTG
:
1011 static void dwc3_get_properties(struct dwc3
*dwc
)
1013 struct device
*dev
= dwc
->dev
;
1014 u8 lpm_nyet_threshold
;
1018 /* default to highest possible threshold */
1019 lpm_nyet_threshold
= 0xff;
1021 /* default to -3.5dB de-emphasis */
1025 * default to assert utmi_sleep_n and use maximum allowed HIRD
1026 * threshold value of 0b1100
1028 hird_threshold
= 12;
1030 dwc
->maximum_speed
= usb_get_maximum_speed(dev
);
1031 dwc
->dr_mode
= usb_get_dr_mode(dev
);
1032 dwc
->hsphy_mode
= of_usb_get_phy_mode(dev
->of_node
);
1034 dwc
->sysdev_is_parent
= device_property_read_bool(dev
,
1035 "linux,sysdev_is_parent");
1036 if (dwc
->sysdev_is_parent
)
1037 dwc
->sysdev
= dwc
->dev
->parent
;
1039 dwc
->sysdev
= dwc
->dev
;
1041 dwc
->has_lpm_erratum
= device_property_read_bool(dev
,
1042 "snps,has-lpm-erratum");
1043 device_property_read_u8(dev
, "snps,lpm-nyet-threshold",
1044 &lpm_nyet_threshold
);
1045 dwc
->is_utmi_l1_suspend
= device_property_read_bool(dev
,
1046 "snps,is-utmi-l1-suspend");
1047 device_property_read_u8(dev
, "snps,hird-threshold",
1049 dwc
->usb3_lpm_capable
= device_property_read_bool(dev
,
1050 "snps,usb3_lpm_capable");
1052 dwc
->disable_scramble_quirk
= device_property_read_bool(dev
,
1053 "snps,disable_scramble_quirk");
1054 dwc
->u2exit_lfps_quirk
= device_property_read_bool(dev
,
1055 "snps,u2exit_lfps_quirk");
1056 dwc
->u2ss_inp3_quirk
= device_property_read_bool(dev
,
1057 "snps,u2ss_inp3_quirk");
1058 dwc
->req_p1p2p3_quirk
= device_property_read_bool(dev
,
1059 "snps,req_p1p2p3_quirk");
1060 dwc
->del_p1p2p3_quirk
= device_property_read_bool(dev
,
1061 "snps,del_p1p2p3_quirk");
1062 dwc
->del_phy_power_chg_quirk
= device_property_read_bool(dev
,
1063 "snps,del_phy_power_chg_quirk");
1064 dwc
->lfps_filter_quirk
= device_property_read_bool(dev
,
1065 "snps,lfps_filter_quirk");
1066 dwc
->rx_detect_poll_quirk
= device_property_read_bool(dev
,
1067 "snps,rx_detect_poll_quirk");
1068 dwc
->dis_u3_susphy_quirk
= device_property_read_bool(dev
,
1069 "snps,dis_u3_susphy_quirk");
1070 dwc
->dis_u2_susphy_quirk
= device_property_read_bool(dev
,
1071 "snps,dis_u2_susphy_quirk");
1072 dwc
->dis_enblslpm_quirk
= device_property_read_bool(dev
,
1073 "snps,dis_enblslpm_quirk");
1074 dwc
->dis_rxdet_inp3_quirk
= device_property_read_bool(dev
,
1075 "snps,dis_rxdet_inp3_quirk");
1076 dwc
->dis_u2_freeclk_exists_quirk
= device_property_read_bool(dev
,
1077 "snps,dis-u2-freeclk-exists-quirk");
1078 dwc
->dis_del_phy_power_chg_quirk
= device_property_read_bool(dev
,
1079 "snps,dis-del-phy-power-chg-quirk");
1080 dwc
->dis_tx_ipgap_linecheck_quirk
= device_property_read_bool(dev
,
1081 "snps,dis-tx-ipgap-linecheck-quirk");
1083 dwc
->tx_de_emphasis_quirk
= device_property_read_bool(dev
,
1084 "snps,tx_de_emphasis_quirk");
1085 device_property_read_u8(dev
, "snps,tx_de_emphasis",
1087 device_property_read_string(dev
, "snps,hsphy_interface",
1088 &dwc
->hsphy_interface
);
1089 device_property_read_u32(dev
, "snps,quirk-frame-length-adjustment",
1092 dwc
->lpm_nyet_threshold
= lpm_nyet_threshold
;
1093 dwc
->tx_de_emphasis
= tx_de_emphasis
;
1095 dwc
->hird_threshold
= hird_threshold
1096 | (dwc
->is_utmi_l1_suspend
<< 4);
1098 dwc
->imod_interval
= 0;
1101 /* check whether the core supports IMOD */
1102 bool dwc3_has_imod(struct dwc3
*dwc
)
1104 return ((dwc3_is_usb3(dwc
) &&
1105 dwc
->revision
>= DWC3_REVISION_300A
) ||
1106 (dwc3_is_usb31(dwc
) &&
1107 dwc
->revision
>= DWC3_USB31_REVISION_120A
));
1110 static void dwc3_check_params(struct dwc3
*dwc
)
1112 struct device
*dev
= dwc
->dev
;
1114 /* Check for proper value of imod_interval */
1115 if (dwc
->imod_interval
&& !dwc3_has_imod(dwc
)) {
1116 dev_warn(dwc
->dev
, "Interrupt moderation not supported\n");
1117 dwc
->imod_interval
= 0;
1121 * Workaround for STAR 9000961433 which affects only version
1122 * 3.00a of the DWC_usb3 core. This prevents the controller
1123 * interrupt from being masked while handling events. IMOD
1124 * allows us to work around this issue. Enable it for the
1127 if (!dwc
->imod_interval
&&
1128 (dwc
->revision
== DWC3_REVISION_300A
))
1129 dwc
->imod_interval
= 1;
1131 /* Check the maximum_speed parameter */
1132 switch (dwc
->maximum_speed
) {
1134 case USB_SPEED_FULL
:
1135 case USB_SPEED_HIGH
:
1136 case USB_SPEED_SUPER
:
1137 case USB_SPEED_SUPER_PLUS
:
1140 dev_err(dev
, "invalid maximum_speed parameter %d\n",
1141 dwc
->maximum_speed
);
1143 case USB_SPEED_UNKNOWN
:
1144 /* default to superspeed */
1145 dwc
->maximum_speed
= USB_SPEED_SUPER
;
1148 * default to superspeed plus if we are capable.
1150 if (dwc3_is_usb31(dwc
) &&
1151 (DWC3_GHWPARAMS3_SSPHY_IFC(dwc
->hwparams
.hwparams3
) ==
1152 DWC3_GHWPARAMS3_SSPHY_IFC_GEN2
))
1153 dwc
->maximum_speed
= USB_SPEED_SUPER_PLUS
;
1159 static int dwc3_probe(struct platform_device
*pdev
)
1161 struct device
*dev
= &pdev
->dev
;
1162 struct resource
*res
;
1169 dwc
= devm_kzalloc(dev
, sizeof(*dwc
), GFP_KERNEL
);
1175 res
= platform_get_resource(pdev
, IORESOURCE_MEM
, 0);
1177 dev_err(dev
, "missing memory resource\n");
1181 dwc
->xhci_resources
[0].start
= res
->start
;
1182 dwc
->xhci_resources
[0].end
= dwc
->xhci_resources
[0].start
+
1184 dwc
->xhci_resources
[0].flags
= res
->flags
;
1185 dwc
->xhci_resources
[0].name
= res
->name
;
1187 res
->start
+= DWC3_GLOBALS_REGS_START
;
1190 * Request memory region but exclude xHCI regs,
1191 * since it will be requested by the xhci-plat driver.
1193 regs
= devm_ioremap_resource(dev
, res
);
1195 ret
= PTR_ERR(regs
);
1200 dwc
->regs_size
= resource_size(res
);
1202 dwc3_get_properties(dwc
);
1204 platform_set_drvdata(pdev
, dwc
);
1205 dwc3_cache_hwparams(dwc
);
1207 spin_lock_init(&dwc
->lock
);
1209 pm_runtime_set_active(dev
);
1210 pm_runtime_use_autosuspend(dev
);
1211 pm_runtime_set_autosuspend_delay(dev
, DWC3_DEFAULT_AUTOSUSPEND_DELAY
);
1212 pm_runtime_enable(dev
);
1213 ret
= pm_runtime_get_sync(dev
);
1217 pm_runtime_forbid(dev
);
1219 ret
= dwc3_alloc_event_buffers(dwc
, DWC3_EVENT_BUFFERS_SIZE
);
1221 dev_err(dwc
->dev
, "failed to allocate event buffers\n");
1226 ret
= dwc3_get_dr_mode(dwc
);
1230 ret
= dwc3_alloc_scratch_buffers(dwc
);
1234 ret
= dwc3_core_init(dwc
);
1236 dev_err(dev
, "failed to initialize core\n");
1240 dwc3_check_params(dwc
);
1242 ret
= dwc3_core_init_mode(dwc
);
1246 dwc3_debugfs_init(dwc
);
1247 pm_runtime_put(dev
);
1252 dwc3_event_buffers_cleanup(dwc
);
1255 dwc3_free_scratch_buffers(dwc
);
1258 dwc3_free_event_buffers(dwc
);
1259 dwc3_ulpi_exit(dwc
);
1262 pm_runtime_allow(&pdev
->dev
);
1265 pm_runtime_put_sync(&pdev
->dev
);
1266 pm_runtime_disable(&pdev
->dev
);
1270 * restore res->start back to its original value so that, in case the
1271 * probe is deferred, we don't end up getting error in request the
1272 * memory region the next time probe is called.
1274 res
->start
-= DWC3_GLOBALS_REGS_START
;
1279 static int dwc3_remove(struct platform_device
*pdev
)
1281 struct dwc3
*dwc
= platform_get_drvdata(pdev
);
1282 struct resource
*res
= platform_get_resource(pdev
, IORESOURCE_MEM
, 0);
1284 pm_runtime_get_sync(&pdev
->dev
);
1286 * restore res->start back to its original value so that, in case the
1287 * probe is deferred, we don't end up getting error in request the
1288 * memory region the next time probe is called.
1290 res
->start
-= DWC3_GLOBALS_REGS_START
;
1292 dwc3_debugfs_exit(dwc
);
1293 dwc3_core_exit_mode(dwc
);
1295 dwc3_core_exit(dwc
);
1296 dwc3_ulpi_exit(dwc
);
1298 pm_runtime_put_sync(&pdev
->dev
);
1299 pm_runtime_allow(&pdev
->dev
);
1300 pm_runtime_disable(&pdev
->dev
);
1302 dwc3_free_event_buffers(dwc
);
1303 dwc3_free_scratch_buffers(dwc
);
1309 static int dwc3_suspend_common(struct dwc3
*dwc
)
1311 unsigned long flags
;
1313 switch (dwc
->dr_mode
) {
1314 case USB_DR_MODE_PERIPHERAL
:
1315 case USB_DR_MODE_OTG
:
1316 spin_lock_irqsave(&dwc
->lock
, flags
);
1317 dwc3_gadget_suspend(dwc
);
1318 spin_unlock_irqrestore(&dwc
->lock
, flags
);
1320 case USB_DR_MODE_HOST
:
1326 dwc3_core_exit(dwc
);
1331 static int dwc3_resume_common(struct dwc3
*dwc
)
1333 unsigned long flags
;
1336 ret
= dwc3_core_init(dwc
);
1340 switch (dwc
->dr_mode
) {
1341 case USB_DR_MODE_PERIPHERAL
:
1342 case USB_DR_MODE_OTG
:
1343 spin_lock_irqsave(&dwc
->lock
, flags
);
1344 dwc3_gadget_resume(dwc
);
1345 spin_unlock_irqrestore(&dwc
->lock
, flags
);
1347 case USB_DR_MODE_HOST
:
1356 static int dwc3_runtime_checks(struct dwc3
*dwc
)
1358 switch (dwc
->dr_mode
) {
1359 case USB_DR_MODE_PERIPHERAL
:
1360 case USB_DR_MODE_OTG
:
1364 case USB_DR_MODE_HOST
:
1373 static int dwc3_runtime_suspend(struct device
*dev
)
1375 struct dwc3
*dwc
= dev_get_drvdata(dev
);
1378 if (dwc3_runtime_checks(dwc
))
1381 ret
= dwc3_suspend_common(dwc
);
1385 device_init_wakeup(dev
, true);
1390 static int dwc3_runtime_resume(struct device
*dev
)
1392 struct dwc3
*dwc
= dev_get_drvdata(dev
);
1395 device_init_wakeup(dev
, false);
1397 ret
= dwc3_resume_common(dwc
);
1401 switch (dwc
->dr_mode
) {
1402 case USB_DR_MODE_PERIPHERAL
:
1403 case USB_DR_MODE_OTG
:
1404 dwc3_gadget_process_pending_events(dwc
);
1406 case USB_DR_MODE_HOST
:
1412 pm_runtime_mark_last_busy(dev
);
1413 pm_runtime_put(dev
);
1418 static int dwc3_runtime_idle(struct device
*dev
)
1420 struct dwc3
*dwc
= dev_get_drvdata(dev
);
1422 switch (dwc
->dr_mode
) {
1423 case USB_DR_MODE_PERIPHERAL
:
1424 case USB_DR_MODE_OTG
:
1425 if (dwc3_runtime_checks(dwc
))
1428 case USB_DR_MODE_HOST
:
1434 pm_runtime_mark_last_busy(dev
);
1435 pm_runtime_autosuspend(dev
);
1439 #endif /* CONFIG_PM */
1441 #ifdef CONFIG_PM_SLEEP
1442 static int dwc3_suspend(struct device
*dev
)
1444 struct dwc3
*dwc
= dev_get_drvdata(dev
);
1447 ret
= dwc3_suspend_common(dwc
);
1451 pinctrl_pm_select_sleep_state(dev
);
1456 static int dwc3_resume(struct device
*dev
)
1458 struct dwc3
*dwc
= dev_get_drvdata(dev
);
1461 pinctrl_pm_select_default_state(dev
);
1463 ret
= dwc3_resume_common(dwc
);
1467 pm_runtime_disable(dev
);
1468 pm_runtime_set_active(dev
);
1469 pm_runtime_enable(dev
);
1473 #endif /* CONFIG_PM_SLEEP */
1475 static const struct dev_pm_ops dwc3_dev_pm_ops
= {
1476 SET_SYSTEM_SLEEP_PM_OPS(dwc3_suspend
, dwc3_resume
)
1477 SET_RUNTIME_PM_OPS(dwc3_runtime_suspend
, dwc3_runtime_resume
,
1482 static const struct of_device_id of_dwc3_match
[] = {
1484 .compatible
= "snps,dwc3"
1487 .compatible
= "synopsys,dwc3"
1491 MODULE_DEVICE_TABLE(of
, of_dwc3_match
);
1496 #define ACPI_ID_INTEL_BSW "808622B7"
1498 static const struct acpi_device_id dwc3_acpi_match
[] = {
1499 { ACPI_ID_INTEL_BSW
, 0 },
1502 MODULE_DEVICE_TABLE(acpi
, dwc3_acpi_match
);
1505 static struct platform_driver dwc3_driver
= {
1506 .probe
= dwc3_probe
,
1507 .remove
= dwc3_remove
,
1510 .of_match_table
= of_match_ptr(of_dwc3_match
),
1511 .acpi_match_table
= ACPI_PTR(dwc3_acpi_match
),
1512 .pm
= &dwc3_dev_pm_ops
,
1516 module_platform_driver(dwc3_driver
);
1518 MODULE_ALIAS("platform:dwc3");
1519 MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
1520 MODULE_LICENSE("GPL v2");
1521 MODULE_DESCRIPTION("DesignWare USB3 DRD Controller Driver");