aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ehci-dbg.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/host/ehci-dbg.c')
-rw-r--r--drivers/usb/host/ehci-dbg.c112
1 files changed, 0 insertions, 112 deletions
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 1599806e3d47..70b496dc18a0 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -18,21 +18,6 @@
18 18
19/* this file is part of ehci-hcd.c */ 19/* this file is part of ehci-hcd.c */
20 20
21#define ehci_dbg(ehci, fmt, args...) \
22 dev_dbg (ehci_to_hcd(ehci)->self.controller , fmt , ## args )
23#define ehci_err(ehci, fmt, args...) \
24 dev_err (ehci_to_hcd(ehci)->self.controller , fmt , ## args )
25#define ehci_info(ehci, fmt, args...) \
26 dev_info (ehci_to_hcd(ehci)->self.controller , fmt , ## args )
27#define ehci_warn(ehci, fmt, args...) \
28 dev_warn (ehci_to_hcd(ehci)->self.controller , fmt , ## args )
29
30#ifdef VERBOSE_DEBUG
31# define ehci_vdbg ehci_dbg
32#else
33 static inline void ehci_vdbg(struct ehci_hcd *ehci, ...) {}
34#endif
35
36#ifdef DEBUG 21#ifdef DEBUG
37 22
38/* check the values in the HCSPARAMS register 23/* check the values in the HCSPARAMS register
@@ -352,11 +337,6 @@ static int debug_async_open(struct inode *, struct file *);
352static int debug_periodic_open(struct inode *, struct file *); 337static int debug_periodic_open(struct inode *, struct file *);
353static int debug_registers_open(struct inode *, struct file *); 338static int debug_registers_open(struct inode *, struct file *);
354static int debug_async_open(struct inode *, struct file *); 339static int debug_async_open(struct inode *, struct file *);
355static ssize_t debug_lpm_read(struct file *file, char __user *user_buf,
356 size_t count, loff_t *ppos);
357static ssize_t debug_lpm_write(struct file *file, const char __user *buffer,
358 size_t count, loff_t *ppos);
359static int debug_lpm_close(struct inode *inode, struct file *file);
360 340
361static ssize_t debug_output(struct file*, char __user*, size_t, loff_t*); 341static ssize_t debug_output(struct file*, char __user*, size_t, loff_t*);
362static int debug_close(struct inode *, struct file *); 342static int debug_close(struct inode *, struct file *);
@@ -382,14 +362,6 @@ static const struct file_operations debug_registers_fops = {
382 .release = debug_close, 362 .release = debug_close,
383 .llseek = default_llseek, 363 .llseek = default_llseek,
384}; 364};
385static const struct file_operations debug_lpm_fops = {
386 .owner = THIS_MODULE,
387 .open = simple_open,
388 .read = debug_lpm_read,
389 .write = debug_lpm_write,
390 .release = debug_lpm_close,
391 .llseek = noop_llseek,
392};
393 365
394static struct dentry *ehci_debug_root; 366static struct dentry *ehci_debug_root;
395 367
@@ -971,86 +943,6 @@ static int debug_registers_open(struct inode *inode, struct file *file)
971 return file->private_data ? 0 : -ENOMEM; 943 return file->private_data ? 0 : -ENOMEM;
972} 944}
973 945
974static int debug_lpm_close(struct inode *inode, struct file *file)
975{
976 return 0;
977}
978
979static ssize_t debug_lpm_read(struct file *file, char __user *user_buf,
980 size_t count, loff_t *ppos)
981{
982 /* TODO: show lpm stats */
983 return 0;
984}
985
986static ssize_t debug_lpm_write(struct file *file, const char __user *user_buf,
987 size_t count, loff_t *ppos)
988{
989 struct usb_hcd *hcd;
990 struct ehci_hcd *ehci;
991 char buf[50];
992 size_t len;
993 u32 temp;
994 unsigned long port;
995 u32 __iomem *portsc ;
996 u32 params;
997
998 hcd = bus_to_hcd(file->private_data);
999 ehci = hcd_to_ehci(hcd);
1000
1001 len = min(count, sizeof(buf) - 1);
1002 if (copy_from_user(buf, user_buf, len))
1003 return -EFAULT;
1004 buf[len] = '\0';
1005 if (len > 0 && buf[len - 1] == '\n')
1006 buf[len - 1] = '\0';
1007
1008 if (strncmp(buf, "enable", 5) == 0) {
1009 if (strict_strtoul(buf + 7, 10, &port))
1010 return -EINVAL;
1011 params = ehci_readl(ehci, &ehci->caps->hcs_params);
1012 if (port > HCS_N_PORTS(params)) {
1013 ehci_dbg(ehci, "ERR: LPM on bad port %lu\n", port);
1014 return -ENODEV;
1015 }
1016 portsc = &ehci->regs->port_status[port-1];
1017 temp = ehci_readl(ehci, portsc);
1018 if (!(temp & PORT_DEV_ADDR)) {
1019 ehci_dbg(ehci, "LPM: no device attached\n");
1020 return -ENODEV;
1021 }
1022 temp |= PORT_LPM;
1023 ehci_writel(ehci, temp, portsc);
1024 printk(KERN_INFO "force enable LPM for port %lu\n", port);
1025 } else if (strncmp(buf, "hird=", 5) == 0) {
1026 unsigned long hird;
1027 if (strict_strtoul(buf + 5, 16, &hird))
1028 return -EINVAL;
1029 printk(KERN_INFO "setting hird %s %lu\n", buf + 6, hird);
1030 ehci->command = (ehci->command & ~CMD_HIRD) | (hird << 24);
1031 ehci_writel(ehci, ehci->command, &ehci->regs->command);
1032 } else if (strncmp(buf, "disable", 7) == 0) {
1033 if (strict_strtoul(buf + 8, 10, &port))
1034 return -EINVAL;
1035 params = ehci_readl(ehci, &ehci->caps->hcs_params);
1036 if (port > HCS_N_PORTS(params)) {
1037 ehci_dbg(ehci, "ERR: LPM off bad port %lu\n", port);
1038 return -ENODEV;
1039 }
1040 portsc = &ehci->regs->port_status[port-1];
1041 temp = ehci_readl(ehci, portsc);
1042 if (!(temp & PORT_DEV_ADDR)) {
1043 ehci_dbg(ehci, "ERR: no device attached\n");
1044 return -ENODEV;
1045 }
1046 temp &= ~PORT_LPM;
1047 ehci_writel(ehci, temp, portsc);
1048 printk(KERN_INFO "disabled LPM for port %lu\n", port);
1049 } else
1050 return -EOPNOTSUPP;
1051 return count;
1052}
1053
1054static inline void create_debug_files (struct ehci_hcd *ehci) 946static inline void create_debug_files (struct ehci_hcd *ehci)
1055{ 947{
1056 struct usb_bus *bus = &ehci_to_hcd(ehci)->self; 948 struct usb_bus *bus = &ehci_to_hcd(ehci)->self;
@@ -1071,10 +963,6 @@ static inline void create_debug_files (struct ehci_hcd *ehci)
1071 &debug_registers_fops)) 963 &debug_registers_fops))
1072 goto file_error; 964 goto file_error;
1073 965
1074 if (!debugfs_create_file("lpm", S_IRUGO|S_IWUSR, ehci->debug_dir, bus,
1075 &debug_lpm_fops))
1076 goto file_error;
1077
1078 return; 966 return;
1079 967
1080file_error: 968file_error: