Loading drivers/usb/dwc3/core.h +2 −0 Original line number Diff line number Diff line Loading @@ -850,6 +850,7 @@ struct dwc3_scratchpad_array { * @vbus_draw: current to be drawn from USB * @imod_interval: set the interrupt moderation interval in 250ns * increments or 0 to disable. * @create_reg_debugfs: create debugfs entry to allow dwc3 register dump */ struct dwc3 { struct usb_ctrlrequest *ctrl_req; Loading Loading @@ -1046,6 +1047,7 @@ struct dwc3 { unsigned long l1_remote_wakeup_cnt; wait_queue_head_t wait_linkstate; bool create_reg_debugfs; }; /* -------------------------------------------------------------------------- */ Loading drivers/usb/dwc3/debugfs.c +39 −4 Original line number Diff line number Diff line Loading @@ -368,6 +368,11 @@ static int dwc3_mode_show(struct seq_file *s, void *unused) unsigned long flags; u32 reg; if (atomic_read(&dwc->in_lpm)) { seq_puts(s, "USB device is powered off\n"); return 0; } spin_lock_irqsave(&dwc->lock, flags); reg = dwc3_readl(dwc->regs, DWC3_GCTL); spin_unlock_irqrestore(&dwc->lock, flags); Loading Loading @@ -403,6 +408,11 @@ static ssize_t dwc3_mode_write(struct file *file, u32 mode = 0; char buf[32] = {}; if (atomic_read(&dwc->in_lpm)) { dev_err(dwc->dev, "USB device is powered off\n"); return count; } if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) return -EFAULT; Loading Loading @@ -437,6 +447,12 @@ static int dwc3_testmode_show(struct seq_file *s, void *unused) unsigned long flags; u32 reg; if (atomic_read(&dwc->in_lpm)) { seq_puts(s, "USB device is powered off\n"); return 0; } spin_lock_irqsave(&dwc->lock, flags); reg = dwc3_readl(dwc->regs, DWC3_DCTL); reg &= DWC3_DCTL_TSTCTRL_MASK; Loading Loading @@ -483,6 +499,11 @@ static ssize_t dwc3_testmode_write(struct file *file, u32 testmode = 0; char buf[32] = {}; if (atomic_read(&dwc->in_lpm)) { seq_puts(s, "USB device is powered off\n"); return count; } if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) return -EFAULT; Loading Loading @@ -521,6 +542,11 @@ static int dwc3_link_state_show(struct seq_file *s, void *unused) enum dwc3_link_state state; u32 reg; if (atomic_read(&dwc->in_lpm)) { seq_puts(s, "USB device is powered off\n"); return 0; } spin_lock_irqsave(&dwc->lock, flags); reg = dwc3_readl(dwc->regs, DWC3_DSTS); state = DWC3_DSTS_USBLNKST(reg); Loading Loading @@ -590,6 +616,11 @@ static ssize_t dwc3_link_state_write(struct file *file, enum dwc3_link_state state = 0; char buf[32] = {}; if (atomic_read(&dwc->in_lpm)) { seq_puts(s, "USB device is powered off\n"); return count; } if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) return -EFAULT; Loading Loading @@ -1241,11 +1272,15 @@ int dwc3_debugfs_init(struct dwc3 *dwc) dwc->regset->nregs = ARRAY_SIZE(dwc3_regs); dwc->regset->base = dwc->regs; file = debugfs_create_regset32("regdump", S_IRUGO, root, dwc->regset); if (dwc->create_reg_debugfs) { file = debugfs_create_regset32("regdump", 0444, root, dwc->regset); if (!file) { dev_dbg(dwc->dev, "Can't create debugfs regdump\n"); ret = -ENOMEM; goto err1; } } if (IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE)) { file = debugfs_create_file("mode", S_IRUGO | S_IWUSR, root, Loading Loading
drivers/usb/dwc3/core.h +2 −0 Original line number Diff line number Diff line Loading @@ -850,6 +850,7 @@ struct dwc3_scratchpad_array { * @vbus_draw: current to be drawn from USB * @imod_interval: set the interrupt moderation interval in 250ns * increments or 0 to disable. * @create_reg_debugfs: create debugfs entry to allow dwc3 register dump */ struct dwc3 { struct usb_ctrlrequest *ctrl_req; Loading Loading @@ -1046,6 +1047,7 @@ struct dwc3 { unsigned long l1_remote_wakeup_cnt; wait_queue_head_t wait_linkstate; bool create_reg_debugfs; }; /* -------------------------------------------------------------------------- */ Loading
drivers/usb/dwc3/debugfs.c +39 −4 Original line number Diff line number Diff line Loading @@ -368,6 +368,11 @@ static int dwc3_mode_show(struct seq_file *s, void *unused) unsigned long flags; u32 reg; if (atomic_read(&dwc->in_lpm)) { seq_puts(s, "USB device is powered off\n"); return 0; } spin_lock_irqsave(&dwc->lock, flags); reg = dwc3_readl(dwc->regs, DWC3_GCTL); spin_unlock_irqrestore(&dwc->lock, flags); Loading Loading @@ -403,6 +408,11 @@ static ssize_t dwc3_mode_write(struct file *file, u32 mode = 0; char buf[32] = {}; if (atomic_read(&dwc->in_lpm)) { dev_err(dwc->dev, "USB device is powered off\n"); return count; } if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) return -EFAULT; Loading Loading @@ -437,6 +447,12 @@ static int dwc3_testmode_show(struct seq_file *s, void *unused) unsigned long flags; u32 reg; if (atomic_read(&dwc->in_lpm)) { seq_puts(s, "USB device is powered off\n"); return 0; } spin_lock_irqsave(&dwc->lock, flags); reg = dwc3_readl(dwc->regs, DWC3_DCTL); reg &= DWC3_DCTL_TSTCTRL_MASK; Loading Loading @@ -483,6 +499,11 @@ static ssize_t dwc3_testmode_write(struct file *file, u32 testmode = 0; char buf[32] = {}; if (atomic_read(&dwc->in_lpm)) { seq_puts(s, "USB device is powered off\n"); return count; } if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) return -EFAULT; Loading Loading @@ -521,6 +542,11 @@ static int dwc3_link_state_show(struct seq_file *s, void *unused) enum dwc3_link_state state; u32 reg; if (atomic_read(&dwc->in_lpm)) { seq_puts(s, "USB device is powered off\n"); return 0; } spin_lock_irqsave(&dwc->lock, flags); reg = dwc3_readl(dwc->regs, DWC3_DSTS); state = DWC3_DSTS_USBLNKST(reg); Loading Loading @@ -590,6 +616,11 @@ static ssize_t dwc3_link_state_write(struct file *file, enum dwc3_link_state state = 0; char buf[32] = {}; if (atomic_read(&dwc->in_lpm)) { seq_puts(s, "USB device is powered off\n"); return count; } if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) return -EFAULT; Loading Loading @@ -1241,11 +1272,15 @@ int dwc3_debugfs_init(struct dwc3 *dwc) dwc->regset->nregs = ARRAY_SIZE(dwc3_regs); dwc->regset->base = dwc->regs; file = debugfs_create_regset32("regdump", S_IRUGO, root, dwc->regset); if (dwc->create_reg_debugfs) { file = debugfs_create_regset32("regdump", 0444, root, dwc->regset); if (!file) { dev_dbg(dwc->dev, "Can't create debugfs regdump\n"); ret = -ENOMEM; goto err1; } } if (IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE)) { file = debugfs_create_file("mode", S_IRUGO | S_IWUSR, root, Loading