mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 21:22:09 -04:00
usb: dwc3: Check USB LPM status before accessing registers
USB controller registers can be accessed when USB session is not active or USB is in low power mode. This results in unclocked register access. Prevent this by checking the USB LPM status before accessing the registers. Change-Id: I5a31bda1d88ac65b28afc2b545a44b4574b8548a Signed-off-by: Elson Roy Serrao <eserrao@codeaurora.org> Signed-off-by: Jack Pham <jackp@codeaurora.org>
This commit is contained in:
parent
e189769e47
commit
04add1acdf
1 changed files with 27 additions and 1 deletions
|
|
@ -393,6 +393,32 @@ static const struct file_operations dwc3_lsp_fops = {
|
|||
.release = single_release,
|
||||
};
|
||||
|
||||
static int dwc3_regdump_show(struct seq_file *s, void *unused)
|
||||
{
|
||||
struct dwc3 *dwc = s->private;
|
||||
|
||||
if (atomic_read(&dwc->in_lpm)) {
|
||||
seq_puts(s, "USB device is powered off\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
debugfs_print_regs32(s, dwc->regset->regs, dwc->regset->nregs,
|
||||
dwc->regset->base, "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dwc3_regdump_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, dwc3_regdump_show, inode->i_private);
|
||||
}
|
||||
|
||||
static const struct file_operations dwc3_regdump_fops = {
|
||||
.open = dwc3_regdump_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static int dwc3_mode_show(struct seq_file *s, void *unused)
|
||||
{
|
||||
struct dwc3 *dwc = s->private;
|
||||
|
|
@ -1168,7 +1194,7 @@ void dwc3_debugfs_init(struct dwc3 *dwc)
|
|||
|
||||
dwc->root = root;
|
||||
|
||||
debugfs_create_regset32("regdump", S_IRUGO, root, dwc->regset);
|
||||
debugfs_create_file("regdump", 0444, root, dwc, &dwc3_regdump_fops);
|
||||
|
||||
debugfs_create_file("lsp_dump", S_IRUGO | S_IWUSR, root, dwc,
|
||||
&dwc3_lsp_fops);
|
||||
|
|
|
|||
Loading…
Reference in a new issue