diff options
| -rw-r--r-- | drivers/phy/Kconfig | 2 | ||||
| -rw-r--r-- | drivers/phy/phy-berlin-usb.c | 4 | ||||
| -rw-r--r-- | drivers/phy/phy-ti-pipe3.c | 172 | ||||
| -rw-r--r-- | drivers/usb/class/cdc-acm.c | 1 | ||||
| -rw-r--r-- | drivers/usb/common/ulpi.c | 2 | ||||
| -rw-r--r-- | drivers/usb/core/hcd.c | 7 | ||||
| -rw-r--r-- | drivers/usb/core/hub.c | 2 | ||||
| -rw-r--r-- | drivers/usb/core/usb.h | 1 | ||||
| -rw-r--r-- | drivers/usb/dwc3/ep0.c | 4 | ||||
| -rw-r--r-- | drivers/usb/gadget/udc/mv_udc_core.c | 2 | ||||
| -rw-r--r-- | drivers/usb/gadget/udc/udc-core.c | 14 | ||||
| -rw-r--r-- | drivers/usb/host/ohci-q.c | 7 | ||||
| -rw-r--r-- | drivers/usb/host/ohci-tmio.c | 2 | ||||
| -rw-r--r-- | drivers/usb/host/xhci-hub.c | 22 | ||||
| -rw-r--r-- | drivers/usb/host/xhci-mem.c | 2 | ||||
| -rw-r--r-- | drivers/usb/host/xhci-pci.c | 57 | ||||
| -rw-r--r-- | drivers/usb/host/xhci-ring.c | 3 | ||||
| -rw-r--r-- | drivers/usb/host/xhci.c | 3 | ||||
| -rw-r--r-- | drivers/usb/host/xhci.h | 1 | ||||
| -rw-r--r-- | drivers/usb/storage/unusual_devs.h | 23 |
20 files changed, 170 insertions, 161 deletions
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index c0e6ede3e27d..6b8dd162f644 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig | |||
| @@ -56,6 +56,7 @@ config PHY_EXYNOS_MIPI_VIDEO | |||
| 56 | 56 | ||
| 57 | config PHY_PXA_28NM_HSIC | 57 | config PHY_PXA_28NM_HSIC |
| 58 | tristate "Marvell USB HSIC 28nm PHY Driver" | 58 | tristate "Marvell USB HSIC 28nm PHY Driver" |
| 59 | depends on HAS_IOMEM | ||
| 59 | select GENERIC_PHY | 60 | select GENERIC_PHY |
| 60 | help | 61 | help |
| 61 | Enable this to support Marvell USB HSIC PHY driver for Marvell | 62 | Enable this to support Marvell USB HSIC PHY driver for Marvell |
| @@ -66,6 +67,7 @@ config PHY_PXA_28NM_HSIC | |||
| 66 | 67 | ||
| 67 | config PHY_PXA_28NM_USB2 | 68 | config PHY_PXA_28NM_USB2 |
| 68 | tristate "Marvell USB 2.0 28nm PHY Driver" | 69 | tristate "Marvell USB 2.0 28nm PHY Driver" |
| 70 | depends on HAS_IOMEM | ||
| 69 | select GENERIC_PHY | 71 | select GENERIC_PHY |
| 70 | help | 72 | help |
| 71 | Enable this to support Marvell USB 2.0 PHY driver for Marvell | 73 | Enable this to support Marvell USB 2.0 PHY driver for Marvell |
diff --git a/drivers/phy/phy-berlin-usb.c b/drivers/phy/phy-berlin-usb.c index c6fc95b53083..335e06d66ed9 100644 --- a/drivers/phy/phy-berlin-usb.c +++ b/drivers/phy/phy-berlin-usb.c | |||
| @@ -105,9 +105,9 @@ | |||
| 105 | 105 | ||
| 106 | static const u32 phy_berlin_pll_dividers[] = { | 106 | static const u32 phy_berlin_pll_dividers[] = { |
| 107 | /* Berlin 2 */ | 107 | /* Berlin 2 */ |
| 108 | CLK_REF_DIV(0xc) | FEEDBACK_CLK_DIV(0x54), | ||
| 109 | /* Berlin 2CD */ | ||
| 110 | CLK_REF_DIV(0x6) | FEEDBACK_CLK_DIV(0x55), | 108 | CLK_REF_DIV(0x6) | FEEDBACK_CLK_DIV(0x55), |
| 109 | /* Berlin 2CD/Q */ | ||
| 110 | CLK_REF_DIV(0xc) | FEEDBACK_CLK_DIV(0x54), | ||
| 111 | }; | 111 | }; |
| 112 | 112 | ||
| 113 | struct phy_berlin_usb_priv { | 113 | struct phy_berlin_usb_priv { |
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c index 53f295c1bab1..3510b81db3fa 100644 --- a/drivers/phy/phy-ti-pipe3.c +++ b/drivers/phy/phy-ti-pipe3.c | |||
| @@ -28,7 +28,6 @@ | |||
| 28 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
| 29 | #include <linux/phy/omap_control_phy.h> | 29 | #include <linux/phy/omap_control_phy.h> |
| 30 | #include <linux/of_platform.h> | 30 | #include <linux/of_platform.h> |
| 31 | #include <linux/spinlock.h> | ||
| 32 | 31 | ||
| 33 | #define PLL_STATUS 0x00000004 | 32 | #define PLL_STATUS 0x00000004 |
| 34 | #define PLL_GO 0x00000008 | 33 | #define PLL_GO 0x00000008 |
| @@ -83,10 +82,6 @@ struct ti_pipe3 { | |||
| 83 | struct clk *refclk; | 82 | struct clk *refclk; |
| 84 | struct clk *div_clk; | 83 | struct clk *div_clk; |
| 85 | struct pipe3_dpll_map *dpll_map; | 84 | struct pipe3_dpll_map *dpll_map; |
| 86 | bool enabled; | ||
| 87 | spinlock_t lock; /* serialize clock enable/disable */ | ||
| 88 | /* the below flag is needed specifically for SATA */ | ||
| 89 | bool refclk_enabled; | ||
| 90 | }; | 85 | }; |
| 91 | 86 | ||
| 92 | static struct pipe3_dpll_map dpll_map_usb[] = { | 87 | static struct pipe3_dpll_map dpll_map_usb[] = { |
| @@ -137,6 +132,9 @@ static struct pipe3_dpll_params *ti_pipe3_get_dpll_params(struct ti_pipe3 *phy) | |||
| 137 | return NULL; | 132 | return NULL; |
| 138 | } | 133 | } |
| 139 | 134 | ||
| 135 | static int ti_pipe3_enable_clocks(struct ti_pipe3 *phy); | ||
| 136 | static void ti_pipe3_disable_clocks(struct ti_pipe3 *phy); | ||
| 137 | |||
| 140 | static int ti_pipe3_power_off(struct phy *x) | 138 | static int ti_pipe3_power_off(struct phy *x) |
| 141 | { | 139 | { |
| 142 | struct ti_pipe3 *phy = phy_get_drvdata(x); | 140 | struct ti_pipe3 *phy = phy_get_drvdata(x); |
| @@ -217,6 +215,7 @@ static int ti_pipe3_init(struct phy *x) | |||
| 217 | u32 val; | 215 | u32 val; |
| 218 | int ret = 0; | 216 | int ret = 0; |
| 219 | 217 | ||
| 218 | ti_pipe3_enable_clocks(phy); | ||
| 220 | /* | 219 | /* |
| 221 | * Set pcie_pcs register to 0x96 for proper functioning of phy | 220 | * Set pcie_pcs register to 0x96 for proper functioning of phy |
| 222 | * as recommended in AM572x TRM SPRUHZ6, section 18.5.2.2, table | 221 | * as recommended in AM572x TRM SPRUHZ6, section 18.5.2.2, table |
| @@ -250,33 +249,35 @@ static int ti_pipe3_exit(struct phy *x) | |||
| 250 | u32 val; | 249 | u32 val; |
| 251 | unsigned long timeout; | 250 | unsigned long timeout; |
| 252 | 251 | ||
| 253 | /* SATA DPLL can't be powered down due to Errata i783 and PCIe | 252 | /* SATA DPLL can't be powered down due to Errata i783 */ |
| 254 | * does not have internal DPLL | 253 | if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-sata")) |
| 255 | */ | ||
| 256 | if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-sata") || | ||
| 257 | of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-pcie")) | ||
| 258 | return 0; | 254 | return 0; |
| 259 | 255 | ||
| 260 | /* Put DPLL in IDLE mode */ | 256 | /* PCIe doesn't have internal DPLL */ |
| 261 | val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_CONFIGURATION2); | 257 | if (!of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-pcie")) { |
| 262 | val |= PLL_IDLE; | 258 | /* Put DPLL in IDLE mode */ |
| 263 | ti_pipe3_writel(phy->pll_ctrl_base, PLL_CONFIGURATION2, val); | 259 | val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_CONFIGURATION2); |
| 264 | 260 | val |= PLL_IDLE; | |
| 265 | /* wait for LDO and Oscillator to power down */ | 261 | ti_pipe3_writel(phy->pll_ctrl_base, PLL_CONFIGURATION2, val); |
| 266 | timeout = jiffies + msecs_to_jiffies(PLL_IDLE_TIME); | ||
| 267 | do { | ||
| 268 | cpu_relax(); | ||
| 269 | val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_STATUS); | ||
| 270 | if ((val & PLL_TICOPWDN) && (val & PLL_LDOPWDN)) | ||
| 271 | break; | ||
| 272 | } while (!time_after(jiffies, timeout)); | ||
| 273 | 262 | ||
| 274 | if (!(val & PLL_TICOPWDN) || !(val & PLL_LDOPWDN)) { | 263 | /* wait for LDO and Oscillator to power down */ |
| 275 | dev_err(phy->dev, "Failed to power down: PLL_STATUS 0x%x\n", | 264 | timeout = jiffies + msecs_to_jiffies(PLL_IDLE_TIME); |
| 276 | val); | 265 | do { |
| 277 | return -EBUSY; | 266 | cpu_relax(); |
| 267 | val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_STATUS); | ||
| 268 | if ((val & PLL_TICOPWDN) && (val & PLL_LDOPWDN)) | ||
| 269 | break; | ||
| 270 | } while (!time_after(jiffies, timeout)); | ||
| 271 | |||
| 272 | if (!(val & PLL_TICOPWDN) || !(val & PLL_LDOPWDN)) { | ||
| 273 | dev_err(phy->dev, "Failed to power down: PLL_STATUS 0x%x\n", | ||
| 274 | val); | ||
| 275 | return -EBUSY; | ||
| 276 | } | ||
| 278 | } | 277 | } |
| 279 | 278 | ||
| 279 | ti_pipe3_disable_clocks(phy); | ||
| 280 | |||
| 280 | return 0; | 281 | return 0; |
| 281 | } | 282 | } |
| 282 | static struct phy_ops ops = { | 283 | static struct phy_ops ops = { |
| @@ -306,7 +307,6 @@ static int ti_pipe3_probe(struct platform_device *pdev) | |||
| 306 | return -ENOMEM; | 307 | return -ENOMEM; |
| 307 | 308 | ||
| 308 | phy->dev = &pdev->dev; | 309 | phy->dev = &pdev->dev; |
| 309 | spin_lock_init(&phy->lock); | ||
| 310 | 310 | ||
| 311 | if (!of_device_is_compatible(node, "ti,phy-pipe3-pcie")) { | 311 | if (!of_device_is_compatible(node, "ti,phy-pipe3-pcie")) { |
| 312 | match = of_match_device(ti_pipe3_id_table, &pdev->dev); | 312 | match = of_match_device(ti_pipe3_id_table, &pdev->dev); |
| @@ -402,6 +402,10 @@ static int ti_pipe3_probe(struct platform_device *pdev) | |||
| 402 | 402 | ||
| 403 | platform_set_drvdata(pdev, phy); | 403 | platform_set_drvdata(pdev, phy); |
| 404 | pm_runtime_enable(phy->dev); | 404 | pm_runtime_enable(phy->dev); |
| 405 | /* Prevent auto-disable of refclk for SATA PHY due to Errata i783 */ | ||
| 406 | if (of_device_is_compatible(node, "ti,phy-pipe3-sata")) | ||
| 407 | if (!IS_ERR(phy->refclk)) | ||
| 408 | clk_prepare_enable(phy->refclk); | ||
| 405 | 409 | ||
| 406 | generic_phy = devm_phy_create(phy->dev, NULL, &ops); | 410 | generic_phy = devm_phy_create(phy->dev, NULL, &ops); |
| 407 | if (IS_ERR(generic_phy)) | 411 | if (IS_ERR(generic_phy)) |
| @@ -413,63 +417,33 @@ static int ti_pipe3_probe(struct platform_device *pdev) | |||
| 413 | if (IS_ERR(phy_provider)) | 417 | if (IS_ERR(phy_provider)) |
| 414 | return PTR_ERR(phy_provider); | 418 | return PTR_ERR(phy_provider); |
| 415 | 419 | ||
| 416 | pm_runtime_get(&pdev->dev); | ||
| 417 | |||
| 418 | return 0; | 420 | return 0; |
| 419 | } | 421 | } |
| 420 | 422 | ||
| 421 | static int ti_pipe3_remove(struct platform_device *pdev) | 423 | static int ti_pipe3_remove(struct platform_device *pdev) |
| 422 | { | 424 | { |
| 423 | if (!pm_runtime_suspended(&pdev->dev)) | ||
| 424 | pm_runtime_put(&pdev->dev); | ||
| 425 | pm_runtime_disable(&pdev->dev); | 425 | pm_runtime_disable(&pdev->dev); |
| 426 | 426 | ||
| 427 | return 0; | 427 | return 0; |
| 428 | } | 428 | } |
| 429 | 429 | ||
| 430 | #ifdef CONFIG_PM | 430 | static int ti_pipe3_enable_clocks(struct ti_pipe3 *phy) |
| 431 | static int ti_pipe3_enable_refclk(struct ti_pipe3 *phy) | ||
| 432 | { | 431 | { |
| 433 | if (!IS_ERR(phy->refclk) && !phy->refclk_enabled) { | 432 | int ret = 0; |
| 434 | int ret; | ||
| 435 | 433 | ||
| 434 | if (!IS_ERR(phy->refclk)) { | ||
| 436 | ret = clk_prepare_enable(phy->refclk); | 435 | ret = clk_prepare_enable(phy->refclk); |
| 437 | if (ret) { | 436 | if (ret) { |
| 438 | dev_err(phy->dev, "Failed to enable refclk %d\n", ret); | 437 | dev_err(phy->dev, "Failed to enable refclk %d\n", ret); |
| 439 | return ret; | 438 | return ret; |
| 440 | } | 439 | } |
| 441 | phy->refclk_enabled = true; | ||
| 442 | } | 440 | } |
| 443 | 441 | ||
| 444 | return 0; | ||
| 445 | } | ||
| 446 | |||
| 447 | static void ti_pipe3_disable_refclk(struct ti_pipe3 *phy) | ||
| 448 | { | ||
| 449 | if (!IS_ERR(phy->refclk)) | ||
| 450 | clk_disable_unprepare(phy->refclk); | ||
| 451 | |||
| 452 | phy->refclk_enabled = false; | ||
| 453 | } | ||
| 454 | |||
| 455 | static int ti_pipe3_enable_clocks(struct ti_pipe3 *phy) | ||
| 456 | { | ||
| 457 | int ret = 0; | ||
| 458 | unsigned long flags; | ||
| 459 | |||
| 460 | spin_lock_irqsave(&phy->lock, flags); | ||
| 461 | if (phy->enabled) | ||
| 462 | goto err1; | ||
| 463 | |||
| 464 | ret = ti_pipe3_enable_refclk(phy); | ||
| 465 | if (ret) | ||
| 466 | goto err1; | ||
| 467 | |||
| 468 | if (!IS_ERR(phy->wkupclk)) { | 442 | if (!IS_ERR(phy->wkupclk)) { |
| 469 | ret = clk_prepare_enable(phy->wkupclk); | 443 | ret = clk_prepare_enable(phy->wkupclk); |
| 470 | if (ret) { | 444 | if (ret) { |
| 471 | dev_err(phy->dev, "Failed to enable wkupclk %d\n", ret); | 445 | dev_err(phy->dev, "Failed to enable wkupclk %d\n", ret); |
| 472 | goto err2; | 446 | goto disable_refclk; |
| 473 | } | 447 | } |
| 474 | } | 448 | } |
| 475 | 449 | ||
| @@ -477,96 +451,33 @@ static int ti_pipe3_enable_clocks(struct ti_pipe3 *phy) | |||
| 477 | ret = clk_prepare_enable(phy->div_clk); | 451 | ret = clk_prepare_enable(phy->div_clk); |
| 478 | if (ret) { | 452 | if (ret) { |
| 479 | dev_err(phy->dev, "Failed to enable div_clk %d\n", ret); | 453 | dev_err(phy->dev, "Failed to enable div_clk %d\n", ret); |
| 480 | goto err3; | 454 | goto disable_wkupclk; |
| 481 | } | 455 | } |
| 482 | } | 456 | } |
| 483 | 457 | ||
| 484 | phy->enabled = true; | ||
| 485 | spin_unlock_irqrestore(&phy->lock, flags); | ||
| 486 | return 0; | 458 | return 0; |
| 487 | 459 | ||
| 488 | err3: | 460 | disable_wkupclk: |
| 489 | if (!IS_ERR(phy->wkupclk)) | 461 | if (!IS_ERR(phy->wkupclk)) |
| 490 | clk_disable_unprepare(phy->wkupclk); | 462 | clk_disable_unprepare(phy->wkupclk); |
| 491 | 463 | ||
| 492 | err2: | 464 | disable_refclk: |
| 493 | if (!IS_ERR(phy->refclk)) | 465 | if (!IS_ERR(phy->refclk)) |
| 494 | clk_disable_unprepare(phy->refclk); | 466 | clk_disable_unprepare(phy->refclk); |
| 495 | 467 | ||
| 496 | ti_pipe3_disable_refclk(phy); | ||
| 497 | err1: | ||
| 498 | spin_unlock_irqrestore(&phy->lock, flags); | ||
| 499 | return ret; | 468 | return ret; |
| 500 | } | 469 | } |
| 501 | 470 | ||
| 502 | static void ti_pipe3_disable_clocks(struct ti_pipe3 *phy) | 471 | static void ti_pipe3_disable_clocks(struct ti_pipe3 *phy) |
| 503 | { | 472 | { |
| 504 | unsigned long flags; | ||
| 505 | |||
| 506 | spin_lock_irqsave(&phy->lock, flags); | ||
| 507 | if (!phy->enabled) { | ||
| 508 | spin_unlock_irqrestore(&phy->lock, flags); | ||
| 509 | return; | ||
| 510 | } | ||
| 511 | |||
| 512 | if (!IS_ERR(phy->wkupclk)) | 473 | if (!IS_ERR(phy->wkupclk)) |
| 513 | clk_disable_unprepare(phy->wkupclk); | 474 | clk_disable_unprepare(phy->wkupclk); |
| 514 | /* Don't disable refclk for SATA PHY due to Errata i783 */ | 475 | if (!IS_ERR(phy->refclk)) |
| 515 | if (!of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-sata")) | 476 | clk_disable_unprepare(phy->refclk); |
| 516 | ti_pipe3_disable_refclk(phy); | ||
| 517 | if (!IS_ERR(phy->div_clk)) | 477 | if (!IS_ERR(phy->div_clk)) |
| 518 | clk_disable_unprepare(phy->div_clk); | 478 | clk_disable_unprepare(phy->div_clk); |
| 519 | phy->enabled = false; | ||
| 520 | spin_unlock_irqrestore(&phy->lock, flags); | ||
| 521 | } | ||
| 522 | |||
| 523 | static int ti_pipe3_runtime_suspend(struct device *dev) | ||
| 524 | { | ||
| 525 | struct ti_pipe3 *phy = dev_get_drvdata(dev); | ||
| 526 | |||
| 527 | ti_pipe3_disable_clocks(phy); | ||
| 528 | return 0; | ||
| 529 | } | 479 | } |
| 530 | 480 | ||
| 531 | static int ti_pipe3_runtime_resume(struct device *dev) | ||
| 532 | { | ||
| 533 | struct ti_pipe3 *phy = dev_get_drvdata(dev); | ||
| 534 | int ret = 0; | ||
| 535 | |||
| 536 | ret = ti_pipe3_enable_clocks(phy); | ||
| 537 | return ret; | ||
| 538 | } | ||
| 539 | |||
| 540 | static int ti_pipe3_suspend(struct device *dev) | ||
| 541 | { | ||
| 542 | struct ti_pipe3 *phy = dev_get_drvdata(dev); | ||
| 543 | |||
| 544 | ti_pipe3_disable_clocks(phy); | ||
| 545 | return 0; | ||
| 546 | } | ||
| 547 | |||
| 548 | static int ti_pipe3_resume(struct device *dev) | ||
| 549 | { | ||
| 550 | struct ti_pipe3 *phy = dev_get_drvdata(dev); | ||
| 551 | int ret; | ||
| 552 | |||
| 553 | ret = ti_pipe3_enable_clocks(phy); | ||
| 554 | if (ret) | ||
| 555 | return ret; | ||
| 556 | |||
| 557 | pm_runtime_disable(dev); | ||
| 558 | pm_runtime_set_active(dev); | ||
| 559 | pm_runtime_enable(dev); | ||
| 560 | return 0; | ||
| 561 | } | ||
| 562 | #endif | ||
| 563 | |||
| 564 | static const struct dev_pm_ops ti_pipe3_pm_ops = { | ||
| 565 | SET_RUNTIME_PM_OPS(ti_pipe3_runtime_suspend, | ||
| 566 | ti_pipe3_runtime_resume, NULL) | ||
| 567 | SET_SYSTEM_SLEEP_PM_OPS(ti_pipe3_suspend, ti_pipe3_resume) | ||
| 568 | }; | ||
| 569 | |||
| 570 | static const struct of_device_id ti_pipe3_id_table[] = { | 481 | static const struct of_device_id ti_pipe3_id_table[] = { |
| 571 | { | 482 | { |
| 572 | .compatible = "ti,phy-usb3", | 483 | .compatible = "ti,phy-usb3", |
| @@ -592,7 +503,6 @@ static struct platform_driver ti_pipe3_driver = { | |||
| 592 | .remove = ti_pipe3_remove, | 503 | .remove = ti_pipe3_remove, |
| 593 | .driver = { | 504 | .driver = { |
| 594 | .name = "ti-pipe3", | 505 | .name = "ti-pipe3", |
| 595 | .pm = &ti_pipe3_pm_ops, | ||
| 596 | .of_match_table = ti_pipe3_id_table, | 506 | .of_match_table = ti_pipe3_id_table, |
| 597 | }, | 507 | }, |
| 598 | }; | 508 | }; |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 519a77ba214c..b30e7423549b 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
| @@ -1944,6 +1944,7 @@ static void __exit acm_exit(void) | |||
| 1944 | usb_deregister(&acm_driver); | 1944 | usb_deregister(&acm_driver); |
| 1945 | tty_unregister_driver(acm_tty_driver); | 1945 | tty_unregister_driver(acm_tty_driver); |
| 1946 | put_tty_driver(acm_tty_driver); | 1946 | put_tty_driver(acm_tty_driver); |
| 1947 | idr_destroy(&acm_minors); | ||
| 1947 | } | 1948 | } |
| 1948 | 1949 | ||
| 1949 | module_init(acm_init); | 1950 | module_init(acm_init); |
diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c index 0e6f968e93fe..01c0c0477a9e 100644 --- a/drivers/usb/common/ulpi.c +++ b/drivers/usb/common/ulpi.c | |||
| @@ -242,7 +242,7 @@ static int __init ulpi_init(void) | |||
| 242 | { | 242 | { |
| 243 | return bus_register(&ulpi_bus); | 243 | return bus_register(&ulpi_bus); |
| 244 | } | 244 | } |
| 245 | module_init(ulpi_init); | 245 | subsys_initcall(ulpi_init); |
| 246 | 246 | ||
| 247 | static void __exit ulpi_exit(void) | 247 | static void __exit ulpi_exit(void) |
| 248 | { | 248 | { |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index be5b2074f906..cbcd0920fb51 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
| @@ -1022,9 +1022,12 @@ static int register_root_hub(struct usb_hcd *hcd) | |||
| 1022 | dev_name(&usb_dev->dev), retval); | 1022 | dev_name(&usb_dev->dev), retval); |
| 1023 | return (retval < 0) ? retval : -EMSGSIZE; | 1023 | return (retval < 0) ? retval : -EMSGSIZE; |
| 1024 | } | 1024 | } |
| 1025 | if (usb_dev->speed == USB_SPEED_SUPER) { | 1025 | |
| 1026 | if (le16_to_cpu(usb_dev->descriptor.bcdUSB) >= 0x0201) { | ||
| 1026 | retval = usb_get_bos_descriptor(usb_dev); | 1027 | retval = usb_get_bos_descriptor(usb_dev); |
| 1027 | if (retval < 0) { | 1028 | if (!retval) { |
| 1029 | usb_dev->lpm_capable = usb_device_supports_lpm(usb_dev); | ||
| 1030 | } else if (usb_dev->speed == USB_SPEED_SUPER) { | ||
| 1028 | mutex_unlock(&usb_bus_list_lock); | 1031 | mutex_unlock(&usb_bus_list_lock); |
| 1029 | dev_dbg(parent_dev, "can't read %s bos descriptor %d\n", | 1032 | dev_dbg(parent_dev, "can't read %s bos descriptor %d\n", |
| 1030 | dev_name(&usb_dev->dev), retval); | 1033 | dev_name(&usb_dev->dev), retval); |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 43cb2f2e3b43..73dfa194160b 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
| @@ -122,7 +122,7 @@ struct usb_hub *usb_hub_to_struct_hub(struct usb_device *hdev) | |||
| 122 | return usb_get_intfdata(hdev->actconfig->interface[0]); | 122 | return usb_get_intfdata(hdev->actconfig->interface[0]); |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | static int usb_device_supports_lpm(struct usb_device *udev) | 125 | int usb_device_supports_lpm(struct usb_device *udev) |
| 126 | { | 126 | { |
| 127 | /* USB 2.1 (and greater) devices indicate LPM support through | 127 | /* USB 2.1 (and greater) devices indicate LPM support through |
| 128 | * their USB 2.0 Extended Capabilities BOS descriptor. | 128 | * their USB 2.0 Extended Capabilities BOS descriptor. |
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h index 7eb1e26798e5..457255a3306a 100644 --- a/drivers/usb/core/usb.h +++ b/drivers/usb/core/usb.h | |||
| @@ -65,6 +65,7 @@ extern int usb_hub_init(void); | |||
| 65 | extern void usb_hub_cleanup(void); | 65 | extern void usb_hub_cleanup(void); |
| 66 | extern int usb_major_init(void); | 66 | extern int usb_major_init(void); |
| 67 | extern void usb_major_cleanup(void); | 67 | extern void usb_major_cleanup(void); |
| 68 | extern int usb_device_supports_lpm(struct usb_device *udev); | ||
| 68 | 69 | ||
| 69 | #ifdef CONFIG_PM | 70 | #ifdef CONFIG_PM |
| 70 | 71 | ||
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index 2ef3c8d6a9db..69e769c35cf5 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c | |||
| @@ -727,6 +727,10 @@ static int dwc3_ep0_std_request(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl) | |||
| 727 | dwc3_trace(trace_dwc3_ep0, "USB_REQ_SET_ISOCH_DELAY"); | 727 | dwc3_trace(trace_dwc3_ep0, "USB_REQ_SET_ISOCH_DELAY"); |
| 728 | ret = dwc3_ep0_set_isoch_delay(dwc, ctrl); | 728 | ret = dwc3_ep0_set_isoch_delay(dwc, ctrl); |
| 729 | break; | 729 | break; |
| 730 | case USB_REQ_SET_INTERFACE: | ||
| 731 | dwc3_trace(trace_dwc3_ep0, "USB_REQ_SET_INTERFACE"); | ||
| 732 | dwc->start_config_issued = false; | ||
| 733 | /* Fall through */ | ||
| 730 | default: | 734 | default: |
| 731 | dwc3_trace(trace_dwc3_ep0, "Forwarding to gadget driver"); | 735 | dwc3_trace(trace_dwc3_ep0, "Forwarding to gadget driver"); |
| 732 | ret = dwc3_ep0_delegate_req(dwc, ctrl); | 736 | ret = dwc3_ep0_delegate_req(dwc, ctrl); |
diff --git a/drivers/usb/gadget/udc/mv_udc_core.c b/drivers/usb/gadget/udc/mv_udc_core.c index d32160d6463f..5da37c957b53 100644 --- a/drivers/usb/gadget/udc/mv_udc_core.c +++ b/drivers/usb/gadget/udc/mv_udc_core.c | |||
| @@ -2167,7 +2167,7 @@ static int mv_udc_probe(struct platform_device *pdev) | |||
| 2167 | return -ENODEV; | 2167 | return -ENODEV; |
| 2168 | } | 2168 | } |
| 2169 | 2169 | ||
| 2170 | udc->phy_regs = ioremap(r->start, resource_size(r)); | 2170 | udc->phy_regs = devm_ioremap(&pdev->dev, r->start, resource_size(r)); |
| 2171 | if (udc->phy_regs == NULL) { | 2171 | if (udc->phy_regs == NULL) { |
| 2172 | dev_err(&pdev->dev, "failed to map phy I/O memory\n"); | 2172 | dev_err(&pdev->dev, "failed to map phy I/O memory\n"); |
| 2173 | return -EBUSY; | 2173 | return -EBUSY; |
diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c index d69c35558f68..362ee8af5fce 100644 --- a/drivers/usb/gadget/udc/udc-core.c +++ b/drivers/usb/gadget/udc/udc-core.c | |||
| @@ -60,13 +60,15 @@ static DEFINE_MUTEX(udc_lock); | |||
| 60 | int usb_gadget_map_request(struct usb_gadget *gadget, | 60 | int usb_gadget_map_request(struct usb_gadget *gadget, |
| 61 | struct usb_request *req, int is_in) | 61 | struct usb_request *req, int is_in) |
| 62 | { | 62 | { |
| 63 | struct device *dev = gadget->dev.parent; | ||
| 64 | |||
| 63 | if (req->length == 0) | 65 | if (req->length == 0) |
| 64 | return 0; | 66 | return 0; |
| 65 | 67 | ||
| 66 | if (req->num_sgs) { | 68 | if (req->num_sgs) { |
| 67 | int mapped; | 69 | int mapped; |
| 68 | 70 | ||
| 69 | mapped = dma_map_sg(&gadget->dev, req->sg, req->num_sgs, | 71 | mapped = dma_map_sg(dev, req->sg, req->num_sgs, |
| 70 | is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); | 72 | is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); |
| 71 | if (mapped == 0) { | 73 | if (mapped == 0) { |
| 72 | dev_err(&gadget->dev, "failed to map SGs\n"); | 74 | dev_err(&gadget->dev, "failed to map SGs\n"); |
| @@ -75,11 +77,11 @@ int usb_gadget_map_request(struct usb_gadget *gadget, | |||
| 75 | 77 | ||
| 76 | req->num_mapped_sgs = mapped; | 78 | req->num_mapped_sgs = mapped; |
| 77 | } else { | 79 | } else { |
| 78 | req->dma = dma_map_single(&gadget->dev, req->buf, req->length, | 80 | req->dma = dma_map_single(dev, req->buf, req->length, |
| 79 | is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); | 81 | is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); |
| 80 | 82 | ||
| 81 | if (dma_mapping_error(&gadget->dev, req->dma)) { | 83 | if (dma_mapping_error(dev, req->dma)) { |
| 82 | dev_err(&gadget->dev, "failed to map buffer\n"); | 84 | dev_err(dev, "failed to map buffer\n"); |
| 83 | return -EFAULT; | 85 | return -EFAULT; |
| 84 | } | 86 | } |
| 85 | } | 87 | } |
| @@ -95,12 +97,12 @@ void usb_gadget_unmap_request(struct usb_gadget *gadget, | |||
| 95 | return; | 97 | return; |
| 96 | 98 | ||
| 97 | if (req->num_mapped_sgs) { | 99 | if (req->num_mapped_sgs) { |
| 98 | dma_unmap_sg(&gadget->dev, req->sg, req->num_mapped_sgs, | 100 | dma_unmap_sg(gadget->dev.parent, req->sg, req->num_mapped_sgs, |
| 99 | is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); | 101 | is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); |
| 100 | 102 | ||
| 101 | req->num_mapped_sgs = 0; | 103 | req->num_mapped_sgs = 0; |
| 102 | } else { | 104 | } else { |
| 103 | dma_unmap_single(&gadget->dev, req->dma, req->length, | 105 | dma_unmap_single(gadget->dev.parent, req->dma, req->length, |
| 104 | is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); | 106 | is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); |
| 105 | } | 107 | } |
| 106 | } | 108 | } |
diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c index f7d561ed3c23..d029bbe9eb36 100644 --- a/drivers/usb/host/ohci-q.c +++ b/drivers/usb/host/ohci-q.c | |||
| @@ -981,10 +981,6 @@ rescan_all: | |||
| 981 | int completed, modified; | 981 | int completed, modified; |
| 982 | __hc32 *prev; | 982 | __hc32 *prev; |
| 983 | 983 | ||
| 984 | /* Is this ED already invisible to the hardware? */ | ||
| 985 | if (ed->state == ED_IDLE) | ||
| 986 | goto ed_idle; | ||
| 987 | |||
| 988 | /* only take off EDs that the HC isn't using, accounting for | 984 | /* only take off EDs that the HC isn't using, accounting for |
| 989 | * frame counter wraps and EDs with partially retired TDs | 985 | * frame counter wraps and EDs with partially retired TDs |
| 990 | */ | 986 | */ |
| @@ -1012,12 +1008,10 @@ skip_ed: | |||
| 1012 | } | 1008 | } |
| 1013 | 1009 | ||
| 1014 | /* ED's now officially unlinked, hc doesn't see */ | 1010 | /* ED's now officially unlinked, hc doesn't see */ |
| 1015 | ed->state = ED_IDLE; | ||
| 1016 | ed->hwHeadP &= ~cpu_to_hc32(ohci, ED_H); | 1011 | ed->hwHeadP &= ~cpu_to_hc32(ohci, ED_H); |
| 1017 | ed->hwNextED = 0; | 1012 | ed->hwNextED = 0; |
| 1018 | wmb(); | 1013 | wmb(); |
| 1019 | ed->hwINFO &= ~cpu_to_hc32(ohci, ED_SKIP | ED_DEQUEUE); | 1014 | ed->hwINFO &= ~cpu_to_hc32(ohci, ED_SKIP | ED_DEQUEUE); |
| 1020 | ed_idle: | ||
| 1021 | 1015 | ||
| 1022 | /* reentrancy: if we drop the schedule lock, someone might | 1016 | /* reentrancy: if we drop the schedule lock, someone might |
| 1023 | * have modified this list. normally it's just prepending | 1017 | * have modified this list. normally it's just prepending |
| @@ -1088,6 +1082,7 @@ rescan_this: | |||
| 1088 | if (list_empty(&ed->td_list)) { | 1082 | if (list_empty(&ed->td_list)) { |
| 1089 | *last = ed->ed_next; | 1083 | *last = ed->ed_next; |
| 1090 | ed->ed_next = NULL; | 1084 | ed->ed_next = NULL; |
| 1085 | ed->state = ED_IDLE; | ||
| 1091 | list_del(&ed->in_use_list); | 1086 | list_del(&ed->in_use_list); |
| 1092 | } else if (ohci->rh_state == OHCI_RH_RUNNING) { | 1087 | } else if (ohci->rh_state == OHCI_RH_RUNNING) { |
| 1093 | *last = ed->ed_next; | 1088 | *last = ed->ed_next; |
diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c index e9a6eec39142..cfcfadfc94fc 100644 --- a/drivers/usb/host/ohci-tmio.c +++ b/drivers/usb/host/ohci-tmio.c | |||
| @@ -58,7 +58,7 @@ | |||
| 58 | #define CCR_PM_CKRNEN 0x0002 | 58 | #define CCR_PM_CKRNEN 0x0002 |
| 59 | #define CCR_PM_USBPW1 0x0004 | 59 | #define CCR_PM_USBPW1 0x0004 |
| 60 | #define CCR_PM_USBPW2 0x0008 | 60 | #define CCR_PM_USBPW2 0x0008 |
| 61 | #define CCR_PM_USBPW3 0x0008 | 61 | #define CCR_PM_USBPW3 0x0010 |
| 62 | #define CCR_PM_PMEE 0x0100 | 62 | #define CCR_PM_PMEE 0x0100 |
| 63 | #define CCR_PM_PMES 0x8000 | 63 | #define CCR_PM_PMES 0x8000 |
| 64 | 64 | ||
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index e75c565feb53..78241b5550df 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
| @@ -484,10 +484,13 @@ static void xhci_hub_report_usb3_link_state(struct xhci_hcd *xhci, | |||
| 484 | u32 pls = status_reg & PORT_PLS_MASK; | 484 | u32 pls = status_reg & PORT_PLS_MASK; |
| 485 | 485 | ||
| 486 | /* resume state is a xHCI internal state. | 486 | /* resume state is a xHCI internal state. |
| 487 | * Do not report it to usb core. | 487 | * Do not report it to usb core, instead, pretend to be U3, |
| 488 | * thus usb core knows it's not ready for transfer | ||
| 488 | */ | 489 | */ |
| 489 | if (pls == XDEV_RESUME) | 490 | if (pls == XDEV_RESUME) { |
| 491 | *status |= USB_SS_PORT_LS_U3; | ||
| 490 | return; | 492 | return; |
| 493 | } | ||
| 491 | 494 | ||
| 492 | /* When the CAS bit is set then warm reset | 495 | /* When the CAS bit is set then warm reset |
| 493 | * should be performed on port | 496 | * should be performed on port |
| @@ -588,7 +591,14 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, | |||
| 588 | status |= USB_PORT_STAT_C_RESET << 16; | 591 | status |= USB_PORT_STAT_C_RESET << 16; |
| 589 | /* USB3.0 only */ | 592 | /* USB3.0 only */ |
| 590 | if (hcd->speed == HCD_USB3) { | 593 | if (hcd->speed == HCD_USB3) { |
| 591 | if ((raw_port_status & PORT_PLC)) | 594 | /* Port link change with port in resume state should not be |
| 595 | * reported to usbcore, as this is an internal state to be | ||
| 596 | * handled by xhci driver. Reporting PLC to usbcore may | ||
| 597 | * cause usbcore clearing PLC first and port change event | ||
| 598 | * irq won't be generated. | ||
| 599 | */ | ||
| 600 | if ((raw_port_status & PORT_PLC) && | ||
| 601 | (raw_port_status & PORT_PLS_MASK) != XDEV_RESUME) | ||
| 592 | status |= USB_PORT_STAT_C_LINK_STATE << 16; | 602 | status |= USB_PORT_STAT_C_LINK_STATE << 16; |
| 593 | if ((raw_port_status & PORT_WRC)) | 603 | if ((raw_port_status & PORT_WRC)) |
| 594 | status |= USB_PORT_STAT_C_BH_RESET << 16; | 604 | status |= USB_PORT_STAT_C_BH_RESET << 16; |
| @@ -1120,10 +1130,10 @@ int xhci_bus_suspend(struct usb_hcd *hcd) | |||
| 1120 | spin_lock_irqsave(&xhci->lock, flags); | 1130 | spin_lock_irqsave(&xhci->lock, flags); |
| 1121 | 1131 | ||
| 1122 | if (hcd->self.root_hub->do_remote_wakeup) { | 1132 | if (hcd->self.root_hub->do_remote_wakeup) { |
| 1123 | if (bus_state->resuming_ports) { | 1133 | if (bus_state->resuming_ports || /* USB2 */ |
| 1134 | bus_state->port_remote_wakeup) { /* USB3 */ | ||
| 1124 | spin_unlock_irqrestore(&xhci->lock, flags); | 1135 | spin_unlock_irqrestore(&xhci->lock, flags); |
| 1125 | xhci_dbg(xhci, "suspend failed because " | 1136 | xhci_dbg(xhci, "suspend failed because a port is resuming\n"); |
| 1126 | "a port is resuming\n"); | ||
| 1127 | return -EBUSY; | 1137 | return -EBUSY; |
| 1128 | } | 1138 | } |
| 1129 | } | 1139 | } |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index f8336408ef07..3e442f77a2b9 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
| @@ -1427,10 +1427,10 @@ int xhci_endpoint_init(struct xhci_hcd *xhci, | |||
| 1427 | /* Attempt to use the ring cache */ | 1427 | /* Attempt to use the ring cache */ |
| 1428 | if (virt_dev->num_rings_cached == 0) | 1428 | if (virt_dev->num_rings_cached == 0) |
| 1429 | return -ENOMEM; | 1429 | return -ENOMEM; |
| 1430 | virt_dev->num_rings_cached--; | ||
| 1430 | virt_dev->eps[ep_index].new_ring = | 1431 | virt_dev->eps[ep_index].new_ring = |
| 1431 | virt_dev->ring_cache[virt_dev->num_rings_cached]; | 1432 | virt_dev->ring_cache[virt_dev->num_rings_cached]; |
| 1432 | virt_dev->ring_cache[virt_dev->num_rings_cached] = NULL; | 1433 | virt_dev->ring_cache[virt_dev->num_rings_cached] = NULL; |
| 1433 | virt_dev->num_rings_cached--; | ||
| 1434 | xhci_reinit_cached_ring(xhci, virt_dev->eps[ep_index].new_ring, | 1434 | xhci_reinit_cached_ring(xhci, virt_dev->eps[ep_index].new_ring, |
| 1435 | 1, type); | 1435 | 1, type); |
| 1436 | } | 1436 | } |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 4a4cb1d91ac8..5590eac2b22d 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
| @@ -23,10 +23,15 @@ | |||
| 23 | #include <linux/pci.h> | 23 | #include <linux/pci.h> |
| 24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
| 25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
| 26 | #include <linux/acpi.h> | ||
| 26 | 27 | ||
| 27 | #include "xhci.h" | 28 | #include "xhci.h" |
| 28 | #include "xhci-trace.h" | 29 | #include "xhci-trace.h" |
| 29 | 30 | ||
| 31 | #define PORT2_SSIC_CONFIG_REG2 0x883c | ||
| 32 | #define PROG_DONE (1 << 30) | ||
| 33 | #define SSIC_PORT_UNUSED (1 << 31) | ||
| 34 | |||
| 30 | /* Device for a quirk */ | 35 | /* Device for a quirk */ |
| 31 | #define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73 | 36 | #define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73 |
| 32 | #define PCI_DEVICE_ID_FRESCO_LOGIC_PDK 0x1000 | 37 | #define PCI_DEVICE_ID_FRESCO_LOGIC_PDK 0x1000 |
| @@ -176,20 +181,63 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
| 176 | } | 181 | } |
| 177 | 182 | ||
| 178 | /* | 183 | /* |
| 184 | * In some Intel xHCI controllers, in order to get D3 working, | ||
| 185 | * through a vendor specific SSIC CONFIG register at offset 0x883c, | ||
| 186 | * SSIC PORT need to be marked as "unused" before putting xHCI | ||
| 187 | * into D3. After D3 exit, the SSIC port need to be marked as "used". | ||
| 188 | * Without this change, xHCI might not enter D3 state. | ||
| 179 | * Make sure PME works on some Intel xHCI controllers by writing 1 to clear | 189 | * Make sure PME works on some Intel xHCI controllers by writing 1 to clear |
| 180 | * the Internal PME flag bit in vendor specific PMCTRL register at offset 0x80a4 | 190 | * the Internal PME flag bit in vendor specific PMCTRL register at offset 0x80a4 |
| 181 | */ | 191 | */ |
| 182 | static void xhci_pme_quirk(struct xhci_hcd *xhci) | 192 | static void xhci_pme_quirk(struct usb_hcd *hcd, bool suspend) |
| 183 | { | 193 | { |
| 194 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); | ||
| 195 | struct pci_dev *pdev = to_pci_dev(hcd->self.controller); | ||
| 184 | u32 val; | 196 | u32 val; |
| 185 | void __iomem *reg; | 197 | void __iomem *reg; |
| 186 | 198 | ||
| 199 | if (pdev->vendor == PCI_VENDOR_ID_INTEL && | ||
| 200 | pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI) { | ||
| 201 | |||
| 202 | reg = (void __iomem *) xhci->cap_regs + PORT2_SSIC_CONFIG_REG2; | ||
| 203 | |||
| 204 | /* Notify SSIC that SSIC profile programming is not done */ | ||
| 205 | val = readl(reg) & ~PROG_DONE; | ||
| 206 | writel(val, reg); | ||
| 207 | |||
| 208 | /* Mark SSIC port as unused(suspend) or used(resume) */ | ||
| 209 | val = readl(reg); | ||
| 210 | if (suspend) | ||
| 211 | val |= SSIC_PORT_UNUSED; | ||
| 212 | else | ||
| 213 | val &= ~SSIC_PORT_UNUSED; | ||
| 214 | writel(val, reg); | ||
| 215 | |||
| 216 | /* Notify SSIC that SSIC profile programming is done */ | ||
| 217 | val = readl(reg) | PROG_DONE; | ||
| 218 | writel(val, reg); | ||
| 219 | readl(reg); | ||
| 220 | } | ||
| 221 | |||
| 187 | reg = (void __iomem *) xhci->cap_regs + 0x80a4; | 222 | reg = (void __iomem *) xhci->cap_regs + 0x80a4; |
| 188 | val = readl(reg); | 223 | val = readl(reg); |
| 189 | writel(val | BIT(28), reg); | 224 | writel(val | BIT(28), reg); |
| 190 | readl(reg); | 225 | readl(reg); |
| 191 | } | 226 | } |
| 192 | 227 | ||
| 228 | #ifdef CONFIG_ACPI | ||
| 229 | static void xhci_pme_acpi_rtd3_enable(struct pci_dev *dev) | ||
| 230 | { | ||
| 231 | static const u8 intel_dsm_uuid[] = { | ||
| 232 | 0xb7, 0x0c, 0x34, 0xac, 0x01, 0xe9, 0xbf, 0x45, | ||
| 233 | 0xb7, 0xe6, 0x2b, 0x34, 0xec, 0x93, 0x1e, 0x23, | ||
| 234 | }; | ||
| 235 | acpi_evaluate_dsm(ACPI_HANDLE(&dev->dev), intel_dsm_uuid, 3, 1, NULL); | ||
| 236 | } | ||
| 237 | #else | ||
| 238 | static void xhci_pme_acpi_rtd3_enable(struct pci_dev *dev) { } | ||
| 239 | #endif /* CONFIG_ACPI */ | ||
| 240 | |||
| 193 | /* called during probe() after chip reset completes */ | 241 | /* called during probe() after chip reset completes */ |
| 194 | static int xhci_pci_setup(struct usb_hcd *hcd) | 242 | static int xhci_pci_setup(struct usb_hcd *hcd) |
| 195 | { | 243 | { |
| @@ -263,6 +311,9 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
| 263 | HCC_MAX_PSA(xhci->hcc_params) >= 4) | 311 | HCC_MAX_PSA(xhci->hcc_params) >= 4) |
| 264 | xhci->shared_hcd->can_do_streams = 1; | 312 | xhci->shared_hcd->can_do_streams = 1; |
| 265 | 313 | ||
| 314 | if (xhci->quirks & XHCI_PME_STUCK_QUIRK) | ||
| 315 | xhci_pme_acpi_rtd3_enable(dev); | ||
| 316 | |||
| 266 | /* USB-2 and USB-3 roothubs initialized, allow runtime pm suspend */ | 317 | /* USB-2 and USB-3 roothubs initialized, allow runtime pm suspend */ |
| 267 | pm_runtime_put_noidle(&dev->dev); | 318 | pm_runtime_put_noidle(&dev->dev); |
| 268 | 319 | ||
| @@ -307,7 +358,7 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup) | |||
| 307 | pdev->no_d3cold = true; | 358 | pdev->no_d3cold = true; |
| 308 | 359 | ||
| 309 | if (xhci->quirks & XHCI_PME_STUCK_QUIRK) | 360 | if (xhci->quirks & XHCI_PME_STUCK_QUIRK) |
| 310 | xhci_pme_quirk(xhci); | 361 | xhci_pme_quirk(hcd, true); |
| 311 | 362 | ||
| 312 | return xhci_suspend(xhci, do_wakeup); | 363 | return xhci_suspend(xhci, do_wakeup); |
| 313 | } | 364 | } |
| @@ -340,7 +391,7 @@ static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated) | |||
| 340 | usb_enable_intel_xhci_ports(pdev); | 391 | usb_enable_intel_xhci_ports(pdev); |
| 341 | 392 | ||
| 342 | if (xhci->quirks & XHCI_PME_STUCK_QUIRK) | 393 | if (xhci->quirks & XHCI_PME_STUCK_QUIRK) |
| 343 | xhci_pme_quirk(xhci); | 394 | xhci_pme_quirk(hcd, false); |
| 344 | 395 | ||
| 345 | retval = xhci_resume(xhci, hibernated); | 396 | retval = xhci_resume(xhci, hibernated); |
| 346 | return retval; | 397 | return retval; |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 94416ff70810..6a8fc52aed58 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
| @@ -1546,6 +1546,9 @@ static void handle_port_status(struct xhci_hcd *xhci, | |||
| 1546 | usb_hcd_resume_root_hub(hcd); | 1546 | usb_hcd_resume_root_hub(hcd); |
| 1547 | } | 1547 | } |
| 1548 | 1548 | ||
| 1549 | if (hcd->speed == HCD_USB3 && (temp & PORT_PLS_MASK) == XDEV_INACTIVE) | ||
| 1550 | bus_state->port_remote_wakeup &= ~(1 << faked_port_index); | ||
| 1551 | |||
| 1549 | if ((temp & PORT_PLC) && (temp & PORT_PLS_MASK) == XDEV_RESUME) { | 1552 | if ((temp & PORT_PLC) && (temp & PORT_PLS_MASK) == XDEV_RESUME) { |
| 1550 | xhci_dbg(xhci, "port resume event for port %d\n", port_id); | 1553 | xhci_dbg(xhci, "port resume event for port %d\n", port_id); |
| 1551 | 1554 | ||
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 7da0d6043d33..526ebc0c7e72 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
| @@ -3453,6 +3453,9 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev) | |||
| 3453 | return -EINVAL; | 3453 | return -EINVAL; |
| 3454 | } | 3454 | } |
| 3455 | 3455 | ||
| 3456 | if (virt_dev->tt_info) | ||
| 3457 | old_active_eps = virt_dev->tt_info->active_eps; | ||
| 3458 | |||
| 3456 | if (virt_dev->udev != udev) { | 3459 | if (virt_dev->udev != udev) { |
| 3457 | /* If the virt_dev and the udev does not match, this virt_dev | 3460 | /* If the virt_dev and the udev does not match, this virt_dev |
| 3458 | * may belong to another udev. | 3461 | * may belong to another udev. |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 31e46cc55807..ed2ebf647c38 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
| @@ -285,6 +285,7 @@ struct xhci_op_regs { | |||
| 285 | #define XDEV_U0 (0x0 << 5) | 285 | #define XDEV_U0 (0x0 << 5) |
| 286 | #define XDEV_U2 (0x2 << 5) | 286 | #define XDEV_U2 (0x2 << 5) |
| 287 | #define XDEV_U3 (0x3 << 5) | 287 | #define XDEV_U3 (0x3 << 5) |
| 288 | #define XDEV_INACTIVE (0x6 << 5) | ||
| 288 | #define XDEV_RESUME (0xf << 5) | 289 | #define XDEV_RESUME (0xf << 5) |
| 289 | /* true: port has power (see HCC_PPC) */ | 290 | /* true: port has power (see HCC_PPC) */ |
| 290 | #define PORT_POWER (1 << 9) | 291 | #define PORT_POWER (1 << 9) |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index caf188800c67..6b2479123de7 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
| @@ -2065,6 +2065,18 @@ UNUSUAL_DEV( 0x1908, 0x3335, 0x0200, 0x0200, | |||
| 2065 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 2065 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
| 2066 | US_FL_NO_READ_DISC_INFO ), | 2066 | US_FL_NO_READ_DISC_INFO ), |
| 2067 | 2067 | ||
| 2068 | /* Reported by Oliver Neukum <oneukum@suse.com> | ||
| 2069 | * This device morphes spontaneously into another device if the access | ||
| 2070 | * pattern of Windows isn't followed. Thus writable media would be dirty | ||
| 2071 | * if the initial instance is used. So the device is limited to its | ||
| 2072 | * virtual CD. | ||
| 2073 | * And yes, the concept that BCD goes up to 9 is not heeded */ | ||
| 2074 | UNUSUAL_DEV( 0x19d2, 0x1225, 0x0000, 0xffff, | ||
| 2075 | "ZTE,Incorporated", | ||
| 2076 | "ZTE WCDMA Technologies MSM", | ||
| 2077 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
| 2078 | US_FL_SINGLE_LUN ), | ||
| 2079 | |||
| 2068 | /* Reported by Sven Geggus <sven-usbst@geggus.net> | 2080 | /* Reported by Sven Geggus <sven-usbst@geggus.net> |
| 2069 | * This encrypted pen drive returns bogus data for the initial READ(10). | 2081 | * This encrypted pen drive returns bogus data for the initial READ(10). |
| 2070 | */ | 2082 | */ |
| @@ -2074,6 +2086,17 @@ UNUSUAL_DEV( 0x1b1c, 0x1ab5, 0x0200, 0x0200, | |||
| 2074 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 2086 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
| 2075 | US_FL_INITIAL_READ10 ), | 2087 | US_FL_INITIAL_READ10 ), |
| 2076 | 2088 | ||
| 2089 | /* Reported by Hans de Goede <hdegoede@redhat.com> | ||
| 2090 | * These are mini projectors using USB for both power and video data transport | ||
| 2091 | * The usb-storage interface is a virtual windows driver CD, which the gm12u320 | ||
| 2092 | * driver automatically converts into framebuffer & kms dri device nodes. | ||
| 2093 | */ | ||
| 2094 | UNUSUAL_DEV( 0x1de1, 0xc102, 0x0000, 0xffff, | ||
| 2095 | "Grain-media Technology Corp.", | ||
| 2096 | "USB3.0 Device GM12U320", | ||
| 2097 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
| 2098 | US_FL_IGNORE_DEVICE ), | ||
| 2099 | |||
| 2077 | /* Patch by Richard Schütz <r.schtz@t-online.de> | 2100 | /* Patch by Richard Schütz <r.schtz@t-online.de> |
| 2078 | * This external hard drive enclosure uses a JMicron chip which | 2101 | * This external hard drive enclosure uses a JMicron chip which |
| 2079 | * needs the US_FL_IGNORE_RESIDUE flag to work properly. */ | 2102 | * needs the US_FL_IGNORE_RESIDUE flag to work properly. */ |
