diff options
-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 | } | 575 | } |
583 | if (HCC_LPM(hcc_params)) { | ||
584 | /* support link power management EHCI 1.1 addendum */ | ||
585 | ehci_dbg(ehci, "support lpm\n"); | ||
586 | ehci->has_lpm = 1; | ||
587 | if (hird > 0xf) { | ||
588 | ehci_dbg(ehci, "hird %d invalid, use default 0", | ||
589 | hird); | ||
590 | hird = 0; | ||
591 | } | ||
592 | temp |= hird << 24; | ||
593 | } | ||
594 | ehci->command = temp; | 576 | ehci->command = temp; |
595 | 577 | ||
596 | /* Accept arbitrarily long scatter-gather lists */ | 578 | /* Accept arbitrarily long scatter-gather lists */ |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index a7ec827ca2ca..a2c56cdd2c3a 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -777,11 +777,6 @@ static int ehci_hub_control ( | |||
777 | status_reg); | 777 | status_reg); |
778 | break; | 778 | break; |
779 | case USB_PORT_FEAT_C_CONNECTION: | 779 | case USB_PORT_FEAT_C_CONNECTION: |
780 | if (ehci->has_lpm) { | ||
781 | /* clear PORTSC bits on disconnect */ | ||
782 | temp &= ~PORT_LPM; | ||
783 | temp &= ~PORT_DEV_ADDR; | ||
784 | } | ||
785 | ehci_writel(ehci, temp | PORT_CSC, status_reg); | 780 | ehci_writel(ehci, temp | PORT_CSC, status_reg); |
786 | break; | 781 | break; |
787 | case USB_PORT_FEAT_C_OVER_CURRENT: | 782 | case USB_PORT_FEAT_C_OVER_CURRENT: |
diff --git a/drivers/usb/host/ehci-lpm.c b/drivers/usb/host/ehci-lpm.c deleted file mode 100644 index 6b092c1dff64..000000000000 --- a/drivers/usb/host/ehci-lpm.c +++ /dev/null | |||
@@ -1,101 +0,0 @@ | |||
1 | /* ehci-lpm.c EHCI HCD LPM support code | ||
2 | * Copyright (c) 2008 - 2010, Intel Corporation. | ||
3 | * Author: Jacob Pan <jacob.jun.pan@intel.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 as | ||
7 | * published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
17 | */ | ||
18 | |||
19 | /* this file is part of ehci-hcd.c */ | ||
20 | |||
21 | static int ehci_lpm_set_da(struct ehci_hcd *ehci, int dev_addr, int port_num) | ||
22 | { | ||
23 | u32 __iomem portsc; | ||
24 | |||
25 | ehci_dbg(ehci, "set dev address %d for port %d\n", dev_addr, port_num); | ||
26 | if (port_num > HCS_N_PORTS(ehci->hcs_params)) { | ||
27 | ehci_dbg(ehci, "invalid port number %d\n", port_num); | ||
28 | return -ENODEV; | ||
29 | } | ||
30 | portsc = ehci_readl(ehci, &ehci->regs->port_status[port_num-1]); | ||
31 | portsc &= ~PORT_DEV_ADDR; | ||
32 | portsc |= dev_addr<<25; | ||
33 | ehci_writel(ehci, portsc, &ehci->regs->port_status[port_num-1]); | ||
34 | return 0; | ||
35 | } | ||
36 | |||
37 | /* | ||
38 | * this function is used to check if the device support LPM | ||
39 | * if yes, mark the PORTSC register with PORT_LPM bit | ||
40 | */ | ||
41 | static int ehci_lpm_check(struct ehci_hcd *ehci, int port) | ||
42 | { | ||
43 | u32 __iomem *portsc ; | ||
44 | u32 val32; | ||
45 | int retval; | ||
46 | |||
47 | portsc = &ehci->regs->port_status[port-1]; | ||
48 | val32 = ehci_readl(ehci, portsc); | ||
49 | if (!(val32 & PORT_DEV_ADDR)) { | ||
50 | ehci_dbg(ehci, "LPM: no device attached\n"); | ||
51 | return -ENODEV; | ||
52 | } | ||
53 | val32 |= PORT_LPM; | ||
54 | ehci_writel(ehci, val32, portsc); | ||
55 | msleep(5); | ||
56 | val32 |= PORT_SUSPEND; | ||
57 | ehci_dbg(ehci, "Sending LPM 0x%08x to port %d\n", val32, port); | ||
58 | ehci_writel(ehci, val32, portsc); | ||
59 | /* wait for ACK */ | ||
60 | msleep(10); | ||
61 | retval = handshake(ehci, &ehci->regs->port_status[port-1], PORT_SSTS, | ||
62 | PORTSC_SUSPEND_STS_ACK, 125); | ||
63 | dbg_port(ehci, "LPM", port, val32); | ||
64 | if (retval != -ETIMEDOUT) { | ||
65 | ehci_dbg(ehci, "LPM: device ACK for LPM\n"); | ||
66 | val32 |= PORT_LPM; | ||
67 | /* | ||
68 | * now device should be in L1 sleep, let's wake up the device | ||
69 | * so that we can complete enumeration. | ||
70 | */ | ||
71 | ehci_writel(ehci, val32, portsc); | ||
72 | msleep(10); | ||
73 | val32 |= PORT_RESUME; | ||
74 | ehci_writel(ehci, val32, portsc); | ||
75 | } else { | ||
76 | ehci_dbg(ehci, "LPM: device does not ACK, disable LPM %d\n", | ||
77 | retval); | ||
78 | val32 &= ~PORT_LPM; | ||
79 | retval = -ETIMEDOUT; | ||
80 | ehci_writel(ehci, val32, portsc); | ||
81 | } | ||
82 | |||
83 | return retval; | ||
84 | } | ||
85 | |||
86 | static int __maybe_unused ehci_update_device(struct usb_hcd *hcd, | ||
87 | struct usb_device *udev) | ||
88 | { | ||
89 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | ||
90 | int rc = 0; | ||
91 | |||
92 | if (!udev->parent) /* udev is root hub itself, impossible */ | ||
93 | rc = -1; | ||
94 | /* we only support lpm device connected to root hub yet */ | ||
95 | if (ehci->has_lpm && !udev->parent->parent) { | ||
96 | rc = ehci_lpm_set_da(ehci, udev->devnum, udev->portnum); | ||
97 | if (!rc) | ||
98 | rc = ehci_lpm_check(ehci, udev->portnum); | ||
99 | } | ||
100 | return rc; | ||
101 | } | ||
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 7880ba621f89..e17330ae0aee 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -202,11 +202,6 @@ static int ehci_pci_setup(struct usb_hcd *hcd) | |||
202 | break; | 202 | break; |
203 | case PCI_VENDOR_ID_INTEL: | 203 | case PCI_VENDOR_ID_INTEL: |
204 | ehci->need_io_watchdog = 0; | 204 | ehci->need_io_watchdog = 0; |
205 | if (pdev->device == 0x0806 || pdev->device == 0x0811 | ||
206 | || pdev->device == 0x0829) { | ||
207 | ehci_info(ehci, "disable lpm for langwell/penwell\n"); | ||
208 | ehci->has_lpm = 0; | ||
209 | } | ||
210 | break; | 205 | break; |
211 | case PCI_VENDOR_ID_NVIDIA: | 206 | case PCI_VENDOR_ID_NVIDIA: |
212 | switch (pdev->device) { | 207 | switch (pdev->device) { |
@@ -216,8 +211,7 @@ static int ehci_pci_setup(struct usb_hcd *hcd) | |||
216 | * devices with PPCD enabled. | 211 | * devices with PPCD enabled. |
217 | */ | 212 | */ |
218 | case 0x0d9d: | 213 | case 0x0d9d: |
219 | ehci_info(ehci, "disable lpm/ppcd for nvidia mcp89"); | 214 | ehci_info(ehci, "disable ppcd for nvidia mcp89\n"); |
220 | ehci->has_lpm = 0; | ||
221 | ehci->has_ppcd = 0; | 215 | ehci->has_ppcd = 0; |
222 | ehci->command &= ~CMD_PPCEE; | 216 | ehci->command &= ~CMD_PPCEE; |
223 | break; | 217 | break; |
@@ -425,11 +419,6 @@ static const struct hc_driver ehci_pci_hc_driver = { | |||
425 | .relinquish_port = ehci_relinquish_port, | 419 | .relinquish_port = ehci_relinquish_port, |
426 | .port_handed_over = ehci_port_handed_over, | 420 | .port_handed_over = ehci_port_handed_over, |
427 | 421 | ||
428 | /* | ||
429 | * call back when device connected and addressed | ||
430 | */ | ||
431 | .update_device = ehci_update_device, | ||
432 | |||
433 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | 422 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, |
434 | }; | 423 | }; |
435 | 424 | ||
diff --git a/drivers/usb/host/ehci-vt8500.c b/drivers/usb/host/ehci-vt8500.c index c6fe0bb619cb..11695d5b9d86 100644 --- a/drivers/usb/host/ehci-vt8500.c +++ b/drivers/usb/host/ehci-vt8500.c | |||
@@ -61,11 +61,6 @@ static const struct hc_driver vt8500_ehci_hc_driver = { | |||
61 | .relinquish_port = ehci_relinquish_port, | 61 | .relinquish_port = ehci_relinquish_port, |
62 | .port_handed_over = ehci_port_handed_over, | 62 | .port_handed_over = ehci_port_handed_over, |
63 | 63 | ||
64 | /* | ||
65 | * call back when device connected and addressed | ||
66 | */ | ||
67 | .update_device = ehci_update_device, | ||
68 | |||
69 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | 64 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, |
70 | }; | 65 | }; |
71 | 66 | ||
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index ec948c3b1cea..2262dcdaa3c1 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h | |||
@@ -206,7 +206,6 @@ struct ehci_hcd { /* one per controller */ | |||
206 | #define OHCI_HCCTRL_LEN 0x4 | 206 | #define OHCI_HCCTRL_LEN 0x4 |
207 | __hc32 *ohci_hcctrl_reg; | 207 | __hc32 *ohci_hcctrl_reg; |
208 | unsigned has_hostpc:1; | 208 | unsigned has_hostpc:1; |
209 | unsigned has_lpm:1; /* support link power management */ | ||
210 | unsigned has_ppcd:1; /* support per-port change bits */ | 209 | unsigned has_ppcd:1; /* support per-port change bits */ |
211 | u8 sbrn; /* packed release number */ | 210 | u8 sbrn; /* packed release number */ |
212 | 211 | ||