diff options
Diffstat (limited to 'drivers/usb/dwc3/debugfs.c')
-rw-r--r-- | drivers/usb/dwc3/debugfs.c | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c index 5945aadaa1c9..4a752e730c5f 100644 --- a/drivers/usb/dwc3/debugfs.c +++ b/drivers/usb/dwc3/debugfs.c | |||
@@ -59,7 +59,7 @@ | |||
59 | .offset = DWC3_ ##nm - DWC3_GLOBALS_REGS_START, \ | 59 | .offset = DWC3_ ##nm - DWC3_GLOBALS_REGS_START, \ |
60 | } | 60 | } |
61 | 61 | ||
62 | static const struct debugfs_reg32 dwc3_regs[] = { | 62 | static struct debugfs_reg32 dwc3_regs[] = { |
63 | dump_register(GSBUSCFG0), | 63 | dump_register(GSBUSCFG0), |
64 | dump_register(GSBUSCFG1), | 64 | dump_register(GSBUSCFG1), |
65 | dump_register(GTXTHRCFG), | 65 | dump_register(GTXTHRCFG), |
@@ -376,27 +376,6 @@ static const struct debugfs_reg32 dwc3_regs[] = { | |||
376 | dump_register(OSTS), | 376 | dump_register(OSTS), |
377 | }; | 377 | }; |
378 | 378 | ||
379 | static int dwc3_regdump_show(struct seq_file *s, void *unused) | ||
380 | { | ||
381 | struct dwc3 *dwc = s->private; | ||
382 | |||
383 | seq_printf(s, "DesignWare USB3 Core Register Dump\n"); | ||
384 | debugfs_print_regs32(s, dwc3_regs, ARRAY_SIZE(dwc3_regs), | ||
385 | dwc->regs, ""); | ||
386 | return 0; | ||
387 | } | ||
388 | |||
389 | static int dwc3_regdump_open(struct inode *inode, struct file *file) | ||
390 | { | ||
391 | return single_open(file, dwc3_regdump_show, inode->i_private); | ||
392 | } | ||
393 | |||
394 | static const struct file_operations dwc3_regdump_fops = { | ||
395 | .open = dwc3_regdump_open, | ||
396 | .read = seq_read, | ||
397 | .release = single_release, | ||
398 | }; | ||
399 | |||
400 | static int dwc3_mode_show(struct seq_file *s, void *unused) | 379 | static int dwc3_mode_show(struct seq_file *s, void *unused) |
401 | { | 380 | { |
402 | struct dwc3 *dwc = s->private; | 381 | struct dwc3 *dwc = s->private; |
@@ -666,13 +645,23 @@ int dwc3_debugfs_init(struct dwc3 *dwc) | |||
666 | 645 | ||
667 | dwc->root = root; | 646 | dwc->root = root; |
668 | 647 | ||
669 | file = debugfs_create_file("regdump", S_IRUGO, root, dwc, | 648 | dwc->regset = kzalloc(sizeof(*dwc->regset), GFP_KERNEL); |
670 | &dwc3_regdump_fops); | 649 | if (!dwc->regset) { |
650 | ret = -ENOMEM; | ||
651 | goto err1; | ||
652 | } | ||
653 | |||
654 | dwc->regset->regs = dwc3_regs; | ||
655 | dwc->regset->nregs = ARRAY_SIZE(dwc3_regs); | ||
656 | dwc->regset->base = dwc->regs; | ||
657 | |||
658 | file = debugfs_create_regset32("regdump", S_IRUGO, root, dwc->regset); | ||
671 | if (!file) { | 659 | if (!file) { |
672 | ret = -ENOMEM; | 660 | ret = -ENOMEM; |
673 | goto err1; | 661 | goto err1; |
674 | } | 662 | } |
675 | 663 | ||
664 | #if IS_ENABLED(CONFIG_USB_DWC3_GADGET) | ||
676 | file = debugfs_create_file("mode", S_IRUGO | S_IWUSR, root, | 665 | file = debugfs_create_file("mode", S_IRUGO | S_IWUSR, root, |
677 | dwc, &dwc3_mode_fops); | 666 | dwc, &dwc3_mode_fops); |
678 | if (!file) { | 667 | if (!file) { |
@@ -693,6 +682,7 @@ int dwc3_debugfs_init(struct dwc3 *dwc) | |||
693 | ret = -ENOMEM; | 682 | ret = -ENOMEM; |
694 | goto err1; | 683 | goto err1; |
695 | } | 684 | } |
685 | #endif | ||
696 | 686 | ||
697 | return 0; | 687 | return 0; |
698 | 688 | ||