39 #include <linux/kernel.h>
40 #include <linux/slab.h>
41 #include <linux/ptrace.h>
42 #include <linux/types.h>
49 #include <linux/usb/ch9.h>
56 #define dump_register(nm) \
58 .name = __stringify(nm), \
59 .offset = DWC3_ ##nm, \
383 seq_printf(s,
"DesignWare USB3 Core Register Dump\n");
384 debugfs_print_regs32(s, dwc3_regs,
ARRAY_SIZE(dwc3_regs),
395 .open = dwc3_regdump_open,
400 static int dwc3_mode_show(
struct seq_file *s,
void *unused)
408 spin_unlock_irqrestore(&dwc->
lock, flags);
433 const char __user *ubuf,
size_t count, loff_t *ppos)
447 if (!
strncmp(buf,
"device", 6))
456 spin_unlock_irqrestore(&dwc->
lock, flags);
462 .open = dwc3_mode_open,
463 .write = dwc3_mode_write,
469 static int dwc3_testmode_show(
struct seq_file *s,
void *unused)
479 spin_unlock_irqrestore(&dwc->
lock, flags);
507 static int dwc3_testmode_open(
struct inode *
inode,
struct file *file)
512 static ssize_t dwc3_testmode_write(
struct file *file,
513 const char __user *ubuf,
size_t count, loff_t *ppos)
524 if (!
strncmp(buf,
"test_j", 6))
526 else if (!
strncmp(buf,
"test_k", 6))
528 else if (!
strncmp(buf,
"test_se0_nak", 12))
530 else if (!
strncmp(buf,
"test_packet", 11))
532 else if (!
strncmp(buf,
"test_force_enable", 17))
539 spin_unlock_irqrestore(&dwc->
lock, flags);
545 .open = dwc3_testmode_open,
546 .write = dwc3_testmode_write,
552 static int dwc3_link_state_show(
struct seq_file *s,
void *unused)
562 spin_unlock_irqrestore(&dwc->
lock, flags);
608 static int dwc3_link_state_open(
struct inode *
inode,
struct file *file)
613 static ssize_t dwc3_link_state_write(
struct file *file,
614 const char __user *ubuf,
size_t count, loff_t *ppos)
625 if (!
strncmp(buf,
"SS.Disabled", 11))
627 else if (!
strncmp(buf,
"Rx.Detect", 9))
629 else if (!
strncmp(buf,
"SS.Inactive", 11))
631 else if (!
strncmp(buf,
"Recovery", 8))
633 else if (!
strncmp(buf,
"Compliance", 10))
635 else if (!
strncmp(buf,
"Loopback", 8))
642 spin_unlock_irqrestore(&dwc->
lock, flags);
648 .open = dwc3_link_state_open,
649 .write = dwc3_link_state_write,
677 dwc, &dwc3_mode_fops);
684 dwc, &dwc3_testmode_fops);
691 dwc, &dwc3_link_state_fops);