diff options
| author | Alan Stern <stern@rowland.harvard.edu> | 2012-10-31 13:12:11 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-31 15:48:07 -0400 |
| commit | 4968f951913997adc8c68c4e986e8168ee1d2998 (patch) | |
| tree | 4ab4aa7bff6faf8c533ec5c346d591fdb0ed64b5 /drivers/usb | |
| parent | 571e41214e988bc38c99d804e6d8e1ea1d016342 (diff) | |
USB: EHCI: remove unused Link Power Management code
This patch (as1622) removes the USB-2.1 Link Power Management code
from the ehci-hcd driver. This code was never integrated with
usbcore, it is full of bugs, and it was not getting used by anybody.
However, the debugging code for dumping the LPM-related fields in the
EHCI registers is left in place. In theory it might be useful to see
these values, even though we don't use them.
This essentially amounts to a partial revert of commit
aa4d8342988d0c1a79ff19b2ede1e81dfbb16ea5 (USB: EHCI: EHCI 1.1
addendum: preparation) and an almost full revert of commit
48f24970144479c29b8cee6d2e1dbedf6dcf9cfb (USB: EHCI: EHCI 1.1
addendum: Basic LPM feature support) plus its follow-ons.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
| -rw-r--r-- | drivers/usb/host/ehci-dbg.c | 97 | ||||
| -rw-r--r-- | drivers/usb/host/ehci-hcd.c | 18 | ||||
| -rw-r--r-- | drivers/usb/host/ehci-hub.c | 5 | ||||
| -rw-r--r-- | drivers/usb/host/ehci-lpm.c | 101 | ||||
| -rw-r--r-- | drivers/usb/host/ehci-pci.c | 13 | ||||
| -rw-r--r-- | drivers/usb/host/ehci-vt8500.c | 5 | ||||
| -rw-r--r-- | drivers/usb/host/ehci.h | 1 |
7 files changed, 1 insertions, 239 deletions
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c index dfd3bf3aa4de..70b496dc18a0 100644 --- a/drivers/usb/host/ehci-dbg.c +++ b/drivers/usb/host/ehci-dbg.c | |||
| @@ -337,11 +337,6 @@ static int debug_async_open(struct inode *, struct file *); | |||
| 337 | static int debug_periodic_open(struct inode *, struct file *); | 337 | static int debug_periodic_open(struct inode *, struct file *); |
| 338 | static int debug_registers_open(struct inode *, struct file *); | 338 | static int debug_registers_open(struct inode *, struct file *); |
| 339 | static int debug_async_open(struct inode *, struct file *); | 339 | static int debug_async_open(struct inode *, struct file *); |
| 340 | static ssize_t debug_lpm_read(struct file *file, char __user *user_buf, | ||
| 341 | size_t count, loff_t *ppos); | ||
| 342 | static ssize_t debug_lpm_write(struct file *file, const char __user *buffer, | ||
| 343 | size_t count, loff_t *ppos); | ||
| 344 | static int debug_lpm_close(struct inode *inode, struct file *file); | ||
| 345 | 340 | ||
| 346 | static ssize_t debug_output(struct file*, char __user*, size_t, loff_t*); | 341 | static ssize_t debug_output(struct file*, char __user*, size_t, loff_t*); |
| 347 | static int debug_close(struct inode *, struct file *); | 342 | static int debug_close(struct inode *, struct file *); |
| @@ -367,14 +362,6 @@ static const struct file_operations debug_registers_fops = { | |||
| 367 | .release = debug_close, | 362 | .release = debug_close, |
| 368 | .llseek = default_llseek, | 363 | .llseek = default_llseek, |
| 369 | }; | 364 | }; |
| 370 | static const struct file_operations debug_lpm_fops = { | ||
| 371 | .owner = THIS_MODULE, | ||
| 372 | .open = simple_open, | ||
| 373 | .read = debug_lpm_read, | ||
| 374 | .write = debug_lpm_write, | ||
| 375 | .release = debug_lpm_close, | ||
| 376 | .llseek = noop_llseek, | ||
| 377 | }; | ||
| 378 | 365 | ||
| 379 | static struct dentry *ehci_debug_root; | 366 | static struct dentry *ehci_debug_root; |
| 380 | 367 | ||
| @@ -956,86 +943,6 @@ static int debug_registers_open(struct inode *inode, struct file *file) | |||
| 956 | return file->private_data ? 0 : -ENOMEM; | 943 | return file->private_data ? 0 : -ENOMEM; |
| 957 | } | 944 | } |
| 958 | 945 | ||
| 959 | static int debug_lpm_close(struct inode *inode, struct file *file) | ||
| 960 | { | ||
| 961 | return 0; | ||
| 962 | } | ||
| 963 | |||
| 964 | static ssize_t debug_lpm_read(struct file *file, char __user *user_buf, | ||
| 965 | size_t count, loff_t *ppos) | ||
| 966 | { | ||
| 967 | /* TODO: show lpm stats */ | ||
| 968 | return 0; | ||
| 969 | } | ||
| 970 | |||
| 971 | static ssize_t debug_lpm_write(struct file *file, const char __user *user_buf, | ||
| 972 | size_t count, loff_t *ppos) | ||
| 973 | { | ||
| 974 | struct usb_hcd *hcd; | ||
| 975 | struct ehci_hcd *ehci; | ||
| 976 | char buf[50]; | ||
| 977 | size_t len; | ||
| 978 | u32 temp; | ||
| 979 | unsigned long port; | ||
| 980 | u32 __iomem *portsc ; | ||
| 981 | u32 params; | ||
| 982 | |||
| 983 | hcd = bus_to_hcd(file->private_data); | ||
| 984 | ehci = hcd_to_ehci(hcd); | ||
| 985 | |||
| 986 | len = min(count, sizeof(buf) - 1); | ||
| 987 | if (copy_from_user(buf, user_buf, len)) | ||
| 988 | return -EFAULT; | ||
| 989 | buf[len] = '\0'; | ||
| 990 | if (len > 0 && buf[len - 1] == '\n') | ||
| 991 | buf[len - 1] = '\0'; | ||
| 992 | |||
| 993 | if (strncmp(buf, "enable", 5) == 0) { | ||
| 994 | if (strict_strtoul(buf + 7, 10, &port)) | ||
| 995 | return -EINVAL; | ||
| 996 | params = ehci_readl(ehci, &ehci->caps->hcs_params); | ||
| 997 | if (port > HCS_N_PORTS(params)) { | ||
| 998 | ehci_dbg(ehci, "ERR: LPM on bad port %lu\n", port); | ||
| 999 | return -ENODEV; | ||
| 1000 | } | ||
| 1001 | portsc = &ehci->regs->port_status[port-1]; | ||
| 1002 | temp = ehci_readl(ehci, portsc); | ||
| 1003 | if (!(temp & PORT_DEV_ADDR)) { | ||
| 1004 | ehci_dbg(ehci, "LPM: no device attached\n"); | ||
| 1005 | return -ENODEV; | ||
| 1006 | } | ||
| 1007 | temp |= PORT_LPM; | ||
| 1008 | ehci_writel(ehci, temp, portsc); | ||
| 1009 | printk(KERN_INFO "force enable LPM for port %lu\n", port); | ||
| 1010 | } else if (strncmp(buf, "hird=", 5) == 0) { | ||
| 1011 | unsigned long hird; | ||
| 1012 | if (strict_strtoul(buf + 5, 16, &hird)) | ||
| 1013 | return -EINVAL; | ||
| 1014 | printk(KERN_INFO "setting hird %s %lu\n", buf + 6, hird); | ||
| 1015 | ehci->command = (ehci->command & ~CMD_HIRD) | (hird << 24); | ||
| 1016 | ehci_writel(ehci, ehci->command, &ehci->regs->command); | ||
| 1017 | } else if (strncmp(buf, "disable", 7) == 0) { | ||
| 1018 | if (strict_strtoul(buf + 8, 10, &port)) | ||
| 1019 | return -EINVAL; | ||
| 1020 | params = ehci_readl(ehci, &ehci->caps->hcs_params); | ||
| 1021 | if (port > HCS_N_PORTS(params)) { | ||
| 1022 | ehci_dbg(ehci, "ERR: LPM off bad port %lu\n", port); | ||
| 1023 | return -ENODEV; | ||
| 1024 | } | ||
| 1025 | portsc = &ehci->regs->port_status[port-1]; | ||
| 1026 | temp = ehci_readl(ehci, portsc); | ||
| 1027 | if (!(temp & PORT_DEV_ADDR)) { | ||
| 1028 | ehci_dbg(ehci, "ERR: no device attached\n"); | ||
| 1029 | return -ENODEV; | ||
| 1030 | } | ||
| 1031 | temp &= ~PORT_LPM; | ||
| 1032 | ehci_writel(ehci, temp, portsc); | ||
| 1033 | printk(KERN_INFO "disabled LPM for port %lu\n", port); | ||
| 1034 | } else | ||
| 1035 | return -EOPNOTSUPP; | ||
| 1036 | return count; | ||
| 1037 | } | ||
| 1038 | |||
| 1039 | static inline void create_debug_files (struct ehci_hcd *ehci) | 946 | static inline void create_debug_files (struct ehci_hcd *ehci) |
| 1040 | { | 947 | { |
| 1041 | struct usb_bus *bus = &ehci_to_hcd(ehci)->self; | 948 | struct usb_bus *bus = &ehci_to_hcd(ehci)->self; |
| @@ -1056,10 +963,6 @@ static inline void create_debug_files (struct ehci_hcd *ehci) | |||
| 1056 | &debug_registers_fops)) | 963 | &debug_registers_fops)) |
| 1057 | goto file_error; | 964 | goto file_error; |
| 1058 | 965 | ||
| 1059 | if (!debugfs_create_file("lpm", S_IRUGO|S_IWUSR, ehci->debug_dir, bus, | ||
| 1060 | &debug_lpm_fops)) | ||
| 1061 | goto file_error; | ||
| 1062 | |||
| 1063 | return; | 966 | return; |
| 1064 | 967 | ||
| 1065 | file_error: | 968 | file_error: |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 9c2afb516fe5..68dd1c99b1f5 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
| @@ -39,7 +39,6 @@ | |||
| 39 | #include <linux/dma-mapping.h> | 39 | #include <linux/dma-mapping.h> |
| 40 | #include <linux/debugfs.h> | 40 | #include <linux/debugfs.h> |
| 41 | #include <linux/slab.h> | 41 | #include <linux/slab.h> |
| 42 | #include <linux/uaccess.h> | ||
| 43 | 42 | ||
| 44 | #include <asm/byteorder.h> | 43 | #include <asm/byteorder.h> |
| 45 | #include <asm/io.h> | 44 | #include <asm/io.h> |
| @@ -108,11 +107,6 @@ static bool ignore_oc = 0; | |||
| 108 | module_param (ignore_oc, bool, S_IRUGO); | 107 | module_param (ignore_oc, bool, S_IRUGO); |
| 109 | MODULE_PARM_DESC (ignore_oc, "ignore bogus hardware overcurrent indications"); | 108 | MODULE_PARM_DESC (ignore_oc, "ignore bogus hardware overcurrent indications"); |
| 110 | 109 | ||
| 111 | /* for link power management(LPM) feature */ | ||
| 112 | static unsigned int hird; | ||
| 113 | module_param(hird, int, S_IRUGO); | ||
| 114 | MODULE_PARM_DESC(hird, "host initiated resume duration, +1 for each 75us"); | ||
| 115 | |||
| 116 | #define INTR_MASK (STS_IAA | STS_FATAL | STS_PCD | STS_ERR | STS_INT) | 110 | #define INTR_MASK (STS_IAA | STS_FATAL | STS_PCD | STS_ERR | STS_INT) |
| 117 | 111 | ||
| 118 | /*-------------------------------------------------------------------------*/ | 112 | /*-------------------------------------------------------------------------*/ |
| @@ -318,7 +312,6 @@ static void end_unlink_intr(struct ehci_hcd *ehci, struct ehci_qh *qh); | |||
| 318 | 312 | ||
| 319 | #include "ehci-timer.c" | 313 | #include "ehci-timer.c" |
| 320 | #include "ehci-hub.c" | 314 | #include "ehci-hub.c" |
| 321 | #include "ehci-lpm.c" | ||
| 322 | #include "ehci-mem.c" | 315 | #include "ehci-mem.c" |
| 323 | #include "ehci-q.c" | 316 | #include "ehci-q.c" |
| 324 | #include "ehci-sched.c" | 317 | #include "ehci-sched.c" |
| @@ -580,17 +573,6 @@ static int ehci_init(struct usb_hcd *hcd) | |||
| 580 | temp &= ~(3 << 2); | 573 | temp &= ~(3 << 2); |
| 581 | temp |= (EHCI_TUNE_FLS << 2); | 574 | temp |= (EHCI_TUNE_FLS << 2); |
| 582 | } | <||
