summaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb/musb_debugfs.c
diff options
context:
space:
mode:
authorBin Liu <b-liu@ti.com>2015-03-24 15:09:25 -0500
committerFelipe Balbi <balbi@ti.com>2015-04-27 15:51:45 -0500
commit205845ef70dd01094415bceafbc86a97eb1899a9 (patch)
treee92efa3c213dda1da2dcb2ffe79fbfcf5b2e1eed /drivers/usb/musb/musb_debugfs.c
parentd72348fb5ca634583bf3f79996cc4b3ef91d9c3a (diff)
downloadlinux-stable-205845ef70dd01094415bceafbc86a97eb1899a9.tar.gz
linux-stable-205845ef70dd01094415bceafbc86a97eb1899a9.tar.bz2
linux-stable-205845ef70dd01094415bceafbc86a97eb1899a9.zip
usb: musb: only set test mode once
The MUSB test mode register can only be set once, otherwise the result is undefined. This prevents the debugfs testmode entry to set the register more than once which causes test failure. Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/musb/musb_debugfs.c')
-rw-r--r--drivers/usb/musb/musb_debugfs.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c
index 78a283e9ce40..04382ec31d3f 100644
--- a/drivers/usb/musb/musb_debugfs.c
+++ b/drivers/usb/musb/musb_debugfs.c
@@ -191,9 +191,16 @@ static ssize_t musb_test_mode_write(struct file *file,
{
struct seq_file *s = file->private_data;
struct musb *musb = s->private;
- u8 test = 0;
+ u8 test;
char buf[18];
+ test = musb_readb(musb->mregs, MUSB_TESTMODE);
+ if (test) {
+ dev_err(musb->controller, "Error: test mode is already set. "
+ "Please do USB Bus Reset to start a new test.\n");
+ return count;
+ }
+
memset(buf, 0x00, sizeof(buf));
if (copy_from_user(buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))