aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2011-10-07 15:55:04 -0400
committerFelipe Balbi <balbi@ti.com>2011-12-12 04:48:10 -0500
commit6c167fc9b0c23ead791edb94cf4debb6b8e534b5 (patch)
tree1ee2f57ad99cc6a62085c0a433fbc56c17bbf284 /drivers
parentb2c2271c826589c5c5b285a5a32e158d36d263d9 (diff)
usb: dwc3: allow forcing a maximum speed
this is mainly for testing. In order to be able to test if we're enumerating correctly on all speeds, let that be controlled by a module parameter. Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/dwc3/core.c15
-rw-r--r--drivers/usb/dwc3/core.h2
-rw-r--r--drivers/usb/dwc3/gadget.c2
3 files changed, 18 insertions, 1 deletions
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 717ebc9ff941..ca3b01f5fffa 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -59,6 +59,10 @@
59 59
60#include "debug.h" 60#include "debug.h"
61 61
62static char *maximum_speed = "super";
63module_param(maximum_speed, charp, 0);
64MODULE_PARM_DESC(maximum_speed, "Maximum supported speed.");
65
62/** 66/**
63 * dwc3_core_soft_reset - Issues core soft reset and PHY reset 67 * dwc3_core_soft_reset - Issues core soft reset and PHY reset
64 * @dwc: pointer to our context structure 68 * @dwc: pointer to our context structure
@@ -370,6 +374,17 @@ static int __devinit dwc3_probe(struct platform_device *pdev)
370 dwc->dev = &pdev->dev; 374 dwc->dev = &pdev->dev;
371 dwc->irq = irq; 375 dwc->irq = irq;
372 376
377 if (!strncmp("super", maximum_speed, 5))
378 dwc->maximum_speed = DWC3_DCFG_SUPERSPEED;
379 else if (!strncmp("high", maximum_speed, 4))
380 dwc->maximum_speed = DWC3_DCFG_HIGHSPEED;
381 else if (!strncmp("full", maximum_speed, 4))
382 dwc->maximum_speed = DWC3_DCFG_FULLSPEED1;
383 else if (!strncmp("low", maximum_speed, 3))
384 dwc->maximum_speed = DWC3_DCFG_LOWSPEED;
385 else
386 dwc->maximum_speed = DWC3_DCFG_SUPERSPEED;
387
373 pm_runtime_enable(&pdev->dev); 388 pm_runtime_enable(&pdev->dev);
374 pm_runtime_get_sync(&pdev->dev); 389 pm_runtime_get_sync(&pdev->dev);
375 pm_runtime_forbid(&pdev->dev); 390 pm_runtime_forbid(&pdev->dev);
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 29a8e1679e12..b7d56c3a1fbb 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -555,6 +555,7 @@ struct dwc3_hwparams {
555 * @regs: base address for our registers 555 * @regs: base address for our registers
556 * @regs_size: address space size 556 * @regs_size: address space size
557 * @irq: IRQ number 557 * @irq: IRQ number
558 * @maximum_speed: maximum speed requested (mainly for testing purposes)
558 * @revision: revision register contents 559 * @revision: revision register contents
559 * @is_selfpowered: true when we are selfpowered 560 * @is_selfpowered: true when we are selfpowered
560 * @three_stage_setup: set if we perform a three phase setup 561 * @three_stage_setup: set if we perform a three phase setup
@@ -595,6 +596,7 @@ struct dwc3 {
595 596
596 int irq; 597 int irq;
597 598
599 u32 maximum_speed;
598 u32 revision; 600 u32 revision;
599 601
600#define DWC3_REVISION_173A 0x5533173a 602#define DWC3_REVISION_173A 0x5533173a
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 46ed15bca19f..807737aec00e 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1183,7 +1183,7 @@ static int dwc3_gadget_start(struct usb_gadget *g,
1183 1183
1184 reg = dwc3_readl(dwc->regs, DWC3_DCFG); 1184 reg = dwc3_readl(dwc->regs, DWC3_DCFG);
1185 reg &= ~(DWC3_DCFG_SPEED_MASK); 1185 reg &= ~(DWC3_DCFG_SPEED_MASK);
1186 reg |= DWC3_DCFG_SUPERSPEED; 1186 reg |= dwc->maximum_speed;
1187 dwc3_writel(dwc->regs, DWC3_DCFG, reg); 1187 dwc3_writel(dwc->regs, DWC3_DCFG, reg);
1188 1188
1189 dwc->start_config_issued = false; 1189 dwc->start_config_issued = false;