diff options
| -rw-r--r-- | MAINTAINERS | 1 | ||||
| -rw-r--r-- | drivers/phy/marvell/phy-mvebu-cp110-comphy.c | 18 | ||||
| -rw-r--r-- | drivers/phy/mediatek/phy-mtk-tphy.c | 3 | ||||
| -rw-r--r-- | drivers/phy/rockchip/phy-rockchip-typec.c | 82 | ||||
| -rw-r--r-- | drivers/phy/tegra/xusb.c | 2 | ||||
| -rw-r--r-- | drivers/usb/class/cdc-acm.c | 3 | ||||
| -rw-r--r-- | drivers/usb/core/config.c | 6 | ||||
| -rw-r--r-- | drivers/usb/core/devio.c | 6 | ||||
| -rw-r--r-- | drivers/usb/core/hub.c | 11 | ||||
| -rw-r--r-- | drivers/usb/core/quirks.c | 4 | ||||
| -rw-r--r-- | drivers/usb/host/xhci-hub.c | 23 | ||||
| -rw-r--r-- | drivers/usb/host/xhci-ring.c | 21 | ||||
| -rw-r--r-- | drivers/usb/host/xhci.c | 3 | ||||
| -rw-r--r-- | drivers/usb/musb/musb_core.c | 21 | ||||
| -rw-r--r-- | drivers/usb/musb/musb_core.h | 2 | ||||
| -rw-r--r-- | drivers/usb/musb/musb_cppi41.c | 94 | ||||
| -rw-r--r-- | drivers/usb/musb/sunxi.c | 2 | ||||
| -rw-r--r-- | drivers/usb/serial/metro-usb.c | 1 |
18 files changed, 226 insertions, 77 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index e652a3e2929d..d85c08956875 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -9213,7 +9213,6 @@ F: include/linux/isicom.h | |||
| 9213 | MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER | 9213 | MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER |
| 9214 | M: Bin Liu <b-liu@ti.com> | 9214 | M: Bin Liu <b-liu@ti.com> |
| 9215 | L: linux-usb@vger.kernel.org | 9215 | L: linux-usb@vger.kernel.org |
| 9216 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git | ||
| 9217 | S: Maintained | 9216 | S: Maintained |
| 9218 | F: drivers/usb/musb/ | 9217 | F: drivers/usb/musb/ |
| 9219 | 9218 | ||
diff --git a/drivers/phy/marvell/phy-mvebu-cp110-comphy.c b/drivers/phy/marvell/phy-mvebu-cp110-comphy.c index 73ebad6634a7..89c887ea5557 100644 --- a/drivers/phy/marvell/phy-mvebu-cp110-comphy.c +++ b/drivers/phy/marvell/phy-mvebu-cp110-comphy.c | |||
| @@ -111,6 +111,8 @@ | |||
| 111 | #define MVEBU_COMPHY_CONF6_40B BIT(18) | 111 | #define MVEBU_COMPHY_CONF6_40B BIT(18) |
| 112 | #define MVEBU_COMPHY_SELECTOR 0x1140 | 112 | #define MVEBU_COMPHY_SELECTOR 0x1140 |
| 113 | #define MVEBU_COMPHY_SELECTOR_PHY(n) ((n) * 0x4) | 113 | #define MVEBU_COMPHY_SELECTOR_PHY(n) ((n) * 0x4) |
| 114 | #define MVEBU_COMPHY_PIPE_SELECTOR 0x1144 | ||
| 115 | #define MVEBU_COMPHY_PIPE_SELECTOR_PIPE(n) ((n) * 0x4) | ||
| 114 | 116 | ||
| 115 | #define MVEBU_COMPHY_LANES 6 | 117 | #define MVEBU_COMPHY_LANES 6 |
| 116 | #define MVEBU_COMPHY_PORTS 3 | 118 | #define MVEBU_COMPHY_PORTS 3 |
| @@ -468,13 +470,17 @@ static int mvebu_comphy_power_on(struct phy *phy) | |||
| 468 | { | 470 | { |
| 469 | struct mvebu_comphy_lane *lane = phy_get_drvdata(phy); | 471 | struct mvebu_comphy_lane *lane = phy_get_drvdata(phy); |
| 470 | struct mvebu_comphy_priv *priv = lane->priv; | 472 | struct mvebu_comphy_priv *priv = lane->priv; |
| 471 | int ret; | 473 | int ret, mux; |
| 472 | u32 mux, val; | 474 | u32 val; |
| 473 | 475 | ||
| 474 | mux = mvebu_comphy_get_mux(lane->id, lane->port, lane->mode); | 476 | mux = mvebu_comphy_get_mux(lane->id, lane->port, lane->mode); |
| 475 | if (mux < 0) | 477 | if (mux < 0) |
| 476 | return -ENOTSUPP; | 478 | return -ENOTSUPP; |
| 477 | 479 | ||
| 480 | regmap_read(priv->regmap, MVEBU_COMPHY_PIPE_SELECTOR, &val); | ||
| 481 | val &= ~(0xf << MVEBU_COMPHY_PIPE_SELECTOR_PIPE(lane->id)); | ||
| 482 | regmap_write(priv->regmap, MVEBU_COMPHY_PIPE_SELECTOR, val); | ||
| 483 | |||
| 478 | regmap_read(priv->regmap, MVEBU_COMPHY_SELECTOR, &val); | 484 | regmap_read(priv->regmap, MVEBU_COMPHY_SELECTOR, &val); |
| 479 | val &= ~(0xf << MVEBU_COMPHY_SELECTOR_PHY(lane->id)); | 485 | val &= ~(0xf << MVEBU_COMPHY_SELECTOR_PHY(lane->id)); |
| 480 | val |= mux << MVEBU_COMPHY_SELECTOR_PHY(lane->id); | 486 | val |= mux << MVEBU_COMPHY_SELECTOR_PHY(lane->id); |
| @@ -526,6 +532,10 @@ static int mvebu_comphy_power_off(struct phy *phy) | |||
| 526 | val &= ~(0xf << MVEBU_COMPHY_SELECTOR_PHY(lane->id)); | 532 | val &= ~(0xf << MVEBU_COMPHY_SELECTOR_PHY(lane->id)); |
| 527 | regmap_write(priv->regmap, MVEBU_COMPHY_SELECTOR, val); | 533 | regmap_write(priv->regmap, MVEBU_COMPHY_SELECTOR, val); |
| 528 | 534 | ||
| 535 | regmap_read(priv->regmap, MVEBU_COMPHY_PIPE_SELECTOR, &val); | ||
| 536 | val &= ~(0xf << MVEBU_COMPHY_PIPE_SELECTOR_PIPE(lane->id)); | ||
| 537 | regmap_write(priv->regmap, MVEBU_COMPHY_PIPE_SELECTOR, val); | ||
| 538 | |||
| 529 | return 0; | 539 | return 0; |
| 530 | } | 540 | } |
| 531 | 541 | ||
| @@ -576,8 +586,8 @@ static int mvebu_comphy_probe(struct platform_device *pdev) | |||
| 576 | return PTR_ERR(priv->regmap); | 586 | return PTR_ERR(priv->regmap); |
| 577 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 587 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 578 | priv->base = devm_ioremap_resource(&pdev->dev, res); | 588 | priv->base = devm_ioremap_resource(&pdev->dev, res); |
| 579 | if (!priv->base) | 589 | if (IS_ERR(priv->base)) |
| 580 | return -ENOMEM; | 590 | return PTR_ERR(priv->base); |
| 581 | 591 | ||
| 582 | for_each_available_child_of_node(pdev->dev.of_node, child) { | 592 | for_each_available_child_of_node(pdev->dev.of_node, child) { |
| 583 | struct mvebu_comphy_lane *lane; | 593 | struct mvebu_comphy_lane *lane; |
diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c index e3baad78521f..721a2a1c97ef 100644 --- a/drivers/phy/mediatek/phy-mtk-tphy.c +++ b/drivers/phy/mediatek/phy-mtk-tphy.c | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | /* banks shared by multiple phys */ | 27 | /* banks shared by multiple phys */ |
| 28 | #define SSUSB_SIFSLV_V1_SPLLC 0x000 /* shared by u3 phys */ | 28 | #define SSUSB_SIFSLV_V1_SPLLC 0x000 /* shared by u3 phys */ |
| 29 | #define SSUSB_SIFSLV_V1_U2FREQ 0x100 /* shared by u2 phys */ | 29 | #define SSUSB_SIFSLV_V1_U2FREQ 0x100 /* shared by u2 phys */ |
| 30 | #define SSUSB_SIFSLV_V1_CHIP 0x300 /* shared by u3 phys */ | ||
| 30 | /* u2 phy bank */ | 31 | /* u2 phy bank */ |
| 31 | #define SSUSB_SIFSLV_V1_U2PHY_COM 0x000 | 32 | #define SSUSB_SIFSLV_V1_U2PHY_COM 0x000 |
| 32 | /* u3/pcie/sata phy banks */ | 33 | /* u3/pcie/sata phy banks */ |
| @@ -762,7 +763,7 @@ static void phy_v1_banks_init(struct mtk_tphy *tphy, | |||
| 762 | case PHY_TYPE_USB3: | 763 | case PHY_TYPE_USB3: |
| 763 | case PHY_TYPE_PCIE: | 764 | case PHY_TYPE_PCIE: |
| 764 | u3_banks->spllc = tphy->sif_base + SSUSB_SIFSLV_V1_SPLLC; | 765 | u3_banks->spllc = tphy->sif_base + SSUSB_SIFSLV_V1_SPLLC; |
| 765 | u3_banks->chip = NULL; | 766 | u3_banks->chip = tphy->sif_base + SSUSB_SIFSLV_V1_CHIP; |
| 766 | u3_banks->phyd = instance->port_base + SSUSB_SIFSLV_V1_U3PHYD; | 767 | u3_banks->phyd = instance->port_base + SSUSB_SIFSLV_V1_U3PHYD; |
| 767 | u3_banks->phya = instance->port_base + SSUSB_SIFSLV_V1_U3PHYA; | 768 | u3_banks->phya = instance->port_base + SSUSB_SIFSLV_V1_U3PHYA; |
| 768 | break; | 769 | break; |
diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c index 4d2c57f21d76..a958c9bced01 100644 --- a/drivers/phy/rockchip/phy-rockchip-typec.c +++ b/drivers/phy/rockchip/phy-rockchip-typec.c | |||
| @@ -443,14 +443,34 @@ static inline int property_enable(struct rockchip_typec_phy *tcphy, | |||
| 443 | return regmap_write(tcphy->grf_regs, reg->offset, val | mask); | 443 | return regmap_write(tcphy->grf_regs, reg->offset, val | mask); |
| 444 | } | 444 | } |
| 445 | 445 | ||
| 446 | static void tcphy_dp_aux_set_flip(struct rockchip_typec_phy *tcphy) | ||
| 447 | { | ||
| 448 | u16 tx_ana_ctrl_reg_1; | ||
| 449 | |||
| 450 | /* | ||
| 451 | * Select the polarity of the xcvr: | ||
| 452 | * 1, Reverses the polarity (If TYPEC, Pulls ups aux_p and pull | ||
| 453 | * down aux_m) | ||
| 454 | * 0, Normal polarity (if TYPEC, pulls up aux_m and pulls down | ||
| 455 | * aux_p) | ||
| 456 | */ | ||
| 457 | tx_ana_ctrl_reg_1 = readl(tcphy->base + TX_ANA_CTRL_REG_1); | ||
| 458 | if (!tcphy->flip) | ||
| 459 | tx_ana_ctrl_reg_1 |= BIT(12); | ||
| 460 | else | ||
| 461 | tx_ana_ctrl_reg_1 &= ~BIT(12); | ||
| 462 | writel(tx_ana_ctrl_reg_1, tcphy->base + TX_ANA_CTRL_REG_1); | ||
| 463 | } | ||
| 464 | |||
| 446 | static void tcphy_dp_aux_calibration(struct rockchip_typec_phy *tcphy) | 465 | static void tcphy_dp_aux_calibration(struct rockchip_typec_phy *tcphy) |
| 447 | { | 466 | { |
| 467 | u16 tx_ana_ctrl_reg_1; | ||
| 448 | u16 rdata, rdata2, val; | 468 | u16 rdata, rdata2, val; |
| 449 | 469 | ||
| 450 | /* disable txda_cal_latch_en for rewrite the calibration values */ | 470 | /* disable txda_cal_latch_en for rewrite the calibration values */ |
| 451 | rdata = readl(tcphy->base + TX_ANA_CTRL_REG_1); | 471 | tx_ana_ctrl_reg_1 = readl(tcphy->base + TX_ANA_CTRL_REG_1); |
| 452 | val = rdata & 0xdfff; | 472 | tx_ana_ctrl_reg_1 &= ~BIT(13); |
| 453 | writel(val, tcphy->base + TX_ANA_CTRL_REG_1); | 473 | writel(tx_ana_ctrl_reg_1, tcphy->base + TX_ANA_CTRL_REG_1); |
| 454 | 474 | ||
| 455 | /* | 475 | /* |
| 456 | * read a resistor calibration code from CMN_TXPUCAL_CTRL[6:0] and | 476 | * read a resistor calibration code from CMN_TXPUCAL_CTRL[6:0] and |
| @@ -472,9 +492,8 @@ static void tcphy_dp_aux_calibration(struct rockchip_typec_phy *tcphy) | |||
| 472 | * Activate this signal for 1 clock cycle to sample new calibration | 492 | * Activate this signal for 1 clock cycle to sample new calibration |
| 473 | * values. | 493 | * values. |
| 474 | */ | 494 | */ |
| 475 | rdata = readl(tcphy->base + TX_ANA_CTRL_REG_1); | 495 | tx_ana_ctrl_reg_1 |= BIT(13); |
| 476 | val = rdata | 0x2000; | 496 | writel(tx_ana_ctrl_reg_1, tcphy->base + TX_ANA_CTRL_REG_1); |
| 477 | writel(val, tcphy->base + TX_ANA_CTRL_REG_1); | ||
| 478 | usleep_range(150, 200); | 497 | usleep_range(150, 200); |
| 479 | 498 | ||
| 480 | /* set TX Voltage Level and TX Deemphasis to 0 */ | 499 | /* set TX Voltage Level and TX Deemphasis to 0 */ |
| @@ -482,8 +501,10 @@ static void tcphy_dp_aux_calibration(struct rockchip_typec_phy *tcphy) | |||
| 482 | /* re-enable decap */ | 501 | /* re-enable decap */ |
| 483 | writel(0x100, tcphy->base + TX_ANA_CTRL_REG_2); | 502 | writel(0x100, tcphy->base + TX_ANA_CTRL_REG_2); |
| 484 | writel(0x300, tcphy->base + TX_ANA_CTRL_REG_2); | 503 | writel(0x300, tcphy->base + TX_ANA_CTRL_REG_2); |
| 485 | writel(0x2008, tcphy->base + TX_ANA_CTRL_REG_1); | 504 | tx_ana_ctrl_reg_1 |= BIT(3); |
| 486 | writel(0x2018, tcphy->base + TX_ANA_CTRL_REG_1); | 505 | writel(tx_ana_ctrl_reg_1, tcphy->base + TX_ANA_CTRL_REG_1); |
| 506 | tx_ana_ctrl_reg_1 |= BIT(4); | ||
| 507 | writel(tx_ana_ctrl_reg_1, tcphy->base + TX_ANA_CTRL_REG_1); | ||
| 487 | 508 | ||
| 488 | writel(0, tcphy->base + TX_ANA_CTRL_REG_5); | 509 | writel(0, tcphy->base + TX_ANA_CTRL_REG_5); |
| 489 | 510 | ||
| @@ -494,8 +515,10 @@ static void tcphy_dp_aux_calibration(struct rockchip_typec_phy *tcphy) | |||
| 494 | writel(0x1001, tcphy->base + TX_ANA_CTRL_REG_4); | 515 | writel(0x1001, tcphy->base + TX_ANA_CTRL_REG_4); |
| 495 | 516 | ||
| 496 | /* re-enables Bandgap reference for LDO */ | 517 | /* re-enables Bandgap reference for LDO */ |
| 497 | writel(0x2098, tcphy->base + TX_ANA_CTRL_REG_1); | 518 | tx_ana_ctrl_reg_1 |= BIT(7); |
| 498 | writel(0x2198, tcphy->base + TX_ANA_CTRL_REG_1); | 519 | writel(tx_ana_ctrl_reg_1, tcphy->base + TX_ANA_CTRL_REG_1); |
| 520 | tx_ana_ctrl_reg_1 |= BIT(8); | ||
| 521 | writel(tx_ana_ctrl_reg_1, tcphy->base + TX_ANA_CTRL_REG_1); | ||
| 499 | 522 | ||
| 500 | /* | 523 | /* |
| 501 | * re-enables the transmitter pre-driver, driver data selection MUX, | 524 | * re-enables the transmitter pre-driver, driver data selection MUX, |
| @@ -505,27 +528,26 @@ static void tcphy_dp_aux_calibration(struct rockchip_typec_phy *tcphy) | |||
| 505 | writel(0x303, tcphy->base + TX_ANA_CTRL_REG_2); | 528 | writel(0x303, tcphy->base + TX_ANA_CTRL_REG_2); |
| 506 | 529 | ||
| 507 | /* | 530 | /* |
| 508 | * BIT 12: Controls auxda_polarity, which selects the polarity of the | 531 | * Do some magic undocumented stuff, some of which appears to |
| 509 | * xcvr: | 532 | * undo the "re-enables Bandgap reference for LDO" above. |
| 510 | * 1, Reverses the polarity (If TYPEC, Pulls ups aux_p and pull | ||
| 511 | * down aux_m) | ||
| 512 | * 0, Normal polarity (if TYPE_C, pulls up aux_m and pulls down | ||
| 513 | * aux_p) | ||
| 514 | */ | 533 | */ |
| 515 | val = 0xa078; | 534 | tx_ana_ctrl_reg_1 |= BIT(15); |
| 516 | if (!tcphy->flip) | 535 | tx_ana_ctrl_reg_1 &= ~BIT(8); |
| 517 | val |= BIT(12); | 536 | tx_ana_ctrl_reg_1 &= ~BIT(7); |
| 518 | writel(val, tcphy->base + TX_ANA_CTRL_REG_1); | 537 | tx_ana_ctrl_reg_1 |= BIT(6); |
| 538 | tx_ana_ctrl_reg_1 |= BIT(5); | ||
| 539 | writel(tx_ana_ctrl_reg_1, tcphy->base + TX_ANA_CTRL_REG_1); | ||
| 519 | 540 | ||
| 520 | writel(0, tcphy->base + TX_ANA_CTRL_REG_3); | 541 | writel(0, tcphy->base + TX_ANA_CTRL_REG_3); |
| 521 | writel(0, tcphy->base + TX_ANA_CTRL_REG_4); | 542 | writel(0, tcphy->base + TX_ANA_CTRL_REG_4); |
| 522 | writel(0, tcphy->base + TX_ANA_CTRL_REG_5); | 543 | writel(0, tcphy->base + TX_ANA_CTRL_REG_5); |
| 523 | 544 | ||
| 524 | /* | 545 | /* |
| 525 | * Controls low_power_swing_en, set the voltage swing of the driver | 546 | * Controls low_power_swing_en, don't set the voltage swing of the |
| 526 | * to 400mv. The values below are peak to peak (differential) values. | 547 | * driver to 400mv. The values below are peak to peak (differential) |
| 548 | * values. | ||
| 527 | */ | 549 | */ |
| 528 | writel(4, tcphy->base + TXDA_COEFF_CALC_CTRL); | 550 | writel(0, tcphy->base + TXDA_COEFF_CALC_CTRL); |
| 529 | writel(0, tcphy->base + TXDA_CYA_AUXDA_CYA); | 551 | writel(0, tcphy->base + TXDA_CYA_AUXDA_CYA); |
| 530 | 552 | ||
| 531 | /* Controls tx_high_z_tm_en */ | 553 | /* Controls tx_high_z_tm_en */ |
| @@ -555,6 +577,7 @@ static int tcphy_phy_init(struct rockchip_typec_phy *tcphy, u8 mode) | |||
| 555 | reset_control_deassert(tcphy->tcphy_rst); | 577 | reset_control_deassert(tcphy->tcphy_rst); |
| 556 | 578 | ||
| 557 | property_enable(tcphy, &cfg->typec_conn_dir, tcphy->flip); | 579 | property_enable(tcphy, &cfg->typec_conn_dir, tcphy->flip); |
| 580 | tcphy_dp_aux_set_flip(tcphy); | ||
| 558 | 581 | ||
| 559 | tcphy_cfg_24m(tcphy); | 582 | tcphy_cfg_24m(tcphy); |
| 560 | 583 | ||
| @@ -685,8 +708,11 @@ static int rockchip_usb3_phy_power_on(struct phy *phy) | |||
| 685 | if (tcphy->mode == new_mode) | 708 | if (tcphy->mode == new_mode) |
| 686 | goto unlock_ret; | 709 | goto unlock_ret; |
| 687 | 710 | ||
| 688 | if (tcphy->mode == MODE_DISCONNECT) | 711 | if (tcphy->mode == MODE_DISCONNECT) { |
| 689 | tcphy_phy_init(tcphy, new_mode); | 712 | ret = tcphy_phy_init(tcphy, new_mode); |
| 713 | if (ret) | ||
| 714 | goto unlock_ret; | ||
| 715 | } | ||
| 690 | 716 | ||
| 691 | /* wait TCPHY for pipe ready */ | 717 | /* wait TCPHY for pipe ready */ |
| 692 | for (timeout = 0; timeout < 100; timeout++) { | 718 | for (timeout = 0; timeout < 100; timeout++) { |
| @@ -760,10 +786,12 @@ static int rockchip_dp_phy_power_on(struct phy *phy) | |||
| 760 | */ | 786 | */ |
| 761 | if (new_mode == MODE_DFP_DP && tcphy->mode != MODE_DISCONNECT) { | 787 | if (new_mode == MODE_DFP_DP && tcphy->mode != MODE_DISCONNECT) { |
| 762 | tcphy_phy_deinit(tcphy); | 788 | tcphy_phy_deinit(tcphy); |
| 763 | tcphy_phy_init(tcphy, new_mode); | 789 | ret = tcphy_phy_init(tcphy, new_mode); |
| 764 | } else if (tcphy->mode == MODE_DISCONNECT) { | 790 | } else if (tcphy->mode == MODE_DISCONNECT) { |
| 765 | tcphy_phy_init(tcphy, new_mode); | 791 | ret = tcphy_phy_init(tcphy, new_mode); |
| 766 | } | 792 | } |
| 793 | if (ret) | ||
| 794 | goto unlock_ret; | ||
| 767 | 795 | ||
| 768 | ret = readx_poll_timeout(readl, tcphy->base + DP_MODE_CTL, | 796 | ret = readx_poll_timeout(readl, tcphy->base + DP_MODE_CTL, |
| 769 | val, val & DP_MODE_A2, 1000, | 797 | val, val & DP_MODE_A2, 1000, |
diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c index 3cbcb2537657..4307bf0013e1 100644 --- a/drivers/phy/tegra/xusb.c +++ b/drivers/phy/tegra/xusb.c | |||
| @@ -454,6 +454,8 @@ tegra_xusb_find_port_node(struct tegra_xusb_padctl *padctl, const char *type, | |||
| 454 | char *name; | 454 | char *name; |
| 455 | 455 | ||
| 456 | name = kasprintf(GFP_KERNEL, "%s-%u", type, index); | 456 | name = kasprintf(GFP_KERNEL, "%s-%u", type, index); |
| 457 | if (!name) | ||
| 458 | return ERR_PTR(-ENOMEM); | ||
| 457 | np = of_find_node_by_name(np, name); | 459 | np = of_find_node_by_name(np, name); |
| 458 | kfree(name); | 460 | kfree(name); |
| 459 | } | 461 | } |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 5e056064259c..18c923a4c16e 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
| @@ -1832,6 +1832,9 @@ static const struct usb_device_id acm_ids[] = { | |||
| 1832 | { USB_DEVICE(0xfff0, 0x0100), /* DATECS FP-2000 */ | 1832 | { USB_DEVICE(0xfff0, 0x0100), /* DATECS FP-2000 */ |
| 1833 | .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */ | 1833 | .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */ |
| 1834 | }, | 1834 | }, |
| 1835 | { USB_DEVICE(0x09d8, 0x0320), /* Elatec GmbH TWN3 */ | ||
| 1836 | .driver_info = NO_UNION_NORMAL, /* has misplaced union descriptor */ | ||
| 1837 | }, | ||
| 1835 | 1838 | ||
| 1836 | { USB_DEVICE(0x2912, 0x0001), /* ATOL FPrint */ | 1839 | { USB_DEVICE(0x2912, 0x0001), /* ATOL FPrint */ |
| 1837 | .driver_info = CLEAR_HALT_CONDITIONS, | 1840 | .driver_info = CLEAR_HALT_CONDITIONS, |
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 68b54bd88d1e..883549ee946c 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c | |||
| @@ -960,10 +960,12 @@ int usb_get_bos_descriptor(struct usb_device *dev) | |||
| 960 | for (i = 0; i < num; i++) { | 960 | for (i = 0; i < num; i++) { |
| 961 | buffer += length; | 961 | buffer += length; |
| 962 | cap = (struct usb_dev_cap_header *)buffer; | 962 | cap = (struct usb_dev_cap_header *)buffer; |
| 963 | length = cap->bLength; | ||
| 964 | 963 | ||
| 965 | if (total_len < length) | 964 | if (total_len < sizeof(*cap) || total_len < cap->bLength) { |
| 965 | dev->bos->desc->bNumDeviceCaps = i; | ||
| 966 | break; | 966 | break; |
| 967 | } | ||
| 968 | length = cap->bLength; | ||
| 967 | total_len -= length; | 969 | total_len -= length; |
| 968 | 970 | ||
| 969 | if (cap->bDescriptorType != USB_DT_DEVICE_CAPABILITY) { | 971 | if (cap->bDescriptorType != USB_DT_DEVICE_CAPABILITY) { |
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 4664e543cf2f..e9326f31db8d 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
| @@ -1576,11 +1576,7 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb | |||
| 1576 | totlen += isopkt[u].length; | 1576 | totlen += isopkt[u].length; |
| 1577 | } | 1577 | } |
| 1578 | u *= sizeof(struct usb_iso_packet_descriptor); | 1578 | u *= sizeof(struct usb_iso_packet_descriptor); |
| 1579 | if (totlen <= uurb->buffer_length) | 1579 | uurb->buffer_length = totlen; |
| 1580 | uurb->buffer_length = totlen; | ||
| 1581 | else | ||
| 1582 | WARN_ONCE(1, "uurb->buffer_length is too short %d vs %d", | ||
| 1583 | totlen, uurb->buffer_length); | ||
| 1584 | break; | 1580 | break; |
| 1585 | 1581 | ||
| 1586 | default: | 1582 | default: |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index b5c733613823..e9ce6bb0b22d 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
| @@ -2710,13 +2710,16 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1, | |||
| 2710 | if (!(portstatus & USB_PORT_STAT_CONNECTION)) | 2710 | if (!(portstatus & USB_PORT_STAT_CONNECTION)) |
| 2711 | return -ENOTCONN; | 2711 | return -ENOTCONN; |
| 2712 | 2712 | ||
| 2713 | /* bomb out completely if the connection bounced. A USB 3.0 | 2713 | /* Retry if connect change is set but status is still connected. |
| 2714 | * connection may bounce if multiple warm resets were issued, | 2714 | * A USB 3.0 connection may bounce if multiple warm resets were issued, |
| 2715 | * but the device may have successfully re-connected. Ignore it. | 2715 | * but the device may have successfully re-connected. Ignore it. |
| 2716 | */ | 2716 | */ |
| 2717 | if (!hub_is_superspeed(hub->hdev) && | 2717 | if (!hub_is_superspeed(hub->hdev) && |
| 2718 | (portchange & USB_PORT_STAT_C_CONNECTION)) | 2718 | (portchange & USB_PORT_STAT_C_CONNECTION)) { |
| 2719 | return -ENOTCONN; | 2719 | usb_clear_port_feature(hub->hdev, port1, |
| 2720 | USB_PORT_FEAT_C_CONNECTION); | ||
| 2721 | return -EAGAIN; | ||
| 2722 | } | ||
| 2720 | 2723 | ||
| 2721 | if (!(portstatus & USB_PORT_STAT_ENABLE)) | 2724 | if (!(portstatus & USB_PORT_STAT_ENABLE)) |
| 2722 | return -EBUSY; | 2725 | return -EBUSY; |
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index 82806e311202..a6aaf2f193a4 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
| @@ -221,6 +221,10 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
| 221 | /* Corsair Strafe RGB */ | 221 | /* Corsair Strafe RGB */ |
| 222 | { USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT }, | 222 | { USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT }, |
| 223 | 223 | ||
| 224 | /* MIDI keyboard WORLDE MINI */ | ||
| 225 | { USB_DEVICE(0x1c75, 0x0204), .driver_info = | ||
| 226 | USB_QUIRK_CONFIG_INTF_STRINGS }, | ||
| 227 | |||
| 224 | /* Acer C120 LED Projector */ | 228 | /* Acer C120 LED Projector */ |
| 225 | { USB_DEVICE(0x1de1, 0xc102), .driver_info = USB_QUIRK_NO_LPM }, | 229 | { USB_DEVICE(0x1de1, 0xc102), .driver_info = USB_QUIRK_NO_LPM }, |
| 226 | 230 | ||
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index da9158f171cb..a2336deb5e36 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
| @@ -420,14 +420,25 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend) | |||
| 420 | GFP_NOWAIT); | 420 | GFP_NOWAIT); |
| 421 | if (!command) { | 421 | if (!command) { |
| 422 | spin_unlock_irqrestore(&xhci->lock, flags); | 422 | spin_unlock_irqrestore(&xhci->lock, flags); |
| 423 | xhci_free_command(xhci, cmd); | 423 | ret = -ENOMEM; |
| 424 | return -ENOMEM; | 424 | goto cmd_cleanup; |
| 425 | } | ||
| 426 | |||
| 427 | ret = xhci_queue_stop_endpoint(xhci, command, slot_id, | ||
| 428 | i, suspend); | ||
| 429 | if (ret) { | ||
| 430 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
| 431 | xhci_free_command(xhci, command); | ||
| 432 | goto cmd_cleanup; | ||
| 425 | } | 433 | } |
| 426 | xhci_queue_stop_endpoint(xhci, command, slot_id, i, | ||
| 427 | suspend); | ||
| 428 | } | 434 | } |
| 429 | } | 435 | } |
| 430 | xhci_queue_stop_endpoint(xhci, cmd, slot_id, 0, suspend); | 436 | ret = xhci_queue_stop_endpoint(xhci, cmd, slot_id, 0, suspend); |
| 437 | if (ret) { | ||
| 438 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
| 439 | goto cmd_cleanup; | ||
| 440 | } | ||
| 441 | |||
| 431 | xhci_ring_cmd_db(xhci); | 442 | xhci_ring_cmd_db(xhci); |
| 432 | spin_unlock_irqrestore(&xhci->lock, flags); | 443 | spin_unlock_irqrestore(&xhci->lock, flags); |
| 433 | 444 | ||
| @@ -439,6 +450,8 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend) | |||
| 439 | xhci_warn(xhci, "Timeout while waiting for stop endpoint command\n"); | 450 | xhci_warn(xhci, "Timeout while waiting for stop endpoint command\n"); |
| 440 | ret = -ETIME; | 451 | ret = -ETIME; |
| 441 | } | 452 | } |
| 453 | |||
| 454 | cmd_cleanup: | ||
| 442 | xhci_free_command(xhci, cmd); | 455 | xhci_free_command(xhci, cmd); |
| 443 | return ret; | 456 | return ret; |
| 444 | } | 457 | } |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index a9443651ce0f..82c746e2d85c 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
| @@ -1309,6 +1309,7 @@ static void xhci_complete_del_and_free_cmd(struct xhci_command *cmd, u32 status) | |||
| 1309 | void xhci_cleanup_command_queue(struct xhci_hcd *xhci) | 1309 | void xhci_cleanup_command_queue(struct xhci_hcd *xhci) |
| 1310 | { | 1310 | { |
| 1311 | struct xhci_command *cur_cmd, *tmp_cmd; | 1311 | struct xhci_command *cur_cmd, *tmp_cmd; |
| 1312 | xhci->current_cmd = NULL; | ||
| 1312 | list_for_each_entry_safe(cur_cmd, tmp_cmd, &xhci->cmd_list, cmd_list) | 1313 | list_for_each_entry_safe(cur_cmd, tmp_cmd, &xhci->cmd_list, cmd_list) |
| 1313 | xhci_complete_del_and_free_cmd(cur_cmd, COMP_COMMAND_ABORTED); | 1314 | xhci_complete_del_and_free_cmd(cur_cmd, COMP_COMMAND_ABORTED); |
| 1314 | } | 1315 | } |
| @@ -2579,15 +2580,21 @@ static int handle_tx_event(struct xhci_hcd *xhci, | |||
| 2579 | (struct xhci_generic_trb *) ep_trb); | 2580 | (struct xhci_generic_trb *) ep_trb); |
| 2580 | 2581 | ||
| 2581 | /* | 2582 | /* |
| 2582 | * No-op TRB should not trigger interrupts. | 2583 | * No-op TRB could trigger interrupts in a case where |
| 2583 | * If ep_trb is a no-op TRB, it means the | 2584 | * a URB was killed and a STALL_ERROR happens right |
| 2584 | * corresponding TD has been cancelled. Just ignore | 2585 | * after the endpoint ring stopped. Reset the halted |
| 2585 | * the TD. | 2586 | * endpoint. Otherwise, the endpoint remains stalled |
| 2587 | * indefinitely. | ||
| 2586 | */ | 2588 | */ |
| 2587 | if (trb_is_noop(ep_trb)) { | 2589 | if (trb_is_noop(ep_trb)) { |
| 2588 | xhci_dbg(xhci, | 2590 | if (trb_comp_code == COMP_STALL_ERROR || |
| 2589 | "ep_trb is a no-op TRB. Skip it for slot %u ep %u\n", | 2591 | xhci_requires_manual_halt_cleanup(xhci, ep_ctx, |
| 2590 | slot_id, ep_index); | 2592 | trb_comp_code)) |
| 2593 | xhci_cleanup_halted_endpoint(xhci, slot_id, | ||
| 2594 | ep_index, | ||
| 2595 | ep_ring->stream_id, | ||
| 2596 | td, ep_trb, | ||
| 2597 | EP_HARD_RESET); | ||
| 2591 | goto cleanup; | 2598 | goto cleanup; |
| 2592 | } | 2599 | } |
| 2593 | 2600 | ||
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index ee198ea47f49..51535ba2bcd4 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
| @@ -4805,7 +4805,8 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) | |||
| 4805 | */ | 4805 | */ |
| 4806 | hcd->has_tt = 1; | 4806 | hcd->has_tt = 1; |
| 4807 | } else { | 4807 | } else { |
| 4808 | if (xhci->sbrn == 0x31) { | 4808 | /* Some 3.1 hosts return sbrn 0x30, can't rely on sbrn alone */ |
| 4809 | if (xhci->sbrn == 0x31 || xhci->usb3_rhub.min_rev >= 1) { | ||
| 4809 | xhci_info(xhci, "Host supports USB 3.1 Enhanced SuperSpeed\n"); | 4810 | xhci_info(xhci, "Host supports USB 3.1 Enhanced SuperSpeed\n"); |
| 4810 | hcd->speed = HCD_USB31; | 4811 | hcd->speed = HCD_USB31; |
| 4811 | hcd->self.root_hub->speed = USB_SPEED_SUPER_PLUS; | 4812 | hcd->self.root_hub->speed = USB_SPEED_SUPER_PLUS; |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 029692053dd3..ff5a1a8989d5 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
| @@ -906,7 +906,7 @@ b_host: | |||
| 906 | */ | 906 | */ |
| 907 | if (int_usb & MUSB_INTR_RESET) { | 907 | if (int_usb & MUSB_INTR_RESET) { |
| 908 | handled = IRQ_HANDLED; | 908 | handled = IRQ_HANDLED; |
| 909 | if (devctl & MUSB_DEVCTL_HM) { | 909 | if (is_host_active(musb)) { |
| 910 | /* | 910 | /* |
| 911 | * When BABBLE happens what we can depends on which | 911 | * When BABBLE happens what we can depends on which |
| 912 | * platform MUSB is running, because some platforms | 912 | * platform MUSB is running, because some platforms |
| @@ -916,9 +916,7 @@ b_host: | |||
| 916 | * drop the session. | 916 | * drop the session. |
| 917 | */ | 917 | */ |
| 918 | dev_err(musb->controller, "Babble\n"); | 918 | dev_err(musb->controller, "Babble\n"); |
| 919 | 919 | musb_recover_from_babble(musb); | |
| 920 | if (is_host_active(musb)) | ||
| 921 | musb_recover_from_babble(musb); | ||
| 922 | } else { | 920 | } else { |
| 923 | musb_dbg(musb, "BUS RESET as %s", | 921 | musb_dbg(musb, "BUS RESET as %s", |
| 924 | usb_otg_state_string(musb->xceiv->otg->state)); | 922 | usb_otg_state_string(musb->xceiv->otg->state)); |
| @@ -1861,22 +1859,22 @@ static void musb_pm_runtime_check_session(struct musb *musb) | |||
| 1861 | MUSB_DEVCTL_HR; | 1859 | MUSB_DEVCTL_HR; |
| 1862 | switch (devctl & ~s) { | 1860 | switch (devctl & ~s) { |
| 1863 | case MUSB_QUIRK_B_INVALID_VBUS_91: | 1861 | case MUSB_QUIRK_B_INVALID_VBUS_91: |
| 1864 | if (musb->quirk_retries--) { | 1862 | if (musb->quirk_retries && !musb->flush_irq_work) { |
| 1865 | musb_dbg(musb, | 1863 | musb_dbg(musb, |
| 1866 | "Poll devctl on invalid vbus, assume no session"); | 1864 | "Poll devctl on invalid vbus, assume no session"); |
| 1867 | schedule_delayed_work(&musb->irq_work, | 1865 | schedule_delayed_work(&musb->irq_work, |
| 1868 | msecs_to_jiffies(1000)); | 1866 | msecs_to_jiffies(1000)); |
| 1869 | 1867 | musb->quirk_retries--; | |
| 1870 | return; | 1868 | return; |
| 1871 | } | 1869 | } |
| 1872 | /* fall through */ | 1870 | /* fall through */ |
| 1873 | case MUSB_QUIRK_A_DISCONNECT_19: | 1871 | case MUSB_QUIRK_A_DISCONNECT_19: |
| 1874 | if (musb->quirk_retries--) { | 1872 | if (musb->quirk_retries && !musb->flush_irq_work) { |
| 1875 | musb_dbg(musb, | 1873 | musb_dbg(musb, |
| 1876 | "Poll devctl on possible host mode disconnect"); | 1874 | "Poll devctl on possible host mode disconnect"); |
| 1877 | schedule_delayed_work(&musb->irq_work, | 1875 | schedule_delayed_work(&musb->irq_work, |
| 1878 | msecs_to_jiffies(1000)); | 1876 | msecs_to_jiffies(1000)); |
| 1879 | 1877 | musb->quirk_retries--; | |
| 1880 | return; | 1878 | return; |
| 1881 | } | 1879 | } |
| 1882 | if (!musb->session) | 1880 | if (!musb->session) |
| @@ -2681,8 +2679,15 @@ static int musb_suspend(struct device *dev) | |||
| 2681 | 2679 | ||
| 2682 | musb_platform_disable(musb); | 2680 | musb_platform_disable(musb); |
| 2683 | musb_disable_interrupts(musb); | 2681 | musb_disable_interrupts(musb); |
| 2682 | |||
| 2683 | musb->flush_irq_work = true; | ||
| 2684 | while (flush_delayed_work(&musb->irq_work)) | ||
| 2685 | ; | ||
| 2686 | musb->flush_irq_work = false; | ||
| 2687 | |||
| 2684 | if (!(musb->io.quirks & MUSB_PRESERVE_SESSION)) | 2688 | if (!(musb->io.quirks & MUSB_PRESERVE_SESSION)) |
| 2685 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); | 2689 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); |
| 2690 | |||
| 2686 | WARN_ON(!list_empty(&musb->pending_list)); | 2691 | WARN_ON(!list_empty(&musb->pending_list)); |
| 2687 | 2692 | ||
| 2688 | spin_lock_irqsave(&musb->lock, flags); | 2693 | spin_lock_irqsave(&musb->lock, flags); |
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index c748f4ac1154..20f4614178d9 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
| @@ -428,6 +428,8 @@ struct musb { | |||
| 428 | unsigned test_mode:1; | 428 | unsigned test_mode:1; |
| 429 | unsigned softconnect:1; | 429 | unsigned softconnect:1; |
| 430 | 430 | ||
| 431 | unsigned flush_irq_work:1; | ||
| 432 | |||
| 431 | u8 address; | 433 | u8 address; |
| 432 | u8 test_mode_nr; | 434 | u8 test_mode_nr; |
| 433 | u16 ackpend; /* ep0 */ | 435 | u16 ackpend; /* ep0 */ |
diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c index ba255280a624..1ec0a4947b6b 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c | |||
| @@ -26,15 +26,28 @@ | |||
| 26 | 26 | ||
| 27 | #define MUSB_DMA_NUM_CHANNELS 15 | 27 | #define MUSB_DMA_NUM_CHANNELS 15 |
| 28 | 28 | ||
| 29 | #define DA8XX_USB_MODE 0x10 | ||
| 30 | #define DA8XX_USB_AUTOREQ 0x14 | ||
| 31 | #define DA8XX_USB_TEARDOWN 0x1c | ||
| 32 | |||
| 33 | #define DA8XX_DMA_NUM_CHANNELS 4 | ||
| 34 | |||
| 29 | struct cppi41_dma_controller { | 35 | struct cppi41_dma_controller { |
| 30 | struct dma_controller controller; | 36 | struct dma_controller controller; |
| 31 | struct cppi41_dma_channel rx_channel[MUSB_DMA_NUM_CHANNELS]; | 37 | struct cppi41_dma_channel *rx_channel; |
| 32 | struct cppi41_dma_channel tx_channel[MUSB_DMA_NUM_CHANNELS]; | 38 | struct cppi41_dma_channel *tx_channel; |
| 33 | struct hrtimer early_tx; | 39 | struct hrtimer early_tx; |
| 34 | struct list_head early_tx_list; | 40 | struct list_head early_tx_list; |
| 35 | u32 rx_mode; | 41 | u32 rx_mode; |
| 36 | u32 tx_mode; | 42 | u32 tx_mode; |
| 37 | u32 auto_req; | 43 | u32 auto_req; |
| 44 | |||
| 45 | u32 tdown_reg; | ||
| 46 | u32 autoreq_reg; | ||
| 47 | |||
| 48 | void (*set_dma_mode)(struct cppi41_dma_channel *cppi41_channel, | ||
| 49 | unsigned int mode); | ||
| 50 | u8 num_channels; | ||
| 38 | }; | 51 | }; |
| 39 | 52 | ||
| 40 | static void save_rx_toggle(struct cppi41_dma_channel *cppi41_channel) | 53 | static void save_rx_toggle(struct cppi41_dma_channel *cppi41_channel) |
| @@ -349,6 +362,32 @@ static void cppi41_set_dma_mode(struct cppi41_dma_channel *cppi41_channel, | |||
| 349 | } | 362 | } |
| 350 | } | 363 | } |
| 351 | 364 | ||
| 365 | static void da8xx_set_dma_mode(struct cppi41_dma_channel *cppi41_channel, | ||
| 366 | unsigned int mode) | ||
| 367 | { | ||
| 368 | struct cppi41_dma_controller *controller = cppi41_channel->controller; | ||
| 369 | struct musb *musb = controller->controller.musb; | ||
| 370 | unsigned int shift; | ||
| 371 | u32 port; | ||
| 372 | u32 new_mode; | ||
| 373 | u32 old_mode; | ||
| 374 | |||
| 375 | old_mode = controller->tx_mode; | ||
| 376 | port = cppi41_channel->port_num; | ||
| 377 | |||
| 378 | shift = (port - 1) * 4; | ||
| 379 | if (!cppi41_channel->is_tx) | ||
| 380 | shift += 16; | ||
| 381 | new_mode = old_mode & ~(3 << shift); | ||
| 382 | new_mode |= mode << shift; | ||
| 383 | |||
| 384 | if (new_mode == old_mode) | ||
| 385 | return; | ||
| 386 | controller->tx_mode = new_mode; | ||
| 387 | musb_writel(musb->ctrl_base, DA8XX_USB_MODE, new_mode); | ||
| 388 | } | ||
| 389 | |||
| 390 | |||
| 352 | static void cppi41_set_autoreq_mode(struct cppi41_dma_channel *cppi41_channel, | 391 | static void cppi41_set_autoreq_mode(struct cppi41_dma_channel *cppi41_channel, |
| 353 | unsigned mode) | 392 | unsigned mode) |
| 354 | { | 393 | { |
| @@ -364,8 +403,8 @@ static void cppi41_set_autoreq_mode(struct cppi41_dma_channel *cppi41_channel, | |||
| 364 | if (new_mode == old_mode) | 403 | if (new_mode == old_mode) |
| 365 | return; | 404 | return; |
| 366 | controller->auto_req = new_mode; | 405 | controller->auto_req = new_mode; |
| 367 | musb_writel(controller->controller.musb->ctrl_base, USB_CTRL_AUTOREQ, | 406 | musb_writel(controller->controller.musb->ctrl_base, |
| 368 | new_mode); | 407 | controller->autoreq_reg, new_mode); |
| 369 | } | 408 | } |
| 370 | 409 | ||
| 371 | static bool cppi41_configure_channel(struct dma_channel *channel, | 410 | static bool cppi41_configure_channel(struct dma_channel *channel, |
| @@ -373,6 +412,7 @@ static bool cppi41_configure_channel(struct dma_channel *channel, | |||
| 373 | dma_addr_t dma_addr, u32 len) | 412 | dma_addr_t dma_addr, u32 len) |
| 374 | { | 413 | { |
| 375 | struct cppi41_dma_channel *cppi41_channel = channel->private_data; | 414 | struct cppi41_dma_channel *cppi41_channel = channel->private_data; |
| 415 | struct cppi41_dma_controller *controller = cppi41_channel->controller; | ||
| 376 | struct dma_chan *dc = cppi41_channel->dc; | 416 | struct dma_chan *dc = cppi41_channel->dc; |
| 377 | struct dma_async_tx_descriptor *dma_desc; | 417 | struct dma_async_tx_descriptor *dma_desc; |
| 378 | enum dma_transfer_direction direction; | 418 | enum dma_transfer_direction direction; |
| @@ -398,7 +438,7 @@ static bool cppi41_configure_channel(struct dma_channel *channel, | |||
| 398 | musb_writel(musb->ctrl_base, | 438 | musb_writel(musb->ctrl_base, |
| 399 | RNDIS_REG(cppi41_channel->port_num), len); | 439 | RNDIS_REG(cppi41_channel->port_num), len); |
| 400 | /* gen rndis */ | 440 | /* gen rndis */ |
| 401 | cppi41_set_dma_mode(cppi41_channel, | 441 | controller->set_dma_mode(cppi41_channel, |
| 402 | EP_MODE_DMA_GEN_RNDIS); | 442 | EP_MODE_DMA_GEN_RNDIS); |
| 403 | 443 | ||
| 404 | /* auto req */ | 444 | /* auto req */ |
| @@ -407,14 +447,15 @@ static bool cppi41_configure_channel(struct dma_channel *channel, | |||
| 407 | } else { | 447 | } else { |
| 408 | musb_writel(musb->ctrl_base, | 448 | musb_writel(musb->ctrl_base, |
| 409 | RNDIS_REG(cppi41_channel->port_num), 0); | 449 | RNDIS_REG(cppi41_channel->port_num), 0); |
| 410 | cppi41_set_dma_mode(cppi41_channel, | 450 | controller->set_dma_mode(cppi41_channel, |
| 411 | EP_MODE_DMA_TRANSPARENT); | 451 | EP_MODE_DMA_TRANSPARENT); |
| 412 | cppi41_set_autoreq_mode(cppi41_channel, | 452 | cppi41_set_autoreq_mode(cppi41_channel, |
| 413 | EP_MODE_AUTOREQ_NONE); | 453 | EP_MODE_AUTOREQ_NONE); |
| 414 | } | 454 | } |
| 415 | } else { | 455 | } else { |
| 416 | /* fallback mode */ | 456 | /* fallback mode */ |
| 417 | cppi41_set_dma_mode(cppi41_channel, EP_MODE_DMA_TRANSPARENT); | 457 | controller->set_dma_mode(cppi41_channel, |
| 458 | EP_MODE_DMA_TRANSPARENT); | ||
| 418 | cppi41_set_autoreq_mode(cppi41_channel, EP_MODE_AUTOREQ_NONE); | 459 | cppi41_set_autoreq_mode(cppi41_channel, EP_MODE_AUTOREQ_NONE); |
| 419 | len = min_t(u32, packet_sz, len); | 460 | len = min_t(u32, packet_sz, len); |
| 420 | } | 461 | } |
| @@ -445,7 +486,7 @@ static struct dma_channel *cppi41_dma_channel_allocate(struct dma_controller *c, | |||
| 445 | struct cppi41_dma_channel *cppi41_channel = NULL; | 486 | struct cppi41_dma_channel *cppi41_channel = NULL; |
| 446 | u8 ch_num = hw_ep->epnum - 1; | 487 | u8 ch_num = hw_ep->epnum - 1; |
| 447 | 488 | ||
| 448 | if (ch_num >= MUSB_DMA_NUM_CHANNELS) | 489 | if (ch_num >= controller->num_channels) |
| 449 | return NULL; | 490 | return NULL; |
| 450 | 491 | ||
| 451 | if (is_tx) | 492 | if (is_tx) |
| @@ -581,12 +622,13 @@ static int cppi41_dma_channel_abort(struct dma_channel *channel) | |||
| 581 | 622 | ||
| 582 | do { | 623 | do { |
| 583 | if (is_tx) | 624 | if (is_tx) |
| 584 | musb_writel(musb->ctrl_base, USB_TDOWN, tdbit); | 625 | musb_writel(musb->ctrl_base, controller->tdown_reg, |
| 626 | tdbit); | ||
| 585 | ret = dmaengine_terminate_all(cppi41_channel->dc); | 627 | ret = dmaengine_terminate_all(cppi41_channel->dc); |
| 586 | } while (ret == -EAGAIN); | 628 | } while (ret == -EAGAIN); |
| 587 | 629 | ||
| 588 | if (is_tx) { | 630 | if (is_tx) { |
| 589 | musb_writel(musb->ctrl_base, USB_TDOWN, tdbit); | 631 | musb_writel(musb->ctrl_base, controller->tdown_reg, tdbit); |
| 590 | 632 | ||
| 591 | csr = musb_readw(epio, MUSB_TXCSR); | 633 | csr = musb_readw(epio, MUSB_TXCSR); |
| 592 | if (csr & MUSB_TXCSR_TXPKTRDY) { | 634 | if (csr & MUSB_TXCSR_TXPKTRDY) { |
| @@ -604,7 +646,7 @@ static void cppi41_release_all_dma_chans(struct cppi41_dma_controller *ctrl) | |||
| 604 | struct dma_chan *dc; | 646 | struct dma_chan *dc; |
| 605 | int i; | 647 | int i; |
| 606 | 648 | ||
| 607 | for (i = 0; i < MUSB_DMA_NUM_CHANNELS; i++) { | 649 | for (i = 0; i < ctrl->num_channels; i++) { |
| 608 | dc = ctrl->tx_channel[i].dc; | 650 | dc = ctrl->tx_channel[i].dc; |
| 609 | if (dc) | 651 | if (dc) |
| 610 | dma_release_channel(dc); | 652 | dma_release_channel(dc); |
| @@ -656,7 +698,7 @@ static int cppi41_dma_controller_start(struct cppi41_dma_controller *controller) | |||
| 656 | goto err; | 698 | goto err; |
| 657 | 699 | ||
| 658 | ret = -EINVAL; | 700 | ret = -EINVAL; |
| 659 | if (port > MUSB_DMA_NUM_CHANNELS || !port) | 701 | if (port > controller->num_channels || !port) |
| 660 | goto err; | 702 | goto err; |
| 661 | if (is_tx) | 703 | if (is_tx) |
| 662 | cppi41_channel = &controller->tx_channel[port - 1]; | 704 | cppi41_channel = &controller->tx_channel[port - 1]; |
| @@ -697,6 +739,8 @@ void cppi41_dma_controller_destroy(struct dma_controller *c) | |||
| 697 | 739 | ||
| 698 | hrtimer_cancel(&controller->early_tx); | 740 | hrtimer_cancel(&controller->early_tx); |
| 699 | cppi41_dma_controller_stop(controller); | 741 | cppi41_dma_controller_stop(controller); |
| 742 | kfree(controller->rx_channel); | ||
| 743 | kfree(controller->tx_channel); | ||
| 700 | kfree(controller); | 744 | kfree(controller); |
| 701 | } | 745 | } |
| 702 | EXPORT_SYMBOL_GPL(cppi41_dma_controller_destroy); | 746 | EXPORT_SYMBOL_GPL(cppi41_dma_controller_destroy); |
| @@ -705,6 +749,7 @@ struct dma_controller * | |||
| 705 | cppi41_dma_controller_create(struct musb *musb, void __iomem *base) | 749 | cppi41_dma_controller_create(struct musb *musb, void __iomem *base) |
| 706 | { | 750 | { |
| 707 | struct cppi41_dma_controller *controller; | 751 | struct cppi41_dma_controller *controller; |
| 752 | int channel_size; | ||
| 708 | int ret = 0; | 753 | int ret = 0; |
| 709 | 754 | ||
| 710 | if (!musb->controller->parent->of_node) { | 755 | if (!musb->controller->parent->of_node) { |
| @@ -727,12 +772,37 @@ cppi41_dma_controller_create(struct musb *musb, void __iomem *base) | |||
| 727 | controller->controller.is_compatible = cppi41_is_compatible; | 772 | controller->controller.is_compatible = cppi41_is_compatible; |
| 728 | controller->controller.musb = musb; | 773 | controller->controller.musb = musb; |
| 729 | 774 | ||
| 775 | if (musb->io.quirks & MUSB_DA8XX) { | ||
| 776 | controller->tdown_reg = DA8XX_USB_TEARDOWN; | ||
| 777 | controller->autoreq_reg = DA8XX_USB_AUTOREQ; | ||
| 778 | controller->set_dma_mode = da8xx_set_dma_mode; | ||
| 779 | controller->num_channels = DA8XX_DMA_NUM_CHANNELS; | ||
| 780 | } else { | ||
| 781 | controller->tdown_reg = USB_TDOWN; | ||
| 782 | controller->autoreq_reg = USB_CTRL_AUTOREQ; | ||
| 783 | controller->set_dma_mode = cppi41_set_dma_mode; | ||
| 784 | controller->num_channels = MUSB_DMA_NUM_CHANNELS; | ||
| 785 | } | ||
| 786 | |||
| 787 | channel_size = controller->num_channels * | ||
| 788 | sizeof(struct cppi41_dma_channel); | ||
| 789 | controller->rx_channel = kzalloc(channel_size, GFP_KERNEL); | ||
| 790 | if (!controller->rx_channel) | ||
| 791 | goto rx_channel_alloc_fail; | ||
| 792 | controller->tx_channel = kzalloc(channel_size, GFP_KERNEL); | ||
| 793 | if (!controller->tx_channel) | ||
| 794 | goto tx_channel_alloc_fail; | ||
| 795 | |||
| 730 | ret = cppi41_dma_controller_start(controller); | 796 | ret = cppi41_dma_controller_start(controller); |
| 731 | if (ret) | 797 | if (ret) |
| 732 | goto plat_get_fail; | 798 | goto plat_get_fail; |
| 733 | return &controller->controller; | 799 | return &controller->controller; |
| 734 | 800 | ||
| 735 | plat_get_fail: | 801 | plat_get_fail: |
| 802 | kfree(controller->tx_channel); | ||
| 803 | tx_channel_alloc_fail: | ||
| 804 | kfree(controller->rx_channel); | ||
| 805 | rx_channel_alloc_fail: | ||
| 736 | kfree(controller); | 806 | kfree(controller); |
| 737 | kzalloc_fail: | 807 | kzalloc_fail: |
| 738 | if (ret == -EPROBE_DEFER) | 808 | if (ret == -EPROBE_DEFER) |
diff --git a/drivers/usb/musb/sunxi.c b/drivers/usb/musb/sunxi.c index c9a09b5bb6e5..dc353e24d53c 100644 --- a/drivers/usb/musb/sunxi.c +++ b/drivers/usb/musb/sunxi.c | |||
| @@ -297,6 +297,8 @@ static int sunxi_musb_exit(struct musb *musb) | |||
| 297 | if (test_bit(SUNXI_MUSB_FL_HAS_SRAM, &glue->flags)) | 297 | if (test_bit(SUNXI_MUSB_FL_HAS_SRAM, &glue->flags)) |
| 298 | sunxi_sram_release(musb->controller->parent); | 298 | sunxi_sram_release(musb->controller->parent); |
| 299 | 299 | ||
| 300 | devm_usb_put_phy(glue->dev, glue->xceiv); | ||
| 301 | |||
| 300 | return 0; | 302 | return 0; |
| 301 | } | 303 | } |
| 302 | 304 | ||
diff --git a/drivers/usb/serial/metro-usb.c b/drivers/usb/serial/metro-usb.c index cc84da8dbb84..14511d6a7d44 100644 --- a/drivers/usb/serial/metro-usb.c +++ b/drivers/usb/serial/metro-usb.c | |||
| @@ -45,6 +45,7 @@ struct metrousb_private { | |||
| 45 | static const struct usb_device_id id_table[] = { | 45 | static const struct usb_device_id id_table[] = { |
| 46 | { USB_DEVICE(FOCUS_VENDOR_ID, FOCUS_PRODUCT_ID_BI) }, | 46 | { USB_DEVICE(FOCUS_VENDOR_ID, FOCUS_PRODUCT_ID_BI) }, |
| 47 | { USB_DEVICE(FOCUS_VENDOR_ID, FOCUS_PRODUCT_ID_UNI) }, | 47 | { USB_DEVICE(FOCUS_VENDOR_ID, FOCUS_PRODUCT_ID_UNI) }, |
| 48 | { USB_DEVICE_INTERFACE_CLASS(0x0c2e, 0x0730, 0xff) }, /* MS7820 */ | ||
| 48 | { }, /* Terminating entry. */ | 49 | { }, /* Terminating entry. */ |
| 49 | }; | 50 | }; |
| 50 | MODULE_DEVICE_TABLE(usb, id_table); | 51 | MODULE_DEVICE_TABLE(usb, id_table); |
