|
@@ -337,11 +337,6 @@ static int debug_async_open(struct inode *, struct file *);
|
|
|
static int debug_periodic_open(struct inode *, struct file *);
|
|
|
static int debug_registers_open(struct inode *, struct file *);
|
|
|
static int debug_async_open(struct inode *, struct file *);
|
|
|
-static ssize_t debug_lpm_read(struct file *file, char __user *user_buf,
|
|
|
- size_t count, loff_t *ppos);
|
|
|
-static ssize_t debug_lpm_write(struct file *file, const char __user *buffer,
|
|
|
- size_t count, loff_t *ppos);
|
|
|
-static int debug_lpm_close(struct inode *inode, struct file *file);
|
|
|
|
|
|
static ssize_t debug_output(struct file*, char __user*, size_t, loff_t*);
|
|
|
static int debug_close(struct inode *, struct file *);
|
|
@@ -367,14 +362,6 @@ static const struct file_operations debug_registers_fops = {
|
|
|
.release = debug_close,
|
|
|
.llseek = default_llseek,
|
|
|
};
|
|
|
-static const struct file_operations debug_lpm_fops = {
|
|
|
- .owner = THIS_MODULE,
|
|
|
- .open = simple_open,
|
|
|
- .read = debug_lpm_read,
|
|
|
- .write = debug_lpm_write,
|
|
|
- .release = debug_lpm_close,
|
|
|
- .llseek = noop_llseek,
|
|
|
-};
|
|
|
|
|
|
static struct dentry *ehci_debug_root;
|
|
|
|
|
@@ -956,86 +943,6 @@ static int debug_registers_open(struct inode *inode, struct file *file)
|
|
|
return file->private_data ? 0 : -ENOMEM;
|
|
|
}
|
|
|
|
|
|
-static int debug_lpm_close(struct inode *inode, struct file *file)
|
|
|
-{
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-static ssize_t debug_lpm_read(struct file *file, char __user *user_buf,
|
|
|
- size_t count, loff_t *ppos)
|
|
|
-{
|
|
|
- /* TODO: show lpm stats */
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-static ssize_t debug_lpm_write(struct file *file, const char __user *user_buf,
|
|
|
- size_t count, loff_t *ppos)
|
|
|
-{
|
|
|
- struct usb_hcd *hcd;
|
|
|
- struct ehci_hcd *ehci;
|
|
|
- char buf[50];
|
|
|
- size_t len;
|
|
|
- u32 temp;
|
|
|
- unsigned long port;
|
|
|
- u32 __iomem *portsc ;
|
|
|
- u32 params;
|
|
|
-
|
|
|
- hcd = bus_to_hcd(file->private_data);
|
|
|
- ehci = hcd_to_ehci(hcd);
|
|
|
-
|
|
|
- len = min(count, sizeof(buf) - 1);
|
|
|
- if (copy_from_user(buf, user_buf, len))
|
|
|
- return -EFAULT;
|
|
|
- buf[len] = '\0';
|
|
|
- if (len > 0 && buf[len - 1] == '\n')
|
|
|
- buf[len - 1] = '\0';
|
|
|
-
|
|
|
- if (strncmp(buf, "enable", 5) == 0) {
|
|
|
- if (strict_strtoul(buf + 7, 10, &port))
|
|
|
- return -EINVAL;
|
|
|
- params = ehci_readl(ehci, &ehci->caps->hcs_params);
|
|
|
- if (port > HCS_N_PORTS(params)) {
|
|
|
- ehci_dbg(ehci, "ERR: LPM on bad port %lu\n", port);
|
|
|
- return -ENODEV;
|
|
|
- }
|
|
|
- portsc = &ehci->regs->port_status[port-1];
|
|
|
- temp = ehci_readl(ehci, portsc);
|
|
|
- if (!(temp & PORT_DEV_ADDR)) {
|
|
|
- ehci_dbg(ehci, "LPM: no device attached\n");
|
|
|
- return -ENODEV;
|
|
|
- }
|
|
|
- temp |= PORT_LPM;
|
|
|
- ehci_writel(ehci, temp, portsc);
|
|
|
- printk(KERN_INFO "force enable LPM for port %lu\n", port);
|
|
|
- } else if (strncmp(buf, "hird=", 5) == 0) {
|
|
|
- unsigned long hird;
|
|
|
- if (strict_strtoul(buf + 5, 16, &hird))
|
|
|
- return -EINVAL;
|
|
|
- printk(KERN_INFO "setting hird %s %lu\n", buf + 6, hird);
|
|
|
- ehci->command = (ehci->command & ~CMD_HIRD) | (hird << 24);
|
|
|
- ehci_writel(ehci, ehci->command, &ehci->regs->command);
|
|
|
- } else if (strncmp(buf, "disable", 7) == 0) {
|
|
|
- if (strict_strtoul(buf + 8, 10, &port))
|
|
|
- return -EINVAL;
|
|
|
- params = ehci_readl(ehci, &ehci->caps->hcs_params);
|
|
|
- if (port > HCS_N_PORTS(params)) {
|
|
|
- ehci_dbg(ehci, "ERR: LPM off bad port %lu\n", port);
|
|
|
- return -ENODEV;
|
|
|
- }
|
|
|
- portsc = &ehci->regs->port_status[port-1];
|
|
|
- temp = ehci_readl(ehci, portsc);
|
|
|
- if (!(temp & PORT_DEV_ADDR)) {
|
|
|
- ehci_dbg(ehci, "ERR: no device attached\n");
|
|
|
- return -ENODEV;
|
|
|
- }
|
|
|
- temp &= ~PORT_LPM;
|
|
|
- ehci_writel(ehci, temp, portsc);
|
|
|
- printk(KERN_INFO "disabled LPM for port %lu\n", port);
|
|
|
- } else
|
|
|
- return -EOPNOTSUPP;
|
|
|
- return count;
|
|
|
-}
|
|
|
-
|
|
|
static inline void create_debug_files (struct ehci_hcd *ehci)
|
|
|
{
|
|
|
struct usb_bus *bus = &ehci_to_hcd(ehci)->self;
|
|
@@ -1056,10 +963,6 @@ static inline void create_debug_files (struct ehci_hcd *ehci)
|
|
|
&debug_registers_fops))
|
|
|
goto file_error;
|
|
|
|
|
|
- if (!debugfs_create_file("lpm", S_IRUGO|S_IWUSR, ehci->debug_dir, bus,
|
|
|
- &debug_lpm_fops))
|
|
|
- goto file_error;
|
|
|
-
|
|
|
return;
|
|
|
|
|
|
file_error:
|