diff options
42 files changed, 573 insertions, 447 deletions
diff --git a/Documentation/ABI/testing/configfs-usb-gadget-uvc b/Documentation/ABI/testing/configfs-usb-gadget-uvc index 2f4a0051b32d..1ba0d0fda9c0 100644 --- a/Documentation/ABI/testing/configfs-usb-gadget-uvc +++ b/Documentation/ABI/testing/configfs-usb-gadget-uvc | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | What: /config/usb-gadget/gadget/functions/uvc.name | 1 | What: /config/usb-gadget/gadget/functions/uvc.name |
| 2 | Date: Dec 2014 | 2 | Date: Dec 2014 |
| 3 | KernelVersion: 3.20 | 3 | KernelVersion: 4.0 |
| 4 | Description: UVC function directory | 4 | Description: UVC function directory |
| 5 | 5 | ||
| 6 | streaming_maxburst - 0..15 (ss only) | 6 | streaming_maxburst - 0..15 (ss only) |
| @@ -9,37 +9,37 @@ Description: UVC function directory | |||
| 9 | 9 | ||
| 10 | What: /config/usb-gadget/gadget/functions/uvc.name/control | 10 | What: /config/usb-gadget/gadget/functions/uvc.name/control |
| 11 | Date: Dec 2014 | 11 | Date: Dec 2014 |
| 12 | KernelVersion: 3.20 | 12 | KernelVersion: 4.0 |
| 13 | Description: Control descriptors | 13 | Description: Control descriptors |
| 14 | 14 | ||
| 15 | What: /config/usb-gadget/gadget/functions/uvc.name/control/class | 15 | What: /config/usb-gadget/gadget/functions/uvc.name/control/class |
| 16 | Date: Dec 2014 | 16 | Date: Dec 2014 |
| 17 | KernelVersion: 3.20 | 17 | KernelVersion: 4.0 |
| 18 | Description: Class descriptors | 18 | Description: Class descriptors |
| 19 | 19 | ||
| 20 | What: /config/usb-gadget/gadget/functions/uvc.name/control/class/ss | 20 | What: /config/usb-gadget/gadget/functions/uvc.name/control/class/ss |
| 21 | Date: Dec 2014 | 21 | Date: Dec 2014 |
| 22 | KernelVersion: 3.20 | 22 | KernelVersion: 4.0 |
| 23 | Description: Super speed control class descriptors | 23 | Description: Super speed control class descriptors |
| 24 | 24 | ||
| 25 | What: /config/usb-gadget/gadget/functions/uvc.name/control/class/fs | 25 | What: /config/usb-gadget/gadget/functions/uvc.name/control/class/fs |
| 26 | Date: Dec 2014 | 26 | Date: Dec 2014 |
| 27 | KernelVersion: 3.20 | 27 | KernelVersion: 4.0 |
| 28 | Description: Full speed control class descriptors | 28 | Description: Full speed control class descriptors |
| 29 | 29 | ||
| 30 | What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal | 30 | What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal |
| 31 | Date: Dec 2014 | 31 | Date: Dec 2014 |
| 32 | KernelVersion: 3.20 | 32 | KernelVersion: 4.0 |
| 33 | Description: Terminal descriptors | 33 | Description: Terminal descriptors |
| 34 | 34 | ||
| 35 | What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/output | 35 | What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/output |
| 36 | Date: Dec 2014 | 36 | Date: Dec 2014 |
| 37 | KernelVersion: 3.20 | 37 | KernelVersion: 4.0 |
| 38 | Description: Output terminal descriptors | 38 | Description: Output terminal descriptors |
| 39 | 39 | ||
| 40 | What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/output/default | 40 | What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/output/default |
| 41 | Date: Dec 2014 | 41 | Date: Dec 2014 |
| 42 | KernelVersion: 3.20 | 42 | KernelVersion: 4.0 |
| 43 | Description: Default output terminal descriptors | 43 | Description: Default output terminal descriptors |
| 44 | 44 | ||
| 45 | All attributes read only: | 45 | All attributes read only: |
| @@ -53,12 +53,12 @@ Description: Default output terminal descriptors | |||
| 53 | 53 | ||
| 54 | What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/camera | 54 | What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/camera |
| 55 | Date: Dec 2014 | 55 | Date: Dec 2014 |
| 56 | KernelVersion: 3.20 | 56 | KernelVersion: 4.0 |
| 57 | Description: Camera terminal descriptors | 57 | Description: Camera terminal descriptors |
| 58 | 58 | ||
| 59 | What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/camera/default | 59 | What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/camera/default |
| 60 | Date: Dec 2014 | 60 | Date: Dec 2014 |
| 61 | KernelVersion: 3.20 | 61 | KernelVersion: 4.0 |
| 62 | Description: Default camera terminal descriptors | 62 | Description: Default camera terminal descriptors |
| 63 | 63 | ||
| 64 | All attributes read only: | 64 | All attributes read only: |
| @@ -75,12 +75,12 @@ Description: Default camera terminal descriptors | |||
| 75 | 75 | ||
| 76 | What: /config/usb-gadget/gadget/functions/uvc.name/control/processing | 76 | What: /config/usb-gadget/gadget/functions/uvc.name/control/processing |
| 77 | Date: Dec 2014 | 77 | Date: Dec 2014 |
| 78 | KernelVersion: 3.20 | 78 | KernelVersion: 4.0 |
| 79 | Description: Processing unit descriptors | 79 | Description: Processing unit descriptors |
| 80 | 80 | ||
| 81 | What: /config/usb-gadget/gadget/functions/uvc.name/control/processing/default | 81 | What: /config/usb-gadget/gadget/functions/uvc.name/control/processing/default |
| 82 | Date: Dec 2014 | 82 | Date: Dec 2014 |
| 83 | KernelVersion: 3.20 | 83 | KernelVersion: 4.0 |
| 84 | Description: Default processing unit descriptors | 84 | Description: Default processing unit descriptors |
| 85 | 85 | ||
| 86 | All attributes read only: | 86 | All attributes read only: |
| @@ -94,49 +94,49 @@ Description: Default processing unit descriptors | |||
| 94 | 94 | ||
| 95 | What: /config/usb-gadget/gadget/functions/uvc.name/control/header | 95 | What: /config/usb-gadget/gadget/functions/uvc.name/control/header |
| 96 | Date: Dec 2014 | 96 | Date: Dec 2014 |
| 97 | KernelVersion: 3.20 | 97 | KernelVersion: 4.0 |
| 98 | Description: Control header descriptors | 98 | Description: Control header descriptors |
| 99 | 99 | ||
| 100 | What: /config/usb-gadget/gadget/functions/uvc.name/control/header/name | 100 | What: /config/usb-gadget/gadget/functions/uvc.name/control/header/name |
| 101 | Date: Dec 2014 | 101 | Date: Dec 2014 |
| 102 | KernelVersion: 3.20 | 102 | KernelVersion: 4.0 |
| 103 | Description: Specific control header descriptors | 103 | Description: Specific control header descriptors |
| 104 | 104 | ||
| 105 | dwClockFrequency | 105 | dwClockFrequency |
| 106 | bcdUVC | 106 | bcdUVC |
| 107 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming | 107 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming |
| 108 | Date: Dec 2014 | 108 | Date: Dec 2014 |
| 109 | KernelVersion: 3.20 | 109 | KernelVersion: 4.0 |
| 110 | Description: Streaming descriptors | 110 | Description: Streaming descriptors |
| 111 | 111 | ||
| 112 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class | 112 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class |
| 113 | Date: Dec 2014 | 113 | Date: Dec 2014 |
| 114 | KernelVersion: 3.20 | 114 | KernelVersion: 4.0 |
| 115 | Description: Streaming class descriptors | 115 | Description: Streaming class descriptors |
| 116 | 116 | ||
| 117 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class/ss | 117 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class/ss |
| 118 | Date: Dec 2014 | 118 | Date: Dec 2014 |
| 119 | KernelVersion: 3.20 | 119 | KernelVersion: 4.0 |
| 120 | Description: Super speed streaming class descriptors | 120 | Description: Super speed streaming class descriptors |
| 121 | 121 | ||
| 122 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class/hs | 122 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class/hs |
| 123 | Date: Dec 2014 | 123 | Date: Dec 2014 |
| 124 | KernelVersion: 3.20 | 124 | KernelVersion: 4.0 |
| 125 | Description: High speed streaming class descriptors | 125 | Description: High speed streaming class descriptors |
| 126 | 126 | ||
| 127 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class/fs | 127 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class/fs |
| 128 | Date: Dec 2014 | 128 | Date: Dec 2014 |
| 129 | KernelVersion: 3.20 | 129 | KernelVersion: 4.0 |
| 130 | Description: Full speed streaming class descriptors | 130 | Description: Full speed streaming class descriptors |
| 131 | 131 | ||
| 132 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/color_matching | 132 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/color_matching |
| 133 | Date: Dec 2014 | 133 | Date: Dec 2014 |
| 134 | KernelVersion: 3.20 | 134 | KernelVersion: 4.0 |
| 135 | Description: Color matching descriptors | 135 | Description: Color matching descriptors |
| 136 | 136 | ||
| 137 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/color_matching/default | 137 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/color_matching/default |
| 138 | Date: Dec 2014 | 138 | Date: Dec 2014 |
| 139 | KernelVersion: 3.20 | 139 | KernelVersion: 4.0 |
| 140 | Description: Default color matching descriptors | 140 | Description: Default color matching descriptors |
| 141 | 141 | ||
| 142 | All attributes read only: | 142 | All attributes read only: |
| @@ -150,12 +150,12 @@ Description: Default color matching descriptors | |||
| 150 | 150 | ||
| 151 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg | 151 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg |
| 152 | Date: Dec 2014 | 152 | Date: Dec 2014 |
| 153 | KernelVersion: 3.20 | 153 | KernelVersion: 4.0 |
| 154 | Description: MJPEG format descriptors | 154 | Description: MJPEG format descriptors |
| 155 | 155 | ||
| 156 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg/name | 156 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg/name |
| 157 | Date: Dec 2014 | 157 | Date: Dec 2014 |
| 158 | KernelVersion: 3.20 | 158 | KernelVersion: 4.0 |
| 159 | Description: Specific MJPEG format descriptors | 159 | Description: Specific MJPEG format descriptors |
| 160 | 160 | ||
| 161 | All attributes read only, | 161 | All attributes read only, |
| @@ -174,7 +174,7 @@ Description: Specific MJPEG format descriptors | |||
| 174 | 174 | ||
| 175 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg/name/name | 175 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg/name/name |
| 176 | Date: Dec 2014 | 176 | Date: Dec 2014 |
| 177 | KernelVersion: 3.20 | 177 | KernelVersion: 4.0 |
| 178 | Description: Specific MJPEG frame descriptors | 178 | Description: Specific MJPEG frame descriptors |
| 179 | 179 | ||
| 180 | dwFrameInterval - indicates how frame interval can be | 180 | dwFrameInterval - indicates how frame interval can be |
| @@ -196,12 +196,12 @@ Description: Specific MJPEG frame descriptors | |||
| 196 | 196 | ||
| 197 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed | 197 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed |
| 198 | Date: Dec 2014 | 198 | Date: Dec 2014 |
| 199 | KernelVersion: 3.20 | 199 | KernelVersion: 4.0 |
| 200 | Description: Uncompressed format descriptors | 200 | Description: Uncompressed format descriptors |
| 201 | 201 | ||
| 202 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed/name | 202 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed/name |
| 203 | Date: Dec 2014 | 203 | Date: Dec 2014 |
| 204 | KernelVersion: 3.20 | 204 | KernelVersion: 4.0 |
| 205 | Description: Specific uncompressed format descriptors | 205 | Description: Specific uncompressed format descriptors |
| 206 | 206 | ||
| 207 | bmaControls - this format's data for bmaControls in | 207 | bmaControls - this format's data for bmaControls in |
| @@ -221,7 +221,7 @@ Description: Specific uncompressed format descriptors | |||
| 221 | 221 | ||
| 222 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed/name/name | 222 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed/name/name |
| 223 | Date: Dec 2014 | 223 | Date: Dec 2014 |
| 224 | KernelVersion: 3.20 | 224 | KernelVersion: 4.0 |
| 225 | Description: Specific uncompressed frame descriptors | 225 | Description: Specific uncompressed frame descriptors |
| 226 | 226 | ||
| 227 | dwFrameInterval - indicates how frame interval can be | 227 | dwFrameInterval - indicates how frame interval can be |
| @@ -243,12 +243,12 @@ Description: Specific uncompressed frame descriptors | |||
| 243 | 243 | ||
| 244 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/header | 244 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/header |
| 245 | Date: Dec 2014 | 245 | Date: Dec 2014 |
| 246 | KernelVersion: 3.20 | 246 | KernelVersion: 4.0 |
| 247 | Description: Streaming header descriptors | 247 | Description: Streaming header descriptors |
| 248 | 248 | ||
| 249 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/header/name | 249 | What: /config/usb-gadget/gadget/functions/uvc.name/streaming/header/name |
| 250 | Date: Dec 2014 | 250 | Date: Dec 2014 |
| 251 | KernelVersion: 3.20 | 251 | KernelVersion: 4.0 |
| 252 | Description: Specific streaming header descriptors | 252 | Description: Specific streaming header descriptors |
| 253 | 253 | ||
| 254 | All attributes read only: | 254 | All attributes read only: |
diff --git a/MAINTAINERS b/MAINTAINERS index b697a03e307a..2bfc987a8c30 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -11975,6 +11975,7 @@ L: linux-usb@vger.kernel.org | |||
| 11975 | W: http://www.linux-usb.org | 11975 | W: http://www.linux-usb.org |
| 11976 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git | 11976 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git |
| 11977 | S: Supported | 11977 | S: Supported |
| 11978 | F: Documentation/devicetree/bindings/usb/ | ||
| 11978 | F: Documentation/usb/ | 11979 | F: Documentation/usb/ |
| 11979 | F: drivers/usb/ | 11980 | F: drivers/usb/ |
| 11980 | F: include/linux/usb.h | 11981 | F: include/linux/usb.h |
diff --git a/drivers/phy/phy-exynos-mipi-video.c b/drivers/phy/phy-exynos-mipi-video.c index cc093ebfda94..8b851f718123 100644 --- a/drivers/phy/phy-exynos-mipi-video.c +++ b/drivers/phy/phy-exynos-mipi-video.c | |||
| @@ -233,8 +233,12 @@ static inline int __is_running(const struct exynos_mipi_phy_desc *data, | |||
| 233 | struct exynos_mipi_video_phy *state) | 233 | struct exynos_mipi_video_phy *state) |
| 234 | { | 234 | { |
| 235 | u32 val; | 235 | u32 val; |
| 236 | int ret; | ||
| 237 | |||
| 238 | ret = regmap_read(state->regmaps[data->resetn_map], data->resetn_reg, &val); | ||
| 239 | if (ret) | ||
| 240 | return 0; | ||
| 236 | 241 | ||
| 237 | regmap_read(state->regmaps[data->resetn_map], data->resetn_reg, &val); | ||
| 238 | return val & data->resetn_val; | 242 | return val & data->resetn_val; |
| 239 | } | 243 | } |
| 240 | 244 | ||
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c index 0a477d24cf76..bf46844dc387 100644 --- a/drivers/phy/phy-ti-pipe3.c +++ b/drivers/phy/phy-ti-pipe3.c | |||
| @@ -293,11 +293,18 @@ static int ti_pipe3_init(struct phy *x) | |||
| 293 | ret = ti_pipe3_dpll_wait_lock(phy); | 293 | ret = ti_pipe3_dpll_wait_lock(phy); |
| 294 | } | 294 | } |
| 295 | 295 | ||
| 296 | /* Program the DPLL only if not locked */ | 296 | /* SATA has issues if re-programmed when locked */ |
| 297 | val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_STATUS); | 297 | val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_STATUS); |
| 298 | if (!(val & PLL_LOCK)) | 298 | if ((val & PLL_LOCK) && of_device_is_compatible(phy->dev->of_node, |
| 299 | if (ti_pipe3_dpll_program(phy)) | 299 | "ti,phy-pipe3-sata")) |
| 300 | return -EINVAL; | 300 | return ret; |
| 301 | |||
| 302 | /* Program the DPLL */ | ||
| 303 | ret = ti_pipe3_dpll_program(phy); | ||
| 304 | if (ret) { | ||
| 305 | ti_pipe3_disable_clocks(phy); | ||
| 306 | return -EINVAL; | ||
| 307 | } | ||
| 301 | 308 | ||
| 302 | return ret; | 309 | return ret; |
| 303 | } | 310 | } |
diff --git a/drivers/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c index 6b6af6cba454..d9b10a39a2cf 100644 --- a/drivers/phy/phy-twl4030-usb.c +++ b/drivers/phy/phy-twl4030-usb.c | |||
| @@ -463,7 +463,8 @@ static int twl4030_phy_power_on(struct phy *phy) | |||
| 463 | twl4030_usb_set_mode(twl, twl->usb_mode); | 463 | twl4030_usb_set_mode(twl, twl->usb_mode); |
| 464 | if (twl->usb_mode == T2_USB_MODE_ULPI) | 464 | if (twl->usb_mode == T2_USB_MODE_ULPI) |
| 465 | twl4030_i2c_access(twl, 0); | 465 | twl4030_i2c_access(twl, 0); |
| 466 | schedule_delayed_work(&twl->id_workaround_work, 0); | 466 | twl->linkstat = MUSB_UNKNOWN; |
| 467 | schedule_delayed_work(&twl->id_workaround_work, HZ); | ||
| 467 | 468 | ||
| 468 | return 0; | 469 | return 0; |
| 469 | } | 470 | } |
| @@ -537,6 +538,7 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl) | |||
| 537 | struct twl4030_usb *twl = _twl; | 538 | struct twl4030_usb *twl = _twl; |
| 538 | enum musb_vbus_id_status status; | 539 | enum musb_vbus_id_status status; |
| 539 | bool status_changed = false; | 540 | bool status_changed = false; |
| 541 | int err; | ||
| 540 | 542 | ||
| 541 | status = twl4030_usb_linkstat(twl); | 543 | status = twl4030_usb_linkstat(twl); |
| 542 | 544 | ||
| @@ -567,7 +569,9 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl) | |||
| 567 | pm_runtime_mark_last_busy(twl->dev); | 569 | pm_runtime_mark_last_busy(twl->dev); |
| 568 | pm_runtime_put_autosuspend(twl->dev); | 570 | pm_runtime_put_autosuspend(twl->dev); |
| 569 | } | 571 | } |
| 570 | musb_mailbox(status); | 572 | err = musb_mailbox(status); |
| 573 | if (err) | ||
| 574 | twl->linkstat = MUSB_UNKNOWN; | ||
| 571 | } | 575 | } |
| 572 | 576 | ||
| 573 | /* don't schedule during sleep - irq works right then */ | 577 | /* don't schedule during sleep - irq works right then */ |
| @@ -595,7 +599,8 @@ static int twl4030_phy_init(struct phy *phy) | |||
| 595 | struct twl4030_usb *twl = phy_get_drvdata(phy); | 599 | struct twl4030_usb *twl = phy_get_drvdata(phy); |
| 596 | 600 | ||
| 597 | pm_runtime_get_sync(twl->dev); | 601 | pm_runtime_get_sync(twl->dev); |
| 598 | schedule_delayed_work(&twl->id_workaround_work, 0); | 602 | twl->linkstat = MUSB_UNKNOWN; |
| 603 | schedule_delayed_work(&twl->id_workaround_work, HZ); | ||
| 599 | pm_runtime_mark_last_busy(twl->dev); | 604 | pm_runtime_mark_last_busy(twl->dev); |
| 600 | pm_runtime_put_autosuspend(twl->dev); | 605 | pm_runtime_put_autosuspend(twl->dev); |
| 601 | 606 | ||
| @@ -763,7 +768,8 @@ static int twl4030_usb_remove(struct platform_device *pdev) | |||
| 763 | if (cable_present(twl->linkstat)) | 768 | if (cable_present(twl->linkstat)) |
| 764 | pm_runtime_put_noidle(twl->dev); | 769 | pm_runtime_put_noidle(twl->dev); |
| 765 | pm_runtime_mark_last_busy(twl->dev); | 770 | pm_runtime_mark_last_busy(twl->dev); |
| 766 | pm_runtime_put_sync_suspend(twl->dev); | 771 | pm_runtime_dont_use_autosuspend(&pdev->dev); |
| 772 | pm_runtime_put_sync(twl->dev); | ||
| 767 | pm_runtime_disable(twl->dev); | 773 | pm_runtime_disable(twl->dev); |
| 768 | 774 | ||
| 769 | /* autogate 60MHz ULPI clock, | 775 | /* autogate 60MHz ULPI clock, |
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index 6dc810bce295..944a6dca0fcb 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
| @@ -44,6 +44,9 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
| 44 | /* Creative SB Audigy 2 NX */ | 44 | /* Creative SB Audigy 2 NX */ |
| 45 | { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME }, | 45 | { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 46 | 46 | ||
| 47 | /* USB3503 */ | ||
| 48 | { USB_DEVICE(0x0424, 0x3503), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
| 49 | |||
| 47 | /* Microsoft Wireless Laser Mouse 6000 Receiver */ | 50 | /* Microsoft Wireless Laser Mouse 6000 Receiver */ |
| 48 | { USB_DEVICE(0x045e, 0x00e1), .driver_info = USB_QUIRK_RESET_RESUME }, | 51 | { USB_DEVICE(0x045e, 0x00e1), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 49 | 52 | ||
| @@ -173,6 +176,10 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
| 173 | /* MAYA44USB sound device */ | 176 | /* MAYA44USB sound device */ |
| 174 | { USB_DEVICE(0x0a92, 0x0091), .driver_info = USB_QUIRK_RESET_RESUME }, | 177 | { USB_DEVICE(0x0a92, 0x0091), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 175 | 178 | ||
| 179 | /* ASUS Base Station(T100) */ | ||
| 180 | { USB_DEVICE(0x0b05, 0x17e0), .driver_info = | ||
| 181 | USB_QUIRK_IGNORE_REMOTE_WAKEUP }, | ||
| 182 | |||
| 176 | /* Action Semiconductor flash disk */ | 183 | /* Action Semiconductor flash disk */ |
| 177 | { USB_DEVICE(0x10d6, 0x2200), .driver_info = | 184 | { USB_DEVICE(0x10d6, 0x2200), .driver_info = |
| 178 | USB_QUIRK_STRING_FETCH_255 }, | 185 | USB_QUIRK_STRING_FETCH_255 }, |
| @@ -188,26 +195,22 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
| 188 | { USB_DEVICE(0x1908, 0x1315), .driver_info = | 195 | { USB_DEVICE(0x1908, 0x1315), .driver_info = |
| 189 | USB_QUIRK_HONOR_BNUMINTERFACES }, | 196 | USB_QUIRK_HONOR_BNUMINTERFACES }, |
| 190 | 197 | ||
| 191 | /* INTEL VALUE SSD */ | ||
| 192 | { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
| 193 | |||
| 194 | /* USB3503 */ | ||
| 195 | { USB_DEVICE(0x0424, 0x3503), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
| 196 | |||
| 197 | /* ASUS Base Station(T100) */ | ||
| 198 | { USB_DEVICE(0x0b05, 0x17e0), .driver_info = | ||
| 199 | USB_QUIRK_IGNORE_REMOTE_WAKEUP }, | ||
| 200 | |||
| 201 | /* Protocol and OTG Electrical Test Device */ | 198 | /* Protocol and OTG Electrical Test Device */ |
| 202 | { USB_DEVICE(0x1a0a, 0x0200), .driver_info = | 199 | { USB_DEVICE(0x1a0a, 0x0200), .driver_info = |
| 203 | USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL }, | 200 | USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL }, |
| 204 | 201 | ||
| 202 | /* Acer C120 LED Projector */ | ||
| 203 | { USB_DEVICE(0x1de1, 0xc102), .driver_info = USB_QUIRK_NO_LPM }, | ||
| 204 | |||
| 205 | /* Blackmagic Design Intensity Shuttle */ | 205 | /* Blackmagic Design Intensity Shuttle */ |
| 206 | { USB_DEVICE(0x1edb, 0xbd3b), .driver_info = USB_QUIRK_NO_LPM }, | 206 | { USB_DEVICE(0x1edb, 0xbd3b), .driver_info = USB_QUIRK_NO_LPM }, |
| 207 | 207 | ||
| 208 | /* Blackmagic Design UltraStudio SDI */ | 208 | /* Blackmagic Design UltraStudio SDI */ |
| 209 | { USB_DEVICE(0x1edb, 0xbd4f), .driver_info = USB_QUIRK_NO_LPM }, | 209 | { USB_DEVICE(0x1edb, 0xbd4f), .driver_info = USB_QUIRK_NO_LPM }, |
| 210 | 210 | ||
| 211 | /* INTEL VALUE SSD */ | ||
| 212 | { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
| 213 | |||
| 211 | { } /* terminating entry must be last */ | 214 | { } /* terminating entry must be last */ |
| 212 | }; | 215 | }; |
| 213 | 216 | ||
diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 3c58d633ce80..dec0b21fc626 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h | |||
| @@ -64,6 +64,17 @@ | |||
| 64 | DWC2_TRACE_SCHEDULER_VB(pr_fmt("%s: SCH: " fmt), \ | 64 | DWC2_TRACE_SCHEDULER_VB(pr_fmt("%s: SCH: " fmt), \ |
| 65 | dev_name(hsotg->dev), ##__VA_ARGS__) | 65 | dev_name(hsotg->dev), ##__VA_ARGS__) |
| 66 | 66 | ||
| 67 | #ifdef CONFIG_MIPS | ||
| 68 | /* | ||
| 69 | * There are some MIPS machines that can run in either big-endian | ||
| 70 | * or little-endian mode and that use the dwc2 register without | ||
| 71 | * a byteswap in both ways. | ||
| 72 | * Unlike other architectures, MIPS apparently does not require a | ||
| 73 | * barrier before the __raw_writel() to synchronize with DMA but does | ||
| 74 | * require the barrier after the __raw_writel() to serialize a set of | ||
| 75 | * writes. This set of operations was added specifically for MIPS and | ||
| 76 | * should only be used there. | ||
| 77 | */ | ||
| 67 | static inline u32 dwc2_readl(const void __iomem *addr) | 78 | static inline u32 dwc2_readl(const void __iomem *addr) |
| 68 | { | 79 | { |
| 69 | u32 value = __raw_readl(addr); | 80 | u32 value = __raw_readl(addr); |
| @@ -90,6 +101,22 @@ static inline void dwc2_writel(u32 value, void __iomem *addr) | |||
| 90 | pr_info("INFO:: wrote %08x to %p\n", value, addr); | 101 | pr_info("INFO:: wrote %08x to %p\n", value, addr); |
| 91 | #endif | 102 | #endif |
| 92 | } | 103 | } |
| 104 | #else | ||
| 105 | /* Normal architectures just use readl/write */ | ||
| 106 | static inline u32 dwc2_readl(const void __iomem *addr) | ||
| 107 | { | ||
| 108 | return readl(addr); | ||
| 109 | } | ||
| 110 | |||
| 111 | static inline void dwc2_writel(u32 value, void __iomem *addr) | ||
| 112 | { | ||
| 113 | writel(value, addr); | ||
| 114 | |||
| 115 | #ifdef DWC2_LOG_WRITES | ||
| 116 | pr_info("info:: wrote %08x to %p\n", value, addr); | ||
| 117 | #endif | ||
| 118 | } | ||
| 119 | #endif | ||
| 93 | 120 | ||
| 94 | /* Maximum number of Endpoints/HostChannels */ | 121 | /* Maximum number of Endpoints/HostChannels */ |
| 95 | #define MAX_EPS_CHANNELS 16 | 122 | #define MAX_EPS_CHANNELS 16 |
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 4c5e3005e1dc..26cf09d0fe3c 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c | |||
| @@ -1018,7 +1018,7 @@ static int dwc2_hsotg_process_req_status(struct dwc2_hsotg *hsotg, | |||
| 1018 | return 1; | 1018 | return 1; |
| 1019 | } | 1019 | } |
| 1020 | 1020 | ||
| 1021 | static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value); | 1021 | static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value, bool now); |
| 1022 | 1022 | ||
| 1023 | /** | 1023 | /** |
| 1024 | * get_ep_head - return the first request on the endpoint | 1024 | * get_ep_head - return the first request on the endpoint |
| @@ -1094,7 +1094,7 @@ static int dwc2_hsotg_process_req_feature(struct dwc2_hsotg *hsotg, | |||
| 1094 | case USB_ENDPOINT_HALT: | 1094 | case USB_ENDPOINT_HALT: |
| 1095 | halted = ep->halted; | 1095 | halted = ep->halted; |
| 1096 | 1096 | ||
| 1097 | dwc2_hsotg_ep_sethalt(&ep->ep, set); | 1097 | dwc2_hsotg_ep_sethalt(&ep->ep, set, true); |
| 1098 | 1098 | ||
| 1099 | ret = dwc2_hsotg_send_reply(hsotg, ep0, NULL, 0); | 1099 | ret = dwc2_hsotg_send_reply(hsotg, ep0, NULL, 0); |
| 1100 | if (ret) { | 1100 | if (ret) { |
| @@ -2948,8 +2948,13 @@ static int dwc2_hsotg_ep_dequeue(struct usb_ep *ep, struct usb_request *req) | |||
| 2948 | * dwc2_hsotg_ep_sethalt - set halt on a given endpoint | 2948 | * dwc2_hsotg_ep_sethalt - set halt on a given endpoint |
| 2949 | * @ep: The endpoint to set halt. | 2949 | * @ep: The endpoint to set halt. |
| 2950 | * @value: Set or unset the halt. | 2950 | * @value: Set or unset the halt. |
| 2951 | * @now: If true, stall the endpoint now. Otherwise return -EAGAIN if | ||
| 2952 | * the endpoint is busy processing requests. | ||
| 2953 | * | ||
| 2954 | * We need to stall the endpoint immediately if request comes from set_feature | ||
| 2955 | * protocol command handler. | ||
| 2951 | */ | 2956 | */ |
| 2952 | static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value) | 2957 | static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value, bool now) |
| 2953 | { | 2958 | { |
| 2954 | struct dwc2_hsotg_ep *hs_ep = our_ep(ep); | 2959 | struct dwc2_hsotg_ep *hs_ep = our_ep(ep); |
| 2955 | struct dwc2_hsotg *hs = hs_ep->parent; | 2960 | struct dwc2_hsotg *hs = hs_ep->parent; |
| @@ -2969,6 +2974,17 @@ static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value) | |||
| 2969 | return 0; | 2974 | return 0; |
| 2970 | } | 2975 | } |
| 2971 | 2976 | ||
| 2977 | if (hs_ep->isochronous) { | ||
| 2978 | dev_err(hs->dev, "%s is Isochronous Endpoint\n", ep->name); | ||
| 2979 | return -EINVAL; | ||
| 2980 | } | ||
| 2981 | |||
| 2982 | if (!now && value && !list_empty(&hs_ep->queue)) { | ||
| 2983 | dev_dbg(hs->dev, "%s request is pending, cannot halt\n", | ||
| 2984 | ep->name); | ||
| 2985 | return -EAGAIN; | ||
| 2986 | } | ||
| 2987 | |||
| 2972 | if (hs_ep->dir_in) { | 2988 | if (hs_ep->dir_in) { |
| 2973 | epreg = DIEPCTL(index); | 2989 | epreg = DIEPCTL(index); |
| 2974 | epctl = dwc2_readl(hs->regs + epreg); | 2990 | epctl = dwc2_readl(hs->regs + epreg); |
| @@ -3020,7 +3036,7 @@ static int dwc2_hsotg_ep_sethalt_lock(struct usb_ep *ep, int value) | |||
| 3020 | int ret = 0; | 3036 | int ret = 0; |
| 3021 | 3037 | ||
| 3022 | spin_lock_irqsave(&hs->lock, flags); | 3038 | spin_lock_irqsave(&hs->lock, flags); |
| 3023 | ret = dwc2_hsotg_ep_sethalt(ep, value); | 3039 | ret = dwc2_hsotg_ep_sethalt(ep, value, false); |
| 3024 | spin_unlock_irqrestore(&hs->lock, flags); | 3040 | spin_unlock_irqrestore(&hs->lock, flags); |
| 3025 | 3041 | ||
| 3026 | return ret; | 3042 | return ret; |
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 7ddf9449a063..654050684f4f 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h | |||
| @@ -402,6 +402,7 @@ | |||
| 402 | #define DWC3_DEPCMD_GET_RSC_IDX(x) (((x) >> DWC3_DEPCMD_PARAM_SHIFT) & 0x7f) | 402 | #define DWC3_DEPCMD_GET_RSC_IDX(x) (((x) >> DWC3_DEPCMD_PARAM_SHIFT) & 0x7f) |
| 403 | #define DWC3_DEPCMD_STATUS(x) (((x) >> 12) & 0x0F) | 403 | #define DWC3_DEPCMD_STATUS(x) (((x) >> 12) & 0x0F) |
| 404 | #define DWC3_DEPCMD_HIPRI_FORCERM (1 << 11) | 404 | #define DWC3_DEPCMD_HIPRI_FORCERM (1 << 11) |
| 405 | #define DWC3_DEPCMD_CLEARPENDIN (1 << 11) | ||
| 405 | #define DWC3_DEPCMD_CMDACT (1 << 10) | 406 | #define DWC3_DEPCMD_CMDACT (1 << 10) |
| 406 | #define DWC3_DEPCMD_CMDIOC (1 << 8) | 407 | #define DWC3_DEPCMD_CMDIOC (1 << 8) |
| 407 | 408 | ||
diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c index dd5cb5577dca..2f1fb7e7aa54 100644 --- a/drivers/usb/dwc3/dwc3-exynos.c +++ b/drivers/usb/dwc3/dwc3-exynos.c | |||
| @@ -128,12 +128,6 @@ static int dwc3_exynos_probe(struct platform_device *pdev) | |||
| 128 | 128 | ||
| 129 | platform_set_drvdata(pdev, exynos); | 129 | platform_set_drvdata(pdev, exynos); |
| 130 | 130 | ||
| 131 | ret = dwc3_exynos_register_phys(exynos); | ||
| 132 | if (ret) { | ||
| 133 | dev_err(dev, "couldn't register PHYs\n"); | ||
| 134 | return ret; | ||
| 135 | } | ||
| 136 | |||
| 137 | exynos->dev = dev; | 131 | exynos->dev = dev; |
| 138 | 132 | ||
| 139 | exynos->clk = devm_clk_get(dev, "usbdrd30"); | 133 | exynos->clk = devm_clk_get(dev, "usbdrd30"); |
| @@ -183,20 +177,29 @@ static int dwc3_exynos_probe(struct platform_device *pdev) | |||
| 183 | goto err3; | 177 | goto err3; |
| 184 | } | 178 | } |
| 185 | 179 | ||
| 180 | ret = dwc3_exynos_register_phys(exynos); | ||
| 181 | if (ret) { | ||
| 182 | dev_err(dev, "couldn't register PHYs\n"); | ||
| 183 | goto err4; | ||
| 184 | } | ||
| 185 | |||
| 186 | if (node) { | 186 | if (node) { |
| 187 | ret = of_platform_populate(node, NULL, NULL, dev); | 187 | ret = of_platform_populate(node, NULL, NULL, dev); |
| 188 | if (ret) { | 188 | if (ret) { |
| 189 | dev_err(dev, "failed to add dwc3 core\n"); | 189 | dev_err(dev, "failed to add dwc3 core\n"); |
| 190 | goto err4; | 190 | goto err5; |
| 191 | } | 191 | } |
| 192 | } else { | 192 | } else { |
| 193 | dev_err(dev, "no device node, failed to add dwc3 core\n"); | 193 | dev_err(dev, "no device node, failed to add dwc3 core\n"); |
| 194 | ret = -ENODEV; | 194 | ret = -ENODEV; |
| 195 | goto err4; | 195 | goto err5; |
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | return 0; | 198 | return 0; |
| 199 | 199 | ||
| 200 | err5: | ||
| 201 | platform_device_unregister(exynos->usb2_phy); | ||
| 202 | platform_device_unregister(exynos->usb3_phy); | ||
| 200 | err4: | 203 | err4: |
| 201 | regulator_disable(exynos->vdd10); | 204 | regulator_disable(exynos->vdd10); |
| 202 | err3: | 205 | err3: |
diff --git a/drivers/usb/dwc3/dwc3-st.c b/drivers/usb/dwc3/dwc3-st.c index 5c0adb9c6fb2..50d6ae6f88bc 100644 --- a/drivers/usb/dwc3/dwc3-st.c +++ b/drivers/usb/dwc3/dwc3-st.c | |||
| @@ -129,12 +129,18 @@ static int st_dwc3_drd_init(struct st_dwc3 *dwc3_data) | |||
| 129 | switch (dwc3_data->dr_mode) { | 129 | switch (dwc3_data->dr_mode) { |
| 130 | case USB_DR_MODE_PERIPHERAL: | 130 | case USB_DR_MODE_PERIPHERAL: |
| 131 | 131 | ||
| 132 | val &= ~(USB3_FORCE_VBUSVALID | USB3_DELAY_VBUSVALID | 132 | val &= ~(USB3_DELAY_VBUSVALID |
| 133 | | USB3_SEL_FORCE_OPMODE | USB3_FORCE_OPMODE(0x3) | 133 | | USB3_SEL_FORCE_OPMODE | USB3_FORCE_OPMODE(0x3) |
| 134 | | USB3_SEL_FORCE_DPPULLDOWN2 | USB3_FORCE_DPPULLDOWN2 | 134 | | USB3_SEL_FORCE_DPPULLDOWN2 | USB3_FORCE_DPPULLDOWN2 |
| 135 | | USB3_SEL_FORCE_DMPULLDOWN2 | USB3_FORCE_DMPULLDOWN2); | 135 | | USB3_SEL_FORCE_DMPULLDOWN2 | USB3_FORCE_DMPULLDOWN2); |
| 136 | 136 | ||
| 137 | val |= USB3_DEVICE_NOT_HOST; | 137 | /* |
| 138 | * USB3_PORT2_FORCE_VBUSVALID When '1' and when | ||
| 139 | * USB3_PORT2_DEVICE_NOT_HOST = 1, forces VBUSVLDEXT2 input | ||
| 140 | * of the pico PHY to 1. | ||
| 141 | */ | ||
| 142 | |||
| 143 | val |= USB3_DEVICE_NOT_HOST | USB3_FORCE_VBUSVALID; | ||
| 138 | break; | 144 | break; |
| 139 | 145 | ||
| 140 | case USB_DR_MODE_HOST: | 146 | case USB_DR_MODE_HOST: |
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 9a7d0bd15dc3..07248ff1be5c 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
| @@ -347,6 +347,28 @@ int dwc3_send_gadget_ep_cmd(struct dwc3 *dwc, unsigned ep, | |||
| 347 | return ret; | 347 | return ret; |
| 348 | } | 348 | } |
| 349 | 349 | ||
| 350 | static int dwc3_send_clear_stall_ep_cmd(struct dwc3_ep *dep) | ||
| 351 | { | ||
| 352 | struct dwc3 *dwc = dep->dwc; | ||
| 353 | struct dwc3_gadget_ep_cmd_params params; | ||
| 354 | u32 cmd = DWC3_DEPCMD_CLEARSTALL; | ||
| 355 | |||
| 356 | /* | ||
| 357 | * As of core revision 2.60a the recommended programming model | ||
| 358 | * is to set the ClearPendIN bit when issuing a Clear Stall EP | ||
| 359 | * command for IN endpoints. This is to prevent an issue where | ||
| 360 | * some (non-compliant) hosts may not send ACK TPs for pending | ||
| 361 | * IN transfers due to a mishandled error condition. Synopsys | ||
| 362 | * STAR 9000614252. | ||
| 363 | */ | ||
| 364 | if (dep->direction && (dwc->revision >= DWC3_REVISION_260A)) | ||
| 365 | cmd |= DWC3_DEPCMD_CLEARPENDIN; | ||
| 366 | |||
| 367 | memset(¶ms, 0, sizeof(params)); | ||
| 368 | |||
| 369 | return dwc3_send_gadget_ep_cmd(dwc, dep->number, cmd, ¶ms); | ||
| 370 | } | ||
| 371 | |||
| 350 | static dma_addr_t dwc3_trb_dma_offset(struct dwc3_ep *dep, | 372 | static dma_addr_t dwc3_trb_dma_offset(struct dwc3_ep *dep, |
| 351 | struct dwc3_trb *trb) | 373 | struct dwc3_trb *trb) |
| 352 | { | 374 | { |
| @@ -1314,8 +1336,7 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol) | |||
| 1314 | else | 1336 | else |
| 1315 | dep->flags |= DWC3_EP_STALL; | 1337 | dep->flags |= DWC3_EP_STALL; |
| 1316 | } else { | 1338 | } else { |
| 1317 | ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, | 1339 | ret = dwc3_send_clear_stall_ep_cmd(dep); |
| 1318 | DWC3_DEPCMD_CLEARSTALL, ¶ms); | ||
| 1319 | if (ret) | 1340 | if (ret) |
| 1320 | dev_err(dwc->dev, "failed to clear STALL on %s\n", | 1341 | dev_err(dwc->dev, "failed to clear STALL on %s\n", |
| 1321 | dep->name); | 1342 | dep->name); |
| @@ -2247,7 +2268,6 @@ static void dwc3_clear_stall_all_ep(struct dwc3 *dwc) | |||
| 2247 | 2268 | ||
| 2248 | for (epnum = 1; epnum < DWC3_ENDPOINTS_NUM; epnum++) { | 2269 | for (epnum = 1; epnum < DWC3_ENDPOINTS_NUM; epnum++) { |
| 2249 | struct dwc3_ep *dep; | 2270 | struct dwc3_ep *dep; |
| 2250 | struct dwc3_gadget_ep_cmd_params params; | ||
| 2251 | int ret; | 2271 | int ret; |
| 2252 | 2272 | ||
| 2253 | dep = dwc->eps[epnum]; | 2273 | dep = dwc->eps[epnum]; |
| @@ -2259,9 +2279,7 @@ static void dwc3_clear_stall_all_ep(struct dwc3 *dwc) | |||
| 2259 | 2279 | ||
| 2260 | dep->flags &= ~DWC3_EP_STALL; | 2280 | dep->flags &= ~DWC3_EP_STALL; |
| 2261 | 2281 | ||
| 2262 | memset(¶ms, 0, sizeof(params)); | 2282 | ret = dwc3_send_clear_stall_ep_cmd(dep); |
| 2263 | ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, | ||
| 2264 | DWC3_DEPCMD_CLEARSTALL, ¶ms); | ||
| 2265 | WARN_ON_ONCE(ret); | 2283 | WARN_ON_ONCE(ret); |
| 2266 | } | 2284 | } |
| 2267 | } | 2285 | } |
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index d67de0d22a2b..eb648485a58c 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c | |||
| @@ -1868,14 +1868,19 @@ unknown: | |||
| 1868 | } | 1868 | } |
| 1869 | break; | 1869 | break; |
| 1870 | } | 1870 | } |
| 1871 | req->length = value; | 1871 | |
| 1872 | req->context = cdev; | 1872 | if (value >= 0) { |
| 1873 | req->zero = value < w_length; | 1873 | req->length = value; |
| 1874 | value = composite_ep0_queue(cdev, req, GFP_ATOMIC); | 1874 | req->context = cdev; |
| 1875 | if (value < 0) { | 1875 | req->zero = value < w_length; |
| 1876 | DBG(cdev, "ep_queue --> %d\n", value); | 1876 | value = composite_ep0_queue(cdev, req, |
| 1877 | req->status = 0; | 1877 | GFP_ATOMIC); |
| 1878 | composite_setup_complete(gadget->ep0, req); | 1878 | if (value < 0) { |
| 1879 | DBG(cdev, "ep_queue --> %d\n", value); | ||
| 1880 | req->status = 0; | ||
| 1881 | composite_setup_complete(gadget->ep0, | ||
| 1882 | req); | ||
| 1883 | } | ||
| 1879 | } | 1884 | } |
| 1880 | return value; | 1885 | return value; |
| 1881 | } | 1886 | } |
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index b6f60ca8a035..70cf3477f951 100644 --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c | |||
| @@ -1401,6 +1401,7 @@ static const struct usb_gadget_driver configfs_driver_template = { | |||
| 1401 | .owner = THIS_MODULE, | 1401 | .owner = THIS_MODULE, |
| 1402 | .name = "configfs-gadget", | 1402 | .name = "configfs-gadget", |
| 1403 | }, | 1403 | }, |
| 1404 | .match_existing_only = 1, | ||
| 1404 | }; | 1405 | }; |
| 1405 | 1406 | ||
| 1406 | static struct config_group *gadgets_make( | 1407 | static struct config_group *gadgets_make( |
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index 73515d54e1cc..cc33d2667408 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c | |||
| @@ -2051,7 +2051,7 @@ static int __ffs_data_do_os_desc(enum ffs_os_desc_type type, | |||
| 2051 | 2051 | ||
| 2052 | if (len < sizeof(*d) || | 2052 | if (len < sizeof(*d) || |
| 2053 | d->bFirstInterfaceNumber >= ffs->interfaces_count || | 2053 | d->bFirstInterfaceNumber >= ffs->interfaces_count || |
| 2054 | d->Reserved1) | 2054 | !d->Reserved1) |
| 2055 | return -EINVAL; | 2055 | return -EINVAL; |
| 2056 | for (i = 0; i < ARRAY_SIZE(d->Reserved2); ++i) | 2056 | for (i = 0; i < ARRAY_SIZE(d->Reserved2); ++i) |
| 2057 | if (d->Reserved2[i]) | 2057 | if (d->Reserved2[i]) |
| @@ -2729,6 +2729,7 @@ static int _ffs_func_bind(struct usb_configuration *c, | |||
| 2729 | func->ffs->ss_descs_count; | 2729 | func->ffs->ss_descs_count; |
| 2730 | 2730 | ||
| 2731 | int fs_len, hs_len, ss_len, ret, i; | 2731 | int fs_len, hs_len, ss_len, ret, i; |
| 2732 | struct ffs_ep *eps_ptr; | ||
| 2732 | 2733 | ||
| 2733 | /* Make it a single chunk, less management later on */ | 2734 | /* Make it a single chunk, less management later on */ |
| 2734 | vla_group(d); | 2735 | vla_group(d); |
| @@ -2777,12 +2778,9 @@ static int _ffs_func_bind(struct usb_configuration *c, | |||
| 2777 | ffs->raw_descs_length); | 2778 | ffs->raw_descs_length); |
| 2778 | 2779 | ||
| 2779 | memset(vla_ptr(vlabuf, d, inums), 0xff, d_inums__sz); | 2780 | memset(vla_ptr(vlabuf, d, inums), 0xff, d_inums__sz); |
| 2780 | for (ret = ffs->eps_count; ret; --ret) { | 2781 | eps_ptr = vla_ptr(vlabuf, d, eps); |
| 2781 | struct ffs_ep *ptr; | 2782 | for (i = 0; i < ffs->eps_count; i++) |
| 2782 | 2783 | eps_ptr[i].num = -1; | |
| 2783 | ptr = vla_ptr(vlabuf, d, eps); | ||
| 2784 | ptr[ret].num = -1; | ||
| 2785 | } | ||
| 2786 | 2784 | ||
| 2787 | /* Save pointers | 2785 | /* Save pointers |
| 2788 | * d_eps == vlabuf, func->eps used to kfree vlabuf later | 2786 | * d_eps == vlabuf, func->eps used to kfree vlabuf later |
| @@ -2851,7 +2849,7 @@ static int _ffs_func_bind(struct usb_configuration *c, | |||
| 2851 | goto error; | 2849 | goto error; |
| 2852 | 2850 | ||
| 2853 | func->function.os_desc_table = vla_ptr(vlabuf, d, os_desc_table); | 2851 | func->function.os_desc_table = vla_ptr(vlabuf, d, os_desc_table); |
| 2854 | if (c->cdev->use_os_string) | 2852 | if (c->cdev->use_os_string) { |
| 2855 | for (i = 0; i < ffs->interfaces_count; ++i) { | 2853 | for (i = 0; i < ffs->interfaces_count; ++i) { |
| 2856 | struct usb_os_desc *desc; | 2854 | struct usb_os_desc *desc; |
| 2857 | 2855 | ||
| @@ -2862,13 +2860,15 @@ static int _ffs_func_bind(struct usb_configuration *c, | |||
| 2862 | vla_ptr(vlabuf, d, ext_compat) + i * 16; | 2860 | vla_ptr(vlabuf, d, ext_compat) + i * 16; |
| 2863 | INIT_LIST_HEAD(&desc->ext_prop); | 2861 | INIT_LIST_HEAD(&desc->ext_prop); |
| 2864 | } | 2862 | } |
| 2865 | ret = ffs_do_os_descs(ffs->ms_os_descs_count, | 2863 | ret = ffs_do_os_descs(ffs->ms_os_descs_count, |
| 2866 | vla_ptr(vlabuf, d, raw_descs) + | 2864 | vla_ptr(vlabuf, d, raw_descs) + |
| 2867 | fs_len + hs_len + ss_len, | 2865 | fs_len + hs_len + ss_len, |
| 2868 | d_raw_descs__sz - fs_len - hs_len - ss_len, | 2866 | d_raw_descs__sz - fs_len - hs_len - |
| 2869 | __ffs_func_bind_do_os_desc, func); | 2867 | ss_len, |
| 2870 | if (unlikely(ret < 0)) | 2868 | __ffs_func_bind_do_os_desc, func); |
| 2871 | goto error; | 2869 | if (unlikely(ret < 0)) |
| 2870 | goto error; | ||
| 2871 | } | ||
| 2872 | func->function.os_desc_n = | 2872 | func->function.os_desc_n = |
| 2873 | c->cdev->use_os_string ? ffs->interfaces_count : 0; | 2873 | c->cdev->use_os_string ? ffs->interfaces_count : 0; |
| 2874 | 2874 | ||
diff --git a/drivers/usb/gadget/function/f_printer.c b/drivers/usb/gadget/function/f_printer.c index c45104e3a64b..64706a789580 100644 --- a/drivers/usb/gadget/function/f_printer.c +++ b/drivers/usb/gadget/function/f_printer.c | |||
| @@ -161,14 +161,6 @@ static struct usb_endpoint_descriptor hs_ep_out_desc = { | |||
| 161 | .wMaxPacketSize = cpu_to_le16(512) | 161 | .wMaxPacketSize = cpu_to_le16(512) |
| 162 | }; | 162 | }; |
| 163 | 163 | ||
| 164 | static struct usb_qualifier_descriptor dev_qualifier = { | ||
| 165 | .bLength = sizeof(dev_qualifier), | ||
| 166 | .bDescriptorType = USB_DT_DEVICE_QUALIFIER, | ||
| 167 | .bcdUSB = cpu_to_le16(0x0200), | ||
| 168 | .bDeviceClass = USB_CLASS_PRINTER, | ||
| 169 | .bNumConfigurations = 1 | ||
| 170 | }; | ||
| 171 | |||
| 172 | static struct usb_descriptor_header *hs_printer_function[] = { | 164 | static struct usb_descriptor_header *hs_printer_function[] = { |
| 173 | (struct usb_descriptor_header *) &intf_desc, | 165 | (struct usb_descriptor_header *) &intf_desc, |
| 174 | (struct usb_descriptor_header *) &hs_ep_in_desc, | 166 | (struct usb_descriptor_header *) &hs_ep_in_desc, |
diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c index 35fe3c80cfc0..197f73386fac 100644 --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c | |||
| @@ -1445,16 +1445,18 @@ static void usbg_drop_tpg(struct se_portal_group *se_tpg) | |||
| 1445 | for (i = 0; i < TPG_INSTANCES; ++i) | 1445 | for (i = 0; i < TPG_INSTANCES; ++i) |
| 1446 | if (tpg_instances[i].tpg == tpg) | 1446 | if (tpg_instances[i].tpg == tpg) |
| 1447 | break; | 1447 | break; |
| 1448 | if (i < TPG_INSTANCES) | 1448 | if (i < TPG_INSTANCES) { |
| 1449 | tpg_instances[i].tpg = NULL; | 1449 | tpg_instances[i].tpg = NULL; |
| 1450 | opts = container_of(tpg_instances[i].func_inst, | 1450 | opts = container_of(tpg_instances[i].func_inst, |
| 1451 | struct f_tcm_opts, func_inst); | 1451 | struct f_tcm_opts, func_inst); |
| 1452 | mutex_lock(&opts->dep_lock); | 1452 | mutex_lock(&opts->dep_lock); |
| 1453 | if (opts->has_dep) | 1453 | if (opts->has_dep) |
| 1454 | module_put(opts->dependent); | 1454 | module_put(opts->dependent); |
| 1455 | else | 1455 | else |
| 1456 | configfs_undepend_item_unlocked(&opts->func_inst.group.cg_item); | 1456 | configfs_undepend_item_unlocked( |
| 1457 | mutex_unlock(&opts->dep_lock); | 1457 | &opts->func_inst.group.cg_item); |
| 1458 | mutex_unlock(&opts->dep_lock); | ||
| 1459 | } | ||
| 1458 | mutex_unlock(&tpg_instances_lock); | 1460 | mutex_unlock(&tpg_instances_lock); |
| 1459 | 1461 | ||
| 1460 | kfree(tpg); | 1462 | kfree(tpg); |
diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c index 186d4b162524..cd214ec8a601 100644 --- a/drivers/usb/gadget/function/f_uac2.c +++ b/drivers/usb/gadget/function/f_uac2.c | |||
| @@ -598,18 +598,6 @@ static struct usb_gadget_strings *fn_strings[] = { | |||
| 598 | NULL, | 598 | NULL, |
| 599 | }; | 599 | }; |
| 600 | 600 | ||
| 601 | static struct usb_qualifier_descriptor devqual_desc = { | ||
| 602 | .bLength = sizeof devqual_desc, | ||
| 603 | .bDescriptorType = USB_DT_DEVICE_QUALIFIER, | ||
| 604 | |||
| 605 | .bcdUSB = cpu_to_le16(0x200), | ||
| 606 | .bDeviceClass = USB_CLASS_MISC, | ||
| 607 | .bDeviceSubClass = 0x02, | ||
| 608 | .bDeviceProtocol = 0x01, | ||
| 609 | .bNumConfigurations = 1, | ||
| 610 | .bRESERVED = 0, | ||
| 611 | }; | ||
| 612 | |||
| 613 | static struct usb_interface_assoc_descriptor iad_desc = { | 601 | static struct usb_interface_assoc_descriptor iad_desc = { |
| 614 | .bLength = sizeof iad_desc, | 602 | .bLength = sizeof iad_desc, |
| 615 | .bDescriptorType = USB_DT_INTERFACE_ASSOCIATION, | 603 | .bDescriptorType = USB_DT_INTERFACE_ASSOCIATION, |
| @@ -1292,6 +1280,7 @@ in_rq_cur(struct usb_function *fn, const struct usb_ctrlrequest *cr) | |||
| 1292 | 1280 | ||
| 1293 | if (control_selector == UAC2_CS_CONTROL_SAM_FREQ) { | 1281 | if (control_selector == UAC2_CS_CONTROL_SAM_FREQ) { |
| 1294 | struct cntrl_cur_lay3 c; | 1282 | struct cntrl_cur_lay3 c; |
| 1283 | memset(&c, 0, sizeof(struct cntrl_cur_lay3)); | ||
| 1295 | 1284 | ||
| 1296 | if (entity_id == USB_IN_CLK_ID) | 1285 | if (entity_id == USB_IN_CLK_ID) |
| 1297 | c.dCUR = p_srate; | 1286 | c.dCUR = p_srate; |
diff --git a/drivers/usb/gadget/function/storage_common.c b/drivers/usb/gadget/function/storage_common.c index d62683017cf3..990df221c629 100644 --- a/drivers/usb/gadget/function/storage_common.c +++ b/drivers/usb/gadget/function/storage_common.c | |||
| @@ -83,9 +83,7 @@ EXPORT_SYMBOL_GPL(fsg_fs_function); | |||
| 83 | * USB 2.0 devices need to expose both high speed and full speed | 83 | * USB 2.0 devices need to expose both high speed and full speed |
| 84 | * descriptors, unless they only run at full speed. | 84 | * descriptors, unless they only run at full speed. |
| 85 | * | 85 | * |
| 86 | * That means alternate endpoint descriptors (bigger packets) | 86 | * That means alternate endpoint descriptors (bigger packets). |
| 87 | * and a "device qualifier" ... plus more construction options | ||
| 88 | * for the configuration descriptor. | ||
| 89 | */ | 87 | */ |
| 90 | struct usb_endpoint_descriptor fsg_hs_bulk_in_desc = { | 88 | struct usb_endpoint_descriptor fsg_hs_bulk_in_desc = { |
| 91 | .bLength = USB_DT_ENDPOINT_SIZE, | 89 | .bLength = USB_DT_ENDPOINT_SIZE, |
diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c index e64479f882a5..aa3707bdebb4 100644 --- a/drivers/usb/gadget/legacy/inode.c +++ b/drivers/usb/gadget/legacy/inode.c | |||
| @@ -938,8 +938,11 @@ ep0_read (struct file *fd, char __user *buf, size_t len, loff_t *ptr) | |||
| 938 | struct usb_ep *ep = dev->gadget->ep0; | 938 | struct usb_ep *ep = dev->gadget->ep0; |
| 939 | struct usb_request *req = dev->req; | 939 | struct usb_request *req = dev->req; |
| 940 | 940 | ||
| 941 | if ((retval = setup_req (ep, req, 0)) == 0) | 941 | if ((retval = setup_req (ep, req, 0)) == 0) { |
| 942 | retval = usb_ep_queue (ep, req, GFP_ATOMIC); | 942 | spin_unlock_irq (&dev->lock); |
| 943 | retval = usb_ep_queue (ep, req, GFP_KERNEL); | ||
| 944 | spin_lock_irq (&dev->lock); | ||
| 945 | } | ||
| 943 | dev->state = STATE_DEV_CONNECTED; | 946 | dev->state = STATE_DEV_CONNECTED; |
| 944 | 947 | ||
| 945 | /* assume that was SET_CONFIGURATION */ | 948 | /* assume that was SET_CONFIGURATION */ |
| @@ -1457,8 +1460,11 @@ delegate: | |||
| 1457 | w_length); | 1460 | w_length); |
| 1458 | if (value < 0) | 1461 | if (value < 0) |
| 1459 | break; | 1462 | break; |
| 1463 | |||
| 1464 | spin_unlock (&dev->lock); | ||
| 1460 | value = usb_ep_queue (gadget->ep0, dev->req, | 1465 | value = usb_ep_queue (gadget->ep0, dev->req, |
| 1461 | GFP_ATOMIC); | 1466 | GFP_KERNEL); |
| 1467 | spin_lock (&dev->lock); | ||
| 1462 | if (value < 0) { | 1468 | if (value < 0) { |
| 1463 | clean_req (gadget->ep0, dev->req); | 1469 | clean_req (gadget->ep0, dev->req); |
| 1464 | break; | 1470 | break; |
| @@ -1481,11 +1487,14 @@ delegate: | |||
| 1481 | if (value >= 0 && dev->state != STATE_DEV_SETUP) { | 1487 | if (value >= 0 && dev->state != STATE_DEV_SETUP) { |
| 1482 | req->length = value; | 1488 | req->length = value; |
| 1483 | req->zero = value < w_length; | 1489 | req->zero = value < w_length; |
| 1484 | value = usb_ep_queue (gadget->ep0, req, GFP_ATOMIC); | 1490 | |
| 1491 | spin_unlock (&dev->lock); | ||
| 1492 | value = usb_ep_queue (gadget->ep0, req, GFP_KERNEL); | ||
| 1485 | if (value < 0) { | 1493 | if (value < 0) { |
| 1486 | DBG (dev, "ep_queue --> %d\n", value); | 1494 | DBG (dev, "ep_queue --> %d\n", value); |
| 1487 | req->status = 0; | 1495 | req->status = 0; |
| 1488 | } | 1496 | } |
| 1497 | return value; | ||
| 1489 | } | 1498 | } |
| 1490 | 1499 | ||
| 1491 | /* device stalls when value < 0 */ | 1500 | /* device stalls when value < 0 */ |
diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c index 6e8300d6a737..e1b2dcebdc2e 100644 --- a/drivers/usb/gadget/udc/udc-core.c +++ b/drivers/usb/gadget/udc/udc-core.c | |||
| @@ -603,11 +603,15 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver) | |||
| 603 | } | 603 | } |
| 604 | } | 604 | } |
| 605 | 605 | ||
| 606 | list_add_tail(&driver->pending, &gadget_driver_pending_list); | 606 | if (!driver->match_existing_only) { |
| 607 | pr_info("udc-core: couldn't find an available UDC - added [%s] to list of pending drivers\n", | 607 | list_add_tail(&driver->pending, &gadget_driver_pending_list); |
| 608 | driver->function); | 608 | pr_info("udc-core: couldn't find an available UDC - added [%s] to list of pending drivers\n", |
| 609 | driver->function); | ||
| 610 | ret = 0; | ||
| 611 | } | ||
| 612 | |||
| 609 | mutex_unlock(&udc_lock); | 613 | mutex_unlock(&udc_lock); |
| 610 | return 0; | 614 | return ret; |
| 611 | found: | 615 | found: |
| 612 | ret = udc_bind_to_driver(udc, driver); | 616 | ret = udc_bind_to_driver(udc, driver); |
| 613 | mutex_unlock(&udc_lock); | 617 | mutex_unlock(&udc_lock); |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index ae1b6e69eb96..a962b89b65a6 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
| @@ -368,6 +368,15 @@ static void ehci_shutdown(struct usb_hcd *hcd) | |||
| 368 | { | 368 | { |
| 369 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | 369 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); |
| 370 | 370 | ||
| 371 | /** | ||
| 372 | * Protect the system from crashing at system shutdown in cases where | ||
| 373 | * usb host is not added yet from OTG controller driver. | ||
| 374 | * As ehci_setup() not done yet, so stop accessing registers or | ||
| 375 | * variables initialized in ehci_setup() | ||
| 376 | */ | ||
| 377 | if (!ehci->sbrn) | ||
| 378 | return; | ||
| 379 | |||
| 371 | spin_lock_irq(&ehci->lock); | 380 | spin_lock_irq(&ehci->lock); |
| 372 | ehci->shutdown = true; | 381 | ehci->shutdown = true; |
| 373 | ehci->rh_state = EHCI_RH_STOPPING; | 382 | ehci->rh_state = EHCI_RH_STOPPING; |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index ffc90295a95f..74f62d68f013 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
| @@ -872,15 +872,23 @@ int ehci_hub_control( | |||
| 872 | ) { | 872 | ) { |
| 873 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); | 873 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); |
| 874 | int ports = HCS_N_PORTS (ehci->hcs_params); | 874 | int ports = HCS_N_PORTS (ehci->hcs_params); |
| 875 | u32 __iomem *status_reg = &ehci->regs->port_status[ | 875 | u32 __iomem *status_reg, *hostpc_reg; |
| 876 | (wIndex & 0xff) - 1]; | ||
| 877 | u32 __iomem *hostpc_reg = &ehci->regs->hostpc[(wIndex & 0xff) - 1]; | ||
| 878 | u32 temp, temp1, status; | 876 | u32 temp, temp1, status; |
| 879 | unsigned long flags; | 877 | unsigned long flags; |
| 880 | int retval = 0; | 878 | int retval = 0; |
| 881 | unsigned selector; | 879 | unsigned selector; |
| 882 | 880 | ||
| 883 | /* | 881 | /* |
| 882 | * Avoid underflow while calculating (wIndex & 0xff) - 1. | ||
| 883 | * The compiler might deduce that wIndex can never be 0 and then | ||
| 884 | * optimize away the tests for !wIndex below. | ||
| 885 | */ | ||
| 886 | temp = wIndex & 0xff; | ||
| 887 | temp -= (temp > 0); | ||
| 888 | status_reg = &ehci->regs->port_status[temp]; | ||
| 889 | hostpc_reg = &ehci->regs->hostpc[temp]; | ||
| 890 | |||
| 891 | /* | ||
| 884 | * FIXME: support SetPortFeatures USB_PORT_FEAT_INDICATOR. | 892 | * FIXME: support SetPortFeatures USB_PORT_FEAT_INDICATOR. |
| 885 | * HCS_INDICATOR may say we can change LEDs to off/amber/green. | 893 | * HCS_INDICATOR may say we can change LEDs to off/amber/green. |
| 886 | * (track current state ourselves) ... blink for diagnostics, | 894 | * (track current state ourselves) ... blink for diagnostics, |
diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c index d3afc89d00f5..2f8d3af811ce 100644 --- a/drivers/usb/host/ehci-msm.c +++ b/drivers/usb/host/ehci-msm.c | |||
| @@ -179,22 +179,32 @@ static int ehci_msm_remove(struct platform_device *pdev) | |||
| 179 | static int ehci_msm_pm_suspend(struct device *dev) | 179 | static int ehci_msm_pm_suspend(struct device *dev) |
| 180 | { | 180 | { |
| 181 | struct usb_hcd *hcd = dev_get_drvdata(dev); | 181 | struct usb_hcd *hcd = dev_get_drvdata(dev); |
| 182 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | ||
| 182 | bool do_wakeup = device_may_wakeup(dev); | 183 | bool do_wakeup = device_may_wakeup(dev); |
| 183 | 184 | ||
| 184 | dev_dbg(dev, "ehci-msm PM suspend\n"); | 185 | dev_dbg(dev, "ehci-msm PM suspend\n"); |
| 185 | 186 | ||
| 186 | return ehci_suspend(hcd, do_wakeup); | 187 | /* Only call ehci_suspend if ehci_setup has been done */ |
| 188 | if (ehci->sbrn) | ||
| 189 | return ehci_suspend(hcd, do_wakeup); | ||
| 190 | |||
| 191 | return 0; | ||
| 187 | } | 192 | } |
| 188 | 193 | ||
| 189 | static int ehci_msm_pm_resume(struct device *dev) | 194 | static int ehci_msm_pm_resume(struct device *dev) |
| 190 | { | 195 | { |
| 191 | struct usb_hcd *hcd = dev_get_drvdata(dev); | 196 | struct usb_hcd *hcd = dev_get_drvdata(dev); |
| 197 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | ||
| 192 | 198 | ||
| 193 | dev_dbg(dev, "ehci-msm PM resume\n"); | 199 | dev_dbg(dev, "ehci-msm PM resume\n"); |
| 194 | ehci_resume(hcd, false); | 200 | |
| 201 | /* Only call ehci_resume if ehci_setup has been done */ | ||
| 202 | if (ehci->sbrn) | ||
| 203 | ehci_resume(hcd, false); | ||
| 195 | 204 | ||
| 196 | return 0; | 205 | return 0; |
| 197 | } | 206 | } |
| 207 | |||
| 198 | #else | 208 | #else |
| 199 | #define ehci_msm_pm_suspend NULL | 209 | #define ehci_msm_pm_suspend NULL |
| 200 | #define ehci_msm_pm_resume NULL | 210 | #define ehci_msm_pm_resume NULL |
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index 4031b372008e..9a3d7db5be57 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c | |||
| @@ -81,15 +81,23 @@ static int tegra_reset_usb_controller(struct platform_device *pdev) | |||
| 81 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | 81 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
| 82 | struct tegra_ehci_hcd *tegra = | 82 | struct tegra_ehci_hcd *tegra = |
| 83 | (struct tegra_ehci_hcd *)hcd_to_ehci(hcd)->priv; | 83 | (struct tegra_ehci_hcd *)hcd_to_ehci(hcd)->priv; |
| 84 | bool has_utmi_pad_registers = false; | ||
| 84 | 85 | ||
| 85 | phy_np = of_parse_phandle(pdev->dev.of_node, "nvidia,phy", 0); | 86 | phy_np = of_parse_phandle(pdev->dev.of_node, "nvidia,phy", 0); |
| 86 | if (!phy_np) | 87 | if (!phy_np) |
| 87 | return -ENOENT; | 88 | return -ENOENT; |
| 88 | 89 | ||
| 90 | if (of_property_read_bool(phy_np, "nvidia,has-utmi-pad-registers")) | ||
| 91 | has_utmi_pad_registers = true; | ||
| 92 | |||
| 89 | if (!usb1_reset_attempted) { | 93 | if (!usb1_reset_attempted) { |
| 90 | struct reset_control *usb1_reset; | 94 | struct reset_control *usb1_reset; |
| 91 | 95 | ||
| 92 | usb1_reset = of_reset_control_get(phy_np, "usb"); | 96 | if (!has_utmi_pad_registers) |
| 97 | usb1_reset = of_reset_control_get(phy_np, "utmi-pads"); | ||
| 98 | else | ||
| 99 | usb1_reset = tegra->rst; | ||
| 100 | |||
| 93 | if (IS_ERR(usb1_reset)) { | 101 | if (IS_ERR(usb1_reset)) { |
| 94 | dev_warn(&pdev->dev, | 102 | dev_warn(&pdev->dev, |
| 95 | "can't get utmi-pads reset from the PHY\n"); | 103 | "can't get utmi-pads reset from the PHY\n"); |
| @@ -99,13 +107,15 @@ static int tegra_reset_usb_controller(struct platform_device *pdev) | |||
| 99 | reset_control_assert(usb1_reset); | 107 | reset_control_assert(usb1_reset); |
| 100 | udelay(1); | 108 | udelay(1); |
| 101 | reset_control_deassert(usb1_reset); | 109 | reset_control_deassert(usb1_reset); |
| 110 | |||
| 111 | if (!has_utmi_pad_registers) | ||
| 112 | reset_control_put(usb1_reset); | ||
| 102 | } | 113 | } |
| 103 | 114 | ||
| 104 | reset_control_put(usb1_reset); | ||
| 105 | usb1_reset_attempted = true; | 115 | usb1_reset_attempted = true; |
| 106 | } | 116 | } |
| 107 | 117 | ||
| 108 | if (!of_property_read_bool(phy_np, "nvidia,has-utmi-pad-registers")) { | 118 | if (!has_utmi_pad_registers) { |
| 109 | reset_control_assert(tegra->rst); | 119 | reset_control_assert(tegra->rst); |
| 110 | udelay(1); | 120 | udelay(1); |
| 111 | reset_control_deassert(tegra->rst); | 121 | reset_control_deassert(tegra->rst); |
diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c index d029bbe9eb36..641fed609911 100644 --- a/drivers/usb/host/ohci-q.c +++ b/drivers/usb/host/ohci-q.c | |||
| @@ -183,7 +183,6 @@ static int ed_schedule (struct ohci_hcd *ohci, struct ed *ed) | |||
| 183 | { | 183 | { |
| 184 | int branch; | 184 | int branch; |
| 185 | 185 | ||
| 186 | ed->state = ED_OPER; | ||
| 187 | ed->ed_prev = NULL; | 186 | ed->ed_prev = NULL; |
| 188 | ed->ed_next = NULL; | 187 | ed->ed_next = NULL; |
| 189 | ed->hwNextED = 0; | 188 | ed->hwNextED = 0; |
| @@ -259,6 +258,8 @@ static int ed_schedule (struct ohci_hcd *ohci, struct ed *ed) | |||
| 259 | /* the HC may not see the schedule updates yet, but if it does | 258 | /* the HC may not see the schedule updates yet, but if it does |
| 260 | * then they'll be properly ordered. | 259 | * then they'll be properly ordered. |
| 261 | */ | 260 | */ |
| 261 | |||
| 262 | ed->state = ED_OPER; | ||
| 262 | return 0; | 263 | return 0; |
| 263 | } | 264 | } |
| 264 | 265 | ||
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 48672fac7ff3..c10972fcc8e4 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
| @@ -37,6 +37,7 @@ | |||
| 37 | /* Device for a quirk */ | 37 | /* Device for a quirk */ |
| 38 | #define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73 | 38 | #define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73 |
| 39 | #define PCI_DEVICE_ID_FRESCO_LOGIC_PDK 0x1000 | 39 | #define PCI_DEVICE_ID_FRESCO_LOGIC_PDK 0x1000 |
| 40 | #define PCI_DEVICE_ID_FRESCO_LOGIC_FL1009 0x1009 | ||
| 40 | #define PCI_DEVICE_ID_FRESCO_LOGIC_FL1400 0x1400 | 41 | #define PCI_DEVICE_ID_FRESCO_LOGIC_FL1400 0x1400 |
| 41 | 42 | ||
| 42 | #define PCI_VENDOR_ID_ETRON 0x1b6f | 43 | #define PCI_VENDOR_ID_ETRON 0x1b6f |
| @@ -114,6 +115,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
| 114 | xhci->quirks |= XHCI_TRUST_TX_LENGTH; | 115 | xhci->quirks |= XHCI_TRUST_TX_LENGTH; |
| 115 | } | 116 | } |
| 116 | 117 | ||
| 118 | if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC && | ||
| 119 | pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1009) | ||
| 120 | xhci->quirks |= XHCI_BROKEN_STREAMS; | ||
| 121 | |||
| 117 | if (pdev->vendor == PCI_VENDOR_ID_NEC) | 122 | if (pdev->vendor == PCI_VENDOR_ID_NEC) |
| 118 | xhci->quirks |= XHCI_NEC_HOST; | 123 | xhci->quirks |= XHCI_NEC_HOST; |
| 119 | 124 | ||
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 676ea458148b..1f3f981fe7f8 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c | |||
| @@ -196,6 +196,9 @@ static int xhci_plat_probe(struct platform_device *pdev) | |||
| 196 | ret = clk_prepare_enable(clk); | 196 | ret = clk_prepare_enable(clk); |
| 197 | if (ret) | 197 | if (ret) |
| 198 | goto put_hcd; | 198 | goto put_hcd; |
| 199 | } else if (PTR_ERR(clk) == -EPROBE_DEFER) { | ||
| 200 | ret = -EPROBE_DEFER; | ||
| 201 | goto put_hcd; | ||
| 199 | } | 202 | } |
| 200 | 203 | ||
| 201 | xhci = hcd_to_xhci(hcd); | 204 | xhci = hcd_to_xhci(hcd); |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 52deae4b7eac..d7d502578d79 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
| @@ -290,6 +290,14 @@ static int xhci_abort_cmd_ring(struct xhci_hcd *xhci) | |||
| 290 | 290 | ||
| 291 | temp_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); | 291 | temp_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); |
| 292 | xhci->cmd_ring_state = CMD_RING_STATE_ABORTED; | 292 | xhci->cmd_ring_state = CMD_RING_STATE_ABORTED; |
| 293 | |||
| 294 | /* | ||
| 295 | * Writing the CMD_RING_ABORT bit should cause a cmd completion event, | ||
| 296 | * however on some host hw the CMD_RING_RUNNING bit is correctly cleared | ||
| 297 | * but the completion event in never sent. Use the cmd timeout timer to | ||
| 298 | * handle those cases. Use twice the time to cover the bit polling retry | ||
| 299 | */ | ||
| 300 | mod_timer(&xhci->cmd_timer, jiffies + (2 * XHCI_CMD_DEFAULT_TIMEOUT)); | ||
| 293 | xhci_write_64(xhci, temp_64 | CMD_RING_ABORT, | 301 | xhci_write_64(xhci, temp_64 | CMD_RING_ABORT, |
| 294 | &xhci->op_regs->cmd_ring); | 302 | &xhci->op_regs->cmd_ring); |
| 295 | 303 | ||
| @@ -314,6 +322,7 @@ static int xhci_abort_cmd_ring(struct xhci_hcd *xhci) | |||
| 314 | 322 | ||
| 315 | xhci_err(xhci, "Stopped the command ring failed, " | 323 | xhci_err(xhci, "Stopped the command ring failed, " |
| 316 | "maybe the host is dead\n"); | 324 | "maybe the host is dead\n"); |
| 325 | del_timer(&xhci->cmd_timer); | ||
| 317 | xhci->xhc_state |= XHCI_STATE_DYING; | 326 | xhci->xhc_state |= XHCI_STATE_DYING; |
| 318 | xhci_quiesce(xhci); | 327 | xhci_quiesce(xhci); |
| 319 | xhci_halt(xhci); | 328 | xhci_halt(xhci); |
| @@ -1246,22 +1255,21 @@ void xhci_handle_command_timeout(unsigned long data) | |||
| 1246 | int ret; | 1255 | int ret; |
| 1247 | unsigned long flags; | 1256 | unsigned long flags; |
| 1248 | u64 hw_ring_state; | 1257 | u64 hw_ring_state; |
| 1249 | struct xhci_command *cur_cmd = NULL; | 1258 | bool second_timeout = false; |
| 1250 | xhci = (struct xhci_hcd *) data; | 1259 | xhci = (struct xhci_hcd *) data; |
| 1251 | 1260 | ||
| 1252 | /* mark this command to be cancelled */ | 1261 | /* mark this command to be cancelled */ |
| 1253 | spin_lock_irqsave(&xhci->lock, flags); | 1262 | spin_lock_irqsave(&xhci->lock, flags); |
| 1254 | if (xhci->current_cmd) { | 1263 | if (xhci->current_cmd) { |
| 1255 | cur_cmd = xhci->current_cmd; | 1264 | if (xhci->current_cmd->status == COMP_CMD_ABORT) |
| 1256 | cur_cmd->status = COMP_CMD_ABORT; | 1265 | second_timeout = true; |
| 1266 | xhci->current_cmd->status = COMP_CMD_ABORT; | ||
| 1257 | } | 1267 | } |
| 1258 | 1268 | ||
| 1259 | |||
| 1260 | /* Make sure command ring is running before aborting it */ | 1269 | /* Make sure command ring is running before aborting it */ |
| 1261 | hw_ring_state = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); | 1270 | hw_ring_state = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); |
| 1262 | if ((xhci->cmd_ring_state & CMD_RING_STATE_RUNNING) && | 1271 | if ((xhci->cmd_ring_state & CMD_RING_STATE_RUNNING) && |
| 1263 | (hw_ring_state & CMD_RING_RUNNING)) { | 1272 | (hw_ring_state & CMD_RING_RUNNING)) { |
| 1264 | |||
| 1265 | spin_unlock_irqrestore(&xhci->lock, flags); | 1273 | spin_unlock_irqrestore(&xhci->lock, flags); |
| 1266 | xhci_dbg(xhci, "Command timeout\n"); | 1274 | xhci_dbg(xhci, "Command timeout\n"); |
| 1267 | ret = xhci_abort_cmd_ring(xhci); | 1275 | ret = xhci_abort_cmd_ring(xhci); |
| @@ -1273,6 +1281,15 @@ void xhci_handle_command_timeout(unsigned long data) | |||
| 1273 | } | 1281 | } |
| 1274 | return; | 1282 | return; |
| 1275 | } | 1283 | } |
| 1284 | |||
| 1285 | /* command ring failed to restart, or host removed. Bail out */ | ||
| 1286 | if (second_timeout || xhci->xhc_state & XHCI_STATE_REMOVING) { | ||
| 1287 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
| 1288 | xhci_dbg(xhci, "command timed out twice, ring start fail?\n"); | ||
| 1289 | xhci_cleanup_command_queue(xhci); | ||
| 1290 | return; | ||
| 1291 | } | ||
| 1292 | |||
| 1276 | /* command timeout on stopped ring, ring can't be aborted */ | 1293 | /* command timeout on stopped ring, ring can't be aborted */ |
| 1277 | xhci_dbg(xhci, "Command timeout on stopped ring\n"); | 1294 | xhci_dbg(xhci, "Command timeout on stopped ring\n"); |
| 1278 | xhci_handle_stopped_cmd_ring(xhci, xhci->current_cmd); | 1295 | xhci_handle_stopped_cmd_ring(xhci, xhci->current_cmd); |
| @@ -2721,7 +2738,8 @@ hw_died: | |||
| 2721 | writel(irq_pending, &xhci->ir_set->irq_pending); | 2738 | writel(irq_pending, &xhci->ir_set->irq_pending); |
| 2722 | } | 2739 | } |
| 2723 | 2740 | ||
| 2724 | if (xhci->xhc_state & XHCI_STATE_DYING) { | 2741 | if (xhci->xhc_state & XHCI_STATE_DYING || |
| 2742 | xhci->xhc_state & XHCI_STATE_HALTED) { | ||
| 2725 | xhci_dbg(xhci, "xHCI dying, ignoring interrupt. " | 2743 | xhci_dbg(xhci, "xHCI dying, ignoring interrupt. " |
| 2726 | "Shouldn't IRQs be disabled?\n"); | 2744 | "Shouldn't IRQs be disabled?\n"); |
| 2727 | /* Clear the event handler busy flag (RW1C); | 2745 | /* Clear the event handler busy flag (RW1C); |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index fa7e1ef36cd9..f2f9518c53ab 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
| @@ -685,20 +685,23 @@ void xhci_stop(struct usb_hcd *hcd) | |||
| 685 | u32 temp; | 685 | u32 temp; |
| 686 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); | 686 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); |
| 687 | 687 | ||
| 688 | if (xhci->xhc_state & XHCI_STATE_HALTED) | ||
| 689 | return; | ||
| 690 | |||
| 691 | mutex_lock(&xhci->mutex); | 688 | mutex_lock(&xhci->mutex); |
| 692 | spin_lock_irq(&xhci->lock); | ||
| 693 | xhci->xhc_state |= XHCI_STATE_HALTED; | ||
| 694 | xhci->cmd_ring_state = CMD_RING_STATE_STOPPED; | ||
| 695 | 689 | ||
| 696 | /* Make sure the xHC is halted for a USB3 roothub | 690 | if (!(xhci->xhc_state & XHCI_STATE_HALTED)) { |
| 697 | * (xhci_stop() could be called as part of failed init). | 691 | spin_lock_irq(&xhci->lock); |
| 698 | */ | 692 | |
| 699 | xhci_halt(xhci); | 693 | xhci->xhc_state |= XHCI_STATE_HALTED; |
| 700 | xhci_reset(xhci); | 694 | xhci->cmd_ring_state = CMD_RING_STATE_STOPPED; |
| 701 | spin_unlock_irq(&xhci->lock); | 695 | xhci_halt(xhci); |
| 696 | xhci_reset(xhci); | ||
| 697 | |||
| 698 | spin_unlock_irq(&xhci->lock); | ||
| 699 | } | ||
| 700 | |||
| 701 | if (!usb_hcd_is_primary_hcd(hcd)) { | ||
| 702 | mutex_unlock(&xhci->mutex); | ||
| 703 | return; | ||
| 704 | } | ||
| 702 | 705 | ||
| 703 | xhci_cleanup_msix(xhci); | 706 | xhci_cleanup_msix(xhci); |
| 704 | 707 | ||
| @@ -4886,7 +4889,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) | |||
| 4886 | xhci->hcc_params2 = readl(&xhci->cap_regs->hcc_params2); | 4889 | xhci->hcc_params2 = readl(&xhci->cap_regs->hcc_params2); |
| 4887 | xhci_print_registers(xhci); | 4890 | xhci_print_registers(xhci); |
| 4888 | 4891 | ||
| 4889 | xhci->quirks = quirks; | 4892 | xhci->quirks |= quirks; |
| 4890 | 4893 | ||
| 4891 | get_quirks(dev, xhci); | 4894 | get_quirks(dev, xhci); |
| 4892 | 4895 | ||
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 39fd95833eb8..f824336def5c 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
| @@ -1090,29 +1090,6 @@ void musb_stop(struct musb *musb) | |||
| 1090 | musb_platform_try_idle(musb, 0); | 1090 | musb_platform_try_idle(musb, 0); |
| 1091 | } | 1091 | } |
| 1092 | 1092 | ||
| 1093 | static void musb_shutdown(struct platform_device *pdev) | ||
| 1094 | { | ||
| 1095 | struct musb *musb = dev_to_musb(&pdev->dev); | ||
| 1096 | unsigned long flags; | ||
| 1097 | |||
| 1098 | pm_runtime_get_sync(musb->controller); | ||
| 1099 | |||
| 1100 | musb_host_cleanup(musb); | ||
| 1101 | musb_gadget_cleanup(musb); | ||
| 1102 | |||
| 1103 | spin_lock_irqsave(&musb->lock, flags); | ||
| 1104 | musb_platform_disable(musb); | ||
| 1105 | musb_generic_disable(musb); | ||
| 1106 | spin_unlock_irqrestore(&musb->lock, flags); | ||
| 1107 | |||
| 1108 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); | ||
| 1109 | musb_platform_exit(musb); | ||
| 1110 | |||
| 1111 | pm_runtime_put(musb->controller); | ||
| 1112 | /* FIXME power down */ | ||
| 1113 | } | ||
| 1114 | |||
| 1115 | |||
| 1116 | /*-------------------------------------------------------------------------*/ | 1093 | /*-------------------------------------------------------------------------*/ |
| 1117 | 1094 | ||
| 1118 | /* | 1095 | /* |
| @@ -1702,7 +1679,7 @@ EXPORT_SYMBOL_GPL(musb_dma_completion); | |||
| 1702 | #define use_dma 0 | 1679 | #define use_dma 0 |
| 1703 | #endif | 1680 | #endif |
| 1704 | 1681 | ||
| 1705 | static void (*musb_phy_callback)(enum musb_vbus_id_status status); | 1682 | static int (*musb_phy_callback)(enum musb_vbus_id_status status); |
| 1706 | 1683 | ||
| 1707 | /* | 1684 | /* |
| 1708 | * musb_mailbox - optional phy notifier function | 1685 | * musb_mailbox - optional phy notifier function |
| @@ -1711,11 +1688,12 @@ static void (*musb_phy_callback)(enum musb_vbus_id_status status); | |||
| 1711 | * Optionally gets called from the USB PHY. Note that the USB PHY must be | 1688 | * Optionally gets called from the USB PHY. Note that the USB PHY must be |
| 1712 | * disabled at the point the phy_callback is registered or unregistered. | 1689 | * disabled at the point the phy_callback is registered or unregistered. |
| 1713 | */ | 1690 | */ |
| 1714 | void musb_mailbox(enum musb_vbus_id_status status) | 1691 | int musb_mailbox(enum musb_vbus_id_status status) |
| 1715 | { | 1692 | { |
| 1716 | if (musb_phy_callback) | 1693 | if (musb_phy_callback) |
| 1717 | musb_phy_callback(status); | 1694 | return musb_phy_callback(status); |
| 1718 | 1695 | ||
| 1696 | return -ENODEV; | ||
| 1719 | }; | 1697 | }; |
| 1720 | EXPORT_SYMBOL_GPL(musb_mailbox); | 1698 | EXPORT_SYMBOL_GPL(musb_mailbox); |
| 1721 | 1699 | ||
| @@ -2028,11 +2006,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
| 2028 | musb_readl = musb_default_readl; | 2006 | musb_readl = musb_default_readl; |
| 2029 | musb_writel = musb_default_writel; | 2007 | musb_writel = musb_default_writel; |
| 2030 | 2008 | ||
| 2031 | /* We need musb_read/write functions initialized for PM */ | ||
| 2032 | pm_runtime_use_autosuspend(musb->controller); | ||
| 2033 | pm_runtime_set_autosuspend_delay(musb->controller, 200); | ||
| 2034 | pm_runtime_enable(musb->controller); | ||
| 2035 | |||
| 2036 | /* The musb_platform_init() call: | 2009 | /* The musb_platform_init() call: |
| 2037 | * - adjusts musb->mregs | 2010 | * - adjusts musb->mregs |
| 2038 | * - sets the musb->isr | 2011 | * - sets the musb->isr |
| @@ -2134,6 +2107,16 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
| 2134 | if (musb->ops->phy_callback) | 2107 | if (musb->ops->phy_callback) |
| 2135 | musb_phy_callback = musb->ops->phy_callback; | 2108 | musb_phy_callback = musb->ops->phy_callback; |
| 2136 | 2109 | ||
| 2110 | /* | ||
| 2111 | * We need musb_read/write functions initialized for PM. | ||
| 2112 | * Note that at least 2430 glue needs autosuspend delay | ||
| 2113 | * somewhere above 300 ms for the hardware to idle properly | ||
| 2114 | * after disconnecting the cable in host mode. Let's use | ||
| 2115 | * 500 ms for some margin. | ||
| 2116 | */ | ||
| 2117 | pm_runtime_use_autosuspend(musb->controller); | ||
| 2118 | pm_runtime_set_autosuspend_delay(musb->controller, 500); | ||
| 2119 | pm_runtime_enable(musb->controller); | ||
| 2137 | pm_runtime_get_sync(musb->controller); | 2120 | pm_runtime_get_sync(musb->controller); |
| 2138 | 2121 | ||
| 2139 | status = usb_phy_init(musb->xceiv); | 2122 | status = usb_phy_init(musb->xceiv); |
| @@ -2237,13 +2220,8 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
| 2237 | if (status) | 2220 | if (status) |
| 2238 | goto fail5; | 2221 | goto fail5; |
| 2239 | 2222 | ||
| 2240 | pm_runtime_put(musb->controller); | 2223 | pm_runtime_mark_last_busy(musb->controller); |
| 2241 | 2224 | pm_runtime_put_autosuspend(musb->controller); | |
| 2242 | /* | ||
| 2243 | * For why this is currently needed, see commit 3e43a0725637 | ||
| 2244 | * ("usb: musb: core: add pm_runtime_irq_safe()") | ||
| 2245 | */ | ||
| 2246 | pm_runtime_irq_safe(musb->controller); | ||
| 2247 | 2225 | ||
| 2248 | return 0; | 2226 | return 0; |
| 2249 | 2227 | ||
| @@ -2265,7 +2243,9 @@ fail2_5: | |||
| 2265 | usb_phy_shutdown(musb->xceiv); | 2243 | usb_phy_shutdown(musb->xceiv); |
| 2266 | 2244 | ||
| 2267 | err_usb_phy_init: | 2245 | err_usb_phy_init: |
| 2246 | pm_runtime_dont_use_autosuspend(musb->controller); | ||
| 2268 | pm_runtime_put_sync(musb->controller); | 2247 | pm_runtime_put_sync(musb->controller); |
| 2248 | pm_runtime_disable(musb->controller); | ||
| 2269 | 2249 | ||
| 2270 | fail2: | 2250 | fail2: |
| 2271 | if (musb->irq_wake) | 2251 | if (musb->irq_wake) |
| @@ -2273,7 +2253,6 @@ fail2: | |||
| 2273 | musb_platform_exit(musb); | 2253 | musb_platform_exit(musb); |
| 2274 | 2254 | ||
| 2275 | fail1: | 2255 | fail1: |
| 2276 | pm_runtime_disable(musb->controller); | ||
| 2277 | dev_err(musb->controller, | 2256 | dev_err(musb->controller, |
| 2278 | "musb_init_controller failed with status %d\n", status); | 2257 | "musb_init_controller failed with status %d\n", status); |
| 2279 | 2258 | ||
| @@ -2312,6 +2291,7 @@ static int musb_remove(struct platform_device *pdev) | |||
| 2312 | { | 2291 | { |
| 2313 | struct device *dev = &pdev->dev; | 2292 | struct device *dev = &pdev->dev; |
| 2314 | struct musb *musb = dev_to_musb(dev); | 2293 | struct musb *musb = dev_to_musb(dev); |
| 2294 | unsigned long flags; | ||
| 2315 | 2295 | ||
| 2316 | /* this gets called on rmmod. | 2296 | /* this gets called on rmmod. |
| 2317 | * - Host mode: host may still be active | 2297 | * - Host mode: host may still be active |
| @@ -2319,17 +2299,26 @@ static int musb_remove(struct platform_device *pdev) | |||
| 2319 | * - OTG mode: both roles are deactivated (or never-activated) | 2299 | * - OTG mode: both roles are deactivated (or never-activated) |
| 2320 | */ | 2300 | */ |
| 2321 | musb_exit_debugfs(musb); | 2301 | musb_exit_debugfs(musb); |
| 2322 | musb_shutdown(pdev); | ||
| 2323 | musb_phy_callback = NULL; | ||
| 2324 | |||
| 2325 | if (musb->dma_controller) | ||
| 2326 | musb_dma_controller_destroy(musb->dma_controller); | ||
| 2327 | |||
| 2328 | usb_phy_shutdown(musb->xceiv); | ||
| 2329 | 2302 | ||
| 2330 | cancel_work_sync(&musb->irq_work); | 2303 | cancel_work_sync(&musb->irq_work); |
| 2331 | cancel_delayed_work_sync(&musb->finish_resume_work); | 2304 | cancel_delayed_work_sync(&musb->finish_resume_work); |
| 2332 | cancel_delayed_work_sync(&musb->deassert_reset_work); | 2305 | cancel_delayed_work_sync(&musb->deassert_reset_work); |
| 2306 | pm_runtime_get_sync(musb->controller); | ||
| 2307 | musb_host_cleanup(musb); | ||
| 2308 | musb_gadget_cleanup(musb); | ||
| 2309 | spin_lock_irqsave(&musb->lock, flags); | ||
| 2310 | musb_platform_disable(musb); | ||
| 2311 | musb_generic_disable(musb); | ||
| 2312 | spin_unlock_irqrestore(&musb->lock, flags); | ||
| 2313 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); | ||
| 2314 | pm_runtime_dont_use_autosuspend(musb->controller); | ||
| 2315 | pm_runtime_put_sync(musb->controller); | ||
| 2316 | pm_runtime_disable(musb->controller); | ||
| 2317 | musb_platform_exit(musb); | ||
| 2318 | musb_phy_callback = NULL; | ||
| 2319 | if (musb->dma_controller) | ||
| 2320 | musb_dma_controller_destroy(musb->dma_controller); | ||
| 2321 | usb_phy_shutdown(musb->xceiv); | ||
| 2333 | musb_free(musb); | 2322 | musb_free(musb); |
| 2334 | device_init_wakeup(dev, 0); | 2323 | device_init_wakeup(dev, 0); |
| 2335 | return 0; | 2324 | return 0; |
| @@ -2429,7 +2418,8 @@ static void musb_restore_context(struct musb *musb) | |||
| 2429 | musb_writew(musb_base, MUSB_INTRTXE, musb->intrtxe); | 2418 | musb_writew(musb_base, MUSB_INTRTXE, musb->intrtxe); |
| 2430 | musb_writew(musb_base, MUSB_INTRRXE, musb->intrrxe); | 2419 | musb_writew(musb_base, MUSB_INTRRXE, musb->intrrxe); |
| 2431 | musb_writeb(musb_base, MUSB_INTRUSBE, musb->context.intrusbe); | 2420 | musb_writeb(musb_base, MUSB_INTRUSBE, musb->context.intrusbe); |
| 2432 | musb_writeb(musb_base, MUSB_DEVCTL, musb->context.devctl); | 2421 | if (musb->context.devctl & MUSB_DEVCTL_SESSION) |
| 2422 | musb_writeb(musb_base, MUSB_DEVCTL, musb->context.devctl); | ||
| 2433 | 2423 | ||
| 2434 | for (i = 0; i < musb->config->num_eps; ++i) { | 2424 | for (i = 0; i < musb->config->num_eps; ++i) { |
| 2435 | struct musb_hw_ep *hw_ep; | 2425 | struct musb_hw_ep *hw_ep; |
| @@ -2612,7 +2602,6 @@ static struct platform_driver musb_driver = { | |||
| 2612 | }, | 2602 | }, |
| 2613 | .probe = musb_probe, | 2603 | .probe = musb_probe, |
| 2614 | .remove = musb_remove, | 2604 | .remove = musb_remove, |
| 2615 | .shutdown = musb_shutdown, | ||
| 2616 | }; | 2605 | }; |
| 2617 | 2606 | ||
| 2618 | module_platform_driver(musb_driver); | 2607 | module_platform_driver(musb_driver); |
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index b6afe9e43305..b55a776b03eb 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
| @@ -215,7 +215,7 @@ struct musb_platform_ops { | |||
| 215 | dma_addr_t *dma_addr, u32 *len); | 215 | dma_addr_t *dma_addr, u32 *len); |
| 216 | void (*pre_root_reset_end)(struct musb *musb); | 216 | void (*pre_root_reset_end)(struct musb *musb); |
| 217 | void (*post_root_reset_end)(struct musb *musb); | 217 | void (*post_root_reset_end)(struct musb *musb); |
| 218 | void (*phy_callback)(enum musb_vbus_id_status status); | 218 | int (*phy_callback)(enum musb_vbus_id_status status); |
| 219 | }; | 219 | }; |
| 220 | 220 | ||
| 221 | /* | 221 | /* |
| @@ -312,6 +312,7 @@ struct musb { | |||
| 312 | struct work_struct irq_work; | 312 | struct work_struct irq_work; |
| 313 | struct delayed_work deassert_reset_work; | 313 | struct delayed_work deassert_reset_work; |
| 314 | struct delayed_work finish_resume_work; | 314 | struct delayed_work finish_resume_work; |
| 315 | struct delayed_work gadget_work; | ||
| 315 | u16 hwvers; | 316 | u16 hwvers; |
| 316 | 317 | ||
| 317 | u16 intrrxe; | 318 | u16 intrrxe; |
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 152865b36522..af2a3a7addf9 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
| @@ -1656,6 +1656,20 @@ static int musb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA) | |||
| 1656 | return usb_phy_set_power(musb->xceiv, mA); | 1656 | return usb_phy_set_power(musb->xceiv, mA); |
| 1657 | } | 1657 | } |
| 1658 | 1658 | ||
| 1659 | static void musb_gadget_work(struct work_struct *work) | ||
| 1660 | { | ||
| 1661 | struct musb *musb; | ||
| 1662 | unsigned long flags; | ||
| 1663 | |||
| 1664 | musb = container_of(work, struct musb, gadget_work.work); | ||
| 1665 | pm_runtime_get_sync(musb->controller); | ||
| 1666 | spin_lock_irqsave(&musb->lock, flags); | ||
| 1667 | musb_pullup(musb, musb->softconnect); | ||
| 1668 | spin_unlock_irqrestore(&musb->lock, flags); | ||
| 1669 | pm_runtime_mark_last_busy(musb->controller); | ||
| 1670 | pm_runtime_put_autosuspend(musb->controller); | ||
| 1671 | } | ||
| 1672 | |||
| 1659 | static int musb_gadget_pullup(struct usb_gadget *gadget, int is_on) | 1673 | static int musb_gadget_pullup(struct usb_gadget *gadget, int is_on) |
| 1660 | { | 1674 | { |
| 1661 | struct musb *musb = gadget_to_musb(gadget); | 1675 | struct musb *musb = gadget_to_musb(gadget); |
| @@ -1663,20 +1677,16 @@ static int musb_gadget_pullup(struct usb_gadget *gadget, int is_on) | |||
| 1663 | 1677 | ||
| 1664 | is_on = !!is_on; | 1678 | is_on = !!is_on; |
| 1665 | 1679 | ||
| 1666 | pm_runtime_get_sync(musb->controller); | ||
| 1667 | |||
| 1668 | /* NOTE: this assumes we are sensing vbus; we'd rather | 1680 | /* NOTE: this assumes we are sensing vbus; we'd rather |
| 1669 | * not pullup unless the B-session is active. | 1681 | * not pullup unless the B-session is active. |
| 1670 | */ | 1682 | */ |
| 1671 | spin_lock_irqsave(&musb->lock, flags); | 1683 | spin_lock_irqsave(&musb->lock, flags); |
| 1672 | if (is_on != musb->softconnect) { | 1684 | if (is_on != musb->softconnect) { |
| 1673 | musb->softconnect = is_on; | 1685 | musb->softconnect = is_on; |
| 1674 | musb_pullup(musb, is_on); | 1686 | schedule_delayed_work(&musb->gadget_work, 0); |
| 1675 | } | 1687 | } |
| 1676 | spin_unlock_irqrestore(&musb->lock, flags); | 1688 | spin_unlock_irqrestore(&musb->lock, flags); |
| 1677 | 1689 | ||
| 1678 | pm_runtime_put(musb->controller); | ||
| 1679 | |||
| 1680 | return 0; | 1690 | return 0; |
| 1681 | } | 1691 | } |
| 1682 | 1692 | ||
| @@ -1845,7 +1855,7 @@ int musb_gadget_setup(struct musb *musb) | |||
| 1845 | #elif IS_ENABLED(CONFIG_USB_MUSB_GADGET) | 1855 | #elif IS_ENABLED(CONFIG_USB_MUSB_GADGET) |
| 1846 | musb->g.is_otg = 0; | 1856 | musb->g.is_otg = 0; |
| 1847 | #endif | 1857 | #endif |
| 1848 | 1858 | INIT_DELAYED_WORK(&musb->gadget_work, musb_gadget_work); | |
| 1849 | musb_g_init_endpoints(musb); | 1859 | musb_g_init_endpoints(musb); |
| 1850 | 1860 | ||
| 1851 | musb->is_active = 0; | 1861 | musb->is_active = 0; |
| @@ -1866,6 +1876,8 @@ void musb_gadget_cleanup(struct musb *musb) | |||
| 1866 | { | 1876 | { |
| 1867 | if (musb->port_mode == MUSB_PORT_MODE_HOST) | 1877 | if (musb->port_mode == MUSB_PORT_MODE_HOST) |
| 1868 | return; | 1878 | return; |
| 1879 | |||
| 1880 | cancel_delayed_work_sync(&musb->gadget_work); | ||
| 1869 | usb_del_gadget_udc(&musb->g); | 1881 | usb_del_gadget_udc(&musb->g); |
| 1870 | } | 1882 | } |
| 1871 | 1883 | ||
| @@ -1914,8 +1926,8 @@ static int musb_gadget_start(struct usb_gadget *g, | |||
| 1914 | if (musb->xceiv->last_event == USB_EVENT_ID) | 1926 | if (musb->xceiv->last_event == USB_EVENT_ID) |
| 1915 | musb_platform_set_vbus(musb, 1); | 1927 | musb_platform_set_vbus(musb, 1); |
| 1916 | 1928 | ||
| 1917 | if (musb->xceiv->last_event == USB_EVENT_NONE) | 1929 | pm_runtime_mark_last_busy(musb->controller); |
| 1918 | pm_runtime_put(musb->controller); | 1930 | pm_runtime_put_autosuspend(musb->controller); |
| 1919 | 1931 | ||
| 1920 | return 0; | 1932 | return 0; |
| 1921 | 1933 | ||
| @@ -1934,8 +1946,7 @@ static int musb_gadget_stop(struct usb_gadget *g) | |||
| 1934 | struct musb *musb = gadget_to_musb(g); | 1946 | struct musb *musb = gadget_to_musb(g); |
| 1935 | unsigned long flags; | 1947 | unsigned long flags; |
| 1936 | 1948 | ||
| 1937 | if (musb->xceiv->last_event == USB_EVENT_NONE) | 1949 | pm_runtime_get_sync(musb->controller); |
| 1938 | pm_runtime_get_sync(musb->controller); | ||
| 1939 | 1950 | ||
| 1940 | /* | 1951 | /* |
| 1941 | * REVISIT always use otg_set_peripheral() here too; | 1952 | * REVISIT always use otg_set_peripheral() here too; |
| @@ -1963,7 +1974,8 @@ static int musb_gadget_stop(struct usb_gadget *g) | |||
| 1963 | * that currently misbehaves. | 1974 | * that currently misbehaves. |
| 1964 | */ | 1975 | */ |
| 1965 | 1976 | ||
| 1966 | pm_runtime_put(musb->controller); | 1977 | pm_runtime_mark_last_busy(musb->controller); |
| 1978 | pm_runtime_put_autosuspend(musb->controller); | ||
| 1967 | 1979 | ||
| 1968 | return 0; | 1980 | return 0; |
| 1969 | } | 1981 | } |
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index 2f8ad7f1f482..d227a71d85e1 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c | |||
| @@ -434,7 +434,13 @@ static void musb_advance_schedule(struct musb *musb, struct urb *urb, | |||
| 434 | } | 434 | } |
| 435 | } | 435 | } |
| 436 | 436 | ||
| 437 | if (qh != NULL && qh->is_ready) { | 437 | /* |
| 438 | * The pipe must be broken if current urb->status is set, so don't | ||
| 439 | * start next urb. | ||
| 440 | * TODO: to minimize the risk of regression, only check urb->status | ||
| 441 | * for RX, until we have a test case to understand the behavior of TX. | ||
| 442 | */ | ||
| 443 | if ((!status || !is_in) && qh && qh->is_ready) { | ||
| 438 | dev_dbg(musb->controller, "... next ep%d %cX urb %p\n", | 444 | dev_dbg(musb->controller, "... next ep%d %cX urb %p\n", |
| 439 | hw_ep->epnum, is_in ? 'R' : 'T', next_urb(qh)); | 445 | hw_ep->epnum, is_in ? 'R' : 'T', next_urb(qh)); |
| 440 | musb_start_urb(musb, is_in, qh); | 446 | musb_start_urb(musb, is_in, qh); |
| @@ -594,14 +600,13 @@ musb_rx_reinit(struct musb *musb, struct musb_qh *qh, u8 epnum) | |||
| 594 | musb_writew(ep->regs, MUSB_TXCSR, 0); | 600 | musb_writew(ep->regs, MUSB_TXCSR, 0); |
| 595 | 601 | ||
| 596 | /* scrub all previous state, clearing toggle */ | 602 | /* scrub all previous state, clearing toggle */ |
| 597 | } else { | ||
| 598 | csr = musb_readw(ep->regs, MUSB_RXCSR); | ||
| 599 | if (csr & MUSB_RXCSR_RXPKTRDY) | ||
| 600 | WARNING("rx%d, packet/%d ready?\n", ep->epnum, | ||
| 601 | musb_readw(ep->regs, MUSB_RXCOUNT)); | ||
| 602 | |||
| 603 | musb_h_flush_rxfifo(ep, MUSB_RXCSR_CLRDATATOG); | ||
| 604 | } | 603 | } |
| 604 | csr = musb_readw(ep->regs, MUSB_RXCSR); | ||
| 605 | if (csr & MUSB_RXCSR_RXPKTRDY) | ||
| 606 | WARNING("rx%d, packet/%d ready?\n", ep->epnum, | ||
| 607 | musb_readw(ep->regs, MUSB_RXCOUNT)); | ||
| 608 | |||
| 609 | musb_h_flush_rxfifo(ep, MUSB_RXCSR_CLRDATATOG); | ||
| 605 | 610 | ||
| 606 | /* target addr and (for multipoint) hub addr/port */ | 611 | /* target addr and (for multipoint) hub addr/port */ |
| 607 | if (musb->is_multipoint) { | 612 | if (musb->is_multipoint) { |
| @@ -627,7 +632,7 @@ musb_rx_reinit(struct musb *musb, struct musb_qh *qh, u8 epnum) | |||
| 627 | ep->rx_reinit = 0; | 632 | ep->rx_reinit = 0; |
| 628 | } | 633 | } |
| 629 | 634 | ||
| 630 | static int musb_tx_dma_set_mode_mentor(struct dma_controller *dma, | 635 | static void musb_tx_dma_set_mode_mentor(struct dma_controller *dma, |
| 631 | struct musb_hw_ep *hw_ep, struct musb_qh *qh, | 636 | struct musb_hw_ep *hw_ep, struct musb_qh *qh, |
| 632 | struct urb *urb, u32 offset, | 637 | struct urb *urb, u32 offset, |
| 633 | u32 *length, u8 *mode) | 638 | u32 *length, u8 *mode) |
| @@ -664,23 +669,18 @@ static int musb_tx_dma_set_mode_mentor(struct dma_controller *dma, | |||
| 664 | } | 669 | } |
| 665 | channel->desired_mode = *mode; | 670 | channel->desired_mode = *mode; |
| 666 | musb_writew(epio, MUSB_TXCSR, csr); | 671 | musb_writew(epio, MUSB_TXCSR, csr); |
| 667 | |||
| 668 | return 0; | ||
| 669 | } | 672 | } |
| 670 | 673 | ||
| 671 | static int musb_tx_dma_set_mode_cppi_tusb(struct dma_controller *dma, | 674 | static void musb_tx_dma_set_mode_cppi_tusb(struct dma_controller *dma, |
| 672 | struct musb_hw_ep *hw_ep, | 675 | struct musb_hw_ep *hw_ep, |
| 673 | struct musb_qh *qh, | 676 | struct musb_qh *qh, |
| 674 | struct urb *urb, | 677 | struct urb *urb, |
| 675 | u32 offset, | 678 | u32 offset, |
| 676 | u32 *length, | 679 | u32 *length, |
| 677 | u8 *mode) | 680 | u8 *mode) |
| 678 | { | 681 | { |
| 679 | struct dma_channel *channel = hw_ep->tx_channel; | 682 | struct dma_channel *channel = hw_ep->tx_channel; |
| 680 | 683 | ||
| 681 | if (!is_cppi_enabled(hw_ep->musb) && !tusb_dma_omap(hw_ep->musb)) | ||
| 682 | return -ENODEV; | ||
| 683 | |||
| 684 | channel->actual_len = 0; | 684 | channel->actual_len = 0; |
| 685 | 685 | ||
| 686 | /* | 686 | /* |
| @@ -688,8 +688,6 @@ static int musb_tx_dma_set_mode_cppi_tusb(struct dma_controller *dma, | |||
| 688 | * to identify the zero-length-final-packet case. | 688 | * to identify the zero-length-final-packet case. |
| 689 | */ | 689 | */ |
| 690 | *mode = (urb->transfer_flags & URB_ZERO_PACKET) ? 1 : 0; | 690 | *mode = (urb->transfer_flags & URB_ZERO_PACKET) ? 1 : 0; |
| 691 | |||
| 692 | return 0; | ||
| 693 | } | 691 | } |
| 694 | 692 | ||
| 695 | static bool musb_tx_dma_program(struct dma_controller *dma, | 693 | static bool musb_tx_dma_program(struct dma_controller *dma, |
| @@ -699,15 +697,14 @@ static bool musb_tx_dma_program(struct dma_controller *dma, | |||
| 699 | struct dma_channel *channel = hw_ep->tx_channel; | 697 | struct dma_channel *channel = hw_ep->tx_channel; |
| 700 | u16 pkt_size = qh->maxpacket; | 698 | u16 pkt_size = qh->maxpacket; |
| 701 | u8 mode; | 699 | u8 mode; |
| 702 | int res; | ||
| 703 | 700 | ||
| 704 | if (musb_dma_inventra(hw_ep->musb) || musb_dma_ux500(hw_ep->musb)) | 701 | if (musb_dma_inventra(hw_ep->musb) || musb_dma_ux500(hw_ep->musb)) |
| 705 | res = musb_tx_dma_set_mode_mentor(dma, hw_ep, qh, urb, | 702 | musb_tx_dma_set_mode_mentor(dma, hw_ep, qh, urb, offset, |
| 706 | offset, &length, &mode); | 703 | &length, &mode); |
| 704 | else if (is_cppi_enabled(hw_ep->musb) || tusb_dma_omap(hw_ep->musb)) | ||
| 705 | musb_tx_dma_set_mode_cppi_tusb(dma, hw_ep, qh, urb, offset, | ||
| 706 | &length, &mode); | ||
| 707 | else | 707 | else |
| 708 | res = musb_tx_dma_set_mode_cppi_tusb(dma, hw_ep, qh, urb, | ||
| 709 | offset, &length, &mode); | ||
| 710 | if (res) | ||
| 711 | return false; | 708 | return false; |
| 712 | 709 | ||
| 713 | qh->segsize = length; | 710 | qh->segsize = length; |
| @@ -995,9 +992,15 @@ static void musb_bulk_nak_timeout(struct musb *musb, struct musb_hw_ep *ep, | |||
| 995 | if (is_in) { | 992 | if (is_in) { |
| 996 | dma = is_dma_capable() ? ep->rx_channel : NULL; | 993 | dma = is_dma_capable() ? ep->rx_channel : NULL; |
| 997 | 994 | ||
| 998 | /* clear nak timeout bit */ | 995 | /* |
| 996 | * Need to stop the transaction by clearing REQPKT first | ||
| 997 | * then the NAK Timeout bit ref MUSBMHDRC USB 2.0 HIGH-SPEED | ||
| 998 | * DUAL-ROLE CONTROLLER Programmer's Guide, section 9.2.2 | ||
| 999 | */ | ||
| 999 | rx_csr = musb_readw(epio, MUSB_RXCSR); | 1000 | rx_csr = musb_readw(epio, MUSB_RXCSR); |
| 1000 | rx_csr |= MUSB_RXCSR_H_WZC_BITS; | 1001 | rx_csr |= MUSB_RXCSR_H_WZC_BITS; |
| 1002 | rx_csr &= ~MUSB_RXCSR_H_REQPKT; | ||
| 1003 | musb_writew(epio, MUSB_RXCSR, rx_csr); | ||
| 1001 | rx_csr &= ~MUSB_RXCSR_DATAERROR; | 1004 | rx_csr &= ~MUSB_RXCSR_DATAERROR; |
| 1002 | musb_writew(epio, MUSB_RXCSR, rx_csr); | 1005 | musb_writew(epio, MUSB_RXCSR, rx_csr); |
| 1003 | 1006 | ||
| @@ -1551,7 +1554,7 @@ static int musb_rx_dma_iso_cppi41(struct dma_controller *dma, | |||
| 1551 | struct urb *urb, | 1554 | struct urb *urb, |
| 1552 | size_t len) | 1555 | size_t len) |
| 1553 | { | 1556 | { |
| 1554 | struct dma_channel *channel = hw_ep->tx_channel; | 1557 | struct dma_channel *channel = hw_ep->rx_channel; |
| 1555 | void __iomem *epio = hw_ep->regs; | 1558 | void __iomem *epio = hw_ep->regs; |
| 1556 | dma_addr_t *buf; | 1559 | dma_addr_t *buf; |
| 1557 | u32 length, res; | 1560 | u32 length, res; |
| @@ -1870,6 +1873,9 @@ void musb_host_rx(struct musb *musb, u8 epnum) | |||
| 1870 | status = -EPROTO; | 1873 | status = -EPROTO; |
| 1871 | musb_writeb(epio, MUSB_RXINTERVAL, 0); | 1874 | musb_writeb(epio, MUSB_RXINTERVAL, 0); |
| 1872 | 1875 | ||
| 1876 | rx_csr &= ~MUSB_RXCSR_H_ERROR; | ||
| 1877 | musb_writew(epio, MUSB_RXCSR, rx_csr); | ||
| 1878 | |||
| 1873 | } else if (rx_csr & MUSB_RXCSR_DATAERROR) { | 1879 | } else if (rx_csr & MUSB_RXCSR_DATAERROR) { |
| 1874 | 1880 | ||
| 1875 | if (USB_ENDPOINT_XFER_ISOC != qh->type) { | 1881 | if (USB_ENDPOINT_XFER_ISOC != qh->type) { |
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index c84e0322c108..0b4cec940386 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
| @@ -49,97 +49,14 @@ struct omap2430_glue { | |||
| 49 | enum musb_vbus_id_status status; | 49 | enum musb_vbus_id_status status; |
| 50 | struct work_struct omap_musb_mailbox_work; | 50 | struct work_struct omap_musb_mailbox_work; |
| 51 | struct device *control_otghs; | 51 | struct device *control_otghs; |
| 52 | bool cable_connected; | ||
| 53 | bool enabled; | ||
| 54 | bool powered; | ||
| 52 | }; | 55 | }; |
| 53 | #define glue_to_musb(g) platform_get_drvdata(g->musb) | 56 | #define glue_to_musb(g) platform_get_drvdata(g->musb) |
| 54 | 57 | ||
| 55 | static struct omap2430_glue *_glue; | 58 | static struct omap2430_glue *_glue; |
| 56 | 59 | ||
| 57 | static struct timer_list musb_idle_timer; | ||
| 58 | |||
| 59 | static void musb_do_idle(unsigned long _musb) | ||
| 60 | { | ||
| 61 | struct musb *musb = (void *)_musb; | ||
| 62 | unsigned long flags; | ||
| 63 | u8 power; | ||
| 64 | u8 devctl; | ||
| 65 | |||
| 66 | spin_lock_irqsave(&musb->lock, flags); | ||
| 67 | |||
| 68 | switch (musb->xceiv->otg->state) { | ||
| 69 | case OTG_STATE_A_WAIT_BCON: | ||
| 70 | |||
| 71 | devctl = musb_readb(musb->mregs, MUSB_DEVCTL); | ||
| 72 | if (devctl & MUSB_DEVCTL_BDEVICE) { | ||
| 73 | musb->xceiv->otg->state = OTG_STATE_B_IDLE; | ||
| 74 | MUSB_DEV_MODE(musb); | ||
| 75 | } else { | ||
| 76 | musb->xceiv->otg->state = OTG_STATE_A_IDLE; | ||
| 77 | MUSB_HST_MODE(musb); | ||
| 78 | } | ||
| 79 | break; | ||
| 80 | case OTG_STATE_A_SUSPEND: | ||
| 81 | /* finish RESUME signaling? */ | ||
| 82 | if (musb->port1_status & MUSB_PORT_STAT_RESUME) { | ||
| 83 | power = musb_readb(musb->mregs, MUSB_POWER); | ||
| 84 | power &= ~MUSB_POWER_RESUME; | ||
| 85 | dev_dbg(musb->controller, "root port resume stopped, power %02x\n", power); | ||
| 86 | musb_writeb(musb->mregs, MUSB_POWER, power); | ||
| 87 | musb->is_active = 1; | ||
| 88 | musb->port1_status &= ~(USB_PORT_STAT_SUSPEND | ||
| 89 | | MUSB_PORT_STAT_RESUME); | ||
| 90 | musb->port1_status |= USB_PORT_STAT_C_SUSPEND << 16; | ||
| 91 | usb_hcd_poll_rh_status(musb->hcd); | ||
| 92 | /* NOTE: it might really be A_WAIT_BCON ... */ | ||
| 93 | musb->xceiv->otg->state = OTG_STATE_A_HOST; | ||
| 94 | } | ||
| 95 | break; | ||
| 96 | case OTG_STATE_A_HOST: | ||
| 97 | devctl = musb_readb(musb->mregs, MUSB_DEVCTL); | ||
| 98 | if (devctl & MUSB_DEVCTL_BDEVICE) | ||
| 99 | musb->xceiv->otg->state = OTG_STATE_B_IDLE; | ||
| 100 | else | ||
| 101 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON; | ||
| 102 | default: | ||
| 103 | break; | ||
| 104 | } | ||
| 105 | spin_unlock_irqrestore(&musb->lock, flags); | ||
| 106 | } | ||
| 107 | |||
| 108 | |||
| 109 | static void omap2430_musb_try_idle(struct musb *musb, unsigned long timeout) | ||
| 110 | { | ||
| 111 | unsigned long default_timeout = jiffies + msecs_to_jiffies(3); | ||
| 112 | static unsigned long last_timer; | ||
| 113 | |||
| 114 | if (timeout == 0) | ||
| 115 | timeout = default_timeout; | ||
| 116 | |||
| 117 | /* Never idle if active, or when VBUS timeout is not set as host */ | ||
| 118 | if (musb->is_active || ((musb->a_wait_bcon == 0) | ||
| 119 | && (musb->xceiv->otg->state == OTG_STATE_A_WAIT_BCON))) { | ||
| 120 | dev_dbg(musb->controller, "%s active, deleting timer\n", | ||
| 121 | usb_otg_state_string(musb->xceiv->otg->state)); | ||
| 122 | del_timer(&musb_idle_timer); | ||
| 123 | last_timer = jiffies; | ||
| 124 | return; | ||
| 125 | } | ||
| 126 | |||
| 127 | if (time_after(last_timer, timeout)) { | ||
| 128 | if (!timer_pending(&musb_idle_timer)) | ||
| 129 | last_timer = timeout; | ||
| 130 | else { | ||
| 131 | dev_dbg(musb->controller, "Longer idle timer already pending, ignoring\n"); | ||
| 132 | return; | ||
| 133 | } | ||
| 134 | } | ||
| 135 | last_timer = timeout; | ||
| 136 | |||
| 137 | dev_dbg(musb->controller, "%s inactive, for idle timer for %lu ms\n", | ||
| 138 | usb_otg_state_string(musb->xceiv->otg->state), | ||
| 139 | (unsigned long)jiffies_to_msecs(timeout - jiffies)); | ||
| 140 | mod_timer(&musb_idle_timer, timeout); | ||
| 141 | } | ||
| 142 | |||
| 143 | static void omap2430_musb_set_vbus(struct musb *musb, int is_on) | 60 | static void omap2430_musb_set_vbus(struct musb *musb, int is_on) |
| 144 | { | 61 | { |
| 145 | struct usb_otg *otg = musb->xceiv->otg; | 62 | struct usb_otg *otg = musb->xceiv->otg; |
| @@ -205,16 +122,6 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on) | |||
| 205 | musb_readb(musb->mregs, MUSB_DEVCTL)); | 122 | musb_readb(musb->mregs, MUSB_DEVCTL)); |
| 206 | } | 123 | } |
| 207 | 124 | ||
| 208 | static int omap2430_musb_set_mode(struct musb *musb, u8 musb_mode) | ||
| 209 | { | ||
| 210 | u8 devctl = musb_readb(musb->mregs, MUSB_DEVCTL); | ||
| 211 | |||
| 212 | devctl |= MUSB_DEVCTL_SESSION; | ||
| 213 | musb_writeb(musb->mregs, MUSB_DEVCTL, devctl); | ||
| 214 | |||
| 215 | return 0; | ||
| 216 | } | ||
| 217 | |||
| 218 | static inline void omap2430_low_level_exit(struct musb *musb) | 125 | static inline void omap2430_low_level_exit(struct musb *musb) |
| 219 | { | 126 | { |
| 220 | u32 l; | 127 | u32 l; |
| @@ -234,22 +141,63 @@ static inline void omap2430_low_level_init(struct musb *musb) | |||
| 234 | musb_writel(musb->mregs, OTG_FORCESTDBY, l); | 141 | musb_writel(musb->mregs, OTG_FORCESTDBY, l); |
| 235 | } | 142 | } |
| 236 | 143 | ||
| 237 | static void omap2430_musb_mailbox(enum musb_vbus_id_status status) | 144 | /* |
| 145 | * We can get multiple cable events so we need to keep track | ||
| 146 | * of the power state. Only keep power enabled if USB cable is | ||
| 147 | * connected and a gadget is started. | ||
| 148 | */ | ||
| 149 | static void omap2430_set_power(struct musb *musb, bool enabled, bool cable) | ||
| 150 | { | ||
| 151 | struct device *dev = musb->controller; | ||
| 152 | struct omap2430_glue *glue = dev_get_drvdata(dev->parent); | ||
| 153 | bool power_up; | ||
| 154 | int res; | ||
| 155 | |||
| 156 | if (glue->enabled != enabled) | ||
| 157 | glue->enabled = enabled; | ||
| 158 | |||
| 159 | if (glue->cable_connected != cable) | ||
| 160 | glue->cable_connected = cable; | ||
| 161 | |||
| 162 | power_up = glue->enabled && glue->cable_connected; | ||
| 163 | if (power_up == glue->powered) { | ||
| 164 | dev_warn(musb->controller, "power state already %i\n", | ||
| 165 | power_up); | ||
| 166 | return; | ||
| 167 | } | ||
| 168 | |||
| 169 | glue->powered = power_up; | ||
| 170 | |||
| 171 | if (power_up) { | ||
| 172 | res = pm_runtime_get_sync(musb->controller); | ||
| 173 | if (res < 0) { | ||
| 174 | dev_err(musb->controller, "could not enable: %i", res); | ||
| 175 | glue->powered = false; | ||
| 176 | } | ||
| 177 | } else { | ||
| 178 | pm_runtime_mark_last_busy(musb->controller); | ||
| 179 | pm_runtime_put_autosuspend(musb->controller); | ||
| 180 | } | ||
| 181 | } | ||
| 182 | |||
| 183 | static int omap2430_musb_mailbox(enum musb_vbus_id_status status) | ||
| 238 | { | 184 | { |
| 239 | struct omap2430_glue *glue = _glue; | 185 | struct omap2430_glue *glue = _glue; |
| 240 | 186 | ||
| 241 | if (!glue) { | 187 | if (!glue) { |
| 242 | pr_err("%s: musb core is not yet initialized\n", __func__); | 188 | pr_err("%s: musb core is not yet initialized\n", __func__); |
| 243 | return; | 189 | return -EPROBE_DEFER; |
| 244 | } | 190 | } |
| 245 | glue->status = status; | 191 | glue->status = status; |
| 246 | 192 | ||
| 247 | if (!glue_to_musb(glue)) { | 193 | if (!glue_to_musb(glue)) { |
| 248 | pr_err("%s: musb core is not yet ready\n", __func__); | 194 | pr_err("%s: musb core is not yet ready\n", __func__); |
| 249 | return; | 195 | return -EPROBE_DEFER; |
| 250 | } | 196 | } |
| 251 | 197 | ||
| 252 | schedule_work(&glue->omap_musb_mailbox_work); | 198 | schedule_work(&glue->omap_musb_mailbox_work); |
| 199 | |||
| 200 | return 0; | ||
| 253 | } | 201 | } |
| 254 | 202 | ||
| 255 | static void omap_musb_set_mailbox(struct omap2430_glue *glue) | 203 | static void omap_musb_set_mailbox(struct omap2430_glue *glue) |
| @@ -259,6 +207,13 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue) | |||
| 259 | struct musb_hdrc_platform_data *pdata = dev_get_platdata(dev); | 207 | struct musb_hdrc_platform_data *pdata = dev_get_platdata(dev); |
| 260 | struct omap_musb_board_data *data = pdata->board_data; | 208 | struct omap_musb_board_data *data = pdata->board_data; |
| 261 | struct usb_otg *otg = musb->xceiv->otg; | 209 | struct usb_otg *otg = musb->xceiv->otg; |
| 210 | bool cable_connected; | ||
| 211 | |||
| 212 | cable_connected = ((glue->status == MUSB_ID_GROUND) || | ||
| 213 | (glue->status == MUSB_VBUS_VALID)); | ||
| 214 | |||
| 215 | if (cable_connected) | ||
| 216 | omap2430_set_power(musb, glue->enabled, cable_connected); | ||
| 262 | 217 | ||
| 263 | switch (glue->status) { | 218 | switch (glue->status) { |
| 264 | case MUSB_ID_GROUND: | 219 | case MUSB_ID_GROUND: |
| @@ -268,7 +223,6 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue) | |||
| 268 | musb->xceiv->otg->state = OTG_STATE_A_IDLE; | 223 | musb->xceiv->otg->state = OTG_STATE_A_IDLE; |
| 269 | musb->xceiv->last_event = USB_EVENT_ID; | 224 | musb->xceiv->last_event = USB_EVENT_ID; |
| 270 | if (musb->gadget_driver) { | 225 | if (musb->gadget_driver) { |
| 271 | pm_runtime_get_sync(dev); | ||
| 272 | omap_control_usb_set_mode(glue->control_otghs, | 226 | omap_control_usb_set_mode(glue->control_otghs, |
| 273 | USB_MODE_HOST); | 227 | USB_MODE_HOST); |
| 274 | omap2430_musb_set_vbus(musb, 1); | 228 | omap2430_musb_set_vbus(musb, 1); |
| @@ -281,8 +235,6 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue) | |||
| 281 | otg->default_a = false; | 235 | otg->default_a = false; |
| 282 | musb->xceiv->otg->state = OTG_STATE_B_IDLE; | 236 | musb->xceiv->otg->state = OTG_STATE_B_IDLE; |
| 283 | musb->xceiv->last_event = USB_EVENT_VBUS; | 237 | musb->xceiv->last_event = USB_EVENT_VBUS; |
| 284 | if (musb->gadget_driver) | ||
| 285 | pm_runtime_get_sync(dev); | ||
| 286 | omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE); | 238 | omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE); |
| 287 | break; | 239 | break; |
| 288 | 240 | ||
| @@ -291,11 +243,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue) | |||
| 291 | dev_dbg(dev, "VBUS Disconnect\n"); | 243 | dev_dbg(dev, "VBUS Disconnect\n"); |
| 292 | 244 | ||
| 293 | musb->xceiv->last_event = USB_EVENT_NONE; | 245 | musb->xceiv->last_event = USB_EVENT_NONE; |
| 294 | if (musb->gadget_driver) { | 246 | if (musb->gadget_driver) |
| 295 | omap2430_musb_set_vbus(musb, 0); | 247 | omap2430_musb_set_vbus(musb, 0); |
| 296 | pm_runtime_mark_last_busy(dev); | ||
| 297 | pm_runtime_put_autosuspend(dev); | ||
| 298 | } | ||
| 299 | 248 | ||
| 300 | if (data->interface_type == MUSB_INTERFACE_UTMI) | 249 | if (data->interface_type == MUSB_INTERFACE_UTMI) |
| 301 | otg_set_vbus(musb->xceiv->otg, 0); | 250 | otg_set_vbus(musb->xceiv->otg, 0); |
| @@ -307,6 +256,9 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue) | |||
| 307 | dev_dbg(dev, "ID float\n"); | 256 | dev_dbg(dev, "ID float\n"); |
| 308 | } | 257 | } |
| 309 | 258 | ||
| 259 | if (!cable_connected) | ||
| 260 | omap2430_set_power(musb, glue->enabled, cable_connected); | ||
| 261 | |||
| 310 | atomic_notifier_call_chain(&musb->xceiv->notifier, | 262 | atomic_notifier_call_chain(&musb->xceiv->notifier, |
| 311 | musb->xceiv->last_event, NULL); | 263 | musb->xceiv->last_event, NULL); |
| 312 | } | 264 | } |
| @@ -316,13 +268,8 @@ static void omap_musb_mailbox_work(struct work_struct *mailbox_work) | |||
| 316 | { | 268 | { |
| 317 | struct omap2430_glue *glue = container_of(mailbox_work, | 269 | struct omap2430_glue *glue = container_of(mailbox_work, |
| 318 | struct omap2430_glue, omap_musb_mailbox_work); | 270 | struct omap2430_glue, omap_musb_mailbox_work); |
| 319 | struct musb *musb = glue_to_musb(glue); | ||
| 320 | struct device *dev = musb->controller; | ||
| 321 | 271 | ||
| 322 | pm_runtime_get_sync(dev); | ||
| 323 | omap_musb_set_mailbox(glue); | 272 | omap_musb_set_mailbox(glue); |
| 324 | pm_runtime_mark_last_busy(dev); | ||
| 325 | pm_runtime_put_autosuspend(dev); | ||
| 326 | } | 273 | } |
| 327 | 274 | ||
| 328 | static irqreturn_t omap2430_musb_interrupt(int irq, void *__hci) | 275 | static irqreturn_t omap2430_musb_interrupt(int irq, void *__hci) |
| @@ -389,23 +336,7 @@ static int omap2430_musb_init(struct musb *musb) | |||
| 389 | return PTR_ERR(musb->phy); | 336 | return PTR_ERR(musb->phy); |
| 390 | } | 337 | } |
| 391 | musb->isr = omap2430_musb_interrupt; | 338 | musb->isr = omap2430_musb_interrupt; |
| 392 | 339 | phy_init(musb->phy); | |
| 393 | /* | ||
| 394 | * Enable runtime PM for musb parent (this driver). We can't | ||
| 395 | * do it earlier as struct musb is not yet allocated and we | ||
| 396 | * need to touch the musb registers for runtime PM. | ||
| 397 | */ | ||
| 398 | pm_runtime_enable(glue->dev); | ||
| 399 | status = pm_runtime_get_sync(glue->dev); | ||
| 400 | if (status < 0) | ||
| 401 | goto err1; | ||
| 402 | |||
| 403 | status = pm_runtime_get_sync(dev); | ||
| 404 | if (status < 0) { | ||
| 405 | dev_err(dev, "pm_runtime_get_sync FAILED %d\n", status); | ||
| 406 | pm_runtime_put_sync(glue->dev); | ||
| 407 | goto err1; | ||
| 408 | } | ||
| 409 | 340 | ||
| 410 | l = musb_readl(musb->mregs, OTG_INTERFSEL); | 341 | l = musb_readl(musb->mregs, OTG_INTERFSEL); |
| 411 | 342 | ||
| @@ -427,20 +358,10 @@ static int omap2430_musb_init(struct musb *musb) | |||
| 427 | musb_readl(musb->mregs, OTG_INTERFSEL), | 358 | musb_readl(musb->mregs, OTG_INTERFSEL), |
| 428 | musb_readl(musb->mregs, OTG_SIMENABLE)); | 359 | musb_readl(musb->mregs, OTG_SIMENABLE)); |
| 429 | 360 | ||
| 430 | setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb); | ||
| 431 | |||
| 432 | if (glue->status != MUSB_UNKNOWN) | 361 | if (glue->status != MUSB_UNKNOWN) |
| 433 | omap_musb_set_mailbox(glue); | 362 | omap_musb_set_mailbox(glue); |
| 434 | 363 | ||
| 435 | phy_init(musb->phy); | ||
| 436 | phy_power_on(musb->phy); | ||
| 437 | |||
| 438 | pm_runtime_put_noidle(musb->controller); | ||
| 439 | pm_runtime_put_noidle(glue->dev); | ||
| 440 | return 0; | 364 | return 0; |
| 441 | |||
| 442 | err1: | ||
| 443 | return status; | ||
| 444 | } | 365 | } |
| 445 | 366 | ||
| 446 | static void omap2430_musb_enable(struct musb *musb) | 367 | static void omap2430_musb_enable(struct musb *musb) |
| @@ -452,6 +373,11 @@ static void omap2430_musb_enable(struct musb *musb) | |||
| 452 | struct musb_hdrc_platform_data *pdata = dev_get_platdata(dev); | 373 | struct musb_hdrc_platform_data *pdata = dev_get_platdata(dev); |
| 453 | struct omap_musb_board_data *data = pdata->board_data; | 374 | struct omap_musb_board_data *data = pdata->board_data; |
| 454 | 375 | ||
| 376 | if (!WARN_ON(!musb->phy)) | ||
| 377 | phy_power_on(musb->phy); | ||
| 378 | |||
| 379 | omap2430_set_power(musb, true, glue->cable_connected); | ||
| 380 | |||
| 455 | switch (glue->status) { | 381 | switch (glue->status) { |
| 456 | 382 | ||
| 457 | case MUSB_ID_GROUND: | 383 | case MUSB_ID_GROUND: |
| @@ -487,18 +413,25 @@ static void omap2430_musb_disable(struct musb *musb) | |||
| 487 | struct device *dev = musb->controller; | 413 | struct device *dev = musb->controller; |
| 488 | struct omap2430_glue *glue = dev_get_drvdata(dev->parent); | 414 | struct omap2430_glue *glue = dev_get_drvdata(dev->parent); |
| 489 | 415 | ||
| 416 | if (!WARN_ON(!musb->phy)) | ||
| 417 | phy_power_off(musb->phy); | ||
| 418 | |||
| 490 | if (glue->status != MUSB_UNKNOWN) | 419 | if (glue->status != MUSB_UNKNOWN) |
| 491 | omap_control_usb_set_mode(glue->control_otghs, | 420 | omap_control_usb_set_mode(glue->control_otghs, |
| 492 | USB_MODE_DISCONNECT); | 421 | USB_MODE_DISCONNECT); |
| 422 | |||
| 423 | omap2430_set_power(musb, false, glue->cable_connected); | ||
| 493 | } | 424 | } |
| 494 | 425 | ||
| 495 | static int omap2430_musb_exit(struct musb *musb) | 426 | static int omap2430_musb_exit(struct musb *musb) |
| 496 | { | 427 | { |
| 497 | del_timer_sync(&musb_idle_timer); | 428 | struct device *dev = musb->controller; |
| 429 | struct omap2430_glue *glue = dev_get_drvdata(dev->parent); | ||
| 498 | 430 | ||
| 499 | omap2430_low_level_exit(musb); | 431 | omap2430_low_level_exit(musb); |
| 500 | phy_power_off(musb->phy); | ||
| 501 | phy_exit(musb->phy); | 432 | phy_exit(musb->phy); |
| 433 | musb->phy = NULL; | ||
| 434 | cancel_work_sync(&glue->omap_musb_mailbox_work); | ||
| 502 | 435 | ||
| 503 | return 0; | 436 | return 0; |
| 504 | } | 437 | } |
| @@ -512,9 +445,6 @@ static const struct musb_platform_ops omap2430_ops = { | |||
| 512 | .init = omap2430_musb_init, | 445 | .init = omap2430_musb_init, |
| 513 | .exit = omap2430_musb_exit, | 446 | .exit = omap2430_musb_exit, |
| 514 | 447 | ||
| 515 | .set_mode = omap2430_musb_set_mode, | ||
| 516 | .try_idle = omap2430_musb_try_idle, | ||
| 517 | |||
| 518 | .set_vbus = omap2430_musb_set_vbus, | 448 | .set_vbus = omap2430_musb_set_vbus, |
| 519 | 449 | ||
| 520 | .enable = omap2430_musb_enable, | 450 | .enable = omap2430_musb_enable, |
| @@ -639,11 +569,9 @@ static int omap2430_probe(struct platform_device *pdev) | |||
| 639 | goto err2; | 569 | goto err2; |
| 640 | } | 570 | } |
| 641 | 571 | ||
| 642 | /* | 572 | pm_runtime_enable(glue->dev); |
| 643 | * Note that we cannot enable PM runtime yet for this | 573 | pm_runtime_use_autosuspend(glue->dev); |
| 644 | * driver as we need struct musb initialized first. | 574 | pm_runtime_set_autosuspend_delay(glue->dev, 500); |
| 645 | * See omap2430_musb_init above. | ||
| 646 | */ | ||
| 647 | 575 | ||
| 648 | ret = platform_device_add(musb); | 576 | ret = platform_device_add(musb); |
| 649 | if (ret) { | 577 | if (ret) { |
| @@ -662,12 +590,14 @@ err0: | |||
| 662 | 590 | ||
| 663 | static int omap2430_remove(struct platform_device *pdev) | 591 | static int omap2430_remove(struct platform_device *pdev) |
| 664 | { | 592 | { |
| 665 | struct omap2430_glue *glue = platform_get_drvdata(pdev); | 593 | struct omap2430_glue *glue = platform_get_drvdata(pdev); |
| 594 | struct musb *musb = glue_to_musb(glue); | ||
| 666 | 595 | ||
| 667 | pm_runtime_get_sync(glue->dev); | 596 | pm_runtime_get_sync(glue->dev); |
| 668 | cancel_work_sync(&glue->omap_musb_mailbox_work); | ||
| 669 | platform_device_unregister(glue->musb); | 597 | platform_device_unregister(glue->musb); |
| 598 | omap2430_set_power(musb, false, false); | ||
| 670 | pm_runtime_put_sync(glue->dev); | 599 | pm_runtime_put_sync(glue->dev); |
| 600 | pm_runtime_dont_use_autosuspend(glue->dev); | ||
| 671 | pm_runtime_disable(glue->dev); | 601 | pm_runtime_disable(glue->dev); |
| 672 | 602 | ||
| 673 | return 0; | 603 | return 0; |
| @@ -680,12 +610,13 @@ static int omap2430_runtime_suspend(struct device *dev) | |||
| 680 | struct omap2430_glue *glue = dev_get_drvdata(dev); | 610 | struct omap2430_glue *glue = dev_get_drvdata(dev); |
| 681 | struct musb *musb = glue_to_musb(glue); | 611 | struct musb *musb = glue_to_musb(glue); |
| 682 | 612 | ||
| 683 | if (musb) { | 613 | if (!musb) |
| 684 | musb->context.otg_interfsel = musb_readl(musb->mregs, | 614 | return 0; |
| 685 | OTG_INTERFSEL); | ||
| 686 | 615 | ||
| 687 | omap2430_low_level_exit(musb); | 616 | musb->context.otg_interfsel = musb_readl(musb->mregs, |
| 688 | } | 617 | OTG_INTERFSEL); |
| 618 | |||
| 619 | omap2430_low_level_exit(musb); | ||
| 689 | 620 | ||
| 690 | return 0; | 621 | return 0; |
| 691 | } | 622 | } |
| @@ -696,7 +627,7 @@ static int omap2430_runtime_resume(struct device *dev) | |||
| 696 | struct musb *musb = glue_to_musb(glue); | 627 | struct musb *musb = glue_to_musb(glue); |
| 697 | 628 | ||
| 698 | if (!musb) | 629 | if (!musb) |
| 699 | return -EPROBE_DEFER; | 630 | return 0; |
| 700 | 631 | ||
| 701 | omap2430_low_level_init(musb); | 632 | omap2430_low_level_init(musb); |
| 702 | musb_writel(musb->mregs, OTG_INTERFSEL, | 633 | musb_writel(musb->mregs, OTG_INTERFSEL, |
| @@ -738,18 +669,8 @@ static struct platform_driver omap2430_driver = { | |||
| 738 | }, | 669 | }, |
| 739 | }; | 670 | }; |
| 740 | 671 | ||
| 672 | module_platform_driver(omap2430_driver); | ||
| 673 | |||
| 741 | MODULE_DESCRIPTION("OMAP2PLUS MUSB Glue Layer"); | 674 | MODULE_DESCRIPTION("OMAP2PLUS MUSB Glue Layer"); |
| 742 | MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>"); | 675 | MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>"); |
| 743 | MODULE_LICENSE("GPL v2"); | 676 | MODULE_LICENSE("GPL v2"); |
| 744 | |||
| 745 | static int __init omap2430_init(void) | ||
| 746 | { | ||
| 747 | return platform_driver_register(&omap2430_driver); | ||
| 748 | } | ||
| 749 | subsys_initcall(omap2430_init); | ||
| 750 | |||
| 751 | static void __exit omap2430_exit(void) | ||
| 752 | { | ||
| 753 | platform_driver_unregister(&omap2430_driver); | ||
| 754 | } | ||
| 755 | module_exit(omap2430_exit); | ||
diff --git a/drivers/usb/musb/sunxi.c b/drivers/usb/musb/sunxi.c index fdab4232cfbf..76500515dd8b 100644 --- a/drivers/usb/musb/sunxi.c +++ b/drivers/usb/musb/sunxi.c | |||
| @@ -80,7 +80,8 @@ static struct musb *sunxi_musb; | |||
| 80 | 80 | ||
| 81 | struct sunxi_glue { | 81 | struct sunxi_glue { |
| 82 | struct device *dev; | 82 | struct device *dev; |
| 83 | struct platform_device *musb; | 83 | struct musb *musb; |
| 84 | struct platform_device *musb_pdev; | ||
| 84 | struct clk *clk; | 85 | struct clk *clk; |
| 85 | struct reset_control *rst; | 86 | struct reset_control *rst; |
| 86 | struct phy *phy; | 87 | struct phy *phy; |
| @@ -102,7 +103,7 @@ static void sunxi_musb_work(struct work_struct *work) | |||
| 102 | return; | 103 | return; |
| 103 | 104 | ||
| 104 | if (test_and_clear_bit(SUNXI_MUSB_FL_HOSTMODE_PEND, &glue->flags)) { | 105 | if (test_and_clear_bit(SUNXI_MUSB_FL_HOSTMODE_PEND, &glue->flags)) { |
| 105 | struct musb *musb = platform_get_drvdata(glue->musb); | 106 | struct musb *musb = glue->musb; |
| 106 | unsigned long flags; | 107 | unsigned long flags; |
| 107 | u8 devctl; | 108 | u8 devctl; |
| 108 | 109 | ||
| @@ -112,7 +113,7 @@ static void sunxi_musb_work(struct work_struct *work) | |||
| 112 | if (test_bit(SUNXI_MUSB_FL_HOSTMODE, &glue->flags)) { | 113 | if (test_bit(SUNXI_MUSB_FL_HOSTMODE, &glue->flags)) { |
| 113 | set_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags); | 114 | set_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags); |
| 114 | musb->xceiv->otg->default_a = 1; | 115 | musb->xceiv->otg->default_a = 1; |
| 115 | musb->xceiv->otg->state = OTG_STATE_A_IDLE; | 116 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; |
| 116 | MUSB_HST_MODE(musb); | 117 | MUSB_HST_MODE(musb); |
| 117 | devctl |= MUSB_DEVCTL_SESSION; | 118 | devctl |= MUSB_DEVCTL_SESSION; |
| 118 | } else { | 119 | } else { |
| @@ -145,10 +146,12 @@ static void sunxi_musb_set_vbus(struct musb *musb, int is_on) | |||
| 145 | { | 146 | { |
| 146 | struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent); | 147 | struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent); |
| 147 | 148 | ||
| 148 | if (is_on) | 149 | if (is_on) { |
| 149 | set_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags); | 150 | set_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags); |
| 150 | else | 151 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; |
| 152 | } else { | ||
| 151 | clear_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags); | 153 | clear_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags); |
| 154 | } | ||
| 152 | 155 | ||
| 153 | schedule_work(&glue->work); | 156 | schedule_work(&glue->work); |
| 154 | } | 157 | } |
| @@ -264,15 +267,6 @@ static int sunxi_musb_init(struct musb *musb) | |||
| 264 | if (ret) | 267 | if (ret) |
| 265 | goto error_unregister_notifier; | 268 | goto error_unregister_notifier; |
| 266 | 269 | ||
| 267 | if (musb->port_mode == MUSB_PORT_MODE_HOST) { | ||
| 268 | ret = phy_power_on(glue->phy); | ||
| 269 | if (ret) | ||
| 270 | goto error_phy_exit; | ||
| 271 | set_bit(SUNXI_MUSB_FL_PHY_ON, &glue->flags); | ||
| 272 | /* Stop musb work from turning vbus off again */ | ||
| 273 | set_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags); | ||
| 274 | } | ||
| 275 | |||
| 276 | musb->isr = sunxi_musb_interrupt; | 270 | musb->isr = sunxi_musb_interrupt; |
| 277 | 271 | ||
| 278 | /* Stop the musb-core from doing runtime pm (not supported on sunxi) */ | 272 | /* Stop the musb-core from doing runtime pm (not supported on sunxi) */ |
| @@ -280,8 +274,6 @@ static int sunxi_musb_init(struct musb *musb) | |||
| 280 | 274 | ||
| 281 | return 0; | 275 | return 0; |
| 282 | 276 | ||
| 283 | error_phy_exit: | ||
| 284 | phy_exit(glue->phy); | ||
| 285 | error_unregister_notifier: | 277 | error_unregister_notifier: |
| 286 | if (musb->port_mode == MUSB_PORT_MODE_DUAL_ROLE) | 278 | if (musb->port_mode == MUSB_PORT_MODE_DUAL_ROLE) |
| 287 | extcon_unregister_notifier(glue->extcon, EXTCON_USB_HOST, | 279 | extcon_unregister_notifier(glue->extcon, EXTCON_USB_HOST, |
| @@ -323,10 +315,31 @@ static int sunxi_musb_exit(struct musb *musb) | |||
| 323 | return 0; | 315 | return 0; |
| 324 | } | 316 | } |
| 325 | 317 | ||
| 318 | static int sunxi_set_mode(struct musb *musb, u8 mode) | ||
| 319 | { | ||
| 320 | struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent); | ||
| 321 | int ret; | ||
| 322 | |||
| 323 | if (mode == MUSB_HOST) { | ||
| 324 | ret = phy_power_on(glue->phy); | ||
| 325 | if (ret) | ||
| 326 | return ret; | ||
| 327 | |||
| 328 | set_bit(SUNXI_MUSB_FL_PHY_ON, &glue->flags); | ||
| 329 | /* Stop musb work from turning vbus off again */ | ||
| 330 | set_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags); | ||
| 331 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; | ||
| 332 | } | ||
| 333 | |||
| 334 | return 0; | ||
| 335 | } | ||
| 336 | |||
| 326 | static void sunxi_musb_enable(struct musb *musb) | 337 | static void sunxi_musb_enable(struct musb *musb) |
| 327 | { | 338 | { |
| 328 | struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent); | 339 | struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent); |
| 329 | 340 | ||
| 341 | glue->musb = musb; | ||
| 342 | |||
| 330 | /* musb_core does not call us in a balanced manner */ | 343 | /* musb_core does not call us in a balanced manner */ |
| 331 | if (test_and_set_bit(SUNXI_MUSB_FL_ENABLED, &glue->flags)) | 344 | if (test_and_set_bit(SUNXI_MUSB_FL_ENABLED, &glue->flags)) |
| 332 | return; | 345 | return; |
| @@ -569,6 +582,7 @@ static const struct musb_platform_ops sunxi_musb_ops = { | |||
| 569 | .exit = sunxi_musb_exit, | 582 | .exit = sunxi_musb_exit, |
| 570 | .enable = sunxi_musb_enable, | 583 | .enable = sunxi_musb_enable, |
| 571 | .disable = sunxi_musb_disable, | 584 | .disable = sunxi_musb_disable, |
| 585 | .set_mode = sunxi_set_mode, | ||
| 572 | .fifo_offset = sunxi_musb_fifo_offset, | 586 | .fifo_offset = sunxi_musb_fifo_offset, |
| 573 | .ep_offset = sunxi_musb_ep_offset, | 587 | .ep_offset = sunxi_musb_ep_offset, |
| 574 | .busctl_offset = sunxi_musb_busctl_offset, | 588 | .busctl_offset = sunxi_musb_busctl_offset, |
| @@ -721,9 +735,9 @@ static int sunxi_musb_probe(struct platform_device *pdev) | |||
| 721 | pinfo.data = &pdata; | 735 | pinfo.data = &pdata; |
| 722 | pinfo.size_data = sizeof(pdata); | 736 | pinfo.size_data = sizeof(pdata); |
| 723 | 737 | ||
| 724 | glue->musb = platform_device_register_full(&pinfo); | 738 | glue->musb_pdev = platform_device_register_full(&pinfo); |
| 725 | if (IS_ERR(glue->musb)) { | 739 | if (IS_ERR(glue->musb_pdev)) { |
| 726 | ret = PTR_ERR(glue->musb); | 740 | ret = PTR_ERR(glue->musb_pdev); |
| 727 | dev_err(&pdev->dev, "Error registering musb dev: %d\n", ret); | 741 | dev_err(&pdev->dev, "Error registering musb dev: %d\n", ret); |
| 728 | goto err_unregister_usb_phy; | 742 | goto err_unregister_usb_phy; |
| 729 | } | 743 | } |
| @@ -740,7 +754,7 @@ static int sunxi_musb_remove(struct platform_device *pdev) | |||
| 740 | struct sunxi_glue *glue = platform_get_drvdata(pdev); | 754 | struct sunxi_glue *glue = platform_get_drvdata(pdev); |
| 741 | struct platform_device *usb_phy = glue->usb_phy; | 755 | struct platform_device *usb_phy = glue->usb_phy; |
| 742 | 756 | ||
| 743 | platform_device_unregister(glue->musb); /* Frees glue ! */ | 757 | platform_device_unregister(glue->musb_pdev); |
| 744 | usb_phy_generic_unregister(usb_phy); | 758 | usb_phy_generic_unregister(usb_phy); |
| 745 | 759 | ||
| 746 | return 0; | 760 | return 0; |
diff --git a/drivers/usb/phy/phy-twl6030-usb.c b/drivers/usb/phy/phy-twl6030-usb.c index 24e2b3cf1867..a72e8d670adc 100644 --- a/drivers/usb/phy/phy-twl6030-usb.c +++ b/drivers/usb/phy/phy-twl6030-usb.c | |||
| @@ -97,6 +97,9 @@ struct twl6030_usb { | |||
| 97 | 97 | ||
| 98 | struct regulator *usb3v3; | 98 | struct regulator *usb3v3; |
| 99 | 99 | ||
| 100 | /* used to check initial cable status after probe */ | ||
| 101 | struct delayed_work get_status_work; | ||
| 102 | |||
| 100 | /* used to set vbus, in atomic path */ | 103 | /* used to set vbus, in atomic path */ |
| 101 | struct work_struct set_vbus_work; | 104 | struct work_struct set_vbus_work; |
| 102 | 105 | ||
| @@ -227,12 +230,16 @@ static irqreturn_t twl6030_usb_irq(int irq, void *_twl) | |||
| 227 | twl->asleep = 1; | 230 | twl->asleep = 1; |
| 228 | status = MUSB_VBUS_VALID; | 231 | status = MUSB_VBUS_VALID; |
| 229 | twl->linkstat = status; | 232 | twl->linkstat = status; |
| 230 | musb_mailbox(status); | 233 | ret = musb_mailbox(status); |
| 234 | if (ret) | ||
| 235 | twl->linkstat = MUSB_UNKNOWN; | ||
| 231 | } else { | 236 | } else { |
| 232 | if (twl->linkstat != MUSB_UNKNOWN) { | 237 | if (twl->linkstat != MUSB_UNKNOWN) { |
| 233 | status = MUSB_VBUS_OFF; | 238 | status = MUSB_VBUS_OFF; |
| 234 | twl->linkstat = status; | 239 | twl->linkstat = status; |
| 235 | musb_mailbox(status); | 240 | ret = musb_mailbox(status); |
| 241 | if (ret) | ||
| 242 | twl->linkstat = MUSB_UNKNOWN; | ||
| 236 | if (twl->asleep) { | 243 | if (twl->asleep) { |
| 237 | regulator_disable(twl->usb3v3); | 244 | regulator_disable(twl->usb3v3); |
| 238 | twl->asleep = 0; | 245 | twl->asleep = 0; |
| @@ -264,7 +271,9 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl) | |||
| 264 | twl6030_writeb(twl, TWL_MODULE_USB, 0x10, USB_ID_INT_EN_HI_SET); | 271 | twl6030_writeb(twl, TWL_MODULE_USB, 0x10, USB_ID_INT_EN_HI_SET); |
| 265 | status = MUSB_ID_GROUND; | 272 | status = MUSB_ID_GROUND; |
| 266 | twl->linkstat = status; | 273 | twl->linkstat = status; |
| 267 | musb_mailbox(status); | 274 | ret = musb_mailbox(status); |
| 275 | if (ret) | ||
| 276 | twl->linkstat = MUSB_UNKNOWN; | ||
| 268 | } else { | 277 | } else { |
| 269 | twl6030_writeb(twl, TWL_MODULE_USB, 0x10, USB_ID_INT_EN_HI_CLR); | 278 | twl6030_writeb(twl, TWL_MODULE_USB, 0x10, USB_ID_INT_EN_HI_CLR); |
| 270 | twl6030_writeb(twl, TWL_MODULE_USB, 0x1, USB_ID_INT_EN_HI_SET); | 279 | twl6030_writeb(twl, TWL_MODULE_USB, 0x1, USB_ID_INT_EN_HI_SET); |
| @@ -274,6 +283,15 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl) | |||
| 274 | return IRQ_HANDLED; | 283 | return IRQ_HANDLED; |
| 275 | } | 284 | } |
| 276 | 285 | ||
| 286 | static void twl6030_status_work(struct work_struct *work) | ||
| 287 | { | ||
| 288 | struct twl6030_usb *twl = container_of(work, struct twl6030_usb, | ||
| 289 | get_status_work.work); | ||
| 290 | |||
| 291 | twl6030_usb_irq(twl->irq2, twl); | ||
| 292 | twl6030_usbotg_irq(twl->irq1, twl); | ||
| 293 | } | ||
| 294 | |||
| 277 | static int twl6030_enable_irq(struct twl6030_usb *twl) | 295 | static int twl6030_enable_irq(struct twl6030_usb *twl) |
| 278 | { | 296 | { |
| 279 | twl6030_writeb(twl, TWL_MODULE_USB, 0x1, USB_ID_INT_EN_HI_SET); | 297 | twl6030_writeb(twl, TWL_MODULE_USB, 0x1, USB_ID_INT_EN_HI_SET); |
| @@ -284,8 +302,6 @@ static int twl6030_enable_irq(struct twl6030_usb *twl) | |||
| 284 | REG_INT_MSK_LINE_C); | 302 | REG_INT_MSK_LINE_C); |
| 285 | twl6030_interrupt_unmask(TWL6030_CHARGER_CTRL_INT_MASK, | 303 | twl6030_interrupt_unmask(TWL6030_CHARGER_CTRL_INT_MASK, |
| 286 | REG_INT_MSK_STS_C); | 304 | REG_INT_MSK_STS_C); |
| 287 | twl6030_usb_irq(twl->irq2, twl); | ||
| 288 | twl6030_usbotg_irq(twl->irq1, twl); | ||
| 289 | 305 | ||
| 290 | return 0; | 306 | return 0; |
| 291 | } | 307 | } |
| @@ -371,6 +387,7 @@ static int twl6030_usb_probe(struct platform_device *pdev) | |||
| 371 | dev_warn(&pdev->dev, "could not create sysfs file\n"); | 387 | dev_warn(&pdev->dev, "could not create sysfs file\n"); |
| 372 | 388 | ||
| 373 | INIT_WORK(&twl->set_vbus_work, otg_set_vbus_work); | 389 | INIT_WORK(&twl->set_vbus_work, otg_set_vbus_work); |
| 390 | INIT_DELAYED_WORK(&twl->get_status_work, twl6030_status_work); | ||
| 374 | 391 | ||
| 375 | status = request_threaded_irq(twl->irq1, NULL, twl6030_usbotg_irq, | 392 | status = request_threaded_irq(twl->irq1, NULL, twl6030_usbotg_irq, |
| 376 | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING | IRQF_ONESHOT, | 393 | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING | IRQF_ONESHOT, |
| @@ -395,6 +412,7 @@ static int twl6030_usb_probe(struct platform_device *pdev) | |||
| 395 | 412 | ||
| 396 | twl->asleep = 0; | 413 | twl->asleep = 0; |
| 397 | twl6030_enable_irq(twl); | 414 | twl6030_enable_irq(twl); |
| 415 | schedule_delayed_work(&twl->get_status_work, HZ); | ||
| 398 | dev_info(&pdev->dev, "Initialized TWL6030 USB module\n"); | 416 | dev_info(&pdev->dev, "Initialized TWL6030 USB module\n"); |
| 399 | 417 | ||
| 400 | return 0; | 418 | return 0; |
| @@ -404,6 +422,7 @@ static int twl6030_usb_remove(struct platform_device *pdev) | |||
| 404 | { | 422 | { |
| 405 | struct twl6030_usb *twl = platform_get_drvdata(pdev); | 423 | struct twl6030_usb *twl = platform_get_drvdata(pdev); |
| 406 | 424 | ||
| 425 | cancel_delayed_work(&twl->get_status_work); | ||
| 407 | twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK, | 426 | twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK, |
| 408 | REG_INT_MSK_LINE_C); | 427 | REG_INT_MSK_LINE_C); |
| 409 | twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK, | 428 | twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK, |
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index 2eddbe538cda..5608af4a369d 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c | |||
| @@ -2007,6 +2007,7 @@ static void mos7720_release(struct usb_serial *serial) | |||
| 2007 | urblist_entry) | 2007 | urblist_entry) |
| 2008 | usb_unlink_urb(urbtrack->urb); | 2008 | usb_unlink_urb(urbtrack->urb); |
| 2009 | spin_unlock_irqrestore(&mos_parport->listlock, flags); | 2009 | spin_unlock_irqrestore(&mos_parport->listlock, flags); |
| 2010 | parport_del_port(mos_parport->pp); | ||
| 2010 | 2011 | ||
| 2011 | kref_put(&mos_parport->ref_count, destroy_mos_parport); | 2012 | kref_put(&mos_parport->ref_count, destroy_mos_parport); |
| 2012 | } | 2013 | } |
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c index 4d49fce406e1..5ef014ba6ae8 100644 --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c | |||
| @@ -836,6 +836,7 @@ static int uas_slave_configure(struct scsi_device *sdev) | |||
| 836 | if (devinfo->flags & US_FL_BROKEN_FUA) | 836 | if (devinfo->flags & US_FL_BROKEN_FUA) |
| 837 | sdev->broken_fua = 1; | 837 | sdev->broken_fua = 1; |
| 838 | 838 | ||
| 839 | scsi_change_queue_depth(sdev, devinfo->qdepth - 2); | ||
| 839 | return 0; | 840 | return 0; |
| 840 | } | 841 | } |
| 841 | 842 | ||
| @@ -848,7 +849,6 @@ static struct scsi_host_template uas_host_template = { | |||
| 848 | .slave_configure = uas_slave_configure, | 849 | .slave_configure = uas_slave_configure, |
| 849 | .eh_abort_handler = uas_eh_abort_handler, | 850 | .eh_abort_handler = uas_eh_abort_handler, |
| 850 | .eh_bus_reset_handler = uas_eh_bus_reset_handler, | 851 | .eh_bus_reset_handler = uas_eh_bus_reset_handler, |
| 851 | .can_queue = MAX_CMNDS, | ||
| 852 | .this_id = -1, | 852 | .this_id = -1, |
| 853 | .sg_tablesize = SG_NONE, | 853 | .sg_tablesize = SG_NONE, |
| 854 | .skip_settle_delay = 1, | 854 | .skip_settle_delay = 1, |
diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c index fca51105974e..2e0450bec1b1 100644 --- a/drivers/usb/usbip/vhci_hcd.c +++ b/drivers/usb/usbip/vhci_hcd.c | |||
| @@ -941,7 +941,7 @@ static void vhci_stop(struct usb_hcd *hcd) | |||
| 941 | 941 | ||
| 942 | static int vhci_get_frame_number(struct usb_hcd *hcd) | 942 | static int vhci_get_frame_number(struct usb_hcd *hcd) |
| 943 | { | 943 | { |
| 944 | pr_err("Not yet implemented\n"); | 944 | dev_err_ratelimited(&hcd->self.root_hub->dev, "Not yet implemented\n"); |
| 945 | return 0; | 945 | return 0; |
| 946 | } | 946 | } |
| 947 | 947 | ||
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 457651bf45b0..fefe8b06a63d 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h | |||
| @@ -1034,6 +1034,8 @@ static inline int usb_gadget_activate(struct usb_gadget *gadget) | |||
| 1034 | * @udc_name: A name of UDC this driver should be bound to. If udc_name is NULL, | 1034 | * @udc_name: A name of UDC this driver should be bound to. If udc_name is NULL, |
| 1035 | * this driver will be bound to any available UDC. | 1035 | * this driver will be bound to any available UDC. |
| 1036 | * @pending: UDC core private data used for deferred probe of this driver. | 1036 | * @pending: UDC core private data used for deferred probe of this driver. |
| 1037 | * @match_existing_only: If udc is not found, return an error and don't add this | ||
| 1038 | * gadget driver to list of pending driver | ||
| 1037 | * | 1039 | * |
| 1038 | * Devices are disabled till a gadget driver successfully bind()s, which | 1040 | * Devices are disabled till a gadget driver successfully bind()s, which |
| 1039 | * means the driver will handle setup() requests needed to enumerate (and | 1041 | * means the driver will handle setup() requests needed to enumerate (and |
| @@ -1097,6 +1099,7 @@ struct usb_gadget_driver { | |||
| 1097 | 1099 | ||
| 1098 | char *udc_name; | 1100 | char *udc_name; |
| 1099 | struct list_head pending; | 1101 | struct list_head pending; |
| 1102 | unsigned match_existing_only:1; | ||
| 1100 | }; | 1103 | }; |
| 1101 | 1104 | ||
| 1102 | 1105 | ||
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h index 0b3da40a525e..d315c8907869 100644 --- a/include/linux/usb/musb.h +++ b/include/linux/usb/musb.h | |||
| @@ -142,10 +142,11 @@ enum musb_vbus_id_status { | |||
| 142 | }; | 142 | }; |
| 143 | 143 | ||
| 144 | #if IS_ENABLED(CONFIG_USB_MUSB_HDRC) | 144 | #if IS_ENABLED(CONFIG_USB_MUSB_HDRC) |
| 145 | void musb_mailbox(enum musb_vbus_id_status status); | 145 | int musb_mailbox(enum musb_vbus_id_status status); |
| 146 | #else | 146 | #else |
| 147 | static inline void musb_mailbox(enum musb_vbus_id_status status) | 147 | static inline int musb_mailbox(enum musb_vbus_id_status status) |
| 148 | { | 148 | { |
| 149 | return 0; | ||
| 149 | } | 150 | } |
| 150 | #endif | 151 | #endif |
| 151 | 152 | ||
