diff options
Diffstat (limited to 'drivers/usb')
62 files changed, 401 insertions, 1154 deletions
diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c index 4f8eb40ad93a..48731d0bab35 100644 --- a/drivers/usb/chipidea/host.c +++ b/drivers/usb/chipidea/host.c | |||
@@ -34,6 +34,44 @@ | |||
34 | 34 | ||
35 | static struct hc_driver __read_mostly ci_ehci_hc_driver; | 35 | static struct hc_driver __read_mostly ci_ehci_hc_driver; |
36 | 36 | ||
37 | struct ehci_ci_priv { | ||
38 | struct regulator *reg_vbus; | ||
39 | }; | ||
40 | |||
41 | static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable) | ||
42 | { | ||
43 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | ||
44 | struct ehci_ci_priv *priv = (struct ehci_ci_priv *)ehci->priv; | ||
45 | struct device *dev = hcd->self.controller; | ||
46 | struct ci_hdrc *ci = dev_get_drvdata(dev); | ||
47 | int ret = 0; | ||
48 | int port = HCS_N_PORTS(ehci->hcs_params); | ||
49 | |||
50 | if (priv->reg_vbus && !ci_otg_is_fsm_mode(ci)) { | ||
51 | if (port > 1) { | ||
52 | dev_warn(dev, | ||
53 | "Not support multi-port regulator control\n"); | ||
54 | return 0; | ||
55 | } | ||
56 | if (enable) | ||
57 | ret = regulator_enable(priv->reg_vbus); | ||
58 | else | ||
59 | ret = regulator_disable(priv->reg_vbus); | ||
60 | if (ret) { | ||
61 | dev_err(dev, | ||
62 | "Failed to %s vbus regulator, ret=%d\n", | ||
63 | enable ? "enable" : "disable", ret); | ||
64 | return ret; | ||
65 | } | ||
66 | } | ||
67 | return 0; | ||
68 | }; | ||
69 | |||
70 | static const struct ehci_driver_overrides ehci_ci_overrides = { | ||
71 | .extra_priv_size = sizeof(struct ehci_ci_priv), | ||
72 | .port_power = ehci_ci_portpower, | ||
73 | }; | ||
74 | |||
37 | static irqreturn_t host_irq(struct ci_hdrc *ci) | 75 | static irqreturn_t host_irq(struct ci_hdrc *ci) |
38 | { | 76 | { |
39 | return usb_hcd_irq(ci->irq, ci->hcd); | 77 | return usb_hcd_irq(ci->irq, ci->hcd); |
@@ -43,6 +81,7 @@ static int host_start(struct ci_hdrc *ci) | |||
43 | { | 81 | { |
44 | struct usb_hcd *hcd; | 82 | struct usb_hcd *hcd; |
45 | struct ehci_hcd *ehci; | 83 | struct ehci_hcd *ehci; |
84 | struct ehci_ci_priv *priv; | ||
46 | int ret; | 85 | int ret; |
47 | 86 | ||
48 | if (usb_disabled()) | 87 | if (usb_disabled()) |
@@ -71,23 +110,15 @@ static int host_start(struct ci_hdrc *ci) | |||
71 | ehci->has_tdi_phy_lpm = ci->hw_bank.lpm; | 110 | ehci->has_tdi_phy_lpm = ci->hw_bank.lpm; |
72 | ehci->imx28_write_fix = ci->imx28_write_fix; | 111 | ehci->imx28_write_fix = ci->imx28_write_fix; |
73 | 112 | ||
74 | /* | 113 | priv = (struct ehci_ci_priv *)ehci->priv; |
75 | * vbus is always on if host is not in OTG FSM mode, | 114 | priv->reg_vbus = NULL; |
76 | * otherwise should be controlled by OTG FSM | 115 | |
77 | */ | 116 | if (ci->platdata->reg_vbus) |
78 | if (ci->platdata->reg_vbus && !ci_otg_is_fsm_mode(ci)) { | 117 | priv->reg_vbus = ci->platdata->reg_vbus; |
79 | ret = regulator_enable(ci->platdata->reg_vbus); | ||
80 | if (ret) { | ||
81 | dev_err(ci->dev, | ||
82 | "Failed to enable vbus regulator, ret=%d\n", | ||
83 | ret); | ||
84 | goto put_hcd; | ||
85 | } | ||
86 | } | ||
87 | 118 | ||
88 | ret = usb_add_hcd(hcd, 0, 0); | 119 | ret = usb_add_hcd(hcd, 0, 0); |
89 | if (ret) { | 120 | if (ret) { |
90 | goto disable_reg; | 121 | goto put_hcd; |
91 | } else { | 122 | } else { |
92 | struct usb_otg *otg = &ci->otg; | 123 | struct usb_otg *otg = &ci->otg; |
93 | 124 | ||
@@ -104,10 +135,6 @@ static int host_start(struct ci_hdrc *ci) | |||
104 | 135 | ||
105 | return ret; | 136 | return ret; |
106 | 137 | ||
107 | disable_reg: | ||
108 | if (ci->platdata->reg_vbus && !ci_otg_is_fsm_mode(ci)) | ||
109 | regulator_disable(ci->platdata->reg_vbus); | ||
110 | |||
111 | put_hcd: | 138 | put_hcd: |
112 | usb_put_hcd(hcd); | 139 | usb_put_hcd(hcd); |
113 | 140 | ||
@@ -121,8 +148,6 @@ static void host_stop(struct ci_hdrc *ci) | |||
121 | if (hcd) { | 148 | if (hcd) { |
122 | usb_remove_hcd(hcd); | 149 | usb_remove_hcd(hcd); |
123 | usb_put_hcd(hcd); | 150 | usb_put_hcd(hcd); |
124 | if (ci->platdata->reg_vbus && !ci_otg_is_fsm_mode(ci)) | ||
125 | regulator_disable(ci->platdata->reg_vbus); | ||
126 | } | 151 | } |
127 | } | 152 | } |
128 | 153 | ||
@@ -150,7 +175,7 @@ int ci_hdrc_host_init(struct ci_hdrc *ci) | |||
150 | rdrv->name = "host"; | 175 | rdrv->name = "host"; |
151 | ci->roles[CI_ROLE_HOST] = rdrv; | 176 | ci->roles[CI_ROLE_HOST] = rdrv; |
152 | 177 | ||
153 | ehci_init_driver(&ci_ehci_hc_driver, NULL); | 178 | ehci_init_driver(&ci_ehci_hc_driver, &ehci_ci_overrides); |
154 | 179 | ||
155 | return 0; | 180 | return 0; |
156 | } | 181 | } |
diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index 3c2ab1ae00fc..368cc8e94fd6 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c | |||
@@ -795,11 +795,8 @@ int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci) | |||
795 | 795 | ||
796 | ci->fsm_timer = devm_kzalloc(ci->dev, | 796 | ci->fsm_timer = devm_kzalloc(ci->dev, |
797 | sizeof(struct ci_otg_fsm_timer_list), GFP_KERNEL); | 797 | sizeof(struct ci_otg_fsm_timer_list), GFP_KERNEL); |
798 | if (!ci->fsm_timer) { | 798 | if (!ci->fsm_timer) |
799 | dev_err(ci->dev, | ||
800 | "Failed to allocate timer structure for ci hdrc otg!\n"); | ||
801 | return -ENOMEM; | 799 | return -ENOMEM; |
802 | } | ||
803 | 800 | ||
804 | INIT_LIST_HEAD(&ci->fsm_timer->active_timers); | 801 | INIT_LIST_HEAD(&ci->fsm_timer->active_timers); |
805 | retval = ci_otg_init_timers(ci); | 802 | retval = ci_otg_init_timers(ci); |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index e934e19f49f5..546a17e8ad5b 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -60,6 +60,9 @@ static struct acm *acm_table[ACM_TTY_MINORS]; | |||
60 | 60 | ||
61 | static DEFINE_MUTEX(acm_table_lock); | 61 | static DEFINE_MUTEX(acm_table_lock); |
62 | 62 | ||
63 | static void acm_tty_set_termios(struct tty_struct *tty, | ||
64 | struct ktermios *termios_old); | ||
65 | |||
63 | /* | 66 | /* |
64 | * acm_table accessors | 67 | * acm_table accessors |
65 | */ | 68 | */ |
@@ -145,8 +148,15 @@ static int acm_ctrl_msg(struct acm *acm, int request, int value, | |||
145 | /* devices aren't required to support these requests. | 148 | /* devices aren't required to support these requests. |
146 | * the cdc acm descriptor tells whether they do... | 149 | * the cdc acm descriptor tells whether they do... |
147 | */ | 150 | */ |
148 | #define acm_set_control(acm, control) \ | 151 | static inline int acm_set_control(struct acm *acm, int control) |
149 | acm_ctrl_msg(acm, USB_CDC_REQ_SET_CONTROL_LINE_STATE, control, NULL, 0) | 152 | { |
153 | if (acm->quirks & QUIRK_CONTROL_LINE_STATE) | ||
154 | return -EOPNOTSUPP; | ||
155 | |||
156 | return acm_ctrl_msg(acm, USB_CDC_REQ_SET_CONTROL_LINE_STATE, | ||
157 | control, NULL, 0); | ||
158 | } | ||
159 | |||
150 | #define acm_set_line(acm, line) \ | 160 | #define acm_set_line(acm, line) \ |
151 | acm_ctrl_msg(acm, USB_CDC_REQ_SET_LINE_CODING, 0, line, sizeof *(line)) | 161 | acm_ctrl_msg(acm, USB_CDC_REQ_SET_LINE_CODING, 0, line, sizeof *(line)) |
152 | #define acm_send_break(acm, ms) \ | 162 | #define acm_send_break(acm, ms) \ |
@@ -554,6 +564,8 @@ static int acm_port_activate(struct tty_port *port, struct tty_struct *tty) | |||
554 | goto error_submit_urb; | 564 | goto error_submit_urb; |
555 | } | 565 | } |
556 | 566 | ||
567 | acm_tty_set_termios(tty, NULL); | ||
568 | |||
557 | /* | 569 | /* |
558 | * Unthrottle device in case the TTY was closed while throttled. | 570 | * Unthrottle device in case the TTY was closed while throttled. |
559 | */ | 571 | */ |
@@ -980,11 +992,12 @@ static void acm_tty_set_termios(struct tty_struct *tty, | |||
980 | /* FIXME: Needs to clear unsupported bits in the termios */ | 992 | /* FIXME: Needs to clear unsupported bits in the termios */ |
981 | acm->clocal = ((termios->c_cflag & CLOCAL) != 0); | 993 | acm->clocal = ((termios->c_cflag & CLOCAL) != 0); |
982 | 994 | ||
983 | if (!newline.dwDTERate) { | 995 | if (C_BAUD(tty) == B0) { |
984 | newline.dwDTERate = acm->line.dwDTERate; | 996 | newline.dwDTERate = acm->line.dwDTERate; |
985 | newctrl &= ~ACM_CTRL_DTR; | 997 | newctrl &= ~ACM_CTRL_DTR; |
986 | } else | 998 | } else if (termios_old && (termios_old->c_cflag & CBAUD) == B0) { |
987 | newctrl |= ACM_CTRL_DTR; | 999 | newctrl |= ACM_CTRL_DTR; |
1000 | } | ||
988 | 1001 | ||
989 | if (newctrl != acm->ctrlout) | 1002 | if (newctrl != acm->ctrlout) |
990 | acm_set_control(acm, acm->ctrlout = newctrl); | 1003 | acm_set_control(acm, acm->ctrlout = newctrl); |
@@ -1144,8 +1157,6 @@ static int acm_probe(struct usb_interface *intf, | |||
1144 | case USB_CDC_CALL_MANAGEMENT_TYPE: | 1157 | case USB_CDC_CALL_MANAGEMENT_TYPE: |
1145 | call_management_function = buffer[3]; | 1158 | call_management_function = buffer[3]; |
1146 | call_interface_num = buffer[4]; | 1159 | call_interface_num = buffer[4]; |
1147 | if ((quirks & NOT_A_MODEM) == 0 && (call_management_function & 3) != 3) | ||
1148 | dev_err(&intf->dev, "This device cannot do calls on its own. It is not a modem.\n"); | ||
1149 | break; | 1160 | break; |
1150 | default: | 1161 | default: |
1151 | /* there are LOTS more CDC descriptors that | 1162 | /* there are LOTS more CDC descriptors that |
@@ -1184,10 +1195,11 @@ next_desc: | |||
1184 | } else { | 1195 | } else { |
1185 | control_interface = usb_ifnum_to_if(usb_dev, union_header->bMasterInterface0); | 1196 | control_interface = usb_ifnum_to_if(usb_dev, union_header->bMasterInterface0); |
1186 | data_interface = usb_ifnum_to_if(usb_dev, (data_interface_num = union_header->bSlaveInterface0)); | 1197 | data_interface = usb_ifnum_to_if(usb_dev, (data_interface_num = union_header->bSlaveInterface0)); |
1187 | if (!control_interface || !data_interface) { | 1198 | } |
1188 | dev_dbg(&intf->dev, "no interfaces\n"); | 1199 | |
1189 | return -ENODEV; | 1200 | if (!control_interface || !data_interface) { |
1190 | } | 1201 | dev_dbg(&intf->dev, "no interfaces\n"); |
1202 | return -ENODEV; | ||
1191 | } | 1203 | } |
1192 | 1204 | ||
1193 | if (data_interface_num != call_interface_num) | 1205 | if (data_interface_num != call_interface_num) |
@@ -1314,6 +1326,7 @@ made_compressed_probe: | |||
1314 | tty_port_init(&acm->port); | 1326 | tty_port_init(&acm->port); |
1315 | acm->port.ops = &acm_port_ops; | 1327 | acm->port.ops = &acm_port_ops; |
1316 | init_usb_anchor(&acm->delayed); | 1328 | init_usb_anchor(&acm->delayed); |
1329 | acm->quirks = quirks; | ||
1317 | 1330 | ||
1318 | buf = usb_alloc_coherent(usb_dev, ctrlsize, GFP_KERNEL, &acm->ctrl_dma); | 1331 | buf = usb_alloc_coherent(usb_dev, ctrlsize, GFP_KERNEL, &acm->ctrl_dma); |
1319 | if (!buf) { | 1332 | if (!buf) { |
@@ -1461,6 +1474,7 @@ alloc_fail8: | |||
1461 | &dev_attr_wCountryCodes); | 1474 | &dev_attr_wCountryCodes); |
1462 | device_remove_file(&acm->control->dev, | 1475 | device_remove_file(&acm->control->dev, |
1463 | &dev_attr_iCountryCodeRelDate); | 1476 | &dev_attr_iCountryCodeRelDate); |
1477 | kfree(acm->country_codes); | ||
1464 | } | 1478 | } |
1465 | device_remove_file(&acm->control->dev, &dev_attr_bmCapabilities); | 1479 | device_remove_file(&acm->control->dev, &dev_attr_bmCapabilities); |
1466 | alloc_fail7: | 1480 | alloc_fail7: |
@@ -1681,6 +1695,9 @@ static const struct usb_device_id acm_ids[] = { | |||
1681 | { USB_DEVICE(0x0572, 0x1328), /* Shiro / Aztech USB MODEM UM-3100 */ | 1695 | { USB_DEVICE(0x0572, 0x1328), /* Shiro / Aztech USB MODEM UM-3100 */ |
1682 | .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ | 1696 | .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ |
1683 | }, | 1697 | }, |
1698 | { USB_DEVICE(0x20df, 0x0001), /* Simtec Electronics Entropy Key */ | ||
1699 | .driver_info = QUIRK_CONTROL_LINE_STATE, }, | ||
1700 | { USB_DEVICE(0x2184, 0x001c) }, /* GW Instek AFG-2225 */ | ||
1684 | { USB_DEVICE(0x22b8, 0x6425), /* Motorola MOTOMAGX phones */ | 1701 | { USB_DEVICE(0x22b8, 0x6425), /* Motorola MOTOMAGX phones */ |
1685 | }, | 1702 | }, |
1686 | /* Motorola H24 HSPA module: */ | 1703 | /* Motorola H24 HSPA module: */ |
@@ -1796,11 +1813,6 @@ static const struct usb_device_id acm_ids[] = { | |||
1796 | 1813 | ||
1797 | /* NOTE: non-Nokia COMM/ACM/0xff is likely MSFT RNDIS... NOT a modem! */ | 1814 | /* NOTE: non-Nokia COMM/ACM/0xff is likely MSFT RNDIS... NOT a modem! */ |
1798 | 1815 | ||
1799 | /* Support Lego NXT using pbLua firmware */ | ||
1800 | { USB_DEVICE(0x0694, 0xff00), | ||
1801 | .driver_info = NOT_A_MODEM, | ||
1802 | }, | ||
1803 | |||
1804 | /* Support for Droids MuIn LCD */ | 1816 | /* Support for Droids MuIn LCD */ |
1805 | { USB_DEVICE(0x04d8, 0x000b), | 1817 | { USB_DEVICE(0x04d8, 0x000b), |
1806 | .driver_info = NO_DATA_INTERFACE, | 1818 | .driver_info = NO_DATA_INTERFACE, |
diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h index fc75651afe1c..ffeb3c83941f 100644 --- a/drivers/usb/class/cdc-acm.h +++ b/drivers/usb/class/cdc-acm.h | |||
@@ -121,6 +121,7 @@ struct acm { | |||
121 | unsigned int throttle_req:1; /* throttle requested */ | 121 | unsigned int throttle_req:1; /* throttle requested */ |
122 | u8 bInterval; | 122 | u8 bInterval; |
123 | struct usb_anchor delayed; /* writes queued for a device about to be woken */ | 123 | struct usb_anchor delayed; /* writes queued for a device about to be woken */ |
124 | unsigned long quirks; | ||
124 | }; | 125 | }; |
125 | 126 | ||
126 | #define CDC_DATA_INTERFACE_TYPE 0x0a | 127 | #define CDC_DATA_INTERFACE_TYPE 0x0a |
@@ -129,6 +130,6 @@ struct acm { | |||
129 | #define NO_UNION_NORMAL BIT(0) | 130 | #define NO_UNION_NORMAL BIT(0) |
130 | #define SINGLE_RX_URB BIT(1) | 131 | #define SINGLE_RX_URB BIT(1) |
131 | #define NO_CAP_LINE BIT(2) | 132 | #define NO_CAP_LINE BIT(2) |
132 | #define NOT_A_MODEM BIT(3) | ||
133 | #define NO_DATA_INTERFACE BIT(4) | 133 | #define NO_DATA_INTERFACE BIT(4) |
134 | #define IGNORE_DEVICE BIT(5) | 134 | #define IGNORE_DEVICE BIT(5) |
135 | #define QUIRK_CONTROL_LINE_STATE BIT(6) | ||
diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index ec978408a2ee..960bc089111b 100644 --- a/drivers/usb/class/usbtmc.c +++ b/drivers/usb/class/usbtmc.c | |||
@@ -1104,10 +1104,8 @@ static int usbtmc_probe(struct usb_interface *intf, | |||
1104 | dev_dbg(&intf->dev, "%s called\n", __func__); | 1104 | dev_dbg(&intf->dev, "%s called\n", __func__); |
1105 | 1105 | ||
1106 | data = devm_kzalloc(&intf->dev, sizeof(*data), GFP_KERNEL); | 1106 | data = devm_kzalloc(&intf->dev, sizeof(*data), GFP_KERNEL); |
1107 | if (!data) { | 1107 | if (!data) |
1108 | dev_err(&intf->dev, "Unable to allocate kernel memory\n"); | ||
1109 | return -ENOMEM; | 1108 | return -ENOMEM; |
1110 | } | ||
1111 | 1109 | ||
1112 | data->intf = intf; | 1110 | data->intf = intf; |
1113 | data->id = id; | 1111 | data->id = id; |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 6a2a2fd990ab..2f2118fa36a8 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -2060,6 +2060,8 @@ int usb_alloc_streams(struct usb_interface *interface, | |||
2060 | return -EINVAL; | 2060 | return -EINVAL; |
2061 | if (dev->speed != USB_SPEED_SUPER) | 2061 | if (dev->speed != USB_SPEED_SUPER) |
2062 | return -EINVAL; | 2062 | return -EINVAL; |
2063 | if (dev->state < USB_STATE_CONFIGURED) | ||
2064 | return -ENODEV; | ||
2063 | 2065 | ||
2064 | for (i = 0; i < num_eps; i++) { | 2066 | for (i = 0; i < num_eps; i++) { |
2065 | /* Streams only apply to bulk endpoints. */ | 2067 | /* Streams only apply to bulk endpoints. */ |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 11e80ac31324..c1dc42e6af05 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -2543,11 +2543,14 @@ int usb_authorize_device(struct usb_device *usb_dev) | |||
2543 | "can't autoresume for authorization: %d\n", result); | 2543 | "can't autoresume for authorization: %d\n", result); |
2544 | goto error_autoresume; | 2544 | goto error_autoresume; |
2545 | } | 2545 | } |
2546 | result = usb_get_device_descriptor(usb_dev, sizeof(usb_dev->descriptor)); | 2546 | |
2547 | if (result < 0) { | 2547 | if (usb_dev->wusb) { |
2548 | dev_err(&usb_dev->dev, "can't re-read device descriptor for " | 2548 | result = usb_get_device_descriptor(usb_dev, sizeof(usb_dev->descriptor)); |
2549 | "authorization: %d\n", result); | 2549 | if (result < 0) { |
2550 | goto error_device_descriptor; | 2550 | dev_err(&usb_dev->dev, "can't re-read device descriptor for " |
2551 | "authorization: %d\n", result); | ||
2552 | goto error_device_descriptor; | ||
2553 | } | ||
2551 | } | 2554 | } |
2552 | 2555 | ||
2553 | usb_dev->authorized = 1; | 2556 | usb_dev->authorized = 1; |
@@ -3907,14 +3910,9 @@ static void usb_enable_link_state(struct usb_hcd *hcd, struct usb_device *udev, | |||
3907 | static int usb_disable_link_state(struct usb_hcd *hcd, struct usb_device *udev, | 3910 | static int usb_disable_link_state(struct usb_hcd *hcd, struct usb_device *udev, |
3908 | enum usb3_link_state state) | 3911 | enum usb3_link_state state) |
3909 | { | 3912 | { |
3910 | int feature; | ||
3911 | |||
3912 | switch (state) { | 3913 | switch (state) { |
3913 | case USB3_LPM_U1: | 3914 | case USB3_LPM_U1: |
3914 | feature = USB_PORT_FEAT_U1_TIMEOUT; | ||
3915 | break; | ||
3916 | case USB3_LPM_U2: | 3915 | case USB3_LPM_U2: |
3917 | feature = USB_PORT_FEAT_U2_TIMEOUT; | ||
3918 | break; | 3916 | break; |
3919 | default: | 3917 | default: |
3920 | dev_warn(&udev->dev, "%s: Can't disable non-U1 or U2 state.\n", | 3918 | dev_warn(&udev->dev, "%s: Can't disable non-U1 or U2 state.\n", |
@@ -4468,9 +4466,6 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1, | |||
4468 | if (retval) | 4466 | if (retval) |
4469 | goto fail; | 4467 | goto fail; |
4470 | 4468 | ||
4471 | if (hcd->usb_phy && !hdev->parent) | ||
4472 | usb_phy_notify_connect(hcd->usb_phy, udev->speed); | ||
4473 | |||
4474 | /* | 4469 | /* |
4475 | * Some superspeed devices have finished the link training process | 4470 | * Some superspeed devices have finished the link training process |
4476 | * and attached to a superspeed hub port, but the device descriptor | 4471 | * and attached to a superspeed hub port, but the device descriptor |
@@ -4627,8 +4622,7 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus, | |||
4627 | 4622 | ||
4628 | /* Disconnect any existing devices under this port */ | 4623 | /* Disconnect any existing devices under this port */ |
4629 | if (udev) { | 4624 | if (udev) { |
4630 | if (hcd->usb_phy && !hdev->parent && | 4625 | if (hcd->usb_phy && !hdev->parent) |
4631 | !(portstatus & USB_PORT_STAT_CONNECTION)) | ||
4632 | usb_phy_notify_disconnect(hcd->usb_phy, udev->speed); | 4626 | usb_phy_notify_disconnect(hcd->usb_phy, udev->speed); |
4633 | usb_disconnect(&port_dev->child); | 4627 | usb_disconnect(&port_dev->child); |
4634 | } | 4628 | } |
@@ -4783,6 +4777,10 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus, | |||
4783 | port_dev->child = NULL; | 4777 | port_dev->child = NULL; |
4784 | spin_unlock_irq(&device_state_lock); | 4778 | spin_unlock_irq(&device_state_lock); |
4785 | mutex_unlock(&usb_port_peer_mutex); | 4779 | mutex_unlock(&usb_port_peer_mutex); |
4780 | } else { | ||
4781 | if (hcd->usb_phy && !hdev->parent) | ||
4782 | usb_phy_notify_connect(hcd->usb_phy, | ||
4783 | udev->speed); | ||
4786 | } | 4784 | } |
4787 | } | 4785 | } |
4788 | 4786 | ||
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index 5ae883dc21f5..39b4081b632d 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
@@ -97,6 +97,12 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
97 | { USB_DEVICE(0x04f3, 0x0089), .driver_info = | 97 | { USB_DEVICE(0x04f3, 0x0089), .driver_info = |
98 | USB_QUIRK_DEVICE_QUALIFIER }, | 98 | USB_QUIRK_DEVICE_QUALIFIER }, |
99 | 99 | ||
100 | { USB_DEVICE(0x04f3, 0x009b), .driver_info = | ||
101 | USB_QUIRK_DEVICE_QUALIFIER }, | ||
102 | |||
103 | { USB_DEVICE(0x04f3, 0x016f), .driver_info = | ||
104 | USB_QUIRK_DEVICE_QUALIFIER }, | ||
105 | |||
100 | /* Roland SC-8820 */ | 106 | /* Roland SC-8820 */ |
101 | { USB_DEVICE(0x0582, 0x0007), .driver_info = USB_QUIRK_RESET_RESUME }, | 107 | { USB_DEVICE(0x0582, 0x0007), .driver_info = USB_QUIRK_RESET_RESUME }, |
102 | 108 | ||
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 407f55cf83aa..200168ec2d75 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c | |||
@@ -2323,7 +2323,7 @@ irq_retry: | |||
2323 | 2323 | ||
2324 | u32 usb_status = readl(hsotg->regs + GOTGCTL); | 2324 | u32 usb_status = readl(hsotg->regs + GOTGCTL); |
2325 | 2325 | ||
2326 | dev_info(hsotg->dev, "%s: USBRst\n", __func__); | 2326 | dev_dbg(hsotg->dev, "%s: USBRst\n", __func__); |
2327 | dev_dbg(hsotg->dev, "GNPTXSTS=%08x\n", | 2327 | dev_dbg(hsotg->dev, "GNPTXSTS=%08x\n", |
2328 | readl(hsotg->regs + GNPTXSTS)); | 2328 | readl(hsotg->regs + GNPTXSTS)); |
2329 | 2329 | ||
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index a8a30b1d4167..fafc628480e0 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig | |||
@@ -234,7 +234,7 @@ config USB_EHCI_SH | |||
234 | 234 | ||
235 | config USB_EHCI_EXYNOS | 235 | config USB_EHCI_EXYNOS |
236 | tristate "EHCI support for Samsung S5P/EXYNOS SoC Series" | 236 | tristate "EHCI support for Samsung S5P/EXYNOS SoC Series" |
237 | depends on PLAT_S5P || ARCH_EXYNOS | 237 | depends on ARCH_S5PV210 || ARCH_EXYNOS |
238 | help | 238 | help |
239 | Enable support for the Samsung Exynos SOC's on-chip EHCI controller. | 239 | Enable support for the Samsung Exynos SOC's on-chip EHCI controller. |
240 | 240 | ||
@@ -292,11 +292,15 @@ config USB_EHCI_HCD_PLATFORM | |||
292 | If unsure, say N. | 292 | If unsure, say N. |
293 | 293 | ||
294 | config USB_OCTEON_EHCI | 294 | config USB_OCTEON_EHCI |
295 | bool "Octeon on-chip EHCI support" | 295 | bool "Octeon on-chip EHCI support (DEPRECATED)" |
296 | depends on CAVIUM_OCTEON_SOC | 296 | depends on CAVIUM_OCTEON_SOC |
297 | default n | 297 | default n |
298 | select USB_EHCI_BIG_ENDIAN_MMIO | 298 | select USB_EHCI_BIG_ENDIAN_MMIO |
299 | select USB_EHCI_HCD_PLATFORM | ||
299 | help | 300 | help |
301 | This option is deprecated now and the driver was removed, use | ||
302 | USB_EHCI_HCD_PLATFORM instead. | ||
303 | |||
300 | Enable support for the Octeon II SOC's on-chip EHCI | 304 | Enable support for the Octeon II SOC's on-chip EHCI |
301 | controller. It is needed for high-speed (480Mbit/sec) | 305 | controller. It is needed for high-speed (480Mbit/sec) |
302 | USB 2.0 device support. All CN6XXX based chips with USB are | 306 | USB 2.0 device support. All CN6XXX based chips with USB are |
@@ -550,7 +554,7 @@ config USB_OHCI_SH | |||
550 | 554 | ||
551 | config USB_OHCI_EXYNOS | 555 | config USB_OHCI_EXYNOS |
552 | tristate "OHCI support for Samsung S5P/EXYNOS SoC Series" | 556 | tristate "OHCI support for Samsung S5P/EXYNOS SoC Series" |
553 | depends on PLAT_S5P || ARCH_EXYNOS | 557 | depends on ARCH_S5PV210 || ARCH_EXYNOS |
554 | help | 558 | help |
555 | Enable support for the Samsung Exynos SOC's on-chip OHCI controller. | 559 | Enable support for the Samsung Exynos SOC's on-chip OHCI controller. |
556 | 560 | ||
@@ -575,12 +579,16 @@ config USB_OHCI_HCD_PLATFORM | |||
575 | If unsure, say N. | 579 | If unsure, say N. |
576 | 580 | ||
577 | config USB_OCTEON_OHCI | 581 | config USB_OCTEON_OHCI |
578 | bool "Octeon on-chip OHCI support" | 582 | bool "Octeon on-chip OHCI support (DEPRECATED)" |
579 | depends on CAVIUM_OCTEON_SOC | 583 | depends on CAVIUM_OCTEON_SOC |
580 | default USB_OCTEON_EHCI | 584 | default USB_OCTEON_EHCI |
581 | select USB_OHCI_BIG_ENDIAN_MMIO | 585 | select USB_OHCI_BIG_ENDIAN_MMIO |
582 | select USB_OHCI_LITTLE_ENDIAN | 586 | select USB_OHCI_LITTLE_ENDIAN |
587 | select USB_OHCI_HCD_PLATFORM | ||
583 | help | 588 | help |
589 | This option is deprecated now and the driver was removed, use | ||
590 | USB_OHCI_HCD_PLATFORM instead. | ||
591 | |||
584 | Enable support for the Octeon II SOC's on-chip OHCI | 592 | Enable support for the Octeon II SOC's on-chip OHCI |
585 | controller. It is needed for low-speed USB 1.0 device | 593 | controller. It is needed for low-speed USB 1.0 device |
586 | support. All CN6XXX based chips with USB are supported. | 594 | support. All CN6XXX based chips with USB are supported. |
@@ -754,12 +762,6 @@ config USB_IMX21_HCD | |||
754 | To compile this driver as a module, choose M here: the | 762 | To compile this driver as a module, choose M here: the |
755 | module will be called "imx21-hcd". | 763 | module will be called "imx21-hcd". |
756 | 764 | ||
757 | |||
758 | |||
759 | config USB_OCTEON2_COMMON | ||
760 | bool | ||
761 | default y if USB_OCTEON_EHCI || USB_OCTEON_OHCI | ||
762 | |||
763 | config USB_HCD_BCMA | 765 | config USB_HCD_BCMA |
764 | tristate "BCMA usb host driver" | 766 | tristate "BCMA usb host driver" |
765 | depends on BCMA | 767 | depends on BCMA |
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index 348c24321562..d6216a493bab 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile | |||
@@ -73,7 +73,6 @@ obj-$(CONFIG_USB_ISP1760_HCD) += isp1760.o | |||
73 | obj-$(CONFIG_USB_HWA_HCD) += hwa-hc.o | 73 | obj-$(CONFIG_USB_HWA_HCD) += hwa-hc.o |
74 | obj-$(CONFIG_USB_IMX21_HCD) += imx21-hcd.o | 74 | obj-$(CONFIG_USB_IMX21_HCD) += imx21-hcd.o |
75 | obj-$(CONFIG_USB_FSL_MPH_DR_OF) += fsl-mph-dr-of.o | 75 | obj-$(CONFIG_USB_FSL_MPH_DR_OF) += fsl-mph-dr-of.o |
76 | obj-$(CONFIG_USB_OCTEON2_COMMON) += octeon2-common.o | ||
77 | obj-$(CONFIG_USB_HCD_BCMA) += bcma-hcd.o | 76 | obj-$(CONFIG_USB_HCD_BCMA) += bcma-hcd.o |
78 | obj-$(CONFIG_USB_HCD_SSB) += ssb-hcd.o | 77 | obj-$(CONFIG_USB_HCD_SSB) += ssb-hcd.o |
79 | obj-$(CONFIG_USB_FUSBH200_HCD) += fusbh200-hcd.o | 78 | obj-$(CONFIG_USB_FUSBH200_HCD) += fusbh200-hcd.o |
diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c index ec9f7b75d497..56a88506febe 100644 --- a/drivers/usb/host/ehci-atmel.c +++ b/drivers/usb/host/ehci-atmel.c | |||
@@ -107,22 +107,15 @@ static int ehci_atmel_drv_probe(struct platform_device *pdev) | |||
107 | } | 107 | } |
108 | 108 | ||
109 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 109 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
110 | if (!res) { | ||
111 | dev_err(&pdev->dev, | ||
112 | "Found HC with no register addr. Check %s setup!\n", | ||
113 | dev_name(&pdev->dev)); | ||
114 | retval = -ENODEV; | ||
115 | goto fail_request_resource; | ||
116 | } | ||
117 | hcd->rsrc_start = res->start; | ||
118 | hcd->rsrc_len = resource_size(res); | ||
119 | |||
120 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); | 110 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); |
121 | if (IS_ERR(hcd->regs)) { | 111 | if (IS_ERR(hcd->regs)) { |
122 | retval = PTR_ERR(hcd->regs); | 112 | retval = PTR_ERR(hcd->regs); |
123 | goto fail_request_resource; | 113 | goto fail_request_resource; |
124 | } | 114 | } |
125 | 115 | ||
116 | hcd->rsrc_start = res->start; | ||
117 | hcd->rsrc_len = resource_size(res); | ||
118 | |||
126 | iclk = devm_clk_get(&pdev->dev, "ehci_clk"); | 119 | iclk = devm_clk_get(&pdev->dev, "ehci_clk"); |
127 | if (IS_ERR(iclk)) { | 120 | if (IS_ERR(iclk)) { |
128 | dev_err(&pdev->dev, "Error getting interface clock\n"); | 121 | dev_err(&pdev->dev, "Error getting interface clock\n"); |
diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c index 7189f2e32ac2..f58c9750e3e4 100644 --- a/drivers/usb/host/ehci-exynos.c +++ b/drivers/usb/host/ehci-exynos.c | |||
@@ -74,7 +74,6 @@ static int exynos_ehci_get_phy(struct device *dev, | |||
74 | 74 | ||
75 | phy = devm_of_phy_get(dev, child, NULL); | 75 | phy = devm_of_phy_get(dev, child, NULL); |
76 | exynos_ehci->phy[phy_number] = phy; | 76 | exynos_ehci->phy[phy_number] = phy; |
77 | of_node_put(child); | ||
78 | if (IS_ERR(phy)) { | 77 | if (IS_ERR(phy)) { |
79 | ret = PTR_ERR(phy); | 78 | ret = PTR_ERR(phy); |
80 | if (ret == -EPROBE_DEFER) { | 79 | if (ret == -EPROBE_DEFER) { |
@@ -188,20 +187,15 @@ skip_phy: | |||
188 | goto fail_clk; | 187 | goto fail_clk; |
189 | 188 | ||
190 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 189 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
191 | if (!res) { | ||
192 | dev_err(&pdev->dev, "Failed to get I/O memory\n"); | ||
193 | err = -ENXIO; | ||
194 | goto fail_io; | ||
195 | } | ||
196 | |||
197 | hcd->rsrc_start = res->start; | ||
198 | hcd->rsrc_len = resource_size(res); | ||
199 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); | 190 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); |
200 | if (IS_ERR(hcd->regs)) { | 191 | if (IS_ERR(hcd->regs)) { |
201 | err = PTR_ERR(hcd->regs); | 192 | err = PTR_ERR(hcd->regs); |
202 | goto fail_io; | 193 | goto fail_io; |
203 | } | 194 | } |
204 | 195 | ||
196 | hcd->rsrc_start = res->start; | ||
197 | hcd->rsrc_len = resource_size(res); | ||
198 | |||
205 | irq = platform_get_irq(pdev, 0); | 199 | irq = platform_get_irq(pdev, 0); |
206 | if (!irq) { | 200 | if (!irq) { |
207 | dev_err(&pdev->dev, "Failed to get IRQ\n"); | 201 | dev_err(&pdev->dev, "Failed to get IRQ\n"); |
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 2d2ae8db439e..fb7bd0c7dc15 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c | |||
@@ -93,21 +93,15 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver, | |||
93 | } | 93 | } |
94 | 94 | ||
95 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 95 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
96 | if (!res) { | ||
97 | dev_err(&pdev->dev, | ||
98 | "Found HC with no register addr. Check %s setup!\n", | ||
99 | dev_name(&pdev->dev)); | ||
100 | retval = -ENODEV; | ||
101 | goto err2; | ||
102 | } | ||
103 | hcd->rsrc_start = res->start; | ||
104 | hcd->rsrc_len = resource_size(res); | ||
105 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); | 96 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); |
106 | if (IS_ERR(hcd->regs)) { | 97 | if (IS_ERR(hcd->regs)) { |
107 | retval = PTR_ERR(hcd->regs); | 98 | retval = PTR_ERR(hcd->regs); |
108 | goto err2; | 99 | goto err2; |
109 | } | 100 | } |
110 | 101 | ||
102 | hcd->rsrc_start = res->start; | ||
103 | hcd->rsrc_len = resource_size(res); | ||
104 | |||
111 | pdata->regs = hcd->regs; | 105 | pdata->regs = hcd->regs; |
112 | 106 | ||
113 | if (pdata->power_budget) | 107 | if (pdata->power_budget) |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 15feaf924b71..38bfeedae1d0 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -311,6 +311,7 @@ static void unlink_empty_async_suspended(struct ehci_hcd *ehci); | |||
311 | static void ehci_work(struct ehci_hcd *ehci); | 311 | static void ehci_work(struct ehci_hcd *ehci); |
312 | static void start_unlink_intr(struct ehci_hcd *ehci, struct ehci_qh *qh); | 312 | static void start_unlink_intr(struct ehci_hcd *ehci, struct ehci_qh *qh); |
313 | static void end_unlink_intr(struct ehci_hcd *ehci, struct ehci_qh *qh); | 313 | static void end_unlink_intr(struct ehci_hcd *ehci, struct ehci_qh *qh); |
314 | static int ehci_port_power(struct ehci_hcd *ehci, int portnum, bool enable); | ||
314 | 315 | ||
315 | #include "ehci-timer.c" | 316 | #include "ehci-timer.c" |
316 | #include "ehci-hub.c" | 317 | #include "ehci-hub.c" |
@@ -329,9 +330,13 @@ static void ehci_turn_off_all_ports(struct ehci_hcd *ehci) | |||
329 | { | 330 | { |
330 | int port = HCS_N_PORTS(ehci->hcs_params); | 331 | int port = HCS_N_PORTS(ehci->hcs_params); |
331 | 332 | ||
332 | while (port--) | 333 | while (port--) { |
333 | ehci_writel(ehci, PORT_RWC_BITS, | 334 | ehci_writel(ehci, PORT_RWC_BITS, |
334 | &ehci->regs->port_status[port]); | 335 | &ehci->regs->port_status[port]); |
336 | spin_unlock_irq(&ehci->lock); | ||
337 | ehci_port_power(ehci, port, false); | ||
338 | spin_lock_irq(&ehci->lock); | ||
339 | } | ||
335 | } | 340 | } |
336 | 341 | ||
337 | /* | 342 | /* |
@@ -1233,6 +1238,8 @@ void ehci_init_driver(struct hc_driver *drv, | |||
1233 | drv->hcd_priv_size += over->extra_priv_size; | 1238 | drv->hcd_priv_size += over->extra_priv_size; |
1234 | if (over->reset) | 1239 | if (over->reset) |
1235 | drv->reset = over->reset; | 1240 | drv->reset = over->reset; |
1241 | if (over->port_power) | ||
1242 | drv->port_power = over->port_power; | ||
1236 | } | 1243 | } |
1237 | } | 1244 | } |
1238 | EXPORT_SYMBOL_GPL(ehci_init_driver); | 1245 | EXPORT_SYMBOL_GPL(ehci_init_driver); |
@@ -1268,11 +1275,6 @@ MODULE_LICENSE ("GPL"); | |||
1268 | #define XILINX_OF_PLATFORM_DRIVER ehci_hcd_xilinx_of_driver | 1275 | #define XILINX_OF_PLATFORM_DRIVER ehci_hcd_xilinx_of_driver |
1269 | #endif | 1276 | #endif |
1270 | 1277 | ||
1271 | #ifdef CONFIG_USB_OCTEON_EHCI | ||
1272 | #include "ehci-octeon.c" | ||
1273 | #define PLATFORM_DRIVER ehci_octeon_driver | ||
1274 | #endif | ||
1275 | |||
1276 | #ifdef CONFIG_TILE_USB | 1278 | #ifdef CONFIG_TILE_USB |
1277 | #include "ehci-tilegx.c" | 1279 | #include "ehci-tilegx.c" |
1278 | #define PLATFORM_DRIVER ehci_hcd_tilegx_driver | 1280 | #define PLATFORM_DRIVER ehci_hcd_tilegx_driver |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 5728829cf6ef..118edb7bdca2 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -69,10 +69,8 @@ static void ehci_handover_companion_ports(struct ehci_hcd *ehci) | |||
69 | if (test_bit(port, &ehci->owned_ports)) { | 69 | if (test_bit(port, &ehci->owned_ports)) { |
70 | reg = &ehci->regs->port_status[port]; | 70 | reg = &ehci->regs->port_status[port]; |
71 | status = ehci_readl(ehci, reg) & ~PORT_RWC_BITS; | 71 | status = ehci_readl(ehci, reg) & ~PORT_RWC_BITS; |
72 | if (!(status & PORT_POWER)) { | 72 | if (!(status & PORT_POWER)) |
73 | status |= PORT_POWER; | 73 | ehci_port_power(ehci, port, true); |
74 | ehci_writel(ehci, status, reg); | ||
75 | } | ||
76 | } | 74 | } |
77 | } | 75 | } |
78 | 76 | ||
@@ -952,9 +950,11 @@ int ehci_hub_control( | |||
952 | clear_bit(wIndex, &ehci->port_c_suspend); | 950 | clear_bit(wIndex, &ehci->port_c_suspend); |
953 | break; | 951 | break; |
954 | case USB_PORT_FEAT_POWER: | 952 | case USB_PORT_FEAT_POWER: |
955 | if (HCS_PPC (ehci->hcs_params)) | 953 | if (HCS_PPC(ehci->hcs_params)) { |
956 | ehci_writel(ehci, temp & ~PORT_POWER, | 954 | spin_unlock_irqrestore(&ehci->lock, flags); |
957 | status_reg); | 955 | ehci_port_power(ehci, wIndex, false); |
956 | spin_lock_irqsave(&ehci->lock, flags); | ||
957 | } | ||
958 | break; | 958 | break; |
959 | case USB_PORT_FEAT_C_CONNECTION: | 959 | case USB_PORT_FEAT_C_CONNECTION: |
960 | ehci_writel(ehci, temp | PORT_CSC, status_reg); | 960 | ehci_writel(ehci, temp | PORT_CSC, status_reg); |
@@ -1004,9 +1004,9 @@ int ehci_hub_control( | |||
1004 | */ | 1004 | */ |
1005 | if (((temp & PORT_OC) || (ehci->need_oc_pp_cycle)) | 1005 | if (((temp & PORT_OC) || (ehci->need_oc_pp_cycle)) |
1006 | && HCS_PPC(ehci->hcs_params)) { | 1006 | && HCS_PPC(ehci->hcs_params)) { |
1007 | ehci_writel(ehci, | 1007 | spin_unlock_irqrestore(&ehci->lock, flags); |
1008 | temp & ~(PORT_RWC_BITS | PORT_POWER), | 1008 | ehci_port_power(ehci, wIndex, false); |
1009 | status_reg); | 1009 | spin_lock_irqsave(&ehci->lock, flags); |
1010 | temp = ehci_readl(ehci, status_reg); | 1010 | temp = ehci_readl(ehci, status_reg); |
1011 | } | 1011 | } |
1012 | } | 1012 | } |
@@ -1187,9 +1187,11 @@ int ehci_hub_control( | |||
1187 | set_bit(wIndex, &ehci->suspended_ports); | 1187 | set_bit(wIndex, &ehci->suspended_ports); |
1188 | break; | 1188 | break; |
1189 | case USB_PORT_FEAT_POWER: | 1189 | case USB_PORT_FEAT_POWER: |
1190 | if (HCS_PPC (ehci->hcs_params)) | 1190 | if (HCS_PPC(ehci->hcs_params)) { |
1191 | ehci_writel(ehci, temp | PORT_POWER, | 1191 | spin_unlock_irqrestore(&ehci->lock, flags); |
1192 | status_reg); | 1192 | ehci_port_power(ehci, wIndex, true); |
1193 | spin_lock_irqsave(&ehci->lock, flags); | ||
1194 | } | ||
1193 | break; | 1195 | break; |
1194 | case USB_PORT_FEAT_RESET: | 1196 | case USB_PORT_FEAT_RESET: |
1195 | if (temp & (PORT_SUSPEND|PORT_RESUME)) | 1197 | if (temp & (PORT_SUSPEND|PORT_RESUME)) |
@@ -1297,3 +1299,20 @@ static int ehci_port_handed_over(struct usb_hcd *hcd, int portnum) | |||
1297 | reg = &ehci->regs->port_status[portnum - 1]; | 1299 | reg = &ehci->regs->port_status[portnum - 1]; |
1298 | return ehci_readl(ehci, reg) & PORT_OWNER; | 1300 | return ehci_readl(ehci, reg) & PORT_OWNER; |
1299 | } | 1301 | } |
1302 | |||
1303 | static int ehci_port_power(struct ehci_hcd *ehci, int portnum, bool enable) | ||
1304 | { | ||
1305 | struct usb_hcd *hcd = ehci_to_hcd(ehci); | ||
1306 | u32 __iomem *status_reg = &ehci->regs->port_status[portnum]; | ||
1307 | u32 temp = ehci_readl(ehci, status_reg) & ~PORT_RWC_BITS; | ||
1308 | |||
1309 | if (enable) | ||
1310 | ehci_writel(ehci, temp | PORT_POWER, status_reg); | ||
1311 | else | ||
1312 | ehci_writel(ehci, temp & ~PORT_POWER, status_reg); | ||
1313 | |||
1314 | if (hcd->driver->port_power) | ||
1315 | hcd->driver->port_power(hcd, portnum, enable); | ||
1316 | |||
1317 | return 0; | ||
1318 | } | ||
diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c index 9dc2118ae808..9db74ca7e5b9 100644 --- a/drivers/usb/host/ehci-msm.c +++ b/drivers/usb/host/ehci-msm.c | |||
@@ -88,19 +88,13 @@ static int ehci_msm_probe(struct platform_device *pdev) | |||
88 | } | 88 | } |
89 | 89 | ||
90 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 90 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
91 | if (!res) { | ||
92 | dev_err(&pdev->dev, "Unable to get memory resource\n"); | ||
93 | ret = -ENODEV; | ||
94 | goto put_hcd; | ||
95 | } | ||
96 | |||
97 | hcd->rsrc_start = res->start; | ||
98 | hcd->rsrc_len = resource_size(res); | ||
99 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); | 91 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); |
100 | if (IS_ERR(hcd->regs)) { | 92 | if (IS_ERR(hcd->regs)) { |
101 | ret = PTR_ERR(hcd->regs); | 93 | ret = PTR_ERR(hcd->regs); |
102 | goto put_hcd; | 94 | goto put_hcd; |
103 | } | 95 | } |
96 | hcd->rsrc_start = res->start; | ||
97 | hcd->rsrc_len = resource_size(res); | ||
104 | 98 | ||
105 | /* | 99 | /* |
106 | * OTG driver takes care of PHY initialization, clock management, | 100 | * OTG driver takes care of PHY initialization, clock management, |
diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c index 08147c35f836..849806a75f1c 100644 --- a/drivers/usb/host/ehci-mv.c +++ b/drivers/usb/host/ehci-mv.c | |||
@@ -153,7 +153,6 @@ static int mv_ehci_probe(struct platform_device *pdev) | |||
153 | 153 | ||
154 | ehci_mv = devm_kzalloc(&pdev->dev, sizeof(*ehci_mv), GFP_KERNEL); | 154 | ehci_mv = devm_kzalloc(&pdev->dev, sizeof(*ehci_mv), GFP_KERNEL); |
155 | if (ehci_mv == NULL) { | 155 | if (ehci_mv == NULL) { |
156 | dev_err(&pdev->dev, "cannot allocate ehci_hcd_mv\n"); | ||
157 | retval = -ENOMEM; | 156 | retval = -ENOMEM; |
158 | goto err_put_hcd; | 157 | goto err_put_hcd; |
159 | } | 158 | } |
@@ -170,12 +169,6 @@ static int mv_ehci_probe(struct platform_device *pdev) | |||
170 | } | 169 | } |
171 | 170 | ||
172 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phyregs"); | 171 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phyregs"); |
173 | if (r == NULL) { | ||
174 | dev_err(&pdev->dev, "no phy I/O memory resource defined\n"); | ||
175 | retval = -ENODEV; | ||
176 | goto err_put_hcd; | ||
177 | } | ||
178 | |||
179 | ehci_mv->phy_regs = devm_ioremap_resource(&pdev->dev, r); | 172 | ehci_mv->phy_regs = devm_ioremap_resource(&pdev->dev, r); |
180 | if (IS_ERR(ehci_mv->phy_regs)) { | 173 | if (IS_ERR(ehci_mv->phy_regs)) { |
181 | retval = PTR_ERR(ehci_mv->phy_regs); | 174 | retval = PTR_ERR(ehci_mv->phy_regs); |
@@ -183,12 +176,6 @@ static int mv_ehci_probe(struct platform_device *pdev) | |||
183 | } | 176 | } |
184 | 177 | ||
185 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "capregs"); | 178 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "capregs"); |
186 | if (!r) { | ||
187 | dev_err(&pdev->dev, "no I/O memory resource defined\n"); | ||
188 | retval = -ENODEV; | ||
189 | goto err_put_hcd; | ||
190 | } | ||
191 | |||
192 | ehci_mv->cap_regs = devm_ioremap_resource(&pdev->dev, r); | 179 | ehci_mv->cap_regs = devm_ioremap_resource(&pdev->dev, r); |
193 | if (IS_ERR(ehci_mv->cap_regs)) { | 180 | if (IS_ERR(ehci_mv->cap_regs)) { |
194 | retval = PTR_ERR(ehci_mv->cap_regs); | 181 | retval = PTR_ERR(ehci_mv->cap_regs); |
diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c index dbe5e4eea08d..c7a9b31eeaef 100644 --- a/drivers/usb/host/ehci-mxc.c +++ b/drivers/usb/host/ehci-mxc.c | |||
@@ -69,20 +69,13 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) | |||
69 | return -ENOMEM; | 69 | return -ENOMEM; |
70 | 70 | ||
71 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 71 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
72 | if (!res) { | ||
73 | dev_err(dev, "Found HC with no register addr. Check setup!\n"); | ||
74 | ret = -ENODEV; | ||
75 | goto err_alloc; | ||
76 | } | ||
77 | |||
78 | hcd->rsrc_start = res->start; | ||
79 | hcd->rsrc_len = resource_size(res); | ||
80 | |||
81 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); | 72 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); |
82 | if (IS_ERR(hcd->regs)) { | 73 | if (IS_ERR(hcd->regs)) { |
83 | ret = PTR_ERR(hcd->regs); | 74 | ret = PTR_ERR(hcd->regs); |
84 | goto err_alloc; | 75 | goto err_alloc; |
85 | } | 76 | } |
77 | hcd->rsrc_start = res->start; | ||
78 | hcd->rsrc_len = resource_size(res); | ||
86 | 79 | ||
87 | hcd->has_tt = 1; | 80 | hcd->has_tt = 1; |
88 | ehci = hcd_to_ehci(hcd); | 81 | ehci = hcd_to_ehci(hcd); |
diff --git a/drivers/usb/host/ehci-octeon.c b/drivers/usb/host/ehci-octeon.c deleted file mode 100644 index 9051439039a7..000000000000 --- a/drivers/usb/host/ehci-octeon.c +++ /dev/null | |||
@@ -1,188 +0,0 @@ | |||
1 | /* | ||
2 | * EHCI HCD glue for Cavium Octeon II SOCs. | ||
3 | * | ||
4 | * Loosely based on ehci-au1xxx.c | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | * | ||
10 | * Copyright (C) 2010 Cavium Networks | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #include <linux/platform_device.h> | ||
15 | |||
16 | #include <asm/octeon/octeon.h> | ||
17 | #include <asm/octeon/cvmx-uctlx-defs.h> | ||
18 | |||
19 | #define OCTEON_EHCI_HCD_NAME "octeon-ehci" | ||
20 | |||
21 | /* Common clock init code. */ | ||
22 | void octeon2_usb_clocks_start(void); | ||
23 | void octeon2_usb_clocks_stop(void); | ||
24 | |||
25 | static void ehci_octeon_start(void) | ||
26 | { | ||
27 | union cvmx_uctlx_ehci_ctl ehci_ctl; | ||
28 | |||
29 | octeon2_usb_clocks_start(); | ||
30 | |||
31 | ehci_ctl.u64 = cvmx_read_csr(CVMX_UCTLX_EHCI_CTL(0)); | ||
32 | /* Use 64-bit addressing. */ | ||
33 | ehci_ctl.s.ehci_64b_addr_en = 1; | ||
34 | ehci_ctl.s.l2c_addr_msb = 0; | ||
35 | ehci_ctl.s.l2c_buff_emod = 1; /* Byte swapped. */ | ||
36 | ehci_ctl.s.l2c_desc_emod = 1; /* Byte swapped. */ | ||
37 | cvmx_write_csr(CVMX_UCTLX_EHCI_CTL(0), ehci_ctl.u64); | ||
38 | } | ||
39 | |||
40 | static void ehci_octeon_stop(void) | ||
41 | { | ||
42 | octeon2_usb_clocks_stop(); | ||
43 | } | ||
44 | |||
45 | static const struct hc_driver ehci_octeon_hc_driver = { | ||
46 | .description = hcd_name, | ||
47 | .product_desc = "Octeon EHCI", | ||
48 | .hcd_priv_size = sizeof(struct ehci_hcd), | ||
49 | |||
50 | /* | ||
51 | * generic hardware linkage | ||
52 | */ | ||
53 | .irq = ehci_irq, | ||
54 | .flags = HCD_MEMORY | HCD_USB2 | HCD_BH, | ||
55 | |||
56 | /* | ||
57 | * basic lifecycle operations | ||
58 | */ | ||
59 | .reset = ehci_setup, | ||
60 | .start = ehci_run, | ||
61 | .stop = ehci_stop, | ||
62 | .shutdown = ehci_shutdown, | ||
63 | |||
64 | /* | ||
65 | * managing i/o requests and associated device resources | ||
66 | */ | ||
67 | .urb_enqueue = ehci_urb_enqueue, | ||
68 | .urb_dequeue = ehci_urb_dequeue, | ||
69 | .endpoint_disable = ehci_endpoint_disable, | ||
70 | .endpoint_reset = ehci_endpoint_reset, | ||
71 | |||
72 | /* | ||
73 | * scheduling support | ||
74 | */ | ||
75 | .get_frame_number = ehci_get_frame, | ||
76 | |||
77 | /* | ||
78 | * root hub support | ||
79 | */ | ||
80 | .hub_status_data = ehci_hub_status_data, | ||
81 | .hub_control = ehci_hub_control, | ||
82 | .bus_suspend = ehci_bus_suspend, | ||
83 | .bus_resume = ehci_bus_resume, | ||
84 | .relinquish_port = ehci_relinquish_port, | ||
85 | .port_handed_over = ehci_port_handed_over, | ||
86 | |||
87 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | ||
88 | }; | ||
89 | |||
90 | static u64 ehci_octeon_dma_mask = DMA_BIT_MASK(64); | ||
91 | |||
92 | static int ehci_octeon_drv_probe(struct platform_device *pdev) | ||
93 | { | ||
94 | struct usb_hcd *hcd; | ||
95 | struct ehci_hcd *ehci; | ||
96 | struct resource *res_mem; | ||
97 | int irq; | ||
98 | int ret; | ||
99 | |||
100 | if (usb_disabled()) | ||
101 | return -ENODEV; | ||
102 | |||
103 | irq = platform_get_irq(pdev, 0); | ||
104 | if (irq < 0) { | ||
105 | dev_err(&pdev->dev, "No irq assigned\n"); | ||
106 | return -ENODEV; | ||
107 | } | ||
108 | |||
109 | res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
110 | if (res_mem == NULL) { | ||
111 | dev_err(&pdev->dev, "No register space assigned\n"); | ||
112 | return -ENODEV; | ||
113 | } | ||
114 | |||
115 | /* | ||
116 | * We can DMA from anywhere. But the descriptors must be in | ||
117 | * the lower 4GB. | ||
118 | */ | ||
119 | pdev->dev.dma_mask = &ehci_octeon_dma_mask; | ||
120 | ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); | ||
121 | if (ret) | ||
122 | return ret; | ||
123 | |||
124 | hcd = usb_create_hcd(&ehci_octeon_hc_driver, &pdev->dev, "octeon"); | ||
125 | if (!hcd) | ||
126 | return -ENOMEM; | ||
127 | |||
128 | hcd->rsrc_start = res_mem->start; | ||
129 | hcd->rsrc_len = resource_size(res_mem); | ||
130 | |||
131 | hcd->regs = devm_ioremap_resource(&pdev->dev, res_mem); | ||
132 | if (IS_ERR(hcd->regs)) { | ||
133 | ret = PTR_ERR(hcd->regs); | ||
134 | goto err1; | ||
135 | } | ||
136 | |||
137 | ehci_octeon_start(); | ||
138 | |||
139 | ehci = hcd_to_ehci(hcd); | ||
140 | |||
141 | /* Octeon EHCI matches CPU endianness. */ | ||
142 | #ifdef __BIG_ENDIAN | ||
143 | ehci->big_endian_mmio = 1; | ||
144 | #endif | ||
145 | |||
146 | ehci->caps = hcd->regs; | ||
147 | |||
148 | ret = usb_add_hcd(hcd, irq, IRQF_SHARED); | ||
149 | if (ret) { | ||
150 | dev_dbg(&pdev->dev, "failed to add hcd with err %d\n", ret); | ||
151 | goto err2; | ||
152 | } | ||
153 | device_wakeup_enable(hcd->self.controller); | ||
154 | |||
155 | platform_set_drvdata(pdev, hcd); | ||
156 | |||
157 | return 0; | ||
158 | err2: | ||
159 | ehci_octeon_stop(); | ||
160 | |||
161 | err1: | ||
162 | usb_put_hcd(hcd); | ||
163 | return ret; | ||
164 | } | ||
165 | |||
166 | static int ehci_octeon_drv_remove(struct platform_device *pdev) | ||
167 | { | ||
168 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | ||
169 | |||
170 | usb_remove_hcd(hcd); | ||
171 | |||
172 | ehci_octeon_stop(); | ||
173 | usb_put_hcd(hcd); | ||
174 | |||
175 | return 0; | ||
176 | } | ||
177 | |||
178 | static struct platform_driver ehci_octeon_driver = { | ||
179 | .probe = ehci_octeon_drv_probe, | ||
180 | .remove = ehci_octeon_drv_remove, | ||
181 | .shutdown = usb_hcd_platform_shutdown, | ||
182 | .driver = { | ||
183 | .name = OCTEON_EHCI_HCD_NAME, | ||
184 | .owner = THIS_MODULE, | ||
185 | } | ||
186 | }; | ||
187 | |||
188 | MODULE_ALIAS("platform:" OCTEON_EHCI_HCD_NAME); | ||
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c index 22e15cab8ea5..3c76489ea61a 100644 --- a/drivers/usb/host/ehci-orion.c +++ b/drivers/usb/host/ehci-orion.c | |||
@@ -25,8 +25,8 @@ | |||
25 | 25 | ||
26 | #include "ehci.h" | 26 | #include "ehci.h" |
27 | 27 | ||
28 | #define rdl(off) __raw_readl(hcd->regs + (off)) | 28 | #define rdl(off) readl_relaxed(hcd->regs + (off)) |
29 | #define wrl(off, val) __raw_writel((val), hcd->regs + (off)) | 29 | #define wrl(off, val) writel_relaxed((val), hcd->regs + (off)) |
30 | 30 | ||
31 | #define USB_CMD 0x140 | 31 | #define USB_CMD 0x140 |
32 | #define USB_MODE 0x1a8 | 32 | #define USB_MODE 0x1a8 |
@@ -175,15 +175,6 @@ static int ehci_orion_drv_probe(struct platform_device *pdev) | |||
175 | goto err; | 175 | goto err; |
176 | } | 176 | } |
177 | 177 | ||
178 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
179 | if (!res) { | ||
180 | dev_err(&pdev->dev, | ||
181 | "Found HC with no register addr. Check %s setup!\n", | ||
182 | dev_name(&pdev->dev)); | ||
183 | err = -ENODEV; | ||
184 | goto err; | ||
185 | } | ||
186 | |||
187 | /* | 178 | /* |
188 | * Right now device-tree probed devices don't get dma_mask | 179 | * Right now device-tree probed devices don't get dma_mask |
189 | * set. Since shared usb code relies on it, set it here for | 180 | * set. Since shared usb code relies on it, set it here for |
@@ -193,6 +184,7 @@ static int ehci_orion_drv_probe(struct platform_device *pdev) | |||
193 | if (err) | 184 | if (err) |
194 | goto err; | 185 | goto err; |
195 | 186 | ||
187 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
196 | regs = devm_ioremap_resource(&pdev->dev, res); | 188 | regs = devm_ioremap_resource(&pdev->dev, res); |
197 | if (IS_ERR(regs)) { | 189 | if (IS_ERR(regs)) { |
198 | err = PTR_ERR(regs); | 190 | err = PTR_ERR(regs); |
diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index 2f5b9ce3e042..35a9aeda0168 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c | |||
@@ -164,11 +164,6 @@ static int ehci_platform_probe(struct platform_device *dev) | |||
164 | dev_err(&dev->dev, "no irq provided"); | 164 | dev_err(&dev->dev, "no irq provided"); |
165 | return irq; | 165 | return irq; |
166 | } | 166 | } |
167 | res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0); | ||
168 | if (!res_mem) { | ||
169 | dev_err(&dev->dev, "no memory resource provided"); | ||
170 | return -ENXIO; | ||
171 | } | ||
172 | 167 | ||
173 | hcd = usb_create_hcd(&ehci_platform_hc_driver, &dev->dev, | 168 | hcd = usb_create_hcd(&ehci_platform_hc_driver, &dev->dev, |
174 | dev_name(&dev->dev)); | 169 | dev_name(&dev->dev)); |
@@ -250,14 +245,15 @@ static int ehci_platform_probe(struct platform_device *dev) | |||
250 | goto err_reset; | 245 | goto err_reset; |
251 | } | 246 | } |
252 | 247 | ||
253 | hcd->rsrc_start = res_mem->start; | 248 | res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0); |
254 | hcd->rsrc_len = resource_size(res_mem); | ||
255 | |||
256 | hcd->regs = devm_ioremap_resource(&dev->dev, res_mem); | 249 | hcd->regs = devm_ioremap_resource(&dev->dev, res_mem); |
257 | if (IS_ERR(hcd->regs)) { | 250 | if (IS_ERR(hcd->regs)) { |
258 | err = PTR_ERR(hcd->regs); | 251 | err = PTR_ERR(hcd->regs); |
259 | goto err_power; | 252 | goto err_power; |
260 | } | 253 | } |
254 | hcd->rsrc_start = res_mem->start; | ||
255 | hcd->rsrc_len = resource_size(res_mem); | ||
256 | |||
261 | err = usb_add_hcd(hcd, irq, IRQF_SHARED); | 257 | err = usb_add_hcd(hcd, irq, IRQF_SHARED); |
262 | if (err) | 258 | if (err) |
263 | goto err_power; | 259 | goto err_power; |
@@ -311,8 +307,7 @@ static int ehci_platform_remove(struct platform_device *dev) | |||
311 | return 0; | 307 | return 0; |
312 | } | 308 | } |
313 | 309 | ||
314 | #ifdef CONFIG_PM | 310 | #ifdef CONFIG_PM_SLEEP |
315 | |||
316 | static int ehci_platform_suspend(struct device *dev) | 311 | static int ehci_platform_suspend(struct device *dev) |
317 | { | 312 | { |
318 | struct usb_hcd *hcd = dev_get_drvdata(dev); | 313 | struct usb_hcd *hcd = dev_get_drvdata(dev); |
@@ -348,11 +343,7 @@ static int ehci_platform_resume(struct device *dev) | |||
348 | ehci_resume(hcd, false); | 343 | ehci_resume(hcd, false); |
349 | return 0; | 344 | return 0; |
350 | } | 345 | } |
351 | 346 | #endif /* CONFIG_PM_SLEEP */ | |
352 | #else /* !CONFIG_PM */ | ||
353 | #define ehci_platform_suspend NULL | ||
354 | #define ehci_platform_resume NULL | ||
355 | #endif /* CONFIG_PM */ | ||
356 | 347 | ||
357 | static const struct of_device_id vt8500_ehci_ids[] = { | 348 | static const struct of_device_id vt8500_ehci_ids[] = { |
358 | { .compatible = "via,vt8500-ehci", }, | 349 | { .compatible = "via,vt8500-ehci", }, |
@@ -368,10 +359,8 @@ static const struct platform_device_id ehci_platform_table[] = { | |||
368 | }; | 359 | }; |
369 | MODULE_DEVICE_TABLE(platform, ehci_platform_table); | 360 | MODULE_DEVICE_TABLE(platform, ehci_platform_table); |
370 | 361 | ||
371 | static const struct dev_pm_ops ehci_platform_pm_ops = { | 362 | static SIMPLE_DEV_PM_OPS(ehci_platform_pm_ops, ehci_platform_suspend, |
372 | .suspend = ehci_platform_suspend, | 363 | ehci_platform_resume); |
373 | .resume = ehci_platform_resume, | ||
374 | }; | ||
375 | 364 | ||
376 | static struct platform_driver ehci_platform_driver = { | 365 | static struct platform_driver ehci_platform_driver = { |
377 | .id_table = ehci_platform_table, | 366 | .id_table = ehci_platform_table, |
diff --git a/drivers/usb/host/ehci-sead3.c b/drivers/usb/host/ehci-sead3.c index cf1267673868..9b6e8d0eac43 100644 --- a/drivers/usb/host/ehci-sead3.c +++ b/drivers/usb/host/ehci-sead3.c | |||
@@ -110,14 +110,13 @@ static int ehci_hcd_sead3_drv_probe(struct platform_device *pdev) | |||
110 | return -ENOMEM; | 110 | return -ENOMEM; |
111 | 111 | ||
112 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 112 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
113 | hcd->rsrc_start = res->start; | ||
114 | hcd->rsrc_len = resource_size(res); | ||
115 | |||
116 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); | 113 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); |
117 | if (IS_ERR(hcd->regs)) { | 114 | if (IS_ERR(hcd->regs)) { |
118 | ret = PTR_ERR(hcd->regs); | 115 | ret = PTR_ERR(hcd->regs); |
119 | goto err1; | 116 | goto err1; |
120 | } | 117 | } |
118 | hcd->rsrc_start = res->start; | ||
119 | hcd->rsrc_len = resource_size(res); | ||
121 | 120 | ||
122 | /* Root hub has integrated TT. */ | 121 | /* Root hub has integrated TT. */ |
123 | hcd->has_tt = 1; | 122 | hcd->has_tt = 1; |
diff --git a/drivers/usb/host/ehci-sh.c b/drivers/usb/host/ehci-sh.c index 9b9b9f5b016e..0e0ce684aff3 100644 --- a/drivers/usb/host/ehci-sh.c +++ b/drivers/usb/host/ehci-sh.c | |||
@@ -86,15 +86,6 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev) | |||
86 | if (usb_disabled()) | 86 | if (usb_disabled()) |
87 | return -ENODEV; | 87 | return -ENODEV; |
88 | 88 | ||
89 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
90 | if (!res) { | ||
91 | dev_err(&pdev->dev, | ||
92 | "Found HC with no register addr. Check %s setup!\n", | ||
93 | dev_name(&pdev->dev)); | ||
94 | ret = -ENODEV; | ||
95 | goto fail_create_hcd; | ||
96 | } | ||
97 | |||
98 | irq = platform_get_irq(pdev, 0); | 89 | irq = platform_get_irq(pdev, 0); |
99 | if (irq <= 0) { | 90 | if (irq <= 0) { |
100 | dev_err(&pdev->dev, | 91 | dev_err(&pdev->dev, |
@@ -114,19 +105,18 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev) | |||
114 | goto fail_create_hcd; | 105 | goto fail_create_hcd; |
115 | } | 106 | } |
116 | 107 | ||
117 | hcd->rsrc_start = res->start; | 108 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
118 | hcd->rsrc_len = resource_size(res); | ||
119 | |||
120 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); | 109 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); |
121 | if (IS_ERR(hcd->regs)) { | 110 | if (IS_ERR(hcd->regs)) { |
122 | ret = PTR_ERR(hcd->regs); | 111 | ret = PTR_ERR(hcd->regs); |
123 | goto fail_request_resource; | 112 | goto fail_request_resource; |
124 | } | 113 | } |
114 | hcd->rsrc_start = res->start; | ||
115 | hcd->rsrc_len = resource_size(res); | ||
125 | 116 | ||
126 | priv = devm_kzalloc(&pdev->dev, sizeof(struct ehci_sh_priv), | 117 | priv = devm_kzalloc(&pdev->dev, sizeof(struct ehci_sh_priv), |
127 | GFP_KERNEL); | 118 | GFP_KERNEL); |
128 | if (!priv) { | 119 | if (!priv) { |
129 | dev_dbg(&pdev->dev, "error allocating priv data\n"); | ||
130 | ret = -ENOMEM; | 120 | ret = -ENOMEM; |
131 | goto fail_request_resource; | 121 | goto fail_request_resource; |
132 | } | 122 | } |
diff --git a/drivers/usb/host/ehci-spear.c b/drivers/usb/host/ehci-spear.c index 1355ff0946b9..34e14746b92e 100644 --- a/drivers/usb/host/ehci-spear.c +++ b/drivers/usb/host/ehci-spear.c | |||
@@ -99,18 +99,13 @@ static int spear_ehci_hcd_drv_probe(struct platform_device *pdev) | |||
99 | } | 99 | } |
100 | 100 | ||
101 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 101 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
102 | if (!res) { | ||
103 | retval = -ENODEV; | ||
104 | goto err_put_hcd; | ||
105 | } | ||
106 | |||
107 | hcd->rsrc_start = res->start; | ||
108 | hcd->rsrc_len = resource_size(res); | ||
109 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); | 102 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); |
110 | if (IS_ERR(hcd->regs)) { | 103 | if (IS_ERR(hcd->regs)) { |
111 | retval = PTR_ERR(hcd->regs); | 104 | retval = PTR_ERR(hcd->regs); |
112 | goto err_put_hcd; | 105 | goto err_put_hcd; |
113 | } | 106 | } |
107 | hcd->rsrc_start = res->start; | ||
108 | hcd->rsrc_len = resource_size(res); | ||
114 | 109 | ||
115 | sehci = to_spear_ehci(hcd); | 110 | sehci = to_spear_ehci(hcd); |
116 | sehci->clk = usbh_clk; | 111 | sehci->clk = usbh_clk; |
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index aaa01971efe9..19a9af1b4d74 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c | |||
@@ -460,18 +460,14 @@ static int tegra_ehci_probe(struct platform_device *pdev) | |||
460 | "nvidia,needs-double-reset"); | 460 | "nvidia,needs-double-reset"); |
461 | 461 | ||
462 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 462 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
463 | if (!res) { | ||
464 | dev_err(&pdev->dev, "Failed to get I/O memory\n"); | ||
465 | err = -ENXIO; | ||
466 | goto cleanup_clk_en; | ||
467 | } | ||
468 | hcd->rsrc_start = res->start; | ||
469 | hcd->rsrc_len = resource_size(res); | ||
470 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); | 463 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); |
471 | if (IS_ERR(hcd->regs)) { | 464 | if (IS_ERR(hcd->regs)) { |
472 | err = PTR_ERR(hcd->regs); | 465 | err = PTR_ERR(hcd->regs); |
473 | goto cleanup_clk_en; | 466 | goto cleanup_clk_en; |
474 | } | 467 | } |
468 | hcd->rsrc_start = res->start; | ||
469 | hcd->rsrc_len = resource_size(res); | ||
470 | |||
475 | ehci->caps = hcd->regs + 0x100; | 471 | ehci->caps = hcd->regs + 0x100; |
476 | ehci->has_hostpc = soc_config->has_hostpc; | 472 | ehci->has_hostpc = soc_config->has_hostpc; |
477 | 473 | ||
@@ -484,7 +480,6 @@ static int tegra_ehci_probe(struct platform_device *pdev) | |||
484 | u_phy->otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg), | 480 | u_phy->otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg), |
485 | GFP_KERNEL); | 481 | GFP_KERNEL); |
486 | if (!u_phy->otg) { | 482 | if (!u_phy->otg) { |
487 | dev_err(&pdev->dev, "Failed to alloc memory for otg\n"); | ||
488 | err = -ENOMEM; | 483 | err = -ENOMEM; |
489 | goto cleanup_phy; | 484 | goto cleanup_phy; |
490 | } | 485 | } |
diff --git a/drivers/usb/host/ehci-w90x900.c b/drivers/usb/host/ehci-w90x900.c index a9303aff125e..c305732e8634 100644 --- a/drivers/usb/host/ehci-w90x900.c +++ b/drivers/usb/host/ehci-w90x900.c | |||
@@ -42,27 +42,20 @@ static int usb_w90x900_probe(const struct hc_driver *driver, | |||
42 | int retval = 0, irq; | 42 | int retval = 0, irq; |
43 | unsigned long val; | 43 | unsigned long val; |
44 | 44 | ||
45 | |||
46 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
47 | if (!res) { | ||
48 | retval = -ENXIO; | ||
49 | goto err1; | ||
50 | } | ||
51 | |||
52 | hcd = usb_create_hcd(driver, &pdev->dev, "w90x900 EHCI"); | 45 | hcd = usb_create_hcd(driver, &pdev->dev, "w90x900 EHCI"); |
53 | if (!hcd) { | 46 | if (!hcd) { |
54 | retval = -ENOMEM; | 47 | retval = -ENOMEM; |
55 | goto err1; | 48 | goto err1; |
56 | } | 49 | } |
57 | 50 | ||
58 | hcd->rsrc_start = res->start; | 51 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
59 | hcd->rsrc_len = resource_size(res); | ||
60 | |||
61 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); | 52 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); |
62 | if (IS_ERR(hcd->regs)) { | 53 | if (IS_ERR(hcd->regs)) { |
63 | retval = PTR_ERR(hcd->regs); | 54 | retval = PTR_ERR(hcd->regs); |
64 | goto err2; | 55 | goto err2; |
65 | } | 56 | } |
57 | hcd->rsrc_start = res->start; | ||
58 | hcd->rsrc_len = resource_size(res); | ||
66 | 59 | ||
67 | ehci = hcd_to_ehci(hcd); | 60 | ehci = hcd_to_ehci(hcd); |
68 | ehci->caps = hcd->regs; | 61 | ehci->caps = hcd->regs; |
@@ -82,8 +75,10 @@ static int usb_w90x900_probe(const struct hc_driver *driver, | |||
82 | __raw_writel(val, ehci->regs+PHY1_CTR); | 75 | __raw_writel(val, ehci->regs+PHY1_CTR); |
83 | 76 | ||
84 | irq = platform_get_irq(pdev, 0); | 77 | irq = platform_get_irq(pdev, 0); |
85 | if (irq < 0) | 78 | if (irq < 0) { |
79 | retval = irq; | ||
86 | goto err2; | 80 | goto err2; |
81 | } | ||
87 | 82 | ||
88 | retval = usb_add_hcd(hcd, irq, IRQF_SHARED); | 83 | retval = usb_add_hcd(hcd, irq, IRQF_SHARED); |
89 | if (retval != 0) | 84 | if (retval != 0) |
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index eee228a26a0e..6f0577b0a5ae 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h | |||
@@ -859,6 +859,8 @@ static inline u32 hc32_to_cpup (const struct ehci_hcd *ehci, const __hc32 *x) | |||
859 | struct ehci_driver_overrides { | 859 | struct ehci_driver_overrides { |
860 | size_t extra_priv_size; | 860 | size_t extra_priv_size; |
861 | int (*reset)(struct usb_hcd *hcd); | 861 | int (*reset)(struct usb_hcd *hcd); |
862 | int (*port_power)(struct usb_hcd *hcd, | ||
863 | int portnum, bool enable); | ||
862 | }; | 864 | }; |
863 | 865 | ||
864 | extern void ehci_init_driver(struct hc_driver *drv, | 866 | extern void ehci_init_driver(struct hc_driver *drv, |
diff --git a/drivers/usb/host/fotg210.h b/drivers/usb/host/fotg210.h index ac6cd1bfd208..3bad17859cd7 100644 --- a/drivers/usb/host/fotg210.h +++ b/drivers/usb/host/fotg210.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef __LINUX_FOTG210_H | 1 | #ifndef __LINUX_FOTG210_H |
2 | #define __LINUX_FOTG210_H | 2 | #define __LINUX_FOTG210_H |
3 | 3 | ||
4 | #include <linux/usb/ehci-dbgp.h> | ||
5 | |||
4 | /* definitions used for the EHCI driver */ | 6 | /* definitions used for the EHCI driver */ |
5 | 7 | ||
6 | /* | 8 | /* |
@@ -84,7 +86,7 @@ struct fotg210_hcd { /* one per controller */ | |||
84 | /* glue to PCI and HCD framework */ | 86 | /* glue to PCI and HCD framework */ |
85 | struct fotg210_caps __iomem *caps; | 87 | struct fotg210_caps __iomem *caps; |
86 | struct fotg210_regs __iomem *regs; | 88 | struct fotg210_regs __iomem *regs; |
87 | struct fotg210_dbg_port __iomem *debug; | 89 | struct ehci_dbg_port __iomem *debug; |
88 | 90 | ||
89 | __u32 hcs_params; /* cached register copy */ | 91 | __u32 hcs_params; /* cached register copy */ |
90 | spinlock_t lock; | 92 | spinlock_t lock; |
@@ -293,64 +295,6 @@ struct fotg210_regs { | |||
293 | #define GMIR_MDEV_INT (1 << 0) | 295 | #define GMIR_MDEV_INT (1 << 0) |
294 | }; | 296 | }; |
295 | 297 | ||
296 | /* Appendix C, Debug port ... intended for use with special "debug devices" | ||
297 | * that can help if there's no serial console. (nonstandard enumeration.) | ||
298 | */ | ||
299 | struct fotg210_dbg_port { | ||
300 | u32 control; | ||
301 | #define DBGP_OWNER (1<<30) | ||
302 | #define DBGP_ENABLED (1<<28) | ||
303 | #define DBGP_DONE (1<<16) | ||
304 | #define DBGP_INUSE (1<<10) | ||
305 | #define DBGP_ERRCODE(x) (((x)>>7)&0x07) | ||
306 | # define DBGP_ERR_BAD 1 | ||
307 | # define DBGP_ERR_SIGNAL 2 | ||
308 | #define DBGP_ERROR (1<<6) | ||
309 | #define DBGP_GO (1<<5) | ||
310 | #define DBGP_OUT (1<<4) | ||
311 | #define DBGP_LEN(x) (((x)>>0)&0x0f) | ||
312 | u32 pids; | ||
313 | #define DBGP_PID_GET(x) (((x)>>16)&0xff) | ||
314 | #define DBGP_PID_SET(data, tok) (((data)<<8)|(tok)) | ||
315 | u32 data03; | ||
316 | u32 data47; | ||
317 | u32 address; | ||
318 | #define DBGP_EPADDR(dev, ep) (((dev)<<8)|(ep)) | ||
319 | }; | ||
320 | |||
321 | #ifdef CONFIG_EARLY_PRINTK_DBGP | ||
322 | #include <linux/init.h> | ||
323 | extern int __init early_dbgp_init(char *s); | ||
324 | extern struct console early_dbgp_console; | ||
325 | #endif /* CONFIG_EARLY_PRINTK_DBGP */ | ||
326 | |||
327 | struct usb_hcd; | ||
328 | |||
329 | static inline int xen_dbgp_reset_prep(struct usb_hcd *hcd) | ||
330 | { | ||
331 | return 1; /* Shouldn't this be 0? */ | ||
332 | } | ||
333 | |||
334 | static inline int xen_dbgp_external_startup(struct usb_hcd *hcd) | ||
335 | { | ||
336 | return -1; | ||
337 | } | ||
338 | |||
339 | #ifdef CONFIG_EARLY_PRINTK_DBGP | ||
340 | /* Call backs from fotg210 host driver to fotg210 debug driver */ | ||
341 | extern int dbgp_external_startup(struct usb_hcd *); | ||
342 | extern int dbgp_reset_prep(struct usb_hcd *hcd); | ||
343 | #else | ||
344 | static inline int dbgp_reset_prep(struct usb_hcd *hcd) | ||
345 | { | ||
346 | return xen_dbgp_reset_prep(hcd); | ||
347 | } | ||
348 | static inline int dbgp_external_startup(struct usb_hcd *hcd) | ||
349 | { | ||
350 | return xen_dbgp_external_startup(hcd); | ||
351 | } | ||
352 | #endif | ||
353 | |||
354 | /*-------------------------------------------------------------------------*/ | 298 | /*-------------------------------------------------------------------------*/ |
355 | 299 | ||
356 | #define QTD_NEXT(fotg210, dma) cpu_to_hc32(fotg210, (u32)dma) | 300 | #define QTD_NEXT(fotg210, dma) cpu_to_hc32(fotg210, (u32)dma) |
diff --git a/drivers/usb/host/fusbh200.h b/drivers/usb/host/fusbh200.h index 6b719e066c3f..d6e5b3d4aa68 100644 --- a/drivers/usb/host/fusbh200.h +++ b/drivers/usb/host/fusbh200.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef __LINUX_FUSBH200_H | 1 | #ifndef __LINUX_FUSBH200_H |
2 | #define __LINUX_FUSBH200_H | 2 | #define __LINUX_FUSBH200_H |
3 | 3 | ||
4 | #include <linux/usb/ehci-dbgp.h> | ||
5 | |||
4 | /* definitions used for the EHCI driver */ | 6 | /* definitions used for the EHCI driver */ |
5 | 7 | ||
6 | /* | 8 | /* |
@@ -84,7 +86,7 @@ struct fusbh200_hcd { /* one per controller */ | |||
84 | /* glue to PCI and HCD framework */ | 86 | /* glue to PCI and HCD framework */ |
85 | struct fusbh200_caps __iomem *caps; | 87 | struct fusbh200_caps __iomem *caps; |
86 | struct fusbh200_regs __iomem *regs; | 88 | struct fusbh200_regs __iomem *regs; |
87 | struct fusbh200_dbg_port __iomem *debug; | 89 | struct ehci_dbg_port __iomem *debug; |
88 | 90 | ||
89 | __u32 hcs_params; /* cached register copy */ | 91 | __u32 hcs_params; /* cached register copy */ |
90 | spinlock_t lock; | 92 | spinlock_t lock; |
@@ -285,64 +287,6 @@ struct fusbh200_regs { | |||
285 | #define BMIER_VBUS_ERR_EN (1<<0) | 287 | #define BMIER_VBUS_ERR_EN (1<<0) |
286 | }; | 288 | }; |
287 | 289 | ||
288 | /* Appendix C, Debug port ... intended for use with special "debug devices" | ||
289 | * that can help if there's no serial console. (nonstandard enumeration.) | ||
290 | */ | ||
291 | struct fusbh200_dbg_port { | ||
292 | u32 control; | ||
293 | #define DBGP_OWNER (1<<30) | ||
294 | #define DBGP_ENABLED (1<<28) | ||
295 | #define DBGP_DONE (1<<16) | ||
296 | #define DBGP_INUSE (1<<10) | ||
297 | #define DBGP_ERRCODE(x) (((x)>>7)&0x07) | ||
298 | # define DBGP_ERR_BAD 1 | ||
299 | # define DBGP_ERR_SIGNAL 2 | ||
300 | #define DBGP_ERROR (1<<6) | ||
301 | #define DBGP_GO (1<<5) | ||
302 | #define DBGP_OUT (1<<4) | ||
303 | #define DBGP_LEN(x) (((x)>>0)&0x0f) | ||
304 | u32 pids; | ||
305 | #define DBGP_PID_GET(x) (((x)>>16)&0xff) | ||
306 | #define DBGP_PID_SET(data, tok) (((data)<<8)|(tok)) | ||
307 | u32 data03; | ||
308 | u32 data47; | ||
309 | u32 address; | ||
310 | #define DBGP_EPADDR(dev, ep) (((dev)<<8)|(ep)) | ||
311 | }; | ||
312 | |||
313 | #ifdef CONFIG_EARLY_PRINTK_DBGP | ||
314 | #include <linux/init.h> | ||
315 | extern int __init early_dbgp_init(char *s); | ||
316 | extern struct console early_dbgp_console; | ||
317 | #endif /* CONFIG_EARLY_PRINTK_DBGP */ | ||
318 | |||
319 | struct usb_hcd; | ||
320 | |||
321 | static inline int xen_dbgp_reset_prep(struct usb_hcd *hcd) | ||
322 | { | ||
323 | return 1; /* Shouldn't this be 0? */ | ||
324 | } | ||
325 | |||
326 | static inline int xen_dbgp_external_startup(struct usb_hcd *hcd) | ||
327 | { | ||
328 | return -1; | ||
329 | } | ||
330 | |||
331 | #ifdef CONFIG_EARLY_PRINTK_DBGP | ||
332 | /* Call backs from fusbh200 host driver to fusbh200 debug driver */ | ||
333 | extern int dbgp_external_startup(struct usb_hcd *); | ||
334 | extern int dbgp_reset_prep(struct usb_hcd *hcd); | ||
335 | #else | ||
336 | static inline int dbgp_reset_prep(struct usb_hcd *hcd) | ||
337 | { | ||
338 | return xen_dbgp_reset_prep(hcd); | ||
339 | } | ||
340 | static inline int dbgp_external_startup(struct usb_hcd *hcd) | ||
341 | { | ||
342 | return xen_dbgp_external_startup(hcd); | ||
343 | } | ||
344 | #endif | ||
345 | |||
346 | /*-------------------------------------------------------------------------*/ | 290 | /*-------------------------------------------------------------------------*/ |
347 | 291 | ||
348 | #define QTD_NEXT(fusbh200, dma) cpu_to_hc32(fusbh200, (u32)dma) | 292 | #define QTD_NEXT(fusbh200, dma) cpu_to_hc32(fusbh200, (u32)dma) |
diff --git a/drivers/usb/host/hwa-hc.c b/drivers/usb/host/hwa-hc.c index d0d8fadf7066..1db0626c8bf4 100644 --- a/drivers/usb/host/hwa-hc.c +++ b/drivers/usb/host/hwa-hc.c | |||
@@ -607,7 +607,7 @@ found: | |||
607 | wa->wa_descr = wa_descr = (struct usb_wa_descriptor *) hdr; | 607 | wa->wa_descr = wa_descr = (struct usb_wa_descriptor *) hdr; |
608 | if (le16_to_cpu(wa_descr->bcdWAVersion) > 0x0100) | 608 | if (le16_to_cpu(wa_descr->bcdWAVersion) > 0x0100) |
609 | dev_warn(dev, "Wire Adapter v%d.%d newer than groked v1.0\n", | 609 | dev_warn(dev, "Wire Adapter v%d.%d newer than groked v1.0\n", |
610 | le16_to_cpu(wa_descr->bcdWAVersion) & 0xff00 >> 8, | 610 | (le16_to_cpu(wa_descr->bcdWAVersion) & 0xff00) >> 8, |
611 | le16_to_cpu(wa_descr->bcdWAVersion) & 0x00ff); | 611 | le16_to_cpu(wa_descr->bcdWAVersion) & 0x00ff); |
612 | result = 0; | 612 | result = 0; |
613 | error: | 613 | error: |
diff --git a/drivers/usb/host/imx21-hcd.c b/drivers/usb/host/imx21-hcd.c index 207bad99301f..eb4efba9f1ad 100644 --- a/drivers/usb/host/imx21-hcd.c +++ b/drivers/usb/host/imx21-hcd.c | |||
@@ -1174,11 +1174,11 @@ static int imx21_hc_urb_enqueue(struct usb_hcd *hcd, | |||
1174 | 1174 | ||
1175 | dev_vdbg(imx21->dev, | 1175 | dev_vdbg(imx21->dev, |
1176 | "enqueue urb=%p ep=%p len=%d " | 1176 | "enqueue urb=%p ep=%p len=%d " |
1177 | "buffer=%p dma=%08X setupBuf=%p setupDma=%08X\n", | 1177 | "buffer=%p dma=%pad setupBuf=%p setupDma=%pad\n", |
1178 | urb, ep, | 1178 | urb, ep, |
1179 | urb->transfer_buffer_length, | 1179 | urb->transfer_buffer_length, |
1180 | urb->transfer_buffer, urb->transfer_dma, | 1180 | urb->transfer_buffer, &urb->transfer_dma, |
1181 | urb->setup_packet, urb->setup_dma); | 1181 | urb->setup_packet, &urb->setup_dma); |
1182 | 1182 | ||
1183 | if (usb_pipeisoc(urb->pipe)) | 1183 | if (usb_pipeisoc(urb->pipe)) |
1184 | return imx21_hc_urb_enqueue_isoc(hcd, ep, urb, mem_flags); | 1184 | return imx21_hc_urb_enqueue_isoc(hcd, ep, urb, mem_flags); |
diff --git a/drivers/usb/host/octeon2-common.c b/drivers/usb/host/octeon2-common.c deleted file mode 100644 index d9df423f3d12..000000000000 --- a/drivers/usb/host/octeon2-common.c +++ /dev/null | |||
@@ -1,200 +0,0 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Copyright (C) 2010, 2011 Cavium Networks | ||
7 | */ | ||
8 | |||
9 | #include <linux/module.h> | ||
10 | #include <linux/mutex.h> | ||
11 | #include <linux/delay.h> | ||
12 | |||
13 | #include <asm/octeon/octeon.h> | ||
14 | #include <asm/octeon/cvmx-uctlx-defs.h> | ||
15 | |||
16 | static DEFINE_MUTEX(octeon2_usb_clocks_mutex); | ||
17 | |||
18 | static int octeon2_usb_clock_start_cnt; | ||
19 | |||
20 | void octeon2_usb_clocks_start(void) | ||
21 | { | ||
22 | u64 div; | ||
23 | union cvmx_uctlx_if_ena if_ena; | ||
24 | union cvmx_uctlx_clk_rst_ctl clk_rst_ctl; | ||
25 | union cvmx_uctlx_uphy_ctl_status uphy_ctl_status; | ||
26 | union cvmx_uctlx_uphy_portx_ctl_status port_ctl_status; | ||
27 | int i; | ||
28 | unsigned long io_clk_64_to_ns; | ||
29 | |||
30 | |||
31 | mutex_lock(&octeon2_usb_clocks_mutex); | ||
32 | |||
33 | octeon2_usb_clock_start_cnt++; | ||
34 | if (octeon2_usb_clock_start_cnt != 1) | ||
35 | goto exit; | ||
36 | |||
37 | io_clk_64_to_ns = 64000000000ull / octeon_get_io_clock_rate(); | ||
38 | |||
39 | /* | ||
40 | * Step 1: Wait for voltages stable. That surely happened | ||
41 | * before starting the kernel. | ||
42 | * | ||
43 | * Step 2: Enable SCLK of UCTL by writing UCTL0_IF_ENA[EN] = 1 | ||
44 | */ | ||
45 | if_ena.u64 = 0; | ||
46 | if_ena.s.en = 1; | ||
47 | cvmx_write_csr(CVMX_UCTLX_IF_ENA(0), if_ena.u64); | ||
48 | |||
49 | /* Step 3: Configure the reference clock, PHY, and HCLK */ | ||
50 | clk_rst_ctl.u64 = cvmx_read_csr(CVMX_UCTLX_CLK_RST_CTL(0)); | ||
51 | |||
52 | /* | ||
53 | * If the UCTL looks like it has already been started, skip | ||
54 | * the initialization, otherwise bus errors are obtained. | ||
55 | */ | ||
56 | if (clk_rst_ctl.s.hrst) | ||
57 | goto end_clock; | ||
58 | /* 3a */ | ||
59 | clk_rst_ctl.s.p_por = 1; | ||
60 | clk_rst_ctl.s.hrst = 0; | ||
61 | clk_rst_ctl.s.p_prst = 0; | ||
62 | clk_rst_ctl.s.h_clkdiv_rst = 0; | ||
63 | clk_rst_ctl.s.o_clkdiv_rst = 0; | ||
64 | clk_rst_ctl.s.h_clkdiv_en = 0; | ||
65 | clk_rst_ctl.s.o_clkdiv_en = 0; | ||
66 | cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk_rst_ctl.u64); | ||
67 | |||
68 | /* 3b */ | ||
69 | /* 12MHz crystal. */ | ||
70 | clk_rst_ctl.s.p_refclk_sel = 0; | ||
71 | clk_rst_ctl.s.p_refclk_div = 0; | ||
72 | cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk_rst_ctl.u64); | ||
73 | |||
74 | /* 3c */ | ||
75 | div = octeon_get_io_clock_rate() / 130000000ull; | ||
76 | |||
77 | switch (div) { | ||
78 | case 0: | ||
79 | div = 1; | ||
80 | break; | ||
81 | case 1: | ||
82 | case 2: | ||
83 | case 3: | ||
84 | case 4: | ||
85 | break; | ||
86 | case 5: | ||
87 | div = 4; | ||
88 | break; | ||
89 | case 6: | ||
90 | case 7: | ||
91 | div = 6; | ||
92 | break; | ||
93 | case 8: | ||
94 | case 9: | ||
95 | case 10: | ||
96 | case 11: | ||
97 | div = 8; | ||
98 | break; | ||
99 | default: | ||
100 | div = 12; | ||
101 | break; | ||
102 | } | ||
103 | clk_rst_ctl.s.h_div = div; | ||
104 | cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk_rst_ctl.u64); | ||
105 | /* Read it back, */ | ||
106 | clk_rst_ctl.u64 = cvmx_read_csr(CVMX_UCTLX_CLK_RST_CTL(0)); | ||
107 | clk_rst_ctl.s.h_clkdiv_en = 1; | ||
108 | cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk_rst_ctl.u64); | ||
109 | /* 3d */ | ||
110 | clk_rst_ctl.s.h_clkdiv_rst = 1; | ||
111 | cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk_rst_ctl.u64); | ||
112 | |||
113 | /* 3e: delay 64 io clocks */ | ||
114 | ndelay(io_clk_64_to_ns); | ||
115 | |||
116 | /* | ||
117 | * Step 4: Program the power-on reset field in the UCTL | ||
118 | * clock-reset-control register. | ||
119 | */ | ||
120 | clk_rst_ctl.s.p_por = 0; | ||
121 | cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk_rst_ctl.u64); | ||
122 | |||
123 | /* Step 5: Wait 1 ms for the PHY clock to start. */ | ||
124 | mdelay(1); | ||
125 | |||
126 | /* | ||
127 | * Step 6: Program the reset input from automatic test | ||
128 | * equipment field in the UPHY CSR | ||
129 | */ | ||
130 | uphy_ctl_status.u64 = cvmx_read_csr(CVMX_UCTLX_UPHY_CTL_STATUS(0)); | ||
131 | uphy_ctl_status.s.ate_reset = 1; | ||
132 | cvmx_write_csr(CVMX_UCTLX_UPHY_CTL_STATUS(0), uphy_ctl_status.u64); | ||
133 | |||
134 | /* Step 7: Wait for at least 10ns. */ | ||
135 | ndelay(10); | ||
136 | |||
137 | /* Step 8: Clear the ATE_RESET field in the UPHY CSR. */ | ||
138 | uphy_ctl_status.s.ate_reset = 0; | ||
139 | cvmx_write_csr(CVMX_UCTLX_UPHY_CTL_STATUS(0), uphy_ctl_status.u64); | ||
140 | |||
141 | /* | ||
142 | * Step 9: Wait for at least 20ns for UPHY to output PHY clock | ||
143 | * signals and OHCI_CLK48 | ||
144 | */ | ||
145 | ndelay(20); | ||
146 | |||
147 | /* Step 10: Configure the OHCI_CLK48 and OHCI_CLK12 clocks. */ | ||
148 | /* 10a */ | ||
149 | clk_rst_ctl.s.o_clkdiv_rst = 1; | ||
150 | cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk_rst_ctl.u64); | ||
151 | |||
152 | /* 10b */ | ||
153 | clk_rst_ctl.s.o_clkdiv_en = 1; | ||
154 | cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk_rst_ctl.u64); | ||
155 | |||
156 | /* 10c */ | ||
157 | ndelay(io_clk_64_to_ns); | ||
158 | |||
159 | /* | ||
160 | * Step 11: Program the PHY reset field: | ||
161 | * UCTL0_CLK_RST_CTL[P_PRST] = 1 | ||
162 | */ | ||
163 | clk_rst_ctl.s.p_prst = 1; | ||
164 | cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk_rst_ctl.u64); | ||
165 | |||
166 | /* Step 12: Wait 1 uS. */ | ||
167 | udelay(1); | ||
168 | |||
169 | /* Step 13: Program the HRESET_N field: UCTL0_CLK_RST_CTL[HRST] = 1 */ | ||
170 | clk_rst_ctl.s.hrst = 1; | ||
171 | cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk_rst_ctl.u64); | ||
172 | |||
173 | end_clock: | ||
174 | /* Now we can set some other registers. */ | ||
175 | |||
176 | for (i = 0; i <= 1; i++) { | ||
177 | port_ctl_status.u64 = | ||
178 | cvmx_read_csr(CVMX_UCTLX_UPHY_PORTX_CTL_STATUS(i, 0)); | ||
179 | /* Set txvreftune to 15 to obtain compliant 'eye' diagram. */ | ||
180 | port_ctl_status.s.txvreftune = 15; | ||
181 | port_ctl_status.s.txrisetune = 1; | ||
182 | port_ctl_status.s.txpreemphasistune = 1; | ||
183 | cvmx_write_csr(CVMX_UCTLX_UPHY_PORTX_CTL_STATUS(i, 0), | ||
184 | port_ctl_status.u64); | ||
185 | } | ||
186 | |||
187 | /* Set uSOF cycle period to 60,000 bits. */ | ||
188 | cvmx_write_csr(CVMX_UCTLX_EHCI_FLA(0), 0x20ull); | ||
189 | exit: | ||
190 | mutex_unlock(&octeon2_usb_clocks_mutex); | ||
191 | } | ||
192 | EXPORT_SYMBOL(octeon2_usb_clocks_start); | ||
193 | |||
194 | void octeon2_usb_clocks_stop(void) | ||
195 | { | ||
196 | mutex_lock(&octeon2_usb_clocks_mutex); | ||
197 | octeon2_usb_clock_start_cnt--; | ||
198 | mutex_unlock(&octeon2_usb_clocks_mutex); | ||
199 | } | ||
200 | EXPORT_SYMBOL(octeon2_usb_clocks_stop); | ||
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index e49eb4f90f5d..39406607e53a 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
@@ -24,12 +24,8 @@ | |||
24 | #include <linux/usb.h> | 24 | #include <linux/usb.h> |
25 | #include <linux/usb/hcd.h> | 25 | #include <linux/usb/hcd.h> |
26 | 26 | ||
27 | #include <mach/hardware.h> | ||
28 | #include <asm/gpio.h> | 27 | #include <asm/gpio.h> |
29 | 28 | ||
30 | #include <mach/cpu.h> | ||
31 | |||
32 | |||
33 | #include "ohci.h" | 29 | #include "ohci.h" |
34 | 30 | ||
35 | #define valid_port(index) ((index) >= 0 && (index) < AT91_MAX_USBH_PORTS) | 31 | #define valid_port(index) ((index) >= 0 && (index) < AT91_MAX_USBH_PORTS) |
@@ -137,12 +133,6 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, | |||
137 | struct resource *res; | 133 | struct resource *res; |
138 | int irq; | 134 | int irq; |
139 | 135 | ||
140 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
141 | if (!res) { | ||
142 | dev_dbg(dev, "hcd probe: missing memory resource\n"); | ||
143 | return -ENXIO; | ||
144 | } | ||
145 | |||
146 | irq = platform_get_irq(pdev, 0); | 136 | irq = platform_get_irq(pdev, 0); |
147 | if (irq < 0) { | 137 | if (irq < 0) { |
148 | dev_dbg(dev, "hcd probe: missing irq resource\n"); | 138 | dev_dbg(dev, "hcd probe: missing irq resource\n"); |
@@ -152,14 +142,15 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, | |||
152 | hcd = usb_create_hcd(driver, dev, "at91"); | 142 | hcd = usb_create_hcd(driver, dev, "at91"); |
153 | if (!hcd) | 143 | if (!hcd) |
154 | return -ENOMEM; | 144 | return -ENOMEM; |
155 | hcd->rsrc_start = res->start; | ||
156 | hcd->rsrc_len = resource_size(res); | ||
157 | 145 | ||
146 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
158 | hcd->regs = devm_ioremap_resource(dev, res); | 147 | hcd->regs = devm_ioremap_resource(dev, res); |
159 | if (IS_ERR(hcd->regs)) { | 148 | if (IS_ERR(hcd->regs)) { |
160 | retval = PTR_ERR(hcd->regs); | 149 | retval = PTR_ERR(hcd->regs); |
161 | goto err; | 150 | goto err; |
162 | } | 151 | } |
152 | hcd->rsrc_start = res->start; | ||
153 | hcd->rsrc_len = resource_size(res); | ||
163 | 154 | ||
164 | iclk = devm_clk_get(dev, "ohci_clk"); | 155 | iclk = devm_clk_get(dev, "ohci_clk"); |
165 | if (IS_ERR(iclk)) { | 156 | if (IS_ERR(iclk)) { |
diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index df06be6b47f5..1c76999b2184 100644 --- a/drivers/usb/host/ohci-da8xx.c +++ b/drivers/usb/host/ohci-da8xx.c | |||
@@ -313,16 +313,13 @@ static int usb_hcd_da8xx_probe(const struct hc_driver *driver, | |||
313 | return -ENOMEM; | 313 | return -ENOMEM; |
314 | 314 | ||
315 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 315 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
316 | if (!mem) | ||
317 | return -ENODEV; | ||
318 | hcd->rsrc_start = mem->start; | ||
319 | hcd->rsrc_len = resource_size(mem); | ||
320 | |||
321 | hcd->regs = devm_ioremap_resource(&pdev->dev, mem); | 316 | hcd->regs = devm_ioremap_resource(&pdev->dev, mem); |
322 | if (IS_ERR(hcd->regs)) { | 317 | if (IS_ERR(hcd->regs)) { |
323 | error = PTR_ERR(hcd->regs); | 318 | error = PTR_ERR(hcd->regs); |
324 | goto err; | 319 | goto err; |
325 | } | 320 | } |
321 | hcd->rsrc_start = mem->start; | ||
322 | hcd->rsrc_len = resource_size(mem); | ||
326 | 323 | ||
327 | ohci_hcd_init(hcd_to_ohci(hcd)); | 324 | ohci_hcd_init(hcd_to_ohci(hcd)); |
328 | 325 | ||
diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index d28b6583ba02..035a8a85a867 100644 --- a/drivers/usb/host/ohci-exynos.c +++ b/drivers/usb/host/ohci-exynos.c | |||
@@ -63,7 +63,6 @@ static int exynos_ohci_get_phy(struct device *dev, | |||
63 | 63 | ||
64 | phy = devm_of_phy_get(dev, child, NULL); | 64 | phy = devm_of_phy_get(dev, child, NULL); |
65 | exynos_ohci->phy[phy_number] = phy; | 65 | exynos_ohci->phy[phy_number] = phy; |
66 | of_node_put(child); | ||
67 | if (IS_ERR(phy)) { | 66 | if (IS_ERR(phy)) { |
68 | ret = PTR_ERR(phy); | 67 | ret = PTR_ERR(phy); |
69 | if (ret == -EPROBE_DEFER) { | 68 | if (ret == -EPROBE_DEFER) { |
@@ -156,19 +155,13 @@ skip_phy: | |||
156 | goto fail_clk; | 155 | goto fail_clk; |
157 | 156 | ||
158 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 157 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
159 | if (!res) { | ||
160 | dev_err(&pdev->dev, "Failed to get I/O memory\n"); | ||
161 | err = -ENXIO; | ||
162 | goto fail_io; | ||
163 | } | ||
164 | |||
165 | hcd->rsrc_start = res->start; | ||
166 | hcd->rsrc_len = resource_size(res); | ||
167 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); | 158 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); |
168 | if (IS_ERR(hcd->regs)) { | 159 | if (IS_ERR(hcd->regs)) { |
169 | err = PTR_ERR(hcd->regs); | 160 | err = PTR_ERR(hcd->regs); |
170 | goto fail_io; | 161 | goto fail_io; |
171 | } | 162 | } |
163 | hcd->rsrc_start = res->start; | ||
164 | hcd->rsrc_len = resource_size(res); | ||
172 | 165 | ||
173 | irq = platform_get_irq(pdev, 0); | 166 | irq = platform_get_irq(pdev, 0); |
174 | if (!irq) { | 167 | if (!irq) { |
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index d664edabf14e..1dab9dfbca6a 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -1249,11 +1249,6 @@ MODULE_LICENSE ("GPL"); | |||
1249 | #define PLATFORM_DRIVER ohci_hcd_jz4740_driver | 1249 | #define PLATFORM_DRIVER ohci_hcd_jz4740_driver |
1250 | #endif | 1250 | #endif |
1251 | 1251 | ||
1252 | #ifdef CONFIG_USB_OCTEON_OHCI | ||
1253 | #include "ohci-octeon.c" | ||
1254 | #define PLATFORM_DRIVER ohci_octeon_driver | ||
1255 | #endif | ||
1256 | |||
1257 | #ifdef CONFIG_TILE_USB | 1252 | #ifdef CONFIG_TILE_USB |
1258 | #include "ohci-tilegx.c" | 1253 | #include "ohci-tilegx.c" |
1259 | #define PLATFORM_DRIVER ohci_hcd_tilegx_driver | 1254 | #define PLATFORM_DRIVER ohci_hcd_tilegx_driver |
diff --git a/drivers/usb/host/ohci-jz4740.c b/drivers/usb/host/ohci-jz4740.c index c2c221a332eb..8ddd8f5470cb 100644 --- a/drivers/usb/host/ohci-jz4740.c +++ b/drivers/usb/host/ohci-jz4740.c | |||
@@ -153,13 +153,6 @@ static int jz4740_ohci_probe(struct platform_device *pdev) | |||
153 | struct resource *res; | 153 | struct resource *res; |
154 | int irq; | 154 | int irq; |
155 | 155 | ||
156 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
157 | |||
158 | if (!res) { | ||
159 | dev_err(&pdev->dev, "Failed to get platform resource\n"); | ||
160 | return -ENOENT; | ||
161 | } | ||
162 | |||
163 | irq = platform_get_irq(pdev, 0); | 156 | irq = platform_get_irq(pdev, 0); |
164 | if (irq < 0) { | 157 | if (irq < 0) { |
165 | dev_err(&pdev->dev, "Failed to get platform irq\n"); | 158 | dev_err(&pdev->dev, "Failed to get platform irq\n"); |
@@ -174,14 +167,14 @@ static int jz4740_ohci_probe(struct platform_device *pdev) | |||
174 | 167 | ||
175 | jz4740_ohci = hcd_to_jz4740_hcd(hcd); | 168 | jz4740_ohci = hcd_to_jz4740_hcd(hcd); |
176 | 169 | ||
177 | hcd->rsrc_start = res->start; | 170 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
178 | hcd->rsrc_len = resource_size(res); | ||
179 | |||
180 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); | 171 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); |
181 | if (IS_ERR(hcd->regs)) { | 172 | if (IS_ERR(hcd->regs)) { |
182 | ret = PTR_ERR(hcd->regs); | 173 | ret = PTR_ERR(hcd->regs); |
183 | goto err_free; | 174 | goto err_free; |
184 | } | 175 | } |
176 | hcd->rsrc_start = res->start; | ||
177 | hcd->rsrc_len = resource_size(res); | ||
185 | 178 | ||
186 | jz4740_ohci->clk = devm_clk_get(&pdev->dev, "uhc"); | 179 | jz4740_ohci->clk = devm_clk_get(&pdev->dev, "uhc"); |
187 | if (IS_ERR(jz4740_ohci->clk)) { | 180 | if (IS_ERR(jz4740_ohci->clk)) { |
diff --git a/drivers/usb/host/ohci-octeon.c b/drivers/usb/host/ohci-octeon.c deleted file mode 100644 index 15af8954085e..000000000000 --- a/drivers/usb/host/ohci-octeon.c +++ /dev/null | |||
@@ -1,202 +0,0 @@ | |||
1 | /* | ||
2 | * EHCI HCD glue for Cavium Octeon II SOCs. | ||
3 | * | ||
4 | * Loosely based on ehci-au1xxx.c | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | * | ||
10 | * Copyright (C) 2010 Cavium Networks | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #include <linux/platform_device.h> | ||
15 | |||
16 | #include <asm/octeon/octeon.h> | ||
17 | #include <asm/octeon/cvmx-uctlx-defs.h> | ||
18 | |||
19 | #define OCTEON_OHCI_HCD_NAME "octeon-ohci" | ||
20 | |||
21 | /* Common clock init code. */ | ||
22 | void octeon2_usb_clocks_start(void); | ||
23 | void octeon2_usb_clocks_stop(void); | ||
24 | |||
25 | static void ohci_octeon_hw_start(void) | ||
26 | { | ||
27 | union cvmx_uctlx_ohci_ctl ohci_ctl; | ||
28 | |||
29 | octeon2_usb_clocks_start(); | ||
30 | |||
31 | ohci_ctl.u64 = cvmx_read_csr(CVMX_UCTLX_OHCI_CTL(0)); | ||
32 | ohci_ctl.s.l2c_addr_msb = 0; | ||
33 | ohci_ctl.s.l2c_buff_emod = 1; /* Byte swapped. */ | ||
34 | ohci_ctl.s.l2c_desc_emod = 1; /* Byte swapped. */ | ||
35 | cvmx_write_csr(CVMX_UCTLX_OHCI_CTL(0), ohci_ctl.u64); | ||
36 | |||
37 | } | ||
38 | |||
39 | static void ohci_octeon_hw_stop(void) | ||
40 | { | ||
41 | /* Undo ohci_octeon_start() */ | ||
42 | octeon2_usb_clocks_stop(); | ||
43 | } | ||
44 | |||
45 | static int ohci_octeon_start(struct usb_hcd *hcd) | ||
46 | { | ||
47 | struct ohci_hcd *ohci = hcd_to_ohci(hcd); | ||
48 | int ret; | ||
49 | |||
50 | ret = ohci_init(ohci); | ||
51 | |||
52 | if (ret < 0) | ||
53 | return ret; | ||
54 | |||
55 | ret = ohci_run(ohci); | ||
56 | |||
57 | if (ret < 0) { | ||
58 | ohci_err(ohci, "can't start %s", hcd->self.bus_name); | ||
59 | ohci_stop(hcd); | ||
60 | return ret; | ||
61 | } | ||
62 | |||
63 | return 0; | ||
64 | } | ||
65 | |||
66 | static const struct hc_driver ohci_octeon_hc_driver = { | ||
67 | .description = hcd_name, | ||
68 | .product_desc = "Octeon OHCI", | ||
69 | .hcd_priv_size = sizeof(struct ohci_hcd), | ||
70 | |||
71 | /* | ||
72 | * generic hardware linkage | ||
73 | */ | ||
74 | .irq = ohci_irq, | ||
75 | .flags = HCD_USB11 | HCD_MEMORY, | ||
76 | |||
77 | /* | ||
78 | * basic lifecycle operations | ||
79 | */ | ||
80 | .start = ohci_octeon_start, | ||
81 | .stop = ohci_stop, | ||
82 | .shutdown = ohci_shutdown, | ||
83 | |||
84 | /* | ||
85 | * managing i/o requests and associated device resources | ||
86 | */ | ||
87 | .urb_enqueue = ohci_urb_enqueue, | ||
88 | .urb_dequeue = ohci_urb_dequeue, | ||
89 | .endpoint_disable = ohci_endpoint_disable, | ||
90 | |||
91 | /* | ||
92 | * scheduling support | ||
93 | */ | ||
94 | .get_frame_number = ohci_get_frame, | ||
95 | |||
96 | /* | ||
97 | * root hub support | ||
98 | */ | ||
99 | .hub_status_data = ohci_hub_status_data, | ||
100 | .hub_control = ohci_hub_control, | ||
101 | |||
102 | .start_port_reset = ohci_start_port_reset, | ||
103 | }; | ||
104 | |||
105 | static int ohci_octeon_drv_probe(struct platform_device *pdev) | ||
106 | { | ||
107 | struct usb_hcd *hcd; | ||
108 | struct ohci_hcd *ohci; | ||
109 | void *reg_base; | ||
110 | struct resource *res_mem; | ||
111 | int irq; | ||
112 | int ret; | ||
113 | |||
114 | if (usb_disabled()) | ||
115 | return -ENODEV; | ||
116 | |||
117 | irq = platform_get_irq(pdev, 0); | ||
118 | if (irq < 0) { | ||
119 | dev_err(&pdev->dev, "No irq assigned\n"); | ||
120 | return -ENODEV; | ||
121 | } | ||
122 | |||
123 | res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
124 | if (res_mem == NULL) { | ||
125 | dev_err(&pdev->dev, "No register space assigned\n"); | ||
126 | return -ENODEV; | ||
127 | } | ||
128 | |||
129 | /* Ohci is a 32-bit device. */ | ||
130 | ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); | ||
131 | if (ret) | ||
132 | return ret; | ||
133 | |||
134 | hcd = usb_create_hcd(&ohci_octeon_hc_driver, &pdev->dev, "octeon"); | ||
135 | if (!hcd) | ||
136 | return -ENOMEM; | ||
137 | |||
138 | hcd->rsrc_start = res_mem->start; | ||
139 | hcd->rsrc_len = resource_size(res_mem); | ||
140 | |||
141 | reg_base = devm_ioremap_resource(&pdev->dev, res_mem); | ||
142 | if (IS_ERR(reg_base)) { | ||
143 | ret = PTR_ERR(reg_base); | ||
144 | goto err1; | ||
145 | } | ||
146 | |||
147 | ohci_octeon_hw_start(); | ||
148 | |||
149 | hcd->regs = reg_base; | ||
150 | |||
151 | ohci = hcd_to_ohci(hcd); | ||
152 | |||
153 | /* Octeon OHCI matches CPU endianness. */ | ||
154 | #ifdef __BIG_ENDIAN | ||
155 | ohci->flags |= OHCI_QUIRK_BE_MMIO; | ||
156 | #endif | ||
157 | |||
158 | ohci_hcd_init(ohci); | ||
159 | |||
160 | ret = usb_add_hcd(hcd, irq, IRQF_SHARED); | ||
161 | if (ret) { | ||
162 | dev_dbg(&pdev->dev, "failed to add hcd with err %d\n", ret); | ||
163 | goto err2; | ||
164 | } | ||
165 | |||
166 | device_wakeup_enable(hcd->self.controller); | ||
167 | |||
168 | platform_set_drvdata(pdev, hcd); | ||
169 | |||
170 | return 0; | ||
171 | |||
172 | err2: | ||
173 | ohci_octeon_hw_stop(); | ||
174 | |||
175 | err1: | ||
176 | usb_put_hcd(hcd); | ||
177 | return ret; | ||
178 | } | ||
179 | |||
180 | static int ohci_octeon_drv_remove(struct platform_device *pdev) | ||
181 | { | ||
182 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | ||
183 | |||
184 | usb_remove_hcd(hcd); | ||
185 | |||
186 | ohci_octeon_hw_stop(); | ||
187 | usb_put_hcd(hcd); | ||
188 | |||
189 | return 0; | ||
190 | } | ||
191 | |||
192 | static struct platform_driver ohci_octeon_driver = { | ||
193 | .probe = ohci_octeon_drv_probe, | ||
194 | .remove = ohci_octeon_drv_remove, | ||
195 | .shutdown = usb_hcd_platform_shutdown, | ||
196 | .driver = { | ||
197 | .name = OCTEON_OHCI_HCD_NAME, | ||
198 | .owner = THIS_MODULE, | ||
199 | } | ||
200 | }; | ||
201 | |||
202 | MODULE_ALIAS("platform:" OCTEON_OHCI_HCD_NAME); | ||
diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c index 4369299064c7..9434c1d54495 100644 --- a/drivers/usb/host/ohci-platform.c +++ b/drivers/usb/host/ohci-platform.c | |||
@@ -43,20 +43,6 @@ struct ohci_platform_priv { | |||
43 | 43 | ||
44 | static const char hcd_name[] = "ohci-platform"; | 44 | static const char hcd_name[] = "ohci-platform"; |
45 | 45 | ||
46 | static int ohci_platform_reset(struct usb_hcd *hcd) | ||
47 | { | ||
48 | struct platform_device *pdev = to_platform_device(hcd->self.controller); | ||
49 | struct usb_ohci_pdata *pdata = dev_get_platdata(&pdev->dev); | ||
50 | struct ohci_hcd *ohci = hcd_to_ohci(hcd); | ||
51 | |||
52 | if (pdata->no_big_frame_no) | ||
53 | ohci->flags |= OHCI_QUIRK_FRAME_NO; | ||
54 | if (pdata->num_ports) | ||
55 | ohci->num_ports = pdata->num_ports; | ||
56 | |||
57 | return ohci_setup(hcd); | ||
58 | } | ||
59 | |||
60 | static int ohci_platform_power_on(struct platform_device *dev) | 46 | static int ohci_platform_power_on(struct platform_device *dev) |
61 | { | 47 | { |
62 | struct usb_hcd *hcd = platform_get_drvdata(dev); | 48 | struct usb_hcd *hcd = platform_get_drvdata(dev); |
@@ -110,7 +96,6 @@ static struct hc_driver __read_mostly ohci_platform_hc_driver; | |||
110 | 96 | ||
111 | static const struct ohci_driver_overrides platform_overrides __initconst = { | 97 | static const struct ohci_driver_overrides platform_overrides __initconst = { |
112 | .product_desc = "Generic Platform OHCI controller", | 98 | .product_desc = "Generic Platform OHCI controller", |
113 | .reset = ohci_platform_reset, | ||
114 | .extra_priv_size = sizeof(struct ohci_platform_priv), | 99 | .extra_priv_size = sizeof(struct ohci_platform_priv), |
115 | }; | 100 | }; |
116 | 101 | ||
@@ -149,12 +134,6 @@ static int ohci_platform_probe(struct platform_device *dev) | |||
149 | return irq; | 134 | return irq; |
150 | } | 135 | } |
151 | 136 | ||
152 | res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0); | ||
153 | if (!res_mem) { | ||
154 | dev_err(&dev->dev, "no memory resource provided"); | ||
155 | return -ENXIO; | ||
156 | } | ||
157 | |||
158 | hcd = usb_create_hcd(&ohci_platform_hc_driver, &dev->dev, | 137 | hcd = usb_create_hcd(&ohci_platform_hc_driver, &dev->dev, |
159 | dev_name(&dev->dev)); | 138 | dev_name(&dev->dev)); |
160 | if (!hcd) | 139 | if (!hcd) |
@@ -175,6 +154,12 @@ static int ohci_platform_probe(struct platform_device *dev) | |||
175 | if (of_property_read_bool(dev->dev.of_node, "big-endian")) | 154 | if (of_property_read_bool(dev->dev.of_node, "big-endian")) |
176 | ohci->flags |= OHCI_QUIRK_BE_MMIO | OHCI_QUIRK_BE_DESC; | 155 | ohci->flags |= OHCI_QUIRK_BE_MMIO | OHCI_QUIRK_BE_DESC; |
177 | 156 | ||
157 | if (of_property_read_bool(dev->dev.of_node, "no-big-frame-no")) | ||
158 | ohci->flags |= OHCI_QUIRK_FRAME_NO; | ||
159 | |||
160 | of_property_read_u32(dev->dev.of_node, "num-ports", | ||
161 | &ohci->num_ports); | ||
162 | |||
178 | priv->phy = devm_phy_get(&dev->dev, "usb"); | 163 | priv->phy = devm_phy_get(&dev->dev, "usb"); |
179 | if (IS_ERR(priv->phy)) { | 164 | if (IS_ERR(priv->phy)) { |
180 | err = PTR_ERR(priv->phy); | 165 | err = PTR_ERR(priv->phy); |
@@ -212,6 +197,10 @@ static int ohci_platform_probe(struct platform_device *dev) | |||
212 | ohci->flags |= OHCI_QUIRK_BE_DESC; | 197 | ohci->flags |= OHCI_QUIRK_BE_DESC; |
213 | if (pdata->big_endian_mmio) | 198 | if (pdata->big_endian_mmio) |
214 | ohci->flags |= OHCI_QUIRK_BE_MMIO; | 199 | ohci->flags |= OHCI_QUIRK_BE_MMIO; |
200 | if (pdata->no_big_frame_no) | ||
201 | ohci->flags |= OHCI_QUIRK_FRAME_NO; | ||
202 | if (pdata->num_ports) | ||
203 | ohci->num_ports = pdata->num_ports; | ||
215 | 204 | ||
216 | #ifndef CONFIG_USB_OHCI_BIG_ENDIAN_MMIO | 205 | #ifndef CONFIG_USB_OHCI_BIG_ENDIAN_MMIO |
217 | if (ohci->flags & OHCI_QUIRK_BE_MMIO) { | 206 | if (ohci->flags & OHCI_QUIRK_BE_MMIO) { |
@@ -236,14 +225,15 @@ static int ohci_platform_probe(struct platform_device *dev) | |||
236 | goto err_reset; | 225 | goto err_reset; |
237 | } | 226 | } |
238 | 227 | ||
239 | hcd->rsrc_start = res_mem->start; | 228 | res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0); |
240 | hcd->rsrc_len = resource_size(res_mem); | ||
241 | |||
242 | hcd->regs = devm_ioremap_resource(&dev->dev, res_mem); | 229 | hcd->regs = devm_ioremap_resource(&dev->dev, res_mem); |
243 | if (IS_ERR(hcd->regs)) { | 230 | if (IS_ERR(hcd->regs)) { |
244 | err = PTR_ERR(hcd->regs); | 231 | err = PTR_ERR(hcd->regs); |
245 | goto err_power; | 232 | goto err_power; |
246 | } | 233 | } |
234 | hcd->rsrc_start = res_mem->start; | ||
235 | hcd->rsrc_len = resource_size(res_mem); | ||
236 | |||
247 | err = usb_add_hcd(hcd, irq, IRQF_SHARED); | 237 | err = usb_add_hcd(hcd, irq, IRQF_SHARED); |
248 | if (err) | 238 | if (err) |
249 | goto err_power; | 239 | goto err_power; |
@@ -298,8 +288,7 @@ static int ohci_platform_remove(struct platform_device *dev) | |||
298 | return 0; | 288 | return 0; |
299 | } | 289 | } |
300 | 290 | ||
301 | #ifdef CONFIG_PM | 291 | #ifdef CONFIG_PM_SLEEP |
302 | |||
303 | static int ohci_platform_suspend(struct device *dev) | 292 | static int ohci_platform_suspend(struct device *dev) |
304 | { | 293 | { |
305 | struct usb_hcd *hcd = dev_get_drvdata(dev); | 294 | struct usb_hcd *hcd = dev_get_drvdata(dev); |
@@ -335,11 +324,7 @@ static int ohci_platform_resume(struct device *dev) | |||
335 | ohci_resume(hcd, false); | 324 | ohci_resume(hcd, false); |
336 | return 0; | 325 | return 0; |
337 | } | 326 | } |
338 | 327 | #endif /* CONFIG_PM_SLEEP */ | |
339 | #else /* !CONFIG_PM */ | ||
340 | #define ohci_platform_suspend NULL | ||
341 | #define ohci_platform_resume NULL | ||
342 | #endif /* CONFIG_PM */ | ||
343 | 328 | ||
344 | static const struct of_device_id ohci_platform_ids[] = { | 329 | static const struct of_device_id ohci_platform_ids[] = { |
345 | { .compatible = "generic-ohci", }, | 330 | { .compatible = "generic-ohci", }, |
@@ -353,10 +338,8 @@ static const struct platform_device_id ohci_platform_table[] = { | |||
353 | }; | 338 | }; |
354 | MODULE_DEVICE_TABLE(platform, ohci_platform_table); | 339 | MODULE_DEVICE_TABLE(platform, ohci_platform_table); |
355 | 340 | ||
356 | static const struct dev_pm_ops ohci_platform_pm_ops = { | 341 | static SIMPLE_DEV_PM_OPS(ohci_platform_pm_ops, ohci_platform_suspend, |
357 | .suspend = ohci_platform_suspend, | 342 | ohci_platform_resume); |
358 | .resume = ohci_platform_resume, | ||
359 | }; | ||
360 | 343 | ||
361 | static struct platform_driver ohci_platform_driver = { | 344 | static struct platform_driver ohci_platform_driver = { |
362 | .id_table = ohci_platform_table, | 345 | .id_table = ohci_platform_table, |
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index e68f3d02cd1a..13399814ef5f 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
@@ -447,20 +447,13 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device | |||
447 | return -ENOMEM; | 447 | return -ENOMEM; |
448 | 448 | ||
449 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 449 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
450 | if (!r) { | ||
451 | pr_err("no resource of IORESOURCE_MEM"); | ||
452 | retval = -ENXIO; | ||
453 | goto err; | ||
454 | } | ||
455 | |||
456 | hcd->rsrc_start = r->start; | ||
457 | hcd->rsrc_len = resource_size(r); | ||
458 | |||
459 | hcd->regs = devm_ioremap_resource(&pdev->dev, r); | 450 | hcd->regs = devm_ioremap_resource(&pdev->dev, r); |
460 | if (IS_ERR(hcd->regs)) { | 451 | if (IS_ERR(hcd->regs)) { |
461 | retval = PTR_ERR(hcd->regs); | 452 | retval = PTR_ERR(hcd->regs); |
462 | goto err; | 453 | goto err; |
463 | } | 454 | } |
455 | hcd->rsrc_start = r->start; | ||
456 | hcd->rsrc_len = resource_size(r); | ||
464 | 457 | ||
465 | /* initialize "struct pxa27x_ohci" */ | 458 | /* initialize "struct pxa27x_ohci" */ |
466 | pxa_ohci = to_pxa27x_ohci(hcd); | 459 | pxa_ohci = to_pxa27x_ohci(hcd); |
diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c index 8d5876692e7c..4a54f9d73136 100644 --- a/drivers/usb/host/ohci-spear.c +++ b/drivers/usb/host/ohci-spear.c | |||
@@ -74,20 +74,15 @@ static int spear_ohci_hcd_drv_probe(struct platform_device *pdev) | |||
74 | } | 74 | } |
75 | 75 | ||
76 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 76 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
77 | if (!res) { | ||
78 | retval = -ENODEV; | ||
79 | goto err_put_hcd; | ||
80 | } | ||
81 | |||
82 | hcd->rsrc_start = pdev->resource[0].start; | ||
83 | hcd->rsrc_len = resource_size(res); | ||
84 | |||
85 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); | 77 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); |
86 | if (IS_ERR(hcd->regs)) { | 78 | if (IS_ERR(hcd->regs)) { |
87 | retval = PTR_ERR(hcd->regs); | 79 | retval = PTR_ERR(hcd->regs); |
88 | goto err_put_hcd; | 80 | goto err_put_hcd; |
89 | } | 81 | } |
90 | 82 | ||
83 | hcd->rsrc_start = pdev->resource[0].start; | ||
84 | hcd->rsrc_len = resource_size(res); | ||
85 | |||
91 | sohci_p = to_spear_ohci(hcd); | 86 | sohci_p = to_spear_ohci(hcd); |
92 | sohci_p->clk = usbh_clk; | 87 | sohci_p->clk = usbh_clk; |
93 | 88 | ||
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h index 59f424567a8d..bc462288cfb0 100644 --- a/drivers/usb/host/ohci.h +++ b/drivers/usb/host/ohci.h | |||
@@ -647,23 +647,22 @@ static inline u32 hc32_to_cpup (const struct ohci_hcd *ohci, const __hc32 *x) | |||
647 | 647 | ||
648 | /*-------------------------------------------------------------------------*/ | 648 | /*-------------------------------------------------------------------------*/ |
649 | 649 | ||
650 | /* HCCA frame number is 16 bits, but is accessed as 32 bits since not all | 650 | /* |
651 | * hardware handles 16 bit reads. That creates a different confusion on | 651 | * The HCCA frame number is 16 bits, but is accessed as 32 bits since not all |
652 | * some big-endian SOC implementations. Same thing happens with PSW access. | 652 | * hardware handles 16 bit reads. Depending on the SoC implementation, the |
653 | * frame number can wind up in either bits [31:16] (default) or | ||
654 | * [15:0] (OHCI_QUIRK_FRAME_NO) on big endian hosts. | ||
655 | * | ||
656 | * Somewhat similarly, the 16-bit PSW fields in a transfer descriptor are | ||
657 | * reordered on BE. | ||
653 | */ | 658 | */ |
654 | 659 | ||
655 | #ifdef CONFIG_PPC_MPC52xx | ||
656 | #define big_endian_frame_no_quirk(ohci) (ohci->flags & OHCI_QUIRK_FRAME_NO) | ||
657 | #else | ||
658 | #define big_endian_frame_no_quirk(ohci) 0 | ||
659 | #endif | ||
660 | |||
661 | static inline u16 ohci_frame_no(const struct ohci_hcd *ohci) | 660 | static inline u16 ohci_frame_no(const struct ohci_hcd *ohci) |
662 | { | 661 | { |
663 | u32 tmp; | 662 | u32 tmp; |
664 | if (big_endian_desc(ohci)) { | 663 | if (big_endian_desc(ohci)) { |
665 | tmp = be32_to_cpup((__force __be32 *)&ohci->hcca->frame_no); | 664 | tmp = be32_to_cpup((__force __be32 *)&ohci->hcca->frame_no); |
666 | if (!big_endian_frame_no_quirk(ohci)) | 665 | if (!(ohci->flags & OHCI_QUIRK_FRAME_NO)) |
667 | tmp >>= 16; | 666 | tmp >>= 16; |
668 | } else | 667 | } else |
669 | tmp = le32_to_cpup((__force __le32 *)&ohci->hcca->frame_no); | 668 | tmp = le32_to_cpup((__force __le32 *)&ohci->hcca->frame_no); |
diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c index 4fe79a2d71a9..75811dd5a9d7 100644 --- a/drivers/usb/host/oxu210hp-hcd.c +++ b/drivers/usb/host/oxu210hp-hcd.c | |||
@@ -3846,7 +3846,6 @@ static int oxu_drv_probe(struct platform_device *pdev) | |||
3846 | */ | 3846 | */ |
3847 | info = devm_kzalloc(&pdev->dev, sizeof(struct oxu_info), GFP_KERNEL); | 3847 | info = devm_kzalloc(&pdev->dev, sizeof(struct oxu_info), GFP_KERNEL); |
3848 | if (!info) { | 3848 | if (!info) { |
3849 | dev_dbg(&pdev->dev, "error allocating memory\n"); | ||
3850 | ret = -EFAULT; | 3849 | ret = -EFAULT; |
3851 | goto error; | 3850 | goto error; |
3852 | } | 3851 | } |
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 2f3acebb577a..dd483c13565b 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c | |||
@@ -233,10 +233,8 @@ commit: | |||
233 | 233 | ||
234 | spin_unlock_irqrestore(&amd_lock, flags); | 234 | spin_unlock_irqrestore(&amd_lock, flags); |
235 | 235 | ||
236 | if (info.nb_dev) | 236 | pci_dev_put(info.nb_dev); |
237 | pci_dev_put(info.nb_dev); | 237 | pci_dev_put(info.smbus_dev); |
238 | if (info.smbus_dev) | ||
239 | pci_dev_put(info.smbus_dev); | ||
240 | 238 | ||
241 | } else { | 239 | } else { |
242 | /* no race - commit the result */ | 240 | /* no race - commit the result */ |
@@ -447,10 +445,8 @@ void usb_amd_dev_put(void) | |||
447 | 445 | ||
448 | spin_unlock_irqrestore(&amd_lock, flags); | 446 | spin_unlock_irqrestore(&amd_lock, flags); |
449 | 447 | ||
450 | if (nb) | 448 | pci_dev_put(nb); |
451 | pci_dev_put(nb); | 449 | pci_dev_put(smbus); |
452 | if (smbus) | ||
453 | pci_dev_put(smbus); | ||
454 | } | 450 | } |
455 | EXPORT_SYMBOL_GPL(usb_amd_dev_put); | 451 | EXPORT_SYMBOL_GPL(usb_amd_dev_put); |
456 | 452 | ||
diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c index b987f1d10058..cf8f46003f62 100644 --- a/drivers/usb/host/uhci-platform.c +++ b/drivers/usb/host/uhci-platform.c | |||
@@ -86,14 +86,14 @@ static int uhci_hcd_platform_probe(struct platform_device *pdev) | |||
86 | return -ENOMEM; | 86 | return -ENOMEM; |
87 | 87 | ||
88 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 88 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
89 | hcd->rsrc_start = res->start; | ||
90 | hcd->rsrc_len = resource_size(res); | ||
91 | |||
92 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); | 89 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); |
93 | if (IS_ERR(hcd->regs)) { | 90 | if (IS_ERR(hcd->regs)) { |
94 | ret = PTR_ERR(hcd->regs); | 91 | ret = PTR_ERR(hcd->regs); |
95 | goto err_rmr; | 92 | goto err_rmr; |
96 | } | 93 | } |
94 | hcd->rsrc_start = res->start; | ||
95 | hcd->rsrc_len = resource_size(res); | ||
96 | |||
97 | uhci = hcd_to_uhci(hcd); | 97 | uhci = hcd_to_uhci(hcd); |
98 | 98 | ||
99 | uhci->regs = hcd->regs; | 99 | uhci->regs = hcd->regs; |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 280dde93abe5..9a69b1f1b300 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -128,20 +128,6 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
128 | xhci->quirks |= XHCI_AVOID_BEI; | 128 | xhci->quirks |= XHCI_AVOID_BEI; |
129 | } | 129 | } |
130 | if (pdev->vendor == PCI_VENDOR_ID_INTEL && | 130 | if (pdev->vendor == PCI_VENDOR_ID_INTEL && |
131 | (pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_XHCI || | ||
132 | pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI)) { | ||
133 | /* Workaround for occasional spurious wakeups from S5 (or | ||
134 | * any other sleep) on Haswell machines with LPT and LPT-LP | ||
135 | * with the new Intel BIOS | ||
136 | */ | ||
137 | /* Limit the quirk to only known vendors, as this triggers | ||
138 | * yet another BIOS bug on some other machines | ||
139 | * https://bugzilla.kernel.org/show_bug.cgi?id=66171 | ||
140 | */ | ||
141 | if (pdev->subsystem_vendor == PCI_VENDOR_ID_HP) | ||
142 | xhci->quirks |= XHCI_SPURIOUS_WAKEUP; | ||
143 | } | ||
144 | if (pdev->vendor == PCI_VENDOR_ID_INTEL && | ||
145 | pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI) { | 131 | pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI) { |
146 | xhci->quirks |= XHCI_SPURIOUS_REBOOT; | 132 | xhci->quirks |= XHCI_SPURIOUS_REBOOT; |
147 | } | 133 | } |
@@ -162,6 +148,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
162 | pdev->device == 0x3432) | 148 | pdev->device == 0x3432) |
163 | xhci->quirks |= XHCI_BROKEN_STREAMS; | 149 | xhci->quirks |= XHCI_BROKEN_STREAMS; |
164 | 150 | ||
151 | if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && | ||
152 | pdev->device == 0x1042) | ||
153 | xhci->quirks |= XHCI_BROKEN_STREAMS; | ||
154 | |||
165 | if (xhci->quirks & XHCI_RESET_ON_RESUME) | 155 | if (xhci->quirks & XHCI_RESET_ON_RESUME) |
166 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | 156 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, |
167 | "QUIRK: Resetting on resume"); | 157 | "QUIRK: Resetting on resume"); |
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 3d78b0cd674b..e68b4ec1757b 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c | |||
@@ -83,9 +83,6 @@ static int xhci_plat_probe(struct platform_device *pdev) | |||
83 | if (irq < 0) | 83 | if (irq < 0) |
84 | return -ENODEV; | 84 | return -ENODEV; |
85 | 85 | ||
86 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
87 | if (!res) | ||
88 | return -ENODEV; | ||
89 | 86 | ||
90 | if (of_device_is_compatible(pdev->dev.of_node, | 87 | if (of_device_is_compatible(pdev->dev.of_node, |
91 | "marvell,armada-375-xhci") || | 88 | "marvell,armada-375-xhci") || |
@@ -109,15 +106,16 @@ static int xhci_plat_probe(struct platform_device *pdev) | |||
109 | if (!hcd) | 106 | if (!hcd) |
110 | return -ENOMEM; | 107 | return -ENOMEM; |
111 | 108 | ||
112 | hcd->rsrc_start = res->start; | 109 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
113 | hcd->rsrc_len = resource_size(res); | ||
114 | |||
115 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); | 110 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); |
116 | if (IS_ERR(hcd->regs)) { | 111 | if (IS_ERR(hcd->regs)) { |
117 | ret = PTR_ERR(hcd->regs); | 112 | ret = PTR_ERR(hcd->regs); |
118 | goto put_hcd; | 113 | goto put_hcd; |
119 | } | 114 | } |
120 | 115 | ||
116 | hcd->rsrc_start = res->start; | ||
117 | hcd->rsrc_len = resource_size(res); | ||
118 | |||
121 | /* | 119 | /* |
122 | * Not all platforms have a clk so it is not an error if the | 120 | * Not all platforms have a clk so it is not an error if the |
123 | * clock does not exists. | 121 | * clock does not exists. |
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c index 633caf643122..022dc0008f2a 100644 --- a/drivers/usb/misc/sisusbvga/sisusb.c +++ b/drivers/usb/misc/sisusbvga/sisusb.c | |||
@@ -2472,8 +2472,7 @@ sisusb_delete(struct kref *kref) | |||
2472 | if (!sisusb) | 2472 | if (!sisusb) |
2473 | return; | 2473 | return; |
2474 | 2474 | ||
2475 | if (sisusb->sisusb_dev) | 2475 | usb_put_dev(sisusb->sisusb_dev); |
2476 | usb_put_dev(sisusb->sisusb_dev); | ||
2477 | 2476 | ||
2478 | sisusb->sisusb_dev = NULL; | 2477 | sisusb->sisusb_dev = NULL; |
2479 | sisusb_free_buffers(sisusb); | 2478 | sisusb_free_buffers(sisusb); |
diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c index ae7e1206ca54..b9af8cb19215 100644 --- a/drivers/usb/misc/usb3503.c +++ b/drivers/usb/misc/usb3503.c | |||
@@ -314,10 +314,8 @@ static int usb3503_i2c_probe(struct i2c_client *i2c, | |||
314 | int err; | 314 | int err; |
315 | 315 | ||
316 | hub = devm_kzalloc(&i2c->dev, sizeof(struct usb3503), GFP_KERNEL); | 316 | hub = devm_kzalloc(&i2c->dev, sizeof(struct usb3503), GFP_KERNEL); |
317 | if (!hub) { | 317 | if (!hub) |
318 | dev_err(&i2c->dev, "private data alloc fail\n"); | ||
319 | return -ENOMEM; | 318 | return -ENOMEM; |
320 | } | ||
321 | 319 | ||
322 | i2c_set_clientdata(i2c, hub); | 320 | i2c_set_clientdata(i2c, hub); |
323 | hub->regmap = devm_regmap_init_i2c(i2c, &usb3503_regmap_config); | 321 | hub->regmap = devm_regmap_init_i2c(i2c, &usb3503_regmap_config); |
@@ -336,10 +334,8 @@ static int usb3503_platform_probe(struct platform_device *pdev) | |||
336 | struct usb3503 *hub; | 334 | struct usb3503 *hub; |
337 | 335 | ||
338 | hub = devm_kzalloc(&pdev->dev, sizeof(struct usb3503), GFP_KERNEL); | 336 | hub = devm_kzalloc(&pdev->dev, sizeof(struct usb3503), GFP_KERNEL); |
339 | if (!hub) { | 337 | if (!hub) |
340 | dev_err(&pdev->dev, "private data alloc fail\n"); | ||
341 | return -ENOMEM; | 338 | return -ENOMEM; |
342 | } | ||
343 | hub->dev = &pdev->dev; | 339 | hub->dev = &pdev->dev; |
344 | 340 | ||
345 | return usb3503_probe(hub); | 341 | return usb3503_probe(hub); |
diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c index c3a45da11610..343fa6ff9f4b 100644 --- a/drivers/usb/misc/yurex.c +++ b/drivers/usb/misc/yurex.c | |||
@@ -410,7 +410,8 @@ static int yurex_release(struct inode *inode, struct file *file) | |||
410 | return 0; | 410 | return 0; |
411 | } | 411 | } |
412 | 412 | ||
413 | static ssize_t yurex_read(struct file *file, char *buffer, size_t count, loff_t *ppos) | 413 | static ssize_t yurex_read(struct file *file, char __user *buffer, size_t count, |
414 | loff_t *ppos) | ||
414 | { | 415 | { |
415 | struct usb_yurex *dev; | 416 | struct usb_yurex *dev; |
416 | int retval = 0; | 417 | int retval = 0; |
@@ -444,7 +445,8 @@ exit: | |||
444 | return retval; | 445 | return retval; |
445 | } | 446 | } |
446 | 447 | ||
447 | static ssize_t yurex_write(struct file *file, const char *user_buffer, size_t count, loff_t *ppos) | 448 | static ssize_t yurex_write(struct file *file, const char __user *user_buffer, |
449 | size_t count, loff_t *ppos) | ||
448 | { | 450 | { |
449 | struct usb_yurex *dev; | 451 | struct usb_yurex *dev; |
450 | int i, set = 0, retval = 0; | 452 | int i, set = 0, retval = 0; |
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c index 3d2bd65df0fc..02c420af251e 100644 --- a/drivers/usb/serial/kobil_sct.c +++ b/drivers/usb/serial/kobil_sct.c | |||
@@ -335,7 +335,8 @@ static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
335 | port->interrupt_out_urb->transfer_buffer_length = length; | 335 | port->interrupt_out_urb->transfer_buffer_length = length; |
336 | 336 | ||
337 | priv->cur_pos = priv->cur_pos + length; | 337 | priv->cur_pos = priv->cur_pos + length; |
338 | result = usb_submit_urb(port->interrupt_out_urb, GFP_NOIO); | 338 | result = usb_submit_urb(port->interrupt_out_urb, |
339 | GFP_ATOMIC); | ||
339 | dev_dbg(&port->dev, "%s - Send write URB returns: %i\n", __func__, result); | 340 | dev_dbg(&port->dev, "%s - Send write URB returns: %i\n", __func__, result); |
340 | todo = priv->filled - priv->cur_pos; | 341 | todo = priv->filled - priv->cur_pos; |
341 | 342 | ||
@@ -350,7 +351,7 @@ static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
350 | if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID || | 351 | if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID || |
351 | priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) { | 352 | priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) { |
352 | result = usb_submit_urb(port->interrupt_in_urb, | 353 | result = usb_submit_urb(port->interrupt_in_urb, |
353 | GFP_NOIO); | 354 | GFP_ATOMIC); |
354 | dev_dbg(&port->dev, "%s - Send read URB returns: %i\n", __func__, result); | 355 | dev_dbg(&port->dev, "%s - Send read URB returns: %i\n", __func__, result); |
355 | } | 356 | } |
356 | } | 357 | } |
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c index 4856fb7e637e..4b7bfb394a32 100644 --- a/drivers/usb/serial/opticon.c +++ b/drivers/usb/serial/opticon.c | |||
@@ -215,7 +215,7 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
215 | 215 | ||
216 | /* The connected devices do not have a bulk write endpoint, | 216 | /* The connected devices do not have a bulk write endpoint, |
217 | * to transmit data to de barcode device the control endpoint is used */ | 217 | * to transmit data to de barcode device the control endpoint is used */ |
218 | dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_NOIO); | 218 | dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC); |
219 | if (!dr) { | 219 | if (!dr) { |
220 | count = -ENOMEM; | 220 | count = -ENOMEM; |
221 | goto error_no_dr; | 221 | goto error_no_dr; |
diff --git a/drivers/usb/storage/debug.c b/drivers/usb/storage/debug.c index e08f64780e30..05bc379b9e62 100644 --- a/drivers/usb/storage/debug.c +++ b/drivers/usb/storage/debug.c | |||
@@ -179,17 +179,14 @@ void usb_stor_show_sense(const struct us_data *us, | |||
179 | US_DEBUGPX("\n"); | 179 | US_DEBUGPX("\n"); |
180 | } | 180 | } |
181 | 181 | ||
182 | int usb_stor_dbg(const struct us_data *us, const char *fmt, ...) | 182 | void usb_stor_dbg(const struct us_data *us, const char *fmt, ...) |
183 | { | 183 | { |
184 | va_list args; | 184 | va_list args; |
185 | int r; | ||
186 | 185 | ||
187 | va_start(args, fmt); | 186 | va_start(args, fmt); |
188 | 187 | ||
189 | r = dev_vprintk_emit(7, &us->pusb_dev->dev, fmt, args); | 188 | dev_vprintk_emit(7, &us->pusb_dev->dev, fmt, args); |
190 | 189 | ||
191 | va_end(args); | 190 | va_end(args); |
192 | |||
193 | return r; | ||
194 | } | 191 | } |
195 | EXPORT_SYMBOL_GPL(usb_stor_dbg); | 192 | EXPORT_SYMBOL_GPL(usb_stor_dbg); |
diff --git a/drivers/usb/storage/debug.h b/drivers/usb/storage/debug.h index b1273f03e223..f52520306e1a 100644 --- a/drivers/usb/storage/debug.h +++ b/drivers/usb/storage/debug.h | |||
@@ -50,15 +50,17 @@ | |||
50 | void usb_stor_show_command(const struct us_data *us, struct scsi_cmnd *srb); | 50 | void usb_stor_show_command(const struct us_data *us, struct scsi_cmnd *srb); |
51 | void usb_stor_show_sense(const struct us_data *us, unsigned char key, | 51 | void usb_stor_show_sense(const struct us_data *us, unsigned char key, |
52 | unsigned char asc, unsigned char ascq); | 52 | unsigned char asc, unsigned char ascq); |
53 | __printf(2, 3) int usb_stor_dbg(const struct us_data *us, | 53 | __printf(2, 3) void usb_stor_dbg(const struct us_data *us, |
54 | const char *fmt, ...); | 54 | const char *fmt, ...); |
55 | 55 | ||
56 | #define US_DEBUGPX(fmt, ...) printk(fmt, ##__VA_ARGS__) | 56 | #define US_DEBUGPX(fmt, ...) printk(fmt, ##__VA_ARGS__) |
57 | #define US_DEBUG(x) x | 57 | #define US_DEBUG(x) x |
58 | #else | 58 | #else |
59 | __printf(2, 3) | 59 | __printf(2, 3) |
60 | static inline int _usb_stor_dbg(const struct us_data *us, | 60 | static inline void _usb_stor_dbg(const struct us_data *us, |
61 | const char *fmt, ...) {return 1;} | 61 | const char *fmt, ...) |
62 | { | ||
63 | } | ||
62 | #define usb_stor_dbg(us, fmt, ...) \ | 64 | #define usb_stor_dbg(us, fmt, ...) \ |
63 | do { if (0) _usb_stor_dbg(us, fmt, ##__VA_ARGS__); } while (0) | 65 | do { if (0) _usb_stor_dbg(us, fmt, ##__VA_ARGS__); } while (0) |
64 | #define US_DEBUGPX(fmt, ...) \ | 66 | #define US_DEBUGPX(fmt, ...) \ |
diff --git a/drivers/usb/storage/initializers.c b/drivers/usb/storage/initializers.c index 4bc2fc98636e..31fa2e92065b 100644 --- a/drivers/usb/storage/initializers.c +++ b/drivers/usb/storage/initializers.c | |||
@@ -49,10 +49,9 @@ int usb_stor_euscsi_init(struct us_data *us) | |||
49 | int result; | 49 | int result; |
50 | 50 | ||
51 | usb_stor_dbg(us, "Attempting to init eUSCSI bridge...\n"); | 51 | usb_stor_dbg(us, "Attempting to init eUSCSI bridge...\n"); |
52 | us->iobuf[0] = 0x1; | ||
53 | result = usb_stor_control_msg(us, us->send_ctrl_pipe, | 52 | result = usb_stor_control_msg(us, us->send_ctrl_pipe, |
54 | 0x0C, USB_RECIP_INTERFACE | USB_TYPE_VENDOR, | 53 | 0x0C, USB_RECIP_INTERFACE | USB_TYPE_VENDOR, |
55 | 0x01, 0x0, us->iobuf, 0x1, USB_CTRL_SET_TIMEOUT); | 54 | 0x01, 0x0, NULL, 0x0, 5 * HZ); |
56 | usb_stor_dbg(us, "-- result is %d\n", result); | 55 | usb_stor_dbg(us, "-- result is %d\n", result); |
57 | 56 | ||
58 | return 0; | 57 | return 0; |
@@ -100,7 +99,7 @@ int usb_stor_huawei_e220_init(struct us_data *us) | |||
100 | result = usb_stor_control_msg(us, us->send_ctrl_pipe, | 99 | result = usb_stor_control_msg(us, us->send_ctrl_pipe, |
101 | USB_REQ_SET_FEATURE, | 100 | USB_REQ_SET_FEATURE, |
102 | USB_TYPE_STANDARD | USB_RECIP_DEVICE, | 101 | USB_TYPE_STANDARD | USB_RECIP_DEVICE, |
103 | 0x01, 0x0, NULL, 0x0, 1000); | 102 | 0x01, 0x0, NULL, 0x0, 1 * HZ); |
104 | usb_stor_dbg(us, "Huawei mode set result is %d\n", result); | 103 | usb_stor_dbg(us, "Huawei mode set result is %d\n", result); |
105 | return 0; | 104 | return 0; |
106 | } | 105 | } |
diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c index 8591d89a38e6..27e4a580d2ed 100644 --- a/drivers/usb/storage/realtek_cr.c +++ b/drivers/usb/storage/realtek_cr.c | |||
@@ -626,6 +626,7 @@ static int config_autodelink_after_power_on(struct us_data *us) | |||
626 | return 0; | 626 | return 0; |
627 | } | 627 | } |
628 | 628 | ||
629 | #ifdef CONFIG_PM | ||
629 | static int config_autodelink_before_power_down(struct us_data *us) | 630 | static int config_autodelink_before_power_down(struct us_data *us) |
630 | { | 631 | { |
631 | struct rts51x_chip *chip = (struct rts51x_chip *)(us->extra); | 632 | struct rts51x_chip *chip = (struct rts51x_chip *)(us->extra); |
@@ -716,6 +717,7 @@ static void fw5895_init(struct us_data *us) | |||
716 | } | 717 | } |
717 | } | 718 | } |
718 | } | 719 | } |
720 | #endif | ||
719 | 721 | ||
720 | #ifdef CONFIG_REALTEK_AUTOPM | 722 | #ifdef CONFIG_REALTEK_AUTOPM |
721 | static void fw5895_set_mmc_wp(struct us_data *us) | 723 | static void fw5895_set_mmc_wp(struct us_data *us) |
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index 22c7d4360fa2..540add24a12f 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c | |||
@@ -1035,9 +1035,20 @@ int usb_stor_Bulk_max_lun(struct us_data *us) | |||
1035 | usb_stor_dbg(us, "GetMaxLUN command result is %d, data is %d\n", | 1035 | usb_stor_dbg(us, "GetMaxLUN command result is %d, data is %d\n", |
1036 | result, us->iobuf[0]); | 1036 | result, us->iobuf[0]); |
1037 | 1037 | ||
1038 | /* if we have a successful request, return the result */ | 1038 | /* |
1039 | if (result > 0) | 1039 | * If we have a successful request, return the result if valid. The |
1040 | return us->iobuf[0]; | 1040 | * CBW LUN field is 4 bits wide, so the value reported by the device |
1041 | * should fit into that. | ||
1042 | */ | ||
1043 | if (result > 0) { | ||
1044 | if (us->iobuf[0] < 16) { | ||
1045 | return us->iobuf[0]; | ||
1046 | } else { | ||
1047 | dev_info(&us->pusb_intf->dev, | ||
1048 | "Max LUN %d is not valid, using 0 instead", | ||
1049 | us->iobuf[0]); | ||
1050 | } | ||
1051 | } | ||
1041 | 1052 | ||
1042 | /* | 1053 | /* |
1043 | * Some devices don't like GetMaxLUN. They may STALL the control | 1054 | * Some devices don't like GetMaxLUN. They may STALL the control |
@@ -1118,6 +1129,31 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
1118 | */ | 1129 | */ |
1119 | if (result == USB_STOR_XFER_LONG) | 1130 | if (result == USB_STOR_XFER_LONG) |
1120 | fake_sense = 1; | 1131 | fake_sense = 1; |
1132 | |||
1133 | /* | ||
1134 | * Sometimes a device will mistakenly skip the data phase | ||
1135 | * and go directly to the status phase without sending a | ||
1136 | * zero-length packet. If we get a 13-byte response here, | ||
1137 | * check whether it really is a CSW. | ||
1138 | */ | ||
1139 | if (result == USB_STOR_XFER_SHORT && | ||
1140 | srb->sc_data_direction == DMA_FROM_DEVICE && | ||
1141 | transfer_length - scsi_get_resid(srb) == | ||
1142 | US_BULK_CS_WRAP_LEN) { | ||
1143 | struct scatterlist *sg = NULL; | ||
1144 | unsigned int offset = 0; | ||
1145 | |||
1146 | if (usb_stor_access_xfer_buf((unsigned char *) bcs, | ||
1147 | US_BULK_CS_WRAP_LEN, srb, &sg, | ||
1148 | &offset, FROM_XFER_BUF) == | ||
1149 | US_BULK_CS_WRAP_LEN && | ||
1150 | bcs->Signature == | ||
1151 | cpu_to_le32(US_BULK_CS_SIGN)) { | ||
1152 | usb_stor_dbg(us, "Device skipped data phase\n"); | ||
1153 | scsi_set_resid(srb, transfer_length); | ||
1154 | goto skipped_data_phase; | ||
1155 | } | ||
1156 | } | ||
1121 | } | 1157 | } |
1122 | 1158 | ||
1123 | /* See flow chart on pg 15 of the Bulk Only Transport spec for | 1159 | /* See flow chart on pg 15 of the Bulk Only Transport spec for |
@@ -1153,6 +1189,7 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
1153 | if (result != USB_STOR_XFER_GOOD) | 1189 | if (result != USB_STOR_XFER_GOOD) |
1154 | return USB_STOR_TRANSPORT_ERROR; | 1190 | return USB_STOR_TRANSPORT_ERROR; |
1155 | 1191 | ||
1192 | skipped_data_phase: | ||
1156 | /* check bulk status */ | 1193 | /* check bulk status */ |
1157 | residue = le32_to_cpu(bcs->Residue); | 1194 | residue = le32_to_cpu(bcs->Residue); |
1158 | usb_stor_dbg(us, "Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n", | 1195 | usb_stor_dbg(us, "Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n", |
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c index 89b24349269e..004ebc12bc21 100644 --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c | |||
@@ -66,7 +66,7 @@ enum { | |||
66 | /* Overrides scsi_pointer */ | 66 | /* Overrides scsi_pointer */ |
67 | struct uas_cmd_info { | 67 | struct uas_cmd_info { |
68 | unsigned int state; | 68 | unsigned int state; |
69 | unsigned int stream; | 69 | unsigned int uas_tag; |
70 | struct urb *cmd_urb; | 70 | struct urb *cmd_urb; |
71 | struct urb *data_in_urb; | 71 | struct urb *data_in_urb; |
72 | struct urb *data_out_urb; | 72 | struct urb *data_out_urb; |
@@ -173,30 +173,15 @@ static void uas_sense(struct urb *urb, struct scsi_cmnd *cmnd) | |||
173 | cmnd->result = sense_iu->status; | 173 | cmnd->result = sense_iu->status; |
174 | } | 174 | } |
175 | 175 | ||
176 | /* | ||
177 | * scsi-tags go from 0 - (nr_tags - 1), uas tags need to match stream-ids, | ||
178 | * which go from 1 - nr_streams. And we use 1 for untagged commands. | ||
179 | */ | ||
180 | static int uas_get_tag(struct scsi_cmnd *cmnd) | ||
181 | { | ||
182 | int tag; | ||
183 | |||
184 | if (blk_rq_tagged(cmnd->request)) | ||
185 | tag = cmnd->request->tag + 2; | ||
186 | else | ||
187 | tag = 1; | ||
188 | |||
189 | return tag; | ||
190 | } | ||
191 | |||
192 | static void uas_log_cmd_state(struct scsi_cmnd *cmnd, const char *prefix, | 176 | static void uas_log_cmd_state(struct scsi_cmnd *cmnd, const char *prefix, |
193 | int status) | 177 | int status) |
194 | { | 178 | { |
195 | struct uas_cmd_info *ci = (void *)&cmnd->SCp; | 179 | struct uas_cmd_info *ci = (void *)&cmnd->SCp; |
180 | struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; | ||
196 | 181 | ||
197 | scmd_printk(KERN_INFO, cmnd, | 182 | scmd_printk(KERN_INFO, cmnd, |
198 | "%s %d tag %d inflight:%s%s%s%s%s%s%s%s%s%s%s%s ", | 183 | "%s %d uas-tag %d inflight:%s%s%s%s%s%s%s%s%s%s%s%s ", |
199 | prefix, status, uas_get_tag(cmnd), | 184 | prefix, status, cmdinfo->uas_tag, |
200 | (ci->state & SUBMIT_STATUS_URB) ? " s-st" : "", | 185 | (ci->state & SUBMIT_STATUS_URB) ? " s-st" : "", |
201 | (ci->state & ALLOC_DATA_IN_URB) ? " a-in" : "", | 186 | (ci->state & ALLOC_DATA_IN_URB) ? " a-in" : "", |
202 | (ci->state & SUBMIT_DATA_IN_URB) ? " s-in" : "", | 187 | (ci->state & SUBMIT_DATA_IN_URB) ? " s-in" : "", |
@@ -242,7 +227,7 @@ static int uas_try_complete(struct scsi_cmnd *cmnd, const char *caller) | |||
242 | DATA_OUT_URB_INFLIGHT | | 227 | DATA_OUT_URB_INFLIGHT | |
243 | COMMAND_ABORTED)) | 228 | COMMAND_ABORTED)) |
244 | return -EBUSY; | 229 | return -EBUSY; |
245 | devinfo->cmnd[uas_get_tag(cmnd) - 1] = NULL; | 230 | devinfo->cmnd[cmdinfo->uas_tag - 1] = NULL; |
246 | uas_free_unsubmitted_urbs(cmnd); | 231 | uas_free_unsubmitted_urbs(cmnd); |
247 | cmnd->scsi_done(cmnd); | 232 | cmnd->scsi_done(cmnd); |
248 | return 0; | 233 | return 0; |
@@ -289,7 +274,7 @@ static void uas_stat_cmplt(struct urb *urb) | |||
289 | idx = be16_to_cpup(&iu->tag) - 1; | 274 | idx = be16_to_cpup(&iu->tag) - 1; |
290 | if (idx >= MAX_CMNDS || !devinfo->cmnd[idx]) { | 275 | if (idx >= MAX_CMNDS || !devinfo->cmnd[idx]) { |
291 | dev_err(&urb->dev->dev, | 276 | dev_err(&urb->dev->dev, |
292 | "stat urb: no pending cmd for tag %d\n", idx + 1); | 277 | "stat urb: no pending cmd for uas-tag %d\n", idx + 1); |
293 | goto out; | 278 | goto out; |
294 | } | 279 | } |
295 | 280 | ||
@@ -427,7 +412,8 @@ static struct urb *uas_alloc_data_urb(struct uas_dev_info *devinfo, gfp_t gfp, | |||
427 | goto out; | 412 | goto out; |
428 | usb_fill_bulk_urb(urb, udev, pipe, NULL, sdb->length, | 413 | usb_fill_bulk_urb(urb, udev, pipe, NULL, sdb->length, |
429 | uas_data_cmplt, cmnd); | 414 | uas_data_cmplt, cmnd); |
430 | urb->stream_id = cmdinfo->stream; | 415 | if (devinfo->use_streams) |
416 | urb->stream_id = cmdinfo->uas_tag; | ||
431 | urb->num_sgs = udev->bus->sg_tablesize ? sdb->table.nents : 0; | 417 | urb->num_sgs = udev->bus->sg_tablesize ? sdb->table.nents : 0; |
432 | urb->sg = sdb->table.sgl; | 418 | urb->sg = sdb->table.sgl; |
433 | out: | 419 | out: |
@@ -451,7 +437,8 @@ static struct urb *uas_alloc_sense_urb(struct uas_dev_info *devinfo, gfp_t gfp, | |||
451 | 437 | ||
452 | usb_fill_bulk_urb(urb, udev, devinfo->status_pipe, iu, sizeof(*iu), | 438 | usb_fill_bulk_urb(urb, udev, devinfo->status_pipe, iu, sizeof(*iu), |
453 | uas_stat_cmplt, cmnd->device->host); | 439 | uas_stat_cmplt, cmnd->device->host); |
454 | urb->stream_id = cmdinfo->stream; | 440 | if (devinfo->use_streams) |
441 | urb->stream_id = cmdinfo->uas_tag; | ||
455 | urb->transfer_flags |= URB_FREE_BUFFER; | 442 | urb->transfer_flags |= URB_FREE_BUFFER; |
456 | out: | 443 | out: |
457 | return urb; | 444 | return urb; |
@@ -465,6 +452,7 @@ static struct urb *uas_alloc_cmd_urb(struct uas_dev_info *devinfo, gfp_t gfp, | |||
465 | { | 452 | { |
466 | struct usb_device *udev = devinfo->udev; | 453 | struct usb_device *udev = devinfo->udev; |
467 | struct scsi_device *sdev = cmnd->device; | 454 | struct scsi_device *sdev = cmnd->device; |
455 | struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; | ||
468 | struct urb *urb = usb_alloc_urb(0, gfp); | 456 | struct urb *urb = usb_alloc_urb(0, gfp); |
469 | struct command_iu *iu; | 457 | struct command_iu *iu; |
470 | int len; | 458 | int len; |
@@ -481,7 +469,7 @@ static struct urb *uas_alloc_cmd_urb(struct uas_dev_info *devinfo, gfp_t gfp, | |||
481 | goto free; | 469 | goto free; |
482 | 470 | ||
483 | iu->iu_id = IU_ID_COMMAND; | 471 | iu->iu_id = IU_ID_COMMAND; |
484 | iu->tag = cpu_to_be16(uas_get_tag(cmnd)); | 472 | iu->tag = cpu_to_be16(cmdinfo->uas_tag); |
485 | iu->prio_attr = UAS_SIMPLE_TAG; | 473 | iu->prio_attr = UAS_SIMPLE_TAG; |
486 | iu->len = len; | 474 | iu->len = len; |
487 | int_to_scsilun(sdev->lun, &iu->lun); | 475 | int_to_scsilun(sdev->lun, &iu->lun); |
@@ -608,8 +596,7 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd, | |||
608 | struct uas_dev_info *devinfo = sdev->hostdata; | 596 | struct uas_dev_info *devinfo = sdev->hostdata; |
609 | struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; | 597 | struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; |
610 | unsigned long flags; | 598 | unsigned long flags; |
611 | unsigned int stream; | 599 | int idx, err; |
612 | int err; | ||
613 | 600 | ||
614 | BUILD_BUG_ON(sizeof(struct uas_cmd_info) > sizeof(struct scsi_pointer)); | 601 | BUILD_BUG_ON(sizeof(struct uas_cmd_info) > sizeof(struct scsi_pointer)); |
615 | 602 | ||
@@ -635,8 +622,12 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd, | |||
635 | return 0; | 622 | return 0; |
636 | } | 623 | } |
637 | 624 | ||
638 | stream = uas_get_tag(cmnd); | 625 | /* Find a free uas-tag */ |
639 | if (devinfo->cmnd[stream - 1]) { | 626 | for (idx = 0; idx < devinfo->qdepth; idx++) { |
627 | if (!devinfo->cmnd[idx]) | ||
628 | break; | ||
629 | } | ||
630 | if (idx == devinfo->qdepth) { | ||
640 | spin_unlock_irqrestore(&devinfo->lock, flags); | 631 | spin_unlock_irqrestore(&devinfo->lock, flags); |
641 | return SCSI_MLQUEUE_DEVICE_BUSY; | 632 | return SCSI_MLQUEUE_DEVICE_BUSY; |
642 | } | 633 | } |
@@ -644,7 +635,7 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd, | |||
644 | cmnd->scsi_done = done; | 635 | cmnd->scsi_done = done; |
645 | 636 | ||
646 | memset(cmdinfo, 0, sizeof(*cmdinfo)); | 637 | memset(cmdinfo, 0, sizeof(*cmdinfo)); |
647 | cmdinfo->stream = stream; | 638 | cmdinfo->uas_tag = idx + 1; /* uas-tag == usb-stream-id, so 1 based */ |
648 | cmdinfo->state = SUBMIT_STATUS_URB | ALLOC_CMD_URB | SUBMIT_CMD_URB; | 639 | cmdinfo->state = SUBMIT_STATUS_URB | ALLOC_CMD_URB | SUBMIT_CMD_URB; |
649 | 640 | ||
650 | switch (cmnd->sc_data_direction) { | 641 | switch (cmnd->sc_data_direction) { |
@@ -659,10 +650,8 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd, | |||
659 | break; | 650 | break; |
660 | } | 651 | } |
661 | 652 | ||
662 | if (!devinfo->use_streams) { | 653 | if (!devinfo->use_streams) |
663 | cmdinfo->state &= ~(SUBMIT_DATA_IN_URB | SUBMIT_DATA_OUT_URB); | 654 | cmdinfo->state &= ~(SUBMIT_DATA_IN_URB | SUBMIT_DATA_OUT_URB); |
664 | cmdinfo->stream = 0; | ||
665 | } | ||
666 | 655 | ||
667 | err = uas_submit_urbs(cmnd, devinfo, GFP_ATOMIC); | 656 | err = uas_submit_urbs(cmnd, devinfo, GFP_ATOMIC); |
668 | if (err) { | 657 | if (err) { |
@@ -674,7 +663,7 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd, | |||
674 | uas_add_work(cmdinfo); | 663 | uas_add_work(cmdinfo); |
675 | } | 664 | } |
676 | 665 | ||
677 | devinfo->cmnd[stream - 1] = cmnd; | 666 | devinfo->cmnd[idx] = cmnd; |
678 | spin_unlock_irqrestore(&devinfo->lock, flags); | 667 | spin_unlock_irqrestore(&devinfo->lock, flags); |
679 | return 0; | 668 | return 0; |
680 | } | 669 | } |
@@ -702,7 +691,7 @@ static int uas_eh_abort_handler(struct scsi_cmnd *cmnd) | |||
702 | cmdinfo->state |= COMMAND_ABORTED; | 691 | cmdinfo->state |= COMMAND_ABORTED; |
703 | 692 | ||
704 | /* Drop all refs to this cmnd, kill data urbs to break their ref */ | 693 | /* Drop all refs to this cmnd, kill data urbs to break their ref */ |
705 | devinfo->cmnd[uas_get_tag(cmnd) - 1] = NULL; | 694 | devinfo->cmnd[cmdinfo->uas_tag - 1] = NULL; |
706 | if (cmdinfo->state & DATA_IN_URB_INFLIGHT) | 695 | if (cmdinfo->state & DATA_IN_URB_INFLIGHT) |
707 | data_in_urb = usb_get_urb(cmdinfo->data_in_urb); | 696 | data_in_urb = usb_get_urb(cmdinfo->data_in_urb); |
708 | if (cmdinfo->state & DATA_OUT_URB_INFLIGHT) | 697 | if (cmdinfo->state & DATA_OUT_URB_INFLIGHT) |
@@ -818,13 +807,6 @@ static struct scsi_host_template uas_host_template = { | |||
818 | .cmd_per_lun = 1, /* until we override it */ | 807 | .cmd_per_lun = 1, /* until we override it */ |
819 | .skip_settle_delay = 1, | 808 | .skip_settle_delay = 1, |
820 | .ordered_tag = 1, | 809 | .ordered_tag = 1, |
821 | |||
822 | /* | ||
823 | * The uas drivers expects tags not to be bigger than the maximum | ||
824 | * per-device queue depth, which is not true with the blk-mq tag | ||
825 | * allocator. | ||
826 | */ | ||
827 | .disable_blk_mq = true, | ||
828 | }; | 810 | }; |
829 | 811 | ||
830 | #define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \ | 812 | #define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \ |
diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h index 8511b54a65d9..2fefaf923e4a 100644 --- a/drivers/usb/storage/unusual_uas.h +++ b/drivers/usb/storage/unusual_uas.h | |||
@@ -54,6 +54,20 @@ UNUSUAL_DEV(0x0bc2, 0x3312, 0x0000, 0x9999, | |||
54 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 54 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
55 | US_FL_NO_ATA_1X), | 55 | US_FL_NO_ATA_1X), |
56 | 56 | ||
57 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ | ||
58 | UNUSUAL_DEV(0x0bc2, 0x3320, 0x0000, 0x9999, | ||
59 | "Seagate", | ||
60 | "Expansion Desk", | ||
61 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
62 | US_FL_NO_ATA_1X), | ||
63 | |||
64 | /* Reported-by: Bogdan Mihalcea <bogdan.mihalcea@infim.ro> */ | ||
65 | UNUSUAL_DEV(0x0bc2, 0xa003, 0x0000, 0x9999, | ||
66 | "Seagate", | ||
67 | "Backup Plus", | ||
68 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
69 | US_FL_NO_ATA_1X), | ||
70 | |||
57 | /* https://bbs.archlinux.org/viewtopic.php?id=183190 */ | 71 | /* https://bbs.archlinux.org/viewtopic.php?id=183190 */ |
58 | UNUSUAL_DEV(0x0bc2, 0xab20, 0x0000, 0x9999, | 72 | UNUSUAL_DEV(0x0bc2, 0xab20, 0x0000, 0x9999, |
59 | "Seagate", | 73 | "Seagate", |
@@ -61,6 +75,13 @@ UNUSUAL_DEV(0x0bc2, 0xab20, 0x0000, 0x9999, | |||
61 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 75 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
62 | US_FL_NO_ATA_1X), | 76 | US_FL_NO_ATA_1X), |
63 | 77 | ||
78 | /* https://bbs.archlinux.org/viewtopic.php?id=183190 */ | ||
79 | UNUSUAL_DEV(0x0bc2, 0xab21, 0x0000, 0x9999, | ||
80 | "Seagate", | ||
81 | "Backup+ BK", | ||
82 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
83 | US_FL_NO_ATA_1X), | ||
84 | |||
64 | /* Reported-by: Claudio Bizzarri <claudio.bizzarri@gmail.com> */ | 85 | /* Reported-by: Claudio Bizzarri <claudio.bizzarri@gmail.com> */ |
65 | UNUSUAL_DEV(0x152d, 0x0567, 0x0000, 0x9999, | 86 | UNUSUAL_DEV(0x152d, 0x0567, 0x0000, 0x9999, |
66 | "JMicron", | 87 | "JMicron", |
@@ -75,3 +96,10 @@ UNUSUAL_DEV(0x174c, 0x5106, 0x0000, 0x9999, | |||
75 | "ASM1051", | 96 | "ASM1051", |
76 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 97 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
77 | US_FL_IGNORE_UAS), | 98 | US_FL_IGNORE_UAS), |
99 | |||
100 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ | ||
101 | UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999, | ||
102 | "VIA", | ||
103 | "VL711", | ||
104 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
105 | US_FL_NO_ATA_1X), | ||
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index 9d66ce62542e..d468d02179f4 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -884,7 +884,9 @@ static void usb_stor_scan_dwork(struct work_struct *work) | |||
884 | dev_dbg(dev, "starting scan\n"); | 884 | dev_dbg(dev, "starting scan\n"); |
885 | 885 | ||
886 | /* For bulk-only devices, determine the max LUN value */ | 886 | /* For bulk-only devices, determine the max LUN value */ |
887 | if (us->protocol == USB_PR_BULK && !(us->fflags & US_FL_SINGLE_LUN)) { | 887 | if (us->protocol == USB_PR_BULK && |
888 | !(us->fflags & US_FL_SINGLE_LUN) && | ||
889 | !(us->fflags & US_FL_SCM_MULT_TARG)) { | ||
888 | mutex_lock(&us->dev_mutex); | 890 | mutex_lock(&us->dev_mutex); |
889 | us->max_lun = usb_stor_Bulk_max_lun(us); | 891 | us->max_lun = usb_stor_Bulk_max_lun(us); |
890 | mutex_unlock(&us->dev_mutex); | 892 | mutex_unlock(&us->dev_mutex); |
@@ -983,21 +985,31 @@ int usb_stor_probe2(struct us_data *us) | |||
983 | usb_stor_dbg(us, "Transport: %s\n", us->transport_name); | 985 | usb_stor_dbg(us, "Transport: %s\n", us->transport_name); |
984 | usb_stor_dbg(us, "Protocol: %s\n", us->protocol_name); | 986 | usb_stor_dbg(us, "Protocol: %s\n", us->protocol_name); |
985 | 987 | ||
988 | if (us->fflags & US_FL_SCM_MULT_TARG) { | ||
989 | /* | ||
990 | * SCM eUSCSI bridge devices can have different numbers | ||
991 | * of LUNs on different targets; allow all to be probed. | ||
992 | */ | ||
993 | us->max_lun = 7; | ||
994 | /* The eUSCSI itself has ID 7, so avoid scanning that */ | ||
995 | us_to_host(us)->this_id = 7; | ||
996 | /* max_id is 8 initially, so no need to set it here */ | ||
997 | } else { | ||
998 | /* In the normal case there is only a single target */ | ||
999 | us_to_host(us)->max_id = 1; | ||
1000 | /* | ||
1001 | * Like Windows, we won't store the LUN bits in CDB[1] for | ||
1002 | * SCSI-2 devices using the Bulk-Only transport (even though | ||
1003 | * this violates the SCSI spec). | ||
1004 | */ | ||
1005 | if (us->transport == usb_stor_Bulk_transport) | ||
1006 | us_to_host(us)->no_scsi2_lun_in_cdb = 1; | ||
1007 | } | ||
1008 | |||
986 | /* fix for single-lun devices */ | 1009 | /* fix for single-lun devices */ |
987 | if (us->fflags & US_FL_SINGLE_LUN) | 1010 | if (us->fflags & US_FL_SINGLE_LUN) |
988 | us->max_lun = 0; | 1011 | us->max_lun = 0; |
989 | 1012 | ||
990 | if (!(us->fflags & US_FL_SCM_MULT_TARG)) | ||
991 | us_to_host(us)->max_id = 1; | ||
992 | |||
993 | /* | ||
994 | * Like Windows, we won't store the LUN bits in CDB[1] for SCSI-2 | ||
995 | * devices using the Bulk-Only transport (even though this violates | ||
996 | * the SCSI spec). | ||
997 | */ | ||
998 | if (us->transport == usb_stor_Bulk_transport) | ||
999 | us_to_host(us)->no_scsi2_lun_in_cdb = 1; | ||
1000 | |||
1001 | /* Find the endpoints and calculate pipe values */ | 1013 | /* Find the endpoints and calculate pipe values */ |
1002 | result = get_pipes(us); | 1014 | result = get_pipes(us); |
1003 | if (result) | 1015 | if (result) |
diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c index c02374b6049c..cc1b03eccf4a 100644 --- a/drivers/usb/usbip/vhci_hcd.c +++ b/drivers/usb/usbip/vhci_hcd.c | |||
@@ -518,8 +518,7 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, | |||
518 | dev_info(dev, "SetAddress Request (%d) to port %d\n", | 518 | dev_info(dev, "SetAddress Request (%d) to port %d\n", |
519 | ctrlreq->wValue, vdev->rhport); | 519 | ctrlreq->wValue, vdev->rhport); |
520 | 520 | ||
521 | if (vdev->udev) | 521 | usb_put_dev(vdev->udev); |
522 | usb_put_dev(vdev->udev); | ||
523 | vdev->udev = usb_get_dev(urb->dev); | 522 | vdev->udev = usb_get_dev(urb->dev); |
524 | 523 | ||
525 | spin_lock(&vdev->ud.lock); | 524 | spin_lock(&vdev->ud.lock); |
@@ -539,8 +538,7 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, | |||
539 | usbip_dbg_vhci_hc( | 538 | usbip_dbg_vhci_hc( |
540 | "Not yet?:Get_Descriptor to device 0 (get max pipe size)\n"); | 539 | "Not yet?:Get_Descriptor to device 0 (get max pipe size)\n"); |
541 | 540 | ||
542 | if (vdev->udev) | 541 | usb_put_dev(vdev->udev); |
543 | usb_put_dev(vdev->udev); | ||
544 | vdev->udev = usb_get_dev(urb->dev); | 542 | vdev->udev = usb_get_dev(urb->dev); |
545 | goto out; | 543 | goto out; |
546 | 544 | ||
@@ -831,8 +829,7 @@ static void vhci_device_reset(struct usbip_device *ud) | |||
831 | vdev->speed = 0; | 829 | vdev->speed = 0; |
832 | vdev->devid = 0; | 830 | vdev->devid = 0; |
833 | 831 | ||
834 | if (vdev->udev) | 832 | usb_put_dev(vdev->udev); |
835 | usb_put_dev(vdev->udev); | ||
836 | vdev->udev = NULL; | 833 | vdev->udev = NULL; |
837 | 834 | ||
838 | if (ud->tcp_socket) { | 835 | if (ud->tcp_socket) { |