diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2011-08-29 07:56:35 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2011-09-09 06:02:08 -0400 |
commit | e7225315a89731d0f986c20165184f1dc9a9bf2b (patch) | |
tree | 271096940ce4d6f0dad0e8ca2cede9318d983e60 /drivers/usb/dwc3 | |
parent | c7fcdeb2627c46b7ec3f0bcb2054b10405f9a70e (diff) |
usb: dwc3: debugfs: remove test mode interface
There are some issues around for enabling/disabling this mode and
handling it. It does not work perfectly (yet). However we have a few
gadgets tested successfuly so far. That means we are quite confident
that we won't need this in near future.
So I'm for removing it and bringing a working version back once there is
a need for it.
Thanks to Dan Carpenter who spotted the wrong memory handling here.
[ balbi@ti.com : made it actually apply ]
Cc: Dan Carpenter <error27@gmail.com>
Cc: wharms@bfs.de
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3')
-rw-r--r-- | drivers/usb/dwc3/debugfs.c | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c index dd861c499d28..20d329f23408 100644 --- a/drivers/usb/dwc3/debugfs.c +++ b/drivers/usb/dwc3/debugfs.c | |||
@@ -406,93 +406,6 @@ static const struct file_operations dwc3_regdump_fops = { | |||
406 | .release = single_release, | 406 | .release = single_release, |
407 | }; | 407 | }; |
408 | 408 | ||
409 | |||
410 | static int dwc3_send_testmode_cmd(struct dwc3 *dwc, int mode) | ||
411 | { | ||
412 | u32 timeout = 250; | ||
413 | |||
414 | dwc3_writel(dwc->regs, DWC3_DGCMDPAR, mode); | ||
415 | dwc3_writel(dwc->regs, DWC3_DGCMD, DWC3_DGCMD_RUN_SOC_BUS_LOOPBACK | | ||
416 | DWC3_DEPCMD_CMDACT); | ||
417 | do { | ||
418 | u32 reg; | ||
419 | |||
420 | reg = dwc3_readl(dwc->regs, DWC3_DGCMD); | ||
421 | if (!(reg & DWC3_DEPCMD_CMDACT)) | ||
422 | return 0; | ||
423 | timeout--; | ||
424 | if (!timeout) | ||
425 | return -ETIMEDOUT; | ||
426 | mdelay(1); | ||
427 | } while (1); | ||
428 | } | ||
429 | |||
430 | static struct dwc3_trb_hw trb_0 __aligned(16); | ||
431 | static struct dwc3_trb_hw trb_1 __aligned(16); | ||
432 | |||
433 | #define BUF_SIZE 4096 | ||
434 | static int dwc3_testmode_open(struct inode *inode, struct file *file) | ||
435 | { | ||
436 | struct dwc3 *dwc = inode->i_private; | ||
437 | struct dwc3_gadget_ep_cmd_params par0; | ||
438 | struct dwc3_gadget_ep_cmd_params par1; | ||
439 | struct dwc3_trb trb; | ||
440 | int ret; | ||
441 | u8 *buf0; | ||
442 | u8 *buf1; | ||
443 | |||
444 | buf0 = kmalloc(BUF_SIZE, GFP_KERNEL); | ||
445 | if (!buf0) | ||
446 | return -ENOMEM; | ||
447 | buf1 = kmalloc(BUF_SIZE, GFP_KERNEL); | ||
448 | if (!buf1) { | ||
449 | kfree(buf0); | ||
450 | return -ENOMEM; | ||
451 | } | ||
452 | |||
453 | memset(buf0, 0xaa, BUF_SIZE); | ||
454 | memset(buf1, 0x33, BUF_SIZE); | ||
455 | |||
456 | memset(&trb, 0, sizeof(trb)); | ||
457 | memset(&par0, 0, sizeof(par0)); | ||
458 | memset(&par1, 0, sizeof(par1)); | ||
459 | |||
460 | trb.lst = 1; | ||
461 | trb.trbctl = DWC3_TRBCTL_NORMAL; | ||
462 | trb.length = BUF_SIZE; | ||
463 | trb.hwo = 1; | ||
464 | |||
465 | trb.bplh = virt_to_phys(buf0); | ||
466 | dwc3_trb_to_hw(&trb, &trb_0); | ||
467 | |||
468 | trb.bplh = virt_to_phys(buf1); | ||
469 | dwc3_trb_to_hw(&trb, &trb_1); | ||
470 | |||
471 | par0.param0.depstrtxfer.transfer_desc_addr_high = | ||
472 | upper_32_bits(virt_to_phys(&trb_0)); | ||
473 | par0.param1.depstrtxfer.transfer_desc_addr_low = | ||
474 | lower_32_bits(virt_to_phys(&trb_0)); | ||
475 | |||
476 | par1.param0.depstrtxfer.transfer_desc_addr_high = | ||
477 | upper_32_bits(virt_to_phys(&trb_1)); | ||
478 | par1.param1.depstrtxfer.transfer_desc_addr_low = | ||
479 | lower_32_bits(virt_to_phys(&trb_1)); | ||
480 | |||
481 | dwc3_send_testmode_cmd(dwc, 1); | ||
482 | |||
483 | ret = dwc3_send_gadget_ep_cmd(dwc, 0, DWC3_DEPCMD_STARTTRANSFER, &par0); | ||
484 | ret = dwc3_send_gadget_ep_cmd(dwc, 1, DWC3_DEPCMD_STARTTRANSFER, &par1); | ||
485 | |||
486 | dwc3_send_testmode_cmd(dwc, 0); | ||
487 | return -EBUSY; | ||
488 | } | ||
489 | |||
490 | static const struct file_operations dwc3_testmode_fops = { | ||
491 | .open = dwc3_testmode_open, | ||
492 | .read = seq_read, | ||
493 | .release = single_release, | ||
494 | }; | ||
495 | |||
496 | int __devinit dwc3_debugfs_init(struct dwc3 *dwc) | 409 | int __devinit dwc3_debugfs_init(struct dwc3 *dwc) |
497 | { | 410 | { |
498 | struct dentry *root; | 411 | struct dentry *root; |
@@ -513,13 +426,6 @@ int __devinit dwc3_debugfs_init(struct dwc3 *dwc) | |||
513 | ret = PTR_ERR(file); | 426 | ret = PTR_ERR(file); |
514 | goto err1; | 427 | goto err1; |
515 | } | 428 | } |
516 | file = debugfs_create_file("testmode", S_IRUGO, root, dwc, | ||
517 | &dwc3_testmode_fops); | ||
518 | if (IS_ERR(file)) { | ||
519 | ret = PTR_ERR(file); | ||
520 | goto err1; | ||
521 | } | ||
522 | |||
523 | return 0; | 429 | return 0; |
524 | 430 | ||
525 | err1: | 431 | err1: |