Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'usb-4.0-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB / PHY driver fixes from Greg KH:
"Here's a number of USB and PHY driver fixes for 4.0-rc5.

The largest thing here is a revert of a gadget function driver patch
that removes 500 lines of code. Other than that, it's a number of
reported bugs fixes and new quirk/id entries.

All have been in linux-next for a while"

* tag 'usb-4.0-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (33 commits)
usb: common: otg-fsm: only signal connect after switching to peripheral
uas: Add US_FL_NO_ATA_1X for Initio Corporation controllers / devices
USB: ehci-atmel: rework clk handling
MAINTAINERS: add entry for USB OTG FSM
usb: chipidea: otg: add a_alt_hnp_support response for B device
phy: omap-usb2: Fix missing clk_prepare call when using old dt name
phy: ti/omap: Fix modalias
phy: core: Fixup return value of phy_exit when !pm_runtime_enabled
phy: miphy28lp: Convert to devm_kcalloc and fix wrong sizof
phy: miphy365x: Convert to devm_kcalloc and fix wrong sizeof
phy: twl4030-usb: Remove redundant assignment for twl->linkstat
phy: exynos5-usbdrd: Fix off-by-one valid value checking for args->args[0]
phy: Find the right match in devm_phy_destroy()
phy: rockchip-usb: Fixup rockchip_usb_phy_power_on failure path
phy: ti-pipe3: Simplify ti_pipe3_dpll_wait_lock implementation
phy: samsung-usb2: Remove NULL terminating entry from phys array
phy: hix5hd2-sata: Check return value of platform_get_resource
phy: exynos-dp-video: Kill exynos_dp_video_phy_pwr_isol function
Revert "usb: gadget: zero: Add support for interrupt EP"
Revert "xhci: Clear the host side toggle manually when endpoint is 'soft reset'"
...

+131 -719
+7
MAINTAINERS
··· 10207 10207 F: Documentation/usb/ohci.txt 10208 10208 F: drivers/usb/host/ohci* 10209 10209 10210 + USB OTG FSM (Finite State Machine) 10211 + M: Peter Chen <Peter.Chen@freescale.com> 10212 + T: git git://github.com/hzpeterchen/linux-usb.git 10213 + L: linux-usb@vger.kernel.org 10214 + S: Maintained 10215 + F: drivers/usb/common/usb-otg-fsm.c 10216 + 10210 10217 USB OVER IP DRIVER 10211 10218 M: Valentina Manea <valentina.manea.m@gmail.com> 10212 10219 M: Shuah Khan <shuah.kh@samsung.com>
+2 -1
drivers/phy/phy-armada375-usb2.c
··· 37 37 struct armada375_cluster_phy *cluster_phy; 38 38 u32 reg; 39 39 40 - cluster_phy = dev_get_drvdata(phy->dev.parent); 40 + cluster_phy = phy_get_drvdata(phy); 41 41 if (!cluster_phy) 42 42 return -ENODEV; 43 43 ··· 131 131 cluster_phy->reg = usb_cluster_base; 132 132 133 133 dev_set_drvdata(dev, cluster_phy); 134 + phy_set_drvdata(phy, cluster_phy); 134 135 135 136 phy_provider = devm_of_phy_provider_register(&pdev->dev, 136 137 armada375_usb_phy_xlate);
+6 -5
drivers/phy/phy-core.c
··· 52 52 53 53 static int devm_phy_match(struct device *dev, void *res, void *match_data) 54 54 { 55 - return res == match_data; 55 + struct phy **phy = res; 56 + 57 + return *phy == match_data; 56 58 } 57 59 58 60 /** ··· 225 223 ret = phy_pm_runtime_get_sync(phy); 226 224 if (ret < 0 && ret != -ENOTSUPP) 227 225 return ret; 226 + ret = 0; /* Override possible ret == -ENOTSUPP */ 228 227 229 228 mutex_lock(&phy->mutex); 230 229 if (phy->init_count == 0 && phy->ops->init) { ··· 234 231 dev_err(&phy->dev, "phy init failed --> %d\n", ret); 235 232 goto out; 236 233 } 237 - } else { 238 - ret = 0; /* Override possible ret == -ENOTSUPP */ 239 234 } 240 235 ++phy->init_count; 241 236 ··· 254 253 ret = phy_pm_runtime_get_sync(phy); 255 254 if (ret < 0 && ret != -ENOTSUPP) 256 255 return ret; 256 + ret = 0; /* Override possible ret == -ENOTSUPP */ 257 257 258 258 mutex_lock(&phy->mutex); 259 259 if (phy->init_count == 1 && phy->ops->exit) { ··· 289 287 ret = phy_pm_runtime_get_sync(phy); 290 288 if (ret < 0 && ret != -ENOTSUPP) 291 289 return ret; 290 + ret = 0; /* Override possible ret == -ENOTSUPP */ 292 291 293 292 mutex_lock(&phy->mutex); 294 293 if (phy->power_count == 0 && phy->ops->power_on) { ··· 298 295 dev_err(&phy->dev, "phy poweron failed --> %d\n", ret); 299 296 goto out; 300 297 } 301 - } else { 302 - ret = 0; /* Override possible ret == -ENOTSUPP */ 303 298 } 304 299 ++phy->power_count; 305 300 mutex_unlock(&phy->mutex);
+4 -20
drivers/phy/phy-exynos-dp-video.c
··· 30 30 const struct exynos_dp_video_phy_drvdata *drvdata; 31 31 }; 32 32 33 - static void exynos_dp_video_phy_pwr_isol(struct exynos_dp_video_phy *state, 34 - unsigned int on) 35 - { 36 - unsigned int val; 37 - 38 - if (IS_ERR(state->regs)) 39 - return; 40 - 41 - val = on ? 0 : EXYNOS5_PHY_ENABLE; 42 - 43 - regmap_update_bits(state->regs, state->drvdata->phy_ctrl_offset, 44 - EXYNOS5_PHY_ENABLE, val); 45 - } 46 - 47 33 static int exynos_dp_video_phy_power_on(struct phy *phy) 48 34 { 49 35 struct exynos_dp_video_phy *state = phy_get_drvdata(phy); 50 36 51 37 /* Disable power isolation on DP-PHY */ 52 - exynos_dp_video_phy_pwr_isol(state, 0); 53 - 54 - return 0; 38 + return regmap_update_bits(state->regs, state->drvdata->phy_ctrl_offset, 39 + EXYNOS5_PHY_ENABLE, EXYNOS5_PHY_ENABLE); 55 40 } 56 41 57 42 static int exynos_dp_video_phy_power_off(struct phy *phy) ··· 44 59 struct exynos_dp_video_phy *state = phy_get_drvdata(phy); 45 60 46 61 /* Enable power isolation on DP-PHY */ 47 - exynos_dp_video_phy_pwr_isol(state, 1); 48 - 49 - return 0; 62 + return regmap_update_bits(state->regs, state->drvdata->phy_ctrl_offset, 63 + EXYNOS5_PHY_ENABLE, 0); 50 64 } 51 65 52 66 static struct phy_ops exynos_dp_video_phy_ops = {
+4 -7
drivers/phy/phy-exynos-mipi-video.c
··· 43 43 } phys[EXYNOS_MIPI_PHYS_NUM]; 44 44 spinlock_t slock; 45 45 void __iomem *regs; 46 - struct mutex mutex; 47 46 struct regmap *regmap; 48 47 }; 49 48 ··· 58 59 else 59 60 reset = EXYNOS4_MIPI_PHY_SRESETN; 60 61 61 - if (state->regmap) { 62 - mutex_lock(&state->mutex); 62 + spin_lock(&state->slock); 63 + 64 + if (!IS_ERR(state->regmap)) { 63 65 regmap_read(state->regmap, offset, &val); 64 66 if (on) 65 67 val |= reset; ··· 72 72 else if (!(val & EXYNOS4_MIPI_PHY_RESET_MASK)) 73 73 val &= ~EXYNOS4_MIPI_PHY_ENABLE; 74 74 regmap_write(state->regmap, offset, val); 75 - mutex_unlock(&state->mutex); 76 75 } else { 77 76 addr = state->regs + EXYNOS_MIPI_PHY_CONTROL(id / 2); 78 77 79 - spin_lock(&state->slock); 80 78 val = readl(addr); 81 79 if (on) 82 80 val |= reset; ··· 88 90 val &= ~EXYNOS4_MIPI_PHY_ENABLE; 89 91 90 92 writel(val, addr); 91 - spin_unlock(&state->slock); 92 93 } 93 94 95 + spin_unlock(&state->slock); 94 96 return 0; 95 97 } 96 98 ··· 156 158 157 159 dev_set_drvdata(dev, state); 158 160 spin_lock_init(&state->slock); 159 - mutex_init(&state->mutex); 160 161 161 162 for (i = 0; i < EXYNOS_MIPI_PHYS_NUM; i++) { 162 163 struct phy *phy = devm_phy_create(dev, NULL,
-1
drivers/phy/phy-exynos4210-usb2.c
··· 250 250 .power_on = exynos4210_power_on, 251 251 .power_off = exynos4210_power_off, 252 252 }, 253 - {}, 254 253 }; 255 254 256 255 const struct samsung_usb2_phy_config exynos4210_usb2_phy_config = {
-1
drivers/phy/phy-exynos4x12-usb2.c
··· 361 361 .power_on = exynos4x12_power_on, 362 362 .power_off = exynos4x12_power_off, 363 363 }, 364 - {}, 365 364 }; 366 365 367 366 const struct samsung_usb2_phy_config exynos3250_usb2_phy_config = {
+1 -1
drivers/phy/phy-exynos5-usbdrd.c
··· 531 531 { 532 532 struct exynos5_usbdrd_phy *phy_drd = dev_get_drvdata(dev); 533 533 534 - if (WARN_ON(args->args[0] > EXYNOS5_DRDPHYS_NUM)) 534 + if (WARN_ON(args->args[0] >= EXYNOS5_DRDPHYS_NUM)) 535 535 return ERR_PTR(-ENODEV); 536 536 537 537 return phy_drd->phys[args->args[0]].phy;
-1
drivers/phy/phy-exynos5250-usb2.c
··· 391 391 .power_on = exynos5250_power_on, 392 392 .power_off = exynos5250_power_off, 393 393 }, 394 - {}, 395 394 }; 396 395 397 396 const struct samsung_usb2_phy_config exynos5250_usb2_phy_config = {
+3
drivers/phy/phy-hix5hd2-sata.c
··· 147 147 return -ENOMEM; 148 148 149 149 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 150 + if (!res) 151 + return -EINVAL; 152 + 150 153 priv->base = devm_ioremap(dev, res->start, resource_size(res)); 151 154 if (!priv->base) 152 155 return -ENOMEM;
+7 -6
drivers/phy/phy-miphy28lp.c
··· 228 228 struct regmap *regmap; 229 229 struct mutex miphy_mutex; 230 230 struct miphy28lp_phy **phys; 231 + int nphys; 231 232 }; 232 233 233 234 struct miphy_initval { ··· 1117 1116 return ERR_PTR(-EINVAL); 1118 1117 } 1119 1118 1120 - for (index = 0; index < of_get_child_count(dev->of_node); index++) 1119 + for (index = 0; index < miphy_dev->nphys; index++) 1121 1120 if (phynode == miphy_dev->phys[index]->phy->dev.of_node) { 1122 1121 miphy_phy = miphy_dev->phys[index]; 1123 1122 break; ··· 1139 1138 1140 1139 static struct phy_ops miphy28lp_ops = { 1141 1140 .init = miphy28lp_init, 1141 + .owner = THIS_MODULE, 1142 1142 }; 1143 1143 1144 1144 static int miphy28lp_probe_resets(struct device_node *node, ··· 1202 1200 struct miphy28lp_dev *miphy_dev; 1203 1201 struct phy_provider *provider; 1204 1202 struct phy *phy; 1205 - int chancount, port = 0; 1206 - int ret; 1203 + int ret, port = 0; 1207 1204 1208 1205 miphy_dev = devm_kzalloc(&pdev->dev, sizeof(*miphy_dev), GFP_KERNEL); 1209 1206 if (!miphy_dev) 1210 1207 return -ENOMEM; 1211 1208 1212 - chancount = of_get_child_count(np); 1213 - miphy_dev->phys = devm_kzalloc(&pdev->dev, sizeof(phy) * chancount, 1214 - GFP_KERNEL); 1209 + miphy_dev->nphys = of_get_child_count(np); 1210 + miphy_dev->phys = devm_kcalloc(&pdev->dev, miphy_dev->nphys, 1211 + sizeof(*miphy_dev->phys), GFP_KERNEL); 1215 1212 if (!miphy_dev->phys) 1216 1213 return -ENOMEM; 1217 1214
+6 -6
drivers/phy/phy-miphy365x.c
··· 150 150 struct regmap *regmap; 151 151 struct mutex miphy_mutex; 152 152 struct miphy365x_phy **phys; 153 + int nphys; 153 154 }; 154 155 155 156 /* ··· 486 485 return ERR_PTR(-EINVAL); 487 486 } 488 487 489 - for (index = 0; index < of_get_child_count(dev->of_node); index++) 488 + for (index = 0; index < miphy_dev->nphys; index++) 490 489 if (phynode == miphy_dev->phys[index]->phy->dev.of_node) { 491 490 miphy_phy = miphy_dev->phys[index]; 492 491 break; ··· 542 541 struct miphy365x_dev *miphy_dev; 543 542 struct phy_provider *provider; 544 543 struct phy *phy; 545 - int chancount, port = 0; 546 - int ret; 544 + int ret, port = 0; 547 545 548 546 miphy_dev = devm_kzalloc(&pdev->dev, sizeof(*miphy_dev), GFP_KERNEL); 549 547 if (!miphy_dev) 550 548 return -ENOMEM; 551 549 552 - chancount = of_get_child_count(np); 553 - miphy_dev->phys = devm_kzalloc(&pdev->dev, sizeof(phy) * chancount, 554 - GFP_KERNEL); 550 + miphy_dev->nphys = of_get_child_count(np); 551 + miphy_dev->phys = devm_kcalloc(&pdev->dev, miphy_dev->nphys, 552 + sizeof(*miphy_dev->phys), GFP_KERNEL); 555 553 if (!miphy_dev->phys) 556 554 return -ENOMEM; 557 555
+1 -1
drivers/phy/phy-omap-control.c
··· 360 360 } 361 361 module_exit(omap_control_phy_exit); 362 362 363 - MODULE_ALIAS("platform: omap_control_phy"); 363 + MODULE_ALIAS("platform:omap_control_phy"); 364 364 MODULE_AUTHOR("Texas Instruments Inc."); 365 365 MODULE_DESCRIPTION("OMAP Control Module PHY Driver"); 366 366 MODULE_LICENSE("GPL v2");
+4 -3
drivers/phy/phy-omap-usb2.c
··· 296 296 dev_warn(&pdev->dev, 297 297 "found usb_otg_ss_refclk960m, please fix DTS\n"); 298 298 } 299 - } else { 300 - clk_prepare(phy->optclk); 301 299 } 300 + 301 + if (!IS_ERR(phy->optclk)) 302 + clk_prepare(phy->optclk); 302 303 303 304 usb_add_phy_dev(&phy->phy); 304 305 ··· 384 383 385 384 module_platform_driver(omap_usb2_driver); 386 385 387 - MODULE_ALIAS("platform: omap_usb2"); 386 + MODULE_ALIAS("platform:omap_usb2"); 388 387 MODULE_AUTHOR("Texas Instruments Inc."); 389 388 MODULE_DESCRIPTION("OMAP USB2 phy driver"); 390 389 MODULE_LICENSE("GPL v2");
+3 -3
drivers/phy/phy-rockchip-usb.c
··· 61 61 return ret; 62 62 63 63 clk_disable_unprepare(phy->clk); 64 - if (ret) 65 - return ret; 66 64 67 65 return 0; 68 66 } ··· 76 78 77 79 /* Power up usb phy analog blocks by set siddq 0 */ 78 80 ret = rockchip_usb_phy_power(phy, 0); 79 - if (ret) 81 + if (ret) { 82 + clk_disable_unprepare(phy->clk); 80 83 return ret; 84 + } 81 85 82 86 return 0; 83 87 }
+4 -8
drivers/phy/phy-ti-pipe3.c
··· 165 165 cpu_relax(); 166 166 val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_STATUS); 167 167 if (val & PLL_LOCK) 168 - break; 168 + return 0; 169 169 } while (!time_after(jiffies, timeout)); 170 170 171 - if (!(val & PLL_LOCK)) { 172 - dev_err(phy->dev, "DPLL failed to lock\n"); 173 - return -EBUSY; 174 - } 175 - 176 - return 0; 171 + dev_err(phy->dev, "DPLL failed to lock\n"); 172 + return -EBUSY; 177 173 } 178 174 179 175 static int ti_pipe3_dpll_program(struct ti_pipe3 *phy) ··· 604 608 605 609 module_platform_driver(ti_pipe3_driver); 606 610 607 - MODULE_ALIAS("platform: ti_pipe3"); 611 + MODULE_ALIAS("platform:ti_pipe3"); 608 612 MODULE_AUTHOR("Texas Instruments Inc."); 609 613 MODULE_DESCRIPTION("TI PIPE3 phy driver"); 610 614 MODULE_LICENSE("GPL v2");
-1
drivers/phy/phy-twl4030-usb.c
··· 666 666 twl->dev = &pdev->dev; 667 667 twl->irq = platform_get_irq(pdev, 0); 668 668 twl->vbus_supplied = false; 669 - twl->linkstat = -EINVAL; 670 669 twl->linkstat = OMAP_MUSB_UNKNOWN; 671 670 672 671 twl->phy.dev = twl->dev;
-1
drivers/phy/phy-xgene.c
··· 1704 1704 for (i = 0; i < MAX_LANE; i++) 1705 1705 ctx->sata_param.speed[i] = 2; /* Default to Gen3 */ 1706 1706 1707 - ctx->dev = &pdev->dev; 1708 1707 platform_set_drvdata(pdev, ctx); 1709 1708 1710 1709 ctx->phy = devm_phy_create(ctx->dev, NULL, &xgene_phy_ops);
+11
drivers/usb/chipidea/udc.c
··· 929 929 return retval; 930 930 } 931 931 932 + static int otg_a_alt_hnp_support(struct ci_hdrc *ci) 933 + { 934 + dev_warn(&ci->gadget.dev, 935 + "connect the device to an alternate port if you want HNP\n"); 936 + return isr_setup_status_phase(ci); 937 + } 938 + 932 939 /** 933 940 * isr_setup_packet_handler: setup packet handler 934 941 * @ci: UDC descriptor ··· 1067 1060 err = isr_setup_status_phase( 1068 1061 ci); 1069 1062 } 1063 + break; 1064 + case USB_DEVICE_A_ALT_HNP_SUPPORT: 1065 + if (ci_otg_is_fsm_mode(ci)) 1066 + err = otg_a_alt_hnp_support(ci); 1070 1067 break; 1071 1068 default: 1072 1069 goto delegate;
+2 -2
drivers/usb/common/usb-otg-fsm.c
··· 150 150 break; 151 151 case OTG_STATE_B_PERIPHERAL: 152 152 otg_chrg_vbus(fsm, 0); 153 - otg_loc_conn(fsm, 1); 154 153 otg_loc_sof(fsm, 0); 155 154 otg_set_protocol(fsm, PROTO_GADGET); 155 + otg_loc_conn(fsm, 1); 156 156 break; 157 157 case OTG_STATE_B_WAIT_ACON: 158 158 otg_chrg_vbus(fsm, 0); ··· 213 213 214 214 break; 215 215 case OTG_STATE_A_PERIPHERAL: 216 - otg_loc_conn(fsm, 1); 217 216 otg_loc_sof(fsm, 0); 218 217 otg_set_protocol(fsm, PROTO_GADGET); 219 218 otg_drv_vbus(fsm, 1); 219 + otg_loc_conn(fsm, 1); 220 220 otg_add_timer(fsm, A_BIDL_ADIS); 221 221 break; 222 222 case OTG_STATE_A_WAIT_VFALL:
+3
drivers/usb/dwc2/core_intr.c
··· 377 377 dwc2_is_host_mode(hsotg) ? "Host" : "Device", 378 378 dwc2_op_state_str(hsotg)); 379 379 380 + if (hsotg->op_state == OTG_STATE_A_HOST) 381 + dwc2_hcd_disconnect(hsotg); 382 + 380 383 /* Change to L3 (OFF) state */ 381 384 hsotg->lx_state = DWC2_L3; 382 385
+1 -2
drivers/usb/gadget/function/f_loopback.c
··· 289 289 struct usb_composite_dev *cdev; 290 290 291 291 cdev = loop->function.config->cdev; 292 - disable_endpoints(cdev, loop->in_ep, loop->out_ep, NULL, NULL, NULL, 293 - NULL); 292 + disable_endpoints(cdev, loop->in_ep, loop->out_ep, NULL, NULL); 294 293 VDBG(cdev, "%s disabled\n", loop->function.name); 295 294 } 296 295
+20 -491
drivers/usb/gadget/function/f_sourcesink.c
··· 23 23 #include "gadget_chips.h" 24 24 #include "u_f.h" 25 25 26 - #define USB_MS_TO_SS_INTERVAL(x) USB_MS_TO_HS_INTERVAL(x) 27 - 28 - enum eptype { 29 - EP_CONTROL = 0, 30 - EP_BULK, 31 - EP_ISOC, 32 - EP_INTERRUPT, 33 - }; 34 - 35 26 /* 36 27 * SOURCE/SINK FUNCTION ... a primary testing vehicle for USB peripheral 37 28 * controller drivers. ··· 55 64 struct usb_ep *out_ep; 56 65 struct usb_ep *iso_in_ep; 57 66 struct usb_ep *iso_out_ep; 58 - struct usb_ep *int_in_ep; 59 - struct usb_ep *int_out_ep; 60 67 int cur_alt; 61 68 }; 62 69 ··· 68 79 static unsigned isoc_maxpacket; 69 80 static unsigned isoc_mult; 70 81 static unsigned isoc_maxburst; 71 - static unsigned int_interval; /* In ms */ 72 - static unsigned int_maxpacket; 73 - static unsigned int_mult; 74 - static unsigned int_maxburst; 75 82 static unsigned buflen; 76 83 77 84 /*-------------------------------------------------------------------------*/ ··· 88 103 89 104 .bAlternateSetting = 1, 90 105 .bNumEndpoints = 4, 91 - .bInterfaceClass = USB_CLASS_VENDOR_SPEC, 92 - /* .iInterface = DYNAMIC */ 93 - }; 94 - 95 - static struct usb_interface_descriptor source_sink_intf_alt2 = { 96 - .bLength = USB_DT_INTERFACE_SIZE, 97 - .bDescriptorType = USB_DT_INTERFACE, 98 - 99 - .bAlternateSetting = 2, 100 - .bNumEndpoints = 2, 101 106 .bInterfaceClass = USB_CLASS_VENDOR_SPEC, 102 107 /* .iInterface = DYNAMIC */ 103 108 }; ··· 130 155 .bInterval = 4, 131 156 }; 132 157 133 - static struct usb_endpoint_descriptor fs_int_source_desc = { 134 - .bLength = USB_DT_ENDPOINT_SIZE, 135 - .bDescriptorType = USB_DT_ENDPOINT, 136 - 137 - .bEndpointAddress = USB_DIR_IN, 138 - .bmAttributes = USB_ENDPOINT_XFER_INT, 139 - .wMaxPacketSize = cpu_to_le16(64), 140 - .bInterval = GZERO_INT_INTERVAL, 141 - }; 142 - 143 - static struct usb_endpoint_descriptor fs_int_sink_desc = { 144 - .bLength = USB_DT_ENDPOINT_SIZE, 145 - .bDescriptorType = USB_DT_ENDPOINT, 146 - 147 - .bEndpointAddress = USB_DIR_OUT, 148 - .bmAttributes = USB_ENDPOINT_XFER_INT, 149 - .wMaxPacketSize = cpu_to_le16(64), 150 - .bInterval = GZERO_INT_INTERVAL, 151 - }; 152 - 153 158 static struct usb_descriptor_header *fs_source_sink_descs[] = { 154 159 (struct usb_descriptor_header *) &source_sink_intf_alt0, 155 160 (struct usb_descriptor_header *) &fs_sink_desc, ··· 140 185 (struct usb_descriptor_header *) &fs_source_desc, 141 186 (struct usb_descriptor_header *) &fs_iso_sink_desc, 142 187 (struct usb_descriptor_header *) &fs_iso_source_desc, 143 - (struct usb_descriptor_header *) &source_sink_intf_alt2, 144 - #define FS_ALT_IFC_2_OFFSET 8 145 - (struct usb_descriptor_header *) &fs_int_sink_desc, 146 - (struct usb_descriptor_header *) &fs_int_source_desc, 147 188 NULL, 148 189 }; 149 190 ··· 179 228 .bInterval = 4, 180 229 }; 181 230 182 - static struct usb_endpoint_descriptor hs_int_source_desc = { 183 - .bLength = USB_DT_ENDPOINT_SIZE, 184 - .bDescriptorType = USB_DT_ENDPOINT, 185 - 186 - .bmAttributes = USB_ENDPOINT_XFER_INT, 187 - .wMaxPacketSize = cpu_to_le16(1024), 188 - .bInterval = USB_MS_TO_HS_INTERVAL(GZERO_INT_INTERVAL), 189 - }; 190 - 191 - static struct usb_endpoint_descriptor hs_int_sink_desc = { 192 - .bLength = USB_DT_ENDPOINT_SIZE, 193 - .bDescriptorType = USB_DT_ENDPOINT, 194 - 195 - .bmAttributes = USB_ENDPOINT_XFER_INT, 196 - .wMaxPacketSize = cpu_to_le16(1024), 197 - .bInterval = USB_MS_TO_HS_INTERVAL(GZERO_INT_INTERVAL), 198 - }; 199 - 200 231 static struct usb_descriptor_header *hs_source_sink_descs[] = { 201 232 (struct usb_descriptor_header *) &source_sink_intf_alt0, 202 233 (struct usb_descriptor_header *) &hs_source_desc, ··· 189 256 (struct usb_descriptor_header *) &hs_sink_desc, 190 257 (struct usb_descriptor_header *) &hs_iso_source_desc, 191 258 (struct usb_descriptor_header *) &hs_iso_sink_desc, 192 - (struct usb_descriptor_header *) &source_sink_intf_alt2, 193 - #define HS_ALT_IFC_2_OFFSET 8 194 - (struct usb_descriptor_header *) &hs_int_source_desc, 195 - (struct usb_descriptor_header *) &hs_int_sink_desc, 196 259 NULL, 197 260 }; 198 261 ··· 264 335 .wBytesPerInterval = cpu_to_le16(1024), 265 336 }; 266 337 267 - static struct usb_endpoint_descriptor ss_int_source_desc = { 268 - .bLength = USB_DT_ENDPOINT_SIZE, 269 - .bDescriptorType = USB_DT_ENDPOINT, 270 - 271 - .bmAttributes = USB_ENDPOINT_XFER_INT, 272 - .wMaxPacketSize = cpu_to_le16(1024), 273 - .bInterval = USB_MS_TO_SS_INTERVAL(GZERO_INT_INTERVAL), 274 - }; 275 - 276 - static struct usb_ss_ep_comp_descriptor ss_int_source_comp_desc = { 277 - .bLength = USB_DT_SS_EP_COMP_SIZE, 278 - .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, 279 - 280 - .bMaxBurst = 0, 281 - .bmAttributes = 0, 282 - .wBytesPerInterval = cpu_to_le16(1024), 283 - }; 284 - 285 - static struct usb_endpoint_descriptor ss_int_sink_desc = { 286 - .bLength = USB_DT_ENDPOINT_SIZE, 287 - .bDescriptorType = USB_DT_ENDPOINT, 288 - 289 - .bmAttributes = USB_ENDPOINT_XFER_INT, 290 - .wMaxPacketSize = cpu_to_le16(1024), 291 - .bInterval = USB_MS_TO_SS_INTERVAL(GZERO_INT_INTERVAL), 292 - }; 293 - 294 - static struct usb_ss_ep_comp_descriptor ss_int_sink_comp_desc = { 295 - .bLength = USB_DT_SS_EP_COMP_SIZE, 296 - .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, 297 - 298 - .bMaxBurst = 0, 299 - .bmAttributes = 0, 300 - .wBytesPerInterval = cpu_to_le16(1024), 301 - }; 302 - 303 338 static struct usb_descriptor_header *ss_source_sink_descs[] = { 304 339 (struct usb_descriptor_header *) &source_sink_intf_alt0, 305 340 (struct usb_descriptor_header *) &ss_source_desc, ··· 280 387 (struct usb_descriptor_header *) &ss_iso_source_comp_desc, 281 388 (struct usb_descriptor_header *) &ss_iso_sink_desc, 282 389 (struct usb_descriptor_header *) &ss_iso_sink_comp_desc, 283 - (struct usb_descriptor_header *) &source_sink_intf_alt2, 284 - #define SS_ALT_IFC_2_OFFSET 14 285 - (struct usb_descriptor_header *) &ss_int_source_desc, 286 - (struct usb_descriptor_header *) &ss_int_source_comp_desc, 287 - (struct usb_descriptor_header *) &ss_int_sink_desc, 288 - (struct usb_descriptor_header *) &ss_int_sink_comp_desc, 289 390 NULL, 290 391 }; 291 392 ··· 301 414 }; 302 415 303 416 /*-------------------------------------------------------------------------*/ 304 - static const char *get_ep_string(enum eptype ep_type) 305 - { 306 - switch (ep_type) { 307 - case EP_ISOC: 308 - return "ISOC-"; 309 - case EP_INTERRUPT: 310 - return "INTERRUPT-"; 311 - case EP_CONTROL: 312 - return "CTRL-"; 313 - case EP_BULK: 314 - return "BULK-"; 315 - default: 316 - return "UNKNOWN-"; 317 - } 318 - } 319 417 320 418 static inline struct usb_request *ss_alloc_ep_req(struct usb_ep *ep, int len) 321 419 { ··· 328 456 329 457 void disable_endpoints(struct usb_composite_dev *cdev, 330 458 struct usb_ep *in, struct usb_ep *out, 331 - struct usb_ep *iso_in, struct usb_ep *iso_out, 332 - struct usb_ep *int_in, struct usb_ep *int_out) 459 + struct usb_ep *iso_in, struct usb_ep *iso_out) 333 460 { 334 461 disable_ep(cdev, in); 335 462 disable_ep(cdev, out); ··· 336 465 disable_ep(cdev, iso_in); 337 466 if (iso_out) 338 467 disable_ep(cdev, iso_out); 339 - if (int_in) 340 - disable_ep(cdev, int_in); 341 - if (int_out) 342 - disable_ep(cdev, int_out); 343 468 } 344 469 345 470 static int ··· 352 485 return id; 353 486 source_sink_intf_alt0.bInterfaceNumber = id; 354 487 source_sink_intf_alt1.bInterfaceNumber = id; 355 - source_sink_intf_alt2.bInterfaceNumber = id; 356 488 357 489 /* allocate bulk endpoints */ 358 490 ss->in_ep = usb_ep_autoconfig(cdev->gadget, &fs_source_desc); ··· 412 546 if (isoc_maxpacket > 1024) 413 547 isoc_maxpacket = 1024; 414 548 415 - /* sanity check the interrupt module parameters */ 416 - if (int_interval < 1) 417 - int_interval = 1; 418 - if (int_interval > 4096) 419 - int_interval = 4096; 420 - if (int_mult > 2) 421 - int_mult = 2; 422 - if (int_maxburst > 15) 423 - int_maxburst = 15; 424 - 425 - /* fill in the FS interrupt descriptors from the module parameters */ 426 - fs_int_source_desc.wMaxPacketSize = int_maxpacket > 64 ? 427 - 64 : int_maxpacket; 428 - fs_int_source_desc.bInterval = int_interval > 255 ? 429 - 255 : int_interval; 430 - fs_int_sink_desc.wMaxPacketSize = int_maxpacket > 64 ? 431 - 64 : int_maxpacket; 432 - fs_int_sink_desc.bInterval = int_interval > 255 ? 433 - 255 : int_interval; 434 - 435 - /* allocate int endpoints */ 436 - ss->int_in_ep = usb_ep_autoconfig(cdev->gadget, &fs_int_source_desc); 437 - if (!ss->int_in_ep) 438 - goto no_int; 439 - ss->int_in_ep->driver_data = cdev; /* claim */ 440 - 441 - ss->int_out_ep = usb_ep_autoconfig(cdev->gadget, &fs_int_sink_desc); 442 - if (ss->int_out_ep) { 443 - ss->int_out_ep->driver_data = cdev; /* claim */ 444 - } else { 445 - ss->int_in_ep->driver_data = NULL; 446 - ss->int_in_ep = NULL; 447 - no_int: 448 - fs_source_sink_descs[FS_ALT_IFC_2_OFFSET] = NULL; 449 - hs_source_sink_descs[HS_ALT_IFC_2_OFFSET] = NULL; 450 - ss_source_sink_descs[SS_ALT_IFC_2_OFFSET] = NULL; 451 - } 452 - 453 - if (int_maxpacket > 1024) 454 - int_maxpacket = 1024; 455 - 456 549 /* support high speed hardware */ 457 550 hs_source_desc.bEndpointAddress = fs_source_desc.bEndpointAddress; 458 551 hs_sink_desc.bEndpointAddress = fs_sink_desc.bEndpointAddress; 459 552 460 553 /* 461 - * Fill in the HS isoc and interrupt descriptors from the module 462 - * parameters. We assume that the user knows what they are doing and 463 - * won't give parameters that their UDC doesn't support. 554 + * Fill in the HS isoc descriptors from the module parameters. 555 + * We assume that the user knows what they are doing and won't 556 + * give parameters that their UDC doesn't support. 464 557 */ 465 558 hs_iso_source_desc.wMaxPacketSize = isoc_maxpacket; 466 559 hs_iso_source_desc.wMaxPacketSize |= isoc_mult << 11; ··· 432 607 hs_iso_sink_desc.bInterval = isoc_interval; 433 608 hs_iso_sink_desc.bEndpointAddress = fs_iso_sink_desc.bEndpointAddress; 434 609 435 - hs_int_source_desc.wMaxPacketSize = int_maxpacket; 436 - hs_int_source_desc.wMaxPacketSize |= int_mult << 11; 437 - hs_int_source_desc.bInterval = USB_MS_TO_HS_INTERVAL(int_interval); 438 - hs_int_source_desc.bEndpointAddress = 439 - fs_int_source_desc.bEndpointAddress; 440 - 441 - hs_int_sink_desc.wMaxPacketSize = int_maxpacket; 442 - hs_int_sink_desc.wMaxPacketSize |= int_mult << 11; 443 - hs_int_sink_desc.bInterval = USB_MS_TO_HS_INTERVAL(int_interval); 444 - hs_int_sink_desc.bEndpointAddress = fs_int_sink_desc.bEndpointAddress; 445 - 446 610 /* support super speed hardware */ 447 611 ss_source_desc.bEndpointAddress = 448 612 fs_source_desc.bEndpointAddress; ··· 439 625 fs_sink_desc.bEndpointAddress; 440 626 441 627 /* 442 - * Fill in the SS isoc and interrupt descriptors from the module 443 - * parameters. We assume that the user knows what they are doing and 444 - * won't give parameters that their UDC doesn't support. 628 + * Fill in the SS isoc descriptors from the module parameters. 629 + * We assume that the user knows what they are doing and won't 630 + * give parameters that their UDC doesn't support. 445 631 */ 446 632 ss_iso_source_desc.wMaxPacketSize = isoc_maxpacket; 447 633 ss_iso_source_desc.bInterval = isoc_interval; ··· 460 646 isoc_maxpacket * (isoc_mult + 1) * (isoc_maxburst + 1); 461 647 ss_iso_sink_desc.bEndpointAddress = fs_iso_sink_desc.bEndpointAddress; 462 648 463 - ss_int_source_desc.wMaxPacketSize = int_maxpacket; 464 - ss_int_source_desc.bInterval = USB_MS_TO_SS_INTERVAL(int_interval); 465 - ss_int_source_comp_desc.bmAttributes = int_mult; 466 - ss_int_source_comp_desc.bMaxBurst = int_maxburst; 467 - ss_int_source_comp_desc.wBytesPerInterval = 468 - int_maxpacket * (int_mult + 1) * (int_maxburst + 1); 469 - ss_int_source_desc.bEndpointAddress = 470 - fs_int_source_desc.bEndpointAddress; 471 - 472 - ss_int_sink_desc.wMaxPacketSize = int_maxpacket; 473 - ss_int_sink_desc.bInterval = USB_MS_TO_SS_INTERVAL(int_interval); 474 - ss_int_sink_comp_desc.bmAttributes = int_mult; 475 - ss_int_sink_comp_desc.bMaxBurst = int_maxburst; 476 - ss_int_sink_comp_desc.wBytesPerInterval = 477 - int_maxpacket * (int_mult + 1) * (int_maxburst + 1); 478 - ss_int_sink_desc.bEndpointAddress = fs_int_sink_desc.bEndpointAddress; 479 - 480 649 ret = usb_assign_descriptors(f, fs_source_sink_descs, 481 650 hs_source_sink_descs, ss_source_sink_descs); 482 651 if (ret) 483 652 return ret; 484 653 485 - DBG(cdev, "%s speed %s: IN/%s, OUT/%s, ISO-IN/%s, ISO-OUT/%s, " 486 - "INT-IN/%s, INT-OUT/%s\n", 654 + DBG(cdev, "%s speed %s: IN/%s, OUT/%s, ISO-IN/%s, ISO-OUT/%s\n", 487 655 (gadget_is_superspeed(c->cdev->gadget) ? "super" : 488 656 (gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full")), 489 657 f->name, ss->in_ep->name, ss->out_ep->name, 490 658 ss->iso_in_ep ? ss->iso_in_ep->name : "<none>", 491 - ss->iso_out_ep ? ss->iso_out_ep->name : "<none>", 492 - ss->int_in_ep ? ss->int_in_ep->name : "<none>", 493 - ss->int_out_ep ? ss->int_out_ep->name : "<none>"); 659 + ss->iso_out_ep ? ss->iso_out_ep->name : "<none>"); 494 660 return 0; 495 661 } 496 662 ··· 601 807 } 602 808 603 809 static int source_sink_start_ep(struct f_sourcesink *ss, bool is_in, 604 - enum eptype ep_type, int speed) 810 + bool is_iso, int speed) 605 811 { 606 812 struct usb_ep *ep; 607 813 struct usb_request *req; 608 814 int i, size, status; 609 815 610 816 for (i = 0; i < 8; i++) { 611 - switch (ep_type) { 612 - case EP_ISOC: 817 + if (is_iso) { 613 818 switch (speed) { 614 819 case USB_SPEED_SUPER: 615 820 size = isoc_maxpacket * (isoc_mult + 1) * ··· 624 831 } 625 832 ep = is_in ? ss->iso_in_ep : ss->iso_out_ep; 626 833 req = ss_alloc_ep_req(ep, size); 627 - break; 628 - case EP_INTERRUPT: 629 - switch (speed) { 630 - case USB_SPEED_SUPER: 631 - size = int_maxpacket * (int_mult + 1) * 632 - (int_maxburst + 1); 633 - break; 634 - case USB_SPEED_HIGH: 635 - size = int_maxpacket * (int_mult + 1); 636 - break; 637 - default: 638 - size = int_maxpacket > 1023 ? 639 - 1023 : int_maxpacket; 640 - break; 641 - } 642 - ep = is_in ? ss->int_in_ep : ss->int_out_ep; 643 - req = ss_alloc_ep_req(ep, size); 644 - break; 645 - default: 834 + } else { 646 835 ep = is_in ? ss->in_ep : ss->out_ep; 647 836 req = ss_alloc_ep_req(ep, 0); 648 - break; 649 837 } 650 838 651 839 if (!req) ··· 644 870 645 871 cdev = ss->function.config->cdev; 646 872 ERROR(cdev, "start %s%s %s --> %d\n", 647 - get_ep_string(ep_type), is_in ? "IN" : "OUT", 648 - ep->name, status); 873 + is_iso ? "ISO-" : "", is_in ? "IN" : "OUT", 874 + ep->name, status); 649 875 free_ep_req(ep, req); 650 876 } 651 877 652 - if (!(ep_type == EP_ISOC)) 878 + if (!is_iso) 653 879 break; 654 880 } 655 881 ··· 662 888 663 889 cdev = ss->function.config->cdev; 664 890 disable_endpoints(cdev, ss->in_ep, ss->out_ep, ss->iso_in_ep, 665 - ss->iso_out_ep, ss->int_in_ep, ss->int_out_ep); 891 + ss->iso_out_ep); 666 892 VDBG(cdev, "%s disabled\n", ss->function.name); 667 893 } 668 894 ··· 674 900 int speed = cdev->gadget->speed; 675 901 struct usb_ep *ep; 676 902 677 - if (alt == 2) { 678 - /* Configure for periodic interrupt endpoint */ 679 - ep = ss->int_in_ep; 680 - if (ep) { 681 - result = config_ep_by_speed(cdev->gadget, 682 - &(ss->function), ep); 683 - if (result) 684 - return result; 685 - 686 - result = usb_ep_enable(ep); 687 - if (result < 0) 688 - return result; 689 - 690 - ep->driver_data = ss; 691 - result = source_sink_start_ep(ss, true, EP_INTERRUPT, 692 - speed); 693 - if (result < 0) { 694 - fail1: 695 - ep = ss->int_in_ep; 696 - if (ep) { 697 - usb_ep_disable(ep); 698 - ep->driver_data = NULL; 699 - } 700 - return result; 701 - } 702 - } 703 - 704 - /* 705 - * one interrupt endpoint reads (sinks) anything OUT (from the 706 - * host) 707 - */ 708 - ep = ss->int_out_ep; 709 - if (ep) { 710 - result = config_ep_by_speed(cdev->gadget, 711 - &(ss->function), ep); 712 - if (result) 713 - goto fail1; 714 - 715 - result = usb_ep_enable(ep); 716 - if (result < 0) 717 - goto fail1; 718 - 719 - ep->driver_data = ss; 720 - result = source_sink_start_ep(ss, false, EP_INTERRUPT, 721 - speed); 722 - if (result < 0) { 723 - ep = ss->int_out_ep; 724 - usb_ep_disable(ep); 725 - ep->driver_data = NULL; 726 - goto fail1; 727 - } 728 - } 729 - 730 - goto out; 731 - } 732 - 733 903 /* one bulk endpoint writes (sources) zeroes IN (to the host) */ 734 904 ep = ss->in_ep; 735 905 result = config_ep_by_speed(cdev->gadget, &(ss->function), ep); ··· 684 966 return result; 685 967 ep->driver_data = ss; 686 968 687 - result = source_sink_start_ep(ss, true, EP_BULK, speed); 969 + result = source_sink_start_ep(ss, true, false, speed); 688 970 if (result < 0) { 689 971 fail: 690 972 ep = ss->in_ep; ··· 703 985 goto fail; 704 986 ep->driver_data = ss; 705 987 706 - result = source_sink_start_ep(ss, false, EP_BULK, speed); 988 + result = source_sink_start_ep(ss, false, false, speed); 707 989 if (result < 0) { 708 990 fail2: 709 991 ep = ss->out_ep; ··· 726 1008 goto fail2; 727 1009 ep->driver_data = ss; 728 1010 729 - result = source_sink_start_ep(ss, true, EP_ISOC, speed); 1011 + result = source_sink_start_ep(ss, true, true, speed); 730 1012 if (result < 0) { 731 1013 fail3: 732 1014 ep = ss->iso_in_ep; ··· 749 1031 goto fail3; 750 1032 ep->driver_data = ss; 751 1033 752 - result = source_sink_start_ep(ss, false, EP_ISOC, speed); 1034 + result = source_sink_start_ep(ss, false, true, speed); 753 1035 if (result < 0) { 754 1036 usb_ep_disable(ep); 755 1037 ep->driver_data = NULL; 756 1038 goto fail3; 757 1039 } 758 1040 } 759 - 760 1041 out: 761 1042 ss->cur_alt = alt; 762 1043 ··· 770 1053 struct usb_composite_dev *cdev = f->config->cdev; 771 1054 772 1055 if (ss->in_ep->driver_data) 773 - disable_source_sink(ss); 774 - else if (alt == 2 && ss->int_in_ep->driver_data) 775 1056 disable_source_sink(ss); 776 1057 return enable_source_sink(cdev, ss, alt); 777 1058 } ··· 883 1168 isoc_maxpacket = ss_opts->isoc_maxpacket; 884 1169 isoc_mult = ss_opts->isoc_mult; 885 1170 isoc_maxburst = ss_opts->isoc_maxburst; 886 - int_interval = ss_opts->int_interval; 887 - int_maxpacket = ss_opts->int_maxpacket; 888 - int_mult = ss_opts->int_mult; 889 - int_maxburst = ss_opts->int_maxburst; 890 1171 buflen = ss_opts->bulk_buflen; 891 1172 892 1173 ss->function.name = "source/sink"; ··· 1179 1468 f_ss_opts_bulk_buflen_show, 1180 1469 f_ss_opts_bulk_buflen_store); 1181 1470 1182 - static ssize_t f_ss_opts_int_interval_show(struct f_ss_opts *opts, char *page) 1183 - { 1184 - int result; 1185 - 1186 - mutex_lock(&opts->lock); 1187 - result = sprintf(page, "%u", opts->int_interval); 1188 - mutex_unlock(&opts->lock); 1189 - 1190 - return result; 1191 - } 1192 - 1193 - static ssize_t f_ss_opts_int_interval_store(struct f_ss_opts *opts, 1194 - const char *page, size_t len) 1195 - { 1196 - int ret; 1197 - u32 num; 1198 - 1199 - mutex_lock(&opts->lock); 1200 - if (opts->refcnt) { 1201 - ret = -EBUSY; 1202 - goto end; 1203 - } 1204 - 1205 - ret = kstrtou32(page, 0, &num); 1206 - if (ret) 1207 - goto end; 1208 - 1209 - if (num > 4096) { 1210 - ret = -EINVAL; 1211 - goto end; 1212 - } 1213 - 1214 - opts->int_interval = num; 1215 - ret = len; 1216 - end: 1217 - mutex_unlock(&opts->lock); 1218 - return ret; 1219 - } 1220 - 1221 - static struct f_ss_opts_attribute f_ss_opts_int_interval = 1222 - __CONFIGFS_ATTR(int_interval, S_IRUGO | S_IWUSR, 1223 - f_ss_opts_int_interval_show, 1224 - f_ss_opts_int_interval_store); 1225 - 1226 - static ssize_t f_ss_opts_int_maxpacket_show(struct f_ss_opts *opts, char *page) 1227 - { 1228 - int result; 1229 - 1230 - mutex_lock(&opts->lock); 1231 - result = sprintf(page, "%u", opts->int_maxpacket); 1232 - mutex_unlock(&opts->lock); 1233 - 1234 - return result; 1235 - } 1236 - 1237 - static ssize_t f_ss_opts_int_maxpacket_store(struct f_ss_opts *opts, 1238 - const char *page, size_t len) 1239 - { 1240 - int ret; 1241 - u16 num; 1242 - 1243 - mutex_lock(&opts->lock); 1244 - if (opts->refcnt) { 1245 - ret = -EBUSY; 1246 - goto end; 1247 - } 1248 - 1249 - ret = kstrtou16(page, 0, &num); 1250 - if (ret) 1251 - goto end; 1252 - 1253 - if (num > 1024) { 1254 - ret = -EINVAL; 1255 - goto end; 1256 - } 1257 - 1258 - opts->int_maxpacket = num; 1259 - ret = len; 1260 - end: 1261 - mutex_unlock(&opts->lock); 1262 - return ret; 1263 - } 1264 - 1265 - static struct f_ss_opts_attribute f_ss_opts_int_maxpacket = 1266 - __CONFIGFS_ATTR(int_maxpacket, S_IRUGO | S_IWUSR, 1267 - f_ss_opts_int_maxpacket_show, 1268 - f_ss_opts_int_maxpacket_store); 1269 - 1270 - static ssize_t f_ss_opts_int_mult_show(struct f_ss_opts *opts, char *page) 1271 - { 1272 - int result; 1273 - 1274 - mutex_lock(&opts->lock); 1275 - result = sprintf(page, "%u", opts->int_mult); 1276 - mutex_unlock(&opts->lock); 1277 - 1278 - return result; 1279 - } 1280 - 1281 - static ssize_t f_ss_opts_int_mult_store(struct f_ss_opts *opts, 1282 - const char *page, size_t len) 1283 - { 1284 - int ret; 1285 - u8 num; 1286 - 1287 - mutex_lock(&opts->lock); 1288 - if (opts->refcnt) { 1289 - ret = -EBUSY; 1290 - goto end; 1291 - } 1292 - 1293 - ret = kstrtou8(page, 0, &num); 1294 - if (ret) 1295 - goto end; 1296 - 1297 - if (num > 2) { 1298 - ret = -EINVAL; 1299 - goto end; 1300 - } 1301 - 1302 - opts->int_mult = num; 1303 - ret = len; 1304 - end: 1305 - mutex_unlock(&opts->lock); 1306 - return ret; 1307 - } 1308 - 1309 - static struct f_ss_opts_attribute f_ss_opts_int_mult = 1310 - __CONFIGFS_ATTR(int_mult, S_IRUGO | S_IWUSR, 1311 - f_ss_opts_int_mult_show, 1312 - f_ss_opts_int_mult_store); 1313 - 1314 - static ssize_t f_ss_opts_int_maxburst_show(struct f_ss_opts *opts, char *page) 1315 - { 1316 - int result; 1317 - 1318 - mutex_lock(&opts->lock); 1319 - result = sprintf(page, "%u", opts->int_maxburst); 1320 - mutex_unlock(&opts->lock); 1321 - 1322 - return result; 1323 - } 1324 - 1325 - static ssize_t f_ss_opts_int_maxburst_store(struct f_ss_opts *opts, 1326 - const char *page, size_t len) 1327 - { 1328 - int ret; 1329 - u8 num; 1330 - 1331 - mutex_lock(&opts->lock); 1332 - if (opts->refcnt) { 1333 - ret = -EBUSY; 1334 - goto end; 1335 - } 1336 - 1337 - ret = kstrtou8(page, 0, &num); 1338 - if (ret) 1339 - goto end; 1340 - 1341 - if (num > 15) { 1342 - ret = -EINVAL; 1343 - goto end; 1344 - } 1345 - 1346 - opts->int_maxburst = num; 1347 - ret = len; 1348 - end: 1349 - mutex_unlock(&opts->lock); 1350 - return ret; 1351 - } 1352 - 1353 - static struct f_ss_opts_attribute f_ss_opts_int_maxburst = 1354 - __CONFIGFS_ATTR(int_maxburst, S_IRUGO | S_IWUSR, 1355 - f_ss_opts_int_maxburst_show, 1356 - f_ss_opts_int_maxburst_store); 1357 - 1358 1471 static struct configfs_attribute *ss_attrs[] = { 1359 1472 &f_ss_opts_pattern.attr, 1360 1473 &f_ss_opts_isoc_interval.attr, ··· 1186 1651 &f_ss_opts_isoc_mult.attr, 1187 1652 &f_ss_opts_isoc_maxburst.attr, 1188 1653 &f_ss_opts_bulk_buflen.attr, 1189 - &f_ss_opts_int_interval.attr, 1190 - &f_ss_opts_int_maxpacket.attr, 1191 - &f_ss_opts_int_mult.attr, 1192 - &f_ss_opts_int_maxburst.attr, 1193 1654 NULL, 1194 1655 }; 1195 1656 ··· 1215 1684 ss_opts->isoc_interval = GZERO_ISOC_INTERVAL; 1216 1685 ss_opts->isoc_maxpacket = GZERO_ISOC_MAXPACKET; 1217 1686 ss_opts->bulk_buflen = GZERO_BULK_BUFLEN; 1218 - ss_opts->int_interval = GZERO_INT_INTERVAL; 1219 - ss_opts->int_maxpacket = GZERO_INT_MAXPACKET; 1220 1687 1221 1688 config_group_init_type_name(&ss_opts->func_inst.group, "", 1222 1689 &ss_func_type);
+1 -12
drivers/usb/gadget/function/g_zero.h
··· 10 10 #define GZERO_QLEN 32 11 11 #define GZERO_ISOC_INTERVAL 4 12 12 #define GZERO_ISOC_MAXPACKET 1024 13 - #define GZERO_INT_INTERVAL 1 /* Default interrupt interval = 1 ms */ 14 - #define GZERO_INT_MAXPACKET 1024 15 13 16 14 struct usb_zero_options { 17 15 unsigned pattern; ··· 17 19 unsigned isoc_maxpacket; 18 20 unsigned isoc_mult; 19 21 unsigned isoc_maxburst; 20 - unsigned int_interval; /* In ms */ 21 - unsigned int_maxpacket; 22 - unsigned int_mult; 23 - unsigned int_maxburst; 24 22 unsigned bulk_buflen; 25 23 unsigned qlen; 26 24 }; ··· 28 34 unsigned isoc_maxpacket; 29 35 unsigned isoc_mult; 30 36 unsigned isoc_maxburst; 31 - unsigned int_interval; /* In ms */ 32 - unsigned int_maxpacket; 33 - unsigned int_mult; 34 - unsigned int_maxburst; 35 37 unsigned bulk_buflen; 36 38 37 39 /* ··· 62 72 void free_ep_req(struct usb_ep *ep, struct usb_request *req); 63 73 void disable_endpoints(struct usb_composite_dev *cdev, 64 74 struct usb_ep *in, struct usb_ep *out, 65 - struct usb_ep *iso_in, struct usb_ep *iso_out, 66 - struct usb_ep *int_in, struct usb_ep *int_out); 75 + struct usb_ep *iso_in, struct usb_ep *iso_out); 67 76 68 77 #endif /* __G_ZERO_H */
-21
drivers/usb/gadget/legacy/zero.c
··· 68 68 .isoc_maxpacket = GZERO_ISOC_MAXPACKET, 69 69 .bulk_buflen = GZERO_BULK_BUFLEN, 70 70 .qlen = GZERO_QLEN, 71 - .int_interval = GZERO_INT_INTERVAL, 72 - .int_maxpacket = GZERO_INT_MAXPACKET, 73 71 }; 74 72 75 73 /*-------------------------------------------------------------------------*/ ··· 266 268 S_IRUGO|S_IWUSR); 267 269 MODULE_PARM_DESC(isoc_maxburst, "0 - 15 (ss only)"); 268 270 269 - module_param_named(int_interval, gzero_options.int_interval, uint, 270 - S_IRUGO|S_IWUSR); 271 - MODULE_PARM_DESC(int_interval, "1 - 16"); 272 - 273 - module_param_named(int_maxpacket, gzero_options.int_maxpacket, uint, 274 - S_IRUGO|S_IWUSR); 275 - MODULE_PARM_DESC(int_maxpacket, "0 - 1023 (fs), 0 - 1024 (hs/ss)"); 276 - 277 - module_param_named(int_mult, gzero_options.int_mult, uint, S_IRUGO|S_IWUSR); 278 - MODULE_PARM_DESC(int_mult, "0 - 2 (hs/ss only)"); 279 - 280 - module_param_named(int_maxburst, gzero_options.int_maxburst, uint, 281 - S_IRUGO|S_IWUSR); 282 - MODULE_PARM_DESC(int_maxburst, "0 - 15 (ss only)"); 283 - 284 271 static struct usb_function *func_lb; 285 272 static struct usb_function_instance *func_inst_lb; 286 273 ··· 301 318 ss_opts->isoc_maxpacket = gzero_options.isoc_maxpacket; 302 319 ss_opts->isoc_mult = gzero_options.isoc_mult; 303 320 ss_opts->isoc_maxburst = gzero_options.isoc_maxburst; 304 - ss_opts->int_interval = gzero_options.int_interval; 305 - ss_opts->int_maxpacket = gzero_options.int_maxpacket; 306 - ss_opts->int_mult = gzero_options.int_mult; 307 - ss_opts->int_maxburst = gzero_options.int_maxburst; 308 321 ss_opts->bulk_buflen = gzero_options.bulk_buflen; 309 322 310 323 func_ss = usb_get_function(func_inst_ss);
+9 -21
drivers/usb/host/ehci-atmel.c
··· 34 34 35 35 struct atmel_ehci_priv { 36 36 struct clk *iclk; 37 - struct clk *fclk; 38 37 struct clk *uclk; 39 38 bool clocked; 40 39 }; ··· 50 51 { 51 52 if (atmel_ehci->clocked) 52 53 return; 53 - if (IS_ENABLED(CONFIG_COMMON_CLK)) { 54 - clk_set_rate(atmel_ehci->uclk, 48000000); 55 - clk_prepare_enable(atmel_ehci->uclk); 56 - } 54 + 55 + clk_prepare_enable(atmel_ehci->uclk); 57 56 clk_prepare_enable(atmel_ehci->iclk); 58 - clk_prepare_enable(atmel_ehci->fclk); 59 57 atmel_ehci->clocked = true; 60 58 } 61 59 ··· 60 64 { 61 65 if (!atmel_ehci->clocked) 62 66 return; 63 - clk_disable_unprepare(atmel_ehci->fclk); 67 + 64 68 clk_disable_unprepare(atmel_ehci->iclk); 65 - if (IS_ENABLED(CONFIG_COMMON_CLK)) 66 - clk_disable_unprepare(atmel_ehci->uclk); 69 + clk_disable_unprepare(atmel_ehci->uclk); 67 70 atmel_ehci->clocked = false; 68 71 } 69 72 ··· 141 146 retval = -ENOENT; 142 147 goto fail_request_resource; 143 148 } 144 - atmel_ehci->fclk = devm_clk_get(&pdev->dev, "uhpck"); 145 - if (IS_ERR(atmel_ehci->fclk)) { 146 - dev_err(&pdev->dev, "Error getting function clock\n"); 147 - retval = -ENOENT; 149 + 150 + atmel_ehci->uclk = devm_clk_get(&pdev->dev, "usb_clk"); 151 + if (IS_ERR(atmel_ehci->uclk)) { 152 + dev_err(&pdev->dev, "failed to get uclk\n"); 153 + retval = PTR_ERR(atmel_ehci->uclk); 148 154 goto fail_request_resource; 149 - } 150 - if (IS_ENABLED(CONFIG_COMMON_CLK)) { 151 - atmel_ehci->uclk = devm_clk_get(&pdev->dev, "usb_clk"); 152 - if (IS_ERR(atmel_ehci->uclk)) { 153 - dev_err(&pdev->dev, "failed to get uclk\n"); 154 - retval = PTR_ERR(atmel_ehci->uclk); 155 - goto fail_request_resource; 156 - } 157 155 } 158 156 159 157 ehci = hcd_to_ehci(hcd);
+1 -1
drivers/usb/host/xhci-ring.c
··· 1729 1729 if (!command) 1730 1730 return; 1731 1731 1732 - ep->ep_state |= EP_HALTED | EP_RECENTLY_HALTED; 1732 + ep->ep_state |= EP_HALTED; 1733 1733 ep->stopped_stream = stream_id; 1734 1734 1735 1735 xhci_queue_reset_ep(xhci, command, slot_id, ep_index);
+9 -91
drivers/usb/host/xhci.c
··· 1338 1338 goto exit; 1339 1339 } 1340 1340 1341 - /* Reject urb if endpoint is in soft reset, queue must stay empty */ 1342 - if (xhci->devs[slot_id]->eps[ep_index].ep_state & EP_CONFIG_PENDING) { 1343 - xhci_warn(xhci, "Can't enqueue URB while ep is in soft reset\n"); 1344 - ret = -EINVAL; 1345 - } 1346 - 1347 1341 if (usb_endpoint_xfer_isoc(&urb->ep->desc)) 1348 1342 size = urb->number_of_packets; 1349 1343 else ··· 2948 2954 } 2949 2955 } 2950 2956 2951 - /* Called after clearing a halted device. USB core should have sent the control 2957 + /* Called when clearing halted device. The core should have sent the control 2952 2958 * message to clear the device halt condition. The host side of the halt should 2953 - * already be cleared with a reset endpoint command issued immediately when the 2954 - * STALL tx event was received. 2959 + * already be cleared with a reset endpoint command issued when the STALL tx 2960 + * event was received. 2961 + * 2962 + * Context: in_interrupt 2955 2963 */ 2956 2964 2957 2965 void xhci_endpoint_reset(struct usb_hcd *hcd, 2958 2966 struct usb_host_endpoint *ep) 2959 2967 { 2960 2968 struct xhci_hcd *xhci; 2961 - struct usb_device *udev; 2962 - struct xhci_virt_device *virt_dev; 2963 - struct xhci_virt_ep *virt_ep; 2964 - struct xhci_input_control_ctx *ctrl_ctx; 2965 - struct xhci_command *command; 2966 - unsigned int ep_index, ep_state; 2967 - unsigned long flags; 2968 - u32 ep_flag; 2969 2969 2970 2970 xhci = hcd_to_xhci(hcd); 2971 - udev = (struct usb_device *) ep->hcpriv; 2972 - if (!ep->hcpriv) 2973 - return; 2974 - virt_dev = xhci->devs[udev->slot_id]; 2975 - ep_index = xhci_get_endpoint_index(&ep->desc); 2976 - virt_ep = &virt_dev->eps[ep_index]; 2977 - ep_state = virt_ep->ep_state; 2978 2971 2979 2972 /* 2980 - * Implement the config ep command in xhci 4.6.8 additional note: 2973 + * We might need to implement the config ep cmd in xhci 4.8.1 note: 2981 2974 * The Reset Endpoint Command may only be issued to endpoints in the 2982 2975 * Halted state. If software wishes reset the Data Toggle or Sequence 2983 2976 * Number of an endpoint that isn't in the Halted state, then software ··· 2972 2991 * for the target endpoint. that is in the Stopped state. 2973 2992 */ 2974 2993 2975 - if (ep_state & SET_DEQ_PENDING || ep_state & EP_RECENTLY_HALTED) { 2976 - virt_ep->ep_state &= ~EP_RECENTLY_HALTED; 2977 - xhci_dbg(xhci, "ep recently halted, no toggle reset needed\n"); 2978 - return; 2979 - } 2980 - 2981 - /* Only interrupt and bulk ep's use Data toggle, USB2 spec 5.5.4-> */ 2982 - if (usb_endpoint_xfer_control(&ep->desc) || 2983 - usb_endpoint_xfer_isoc(&ep->desc)) 2984 - return; 2985 - 2986 - ep_flag = xhci_get_endpoint_flag(&ep->desc); 2987 - 2988 - if (ep_flag == SLOT_FLAG || ep_flag == EP0_FLAG) 2989 - return; 2990 - 2991 - command = xhci_alloc_command(xhci, true, true, GFP_NOWAIT); 2992 - if (!command) { 2993 - xhci_err(xhci, "Could not allocate xHCI command structure.\n"); 2994 - return; 2995 - } 2996 - 2997 - spin_lock_irqsave(&xhci->lock, flags); 2998 - 2999 - /* block ringing ep doorbell */ 3000 - virt_ep->ep_state |= EP_CONFIG_PENDING; 3001 - 3002 - /* 3003 - * Make sure endpoint ring is empty before resetting the toggle/seq. 3004 - * Driver is required to synchronously cancel all transfer request. 3005 - * 3006 - * xhci 4.6.6 says we can issue a configure endpoint command on a 3007 - * running endpoint ring as long as it's idle (queue empty) 3008 - */ 3009 - 3010 - if (!list_empty(&virt_ep->ring->td_list)) { 3011 - dev_err(&udev->dev, "EP not empty, refuse reset\n"); 3012 - spin_unlock_irqrestore(&xhci->lock, flags); 3013 - goto cleanup; 3014 - } 3015 - 3016 - xhci_dbg(xhci, "Reset toggle/seq for slot %d, ep_index: %d\n", 3017 - udev->slot_id, ep_index); 3018 - 3019 - ctrl_ctx = xhci_get_input_control_ctx(command->in_ctx); 3020 - if (!ctrl_ctx) { 3021 - xhci_err(xhci, "Could not get input context, bad type. virt_dev: %p, in_ctx %p\n", 3022 - virt_dev, virt_dev->in_ctx); 3023 - spin_unlock_irqrestore(&xhci->lock, flags); 3024 - goto cleanup; 3025 - } 3026 - xhci_setup_input_ctx_for_config_ep(xhci, command->in_ctx, 3027 - virt_dev->out_ctx, ctrl_ctx, 3028 - ep_flag, ep_flag); 3029 - xhci_endpoint_copy(xhci, command->in_ctx, virt_dev->out_ctx, ep_index); 3030 - 3031 - xhci_queue_configure_endpoint(xhci, command, command->in_ctx->dma, 3032 - udev->slot_id, false); 3033 - xhci_ring_cmd_db(xhci); 3034 - spin_unlock_irqrestore(&xhci->lock, flags); 3035 - 3036 - wait_for_completion(command->completion); 3037 - 3038 - cleanup: 3039 - virt_ep->ep_state &= ~EP_CONFIG_PENDING; 3040 - xhci_free_command(xhci, command); 2994 + /* For now just print debug to follow the situation */ 2995 + xhci_dbg(xhci, "Endpoint 0x%x ep reset callback called\n", 2996 + ep->desc.bEndpointAddress); 3041 2997 } 3042 2998 3043 2999 static int xhci_check_streams_endpoint(struct xhci_hcd *xhci,
-2
drivers/usb/host/xhci.h
··· 865 865 #define EP_HAS_STREAMS (1 << 4) 866 866 /* Transitioning the endpoint to not using streams, don't enqueue URBs */ 867 867 #define EP_GETTING_NO_STREAMS (1 << 5) 868 - #define EP_RECENTLY_HALTED (1 << 6) 869 - #define EP_CONFIG_PENDING (1 << 7) 870 868 /* ---- Related to URB cancellation ---- */ 871 869 struct list_head cancelled_td_list; 872 870 struct xhci_td *stopped_td;
+1 -2
drivers/usb/isp1760/isp1760-core.c
··· 151 151 } 152 152 153 153 if (IS_ENABLED(CONFIG_USB_ISP1761_UDC) && !udc_disabled) { 154 - ret = isp1760_udc_register(isp, irq, irqflags | IRQF_SHARED | 155 - IRQF_DISABLED); 154 + ret = isp1760_udc_register(isp, irq, irqflags); 156 155 if (ret < 0) { 157 156 isp1760_hcd_unregister(&isp->hcd); 158 157 return ret;
+9 -7
drivers/usb/isp1760/isp1760-udc.c
··· 1191 1191 struct usb_gadget_driver *driver) 1192 1192 { 1193 1193 struct isp1760_udc *udc = gadget_to_udc(gadget); 1194 + unsigned long flags; 1194 1195 1195 1196 /* The hardware doesn't support low speed. */ 1196 1197 if (driver->max_speed < USB_SPEED_FULL) { ··· 1199 1198 return -EINVAL; 1200 1199 } 1201 1200 1202 - spin_lock(&udc->lock); 1201 + spin_lock_irqsave(&udc->lock, flags); 1203 1202 1204 1203 if (udc->driver) { 1205 1204 dev_err(udc->isp->dev, "UDC already has a gadget driver\n"); ··· 1209 1208 1210 1209 udc->driver = driver; 1211 1210 1212 - spin_unlock(&udc->lock); 1211 + spin_unlock_irqrestore(&udc->lock, flags); 1213 1212 1214 1213 dev_dbg(udc->isp->dev, "starting UDC with driver %s\n", 1215 1214 driver->function); ··· 1233 1232 static int isp1760_udc_stop(struct usb_gadget *gadget) 1234 1233 { 1235 1234 struct isp1760_udc *udc = gadget_to_udc(gadget); 1235 + unsigned long flags; 1236 1236 1237 1237 dev_dbg(udc->isp->dev, "%s\n", __func__); 1238 1238 ··· 1241 1239 1242 1240 isp1760_udc_write(udc, DC_MODE, 0); 1243 1241 1244 - spin_lock(&udc->lock); 1242 + spin_lock_irqsave(&udc->lock, flags); 1245 1243 udc->driver = NULL; 1246 - spin_unlock(&udc->lock); 1244 + spin_unlock_irqrestore(&udc->lock, flags); 1247 1245 1248 1246 return 0; 1249 1247 } ··· 1413 1411 return -ENODEV; 1414 1412 } 1415 1413 1416 - if (chipid != 0x00011582) { 1414 + if (chipid != 0x00011582 && chipid != 0x00158210) { 1417 1415 dev_err(udc->isp->dev, "udc: invalid chip ID 0x%08x\n", chipid); 1418 1416 return -ENODEV; 1419 1417 } ··· 1453 1451 1454 1452 sprintf(udc->irqname, "%s (udc)", devname); 1455 1453 1456 - ret = request_irq(irq, isp1760_udc_irq, IRQF_SHARED | IRQF_DISABLED | 1457 - irqflags, udc->irqname, udc); 1454 + ret = request_irq(irq, isp1760_udc_irq, IRQF_SHARED | irqflags, 1455 + udc->irqname, udc); 1458 1456 if (ret < 0) 1459 1457 goto error; 1460 1458
+2 -1
drivers/usb/musb/Kconfig
··· 79 79 80 80 config USB_MUSB_OMAP2PLUS 81 81 tristate "OMAP2430 and onwards" 82 - depends on ARCH_OMAP2PLUS && USB && OMAP_CONTROL_PHY 82 + depends on ARCH_OMAP2PLUS && USB 83 + depends on OMAP_CONTROL_PHY || !OMAP_CONTROL_PHY 83 84 select GENERIC_PHY 84 85 85 86 config USB_MUSB_AM35X
+3
drivers/usb/phy/phy-am335x-control.c
··· 126 126 return NULL; 127 127 128 128 dev = bus_find_device(&platform_bus_type, NULL, node, match); 129 + if (!dev) 130 + return NULL; 131 + 129 132 ctrl_usb = dev_get_drvdata(dev); 130 133 if (!ctrl_usb) 131 134 return NULL;
+7
drivers/usb/storage/unusual_uas.h
··· 113 113 USB_SC_DEVICE, USB_PR_DEVICE, NULL, 114 114 US_FL_NO_ATA_1X), 115 115 116 + /* Reported-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> */ 117 + UNUSUAL_DEV(0x13fd, 0x3940, 0x0000, 0x9999, 118 + "Initio Corporation", 119 + "", 120 + USB_SC_DEVICE, USB_PR_DEVICE, NULL, 121 + US_FL_NO_ATA_1X), 122 + 116 123 /* Reported-by: Tom Arild Naess <tanaess@gmail.com> */ 117 124 UNUSUAL_DEV(0x152d, 0x0539, 0x0000, 0x9999, 118 125 "JMicron",