aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/dwc3')
-rw-r--r--drivers/usb/dwc3/Kconfig2
-rw-r--r--drivers/usb/dwc3/core.c251
-rw-r--r--drivers/usb/dwc3/core.h89
-rw-r--r--drivers/usb/dwc3/dwc3-exynos.c44
-rw-r--r--drivers/usb/dwc3/dwc3-keystone.c1
-rw-r--r--drivers/usb/dwc3/dwc3-omap.c20
-rw-r--r--drivers/usb/dwc3/dwc3-pci.c35
-rw-r--r--drivers/usb/dwc3/dwc3-st.c2
-rw-r--r--drivers/usb/dwc3/ep0.c26
-rw-r--r--drivers/usb/dwc3/gadget.c68
-rw-r--r--drivers/usb/dwc3/platform_data.h20
-rw-r--r--drivers/usb/dwc3/trace.h20
12 files changed, 428 insertions, 150 deletions
diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
index f4e5cc60db0b..58b5b2cde4c5 100644
--- a/drivers/usb/dwc3/Kconfig
+++ b/drivers/usb/dwc3/Kconfig
@@ -55,7 +55,7 @@ config USB_DWC3_OMAP
55 55
56config USB_DWC3_EXYNOS 56config USB_DWC3_EXYNOS
57 tristate "Samsung Exynos Platform" 57 tristate "Samsung Exynos Platform"
58 depends on ARCH_EXYNOS || COMPILE_TEST 58 depends on ARCH_EXYNOS && OF || COMPILE_TEST
59 default USB_DWC3 59 default USB_DWC3
60 help 60 help
61 Recent Exynos5 SoCs ship with one DesignWare Core USB3 IP inside, 61 Recent Exynos5 SoCs ship with one DesignWare Core USB3 IP inside,
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index b0f4d52b7f04..25ddc39efad8 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -19,6 +19,7 @@
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */ 20 */
21 21
22#include <linux/version.h>
22#include <linux/module.h> 23#include <linux/module.h>
23#include <linux/kernel.h> 24#include <linux/kernel.h>
24#include <linux/slab.h> 25#include <linux/slab.h>
@@ -32,6 +33,7 @@
32#include <linux/delay.h> 33#include <linux/delay.h>
33#include <linux/dma-mapping.h> 34#include <linux/dma-mapping.h>
34#include <linux/of.h> 35#include <linux/of.h>
36#include <linux/acpi.h>
35 37
36#include <linux/usb/ch9.h> 38#include <linux/usb/ch9.h>
37#include <linux/usb/gadget.h> 39#include <linux/usb/gadget.h>
@@ -363,6 +365,72 @@ static void dwc3_cache_hwparams(struct dwc3 *dwc)
363} 365}
364 366
365/** 367/**
368 * dwc3_phy_setup - Configure USB PHY Interface of DWC3 Core
369 * @dwc: Pointer to our controller context structure
370 */
371static void dwc3_phy_setup(struct dwc3 *dwc)
372{
373 u32 reg;
374
375 reg = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0));
376
377 /*
378 * Above 1.94a, it is recommended to set DWC3_GUSB3PIPECTL_SUSPHY
379 * to '0' during coreConsultant configuration. So default value
380 * will be '0' when the core is reset. Application needs to set it
381 * to '1' after the core initialization is completed.
382 */
383 if (dwc->revision > DWC3_REVISION_194A)
384 reg |= DWC3_GUSB3PIPECTL_SUSPHY;
385
386 if (dwc->u2ss_inp3_quirk)
387 reg |= DWC3_GUSB3PIPECTL_U2SSINP3OK;
388
389 if (dwc->req_p1p2p3_quirk)
390 reg |= DWC3_GUSB3PIPECTL_REQP1P2P3;
391
392 if (dwc->del_p1p2p3_quirk)
393 reg |= DWC3_GUSB3PIPECTL_DEP1P2P3_EN;
394
395 if (dwc->del_phy_power_chg_quirk)
396 reg |= DWC3_GUSB3PIPECTL_DEPOCHANGE;
397
398 if (dwc->lfps_filter_quirk)
399 reg |= DWC3_GUSB3PIPECTL_LFPSFILT;
400
401 if (dwc->rx_detect_poll_quirk)
402 reg |= DWC3_GUSB3PIPECTL_RX_DETOPOLL;
403
404 if (dwc->tx_de_emphasis_quirk)
405 reg |= DWC3_GUSB3PIPECTL_TX_DEEPH(dwc->tx_de_emphasis);
406
407 if (dwc->dis_u3_susphy_quirk)
408 reg &= ~DWC3_GUSB3PIPECTL_SUSPHY;
409
410 dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), reg);
411
412 mdelay(100);
413
414 reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
415
416 /*
417 * Above 1.94a, it is recommended to set DWC3_GUSB2PHYCFG_SUSPHY to
418 * '0' during coreConsultant configuration. So default value will
419 * be '0' when the core is reset. Application needs to set it to
420 * '1' after the core initialization is completed.
421 */
422 if (dwc->revision > DWC3_REVISION_194A)
423 reg |= DWC3_GUSB2PHYCFG_SUSPHY;
424
425 if (dwc->dis_u2_susphy_quirk)
426 reg &= ~DWC3_GUSB2PHYCFG_SUSPHY;
427
428 dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
429
430 mdelay(100);
431}
432
433/**
366 * dwc3_core_init - Low-level initialization of DWC3 Core 434 * dwc3_core_init - Low-level initialization of DWC3 Core
367 * @dwc: Pointer to our controller context structure 435 * @dwc: Pointer to our controller context structure
368 * 436 *
@@ -384,6 +452,12 @@ static int dwc3_core_init(struct dwc3 *dwc)
384 } 452 }
385 dwc->revision = reg; 453 dwc->revision = reg;
386 454
455 /*
456 * Write Linux Version Code to our GUID register so it's easy to figure
457 * out which kernel version a bug was found.
458 */
459 dwc3_writel(dwc->regs, DWC3_GUID, LINUX_VERSION_CODE);
460
387 /* Handle USB2.0-only core configuration */ 461 /* Handle USB2.0-only core configuration */
388 if (DWC3_GHWPARAMS3_SSPHY_IFC(dwc->hwparams.hwparams3) == 462 if (DWC3_GHWPARAMS3_SSPHY_IFC(dwc->hwparams.hwparams3) ==
389 DWC3_GHWPARAMS3_SSPHY_IFC_DIS) { 463 DWC3_GHWPARAMS3_SSPHY_IFC_DIS) {
@@ -414,7 +488,6 @@ static int dwc3_core_init(struct dwc3 *dwc)
414 488
415 reg = dwc3_readl(dwc->regs, DWC3_GCTL); 489 reg = dwc3_readl(dwc->regs, DWC3_GCTL);
416 reg &= ~DWC3_GCTL_SCALEDOWN_MASK; 490 reg &= ~DWC3_GCTL_SCALEDOWN_MASK;
417 reg &= ~DWC3_GCTL_DISSCRAMBLE;
418 491
419 switch (DWC3_GHWPARAMS1_EN_PWROPT(dwc->hwparams.hwparams1)) { 492 switch (DWC3_GHWPARAMS1_EN_PWROPT(dwc->hwparams.hwparams1)) {
420 case DWC3_GHWPARAMS1_EN_PWROPT_CLK: 493 case DWC3_GHWPARAMS1_EN_PWROPT_CLK:
@@ -441,11 +514,34 @@ static int dwc3_core_init(struct dwc3 *dwc)
441 case DWC3_GHWPARAMS1_EN_PWROPT_HIB: 514 case DWC3_GHWPARAMS1_EN_PWROPT_HIB:
442 /* enable hibernation here */ 515 /* enable hibernation here */
443 dwc->nr_scratch = DWC3_GHWPARAMS4_HIBER_SCRATCHBUFS(hwparams4); 516 dwc->nr_scratch = DWC3_GHWPARAMS4_HIBER_SCRATCHBUFS(hwparams4);
517
518 /*
519 * REVISIT Enabling this bit so that host-mode hibernation
520 * will work. Device-mode hibernation is not yet implemented.
521 */
522 reg |= DWC3_GCTL_GBLHIBERNATIONEN;
444 break; 523 break;
445 default: 524 default:
446 dev_dbg(dwc->dev, "No power optimization available\n"); 525 dev_dbg(dwc->dev, "No power optimization available\n");
447 } 526 }
448 527
528 /* check if current dwc3 is on simulation board */
529 if (dwc->hwparams.hwparams6 & DWC3_GHWPARAMS6_EN_FPGA) {
530 dev_dbg(dwc->dev, "it is on FPGA board\n");
531 dwc->is_fpga = true;
532 }
533
534 WARN_ONCE(dwc->disable_scramble_quirk && !dwc->is_fpga,
535 "disable_scramble cannot be used on non-FPGA builds\n");
536
537 if (dwc->disable_scramble_quirk && dwc->is_fpga)
538 reg |= DWC3_GCTL_DISSCRAMBLE;
539 else
540 reg &= ~DWC3_GCTL_DISSCRAMBLE;
541
542 if (dwc->u2exit_lfps_quirk)
543 reg |= DWC3_GCTL_U2EXIT_LFPS;
544
449 /* 545 /*
450 * WORKAROUND: DWC3 revisions <1.90a have a bug 546 * WORKAROUND: DWC3 revisions <1.90a have a bug
451 * where the device can fail to connect at SuperSpeed 547 * where the device can fail to connect at SuperSpeed
@@ -459,6 +555,8 @@ static int dwc3_core_init(struct dwc3 *dwc)
459 555
460 dwc3_writel(dwc->regs, DWC3_GCTL, reg); 556 dwc3_writel(dwc->regs, DWC3_GCTL, reg);
461 557
558 dwc3_phy_setup(dwc);
559
462 ret = dwc3_alloc_scratch_buffers(dwc); 560 ret = dwc3_alloc_scratch_buffers(dwc);
463 if (ret) 561 if (ret)
464 goto err1; 562 goto err1;
@@ -630,6 +728,9 @@ static int dwc3_probe(struct platform_device *pdev)
630 struct device_node *node = dev->of_node; 728 struct device_node *node = dev->of_node;
631 struct resource *res; 729 struct resource *res;
632 struct dwc3 *dwc; 730 struct dwc3 *dwc;
731 u8 lpm_nyet_threshold;
732 u8 tx_de_emphasis;
733 u8 hird_threshold;
633 734
634 int ret; 735 int ret;
635 736
@@ -685,22 +786,96 @@ static int dwc3_probe(struct platform_device *pdev)
685 */ 786 */
686 res->start -= DWC3_GLOBALS_REGS_START; 787 res->start -= DWC3_GLOBALS_REGS_START;
687 788
789 /* default to highest possible threshold */
790 lpm_nyet_threshold = 0xff;
791
792 /* default to -3.5dB de-emphasis */
793 tx_de_emphasis = 1;
794
795 /*
796 * default to assert utmi_sleep_n and use maximum allowed HIRD
797 * threshold value of 0b1100
798 */
799 hird_threshold = 12;
800
688 if (node) { 801 if (node) {
689 dwc->maximum_speed = of_usb_get_maximum_speed(node); 802 dwc->maximum_speed = of_usb_get_maximum_speed(node);
690 803 dwc->has_lpm_erratum = of_property_read_bool(node,
691 dwc->needs_fifo_resize = of_property_read_bool(node, "tx-fifo-resize"); 804 "snps,has-lpm-erratum");
805 of_property_read_u8(node, "snps,lpm-nyet-threshold",
806 &lpm_nyet_threshold);
807 dwc->is_utmi_l1_suspend = of_property_read_bool(node,
808 "snps,is-utmi-l1-suspend");
809 of_property_read_u8(node, "snps,hird-threshold",
810 &hird_threshold);
811
812 dwc->needs_fifo_resize = of_property_read_bool(node,
813 "tx-fifo-resize");
692 dwc->dr_mode = of_usb_get_dr_mode(node); 814 dwc->dr_mode = of_usb_get_dr_mode(node);
815
816 dwc->disable_scramble_quirk = of_property_read_bool(node,
817 "snps,disable_scramble_quirk");
818 dwc->u2exit_lfps_quirk = of_property_read_bool(node,
819 "snps,u2exit_lfps_quirk");
820 dwc->u2ss_inp3_quirk = of_property_read_bool(node,
821 "snps,u2ss_inp3_quirk");
822 dwc->req_p1p2p3_quirk = of_property_read_bool(node,
823 "snps,req_p1p2p3_quirk");
824 dwc->del_p1p2p3_quirk = of_property_read_bool(node,
825 "snps,del_p1p2p3_quirk");
826 dwc->del_phy_power_chg_quirk = of_property_read_bool(node,
827 "snps,del_phy_power_chg_quirk");
828 dwc->lfps_filter_quirk = of_property_read_bool(node,
829 "snps,lfps_filter_quirk");
830 dwc->rx_detect_poll_quirk = of_property_read_bool(node,
831 "snps,rx_detect_poll_quirk");
832 dwc->dis_u3_susphy_quirk = of_property_read_bool(node,
833 "snps,dis_u3_susphy_quirk");
834 dwc->dis_u2_susphy_quirk = of_property_read_bool(node,
835 "snps,dis_u2_susphy_quirk");
836
837 dwc->tx_de_emphasis_quirk = of_property_read_bool(node,
838 "snps,tx_de_emphasis_quirk");
839 of_property_read_u8(node, "snps,tx_de_emphasis",
840 &tx_de_emphasis);
693 } else if (pdata) { 841 } else if (pdata) {
694 dwc->maximum_speed = pdata->maximum_speed; 842 dwc->maximum_speed = pdata->maximum_speed;
843 dwc->has_lpm_erratum = pdata->has_lpm_erratum;
844 if (pdata->lpm_nyet_threshold)
845 lpm_nyet_threshold = pdata->lpm_nyet_threshold;
846 dwc->is_utmi_l1_suspend = pdata->is_utmi_l1_suspend;
847 if (pdata->hird_threshold)
848 hird_threshold = pdata->hird_threshold;
695 849
696 dwc->needs_fifo_resize = pdata->tx_fifo_resize; 850 dwc->needs_fifo_resize = pdata->tx_fifo_resize;
697 dwc->dr_mode = pdata->dr_mode; 851 dwc->dr_mode = pdata->dr_mode;
852
853 dwc->disable_scramble_quirk = pdata->disable_scramble_quirk;
854 dwc->u2exit_lfps_quirk = pdata->u2exit_lfps_quirk;
855 dwc->u2ss_inp3_quirk = pdata->u2ss_inp3_quirk;
856 dwc->req_p1p2p3_quirk = pdata->req_p1p2p3_quirk;
857 dwc->del_p1p2p3_quirk = pdata->del_p1p2p3_quirk;
858 dwc->del_phy_power_chg_quirk = pdata->del_phy_power_chg_quirk;
859 dwc->lfps_filter_quirk = pdata->lfps_filter_quirk;
860 dwc->rx_detect_poll_quirk = pdata->rx_detect_poll_quirk;
861 dwc->dis_u3_susphy_quirk = pdata->dis_u3_susphy_quirk;
862 dwc->dis_u2_susphy_quirk = pdata->dis_u2_susphy_quirk;
863
864 dwc->tx_de_emphasis_quirk = pdata->tx_de_emphasis_quirk;
865 if (pdata->tx_de_emphasis)
866 tx_de_emphasis = pdata->tx_de_emphasis;
698 } 867 }
699 868
700 /* default to superspeed if no maximum_speed passed */ 869 /* default to superspeed if no maximum_speed passed */
701 if (dwc->maximum_speed == USB_SPEED_UNKNOWN) 870 if (dwc->maximum_speed == USB_SPEED_UNKNOWN)
702 dwc->maximum_speed = USB_SPEED_SUPER; 871 dwc->maximum_speed = USB_SPEED_SUPER;
703 872
873 dwc->lpm_nyet_threshold = lpm_nyet_threshold;
874 dwc->tx_de_emphasis = tx_de_emphasis;
875
876 dwc->hird_threshold = hird_threshold
877 | (dwc->is_utmi_l1_suspend << 4);
878
704 ret = dwc3_core_get_phy(dwc); 879 ret = dwc3_core_get_phy(dwc);
705 if (ret) 880 if (ret)
706 return ret; 881 return ret;
@@ -708,9 +883,11 @@ static int dwc3_probe(struct platform_device *pdev)
708 spin_lock_init(&dwc->lock); 883 spin_lock_init(&dwc->lock);
709 platform_set_drvdata(pdev, dwc); 884 platform_set_drvdata(pdev, dwc);
710 885
711 dev->dma_mask = dev->parent->dma_mask; 886 if (!dev->dma_mask) {
712 dev->dma_parms = dev->parent->dma_parms; 887 dev->dma_mask = dev->parent->dma_mask;
713 dma_set_coherent_mask(dev, dev->parent->coherent_dma_mask); 888 dev->dma_parms = dev->parent->dma_parms;
889 dma_set_coherent_mask(dev, dev->parent->coherent_dma_mask);
890 }
714 891
715 pm_runtime_enable(dev); 892 pm_runtime_enable(dev);
716 pm_runtime_get_sync(dev); 893 pm_runtime_get_sync(dev);
@@ -815,50 +992,6 @@ static int dwc3_remove(struct platform_device *pdev)
815} 992}
816 993
817#ifdef CONFIG_PM_SLEEP 994#ifdef CONFIG_PM_SLEEP
818static int dwc3_prepare(struct device *dev)
819{
820 struct dwc3 *dwc = dev_get_drvdata(dev);
821 unsigned long flags;
822
823 spin_lock_irqsave(&dwc->lock, flags);
824
825 switch (dwc->dr_mode) {
826 case USB_DR_MODE_PERIPHERAL:
827 case USB_DR_MODE_OTG:
828 dwc3_gadget_prepare(dwc);
829 /* FALLTHROUGH */
830 case USB_DR_MODE_HOST:
831 default:
832 dwc3_event_buffers_cleanup(dwc);
833 break;
834 }
835
836 spin_unlock_irqrestore(&dwc->lock, flags);
837
838 return 0;
839}
840
841static void dwc3_complete(struct device *dev)
842{
843 struct dwc3 *dwc = dev_get_drvdata(dev);
844 unsigned long flags;
845
846 spin_lock_irqsave(&dwc->lock, flags);
847
848 dwc3_event_buffers_setup(dwc);
849 switch (dwc->dr_mode) {
850 case USB_DR_MODE_PERIPHERAL:
851 case USB_DR_MODE_OTG:
852 dwc3_gadget_complete(dwc);
853 /* FALLTHROUGH */
854 case USB_DR_MODE_HOST:
855 default:
856 break;
857 }
858
859 spin_unlock_irqrestore(&dwc->lock, flags);
860}
861
862static int dwc3_suspend(struct device *dev) 995static int dwc3_suspend(struct device *dev)
863{ 996{
864 struct dwc3 *dwc = dev_get_drvdata(dev); 997 struct dwc3 *dwc = dev_get_drvdata(dev);
@@ -873,7 +1006,7 @@ static int dwc3_suspend(struct device *dev)
873 /* FALLTHROUGH */ 1006 /* FALLTHROUGH */
874 case USB_DR_MODE_HOST: 1007 case USB_DR_MODE_HOST:
875 default: 1008 default:
876 /* do nothing */ 1009 dwc3_event_buffers_cleanup(dwc);
877 break; 1010 break;
878 } 1011 }
879 1012
@@ -906,6 +1039,7 @@ static int dwc3_resume(struct device *dev)
906 1039
907 spin_lock_irqsave(&dwc->lock, flags); 1040 spin_lock_irqsave(&dwc->lock, flags);
908 1041
1042 dwc3_event_buffers_setup(dwc);
909 dwc3_writel(dwc->regs, DWC3_GCTL, dwc->gctl); 1043 dwc3_writel(dwc->regs, DWC3_GCTL, dwc->gctl);
910 1044
911 switch (dwc->dr_mode) { 1045 switch (dwc->dr_mode) {
@@ -934,9 +1068,6 @@ err_usb2phy_init:
934} 1068}
935 1069
936static const struct dev_pm_ops dwc3_dev_pm_ops = { 1070static const struct dev_pm_ops dwc3_dev_pm_ops = {
937 .prepare = dwc3_prepare,
938 .complete = dwc3_complete,
939
940 SET_SYSTEM_SLEEP_PM_OPS(dwc3_suspend, dwc3_resume) 1071 SET_SYSTEM_SLEEP_PM_OPS(dwc3_suspend, dwc3_resume)
941}; 1072};
942 1073
@@ -958,12 +1089,24 @@ static const struct of_device_id of_dwc3_match[] = {
958MODULE_DEVICE_TABLE(of, of_dwc3_match); 1089MODULE_DEVICE_TABLE(of, of_dwc3_match);
959#endif 1090#endif
960 1091
1092#ifdef CONFIG_ACPI
1093
1094#define ACPI_ID_INTEL_BSW "808622B7"
1095
1096static const struct acpi_device_id dwc3_acpi_match[] = {
1097 { ACPI_ID_INTEL_BSW, 0 },
1098 { },
1099};
1100MODULE_DEVICE_TABLE(acpi, dwc3_acpi_match);
1101#endif
1102
961static struct platform_driver dwc3_driver = { 1103static struct platform_driver dwc3_driver = {
962 .probe = dwc3_probe, 1104 .probe = dwc3_probe,
963 .remove = dwc3_remove, 1105 .remove = dwc3_remove,
964 .driver = { 1106 .driver = {
965 .name = "dwc3", 1107 .name = "dwc3",
966 .of_match_table = of_match_ptr(of_dwc3_match), 1108 .of_match_table = of_match_ptr(of_dwc3_match),
1109 .acpi_match_table = ACPI_PTR(dwc3_acpi_match),
967 .pm = DWC3_PM_OPS, 1110 .pm = DWC3_PM_OPS,
968 }, 1111 },
969}; 1112};
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 66f62563bcf9..4bb9aa696ede 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -166,6 +166,7 @@
166#define DWC3_GCTL_SCALEDOWN(n) ((n) << 4) 166#define DWC3_GCTL_SCALEDOWN(n) ((n) << 4)
167#define DWC3_GCTL_SCALEDOWN_MASK DWC3_GCTL_SCALEDOWN(3) 167#define DWC3_GCTL_SCALEDOWN_MASK DWC3_GCTL_SCALEDOWN(3)
168#define DWC3_GCTL_DISSCRAMBLE (1 << 3) 168#define DWC3_GCTL_DISSCRAMBLE (1 << 3)
169#define DWC3_GCTL_U2EXIT_LFPS (1 << 2)
169#define DWC3_GCTL_GBLHIBERNATIONEN (1 << 1) 170#define DWC3_GCTL_GBLHIBERNATIONEN (1 << 1)
170#define DWC3_GCTL_DSBLCLKGTNG (1 << 0) 171#define DWC3_GCTL_DSBLCLKGTNG (1 << 0)
171 172
@@ -175,7 +176,17 @@
175 176
176/* Global USB3 PIPE Control Register */ 177/* Global USB3 PIPE Control Register */
177#define DWC3_GUSB3PIPECTL_PHYSOFTRST (1 << 31) 178#define DWC3_GUSB3PIPECTL_PHYSOFTRST (1 << 31)
179#define DWC3_GUSB3PIPECTL_U2SSINP3OK (1 << 29)
180#define DWC3_GUSB3PIPECTL_REQP1P2P3 (1 << 24)
181#define DWC3_GUSB3PIPECTL_DEP1P2P3(n) ((n) << 19)
182#define DWC3_GUSB3PIPECTL_DEP1P2P3_MASK DWC3_GUSB3PIPECTL_DEP1P2P3(7)
183#define DWC3_GUSB3PIPECTL_DEP1P2P3_EN DWC3_GUSB3PIPECTL_DEP1P2P3(1)
184#define DWC3_GUSB3PIPECTL_DEPOCHANGE (1 << 18)
178#define DWC3_GUSB3PIPECTL_SUSPHY (1 << 17) 185#define DWC3_GUSB3PIPECTL_SUSPHY (1 << 17)
186#define DWC3_GUSB3PIPECTL_LFPSFILT (1 << 9)
187#define DWC3_GUSB3PIPECTL_RX_DETOPOLL (1 << 8)
188#define DWC3_GUSB3PIPECTL_TX_DEEPH_MASK DWC3_GUSB3PIPECTL_TX_DEEPH(3)
189#define DWC3_GUSB3PIPECTL_TX_DEEPH(n) ((n) << 1)
179 190
180/* Global TX Fifo Size Register */ 191/* Global TX Fifo Size Register */
181#define DWC3_GTXFIFOSIZ_TXFDEF(n) ((n) & 0xffff) 192#define DWC3_GTXFIFOSIZ_TXFDEF(n) ((n) & 0xffff)
@@ -210,6 +221,9 @@
210#define DWC3_GHWPARAMS4_HIBER_SCRATCHBUFS(n) (((n) & (0x0f << 13)) >> 13) 221#define DWC3_GHWPARAMS4_HIBER_SCRATCHBUFS(n) (((n) & (0x0f << 13)) >> 13)
211#define DWC3_MAX_HIBER_SCRATCHBUFS 15 222#define DWC3_MAX_HIBER_SCRATCHBUFS 15
212 223
224/* Global HWPARAMS6 Register */
225#define DWC3_GHWPARAMS6_EN_FPGA (1 << 7)
226
213/* Device Configuration Register */ 227/* Device Configuration Register */
214#define DWC3_DCFG_DEVADDR(addr) ((addr) << 3) 228#define DWC3_DCFG_DEVADDR(addr) ((addr) << 3)
215#define DWC3_DCFG_DEVADDR_MASK DWC3_DCFG_DEVADDR(0x7f) 229#define DWC3_DCFG_DEVADDR_MASK DWC3_DCFG_DEVADDR(0x7f)
@@ -243,16 +257,19 @@
243#define DWC3_DCTL_TRGTULST_SS_INACT (DWC3_DCTL_TRGTULST(6)) 257#define DWC3_DCTL_TRGTULST_SS_INACT (DWC3_DCTL_TRGTULST(6))
244 258
245/* These apply for core versions 1.94a and later */ 259/* These apply for core versions 1.94a and later */
246#define DWC3_DCTL_KEEP_CONNECT (1 << 19) 260#define DWC3_DCTL_LPM_ERRATA_MASK DWC3_DCTL_LPM_ERRATA(0xf)
247#define DWC3_DCTL_L1_HIBER_EN (1 << 18) 261#define DWC3_DCTL_LPM_ERRATA(n) ((n) << 20)
248#define DWC3_DCTL_CRS (1 << 17) 262
249#define DWC3_DCTL_CSS (1 << 16) 263#define DWC3_DCTL_KEEP_CONNECT (1 << 19)
264#define DWC3_DCTL_L1_HIBER_EN (1 << 18)
265#define DWC3_DCTL_CRS (1 << 17)
266#define DWC3_DCTL_CSS (1 << 16)
250 267
251#define DWC3_DCTL_INITU2ENA (1 << 12) 268#define DWC3_DCTL_INITU2ENA (1 << 12)
252#define DWC3_DCTL_ACCEPTU2ENA (1 << 11) 269#define DWC3_DCTL_ACCEPTU2ENA (1 << 11)
253#define DWC3_DCTL_INITU1ENA (1 << 10) 270#define DWC3_DCTL_INITU1ENA (1 << 10)
254#define DWC3_DCTL_ACCEPTU1ENA (1 << 9) 271#define DWC3_DCTL_ACCEPTU1ENA (1 << 9)
255#define DWC3_DCTL_TSTCTRL_MASK (0xf << 1) 272#define DWC3_DCTL_TSTCTRL_MASK (0xf << 1)
256 273
257#define DWC3_DCTL_ULSTCHNGREQ_MASK (0x0f << 5) 274#define DWC3_DCTL_ULSTCHNGREQ_MASK (0x0f << 5)
258#define DWC3_DCTL_ULSTCHNGREQ(n) (((n) << 5) & DWC3_DCTL_ULSTCHNGREQ_MASK) 275#define DWC3_DCTL_ULSTCHNGREQ(n) (((n) << 5) & DWC3_DCTL_ULSTCHNGREQ_MASK)
@@ -657,17 +674,41 @@ struct dwc3_scratchpad_array {
657 * @regset: debugfs pointer to regdump file 674 * @regset: debugfs pointer to regdump file
658 * @test_mode: true when we're entering a USB test mode 675 * @test_mode: true when we're entering a USB test mode
659 * @test_mode_nr: test feature selector 676 * @test_mode_nr: test feature selector
677 * @lpm_nyet_threshold: LPM NYET response threshold
678 * @hird_threshold: HIRD threshold
660 * @delayed_status: true when gadget driver asks for delayed status 679 * @delayed_status: true when gadget driver asks for delayed status
661 * @ep0_bounced: true when we used bounce buffer 680 * @ep0_bounced: true when we used bounce buffer
662 * @ep0_expect_in: true when we expect a DATA IN transfer 681 * @ep0_expect_in: true when we expect a DATA IN transfer
663 * @has_hibernation: true when dwc3 was configured with Hibernation 682 * @has_hibernation: true when dwc3 was configured with Hibernation
683 * @has_lpm_erratum: true when core was configured with LPM Erratum. Note that
684 * there's now way for software to detect this in runtime.
685 * @is_utmi_l1_suspend: the core asserts output signal
686 * 0 - utmi_sleep_n
687 * 1 - utmi_l1_suspend_n
664 * @is_selfpowered: true when we are selfpowered 688 * @is_selfpowered: true when we are selfpowered
689 * @is_fpga: true when we are using the FPGA board
665 * @needs_fifo_resize: not all users might want fifo resizing, flag it 690 * @needs_fifo_resize: not all users might want fifo resizing, flag it
666 * @pullups_connected: true when Run/Stop bit is set 691 * @pullups_connected: true when Run/Stop bit is set
667 * @resize_fifos: tells us it's ok to reconfigure our TxFIFO sizes. 692 * @resize_fifos: tells us it's ok to reconfigure our TxFIFO sizes.
668 * @setup_packet_pending: true when there's a Setup Packet in FIFO. Workaround 693 * @setup_packet_pending: true when there's a Setup Packet in FIFO. Workaround
669 * @start_config_issued: true when StartConfig command has been issued 694 * @start_config_issued: true when StartConfig command has been issued
670 * @three_stage_setup: set if we perform a three phase setup 695 * @three_stage_setup: set if we perform a three phase setup
696 * @disable_scramble_quirk: set if we enable the disable scramble quirk
697 * @u2exit_lfps_quirk: set if we enable u2exit lfps quirk
698 * @u2ss_inp3_quirk: set if we enable P3 OK for U2/SS Inactive quirk
699 * @req_p1p2p3_quirk: set if we enable request p1p2p3 quirk
700 * @del_p1p2p3_quirk: set if we enable delay p1p2p3 quirk
701 * @del_phy_power_chg_quirk: set if we enable delay phy power change quirk
702 * @lfps_filter_quirk: set if we enable LFPS filter quirk
703 * @rx_detect_poll_quirk: set if we enable rx_detect to polling lfps quirk
704 * @dis_u3_susphy_quirk: set if we disable usb3 suspend phy
705 * @dis_u2_susphy_quirk: set if we disable usb2 suspend phy
706 * @tx_de_emphasis_quirk: set if we enable Tx de-emphasis quirk
707 * @tx_de_emphasis: Tx de-emphasis value
708 * 0 - -6dB de-emphasis
709 * 1 - -3.5dB de-emphasis
710 * 2 - No de-emphasis
711 * 3 - Reserved
671 */ 712 */
672struct dwc3 { 713struct dwc3 {
673 struct usb_ctrlrequest *ctrl_req; 714 struct usb_ctrlrequest *ctrl_req;
@@ -759,18 +800,37 @@ struct dwc3 {
759 800
760 u8 test_mode; 801 u8 test_mode;
761 u8 test_mode_nr; 802 u8 test_mode_nr;
803 u8 lpm_nyet_threshold;
804 u8 hird_threshold;
762 805
763 unsigned delayed_status:1; 806 unsigned delayed_status:1;
764 unsigned ep0_bounced:1; 807 unsigned ep0_bounced:1;
765 unsigned ep0_expect_in:1; 808 unsigned ep0_expect_in:1;
766 unsigned has_hibernation:1; 809 unsigned has_hibernation:1;
810 unsigned has_lpm_erratum:1;
811 unsigned is_utmi_l1_suspend:1;
767 unsigned is_selfpowered:1; 812 unsigned is_selfpowered:1;
813 unsigned is_fpga:1;
768 unsigned needs_fifo_resize:1; 814 unsigned needs_fifo_resize:1;
769 unsigned pullups_connected:1; 815 unsigned pullups_connected:1;
770 unsigned resize_fifos:1; 816 unsigned resize_fifos:1;
771 unsigned setup_packet_pending:1; 817 unsigned setup_packet_pending:1;
772 unsigned start_config_issued:1; 818 unsigned start_config_issued:1;
773 unsigned three_stage_setup:1; 819 unsigned three_stage_setup:1;
820
821 unsigned disable_scramble_quirk:1;
822 unsigned u2exit_lfps_quirk:1;
823 unsigned u2ss_inp3_quirk:1;
824 unsigned req_p1p2p3_quirk:1;
825 unsigned del_p1p2p3_quirk:1;
826 unsigned del_phy_power_chg_quirk:1;
827 unsigned lfps_filter_quirk:1;
828 unsigned rx_detect_poll_quirk:1;
829 unsigned dis_u3_susphy_quirk:1;
830 unsigned dis_u2_susphy_quirk:1;
831
832 unsigned tx_de_emphasis_quirk:1;
833 unsigned tx_de_emphasis:2;
774}; 834};
775 835
776/* -------------------------------------------------------------------------- */ 836/* -------------------------------------------------------------------------- */
@@ -964,20 +1024,9 @@ static inline int dwc3_send_gadget_generic_command(struct dwc3 *dwc,
964 1024
965/* power management interface */ 1025/* power management interface */
966#if !IS_ENABLED(CONFIG_USB_DWC3_HOST) 1026#if !IS_ENABLED(CONFIG_USB_DWC3_HOST)
967int dwc3_gadget_prepare(struct dwc3 *dwc);
968void dwc3_gadget_complete(struct dwc3 *dwc);
969int dwc3_gadget_suspend(struct dwc3 *dwc); 1027int dwc3_gadget_suspend(struct dwc3 *dwc);
970int dwc3_gadget_resume(struct dwc3 *dwc); 1028int dwc3_gadget_resume(struct dwc3 *dwc);
971#else 1029#else
972static inline int dwc3_gadget_prepare(struct dwc3 *dwc)
973{
974 return 0;
975}
976
977static inline void dwc3_gadget_complete(struct dwc3 *dwc)
978{
979}
980
981static inline int dwc3_gadget_suspend(struct dwc3 *dwc) 1030static inline int dwc3_gadget_suspend(struct dwc3 *dwc)
982{ 1031{
983 return 0; 1032 return 0;
diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
index 3951a65fea04..7bd0a95b2815 100644
--- a/drivers/usb/dwc3/dwc3-exynos.c
+++ b/drivers/usb/dwc3/dwc3-exynos.c
@@ -20,7 +20,6 @@
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/slab.h> 21#include <linux/slab.h>
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/platform_data/dwc3-exynos.h>
24#include <linux/dma-mapping.h> 23#include <linux/dma-mapping.h>
25#include <linux/clk.h> 24#include <linux/clk.h>
26#include <linux/usb/otg.h> 25#include <linux/usb/otg.h>
@@ -35,6 +34,9 @@ struct dwc3_exynos {
35 struct device *dev; 34 struct device *dev;
36 35
37 struct clk *clk; 36 struct clk *clk;
37 struct clk *susp_clk;
38 struct clk *axius_clk;
39
38 struct regulator *vdd33; 40 struct regulator *vdd33;
39 struct regulator *vdd10; 41 struct regulator *vdd10;
40}; 42};
@@ -106,7 +108,6 @@ static int dwc3_exynos_remove_child(struct device *dev, void *unused)
106static int dwc3_exynos_probe(struct platform_device *pdev) 108static int dwc3_exynos_probe(struct platform_device *pdev)
107{ 109{
108 struct dwc3_exynos *exynos; 110 struct dwc3_exynos *exynos;
109 struct clk *clk;
110 struct device *dev = &pdev->dev; 111 struct device *dev = &pdev->dev;
111 struct device_node *node = dev->of_node; 112 struct device_node *node = dev->of_node;
112 113
@@ -133,16 +134,32 @@ static int dwc3_exynos_probe(struct platform_device *pdev)
133 return ret; 134 return ret;
134 } 135 }
135 136
136 clk = devm_clk_get(dev, "usbdrd30"); 137 exynos->dev = dev;
137 if (IS_ERR(clk)) { 138
139 exynos->clk = devm_clk_get(dev, "usbdrd30");
140 if (IS_ERR(exynos->clk)) {
138 dev_err(dev, "couldn't get clock\n"); 141 dev_err(dev, "couldn't get clock\n");
139 return -EINVAL; 142 return -EINVAL;
140 } 143 }
144 clk_prepare_enable(exynos->clk);
141 145
142 exynos->dev = dev; 146 exynos->susp_clk = devm_clk_get(dev, "usbdrd30_susp_clk");
143 exynos->clk = clk; 147 if (IS_ERR(exynos->susp_clk)) {
148 dev_dbg(dev, "no suspend clk specified\n");
149 exynos->susp_clk = NULL;
150 }
151 clk_prepare_enable(exynos->susp_clk);
144 152
145 clk_prepare_enable(exynos->clk); 153 if (of_device_is_compatible(node, "samsung,exynos7-dwusb3")) {
154 exynos->axius_clk = devm_clk_get(dev, "usbdrd30_axius_clk");
155 if (IS_ERR(exynos->axius_clk)) {
156 dev_err(dev, "no AXI UpScaler clk specified\n");
157 return -ENODEV;
158 }
159 clk_prepare_enable(exynos->axius_clk);
160 } else {
161 exynos->axius_clk = NULL;
162 }
146 163
147 exynos->vdd33 = devm_regulator_get(dev, "vdd33"); 164 exynos->vdd33 = devm_regulator_get(dev, "vdd33");
148 if (IS_ERR(exynos->vdd33)) { 165 if (IS_ERR(exynos->vdd33)) {
@@ -185,7 +202,9 @@ err4:
185err3: 202err3:
186 regulator_disable(exynos->vdd33); 203 regulator_disable(exynos->vdd33);
187err2: 204err2:
188 clk_disable_unprepare(clk); 205 clk_disable_unprepare(exynos->axius_clk);
206 clk_disable_unprepare(exynos->susp_clk);
207 clk_disable_unprepare(exynos->clk);
189 return ret; 208 return ret;
190} 209}
191 210
@@ -197,6 +216,8 @@ static int dwc3_exynos_remove(struct platform_device *pdev)
197 platform_device_unregister(exynos->usb2_phy); 216 platform_device_unregister(exynos->usb2_phy);
198 platform_device_unregister(exynos->usb3_phy); 217 platform_device_unregister(exynos->usb3_phy);
199 218
219 clk_disable_unprepare(exynos->axius_clk);
220 clk_disable_unprepare(exynos->susp_clk);
200 clk_disable_unprepare(exynos->clk); 221 clk_disable_unprepare(exynos->clk);
201 222
202 regulator_disable(exynos->vdd33); 223 regulator_disable(exynos->vdd33);
@@ -205,19 +226,19 @@ static int dwc3_exynos_remove(struct platform_device *pdev)
205 return 0; 226 return 0;
206} 227}
207 228
208#ifdef CONFIG_OF
209static const struct of_device_id exynos_dwc3_match[] = { 229static const struct of_device_id exynos_dwc3_match[] = {
210 { .compatible = "samsung,exynos5250-dwusb3" }, 230 { .compatible = "samsung,exynos5250-dwusb3" },
231 { .compatible = "samsung,exynos7-dwusb3" },
211 {}, 232 {},
212}; 233};
213MODULE_DEVICE_TABLE(of, exynos_dwc3_match); 234MODULE_DEVICE_TABLE(of, exynos_dwc3_match);
214#endif
215 235
216#ifdef CONFIG_PM_SLEEP 236#ifdef CONFIG_PM_SLEEP
217static int dwc3_exynos_suspend(struct device *dev) 237static int dwc3_exynos_suspend(struct device *dev)
218{ 238{
219 struct dwc3_exynos *exynos = dev_get_drvdata(dev); 239 struct dwc3_exynos *exynos = dev_get_drvdata(dev);
220 240
241 clk_disable(exynos->axius_clk);
221 clk_disable(exynos->clk); 242 clk_disable(exynos->clk);
222 243
223 regulator_disable(exynos->vdd33); 244 regulator_disable(exynos->vdd33);
@@ -243,6 +264,7 @@ static int dwc3_exynos_resume(struct device *dev)
243 } 264 }
244 265
245 clk_enable(exynos->clk); 266 clk_enable(exynos->clk);
267 clk_enable(exynos->axius_clk);
246 268
247 /* runtime set active to reflect active state. */ 269 /* runtime set active to reflect active state. */
248 pm_runtime_disable(dev); 270 pm_runtime_disable(dev);
@@ -266,7 +288,7 @@ static struct platform_driver dwc3_exynos_driver = {
266 .remove = dwc3_exynos_remove, 288 .remove = dwc3_exynos_remove,
267 .driver = { 289 .driver = {
268 .name = "exynos-dwc3", 290 .name = "exynos-dwc3",
269 .of_match_table = of_match_ptr(exynos_dwc3_match), 291 .of_match_table = exynos_dwc3_match,
270 .pm = DEV_PM_OPS, 292 .pm = DEV_PM_OPS,
271 }, 293 },
272}; 294};
diff --git a/drivers/usb/dwc3/dwc3-keystone.c b/drivers/usb/dwc3/dwc3-keystone.c
index dd8d2df6db31..fe3b9335a74e 100644
--- a/drivers/usb/dwc3/dwc3-keystone.c
+++ b/drivers/usb/dwc3/dwc3-keystone.c
@@ -123,6 +123,7 @@ static int kdwc3_probe(struct platform_device *pdev)
123 irq = platform_get_irq(pdev, 0); 123 irq = platform_get_irq(pdev, 0);
124 if (irq < 0) { 124 if (irq < 0) {
125 dev_err(&pdev->dev, "missing irq\n"); 125 dev_err(&pdev->dev, "missing irq\n");
126 error = irq;
126 goto err_irq; 127 goto err_irq;
127 } 128 }
128 129
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index a0aa9f3da441..172d64e585b6 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -593,27 +593,12 @@ static const struct of_device_id of_dwc3_match[] = {
593MODULE_DEVICE_TABLE(of, of_dwc3_match); 593MODULE_DEVICE_TABLE(of, of_dwc3_match);
594 594
595#ifdef CONFIG_PM_SLEEP 595#ifdef CONFIG_PM_SLEEP
596static int dwc3_omap_prepare(struct device *dev)
597{
598 struct dwc3_omap *omap = dev_get_drvdata(dev);
599
600 dwc3_omap_disable_irqs(omap);
601
602 return 0;
603}
604
605static void dwc3_omap_complete(struct device *dev)
606{
607 struct dwc3_omap *omap = dev_get_drvdata(dev);
608
609 dwc3_omap_enable_irqs(omap);
610}
611
612static int dwc3_omap_suspend(struct device *dev) 596static int dwc3_omap_suspend(struct device *dev)
613{ 597{
614 struct dwc3_omap *omap = dev_get_drvdata(dev); 598 struct dwc3_omap *omap = dev_get_drvdata(dev);
615 599
616 omap->utmi_otg_status = dwc3_omap_read_utmi_status(omap); 600 omap->utmi_otg_status = dwc3_omap_read_utmi_status(omap);
601 dwc3_omap_disable_irqs(omap);
617 602
618 return 0; 603 return 0;
619} 604}
@@ -623,6 +608,7 @@ static int dwc3_omap_resume(struct device *dev)
623 struct dwc3_omap *omap = dev_get_drvdata(dev); 608 struct dwc3_omap *omap = dev_get_drvdata(dev);
624 609
625 dwc3_omap_write_utmi_status(omap, omap->utmi_otg_status); 610 dwc3_omap_write_utmi_status(omap, omap->utmi_otg_status);
611 dwc3_omap_enable_irqs(omap);
626 612
627 pm_runtime_disable(dev); 613 pm_runtime_disable(dev);
628 pm_runtime_set_active(dev); 614 pm_runtime_set_active(dev);
@@ -632,8 +618,6 @@ static int dwc3_omap_resume(struct device *dev)
632} 618}
633 619
634static const struct dev_pm_ops dwc3_omap_dev_pm_ops = { 620static const struct dev_pm_ops dwc3_omap_dev_pm_ops = {
635 .prepare = dwc3_omap_prepare,
636 .complete = dwc3_omap_complete,
637 621
638 SET_SYSTEM_SLEEP_PM_OPS(dwc3_omap_suspend, dwc3_omap_resume) 622 SET_SYSTEM_SLEEP_PM_OPS(dwc3_omap_suspend, dwc3_omap_resume)
639}; 623};
diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index a36cf66302fb..7c4faf738747 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -25,6 +25,8 @@
25#include <linux/usb/otg.h> 25#include <linux/usb/otg.h>
26#include <linux/usb/usb_phy_generic.h> 26#include <linux/usb/usb_phy_generic.h>
27 27
28#include "platform_data.h"
29
28/* FIXME define these in <linux/pci_ids.h> */ 30/* FIXME define these in <linux/pci_ids.h> */
29#define PCI_VENDOR_ID_SYNOPSYS 0x16c3 31#define PCI_VENDOR_ID_SYNOPSYS 0x16c3
30#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd 32#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd
@@ -102,6 +104,9 @@ static int dwc3_pci_probe(struct pci_dev *pci,
102 struct dwc3_pci *glue; 104 struct dwc3_pci *glue;
103 int ret; 105 int ret;
104 struct device *dev = &pci->dev; 106 struct device *dev = &pci->dev;
107 struct dwc3_platform_data dwc3_pdata;
108
109 memset(&dwc3_pdata, 0x00, sizeof(dwc3_pdata));
105 110
106 glue = devm_kzalloc(dev, sizeof(*glue), GFP_KERNEL); 111 glue = devm_kzalloc(dev, sizeof(*glue), GFP_KERNEL);
107 if (!glue) 112 if (!glue)
@@ -140,6 +145,31 @@ static int dwc3_pci_probe(struct pci_dev *pci,
140 res[1].name = "dwc_usb3"; 145 res[1].name = "dwc_usb3";
141 res[1].flags = IORESOURCE_IRQ; 146 res[1].flags = IORESOURCE_IRQ;
142 147
148 if (pci->vendor == PCI_VENDOR_ID_AMD &&
149 pci->device == PCI_DEVICE_ID_AMD_NL_USB) {
150 dwc3_pdata.has_lpm_erratum = true;
151 dwc3_pdata.lpm_nyet_threshold = 0xf;
152
153 dwc3_pdata.u2exit_lfps_quirk = true;
154 dwc3_pdata.u2ss_inp3_quirk = true;
155 dwc3_pdata.req_p1p2p3_quirk = true;
156 dwc3_pdata.del_p1p2p3_quirk = true;
157 dwc3_pdata.del_phy_power_chg_quirk = true;
158 dwc3_pdata.lfps_filter_quirk = true;
159 dwc3_pdata.rx_detect_poll_quirk = true;
160
161 dwc3_pdata.tx_de_emphasis_quirk = true;
162 dwc3_pdata.tx_de_emphasis = 1;
163
164 /*
165 * FIXME these quirks should be removed when AMD NL
166 * taps out
167 */
168 dwc3_pdata.disable_scramble_quirk = true;
169 dwc3_pdata.dis_u3_susphy_quirk = true;
170 dwc3_pdata.dis_u2_susphy_quirk = true;
171 }
172
143 ret = platform_device_add_resources(dwc3, res, ARRAY_SIZE(res)); 173 ret = platform_device_add_resources(dwc3, res, ARRAY_SIZE(res));
144 if (ret) { 174 if (ret) {
145 dev_err(dev, "couldn't add resources to dwc3 device\n"); 175 dev_err(dev, "couldn't add resources to dwc3 device\n");
@@ -148,6 +178,10 @@ static int dwc3_pci_probe(struct pci_dev *pci,
148 178
149 pci_set_drvdata(pci, glue); 179 pci_set_drvdata(pci, glue);
150 180
181 ret = platform_device_add_data(dwc3, &dwc3_pdata, sizeof(dwc3_pdata));
182 if (ret)
183 goto err3;
184
151 dma_set_coherent_mask(&dwc3->dev, dev->coherent_dma_mask); 185 dma_set_coherent_mask(&dwc3->dev, dev->coherent_dma_mask);
152 186
153 dwc3->dev.dma_mask = dev->dma_mask; 187 dwc3->dev.dma_mask = dev->dma_mask;
@@ -185,6 +219,7 @@ static const struct pci_device_id dwc3_pci_id_table[] = {
185 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BSW), }, 219 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BSW), },
186 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BYT), }, 220 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BYT), },
187 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MRFLD), }, 221 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MRFLD), },
222 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), },
188 { } /* Terminating Entry */ 223 { } /* Terminating Entry */
189}; 224};
190MODULE_DEVICE_TABLE(pci, dwc3_pci_id_table); 225MODULE_DEVICE_TABLE(pci, dwc3_pci_id_table);
diff --git a/drivers/usb/dwc3/dwc3-st.c b/drivers/usb/dwc3/dwc3-st.c
index c7602b5362ad..4a1a543deeda 100644
--- a/drivers/usb/dwc3/dwc3-st.c
+++ b/drivers/usb/dwc3/dwc3-st.c
@@ -243,7 +243,7 @@ static int st_dwc3_probe(struct platform_device *pdev)
243 dwc3_data->rstc_rst = devm_reset_control_get(dev, "softreset"); 243 dwc3_data->rstc_rst = devm_reset_control_get(dev, "softreset");
244 if (IS_ERR(dwc3_data->rstc_rst)) { 244 if (IS_ERR(dwc3_data->rstc_rst)) {
245 dev_err(&pdev->dev, "could not get reset controller\n"); 245 dev_err(&pdev->dev, "could not get reset controller\n");
246 ret = PTR_ERR(dwc3_data->rstc_pwrdn); 246 ret = PTR_ERR(dwc3_data->rstc_rst);
247 goto undo_powerdown; 247 goto undo_powerdown;
248 } 248 }
249 249
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 711b23019d54..baeedbd67f77 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -86,6 +86,8 @@ static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum, dma_addr_t buf_dma,
86 params.param0 = upper_32_bits(dwc->ep0_trb_addr); 86 params.param0 = upper_32_bits(dwc->ep0_trb_addr);
87 params.param1 = lower_32_bits(dwc->ep0_trb_addr); 87 params.param1 = lower_32_bits(dwc->ep0_trb_addr);
88 88
89 trace_dwc3_prepare_trb(dep, trb);
90
89 ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, 91 ret = dwc3_send_gadget_ep_cmd(dwc, dep->number,
90 DWC3_DEPCMD_STARTTRANSFER, &params); 92 DWC3_DEPCMD_STARTTRANSFER, &params);
91 if (ret < 0) { 93 if (ret < 0) {
@@ -441,7 +443,6 @@ static int dwc3_ep0_handle_feature(struct dwc3 *dwc,
441 443
442 case USB_DEVICE_LTM_ENABLE: 444 case USB_DEVICE_LTM_ENABLE:
443 return -EINVAL; 445 return -EINVAL;
444 break;
445 446
446 case USB_DEVICE_TEST_MODE: 447 case USB_DEVICE_TEST_MODE:
447 if ((wIndex & 0xff) != 0) 448 if ((wIndex & 0xff) != 0)
@@ -550,7 +551,6 @@ static int dwc3_ep0_set_config(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)
550 switch (state) { 551 switch (state) {
551 case USB_STATE_DEFAULT: 552 case USB_STATE_DEFAULT:
552 return -EINVAL; 553 return -EINVAL;
553 break;
554 554
555 case USB_STATE_ADDRESS: 555 case USB_STATE_ADDRESS:
556 ret = dwc3_ep0_delegate_req(dwc, ctrl); 556 ret = dwc3_ep0_delegate_req(dwc, ctrl);
@@ -700,35 +700,35 @@ static int dwc3_ep0_std_request(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)
700 700
701 switch (ctrl->bRequest) { 701 switch (ctrl->bRequest) {
702 case USB_REQ_GET_STATUS: 702 case USB_REQ_GET_STATUS:
703 dwc3_trace(trace_dwc3_ep0, "USB_REQ_GET_STATUS\n"); 703 dwc3_trace(trace_dwc3_ep0, "USB_REQ_GET_STATUS");
704 ret = dwc3_ep0_handle_status(dwc, ctrl); 704 ret = dwc3_ep0_handle_status(dwc, ctrl);
705 break; 705 break;
706 case USB_REQ_CLEAR_FEATURE: 706 case USB_REQ_CLEAR_FEATURE:
707 dwc3_trace(trace_dwc3_ep0, "USB_REQ_CLEAR_FEATURE\n"); 707 dwc3_trace(trace_dwc3_ep0, "USB_REQ_CLEAR_FEATURE");
708 ret = dwc3_ep0_handle_feature(dwc, ctrl, 0); 708 ret = dwc3_ep0_handle_feature(dwc, ctrl, 0);
709 break; 709 break;
710 case USB_REQ_SET_FEATURE: 710 case USB_REQ_SET_FEATURE:
711 dwc3_trace(trace_dwc3_ep0, "USB_REQ_SET_FEATURE\n"); 711 dwc3_trace(trace_dwc3_ep0, "USB_REQ_SET_FEATURE");
712 ret = dwc3_ep0_handle_feature(dwc, ctrl, 1); 712 ret = dwc3_ep0_handle_feature(dwc, ctrl, 1);
713 break; 713 break;
714 case USB_REQ_SET_ADDRESS: 714 case USB_REQ_SET_ADDRESS:
715 dwc3_trace(trace_dwc3_ep0, "USB_REQ_SET_ADDRESS\n"); 715 dwc3_trace(trace_dwc3_ep0, "USB_REQ_SET_ADDRESS");
716 ret = dwc3_ep0_set_address(dwc, ctrl); 716 ret = dwc3_ep0_set_address(dwc, ctrl);
717 break; 717 break;
718 case USB_REQ_SET_CONFIGURATION: 718 case USB_REQ_SET_CONFIGURATION:
719 dwc3_trace(trace_dwc3_ep0, "USB_REQ_SET_CONFIGURATION\n"); 719 dwc3_trace(trace_dwc3_ep0, "USB_REQ_SET_CONFIGURATION");
720 ret = dwc3_ep0_set_config(dwc, ctrl); 720 ret = dwc3_ep0_set_config(dwc, ctrl);
721 break; 721 break;
722 case USB_REQ_SET_SEL: 722 case USB_REQ_SET_SEL:
723 dwc3_trace(trace_dwc3_ep0, "USB_REQ_SET_SEL\n"); 723 dwc3_trace(trace_dwc3_ep0, "USB_REQ_SET_SEL");
724 ret = dwc3_ep0_set_sel(dwc, ctrl); 724 ret = dwc3_ep0_set_sel(dwc, ctrl);
725 break; 725 break;
726 case USB_REQ_SET_ISOCH_DELAY: 726 case USB_REQ_SET_ISOCH_DELAY:
727 dwc3_trace(trace_dwc3_ep0, "USB_REQ_SET_ISOCH_DELAY\n"); 727 dwc3_trace(trace_dwc3_ep0, "USB_REQ_SET_ISOCH_DELAY");
728 ret = dwc3_ep0_set_isoch_delay(dwc, ctrl); 728 ret = dwc3_ep0_set_isoch_delay(dwc, ctrl);
729 break; 729 break;
730 default: 730 default:
731 dwc3_trace(trace_dwc3_ep0, "Forwarding to gadget driver\n"); 731 dwc3_trace(trace_dwc3_ep0, "Forwarding to gadget driver");
732 ret = dwc3_ep0_delegate_req(dwc, ctrl); 732 ret = dwc3_ep0_delegate_req(dwc, ctrl);
733 break; 733 break;
734 } 734 }
@@ -791,6 +791,8 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
791 791
792 trb = dwc->ep0_trb; 792 trb = dwc->ep0_trb;
793 793
794 trace_dwc3_complete_trb(ep0, trb);
795
794 status = DWC3_TRB_SIZE_TRBSTS(trb->size); 796 status = DWC3_TRB_SIZE_TRBSTS(trb->size);
795 if (status == DWC3_TRBSTS_SETUP_PENDING) { 797 if (status == DWC3_TRBSTS_SETUP_PENDING) {
796 dwc3_trace(trace_dwc3_ep0, "Setup Pending received"); 798 dwc3_trace(trace_dwc3_ep0, "Setup Pending received");
@@ -855,6 +857,8 @@ static void dwc3_ep0_complete_status(struct dwc3 *dwc,
855 dep = dwc->eps[0]; 857 dep = dwc->eps[0];
856 trb = dwc->ep0_trb; 858 trb = dwc->ep0_trb;
857 859
860 trace_dwc3_complete_trb(dep, trb);
861
858 if (!list_empty(&dep->request_list)) { 862 if (!list_empty(&dep->request_list)) {
859 r = next_request(&dep->request_list); 863 r = next_request(&dep->request_list);
860 864
@@ -875,7 +879,7 @@ static void dwc3_ep0_complete_status(struct dwc3 *dwc,
875 879
876 status = DWC3_TRB_SIZE_TRBSTS(trb->size); 880 status = DWC3_TRB_SIZE_TRBSTS(trb->size);
877 if (status == DWC3_TRBSTS_SETUP_PENDING) 881 if (status == DWC3_TRBSTS_SETUP_PENDING)
878 dwc3_trace(trace_dwc3_ep0, "Setup Pending received\n"); 882 dwc3_trace(trace_dwc3_ep0, "Setup Pending received");
879 883
880 dwc->ep0state = EP0_SETUP_PHASE; 884 dwc->ep0state = EP0_SETUP_PHASE;
881 dwc3_ep0_out_start(dwc); 885 dwc3_ep0_out_start(dwc);
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 546ea5431b8c..f03b136ecfce 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1140,8 +1140,14 @@ static int dwc3_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request,
1140 if (!dep->endpoint.desc) { 1140 if (!dep->endpoint.desc) {
1141 dev_dbg(dwc->dev, "trying to queue request %p to disabled %s\n", 1141 dev_dbg(dwc->dev, "trying to queue request %p to disabled %s\n",
1142 request, ep->name); 1142 request, ep->name);
1143 spin_unlock_irqrestore(&dwc->lock, flags); 1143 ret = -ESHUTDOWN;
1144 return -ESHUTDOWN; 1144 goto out;
1145 }
1146
1147 if (WARN(req->dep != dep, "request %p belongs to '%s'\n",
1148 request, req->dep->name)) {
1149 ret = -EINVAL;
1150 goto out;
1145 } 1151 }
1146 1152
1147 dev_vdbg(dwc->dev, "queing request %p to %s length %d\n", 1153 dev_vdbg(dwc->dev, "queing request %p to %s length %d\n",
@@ -1149,6 +1155,8 @@ static int dwc3_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request,
1149 trace_dwc3_ep_queue(req); 1155 trace_dwc3_ep_queue(req);
1150 1156
1151 ret = __dwc3_gadget_ep_queue(dep, req); 1157 ret = __dwc3_gadget_ep_queue(dep, req);
1158
1159out:
1152 spin_unlock_irqrestore(&dwc->lock, flags); 1160 spin_unlock_irqrestore(&dwc->lock, flags);
1153 1161
1154 return ret; 1162 return ret;
@@ -1622,8 +1630,7 @@ err0:
1622 return ret; 1630 return ret;
1623} 1631}
1624 1632
1625static int dwc3_gadget_stop(struct usb_gadget *g, 1633static int dwc3_gadget_stop(struct usb_gadget *g)
1626 struct usb_gadget_driver *driver)
1627{ 1634{
1628 struct dwc3 *dwc = gadget_to_dwc(g); 1635 struct dwc3 *dwc = gadget_to_dwc(g);
1629 unsigned long flags; 1636 unsigned long flags;
@@ -2034,6 +2041,17 @@ static void dwc3_resume_gadget(struct dwc3 *dwc)
2034 if (dwc->gadget_driver && dwc->gadget_driver->resume) { 2041 if (dwc->gadget_driver && dwc->gadget_driver->resume) {
2035 spin_unlock(&dwc->lock); 2042 spin_unlock(&dwc->lock);
2036 dwc->gadget_driver->resume(&dwc->gadget); 2043 dwc->gadget_driver->resume(&dwc->gadget);
2044 }
2045}
2046
2047static void dwc3_reset_gadget(struct dwc3 *dwc)
2048{
2049 if (!dwc->gadget_driver)
2050 return;
2051
2052 if (dwc->gadget.speed != USB_SPEED_UNKNOWN) {
2053 spin_unlock(&dwc->lock);
2054 usb_gadget_udc_reset(&dwc->gadget, dwc->gadget_driver);
2037 spin_lock(&dwc->lock); 2055 spin_lock(&dwc->lock);
2038 } 2056 }
2039} 2057}
@@ -2140,6 +2158,7 @@ static void dwc3_gadget_disconnect_interrupt(struct dwc3 *dwc)
2140 2158
2141 dwc->gadget.speed = USB_SPEED_UNKNOWN; 2159 dwc->gadget.speed = USB_SPEED_UNKNOWN;
2142 dwc->setup_packet_pending = false; 2160 dwc->setup_packet_pending = false;
2161 usb_gadget_set_state(&dwc->gadget, USB_STATE_NOTATTACHED);
2143} 2162}
2144 2163
2145static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc) 2164static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc)
@@ -2177,11 +2196,7 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc)
2177 dwc3_gadget_disconnect_interrupt(dwc); 2196 dwc3_gadget_disconnect_interrupt(dwc);
2178 } 2197 }
2179 2198
2180 /* after reset -> Default State */ 2199 dwc3_reset_gadget(dwc);
2181 usb_gadget_set_state(&dwc->gadget, USB_STATE_DEFAULT);
2182
2183 if (dwc->gadget.speed != USB_SPEED_UNKNOWN)
2184 dwc3_disconnect_gadget(dwc);
2185 2200
2186 reg = dwc3_readl(dwc->regs, DWC3_DCTL); 2201 reg = dwc3_readl(dwc->regs, DWC3_DCTL);
2187 reg &= ~DWC3_DCTL_TSTCTRL_MASK; 2202 reg &= ~DWC3_DCTL_TSTCTRL_MASK;
@@ -2287,11 +2302,20 @@ static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc)
2287 reg = dwc3_readl(dwc->regs, DWC3_DCTL); 2302 reg = dwc3_readl(dwc->regs, DWC3_DCTL);
2288 reg &= ~(DWC3_DCTL_HIRD_THRES_MASK | DWC3_DCTL_L1_HIBER_EN); 2303 reg &= ~(DWC3_DCTL_HIRD_THRES_MASK | DWC3_DCTL_L1_HIBER_EN);
2289 2304
2305 reg |= DWC3_DCTL_HIRD_THRES(dwc->hird_threshold);
2306
2290 /* 2307 /*
2291 * TODO: This should be configurable. For now using 2308 * When dwc3 revisions >= 2.40a, LPM Erratum is enabled and
2292 * maximum allowed HIRD threshold value of 0b1100 2309 * DCFG.LPMCap is set, core responses with an ACK and the
2310 * BESL value in the LPM token is less than or equal to LPM
2311 * NYET threshold.
2293 */ 2312 */
2294 reg |= DWC3_DCTL_HIRD_THRES(12); 2313 WARN_ONCE(dwc->revision < DWC3_REVISION_240A
2314 && dwc->has_lpm_erratum,
2315 "LPM Erratum not available on dwc3 revisisions < 2.40a\n");
2316
2317 if (dwc->has_lpm_erratum && dwc->revision >= DWC3_REVISION_240A)
2318 reg |= DWC3_DCTL_LPM_ERRATA(dwc->lpm_nyet_threshold);
2295 2319
2296 dwc3_writel(dwc->regs, DWC3_DCTL, reg); 2320 dwc3_writel(dwc->regs, DWC3_DCTL, reg);
2297 } else { 2321 } else {
@@ -2744,26 +2768,13 @@ void dwc3_gadget_exit(struct dwc3 *dwc)
2744 dwc->ctrl_req, dwc->ctrl_req_addr); 2768 dwc->ctrl_req, dwc->ctrl_req_addr);
2745} 2769}
2746 2770
2747int dwc3_gadget_prepare(struct dwc3 *dwc) 2771int dwc3_gadget_suspend(struct dwc3 *dwc)
2748{ 2772{
2749 if (dwc->pullups_connected) { 2773 if (dwc->pullups_connected) {
2750 dwc3_gadget_disable_irq(dwc); 2774 dwc3_gadget_disable_irq(dwc);
2751 dwc3_gadget_run_stop(dwc, true, true); 2775 dwc3_gadget_run_stop(dwc, true, true);
2752 } 2776 }
2753 2777
2754 return 0;
2755}
2756
2757void dwc3_gadget_complete(struct dwc3 *dwc)
2758{
2759 if (dwc->pullups_connected) {
2760 dwc3_gadget_enable_irq(dwc);
2761 dwc3_gadget_run_stop(dwc, true, false);
2762 }
2763}
2764
2765int dwc3_gadget_suspend(struct dwc3 *dwc)
2766{
2767 __dwc3_gadget_ep_disable(dwc->eps[0]); 2778 __dwc3_gadget_ep_disable(dwc->eps[0]);
2768 __dwc3_gadget_ep_disable(dwc->eps[1]); 2779 __dwc3_gadget_ep_disable(dwc->eps[1]);
2769 2780
@@ -2798,6 +2809,11 @@ int dwc3_gadget_resume(struct dwc3 *dwc)
2798 2809
2799 dwc3_writel(dwc->regs, DWC3_DCFG, dwc->dcfg); 2810 dwc3_writel(dwc->regs, DWC3_DCFG, dwc->dcfg);
2800 2811
2812 if (dwc->pullups_connected) {
2813 dwc3_gadget_enable_irq(dwc);
2814 dwc3_gadget_run_stop(dwc, true, false);
2815 }
2816
2801 return 0; 2817 return 0;
2802 2818
2803err1: 2819err1:
diff --git a/drivers/usb/dwc3/platform_data.h b/drivers/usb/dwc3/platform_data.h
index 7db34f00b89a..a3a3b6d5668c 100644
--- a/drivers/usb/dwc3/platform_data.h
+++ b/drivers/usb/dwc3/platform_data.h
@@ -24,4 +24,24 @@ struct dwc3_platform_data {
24 enum usb_device_speed maximum_speed; 24 enum usb_device_speed maximum_speed;
25 enum usb_dr_mode dr_mode; 25 enum usb_dr_mode dr_mode;
26 bool tx_fifo_resize; 26 bool tx_fifo_resize;
27
28 unsigned is_utmi_l1_suspend:1;
29 u8 hird_threshold;
30
31 u8 lpm_nyet_threshold;
32
33 unsigned disable_scramble_quirk:1;
34 unsigned has_lpm_erratum:1;
35 unsigned u2exit_lfps_quirk:1;
36 unsigned u2ss_inp3_quirk:1;
37 unsigned req_p1p2p3_quirk:1;
38 unsigned del_p1p2p3_quirk:1;
39 unsigned del_phy_power_chg_quirk:1;
40 unsigned lfps_filter_quirk:1;
41 unsigned rx_detect_poll_quirk:1;
42 unsigned dis_u3_susphy_quirk:1;
43 unsigned dis_u2_susphy_quirk:1;
44
45 unsigned tx_de_emphasis_quirk:1;
46 unsigned tx_de_emphasis:2;
27}; 47};
diff --git a/drivers/usb/dwc3/trace.h b/drivers/usb/dwc3/trace.h
index 60b0f41eafc4..9fc20b33dd8e 100644
--- a/drivers/usb/dwc3/trace.h
+++ b/drivers/usb/dwc3/trace.h
@@ -61,7 +61,7 @@ DECLARE_EVENT_CLASS(dwc3_log_event,
61 TP_fast_assign( 61 TP_fast_assign(
62 __entry->event = event; 62 __entry->event = event;
63 ), 63 ),
64 TP_printk("event %08x\n", __entry->event) 64 TP_printk("event %08x", __entry->event)
65); 65);
66 66
67DEFINE_EVENT(dwc3_log_event, dwc3_event, 67DEFINE_EVENT(dwc3_log_event, dwc3_event,
@@ -157,7 +157,7 @@ DECLARE_EVENT_CLASS(dwc3_log_generic_cmd,
157 __entry->cmd = cmd; 157 __entry->cmd = cmd;
158 __entry->param = param; 158 __entry->param = param;
159 ), 159 ),
160 TP_printk("cmd '%s' [%d] param %08x\n", 160 TP_printk("cmd '%s' [%d] param %08x",
161 dwc3_gadget_generic_cmd_string(__entry->cmd), 161 dwc3_gadget_generic_cmd_string(__entry->cmd),
162 __entry->cmd, __entry->param 162 __entry->cmd, __entry->param
163 ) 163 )
@@ -175,17 +175,21 @@ DECLARE_EVENT_CLASS(dwc3_log_gadget_ep_cmd,
175 TP_STRUCT__entry( 175 TP_STRUCT__entry(
176 __dynamic_array(char, name, DWC3_MSG_MAX) 176 __dynamic_array(char, name, DWC3_MSG_MAX)
177 __field(unsigned int, cmd) 177 __field(unsigned int, cmd)
178 __field(struct dwc3_gadget_ep_cmd_params *, params) 178 __field(u32, param0)
179 __field(u32, param1)
180 __field(u32, param2)
179 ), 181 ),
180 TP_fast_assign( 182 TP_fast_assign(
181 snprintf(__get_str(name), DWC3_MSG_MAX, "%s", dep->name); 183 snprintf(__get_str(name), DWC3_MSG_MAX, "%s", dep->name);
182 __entry->cmd = cmd; 184 __entry->cmd = cmd;
183 __entry->params = params; 185 __entry->param0 = params->param0;
186 __entry->param1 = params->param1;
187 __entry->param2 = params->param2;
184 ), 188 ),
185 TP_printk("%s: cmd '%s' [%d] params %08x %08x %08x\n", 189 TP_printk("%s: cmd '%s' [%d] params %08x %08x %08x",
186 __get_str(name), dwc3_gadget_ep_cmd_string(__entry->cmd), 190 __get_str(name), dwc3_gadget_ep_cmd_string(__entry->cmd),
187 __entry->cmd, __entry->params->param0, 191 __entry->cmd, __entry->param0,
188 __entry->params->param1, __entry->params->param2 192 __entry->param1, __entry->param2
189 ) 193 )
190); 194);
191 195
@@ -214,7 +218,7 @@ DECLARE_EVENT_CLASS(dwc3_log_trb,
214 __entry->size = trb->size; 218 __entry->size = trb->size;
215 __entry->ctrl = trb->ctrl; 219 __entry->ctrl = trb->ctrl;
216 ), 220 ),
217 TP_printk("%s: trb %p bph %08x bpl %08x size %08x ctrl %08x\n", 221 TP_printk("%s: trb %p bph %08x bpl %08x size %08x ctrl %08x",
218 __get_str(name), __entry->trb, __entry->bph, __entry->bpl, 222 __get_str(name), __entry->trb, __entry->bph, __entry->bpl,
219 __entry->size, __entry->ctrl 223 __entry->size, __entry->ctrl
220 ) 224 )