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

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

Pull USB / Thunderbolt updates from Greg KH:
"Here is the big set of USB and Thunderbolt driver changes for
6.17-rc1.

Lots of little things in here, mostly all small cleanups and updates,
no major new features this development cycle. Stuff included in here
is:

- xhci minor tweaks for error handling

- typec minor updates and a driver update

- gadget driver api cleanups

- unused function removals

- unbind memory leak fixes

- a few new device ids added

- a few new devices supported for some drivers

- other minor cleanups and changes

All of these have been in linux-next with no reported issues, with the
leak fixes being in the shortest amount of time, but they are
'obviously correct' :)"

* tag 'usb-6.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (100 commits)
usb: musb: omap2430: clean up probe error handling
usb: musb: omap2430: fix device leak at unbind
usb: gadget: udc: renesas_usb3: fix device leak at unbind
usb: dwc3: meson-g12a: fix device leaks at unbind
usb: dwc3: imx8mp: fix device leak at unbind
usb: musb: omap2430: enable compile testing
usb: gadget: udc: renesas_usb3: drop unused module alias
usb: xhci: print xhci->xhc_state when queue_command failed
usb: atm: cxacru: Merge cxacru_upload_firmware() into cxacru_heavy_init()
USB: serial: option: add Foxconn T99W709
usb: core: add urb->sgt parameter description
thunderbolt: Fix copy+paste error in match_service_id()
usb: typec: ucsi: Update power_supply on power role change
usb: typec: ucsi: psy: Set current max to 100mA for BC 1.2 and Default
usb: typec: fusb302: cache PD RX state
usb: typec: ucsi: yoga-c630: add DRM dependency
usb: gadget : fix use-after-free in composite_dev_cleanup()
usb: chipidea: imx: Add a missing blank line
usb: gadget: f_uac1: replace scnprintf() with sysfs_emit()
usb: usblp: clean up assignment inside if conditions
...

+1016 -683
+10
Documentation/ABI/testing/sysfs-driver-typec-displayport
··· 62 62 by VESA DisplayPort Alt Mode on USB Type-C Standard. 63 63 - 0 when HPD’s logical state is low (HPD_Low) as defined by 64 64 VESA DisplayPort Alt Mode on USB Type-C Standard. 65 + 66 + What: /sys/bus/typec/devices/.../displayport/irq_hpd 67 + Date: June 2025 68 + Contact: RD Babiera <rdbabiera@google.com> 69 + Description: 70 + IRQ_HPD events are sent over the USB PD protocol in Status Update and 71 + Attention messages. IRQ_HPD can only be asserted when HPD is high, 72 + and is asserted when an IRQ_HPD has been issued since the last Status 73 + Update. This is a read only node that returns the number of IRQ events 74 + raised in the driver's lifetime.
+5
Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml
··· 23 23 - nvidia,tegra30-udc 24 24 - nvidia,tegra114-udc 25 25 - nvidia,tegra124-udc 26 + - nxp,s32g2-usb 26 27 - qcom,ci-hdrc 27 28 - items: 28 29 - enum: ··· 38 37 - enum: 39 38 - nuvoton,npcm845-udc 40 39 - const: nuvoton,npcm750-udc 40 + - items: 41 + - enum: 42 + - nxp,s32g3-usb 43 + - const: nxp,s32g2-usb 41 44 42 45 clocks: 43 46 minItems: 1
+1 -1
Documentation/devicetree/bindings/usb/dwc2.yaml
··· 59 59 - const: amcc,dwc-otg 60 60 - const: apm,apm82181-dwc-otg 61 61 - const: snps,dwc2 62 - - const: sophgo,cv1800-usb 62 + - const: sophgo,cv1800b-usb 63 63 - const: st,stm32f4x9-fsotg 64 64 - const: st,stm32f4x9-hsotg 65 65 - const: st,stm32f7-hsotg
+2
Documentation/devicetree/bindings/usb/fsl,usbmisc.yaml
··· 21 21 - fsl,imx53-usbmisc 22 22 - fsl,imx6q-usbmisc 23 23 - fsl,vf610-usbmisc 24 + - nxp,s32g2-usbmisc 25 + - nxp,s32g3-usbmisc 24 26 - items: 25 27 - enum: 26 28 - fsl,imx6ul-usbmisc
+14 -14
Documentation/devicetree/bindings/usb/genesys,gl850g.yaml
··· 26 26 description: 27 27 The regulator that provides 3.3V or 5.0V core power to the hub. 28 28 29 - peer-hub: 30 - $ref: /schemas/types.yaml#/definitions/phandle 31 - description: 32 - For onboard hub controllers that support USB 3.x and USB 2.0 hubs 33 - with shared resets and power supplies, this property is used to identify 34 - the hubs with which these are shared. 29 + peer-hub: true 30 + 31 + ports: 32 + $ref: /schemas/graph.yaml#/properties/ports 33 + 34 + patternProperties: 35 + '^port@': 36 + $ref: /schemas/graph.yaml#/properties/port 37 + 38 + properties: 39 + reg: 40 + minimum: 1 41 + maximum: 4 35 42 36 43 required: 37 44 - compatible 38 45 - reg 39 46 40 47 allOf: 41 - - $ref: usb-device.yaml# 48 + - $ref: usb-hub.yaml# 42 49 - if: 43 50 properties: 44 51 compatible: ··· 68 61 properties: 69 62 peer-hub: true 70 63 vdd-supply: true 71 - 72 - patternProperties: 73 - "^.*@[0-9a-f]{1,2}$": 74 - description: The hard wired USB devices 75 - type: object 76 - $ref: /schemas/usb/usb-device.yaml 77 - additionalProperties: true 78 64 79 65 unevaluatedProperties: false 80 66
-28
Documentation/devicetree/bindings/usb/lpc32xx-udc.txt
··· 1 - * NXP LPC32xx SoC USB Device Controller (UDC) 2 - 3 - Required properties: 4 - - compatible: Must be "nxp,lpc3220-udc" 5 - - reg: Physical base address of the controller and length of memory mapped 6 - region. 7 - - interrupts: The USB interrupts: 8 - * USB Device Low Priority Interrupt 9 - * USB Device High Priority Interrupt 10 - * USB Device DMA Interrupt 11 - * External USB Transceiver Interrupt (OTG ATX) 12 - - transceiver: phandle of the associated ISP1301 device - this is necessary for 13 - the UDC controller for connecting to the USB physical layer 14 - 15 - Example: 16 - 17 - isp1301: usb-transceiver@2c { 18 - compatible = "nxp,isp1301"; 19 - reg = <0x2c>; 20 - }; 21 - 22 - usbd@31020000 { 23 - compatible = "nxp,lpc3220-udc"; 24 - reg = <0x31020000 0x300>; 25 - interrupt-parent = <&mic>; 26 - interrupts = <0x3d 0>, <0x3e 0>, <0x3c 0>, <0x3a 0>; 27 - transceiver = <&isp1301>; 28 - };
+50
Documentation/devicetree/bindings/usb/nxp,lpc3220-udc.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/usb/nxp,lpc3220-udc.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: NXP LPC32xx SoC USB Device Controller (UDC) 8 + 9 + maintainers: 10 + - Frank Li <Frank.Li@nxp.com> 11 + 12 + properties: 13 + compatible: 14 + const: nxp,lpc3220-udc 15 + 16 + reg: 17 + maxItems: 1 18 + 19 + interrupts: 20 + items: 21 + - description: USB Device Low Priority Interrupt 22 + - description: USB Device High Priority Interrupt 23 + - description: USB Device DMA Interrupt 24 + - description: External USB Transceiver Interrupt (OTG ATX) 25 + 26 + clocks: 27 + maxItems: 1 28 + 29 + transceiver: 30 + description: 31 + phandle of the associated ISP1301 device - this is necessary for 32 + the UDC controller for connecting to the USB physical layer 33 + 34 + required: 35 + - compatible 36 + - reg 37 + - interrupts 38 + - transceiver 39 + 40 + additionalProperties: false 41 + 42 + examples: 43 + - | 44 + usbd@31020000 { 45 + compatible = "nxp,lpc3220-udc"; 46 + reg = <0x31020000 0x300>; 47 + interrupt-parent = <&mic>; 48 + interrupts = <0x3d 0>, <0x3e 0>, <0x3c 0>, <0x3a 0>; 49 + transceiver = <&isp1301>; 50 + };
+1
Documentation/devicetree/bindings/usb/renesas,usbhs.yaml
··· 27 27 - renesas,usbhs-r9a07g044 # RZ/G2{L,LC} 28 28 - renesas,usbhs-r9a07g054 # RZ/V2L 29 29 - renesas,usbhs-r9a08g045 # RZ/G3S 30 + - renesas,usbhs-r9a09g056 # RZ/V2N 30 31 - renesas,usbhs-r9a09g057 # RZ/V2H(P) 31 32 - const: renesas,rzg2l-usbhs 32 33
-11
Documentation/driver-api/usb/anchors.rst
··· 45 45 are called in the reverse temporal order they were submitted. 46 46 This way no data can be reordered. 47 47 48 - :c:func:`usb_unlink_anchored_urbs` 49 - ---------------------------------- 50 - 51 - 52 - This function unlinks all URBs associated with an anchor. The URBs 53 - are processed in the reverse temporal order they were submitted. 54 - This is similar to :c:func:`usb_kill_anchored_urbs`, but it will not sleep. 55 - Therefore no guarantee is made that the URBs have been unlinked when 56 - the call returns. They may be unlinked later but will be unlinked in 57 - finite time. 58 - 59 48 :c:func:`usb_scuttle_anchored_urbs` 60 49 ----------------------------------- 61 50
+22 -23
Documentation/usb/gadget_configfs.rst
··· 92 92 93 93 Further custom string descriptors can be created as directories within the 94 94 language's directory, with the string text being written to the "s" attribute 95 - within the string's directory: 95 + within the string's directory:: 96 96 97 97 $ mkdir strings/0x409/xu.0 98 98 $ echo <string text> > strings/0x409/xu.0/s ··· 104 104 ------------------------------ 105 105 106 106 Each gadget will consist of a number of configurations, their corresponding 107 - directories must be created: 107 + directories must be created:: 108 108 109 - $ mkdir configs/<name>.<number> 109 + $ mkdir configs/<name>.<number> 110 110 111 111 where <name> can be any string which is legal in a filesystem and the 112 112 <number> is the configuration's number, e.g.:: ··· 246 246 ... 247 247 ... 248 248 249 - Remove strings directories in configurations: 249 + Remove strings directories in configurations:: 250 250 251 251 $ rmdir configs/<config name>.<number>/strings/<lang> 252 252 ··· 270 270 ... 271 271 ... 272 272 273 - Remove functions (function modules are not unloaded, though): 273 + Remove functions (function modules are not unloaded, though):: 274 274 275 275 $ rmdir functions/<name>.<instance name> 276 276 ··· 369 369 The concepts described above translate to USB gadgets like this: 370 370 371 371 1. A gadget has its config group, which has some attributes (idVendor, 372 - idProduct etc) and default sub-groups (configs, functions, strings). 373 - Writing to the attributes causes the information to be stored in 374 - appropriate locations. In the configs, functions and strings sub-groups 375 - a user can create their sub-groups to represent configurations, functions, 376 - and groups of strings in a given language. 372 + idProduct etc) and default sub-groups (configs, functions, strings). 373 + Writing to the attributes causes the information to be stored in appropriate 374 + locations. In the configs, functions and strings sub-groups a user can 375 + create their sub-groups to represent configurations, functions, and groups 376 + of strings in a given language. 377 377 378 378 2. The user creates configurations and functions, in the configurations 379 - creates symbolic links to functions. This information is used when the 380 - gadget's UDC attribute is written to, which means binding the gadget 381 - to the UDC. The code in drivers/usb/gadget/configfs.c iterates over 382 - all configurations, and in each configuration it iterates over all 383 - functions and binds them. This way the whole gadget is bound. 379 + creates symbolic links to functions. This information is used when the 380 + gadget's UDC attribute is written to, which means binding the gadget to the 381 + UDC. The code in drivers/usb/gadget/configfs.c iterates over all 382 + configurations, and in each configuration it iterates over all functions and 383 + binds them. This way the whole gadget is bound. 384 384 385 385 3. The file drivers/usb/gadget/configfs.c contains code for 386 386 ··· 388 388 - gadget's default groups (configs, functions, strings) 389 389 - associating functions with configurations (symlinks) 390 390 391 - 4. Each USB function naturally has its own view of what it wants 392 - configured, so config_groups for particular functions are defined 393 - in the functions implementation files drivers/usb/gadget/f_*.c. 391 + 4. Each USB function naturally has its own view of what it wants configured, so 392 + config_groups for particular functions are defined in the functions 393 + implementation files drivers/usb/gadget/f_*.c. 394 394 395 395 5. Function's code is written in such a way that it uses 396 - 397 - usb_get_function_instance(), which, in turn, calls request_module. 398 - So, provided that modprobe works, modules for particular functions 399 - are loaded automatically. Please note that the converse is not true: 400 - after a gadget is disabled and torn down, the modules remain loaded. 396 + usb_get_function_instance(), which, in turn, calls request_module. So, 397 + provided that modprobe works, modules for particular functions are loaded 398 + automatically. Please note that the converse is not true: after a gadget is 399 + disabled and torn down, the modules remain loaded.
+23
arch/arm64/boot/dts/freescale/s32g2.dtsi
··· 376 376 status = "disabled"; 377 377 }; 378 378 379 + usbmisc: usbmisc@44064200 { 380 + #index-cells = <1>; 381 + compatible = "nxp,s32g2-usbmisc"; 382 + reg = <0x44064200 0x200>; 383 + }; 384 + 385 + usbotg: usb@44064000 { 386 + compatible = "nxp,s32g2-usb"; 387 + reg = <0x44064000 0x200>; 388 + interrupt-parent = <&gic>; 389 + interrupts = <GIC_SPI 211 IRQ_TYPE_LEVEL_HIGH>, /* OTG Core */ 390 + <GIC_SPI 212 IRQ_TYPE_LEVEL_HIGH>; /* OTG Wakeup */ 391 + clocks = <&clks 94>, <&clks 95>; 392 + fsl,usbmisc = <&usbmisc 0>; 393 + ahb-burst-config = <0x3>; 394 + tx-burst-size-dword = <0x10>; 395 + rx-burst-size-dword = <0x10>; 396 + phy_type = "ulpi"; 397 + dr_mode = "host"; 398 + maximum-speed = "high-speed"; 399 + status = "disabled"; 400 + }; 401 + 379 402 i2c0: i2c@401e4000 { 380 403 compatible = "nxp,s32g2-i2c"; 381 404 reg = <0x401e4000 0x1000>;
+23
arch/arm64/boot/dts/freescale/s32g3.dtsi
··· 435 435 status = "disabled"; 436 436 }; 437 437 438 + usbmisc: usbmisc@44064200 { 439 + #index-cells = <1>; 440 + compatible = "nxp,s32g3-usbmisc"; 441 + reg = <0x44064200 0x200>; 442 + }; 443 + 444 + usbotg: usb@44064000 { 445 + compatible = "nxp,s32g3-usb", "nxp,s32g2-usb"; 446 + reg = <0x44064000 0x200>; 447 + interrupt-parent = <&gic>; 448 + interrupts = <GIC_SPI 211 IRQ_TYPE_LEVEL_HIGH>, /* OTG Core */ 449 + <GIC_SPI 212 IRQ_TYPE_LEVEL_HIGH>; /* OTG Wakeup */ 450 + clocks = <&clks 94>, <&clks 95>; 451 + fsl,usbmisc = <&usbmisc 0>; 452 + ahb-burst-config = <0x3>; 453 + tx-burst-size-dword = <0x10>; 454 + rx-burst-size-dword = <0x10>; 455 + phy_type = "ulpi"; 456 + dr_mode = "host"; 457 + maximum-speed = "high-speed"; 458 + status = "disabled"; 459 + }; 460 + 438 461 i2c0: i2c@401e4000 { 439 462 compatible = "nxp,s32g3-i2c", 440 463 "nxp,s32g2-i2c";
-4
drivers/media/usb/stk1160/stk1160-v4l.c
··· 232 232 233 233 /* submit urbs and enables IRQ */ 234 234 for (i = 0; i < dev->isoc_ctl.num_bufs; i++) { 235 - struct stk1160_urb *stk_urb = &dev->isoc_ctl.urb_ctl[i]; 236 - 237 - dma_sync_sgtable_for_device(stk1160_get_dmadev(dev), stk_urb->sgt, 238 - DMA_FROM_DEVICE); 239 235 rc = usb_submit_urb(dev->isoc_ctl.urb_ctl[i].urb, GFP_KERNEL); 240 236 if (rc) { 241 237 stk1160_err("cannot submit urb[%d] (%d)\n", i, rc);
+11 -32
drivers/media/usb/stk1160/stk1160-video.c
··· 298 298 static void stk1160_isoc_irq(struct urb *urb) 299 299 { 300 300 int i, rc; 301 - struct stk1160_urb *stk_urb = urb->context; 302 - struct stk1160 *dev = stk_urb->dev; 303 - struct device *dma_dev = stk1160_get_dmadev(dev); 301 + struct stk1160 *dev = urb->context; 304 302 305 303 switch (urb->status) { 306 304 case 0: ··· 313 315 return; 314 316 } 315 317 316 - invalidate_kernel_vmap_range(stk_urb->transfer_buffer, 317 - urb->transfer_buffer_length); 318 - dma_sync_sgtable_for_cpu(dma_dev, stk_urb->sgt, DMA_FROM_DEVICE); 319 - 320 318 stk1160_process_isoc(dev, urb); 321 319 322 320 /* Reset urb buffers */ ··· 321 327 urb->iso_frame_desc[i].actual_length = 0; 322 328 } 323 329 324 - dma_sync_sgtable_for_device(dma_dev, stk_urb->sgt, DMA_FROM_DEVICE); 325 330 rc = usb_submit_urb(urb, GFP_ATOMIC); 326 331 if (rc) 327 332 stk1160_err("urb re-submit failed (%d)\n", rc); ··· 358 365 359 366 static void stk_free_urb(struct stk1160 *dev, struct stk1160_urb *stk_urb) 360 367 { 361 - struct device *dma_dev = stk1160_get_dmadev(dev); 362 - 363 - dma_vunmap_noncontiguous(dma_dev, stk_urb->transfer_buffer); 364 - dma_free_noncontiguous(dma_dev, stk_urb->urb->transfer_buffer_length, 365 - stk_urb->sgt, DMA_FROM_DEVICE); 368 + usb_free_noncoherent(dev->udev, stk_urb->urb->transfer_buffer_length, 369 + stk_urb->transfer_buffer, DMA_FROM_DEVICE, 370 + stk_urb->sgt); 366 371 usb_free_urb(stk_urb->urb); 367 372 368 373 stk_urb->transfer_buffer = NULL; ··· 401 410 static int stk1160_fill_urb(struct stk1160 *dev, struct stk1160_urb *stk_urb, 402 411 int sb_size, int max_packets) 403 412 { 404 - struct device *dma_dev = stk1160_get_dmadev(dev); 405 - 406 413 stk_urb->urb = usb_alloc_urb(max_packets, GFP_KERNEL); 407 414 if (!stk_urb->urb) 408 415 return -ENOMEM; 409 - stk_urb->sgt = dma_alloc_noncontiguous(dma_dev, sb_size, 410 - DMA_FROM_DEVICE, GFP_KERNEL, 0); 411 416 412 - /* 413 - * If the buffer allocation failed, we exit but return 0 since 414 - * we allow the driver working with less buffers 415 - */ 416 - if (!stk_urb->sgt) 417 + stk_urb->transfer_buffer = usb_alloc_noncoherent(dev->udev, sb_size, 418 + GFP_KERNEL, &stk_urb->dma, 419 + DMA_FROM_DEVICE, &stk_urb->sgt); 420 + if (!stk_urb->transfer_buffer) 417 421 goto free_urb; 418 422 419 - stk_urb->transfer_buffer = dma_vmap_noncontiguous(dma_dev, sb_size, 420 - stk_urb->sgt); 421 - if (!stk_urb->transfer_buffer) 422 - goto free_sgt; 423 - 424 - stk_urb->dma = stk_urb->sgt->sgl->dma_address; 425 423 stk_urb->dev = dev; 426 424 return 0; 427 - free_sgt: 428 - dma_free_noncontiguous(dma_dev, sb_size, stk_urb->sgt, DMA_FROM_DEVICE); 429 - stk_urb->sgt = NULL; 425 + 430 426 free_urb: 431 427 usb_free_urb(stk_urb->urb); 432 428 stk_urb->urb = NULL; ··· 472 494 urb->transfer_buffer = dev->isoc_ctl.urb_ctl[i].transfer_buffer; 473 495 urb->transfer_buffer_length = sb_size; 474 496 urb->complete = stk1160_isoc_irq; 475 - urb->context = &dev->isoc_ctl.urb_ctl[i]; 497 + urb->context = dev; 476 498 urb->interval = 1; 477 499 urb->start_frame = 0; 478 500 urb->number_of_packets = max_packets; 479 501 urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; 480 502 urb->transfer_dma = dev->isoc_ctl.urb_ctl[i].dma; 503 + urb->sgt = dev->isoc_ctl.urb_ctl[i].sgt; 481 504 482 505 k = 0; 483 506 for (j = 0; j < max_packets; j++) {
-7
drivers/media/usb/stk1160/stk1160.h
··· 16 16 #include <media/videobuf2-v4l2.h> 17 17 #include <media/v4l2-device.h> 18 18 #include <media/v4l2-ctrls.h> 19 - #include <linux/usb.h> 20 - #include <linux/usb/hcd.h> 21 19 22 20 #define STK1160_VERSION "0.9.5" 23 21 #define STK1160_VERSION_NUM 0x000905 ··· 193 195 194 196 /* Provided by stk1160-ac97.c */ 195 197 void stk1160_ac97_setup(struct stk1160 *dev); 196 - 197 - static inline struct device *stk1160_get_dmadev(struct stk1160 *dev) 198 - { 199 - return bus_to_hcd(dev->udev->bus)->self.sysdev; 200 - }
+14 -47
drivers/media/usb/uvc/uvc_video.c
··· 1275 1275 return DMA_TO_DEVICE; 1276 1276 } 1277 1277 1278 - static inline struct device *uvc_stream_to_dmadev(struct uvc_streaming *stream) 1279 - { 1280 - return bus_to_hcd(stream->dev->udev->bus)->self.sysdev; 1281 - } 1282 - 1283 - static int uvc_submit_urb(struct uvc_urb *uvc_urb, gfp_t mem_flags) 1284 - { 1285 - /* Sync DMA. */ 1286 - dma_sync_sgtable_for_device(uvc_stream_to_dmadev(uvc_urb->stream), 1287 - uvc_urb->sgt, 1288 - uvc_stream_dir(uvc_urb->stream)); 1289 - return usb_submit_urb(uvc_urb->urb, mem_flags); 1290 - } 1291 - 1292 1278 /* 1293 1279 * uvc_video_decode_data_work: Asynchronous memcpy processing 1294 1280 * ··· 1296 1310 uvc_queue_buffer_release(op->buf); 1297 1311 } 1298 1312 1299 - ret = uvc_submit_urb(uvc_urb, GFP_KERNEL); 1313 + ret = usb_submit_urb(uvc_urb->urb, GFP_KERNEL); 1300 1314 if (ret < 0) 1301 1315 dev_err(&uvc_urb->stream->intf->dev, 1302 1316 "Failed to resubmit video URB (%d).\n", ret); ··· 1722 1736 /* Re-initialise the URB async work. */ 1723 1737 uvc_urb->async_operations = 0; 1724 1738 1725 - /* Sync DMA and invalidate vmap range. */ 1726 - dma_sync_sgtable_for_cpu(uvc_stream_to_dmadev(uvc_urb->stream), 1727 - uvc_urb->sgt, uvc_stream_dir(stream)); 1728 - invalidate_kernel_vmap_range(uvc_urb->buffer, 1729 - uvc_urb->stream->urb_size); 1730 - 1731 1739 /* 1732 1740 * Process the URB headers, and optionally queue expensive memcpy tasks 1733 1741 * to be deferred to a work queue. ··· 1730 1750 1731 1751 /* If no async work is needed, resubmit the URB immediately. */ 1732 1752 if (!uvc_urb->async_operations) { 1733 - ret = uvc_submit_urb(uvc_urb, GFP_ATOMIC); 1753 + ret = usb_submit_urb(uvc_urb->urb, GFP_ATOMIC); 1734 1754 if (ret < 0) 1735 1755 dev_err(&stream->intf->dev, 1736 1756 "Failed to resubmit video URB (%d).\n", ret); ··· 1745 1765 */ 1746 1766 static void uvc_free_urb_buffers(struct uvc_streaming *stream) 1747 1767 { 1748 - struct device *dma_dev = uvc_stream_to_dmadev(stream); 1768 + struct usb_device *udev = stream->dev->udev; 1749 1769 struct uvc_urb *uvc_urb; 1750 1770 1751 1771 for_each_uvc_urb(uvc_urb, stream) { 1752 1772 if (!uvc_urb->buffer) 1753 1773 continue; 1754 1774 1755 - dma_vunmap_noncontiguous(dma_dev, uvc_urb->buffer); 1756 - dma_free_noncontiguous(dma_dev, stream->urb_size, uvc_urb->sgt, 1757 - uvc_stream_dir(stream)); 1758 - 1775 + usb_free_noncoherent(udev, stream->urb_size, uvc_urb->buffer, 1776 + uvc_stream_dir(stream), uvc_urb->sgt); 1759 1777 uvc_urb->buffer = NULL; 1760 1778 uvc_urb->sgt = NULL; 1761 1779 } ··· 1764 1786 static bool uvc_alloc_urb_buffer(struct uvc_streaming *stream, 1765 1787 struct uvc_urb *uvc_urb, gfp_t gfp_flags) 1766 1788 { 1767 - struct device *dma_dev = uvc_stream_to_dmadev(stream); 1789 + struct usb_device *udev = stream->dev->udev; 1768 1790 1769 - uvc_urb->sgt = dma_alloc_noncontiguous(dma_dev, stream->urb_size, 1770 - uvc_stream_dir(stream), 1771 - gfp_flags, 0); 1772 - if (!uvc_urb->sgt) 1773 - return false; 1774 - uvc_urb->dma = uvc_urb->sgt->sgl->dma_address; 1775 - 1776 - uvc_urb->buffer = dma_vmap_noncontiguous(dma_dev, stream->urb_size, 1777 - uvc_urb->sgt); 1778 - if (!uvc_urb->buffer) { 1779 - dma_free_noncontiguous(dma_dev, stream->urb_size, 1780 - uvc_urb->sgt, 1781 - uvc_stream_dir(stream)); 1782 - uvc_urb->sgt = NULL; 1783 - return false; 1784 - } 1785 - 1786 - return true; 1791 + uvc_urb->buffer = usb_alloc_noncoherent(udev, stream->urb_size, 1792 + gfp_flags, &uvc_urb->dma, 1793 + uvc_stream_dir(stream), 1794 + &uvc_urb->sgt); 1795 + return !!uvc_urb->buffer; 1787 1796 } 1788 1797 1789 1798 /* ··· 1918 1953 urb->complete = uvc_video_complete; 1919 1954 urb->number_of_packets = npackets; 1920 1955 urb->transfer_buffer_length = size; 1956 + urb->sgt = uvc_urb->sgt; 1921 1957 1922 1958 for (i = 0; i < npackets; ++i) { 1923 1959 urb->iso_frame_desc[i].offset = i * psize; ··· 1975 2009 size, uvc_video_complete, uvc_urb); 1976 2010 urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; 1977 2011 urb->transfer_dma = uvc_urb->dma; 2012 + urb->sgt = uvc_urb->sgt; 1978 2013 1979 2014 uvc_urb->urb = urb; 1980 2015 } ··· 2087 2120 2088 2121 /* Submit the URBs. */ 2089 2122 for_each_uvc_urb(uvc_urb, stream) { 2090 - ret = uvc_submit_urb(uvc_urb, gfp_flags); 2123 + ret = usb_submit_urb(uvc_urb->urb, gfp_flags); 2091 2124 if (ret < 0) { 2092 2125 dev_err(&stream->intf->dev, 2093 2126 "Failed to submit URB %u (%d).\n",
+1 -1
drivers/thunderbolt/domain.c
··· 36 36 return false; 37 37 } 38 38 39 - if (id->match_flags & TBSVC_MATCH_PROTOCOL_VERSION) { 39 + if (id->match_flags & TBSVC_MATCH_PROTOCOL_REVISION) { 40 40 if (id->protocol_revision != svc->prtcrevs) 41 41 return false; 42 42 }
+1 -1
drivers/thunderbolt/nvm.c
··· 588 588 * @size: Size of the buffer in bytes 589 589 * @retries: Number of retries if the block write fails 590 590 * @write_block: Function that writes block to the flash 591 - * @write_block_data: Data passwd to @write_block 591 + * @write_block_data: Data passed to @write_block 592 592 * 593 593 * This is generic function that writes data to NVM or NVM like device. 594 594 *
+1 -1
drivers/thunderbolt/switch.c
··· 3069 3069 * @width: The new link width 3070 3070 * 3071 3071 * Set device router link width to @width from router upstream port 3072 - * perspective. Supports also asymmetric links if the routers boths side 3072 + * perspective. Supports also asymmetric links if the routers both side 3073 3073 * of the link supports it. 3074 3074 * 3075 3075 * Does nothing for host router.
+82 -90
drivers/usb/atm/cxacru.c
··· 980 980 return ret; 981 981 } 982 982 983 - static void cxacru_upload_firmware(struct cxacru_data *instance, 984 - const struct firmware *fw, 985 - const struct firmware *bp) 986 - { 987 - int ret; 988 - struct usbatm_data *usbatm = instance->usbatm; 989 - struct usb_device *usb_dev = usbatm->usb_dev; 990 - __le16 signature[] = { usb_dev->descriptor.idVendor, 991 - usb_dev->descriptor.idProduct }; 992 - __le32 val; 993 - 994 - usb_dbg(usbatm, "%s\n", __func__); 995 - 996 - /* FirmwarePllFClkValue */ 997 - val = cpu_to_le32(instance->modem_type->pll_f_clk); 998 - ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, PLLFCLK_ADDR, (u8 *) &val, 4); 999 - if (ret) { 1000 - usb_err(usbatm, "FirmwarePllFClkValue failed: %d\n", ret); 1001 - return; 1002 - } 1003 - 1004 - /* FirmwarePllBClkValue */ 1005 - val = cpu_to_le32(instance->modem_type->pll_b_clk); 1006 - ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, PLLBCLK_ADDR, (u8 *) &val, 4); 1007 - if (ret) { 1008 - usb_err(usbatm, "FirmwarePllBClkValue failed: %d\n", ret); 1009 - return; 1010 - } 1011 - 1012 - /* Enable SDRAM */ 1013 - val = cpu_to_le32(SDRAM_ENA); 1014 - ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, SDRAMEN_ADDR, (u8 *) &val, 4); 1015 - if (ret) { 1016 - usb_err(usbatm, "Enable SDRAM failed: %d\n", ret); 1017 - return; 1018 - } 1019 - 1020 - /* Firmware */ 1021 - usb_info(usbatm, "loading firmware\n"); 1022 - ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, FW_ADDR, fw->data, fw->size); 1023 - if (ret) { 1024 - usb_err(usbatm, "Firmware upload failed: %d\n", ret); 1025 - return; 1026 - } 1027 - 1028 - /* Boot ROM patch */ 1029 - if (instance->modem_type->boot_rom_patch) { 1030 - usb_info(usbatm, "loading boot ROM patch\n"); 1031 - ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, BR_ADDR, bp->data, bp->size); 1032 - if (ret) { 1033 - usb_err(usbatm, "Boot ROM patching failed: %d\n", ret); 1034 - return; 1035 - } 1036 - } 1037 - 1038 - /* Signature */ 1039 - ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, SIG_ADDR, (u8 *) signature, 4); 1040 - if (ret) { 1041 - usb_err(usbatm, "Signature storing failed: %d\n", ret); 1042 - return; 1043 - } 1044 - 1045 - usb_info(usbatm, "starting device\n"); 1046 - if (instance->modem_type->boot_rom_patch) { 1047 - val = cpu_to_le32(BR_ADDR); 1048 - ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, BR_STACK_ADDR, (u8 *) &val, 4); 1049 - } else { 1050 - ret = cxacru_fw(usb_dev, FW_GOTO_MEM, 0x0, 0x0, FW_ADDR, NULL, 0); 1051 - } 1052 - if (ret) { 1053 - usb_err(usbatm, "Passing control to firmware failed: %d\n", ret); 1054 - return; 1055 - } 1056 - 1057 - /* Delay to allow firmware to start up. */ 1058 - msleep_interruptible(1000); 1059 - 1060 - usb_clear_halt(usb_dev, usb_sndbulkpipe(usb_dev, CXACRU_EP_CMD)); 1061 - usb_clear_halt(usb_dev, usb_rcvbulkpipe(usb_dev, CXACRU_EP_CMD)); 1062 - usb_clear_halt(usb_dev, usb_sndbulkpipe(usb_dev, CXACRU_EP_DATA)); 1063 - usb_clear_halt(usb_dev, usb_rcvbulkpipe(usb_dev, CXACRU_EP_DATA)); 1064 - 1065 - ret = cxacru_cm(instance, CM_REQUEST_CARD_GET_STATUS, NULL, 0, NULL, 0); 1066 - if (ret < 0) { 1067 - usb_err(usbatm, "modem failed to initialize: %d\n", ret); 1068 - return; 1069 - } 1070 - } 1071 983 1072 984 static int cxacru_find_firmware(struct cxacru_data *instance, 1073 985 char *phase, const struct firmware **fw_p) ··· 1006 1094 { 1007 1095 const struct firmware *fw, *bp; 1008 1096 struct cxacru_data *instance = usbatm_instance->driver_data; 1009 - int ret = cxacru_find_firmware(instance, "fw", &fw); 1097 + struct usbatm_data *usbatm = instance->usbatm; 1098 + struct usb_device *usb_dev = usbatm->usb_dev; 1099 + __le16 signature[] = { usb_dev->descriptor.idVendor, 1100 + usb_dev->descriptor.idProduct }; 1101 + __le32 val; 1102 + int ret; 1010 1103 1104 + ret = cxacru_find_firmware(instance, "fw", &fw); 1011 1105 if (ret) { 1012 1106 usb_warn(usbatm_instance, "firmware (cxacru-fw.bin) unavailable (system misconfigured?)\n"); 1013 1107 return ret; ··· 1028 1110 } 1029 1111 } 1030 1112 1031 - cxacru_upload_firmware(instance, fw, bp); 1113 + /* FirmwarePllFClkValue */ 1114 + val = cpu_to_le32(instance->modem_type->pll_f_clk); 1115 + ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, PLLFCLK_ADDR, (u8 *) &val, 4); 1116 + if (ret) { 1117 + usb_err(usbatm, "FirmwarePllFClkValue failed: %d\n", ret); 1118 + goto done; 1119 + } 1032 1120 1121 + /* FirmwarePllBClkValue */ 1122 + val = cpu_to_le32(instance->modem_type->pll_b_clk); 1123 + ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, PLLBCLK_ADDR, (u8 *) &val, 4); 1124 + if (ret) { 1125 + usb_err(usbatm, "FirmwarePllBClkValue failed: %d\n", ret); 1126 + goto done; 1127 + } 1128 + 1129 + /* Enable SDRAM */ 1130 + val = cpu_to_le32(SDRAM_ENA); 1131 + ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, SDRAMEN_ADDR, (u8 *) &val, 4); 1132 + if (ret) { 1133 + usb_err(usbatm, "Enable SDRAM failed: %d\n", ret); 1134 + goto done; 1135 + } 1136 + 1137 + /* Firmware */ 1138 + usb_info(usbatm, "loading firmware\n"); 1139 + ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, FW_ADDR, fw->data, fw->size); 1140 + if (ret) { 1141 + usb_err(usbatm, "Firmware upload failed: %d\n", ret); 1142 + goto done; 1143 + } 1144 + 1145 + /* Boot ROM patch */ 1146 + if (instance->modem_type->boot_rom_patch) { 1147 + usb_info(usbatm, "loading boot ROM patch\n"); 1148 + ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, BR_ADDR, bp->data, bp->size); 1149 + if (ret) { 1150 + usb_err(usbatm, "Boot ROM patching failed: %d\n", ret); 1151 + goto done; 1152 + } 1153 + } 1154 + 1155 + /* Signature */ 1156 + ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, SIG_ADDR, (u8 *) signature, 4); 1157 + if (ret) { 1158 + usb_err(usbatm, "Signature storing failed: %d\n", ret); 1159 + goto done; 1160 + } 1161 + 1162 + usb_info(usbatm, "starting device\n"); 1163 + if (instance->modem_type->boot_rom_patch) { 1164 + val = cpu_to_le32(BR_ADDR); 1165 + ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, BR_STACK_ADDR, (u8 *) &val, 4); 1166 + } else { 1167 + ret = cxacru_fw(usb_dev, FW_GOTO_MEM, 0x0, 0x0, FW_ADDR, NULL, 0); 1168 + } 1169 + if (ret) { 1170 + usb_err(usbatm, "Passing control to firmware failed: %d\n", ret); 1171 + goto done; 1172 + } 1173 + 1174 + /* Delay to allow firmware to start up. */ 1175 + msleep_interruptible(1000); 1176 + 1177 + usb_clear_halt(usb_dev, usb_sndbulkpipe(usb_dev, CXACRU_EP_CMD)); 1178 + usb_clear_halt(usb_dev, usb_rcvbulkpipe(usb_dev, CXACRU_EP_CMD)); 1179 + usb_clear_halt(usb_dev, usb_sndbulkpipe(usb_dev, CXACRU_EP_DATA)); 1180 + usb_clear_halt(usb_dev, usb_rcvbulkpipe(usb_dev, CXACRU_EP_DATA)); 1181 + 1182 + ret = cxacru_cm(instance, CM_REQUEST_CARD_GET_STATUS, NULL, 0, NULL, 0); 1183 + if (ret < 0) { 1184 + usb_err(usbatm, "modem failed to initialize: %d\n", ret); 1185 + goto done; 1186 + } 1187 + 1188 + done: 1033 1189 if (instance->modem_type->boot_rom_patch) 1034 1190 release_firmware(bp); 1035 1191 release_firmware(fw);
+11
drivers/usb/chipidea/ci_hdrc_imx.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0+ 2 2 /* 3 3 * Copyright 2012 Freescale Semiconductor, Inc. 4 + * Copyright 2025 NXP 4 5 * Copyright (C) 2012 Marek Vasut <marex@denx.de> 5 6 * on behalf of DENX Software Engineering GmbH 6 7 */ ··· 79 78 CI_HDRC_HAS_PORTSC_PEC_MISSED, 80 79 }; 81 80 81 + static const struct ci_hdrc_imx_platform_flag s32g_usb_data = { 82 + .flags = CI_HDRC_DISABLE_HOST_STREAMING, 83 + }; 84 + 82 85 static const struct of_device_id ci_hdrc_imx_dt_ids[] = { 83 86 { .compatible = "fsl,imx23-usb", .data = &imx23_usb_data}, 84 87 { .compatible = "fsl,imx28-usb", .data = &imx28_usb_data}, ··· 94 89 { .compatible = "fsl,imx7d-usb", .data = &imx7d_usb_data}, 95 90 { .compatible = "fsl,imx7ulp-usb", .data = &imx7ulp_usb_data}, 96 91 { .compatible = "fsl,imx8ulp-usb", .data = &imx8ulp_usb_data}, 92 + { .compatible = "nxp,s32g2-usb", .data = &s32g_usb_data}, 97 93 { /* sentinel */ } 98 94 }; 99 95 MODULE_DEVICE_TABLE(of, ci_hdrc_imx_dt_ids); ··· 336 330 ret = imx_usbmisc_charger_detection(mdata, false); 337 331 if (ci->usb_phy) 338 332 schedule_work(&ci->usb_phy->chg_work); 333 + break; 334 + case CI_HDRC_CONTROLLER_PULLUP_EVENT: 335 + if (ci->role == CI_ROLE_GADGET) 336 + imx_usbmisc_pullup(data->usbmisc_data, 337 + ci->gadget.connected); 339 338 break; 340 339 default: 341 340 break;
+1
drivers/usb/chipidea/ci_hdrc_imx.h
··· 37 37 int imx_usbmisc_charger_detection(struct imx_usbmisc_data *data, bool connect); 38 38 int imx_usbmisc_suspend(struct imx_usbmisc_data *data, bool wakeup); 39 39 int imx_usbmisc_resume(struct imx_usbmisc_data *data, bool wakeup); 40 + int imx_usbmisc_pullup(struct imx_usbmisc_data *data, bool on); 40 41 41 42 #endif /* __DRIVER_USB_CHIPIDEA_CI_HDRC_IMX_H */
+5
drivers/usb/chipidea/udc.c
··· 1970 1970 hw_write(ci, OP_USBCMD, USBCMD_RS, USBCMD_RS); 1971 1971 else 1972 1972 hw_write(ci, OP_USBCMD, USBCMD_RS, 0); 1973 + 1974 + if (ci->platdata->notify_event) { 1975 + _gadget->connected = is_on; 1976 + ci->platdata->notify_event(ci, CI_HDRC_CONTROLLER_PULLUP_EVENT); 1977 + } 1973 1978 pm_runtime_put_sync(ci->dev); 1974 1979 1975 1980 return 0;
+128
drivers/usb/chipidea/usbmisc_imx.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0+ 2 2 /* 3 3 * Copyright 2012 Freescale Semiconductor, Inc. 4 + * Copyright 2025 NXP 4 5 */ 5 6 6 7 #include <linux/module.h> ··· 156 155 BLKCTL_OTG_VBUS_WAKEUP_EN | \ 157 156 BLKCTL_OTG_DPDM_WAKEUP_EN) 158 157 158 + #define S32G_WAKEUP_IE BIT(0) 159 + #define S32G_CORE_IE BIT(1) 160 + #define S32G_PWRFLTEN BIT(7) 161 + #define S32G_WAKEUPCTRL BIT(10) 162 + #define S32G_WAKEUPEN BIT(11) 163 + 164 + /* Workaround errata ERR050474 (handle packages that aren't 4 byte aligned) */ 165 + #define S32G_UCMALLBE BIT(15) 166 + 167 + #define S32G_WAKEUP_BITS (S32G_WAKEUP_IE | S32G_CORE_IE | S32G_WAKEUPEN | \ 168 + S32G_WAKEUPCTRL) 169 + 159 170 struct usbmisc_ops { 160 171 /* It's called once when probe a usb device */ 161 172 int (*init)(struct imx_usbmisc_data *data); ··· 183 170 int (*charger_detection)(struct imx_usbmisc_data *data); 184 171 /* It's called when system resume from usb power lost */ 185 172 int (*power_lost_check)(struct imx_usbmisc_data *data); 173 + /* It's called when device controller changed pullup status */ 174 + void (*pullup)(struct imx_usbmisc_data *data, bool on); 175 + /* It's called during suspend/resume to save power */ 186 176 void (*vbus_comparator_on)(struct imx_usbmisc_data *data, bool on); 187 177 }; 188 178 ··· 630 614 return 0; 631 615 } 632 616 617 + static int usbmisc_s32g_set_wakeup(struct imx_usbmisc_data *data, bool enabled) 618 + { 619 + struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); 620 + unsigned long flags; 621 + u32 reg; 622 + 623 + spin_lock_irqsave(&usbmisc->lock, flags); 624 + 625 + reg = readl(usbmisc->base); 626 + if (enabled) 627 + reg |= S32G_WAKEUP_BITS; 628 + else 629 + reg &= ~S32G_WAKEUP_BITS; 630 + 631 + writel(reg, usbmisc->base); 632 + spin_unlock_irqrestore(&usbmisc->lock, flags); 633 + 634 + return 0; 635 + } 636 + 637 + static int usbmisc_s32g_init(struct imx_usbmisc_data *data, u32 extra_flags) 638 + { 639 + struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); 640 + unsigned long flags; 641 + u32 reg; 642 + 643 + spin_lock_irqsave(&usbmisc->lock, flags); 644 + 645 + reg = readl(usbmisc->base); 646 + 647 + reg |= S32G_PWRFLTEN; 648 + reg |= extra_flags; 649 + 650 + writel(reg, usbmisc->base); 651 + 652 + spin_unlock_irqrestore(&usbmisc->lock, flags); 653 + usbmisc_s32g_set_wakeup(data, false); 654 + 655 + return 0; 656 + } 657 + 658 + static int usbmisc_s32g2_init(struct imx_usbmisc_data *data) 659 + { 660 + return usbmisc_s32g_init(data, S32G_UCMALLBE); 661 + } 662 + 663 + static int usbmisc_s32g3_init(struct imx_usbmisc_data *data) 664 + { 665 + return usbmisc_s32g_init(data, 0); 666 + } 667 + 633 668 static int usbmisc_imx7d_set_wakeup 634 669 (struct imx_usbmisc_data *data, bool enabled) 635 670 { ··· 1062 995 return 0; 1063 996 } 1064 997 998 + static void usbmisc_imx7d_pullup(struct imx_usbmisc_data *data, bool on) 999 + { 1000 + struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); 1001 + unsigned long flags; 1002 + u32 val; 1003 + 1004 + spin_lock_irqsave(&usbmisc->lock, flags); 1005 + val = readl(usbmisc->base + MX7D_USBNC_USB_CTRL2); 1006 + if (!on) { 1007 + val &= ~MX7D_USBNC_USB_CTRL2_OPMODE_OVERRIDE_MASK; 1008 + val |= MX7D_USBNC_USB_CTRL2_OPMODE(1); 1009 + val |= MX7D_USBNC_USB_CTRL2_OPMODE_OVERRIDE_EN; 1010 + } else { 1011 + val &= ~MX7D_USBNC_USB_CTRL2_OPMODE_OVERRIDE_EN; 1012 + } 1013 + writel(val, usbmisc->base + MX7D_USBNC_USB_CTRL2); 1014 + spin_unlock_irqrestore(&usbmisc->lock, flags); 1015 + } 1016 + 1065 1017 static int usbmisc_imx7d_power_lost_check(struct imx_usbmisc_data *data) 1066 1018 { 1067 1019 struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); ··· 1117 1031 return 1; 1118 1032 else 1119 1033 return 0; 1034 + } 1035 + 1036 + static int usbmisc_s32g_power_lost_check(struct imx_usbmisc_data *data) 1037 + { 1038 + return 1; 1120 1039 } 1121 1040 1122 1041 static u32 usbmisc_blkctl_wakeup_setting(struct imx_usbmisc_data *data) ··· 1203 1112 .set_wakeup = usbmisc_imx7d_set_wakeup, 1204 1113 .charger_detection = imx7d_charger_detection, 1205 1114 .power_lost_check = usbmisc_imx7d_power_lost_check, 1115 + .pullup = usbmisc_imx7d_pullup, 1206 1116 .vbus_comparator_on = usbmisc_imx7d_vbus_comparator_on, 1207 1117 }; 1208 1118 ··· 1220 1128 .set_wakeup = usbmisc_imx95_set_wakeup, 1221 1129 .charger_detection = imx7d_charger_detection, 1222 1130 .power_lost_check = usbmisc_imx7d_power_lost_check, 1131 + .pullup = usbmisc_imx7d_pullup, 1223 1132 .vbus_comparator_on = usbmisc_imx7d_vbus_comparator_on, 1133 + }; 1134 + 1135 + static const struct usbmisc_ops s32g2_usbmisc_ops = { 1136 + .init = usbmisc_s32g2_init, 1137 + .set_wakeup = usbmisc_s32g_set_wakeup, 1138 + .power_lost_check = usbmisc_s32g_power_lost_check, 1139 + }; 1140 + 1141 + static const struct usbmisc_ops s32g3_usbmisc_ops = { 1142 + .init = usbmisc_s32g3_init, 1143 + .set_wakeup = usbmisc_s32g_set_wakeup, 1144 + .power_lost_check = usbmisc_s32g_power_lost_check, 1224 1145 }; 1225 1146 1226 1147 static inline bool is_imx53_usbmisc(struct imx_usbmisc_data *data) ··· 1329 1224 return ret; 1330 1225 } 1331 1226 EXPORT_SYMBOL_GPL(imx_usbmisc_charger_detection); 1227 + 1228 + int imx_usbmisc_pullup(struct imx_usbmisc_data *data, bool on) 1229 + { 1230 + struct imx_usbmisc *usbmisc; 1231 + 1232 + if (!data) 1233 + return 0; 1234 + 1235 + usbmisc = dev_get_drvdata(data->dev); 1236 + if (usbmisc->ops->pullup) 1237 + usbmisc->ops->pullup(data, on); 1238 + 1239 + return 0; 1240 + } 1241 + EXPORT_SYMBOL_GPL(imx_usbmisc_pullup); 1332 1242 1333 1243 int imx_usbmisc_suspend(struct imx_usbmisc_data *data, bool wakeup) 1334 1244 { ··· 1475 1355 { 1476 1356 .compatible = "fsl,imx95-usbmisc", 1477 1357 .data = &imx95_usbmisc_ops, 1358 + }, 1359 + { 1360 + .compatible = "nxp,s32g2-usbmisc", 1361 + .data = &s32g2_usbmisc_ops, 1362 + }, 1363 + { 1364 + .compatible = "nxp,s32g3-usbmisc", 1365 + .data = &s32g3_usbmisc_ops, 1478 1366 }, 1479 1367 { /* sentinel */ } 1480 1368 };
+6 -5
drivers/usb/class/cdc-acm.c
··· 1520 1520 goto err_remove_files; 1521 1521 } 1522 1522 1523 + if (quirks & CLEAR_HALT_CONDITIONS) { 1524 + /* errors intentionally ignored */ 1525 + usb_clear_halt(usb_dev, acm->in); 1526 + usb_clear_halt(usb_dev, acm->out); 1527 + } 1528 + 1523 1529 tty_dev = tty_port_register_device(&acm->port, acm_tty_driver, minor, 1524 1530 &control_interface->dev); 1525 1531 if (IS_ERR(tty_dev)) { 1526 1532 rv = PTR_ERR(tty_dev); 1527 1533 goto err_release_data_interface; 1528 - } 1529 - 1530 - if (quirks & CLEAR_HALT_CONDITIONS) { 1531 - usb_clear_halt(usb_dev, acm->in); 1532 - usb_clear_halt(usb_dev, acm->out); 1533 1534 } 1534 1535 1535 1536 dev_info(&intf->dev, "ttyACM%d: USB ACM device\n", minor);
+22 -11
drivers/usb/class/usblp.c
··· 366 366 int error; 367 367 368 368 mutex_lock(&usblp->mut); 369 - if ((error = usblp_read_status(usblp, usblp->statusbuf)) < 0) { 369 + error = usblp_read_status(usblp, usblp->statusbuf); 370 + if (error < 0) { 370 371 mutex_unlock(&usblp->mut); 371 372 printk_ratelimited(KERN_ERR 372 373 "usblp%d: error %d reading printer status\n", ··· 752 751 rv = -EINTR; 753 752 goto raise_biglock; 754 753 } 755 - if ((rv = usblp_wwait(usblp, !!(file->f_flags & O_NONBLOCK))) < 0) 754 + rv = usblp_wwait(usblp, !!(file->f_flags & O_NONBLOCK)); 755 + if (rv < 0) 756 756 goto raise_wait; 757 757 758 758 while (writecount < count) { 759 759 /* 760 760 * Step 1: Submit next block. 761 761 */ 762 - if ((transfer_length = count - writecount) > USBLP_BUF_SIZE) 762 + transfer_length = count - writecount; 763 + if (transfer_length > USBLP_BUF_SIZE) 763 764 transfer_length = USBLP_BUF_SIZE; 764 765 765 766 rv = -ENOMEM; ··· 779 776 spin_lock_irq(&usblp->lock); 780 777 usblp->wcomplete = 0; 781 778 spin_unlock_irq(&usblp->lock); 782 - if ((rv = usb_submit_urb(writeurb, GFP_KERNEL)) < 0) { 779 + 780 + rv = usb_submit_urb(writeurb, GFP_KERNEL); 781 + if (rv < 0) { 783 782 usblp->wstatus = 0; 784 783 spin_lock_irq(&usblp->lock); 785 784 usblp->no_paper = 0; ··· 862 857 goto done; 863 858 } 864 859 865 - if ((avail = usblp->rstatus) < 0) { 860 + avail = usblp->rstatus; 861 + if (avail < 0) { 866 862 printk(KERN_ERR "usblp%d: error %d reading from printer\n", 867 - usblp->minor, (int)avail); 863 + usblp->minor, (int)avail); 868 864 usblp_submit_read(usblp); 869 865 count = -EIO; 870 866 goto done; ··· 878 872 goto done; 879 873 } 880 874 881 - if ((usblp->readcount += count) == avail) { 875 + usblp->readcount += count; 876 + if (usblp->readcount == avail) { 882 877 if (usblp_submit_read(usblp) < 0) { 883 878 /* We don't want to leak USB return codes into errno. */ 884 879 if (count == 0) ··· 980 973 break; 981 974 } 982 975 set_current_state(TASK_INTERRUPTIBLE); 983 - if ((rc = usblp_rtest(usblp, nonblock)) < 0) { 976 + rc = usblp_rtest(usblp, nonblock); 977 + if (rc < 0) { 984 978 mutex_unlock(&usblp->mut); 985 979 break; 986 980 } ··· 1039 1031 usblp->readcount = 0; /* XXX Why here? */ 1040 1032 usblp->rcomplete = 0; 1041 1033 spin_unlock_irqrestore(&usblp->lock, flags); 1042 - if ((rc = usb_submit_urb(urb, GFP_KERNEL)) < 0) { 1034 + rc = usb_submit_urb(urb, GFP_KERNEL); 1035 + if (rc < 0) { 1043 1036 dev_dbg(&usblp->intf->dev, "error submitting urb (%d)\n", rc); 1044 1037 spin_lock_irqsave(&usblp->lock, flags); 1045 1038 usblp->rstatus = rc; ··· 1159 1150 /* Malloc device ID string buffer to the largest expected length, 1160 1151 * since we can re-query it on an ioctl and a dynamic string 1161 1152 * could change in length. */ 1162 - if (!(usblp->device_id_string = kmalloc(USBLP_DEVICE_ID_SIZE, GFP_KERNEL))) { 1153 + usblp->device_id_string = kmalloc(USBLP_DEVICE_ID_SIZE, GFP_KERNEL); 1154 + if (!usblp->device_id_string) { 1163 1155 retval = -ENOMEM; 1164 1156 goto abort; 1165 1157 } ··· 1170 1160 * malloc both regardless of bidirectionality, because the 1171 1161 * alternate setting can be changed later via an ioctl. 1172 1162 */ 1173 - if (!(usblp->readbuf = kmalloc(USBLP_BUF_SIZE_IN, GFP_KERNEL))) { 1163 + usblp->readbuf = kmalloc(USBLP_BUF_SIZE_IN, GFP_KERNEL); 1164 + if (!usblp->readbuf) { 1174 1165 retval = -ENOMEM; 1175 1166 goto abort; 1176 1167 }
+8 -2
drivers/usb/core/config.c
··· 107 107 */ 108 108 desc = (struct usb_ss_ep_comp_descriptor *) buffer; 109 109 110 - if (desc->bDescriptorType != USB_DT_SS_ENDPOINT_COMP || 111 - size < USB_DT_SS_EP_COMP_SIZE) { 110 + if (size < USB_DT_SS_EP_COMP_SIZE) { 111 + dev_notice(ddev, 112 + "invalid SuperSpeed endpoint companion descriptor " 113 + "of length %d, skipping\n", size); 114 + return; 115 + } 116 + 117 + if (desc->bDescriptorType != USB_DT_SS_ENDPOINT_COMP) { 112 118 dev_notice(ddev, "No SuperSpeed endpoint companion for config %d " 113 119 " interface %d altsetting %d ep %d: " 114 120 "using minimum values\n",
+2 -2
drivers/usb/core/driver.c
··· 119 119 guard(mutex)(&usb_dynids_lock); 120 120 list_for_each_entry(dynid, &dynids->list, node) 121 121 if (dynid->id.bInterfaceClass != 0) 122 - count += scnprintf(&buf[count], PAGE_SIZE - count, "%04x %04x %02x\n", 122 + count += sysfs_emit_at(&buf[count], count, "%04x %04x %02x\n", 123 123 dynid->id.idVendor, dynid->id.idProduct, 124 124 dynid->id.bInterfaceClass); 125 125 else 126 - count += scnprintf(&buf[count], PAGE_SIZE - count, "%04x %04x\n", 126 + count += sysfs_emit_at(&buf[count], count, "%04x %04x\n", 127 127 dynid->id.idVendor, dynid->id.idProduct); 128 128 return count; 129 129 }
+1 -1
drivers/usb/core/hcd-pci.c
··· 210 210 hcd->amd_resume_bug = usb_hcd_amd_resume_bug(dev, driver); 211 211 212 212 if (driver->flags & HCD_MEMORY) { 213 - /* EHCI, OHCI */ 213 + /* XHCI, EHCI, OHCI */ 214 214 hcd->rsrc_start = pci_resource_start(dev, 0); 215 215 hcd->rsrc_len = pci_resource_len(dev, 0); 216 216 if (!devm_request_mem_region(&dev->dev, hcd->rsrc_start,
+21 -8
drivers/usb/core/hcd.c
··· 1342 1342 1343 1343 dir = usb_urb_dir_in(urb) ? DMA_FROM_DEVICE : DMA_TO_DEVICE; 1344 1344 if (IS_ENABLED(CONFIG_HAS_DMA) && 1345 - (urb->transfer_flags & URB_DMA_MAP_SG)) 1345 + (urb->transfer_flags & URB_DMA_MAP_SG)) { 1346 1346 dma_unmap_sg(hcd->self.sysdev, 1347 1347 urb->sg, 1348 1348 urb->num_sgs, 1349 1349 dir); 1350 - else if (IS_ENABLED(CONFIG_HAS_DMA) && 1351 - (urb->transfer_flags & URB_DMA_MAP_PAGE)) 1350 + } else if (IS_ENABLED(CONFIG_HAS_DMA) && 1351 + (urb->transfer_flags & URB_DMA_MAP_PAGE)) { 1352 1352 dma_unmap_page(hcd->self.sysdev, 1353 1353 urb->transfer_dma, 1354 1354 urb->transfer_buffer_length, 1355 1355 dir); 1356 - else if (IS_ENABLED(CONFIG_HAS_DMA) && 1357 - (urb->transfer_flags & URB_DMA_MAP_SINGLE)) 1356 + } else if (IS_ENABLED(CONFIG_HAS_DMA) && 1357 + (urb->transfer_flags & URB_DMA_MAP_SINGLE)) { 1358 1358 dma_unmap_single(hcd->self.sysdev, 1359 1359 urb->transfer_dma, 1360 1360 urb->transfer_buffer_length, 1361 1361 dir); 1362 - else if (urb->transfer_flags & URB_MAP_LOCAL) 1362 + } else if (urb->transfer_flags & URB_MAP_LOCAL) { 1363 1363 hcd_free_coherent(urb->dev->bus, 1364 1364 &urb->transfer_dma, 1365 1365 &urb->transfer_buffer, 1366 1366 urb->transfer_buffer_length, 1367 1367 dir); 1368 + } else if ((urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP) && urb->sgt) { 1369 + dma_sync_sgtable_for_cpu(hcd->self.sysdev, urb->sgt, dir); 1370 + if (dir == DMA_FROM_DEVICE) 1371 + invalidate_kernel_vmap_range(urb->transfer_buffer, 1372 + urb->transfer_buffer_length); 1373 + } 1368 1374 1369 1375 /* Make it safe to call this routine more than once */ 1370 1376 urb->transfer_flags &= ~(URB_DMA_MAP_SG | URB_DMA_MAP_PAGE | ··· 1431 1425 } 1432 1426 1433 1427 dir = usb_urb_dir_in(urb) ? DMA_FROM_DEVICE : DMA_TO_DEVICE; 1434 - if (urb->transfer_buffer_length != 0 1435 - && !(urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP)) { 1428 + if (urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP) { 1429 + if (!urb->sgt) 1430 + return 0; 1431 + 1432 + if (dir == DMA_TO_DEVICE) 1433 + flush_kernel_vmap_range(urb->transfer_buffer, 1434 + urb->transfer_buffer_length); 1435 + dma_sync_sgtable_for_device(hcd->self.sysdev, urb->sgt, dir); 1436 + } else if (urb->transfer_buffer_length != 0) { 1436 1437 if (hcd->localmem_pool) { 1437 1438 ret = hcd_alloc_coherent( 1438 1439 urb->dev->bus, mem_flags,
+1 -1
drivers/usb/core/quirks.c
··· 736 736 udev->quirks ^= usb_detect_dynamic_quirks(udev); 737 737 738 738 if (udev->quirks) 739 - dev_dbg(&udev->dev, "USB quirks for this device: %x\n", 739 + dev_dbg(&udev->dev, "USB quirks for this device: 0x%x\n", 740 740 udev->quirks); 741 741 742 742 #ifdef CONFIG_USB_DEFAULT_PERSIST
+4 -27
drivers/usb/core/urb.c
··· 500 500 501 501 /* Check that the pipe's type matches the endpoint's type */ 502 502 if (usb_pipe_type_check(urb->dev, urb->pipe)) 503 - dev_WARN(&dev->dev, "BOGUS urb xfer, pipe %x != type %x\n", 503 + dev_warn_once(&dev->dev, "BOGUS urb xfer, pipe %x != type %x\n", 504 504 usb_pipetype(urb->pipe), pipetypes[xfertype]); 505 505 506 506 /* Check against a simple/standard policy */ ··· 597 597 * code). 598 598 * 599 599 * Drivers should not call this routine or related routines, such as 600 - * usb_kill_urb() or usb_unlink_anchored_urbs(), after their disconnect 601 - * method has returned. The disconnect function should synchronize with 602 - * a driver's I/O routines to insure that all URB-related activity has 603 - * completed before it returns. 600 + * usb_kill_urb(), after their disconnect method has returned. The 601 + * disconnect function should synchronize with a driver's I/O routines 602 + * to insure that all URB-related activity has completed before it returns. 604 603 * 605 604 * This request is asynchronous, however the HCD might call the ->complete() 606 605 * callback during unlink. Therefore when drivers call usb_unlink_urb(), they ··· 889 890 spin_unlock_irqrestore(&anchor->lock, flags); 890 891 } 891 892 EXPORT_SYMBOL_GPL(usb_unpoison_anchored_urbs); 892 - /** 893 - * usb_unlink_anchored_urbs - asynchronously cancel transfer requests en masse 894 - * @anchor: anchor the requests are bound to 895 - * 896 - * this allows all outstanding URBs to be unlinked starting 897 - * from the back of the queue. This function is asynchronous. 898 - * The unlinking is just triggered. It may happen after this 899 - * function has returned. 900 - * 901 - * This routine should not be called by a driver after its disconnect 902 - * method has returned. 903 - */ 904 - void usb_unlink_anchored_urbs(struct usb_anchor *anchor) 905 - { 906 - struct urb *victim; 907 - 908 - while ((victim = usb_get_from_anchor(anchor)) != NULL) { 909 - usb_unlink_urb(victim); 910 - usb_put_urb(victim); 911 - } 912 - } 913 - EXPORT_SYMBOL_GPL(usb_unlink_anchored_urbs); 914 893 915 894 /** 916 895 * usb_anchor_suspend_wakeups
+80
drivers/usb/core/usb.c
··· 1030 1030 } 1031 1031 EXPORT_SYMBOL_GPL(usb_free_coherent); 1032 1032 1033 + /** 1034 + * usb_alloc_noncoherent - allocate dma-noncoherent buffer for URB_NO_xxx_DMA_MAP 1035 + * @dev: device the buffer will be used with 1036 + * @size: requested buffer size 1037 + * @mem_flags: affect whether allocation may block 1038 + * @dma: used to return DMA address of buffer 1039 + * @dir: DMA transfer direction 1040 + * @table: used to return sg_table of allocated memory 1041 + * 1042 + * To explicit manage the memory ownership for the kernel vs the device by 1043 + * USB core, the user needs save sg_table to urb->sgt. Then USB core will 1044 + * do DMA sync for CPU and device properly. 1045 + * 1046 + * When the buffer is no longer used, free it with usb_free_noncoherent(). 1047 + * 1048 + * Return: Either null (indicating no buffer could be allocated), or the 1049 + * cpu-space pointer to a buffer that may be used to perform DMA to the 1050 + * specified device. Such cpu-space buffers are returned along with the DMA 1051 + * address (through the pointer provided). 1052 + */ 1053 + void *usb_alloc_noncoherent(struct usb_device *dev, size_t size, 1054 + gfp_t mem_flags, dma_addr_t *dma, 1055 + enum dma_data_direction dir, 1056 + struct sg_table **table) 1057 + { 1058 + struct device *dmadev; 1059 + struct sg_table *sgt; 1060 + void *buffer; 1061 + 1062 + if (!dev || !dev->bus) 1063 + return NULL; 1064 + 1065 + dmadev = bus_to_hcd(dev->bus)->self.sysdev; 1066 + 1067 + sgt = dma_alloc_noncontiguous(dmadev, size, dir, mem_flags, 0); 1068 + if (!sgt) 1069 + return NULL; 1070 + 1071 + buffer = dma_vmap_noncontiguous(dmadev, size, sgt); 1072 + if (!buffer) { 1073 + dma_free_noncontiguous(dmadev, size, sgt, dir); 1074 + return NULL; 1075 + } 1076 + 1077 + *table = sgt; 1078 + *dma = sg_dma_address(sgt->sgl); 1079 + 1080 + return buffer; 1081 + } 1082 + EXPORT_SYMBOL_GPL(usb_alloc_noncoherent); 1083 + 1084 + /** 1085 + * usb_free_noncoherent - free memory allocated with usb_alloc_noncoherent() 1086 + * @dev: device the buffer was used with 1087 + * @size: requested buffer size 1088 + * @addr: CPU address of buffer 1089 + * @dir: DMA transfer direction 1090 + * @table: describe the allocated and DMA mapped memory, 1091 + * 1092 + * This reclaims an I/O buffer, letting it be reused. The memory must have 1093 + * been allocated using usb_alloc_noncoherent(), and the parameters must match 1094 + * those provided in that allocation request. 1095 + */ 1096 + void usb_free_noncoherent(struct usb_device *dev, size_t size, 1097 + void *addr, enum dma_data_direction dir, 1098 + struct sg_table *table) 1099 + { 1100 + struct device *dmadev; 1101 + 1102 + if (!dev || !dev->bus) 1103 + return; 1104 + if (!addr) 1105 + return; 1106 + 1107 + dmadev = bus_to_hcd(dev->bus)->self.sysdev; 1108 + dma_vunmap_noncontiguous(dmadev, addr); 1109 + dma_free_noncontiguous(dmadev, size, table, dir); 1110 + } 1111 + EXPORT_SYMBOL_GPL(usb_free_noncoherent); 1112 + 1033 1113 /* 1034 1114 * Notifications of device and interface registration 1035 1115 */
+1 -1
drivers/usb/dwc2/params.c
··· 334 334 .data = dwc2_set_amlogic_a1_params }, 335 335 { .compatible = "amcc,dwc-otg", .data = dwc2_set_amcc_params }, 336 336 { .compatible = "apm,apm82181-dwc-otg", .data = dwc2_set_amcc_params }, 337 - { .compatible = "sophgo,cv1800-usb", 337 + { .compatible = "sophgo,cv1800b-usb", 338 338 .data = dwc2_set_cv1800_params }, 339 339 { .compatible = "st,stm32f4x9-fsotg", 340 340 .data = dwc2_set_stm32f4x9_fsotg_params },
+3
drivers/usb/dwc2/platform.c
··· 371 371 372 372 dwc2_disable_global_interrupts(hsotg); 373 373 synchronize_irq(hsotg->irq); 374 + 375 + if (hsotg->ll_hw_enabled) 376 + dwc2_lowlevel_hw_disable(hsotg); 374 377 } 375 378 376 379 /**
+6 -1
drivers/usb/dwc3/dwc3-imx8mp.c
··· 244 244 IRQF_ONESHOT, dev_name(dev), dwc3_imx); 245 245 if (err) { 246 246 dev_err(dev, "failed to request IRQ #%d --> %d\n", irq, err); 247 - goto depopulate; 247 + goto put_dwc3; 248 248 } 249 249 250 250 device_set_wakeup_capable(dev, true); ··· 252 252 253 253 return 0; 254 254 255 + put_dwc3: 256 + put_device(&dwc3_imx->dwc3->dev); 255 257 depopulate: 256 258 of_platform_depopulate(dev); 257 259 remove_swnode: ··· 267 265 268 266 static void dwc3_imx8mp_remove(struct platform_device *pdev) 269 267 { 268 + struct dwc3_imx8mp *dwc3_imx = platform_get_drvdata(pdev); 270 269 struct device *dev = &pdev->dev; 270 + 271 + put_device(&dwc3_imx->dwc3->dev); 271 272 272 273 pm_runtime_get_sync(dev); 273 274 of_platform_depopulate(dev);
+3
drivers/usb/dwc3/dwc3-meson-g12a.c
··· 837 837 838 838 usb_role_switch_unregister(priv->role_switch); 839 839 840 + put_device(priv->switch_desc.udc); 841 + put_device(priv->switch_desc.usb2_port); 842 + 840 843 of_platform_depopulate(dev); 841 844 842 845 for (i = 0 ; i < PHY_COUNT ; ++i) {
+23 -12
drivers/usb/dwc3/dwc3-xilinx.c
··· 32 32 #define XLNX_USB_TRAFFIC_ROUTE_CONFIG 0x005C 33 33 #define XLNX_USB_TRAFFIC_ROUTE_FPD 0x1 34 34 35 + /* USB 2.0 IP Register */ 36 + #define XLNX_USB2_TRAFFIC_ROUTE_CONFIG 0x0044 37 + 35 38 #define XLNX_USB_FPD_PIPE_CLK 0x7c 36 39 #define PIPE_CLK_DESELECT 1 37 40 #define PIPE_CLK_SELECT 0 ··· 69 66 writel(reg, priv_data->regs + XLNX_USB_PHY_RST_EN); 70 67 } 71 68 69 + static void dwc3_xlnx_set_coherency(struct dwc3_xlnx *priv_data, u32 coherency_offset) 70 + { 71 + struct device *dev = priv_data->dev; 72 + u32 reg; 73 + 74 + /* 75 + * This routes the USB DMA traffic to go through FPD path instead 76 + * of reaching DDR directly. This traffic routing is needed to 77 + * make SMMU and CCI work with USB DMA. 78 + */ 79 + if (of_dma_is_coherent(dev->of_node) || device_iommu_mapped(dev)) { 80 + reg = readl(priv_data->regs + coherency_offset); 81 + reg |= XLNX_USB_TRAFFIC_ROUTE_FPD; 82 + writel(reg, priv_data->regs + coherency_offset); 83 + } 84 + } 85 + 72 86 static int dwc3_xlnx_init_versal(struct dwc3_xlnx *priv_data) 73 87 { 74 88 struct device *dev = priv_data->dev; ··· 112 92 } 113 93 114 94 dwc3_xlnx_mask_phy_rst(priv_data, true); 95 + dwc3_xlnx_set_coherency(priv_data, XLNX_USB2_TRAFFIC_ROUTE_CONFIG); 115 96 116 97 return 0; 117 98 } ··· 123 102 struct reset_control *crst, *hibrst, *apbrst; 124 103 struct gpio_desc *reset_gpio; 125 104 int ret = 0; 126 - u32 reg; 127 105 128 106 priv_data->usb3_phy = devm_phy_optional_get(dev, "usb3-phy"); 129 107 if (IS_ERR(priv_data->usb3_phy)) { ··· 239 219 usleep_range(5000, 10000); 240 220 } 241 221 242 - /* 243 - * This routes the USB DMA traffic to go through FPD path instead 244 - * of reaching DDR directly. This traffic routing is needed to 245 - * make SMMU and CCI work with USB DMA. 246 - */ 247 - if (of_dma_is_coherent(dev->of_node) || device_iommu_mapped(dev)) { 248 - reg = readl(priv_data->regs + XLNX_USB_TRAFFIC_ROUTE_CONFIG); 249 - reg |= XLNX_USB_TRAFFIC_ROUTE_FPD; 250 - writel(reg, priv_data->regs + XLNX_USB_TRAFFIC_ROUTE_CONFIG); 251 - } 252 - 222 + dwc3_xlnx_set_coherency(priv_data, XLNX_USB_TRAFFIC_ROUTE_CONFIG); 253 223 err: 254 224 return ret; 255 225 } ··· 432 422 static struct platform_driver dwc3_xlnx_driver = { 433 423 .probe = dwc3_xlnx_probe, 434 424 .remove = dwc3_xlnx_remove, 425 + .shutdown = dwc3_xlnx_remove, 435 426 .driver = { 436 427 .name = "dwc3-xilinx", 437 428 .of_match_table = dwc3_xlnx_of_match,
+7 -9
drivers/usb/dwc3/gadget.c
··· 924 924 if (ret) 925 925 return ret; 926 926 927 - if (!(dep->flags & DWC3_EP_RESOURCE_ALLOCATED)) { 928 - ret = dwc3_gadget_set_xfer_resource(dep); 929 - if (ret) 930 - return ret; 931 - } 927 + ret = dwc3_gadget_set_xfer_resource(dep); 928 + if (ret) 929 + return ret; 932 930 933 931 if (!(dep->flags & DWC3_EP_ENABLED)) { 934 932 struct dwc3_trb *trb_st_hw; ··· 3495 3497 3496 3498 static int dwc3_gadget_ep_reclaim_completed_trb(struct dwc3_ep *dep, 3497 3499 struct dwc3_request *req, struct dwc3_trb *trb, 3498 - const struct dwc3_event_depevt *event, int status, int chain) 3500 + const struct dwc3_event_depevt *event, int status) 3499 3501 { 3500 3502 unsigned int count; 3501 3503 ··· 3547 3549 if ((trb->ctrl & DWC3_TRB_CTRL_HWO) && status != -ESHUTDOWN) 3548 3550 return 1; 3549 3551 3550 - if (event->status & DEPEVT_STATUS_SHORT && !chain) 3552 + if (event->status & DEPEVT_STATUS_SHORT && 3553 + !(trb->ctrl & DWC3_TRB_CTRL_CHN)) 3551 3554 return 1; 3552 3555 3553 3556 if ((trb->ctrl & DWC3_TRB_CTRL_ISP_IMI) && ··· 3575 3576 trb = &dep->trb_pool[dep->trb_dequeue]; 3576 3577 3577 3578 ret = dwc3_gadget_ep_reclaim_completed_trb(dep, req, 3578 - trb, event, status, 3579 - !!(trb->ctrl & DWC3_TRB_CTRL_CHN)); 3579 + trb, event, status); 3580 3580 if (ret) 3581 3581 break; 3582 3582 }
+4
drivers/usb/early/xhci-dbc.c
··· 681 681 682 682 xdbc.table_base = NULL; 683 683 xdbc.out_buf = NULL; 684 + 685 + early_iounmap(xdbc.xhci_base, xdbc.xhci_length); 686 + xdbc.xhci_base = NULL; 687 + xdbc.xhci_length = 0; 684 688 } 685 689 686 690 return ret;
+6 -25
drivers/usb/gadget/composite.c
··· 1011 1011 1012 1012 ep = (struct usb_endpoint_descriptor *)*descriptors; 1013 1013 addr = ((ep->bEndpointAddress & 0x80) >> 3) 1014 - | (ep->bEndpointAddress & 0x0f); 1014 + | usb_endpoint_num(ep); 1015 1015 set_bit(addr, f->endpoints); 1016 1016 } 1017 1017 ··· 1192 1192 config->unbind(config); 1193 1193 /* may free memory for "c" */ 1194 1194 } 1195 - } 1196 - 1197 - /** 1198 - * usb_remove_config() - remove a configuration from a device. 1199 - * @cdev: wraps the USB gadget 1200 - * @config: the configuration 1201 - * 1202 - * Drivers must call usb_gadget_disconnect before calling this function 1203 - * to disconnect the device from the host and make sure the host will not 1204 - * try to enumerate the device while we are changing the config list. 1205 - */ 1206 - void usb_remove_config(struct usb_composite_dev *cdev, 1207 - struct usb_configuration *config) 1208 - { 1209 - unsigned long flags; 1210 - 1211 - spin_lock_irqsave(&cdev->lock, flags); 1212 - 1213 - if (cdev->config == config) 1214 - reset_config(cdev); 1215 - 1216 - spin_unlock_irqrestore(&cdev->lock, flags); 1217 - 1218 - remove_config(cdev, config); 1219 1195 } 1220 1196 1221 1197 /*-------------------------------------------------------------------------*/ ··· 2465 2489 if (!cdev->os_desc_req->buf) { 2466 2490 ret = -ENOMEM; 2467 2491 usb_ep_free_request(ep0, cdev->os_desc_req); 2492 + /* 2493 + * Set os_desc_req to NULL so that composite_dev_cleanup() 2494 + * will not try to free it again. 2495 + */ 2496 + cdev->os_desc_req = NULL; 2468 2497 goto end; 2469 2498 } 2470 2499 cdev->os_desc_req->context = cdev;
-53
drivers/usb/gadget/config.c
··· 54 54 EXPORT_SYMBOL_GPL(usb_descriptor_fillbuf); 55 55 56 56 /** 57 - * usb_gadget_config_buf - builts a complete configuration descriptor 58 - * @config: Header for the descriptor, including characteristics such 59 - * as power requirements and number of interfaces. 60 - * @buf: Buffer for the resulting configuration descriptor. 61 - * @length: Length of buffer. If this is not big enough to hold the 62 - * entire configuration descriptor, an error code will be returned. 63 - * @desc: Null-terminated vector of pointers to the descriptors (interface, 64 - * endpoint, etc) defining all functions in this device configuration. 65 - * 66 - * This copies descriptors into the response buffer, building a descriptor 67 - * for that configuration. It returns the buffer length or a negative 68 - * status code. The config.wTotalLength field is set to match the length 69 - * of the result, but other descriptor fields (including power usage and 70 - * interface count) must be set by the caller. 71 - * 72 - * Gadget drivers could use this when constructing a config descriptor 73 - * in response to USB_REQ_GET_DESCRIPTOR. They will need to patch the 74 - * resulting bDescriptorType value if USB_DT_OTHER_SPEED_CONFIG is needed. 75 - */ 76 - int usb_gadget_config_buf( 77 - const struct usb_config_descriptor *config, 78 - void *buf, 79 - unsigned length, 80 - const struct usb_descriptor_header **desc 81 - ) 82 - { 83 - struct usb_config_descriptor *cp = buf; 84 - int len; 85 - 86 - /* config descriptor first */ 87 - if (length < USB_DT_CONFIG_SIZE || !desc) 88 - return -EINVAL; 89 - *cp = *config; 90 - 91 - /* then interface/endpoint/class/vendor/... */ 92 - len = usb_descriptor_fillbuf(USB_DT_CONFIG_SIZE + (u8 *)buf, 93 - length - USB_DT_CONFIG_SIZE, desc); 94 - if (len < 0) 95 - return len; 96 - len += USB_DT_CONFIG_SIZE; 97 - if (len > 0xffff) 98 - return -EINVAL; 99 - 100 - /* patch up the config descriptor */ 101 - cp->bLength = USB_DT_CONFIG_SIZE; 102 - cp->bDescriptorType = USB_DT_CONFIG; 103 - cp->wTotalLength = cpu_to_le16(len); 104 - cp->bmAttributes |= USB_CONFIG_ATT_ONE; 105 - return len; 106 - } 107 - EXPORT_SYMBOL_GPL(usb_gadget_config_buf); 108 - 109 - /** 110 57 * usb_copy_descriptors - copy a vector of USB descriptors 111 58 * @src: null-terminated vector to copy 112 59 * Context: initialization code, which may sleep
+1 -11
drivers/usb/gadget/function/f_fs.c
··· 854 854 work); 855 855 int ret = io_data->status; 856 856 bool kiocb_has_eventfd = io_data->kiocb->ki_flags & IOCB_EVENTFD; 857 - unsigned long flags; 858 857 859 858 if (io_data->read && ret > 0) { 860 859 kthread_use_mm(io_data->mm); ··· 866 867 if (io_data->ffs->ffs_eventfd && !kiocb_has_eventfd) 867 868 eventfd_signal(io_data->ffs->ffs_eventfd); 868 869 869 - spin_lock_irqsave(&io_data->ffs->eps_lock, flags); 870 870 usb_ep_free_request(io_data->ep, io_data->req); 871 - io_data->req = NULL; 872 - spin_unlock_irqrestore(&io_data->ffs->eps_lock, flags); 873 871 874 872 if (io_data->read) 875 873 kfree(io_data->to_free); ··· 1207 1211 static int ffs_aio_cancel(struct kiocb *kiocb) 1208 1212 { 1209 1213 struct ffs_io_data *io_data = kiocb->private; 1210 - struct ffs_epfile *epfile = kiocb->ki_filp->private_data; 1211 - unsigned long flags; 1212 1214 int value; 1213 - 1214 - spin_lock_irqsave(&epfile->ffs->eps_lock, flags); 1215 1215 1216 1216 if (io_data && io_data->ep && io_data->req) 1217 1217 value = usb_ep_dequeue(io_data->ep, io_data->req); 1218 1218 else 1219 1219 value = -EINVAL; 1220 - 1221 - spin_unlock_irqrestore(&epfile->ffs->eps_lock, flags); 1222 1220 1223 1221 return value; 1224 1222 } ··· 3284 3294 if (ffs_ep->descs[ep_desc_id]) { 3285 3295 pr_err("two %sspeed descriptors for EP %d\n", 3286 3296 speed_names[ep_desc_id], 3287 - ds->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); 3297 + usb_endpoint_num(ds)); 3288 3298 return -EINVAL; 3289 3299 } 3290 3300 ffs_ep->descs[ep_desc_id] = ds;
+4 -3
drivers/usb/gadget/function/f_hid.c
··· 1278 1278 1279 1279 if (!hidg->workqueue) { 1280 1280 status = -ENOMEM; 1281 - goto fail; 1281 + goto fail_free_descs; 1282 1282 } 1283 1283 1284 1284 /* create char device */ 1285 1285 cdev_init(&hidg->cdev, &f_hidg_fops); 1286 1286 status = cdev_device_add(&hidg->cdev, &hidg->dev); 1287 1287 if (status) 1288 - goto fail_free_descs; 1288 + goto fail_free_all; 1289 1289 1290 1290 return 0; 1291 - fail_free_descs: 1291 + fail_free_all: 1292 1292 destroy_workqueue(hidg->workqueue); 1293 + fail_free_descs: 1293 1294 usb_free_all_descriptors(f); 1294 1295 fail: 1295 1296 ERROR(f->config->cdev, "hidg_bind FAILED\n");
+1 -1
drivers/usb/gadget/function/f_uac1.c
··· 1634 1634 int result; \ 1635 1635 \ 1636 1636 mutex_lock(&opts->lock); \ 1637 - result = scnprintf(page, sizeof(opts->name), "%s", opts->name); \ 1637 + result = sysfs_emit(page, "%s", opts->name); \ 1638 1638 mutex_unlock(&opts->lock); \ 1639 1639 \ 1640 1640 return result; \
+1 -1
drivers/usb/gadget/function/f_uac2.c
··· 2052 2052 int result; \ 2053 2053 \ 2054 2054 mutex_lock(&opts->lock); \ 2055 - result = scnprintf(page, sizeof(opts->name), "%s", opts->name); \ 2055 + result = sysfs_emit(page, "%s", opts->name); \ 2056 2056 mutex_unlock(&opts->lock); \ 2057 2057 \ 2058 2058 return result; \
-6
drivers/usb/gadget/function/u_serial.c
··· 1501 1501 spin_unlock_irqrestore(&serial_port_lock, flags); 1502 1502 if (!gserial_wakeup_host(gser)) 1503 1503 return; 1504 - 1505 - /* Check if port is valid after acquiring lock back */ 1506 1504 spin_lock_irqsave(&serial_port_lock, flags); 1507 - if (!port) { 1508 - spin_unlock_irqrestore(&serial_port_lock, flags); 1509 - return; 1510 - } 1511 1505 } 1512 1506 1513 1507 spin_lock(&port->port_lock);
+10
drivers/usb/gadget/function/uvc_configfs.c
··· 2916 2916 'H', '2', '6', '4', 0x00, 0x00, 0x10, 0x00, 2917 2917 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 2918 2918 }; 2919 + struct uvcg_color_matching *color_match; 2920 + struct config_item *streaming; 2919 2921 struct uvcg_framebased *h; 2922 + 2923 + streaming = group->cg_item.ci_parent; 2924 + color_match = uvcg_format_get_default_color_match(streaming); 2925 + if (!color_match) 2926 + return ERR_PTR(-EINVAL); 2920 2927 2921 2928 h = kzalloc(sizeof(*h), GFP_KERNEL); 2922 2929 if (!h) ··· 2943 2936 2944 2937 INIT_LIST_HEAD(&h->fmt.frames); 2945 2938 h->fmt.type = UVCG_FRAMEBASED; 2939 + 2940 + h->fmt.color_matching = color_match; 2941 + color_match->refcnt++; 2946 2942 config_group_init_type_name(&h->fmt.group, name, 2947 2943 &uvcg_framebased_type); 2948 2944
+1 -1
drivers/usb/gadget/udc/dummy_hcd.c
··· 623 623 624 624 dev_dbg(udc_dev(dum), "enabled %s (ep%d%s-%s) maxpacket %d stream %s\n", 625 625 _ep->name, 626 - desc->bEndpointAddress & 0x0f, 626 + usb_endpoint_num(desc), 627 627 (desc->bEndpointAddress & USB_DIR_IN) ? "in" : "out", 628 628 usb_ep_type_string(usb_endpoint_type(desc)), 629 629 max, str_enabled_disabled(ep->stream_en));
+3 -3
drivers/usb/gadget/udc/m66592-udc.c
··· 359 359 ep->pipenum = pipenum; 360 360 ep->ep.maxpacket = usb_endpoint_maxp(desc); 361 361 m66592->pipenum2ep[pipenum] = ep; 362 - m66592->epaddr2ep[desc->bEndpointAddress&USB_ENDPOINT_NUMBER_MASK] = ep; 362 + m66592->epaddr2ep[usb_endpoint_num(desc)] = ep; 363 363 INIT_LIST_HEAD(&ep->queue); 364 364 } 365 365 ··· 391 391 392 392 BUG_ON(ep->pipenum); 393 393 394 - switch (desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) { 394 + switch (usb_endpoint_type(desc)) { 395 395 case USB_ENDPOINT_XFER_BULK: 396 396 if (m66592->bulk >= M66592_MAX_NUM_BULK) { 397 397 if (m66592->isochronous >= M66592_MAX_NUM_ISOC) { ··· 433 433 } 434 434 ep->type = info.type; 435 435 436 - info.epnum = desc->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; 436 + info.epnum = usb_endpoint_num(desc); 437 437 info.maxpacket = usb_endpoint_maxp(desc); 438 438 info.interval = desc->bInterval; 439 439 if (desc->bEndpointAddress & USB_ENDPOINT_DIR_MASK)
+4 -4
drivers/usb/gadget/udc/net2280.c
··· 203 203 } 204 204 205 205 /* erratum 0119 workaround ties up an endpoint number */ 206 - if ((desc->bEndpointAddress & 0x0f) == EP_DONTUSE) { 206 + if (usb_endpoint_num(desc) == EP_DONTUSE) { 207 207 ret = -EDOM; 208 208 goto print_err; 209 209 } 210 210 211 211 if (dev->quirks & PLX_PCIE) { 212 - if ((desc->bEndpointAddress & 0x0f) >= 0x0c) { 212 + if (usb_endpoint_num(desc) >= 0x0c) { 213 213 ret = -EDOM; 214 214 goto print_err; 215 215 } ··· 255 255 else 256 256 tmp &= ~USB3380_EP_CFG_MASK_OUT; 257 257 } 258 - type = (desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK); 258 + type = usb_endpoint_type(desc); 259 259 if (type == USB_ENDPOINT_XFER_INT) { 260 260 /* erratum 0105 workaround prevents hs NYET */ 261 261 if (dev->chiprev == 0100 && ··· 1334 1334 retval = -ESHUTDOWN; 1335 1335 goto print_err; 1336 1336 } 1337 - if (ep->desc /* not ep0 */ && (ep->desc->bmAttributes & 0x03) 1337 + if (ep->desc /* not ep0 */ && usb_endpoint_type(ep->desc) 1338 1338 == USB_ENDPOINT_XFER_ISOC) { 1339 1339 retval = -EINVAL; 1340 1340 goto print_err;
+1 -1
drivers/usb/gadget/udc/pch_udc.c
··· 988 988 pch_udc_ep_fifo_flush(ep, ep->in); 989 989 /* Configure the endpoint */ 990 990 val = ep->num << UDC_CSR_NE_NUM_SHIFT | ep->in << UDC_CSR_NE_DIR_SHIFT | 991 - ((desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) << 991 + (usb_endpoint_type(desc) << 992 992 UDC_CSR_NE_TYPE_SHIFT) | 993 993 (cfg->cur_cfg << UDC_CSR_NE_CFG_SHIFT) | 994 994 (cfg->cur_intf << UDC_CSR_NE_INTF_SHIFT) |
+4 -6
drivers/usb/gadget/udc/renesas_usb3.c
··· 2657 2657 struct renesas_usb3 *usb3 = platform_get_drvdata(pdev); 2658 2658 2659 2659 debugfs_remove_recursive(usb3->dentry); 2660 + put_device(usb3->host_dev); 2660 2661 device_remove_file(&pdev->dev, &dev_attr_role); 2661 2662 2662 2663 cancel_work_sync(&usb3->role_work); ··· 2974 2973 return ret; 2975 2974 } 2976 2975 2977 - #ifdef CONFIG_PM_SLEEP 2978 2976 static int renesas_usb3_suspend(struct device *dev) 2979 2977 { 2980 2978 struct renesas_usb3 *usb3 = dev_get_drvdata(dev); ··· 3004 3004 3005 3005 return 0; 3006 3006 } 3007 - #endif 3008 3007 3009 - static SIMPLE_DEV_PM_OPS(renesas_usb3_pm_ops, renesas_usb3_suspend, 3010 - renesas_usb3_resume); 3008 + static DEFINE_SIMPLE_DEV_PM_OPS(renesas_usb3_pm_ops, renesas_usb3_suspend, 3009 + renesas_usb3_resume); 3011 3010 3012 3011 static struct platform_driver renesas_usb3_driver = { 3013 3012 .probe = renesas_usb3_probe, 3014 3013 .remove = renesas_usb3_remove, 3015 3014 .driver = { 3016 3015 .name = udc_name, 3017 - .pm = &renesas_usb3_pm_ops, 3016 + .pm = pm_sleep_ptr(&renesas_usb3_pm_ops), 3018 3017 .of_match_table = usb3_of_match, 3019 3018 }, 3020 3019 }; ··· 3022 3023 MODULE_DESCRIPTION("Renesas USB3.0 Peripheral driver"); 3023 3024 MODULE_LICENSE("GPL v2"); 3024 3025 MODULE_AUTHOR("Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>"); 3025 - MODULE_ALIAS("platform:renesas_usb3");
+2 -2
drivers/usb/gadget/udc/udc-xilinx.c
··· 813 813 814 814 ep->is_in = ((desc->bEndpointAddress & USB_DIR_IN) != 0); 815 815 /* Bit 3...0:endpoint number */ 816 - ep->epnumber = (desc->bEndpointAddress & 0x0f); 816 + ep->epnumber = usb_endpoint_num(desc); 817 817 ep->desc = desc; 818 818 ep->ep_usb.desc = desc; 819 - tmp = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; 819 + tmp = usb_endpoint_type(desc); 820 820 ep->ep_usb.maxpacket = maxpacket = le16_to_cpu(desc->wMaxPacketSize); 821 821 822 822 switch (tmp) {
+6 -12
drivers/usb/host/ehci-sysfs.c
··· 12 12 char *buf) 13 13 { 14 14 struct ehci_hcd *ehci; 15 - int nports, index, n; 16 - int count = PAGE_SIZE; 17 - char *ptr = buf; 15 + int nports, index; 16 + int len = 0; 18 17 19 18 ehci = hcd_to_ehci(dev_get_drvdata(dev)); 20 19 nports = HCS_N_PORTS(ehci->hcs_params); 21 20 22 21 for (index = 0; index < nports; ++index) { 23 - if (test_bit(index, &ehci->companion_ports)) { 24 - n = scnprintf(ptr, count, "%d\n", index + 1); 25 - ptr += n; 26 - count -= n; 27 - } 22 + if (test_bit(index, &ehci->companion_ports)) 23 + len += sysfs_emit_at(buf, len, "%d\n", index + 1); 28 24 } 29 - return ptr - buf; 25 + return len; 30 26 } 31 27 32 28 /* ··· 66 70 char *buf) 67 71 { 68 72 struct ehci_hcd *ehci; 69 - int n; 70 73 71 74 ehci = hcd_to_ehci(dev_get_drvdata(dev)); 72 - n = scnprintf(buf, PAGE_SIZE, "%d\n", ehci->uframe_periodic_max); 73 - return n; 75 + return sysfs_emit(buf, "%d\n", ehci->uframe_periodic_max); 74 76 } 75 77 76 78
+1 -2
drivers/usb/host/fsl-mph-dr-of.c
··· 327 327 328 328 pdata->regs = NULL; 329 329 330 - if (pdata->clk) 331 - clk_disable_unprepare(pdata->clk); 330 + clk_disable_unprepare(pdata->clk); 332 331 } 333 332 334 333 static struct fsl_usb2_platform_data fsl_usb2_mpc5121_pd = {
+1 -1
drivers/usb/host/ohci-at91.c
··· 193 193 if (irq < 0) 194 194 return irq; 195 195 196 - hcd = usb_create_hcd(driver, dev, "at91"); 196 + hcd = usb_create_hcd(driver, dev, dev_name(dev)); 197 197 if (!hcd) 198 198 return -ENOMEM; 199 199 ohci_at91 = hcd_to_ohci_at91_priv(hcd);
+1 -2
drivers/usb/host/ohci-spear.c
··· 103 103 struct spear_ohci *sohci_p = to_spear_ohci(hcd); 104 104 105 105 usb_remove_hcd(hcd); 106 - if (sohci_p->clk) 107 - clk_disable_unprepare(sohci_p->clk); 106 + clk_disable_unprepare(sohci_p->clk); 108 107 109 108 usb_put_hcd(hcd); 110 109 }
+2
drivers/usb/host/xhci-mem.c
··· 1195 1195 ep0_ctx->deq = cpu_to_le64(dev->eps[0].ring->first_seg->dma | 1196 1196 dev->eps[0].ring->cycle_state); 1197 1197 1198 + ep0_ctx->tx_info = cpu_to_le32(EP_AVG_TRB_LENGTH(8)); 1199 + 1198 1200 trace_xhci_setup_addressable_virt_device(dev); 1199 1201 1200 1202 /* Steps 7 and 8 were done in xhci_alloc_virt_device() */
+1 -1
drivers/usb/host/xhci-plat.c
··· 152 152 int ret; 153 153 int irq; 154 154 struct xhci_plat_priv *priv = NULL; 155 - bool of_match; 155 + const struct of_device_id *of_match; 156 156 157 157 if (usb_disabled()) 158 158 return -ENODEV;
+7 -3
drivers/usb/host/xhci-ring.c
··· 1376 1376 */ 1377 1377 void xhci_hc_died(struct xhci_hcd *xhci) 1378 1378 { 1379 + bool notify; 1379 1380 int i, j; 1380 1381 1381 1382 if (xhci->xhc_state & XHCI_STATE_DYING) 1382 1383 return; 1383 1384 1384 - xhci_err(xhci, "xHCI host controller not responding, assume dead\n"); 1385 + notify = !(xhci->xhc_state & XHCI_STATE_REMOVING); 1386 + if (notify) 1387 + xhci_err(xhci, "xHCI host controller not responding, assume dead\n"); 1385 1388 xhci->xhc_state |= XHCI_STATE_DYING; 1386 1389 1387 1390 xhci_cleanup_command_queue(xhci); ··· 1398 1395 } 1399 1396 1400 1397 /* inform usb core hc died if PCI remove isn't already handling it */ 1401 - if (!(xhci->xhc_state & XHCI_STATE_REMOVING)) 1398 + if (notify) 1402 1399 usb_hc_died(xhci_to_hcd(xhci)); 1403 1400 } 1404 1401 ··· 4375 4372 4376 4373 if ((xhci->xhc_state & XHCI_STATE_DYING) || 4377 4374 (xhci->xhc_state & XHCI_STATE_HALTED)) { 4378 - xhci_dbg(xhci, "xHCI dying or halted, can't queue_command\n"); 4375 + xhci_dbg(xhci, "xHCI dying or halted, can't queue_command. state: 0x%x\n", 4376 + xhci->xhc_state); 4379 4377 return -ESHUTDOWN; 4380 4378 } 4381 4379
+4 -2
drivers/usb/host/xhci.c
··· 121 121 ret = xhci_handshake(&xhci->op_regs->status, 122 122 STS_HALT, STS_HALT, XHCI_MAX_HALT_USEC); 123 123 if (ret) { 124 - xhci_warn(xhci, "Host halt failed, %d\n", ret); 124 + if (!(xhci->xhc_state & XHCI_STATE_DYING)) 125 + xhci_warn(xhci, "Host halt failed, %d\n", ret); 125 126 return ret; 126 127 } 127 128 ··· 181 180 state = readl(&xhci->op_regs->status); 182 181 183 182 if (state == ~(u32)0) { 184 - xhci_warn(xhci, "Host not accessible, reset failed.\n"); 183 + if (!(xhci->xhc_state & XHCI_STATE_DYING)) 184 + xhci_warn(xhci, "Host not accessible, reset failed.\n"); 185 185 return -ENODEV; 186 186 } 187 187
+21 -3
drivers/usb/misc/apple-mfi-fastcharge.c
··· 44 44 struct mfi_device { 45 45 struct usb_device *udev; 46 46 struct power_supply *battery; 47 + struct power_supply_desc battery_desc; 47 48 int charge_type; 48 49 }; 49 50 ··· 179 178 { 180 179 struct power_supply_config battery_cfg = {}; 181 180 struct mfi_device *mfi = NULL; 181 + char *battery_name; 182 182 int err; 183 183 184 184 if (!mfi_fc_match(udev)) ··· 189 187 if (!mfi) 190 188 return -ENOMEM; 191 189 190 + battery_name = kasprintf(GFP_KERNEL, "apple_mfi_fastcharge_%d-%d", 191 + udev->bus->busnum, udev->devnum); 192 + if (!battery_name) { 193 + err = -ENOMEM; 194 + goto err_free_mfi; 195 + } 196 + 197 + mfi->battery_desc = apple_mfi_fc_desc; 198 + mfi->battery_desc.name = battery_name; 199 + 192 200 battery_cfg.drv_data = mfi; 193 201 194 202 mfi->charge_type = POWER_SUPPLY_CHARGE_TYPE_TRICKLE; 195 203 mfi->battery = power_supply_register(&udev->dev, 196 - &apple_mfi_fc_desc, 204 + &mfi->battery_desc, 197 205 &battery_cfg); 198 206 if (IS_ERR(mfi->battery)) { 199 207 dev_err(&udev->dev, "Can't register battery\n"); 200 208 err = PTR_ERR(mfi->battery); 201 - kfree(mfi); 202 - return err; 209 + goto err_free_name; 203 210 } 204 211 205 212 mfi->udev = usb_get_dev(udev); 206 213 dev_set_drvdata(&udev->dev, mfi); 207 214 208 215 return 0; 216 + 217 + err_free_name: 218 + kfree(battery_name); 219 + err_free_mfi: 220 + kfree(mfi); 221 + return err; 209 222 } 210 223 211 224 static void mfi_fc_disconnect(struct usb_device *udev) ··· 230 213 mfi = dev_get_drvdata(&udev->dev); 231 214 if (mfi->battery) 232 215 power_supply_unregister(mfi->battery); 216 + kfree(mfi->battery_desc.name); 233 217 dev_set_drvdata(&udev->dev, NULL); 234 218 usb_put_dev(mfi->udev); 235 219 kfree(mfi);
+2
drivers/usb/misc/onboard_usb_dev.c
··· 564 564 565 565 /************************** USB driver **************************/ 566 566 567 + #define VENDOR_ID_BISON 0x5986 567 568 #define VENDOR_ID_CYPRESS 0x04b4 568 569 #define VENDOR_ID_GENESYS 0x05e3 569 570 #define VENDOR_ID_MICROCHIP 0x0424 ··· 648 647 } 649 648 650 649 static const struct usb_device_id onboard_dev_id_table[] = { 650 + { USB_DEVICE(VENDOR_ID_BISON, 0x1198) }, /* Bison Electronics Inc. Integrated Camera */ 651 651 { USB_DEVICE(VENDOR_ID_CYPRESS, 0x6500) }, /* CYUSB330x 3.0 HUB */ 652 652 { USB_DEVICE(VENDOR_ID_CYPRESS, 0x6502) }, /* CYUSB330x 2.0 HUB */ 653 653 { USB_DEVICE(VENDOR_ID_CYPRESS, 0x6503) }, /* CYUSB33{0,1}x 2.0 HUB, Vendor Mode */
+8
drivers/usb/misc/onboard_usb_dev.h
··· 73 73 .is_hub = true, 74 74 }; 75 75 76 + static const struct onboard_dev_pdata bison_intcamera_data = { 77 + .reset_us = 1000, 78 + .num_supplies = 1, 79 + .supply_names = { "vdd" }, 80 + .is_hub = false, 81 + }; 82 + 76 83 static const struct onboard_dev_pdata cypress_hx3_data = { 77 84 .reset_us = 10000, 78 85 .num_supplies = 2, ··· 151 144 { .compatible = "usb2109,817", .data = &vialab_vl817_data, }, 152 145 { .compatible = "usb2109,2817", .data = &vialab_vl817_data, }, 153 146 { .compatible = "usb20b1,0013", .data = &xmos_xvf3500_data, }, 147 + { .compatible = "usb5986,1198", .data = &bison_intcamera_data, }, 154 148 {} 155 149 }; 156 150
+2 -1
drivers/usb/musb/Kconfig
··· 84 84 85 85 config USB_MUSB_OMAP2PLUS 86 86 tristate "OMAP2430 and onwards" 87 - depends on ARCH_OMAP2PLUS && USB 87 + depends on ARCH_OMAP2PLUS || COMPILE_TEST 88 + depends on USB 88 89 depends on OMAP_CONTROL_PHY || !OMAP_CONTROL_PHY 89 90 select GENERIC_PHY 90 91
+19 -18
drivers/usb/musb/omap2430.c
··· 318 318 319 319 glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL); 320 320 if (!glue) 321 - goto err0; 321 + return -ENOMEM; 322 322 323 323 musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO); 324 - if (!musb) { 325 - dev_err(&pdev->dev, "failed to allocate musb device\n"); 326 - goto err0; 327 - } 324 + if (!musb) 325 + return -ENOMEM; 328 326 329 327 musb->dev.parent = &pdev->dev; 330 328 musb->dev.dma_mask = &omap2430_dmamask; ··· 347 349 348 350 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 349 351 if (!pdata) 350 - goto err2; 352 + goto err_put_musb; 351 353 352 354 data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); 353 355 if (!data) 354 - goto err2; 356 + goto err_put_musb; 355 357 356 358 config = devm_kzalloc(&pdev->dev, sizeof(*config), GFP_KERNEL); 357 359 if (!config) 358 - goto err2; 360 + goto err_put_musb; 359 361 360 362 of_property_read_u32(np, "mode", (u32 *)&pdata->mode); 361 363 of_property_read_u32(np, "interface-type", ··· 378 380 if (!control_pdev) { 379 381 dev_err(&pdev->dev, "Failed to get control device\n"); 380 382 ret = -EINVAL; 381 - goto err2; 383 + goto err_put_musb; 382 384 } 383 385 glue->control_otghs = &control_pdev->dev; 384 386 } ··· 398 400 ret = platform_device_add_resources(musb, pdev->resource, pdev->num_resources); 399 401 if (ret) { 400 402 dev_err(&pdev->dev, "failed to add resources\n"); 401 - goto err2; 403 + goto err_put_control_otghs; 402 404 } 403 405 404 406 if (populate_irqs) { ··· 411 413 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 412 414 if (!res) { 413 415 ret = -EINVAL; 414 - goto err2; 416 + goto err_put_control_otghs; 415 417 } 416 418 417 419 musb_res[i].start = res->start; ··· 439 441 ret = platform_device_add_resources(musb, musb_res, i); 440 442 if (ret) { 441 443 dev_err(&pdev->dev, "failed to add IRQ resources\n"); 442 - goto err2; 444 + goto err_put_control_otghs; 443 445 } 444 446 } 445 447 446 448 ret = platform_device_add_data(musb, pdata, sizeof(*pdata)); 447 449 if (ret) { 448 450 dev_err(&pdev->dev, "failed to add platform_data\n"); 449 - goto err2; 451 + goto err_put_control_otghs; 450 452 } 451 453 452 454 pm_runtime_enable(glue->dev); ··· 454 456 ret = platform_device_add(musb); 455 457 if (ret) { 456 458 dev_err(&pdev->dev, "failed to register musb device\n"); 457 - goto err3; 459 + goto err_disable_rpm; 458 460 } 459 461 460 462 return 0; 461 463 462 - err3: 464 + err_disable_rpm: 463 465 pm_runtime_disable(glue->dev); 464 - 465 - err2: 466 + err_put_control_otghs: 467 + if (!IS_ERR(glue->control_otghs)) 468 + put_device(glue->control_otghs); 469 + err_put_musb: 466 470 platform_device_put(musb); 467 471 468 - err0: 469 472 return ret; 470 473 } 471 474 ··· 476 477 477 478 platform_device_unregister(glue->musb); 478 479 pm_runtime_disable(glue->dev); 480 + if (!IS_ERR(glue->control_otghs)) 481 + put_device(glue->control_otghs); 479 482 } 480 483 481 484 #ifdef CONFIG_PM
-89
drivers/usb/phy/phy-tegra-usb.c
··· 711 711 return utmip_pad_power_off(phy); 712 712 } 713 713 714 - static void utmi_phy_preresume(struct tegra_usb_phy *phy) 715 - { 716 - void __iomem *base = phy->regs; 717 - u32 val; 718 - 719 - val = readl_relaxed(base + UTMIP_TX_CFG0); 720 - val |= UTMIP_HS_DISCON_DISABLE; 721 - writel_relaxed(val, base + UTMIP_TX_CFG0); 722 - } 723 - 724 - static void utmi_phy_postresume(struct tegra_usb_phy *phy) 725 - { 726 - void __iomem *base = phy->regs; 727 - u32 val; 728 - 729 - val = readl_relaxed(base + UTMIP_TX_CFG0); 730 - val &= ~UTMIP_HS_DISCON_DISABLE; 731 - writel_relaxed(val, base + UTMIP_TX_CFG0); 732 - } 733 - 734 - static void utmi_phy_restore_start(struct tegra_usb_phy *phy, 735 - enum tegra_usb_phy_port_speed port_speed) 736 - { 737 - void __iomem *base = phy->regs; 738 - u32 val; 739 - 740 - val = readl_relaxed(base + UTMIP_MISC_CFG0); 741 - val &= ~UTMIP_DPDM_OBSERVE_SEL(~0); 742 - if (port_speed == TEGRA_USB_PHY_PORT_SPEED_LOW) 743 - val |= UTMIP_DPDM_OBSERVE_SEL_FS_K; 744 - else 745 - val |= UTMIP_DPDM_OBSERVE_SEL_FS_J; 746 - writel_relaxed(val, base + UTMIP_MISC_CFG0); 747 - usleep_range(1, 10); 748 - 749 - val = readl_relaxed(base + UTMIP_MISC_CFG0); 750 - val |= UTMIP_DPDM_OBSERVE; 751 - writel_relaxed(val, base + UTMIP_MISC_CFG0); 752 - usleep_range(10, 100); 753 - } 754 - 755 - static void utmi_phy_restore_end(struct tegra_usb_phy *phy) 756 - { 757 - void __iomem *base = phy->regs; 758 - u32 val; 759 - 760 - val = readl_relaxed(base + UTMIP_MISC_CFG0); 761 - val &= ~UTMIP_DPDM_OBSERVE; 762 - writel_relaxed(val, base + UTMIP_MISC_CFG0); 763 - usleep_range(10, 100); 764 - } 765 - 766 714 static int ulpi_phy_power_on(struct tegra_usb_phy *phy) 767 715 { 768 716 void __iomem *base = phy->regs; ··· 1070 1122 1071 1123 return err; 1072 1124 } 1073 - 1074 - void tegra_usb_phy_preresume(struct usb_phy *u_phy) 1075 - { 1076 - struct tegra_usb_phy *phy = to_tegra_usb_phy(u_phy); 1077 - 1078 - if (!phy->is_ulpi_phy) 1079 - utmi_phy_preresume(phy); 1080 - } 1081 - EXPORT_SYMBOL_GPL(tegra_usb_phy_preresume); 1082 - 1083 - void tegra_usb_phy_postresume(struct usb_phy *u_phy) 1084 - { 1085 - struct tegra_usb_phy *phy = to_tegra_usb_phy(u_phy); 1086 - 1087 - if (!phy->is_ulpi_phy) 1088 - utmi_phy_postresume(phy); 1089 - } 1090 - EXPORT_SYMBOL_GPL(tegra_usb_phy_postresume); 1091 - 1092 - void tegra_ehci_phy_restore_start(struct usb_phy *u_phy, 1093 - enum tegra_usb_phy_port_speed port_speed) 1094 - { 1095 - struct tegra_usb_phy *phy = to_tegra_usb_phy(u_phy); 1096 - 1097 - if (!phy->is_ulpi_phy) 1098 - utmi_phy_restore_start(phy, port_speed); 1099 - } 1100 - EXPORT_SYMBOL_GPL(tegra_ehci_phy_restore_start); 1101 - 1102 - void tegra_ehci_phy_restore_end(struct usb_phy *u_phy) 1103 - { 1104 - struct tegra_usb_phy *phy = to_tegra_usb_phy(u_phy); 1105 - 1106 - if (!phy->is_ulpi_phy) 1107 - utmi_phy_restore_end(phy); 1108 - } 1109 - EXPORT_SYMBOL_GPL(tegra_ehci_phy_restore_end); 1110 1125 1111 1126 static int read_utmi_param(struct platform_device *pdev, const char *param, 1112 1127 u8 *dest)
+4 -4
drivers/usb/renesas_usbhs/common.c
··· 823 823 usbhs_pipe_remove(priv); 824 824 } 825 825 826 - static __maybe_unused int usbhsc_suspend(struct device *dev) 826 + static int usbhsc_suspend(struct device *dev) 827 827 { 828 828 struct usbhs_priv *priv = dev_get_drvdata(dev); 829 829 struct usbhs_mod *mod = usbhs_mod_get_current(priv); ··· 839 839 return 0; 840 840 } 841 841 842 - static __maybe_unused int usbhsc_resume(struct device *dev) 842 + static int usbhsc_resume(struct device *dev) 843 843 { 844 844 struct usbhs_priv *priv = dev_get_drvdata(dev); 845 845 struct platform_device *pdev = usbhs_priv_to_pdev(priv); ··· 856 856 return 0; 857 857 } 858 858 859 - static SIMPLE_DEV_PM_OPS(usbhsc_pm_ops, usbhsc_suspend, usbhsc_resume); 859 + static DEFINE_SIMPLE_DEV_PM_OPS(usbhsc_pm_ops, usbhsc_suspend, usbhsc_resume); 860 860 861 861 static struct platform_driver renesas_usbhs_driver = { 862 862 .driver = { 863 863 .name = "renesas_usbhs", 864 - .pm = &usbhsc_pm_ops, 864 + .pm = pm_sleep_ptr(&usbhsc_pm_ops), 865 865 .of_match_table = usbhs_of_match, 866 866 }, 867 867 .probe = usbhs_probe,
+1 -1
drivers/usb/renesas_usbhs/fifo.c
··· 123 123 if (fifo) 124 124 chan = usbhsf_dma_chan_get(fifo, pkt); 125 125 if (chan) { 126 - dmaengine_terminate_all(chan); 126 + dmaengine_terminate_sync(chan); 127 127 usbhsf_dma_unmap(pkt); 128 128 } else { 129 129 if (usbhs_pipe_is_dir_in(pipe))
+6 -4
drivers/usb/serial/cp210x.c
··· 1504 1504 return !!(mask & BIT(gpio)); 1505 1505 } 1506 1506 1507 - static void cp210x_gpio_set(struct gpio_chip *gc, unsigned int gpio, int value) 1507 + static int cp210x_gpio_set(struct gpio_chip *gc, unsigned int gpio, int value) 1508 1508 { 1509 1509 struct usb_serial *serial = gpiochip_get_data(gc); 1510 1510 struct cp210x_serial_private *priv = usb_get_serial_data(serial); ··· 1559 1559 if (result < 0) { 1560 1560 dev_err(&serial->interface->dev, "failed to set GPIO value: %d\n", 1561 1561 result); 1562 + return result; 1562 1563 } 1564 + 1565 + return 0; 1563 1566 } 1564 1567 1565 1568 static int cp210x_gpio_direction_get(struct gpio_chip *gc, unsigned int gpio) ··· 1602 1599 struct cp210x_serial_private *priv = usb_get_serial_data(serial); 1603 1600 1604 1601 priv->gpio_input &= ~BIT(gpio); 1605 - cp210x_gpio_set(gc, gpio, value); 1606 1602 1607 - return 0; 1603 + return cp210x_gpio_set(gc, gpio, value); 1608 1604 } 1609 1605 1610 1606 static int cp210x_gpio_set_config(struct gpio_chip *gc, unsigned int gpio, ··· 1962 1960 priv->gc.direction_input = cp210x_gpio_direction_input; 1963 1961 priv->gc.direction_output = cp210x_gpio_direction_output; 1964 1962 priv->gc.get = cp210x_gpio_get; 1965 - priv->gc.set = cp210x_gpio_set; 1963 + priv->gc.set_rv = cp210x_gpio_set; 1966 1964 priv->gc.set_config = cp210x_gpio_set_config; 1967 1965 priv->gc.init_valid_mask = cp210x_gpio_init_valid_mask; 1968 1966 priv->gc.owner = THIS_MODULE;
+12 -6
drivers/usb/serial/ftdi_sio.c
··· 1859 1859 return !!(result & BIT(gpio)); 1860 1860 } 1861 1861 1862 - static void ftdi_gpio_set(struct gpio_chip *gc, unsigned int gpio, int value) 1862 + static int ftdi_gpio_set(struct gpio_chip *gc, unsigned int gpio, int value) 1863 1863 { 1864 1864 struct usb_serial_port *port = gpiochip_get_data(gc); 1865 1865 struct ftdi_private *priv = usb_get_serial_port_data(port); 1866 + int result; 1866 1867 1867 1868 mutex_lock(&priv->gpio_lock); 1868 1869 ··· 1872 1871 else 1873 1872 priv->gpio_value &= ~BIT(gpio); 1874 1873 1875 - ftdi_set_cbus_pins(port); 1874 + result = ftdi_set_cbus_pins(port); 1876 1875 1877 1876 mutex_unlock(&priv->gpio_lock); 1877 + 1878 + return result; 1878 1879 } 1879 1880 1880 1881 static int ftdi_gpio_get_multiple(struct gpio_chip *gc, unsigned long *mask, ··· 1894 1891 return 0; 1895 1892 } 1896 1893 1897 - static void ftdi_gpio_set_multiple(struct gpio_chip *gc, unsigned long *mask, 1894 + static int ftdi_gpio_set_multiple(struct gpio_chip *gc, unsigned long *mask, 1898 1895 unsigned long *bits) 1899 1896 { 1900 1897 struct usb_serial_port *port = gpiochip_get_data(gc); 1901 1898 struct ftdi_private *priv = usb_get_serial_port_data(port); 1899 + int result; 1902 1900 1903 1901 mutex_lock(&priv->gpio_lock); 1904 1902 1905 1903 priv->gpio_value &= ~(*mask); 1906 1904 priv->gpio_value |= *bits & *mask; 1907 - ftdi_set_cbus_pins(port); 1905 + result = ftdi_set_cbus_pins(port); 1908 1906 1909 1907 mutex_unlock(&priv->gpio_lock); 1908 + 1909 + return result; 1910 1910 } 1911 1911 1912 1912 static int ftdi_gpio_direction_get(struct gpio_chip *gc, unsigned int gpio) ··· 2150 2144 priv->gc.direction_output = ftdi_gpio_direction_output; 2151 2145 priv->gc.init_valid_mask = ftdi_gpio_init_valid_mask; 2152 2146 priv->gc.get = ftdi_gpio_get; 2153 - priv->gc.set = ftdi_gpio_set; 2147 + priv->gc.set_rv = ftdi_gpio_set; 2154 2148 priv->gc.get_multiple = ftdi_gpio_get_multiple; 2155 - priv->gc.set_multiple = ftdi_gpio_set_multiple; 2149 + priv->gc.set_multiple_rv = ftdi_gpio_set_multiple; 2156 2150 priv->gc.owner = THIS_MODULE; 2157 2151 priv->gc.parent = &serial->interface->dev; 2158 2152 priv->gc.base = -1;
+2
drivers/usb/serial/option.c
··· 2346 2346 .driver_info = RSVD(3) }, 2347 2347 { USB_DEVICE_INTERFACE_CLASS(0x0489, 0xe145, 0xff), /* Foxconn T99W651 RNDIS */ 2348 2348 .driver_info = RSVD(5) | RSVD(6) }, 2349 + { USB_DEVICE_INTERFACE_CLASS(0x0489, 0xe15f, 0xff), /* Foxconn T99W709 */ 2350 + .driver_info = RSVD(5) }, 2349 2351 { USB_DEVICE_INTERFACE_CLASS(0x0489, 0xe167, 0xff), /* Foxconn T99W640 MBIM */ 2350 2352 .driver_info = RSVD(3) }, 2351 2353 { USB_DEVICE(0x1508, 0x1001), /* Fibocom NL668 (IOT version) */
+1 -1
drivers/usb/storage/realtek_cr.c
··· 748 748 749 749 usb_stor_dbg(us, "state:%d\n", rts51x_get_stat(chip)); 750 750 751 - chip->timer_expires = jiffies + msecs_to_jiffies(1000*ss_delay); 751 + chip->timer_expires = jiffies + secs_to_jiffies(ss_delay); 752 752 mod_timer(&chip->rts51x_suspend_timer, chip->timer_expires); 753 753 } 754 754
+28
drivers/usb/typec/altmodes/displayport.c
··· 65 65 enum dp_state state; 66 66 bool hpd; 67 67 bool pending_hpd; 68 + u32 irq_hpd_count; 69 + /* 70 + * hpd is mandatory for irq_hpd assertion, so irq_hpd also needs its own pending flag if 71 + * both hpd and irq_hpd are asserted in the first Status Update before the pin assignment 72 + * is configured. 73 + */ 74 + bool pending_irq_hpd; 68 75 69 76 struct mutex lock; /* device lock */ 70 77 struct work_struct work; ··· 158 151 { 159 152 bool configured = !!DP_CONF_GET_PIN_ASSIGN(dp->data.conf); 160 153 bool hpd = !!(dp->data.status & DP_STATUS_HPD_STATE); 154 + bool irq_hpd = !!(dp->data.status & DP_STATUS_IRQ_HPD); 161 155 u8 con = DP_STATUS_CONNECTION(dp->data.status); 162 156 int ret = 0; 163 157 ··· 178 170 dp->hpd = hpd; 179 171 dp->pending_hpd = true; 180 172 } 173 + if (dp->hpd && dp->pending_hpd && irq_hpd) 174 + dp->pending_irq_hpd = true; 181 175 } 182 176 } else { 183 177 drm_connector_oob_hotplug_event(dp->connector_fwnode, ··· 187 177 connector_status_disconnected); 188 178 dp->hpd = hpd; 189 179 sysfs_notify(&dp->alt->dev.kobj, "displayport", "hpd"); 180 + if (hpd && irq_hpd) { 181 + dp->irq_hpd_count++; 182 + sysfs_notify(&dp->alt->dev.kobj, "displayport", "irq_hpd"); 183 + } 190 184 } 191 185 192 186 return ret; ··· 210 196 connector_status_connected); 211 197 sysfs_notify(&dp->alt->dev.kobj, "displayport", "hpd"); 212 198 dp->pending_hpd = false; 199 + if (dp->pending_irq_hpd) { 200 + dp->irq_hpd_count++; 201 + sysfs_notify(&dp->alt->dev.kobj, "displayport", "irq_hpd"); 202 + dp->pending_irq_hpd = false; 203 + } 213 204 } 214 205 215 206 return dp_altmode_notify(dp); ··· 725 706 } 726 707 static DEVICE_ATTR_RO(hpd); 727 708 709 + static ssize_t irq_hpd_show(struct device *dev, struct device_attribute *attr, char *buf) 710 + { 711 + struct dp_altmode *dp = dev_get_drvdata(dev); 712 + 713 + return sysfs_emit(buf, "%d\n", dp->irq_hpd_count); 714 + } 715 + static DEVICE_ATTR_RO(irq_hpd); 716 + 728 717 static struct attribute *displayport_attrs[] = { 729 718 &dev_attr_configuration.attr, 730 719 &dev_attr_pin_assignment.attr, 731 720 &dev_attr_hpd.attr, 721 + &dev_attr_irq_hpd.attr, 732 722 NULL 733 723 }; 734 724
+1 -1
drivers/usb/typec/mux/intel_pmc_mux.c
··· 754 754 755 755 pmc->ipc = devm_intel_scu_ipc_dev_get(&pdev->dev); 756 756 if (!pmc->ipc) 757 - return -ENODEV; 757 + return -EPROBE_DEFER; 758 758 759 759 pmc->dev = &pdev->dev; 760 760
+12 -8
drivers/usb/typec/tcpm/fusb302.c
··· 104 104 bool vconn_on; 105 105 bool vbus_on; 106 106 bool charge_on; 107 + bool pd_rx_on; 107 108 bool vbus_present; 108 109 enum typec_cc_polarity cc_polarity; 109 110 enum typec_cc_status cc1; ··· 842 841 int ret = 0; 843 842 844 843 mutex_lock(&chip->lock); 844 + if (chip->pd_rx_on == on) { 845 + fusb302_log(chip, "pd is already %s", str_on_off(on)); 846 + goto done; 847 + } 848 + 845 849 ret = fusb302_pd_rx_flush(chip); 846 850 if (ret < 0) { 847 851 fusb302_log(chip, "cannot flush pd rx buffer, ret=%d", ret); ··· 869 863 str_on_off(on), ret); 870 864 goto done; 871 865 } 866 + 867 + chip->pd_rx_on = on; 872 868 fusb302_log(chip, "pd := %s", str_on_off(on)); 873 869 done: 874 870 mutex_unlock(&chip->lock); ··· 1485 1477 struct fusb302_chip *chip = dev_id; 1486 1478 unsigned long flags; 1487 1479 1488 - /* Disable our level triggered IRQ until our irq_work has cleared it */ 1489 - disable_irq_nosync(chip->gpio_int_n_irq); 1490 - 1491 1480 spin_lock_irqsave(&chip->irq_lock, flags); 1492 1481 if (chip->irq_suspended) 1493 1482 chip->irq_while_suspended = true; ··· 1627 1622 } 1628 1623 done: 1629 1624 mutex_unlock(&chip->lock); 1630 - enable_irq(chip->gpio_int_n_irq); 1631 1625 } 1632 1626 1633 1627 static int init_gpio(struct fusb302_chip *chip) ··· 1751 1747 goto destroy_workqueue; 1752 1748 } 1753 1749 1754 - ret = request_irq(chip->gpio_int_n_irq, fusb302_irq_intn, 1755 - IRQF_ONESHOT | IRQF_TRIGGER_LOW, 1756 - "fsc_interrupt_int_n", chip); 1750 + ret = devm_request_threaded_irq(dev, chip->gpio_int_n_irq, 1751 + NULL, fusb302_irq_intn, 1752 + IRQF_ONESHOT | IRQF_TRIGGER_LOW, 1753 + "fsc_interrupt_int_n", chip); 1757 1754 if (ret < 0) { 1758 1755 dev_err(dev, "cannot request IRQ for GPIO Int_N, ret=%d", ret); 1759 1756 goto tcpm_unregister_port; ··· 1779 1774 struct fusb302_chip *chip = i2c_get_clientdata(client); 1780 1775 1781 1776 disable_irq_wake(chip->gpio_int_n_irq); 1782 - free_irq(chip->gpio_int_n_irq, chip); 1783 1777 cancel_work_sync(&chip->irq_work); 1784 1778 cancel_delayed_work_sync(&chip->bc_lvl_handler); 1785 1779 tcpm_unregister_port(chip->tcpm_port);
+32 -19
drivers/usb/typec/tcpm/tcpci_maxim_core.c
··· 421 421 return IRQ_WAKE_THREAD; 422 422 } 423 423 424 - static int max_tcpci_init_alert(struct max_tcpci_chip *chip, struct i2c_client *client) 425 - { 426 - int ret; 427 - 428 - ret = devm_request_threaded_irq(chip->dev, client->irq, max_tcpci_isr, max_tcpci_irq, 429 - (IRQF_TRIGGER_LOW | IRQF_ONESHOT), dev_name(chip->dev), 430 - chip); 431 - 432 - if (ret < 0) 433 - return ret; 434 - 435 - enable_irq_wake(client->irq); 436 - return 0; 437 - } 438 - 439 424 static int max_tcpci_start_toggling(struct tcpci *tcpci, struct tcpci_data *tdata, 440 425 enum typec_cc_status cc) 441 426 { ··· 517 532 518 533 chip->port = tcpci_get_tcpm_port(chip->tcpci); 519 534 520 - ret = max_tcpci_init_alert(chip, client); 535 + ret = devm_request_threaded_irq(&client->dev, client->irq, max_tcpci_isr, max_tcpci_irq, 536 + (IRQF_TRIGGER_LOW | IRQF_ONESHOT), dev_name(chip->dev), 537 + chip); 521 538 if (ret < 0) 522 539 return dev_err_probe(&client->dev, ret, 523 540 "IRQ initialization failed\n"); ··· 531 544 return 0; 532 545 } 533 546 547 + #ifdef CONFIG_PM_SLEEP 548 + static int max_tcpci_resume(struct device *dev) 549 + { 550 + struct i2c_client *client = to_i2c_client(dev); 551 + int ret = 0; 552 + 553 + if (client->irq && device_may_wakeup(dev)) 554 + ret = disable_irq_wake(client->irq); 555 + 556 + return ret; 557 + } 558 + 559 + static int max_tcpci_suspend(struct device *dev) 560 + { 561 + struct i2c_client *client = to_i2c_client(dev); 562 + int ret = 0; 563 + 564 + if (client->irq && device_may_wakeup(dev)) 565 + ret = enable_irq_wake(client->irq); 566 + 567 + return ret; 568 + } 569 + #endif /* CONFIG_PM_SLEEP */ 570 + 571 + static SIMPLE_DEV_PM_OPS(max_tcpci_pm_ops, max_tcpci_suspend, max_tcpci_resume); 572 + 534 573 static const struct i2c_device_id max_tcpci_id[] = { 535 574 { "maxtcpc" }, 536 575 { } 537 576 }; 538 577 MODULE_DEVICE_TABLE(i2c, max_tcpci_id); 539 578 540 - #ifdef CONFIG_OF 541 579 static const struct of_device_id max_tcpci_of_match[] = { 542 580 { .compatible = "maxim,max33359", }, 543 581 {}, 544 582 }; 545 583 MODULE_DEVICE_TABLE(of, max_tcpci_of_match); 546 - #endif 547 584 548 585 static struct i2c_driver max_tcpci_i2c_driver = { 549 586 .driver = { 550 587 .name = "maxtcpc", 551 - .of_match_table = of_match_ptr(max_tcpci_of_match), 588 + .probe_type = PROBE_PREFER_ASYNCHRONOUS, 589 + .of_match_table = max_tcpci_of_match, 590 + .pm = &max_tcpci_pm_ops, 552 591 }, 553 592 .probe = max_tcpci_probe, 554 593 .id_table = max_tcpci_id,
+2
drivers/usb/typec/ucsi/Kconfig
··· 85 85 config UCSI_LENOVO_YOGA_C630 86 86 tristate "UCSI Interface Driver for Lenovo Yoga C630" 87 87 depends on EC_LENOVO_YOGA_C630 88 + depends on DRM || !DRM 89 + select DRM_AUX_HPD_BRIDGE if DRM_BRIDGE && OF 88 90 help 89 91 This driver enables UCSI support on the Lenovo Yoga C630 laptop. 90 92
+1
drivers/usb/typec/ucsi/cros_ec_ucsi.c
··· 137 137 static const struct ucsi_operations cros_ucsi_ops = { 138 138 .read_version = cros_ucsi_read_version, 139 139 .read_cci = cros_ucsi_read_cci, 140 + .poll_cci = cros_ucsi_read_cci, 140 141 .read_message_in = cros_ucsi_read_message_in, 141 142 .async_control = cros_ucsi_async_control, 142 143 .sync_control = cros_ucsi_sync_control,
+1 -1
drivers/usb/typec/ucsi/psy.c
··· 164 164 case UCSI_CONSTAT_PWR_OPMODE_DEFAULT: 165 165 /* UCSI can't tell b/w DCP/CDP or USB2/3x1/3x2 SDP chargers */ 166 166 default: 167 - val->intval = 0; 167 + val->intval = UCSI_TYPEC_DEFAULT_CURRENT * 1000; 168 168 break; 169 169 } 170 170 return 0;
-17
drivers/usb/typec/ucsi/trace.c
··· 33 33 return ucsi_cmd_strs[(cmd >= ARRAY_SIZE(ucsi_cmd_strs)) ? 0 : cmd]; 34 34 } 35 35 36 - const char *ucsi_cci_str(u32 cci) 37 - { 38 - if (UCSI_CCI_CONNECTOR(cci)) { 39 - if (cci & UCSI_CCI_ACK_COMPLETE) 40 - return "Event pending (ACK completed)"; 41 - if (cci & UCSI_CCI_COMMAND_COMPLETE) 42 - return "Event pending (command completed)"; 43 - return "Connector Change"; 44 - } 45 - if (cci & UCSI_CCI_ACK_COMPLETE) 46 - return "ACK completed"; 47 - if (cci & UCSI_CCI_COMMAND_COMPLETE) 48 - return "Command completed"; 49 - 50 - return ""; 51 - } 52 - 53 36 static const char * const ucsi_recipient_strs[] = { 54 37 [UCSI_RECIPIENT_CON] = "port", 55 38 [UCSI_RECIPIENT_SOP] = "partner",
-1
drivers/usb/typec/ucsi/trace.h
··· 10 10 #include <linux/usb/typec_altmode.h> 11 11 12 12 const char *ucsi_cmd_str(u64 raw_cmd); 13 - const char *ucsi_cci_str(u32 cci); 14 13 const char *ucsi_recipient_str(u8 recipient); 15 14 16 15 DECLARE_EVENT_CLASS(ucsi_log_command,
+3 -3
drivers/usb/typec/ucsi/ucsi.c
··· 531 531 * Update the original altmode table as some ppms may report 532 532 * multiple DP altmodes. 533 533 */ 534 - if (recipient == UCSI_RECIPIENT_CON) 535 - multi_dp = ucsi->ops->update_altmodes(ucsi, orig, updated); 534 + multi_dp = ucsi->ops->update_altmodes(ucsi, recipient, orig, updated); 536 535 537 536 /* now register altmodes */ 538 537 for (i = 0; i < max_altmodes; i++) { 539 538 memset(&desc, 0, sizeof(desc)); 540 - if (multi_dp && recipient == UCSI_RECIPIENT_CON) { 539 + if (multi_dp) { 541 540 desc.svid = updated[i].svid; 542 541 desc.vdo = updated[i].mid; 543 542 } else { ··· 1245 1246 1246 1247 if (change & UCSI_CONSTAT_POWER_DIR_CHANGE) { 1247 1248 typec_set_pwr_role(con->port, role); 1249 + ucsi_port_psy_changed(con); 1248 1250 1249 1251 /* Complete pending power role swap */ 1250 1252 if (!completion_done(&con->complete))
+7 -4
drivers/usb/typec/ucsi/ucsi.h
··· 50 50 /* Command Status and Connector Change Indication (CCI) bits */ 51 51 #define UCSI_CCI_CONNECTOR(_c_) (((_c_) & GENMASK(7, 1)) >> 1) 52 52 #define UCSI_CCI_LENGTH(_c_) (((_c_) & GENMASK(15, 8)) >> 8) 53 + #define UCSI_SET_CCI_LENGTH(_c_) ((_c_) << 8) 53 54 #define UCSI_CCI_NOT_SUPPORTED BIT(25) 54 55 #define UCSI_CCI_CANCEL_COMPLETE BIT(26) 55 56 #define UCSI_CCI_RESET_COMPLETE BIT(27) ··· 83 82 int (*sync_control)(struct ucsi *ucsi, u64 command, u32 *cci, 84 83 void *data, size_t size); 85 84 int (*async_control)(struct ucsi *ucsi, u64 command); 86 - bool (*update_altmodes)(struct ucsi *ucsi, struct ucsi_altmode *orig, 85 + bool (*update_altmodes)(struct ucsi *ucsi, u8 recipient, 86 + struct ucsi_altmode *orig, 87 87 struct ucsi_altmode *updated); 88 88 void (*update_connector)(struct ucsi_connector *con); 89 89 void (*connector_status)(struct ucsi_connector *con); ··· 483 481 #define UCSI_MAX_SVID 5 484 482 #define UCSI_MAX_ALTMODES (UCSI_MAX_SVID * 6) 485 483 486 - #define UCSI_TYPEC_VSAFE5V 5000 487 - #define UCSI_TYPEC_1_5_CURRENT 1500 488 - #define UCSI_TYPEC_3_0_CURRENT 3000 484 + #define UCSI_TYPEC_VSAFE5V 5000 485 + #define UCSI_TYPEC_DEFAULT_CURRENT 100 486 + #define UCSI_TYPEC_1_5_CURRENT 1500 487 + #define UCSI_TYPEC_3_0_CURRENT 3000 489 488 490 489 struct ucsi_connector { 491 490 int num;
+4
drivers/usb/typec/ucsi/ucsi_ccg.c
··· 394 394 } 395 395 396 396 static bool ucsi_ccg_update_altmodes(struct ucsi *ucsi, 397 + u8 recipient, 397 398 struct ucsi_altmode *orig, 398 399 struct ucsi_altmode *updated) 399 400 { ··· 402 401 struct ucsi_ccg_altmode *alt, *new_alt; 403 402 int i, j, k = 0; 404 403 bool found = false; 404 + 405 + if (recipient != UCSI_RECIPIENT_CON) 406 + return false; 405 407 406 408 alt = uc->orig; 407 409 new_alt = uc->updated;
+172 -4
drivers/usb/typec/ucsi/ucsi_yoga_c630.c
··· 7 7 */ 8 8 #include <linux/auxiliary_bus.h> 9 9 #include <linux/bitops.h> 10 + #include <linux/bitfield.h> 10 11 #include <linux/completion.h> 11 12 #include <linux/container_of.h> 12 13 #include <linux/module.h> 13 14 #include <linux/notifier.h> 15 + #include <linux/of.h> 16 + #include <linux/property.h> 14 17 #include <linux/string.h> 15 18 #include <linux/platform_data/lenovo-yoga-c630.h> 19 + #include <linux/usb/typec_dp.h> 20 + 21 + #include <drm/bridge/aux-bridge.h> 16 22 17 23 #include "ucsi.h" 24 + 25 + #define LENOVO_EC_USB_MUX 0x08 26 + 27 + #define USB_MUX_MUXC GENMASK(1, 0) 28 + #define USB_MUX_CCST GENMASK(3, 2) 29 + #define USB_MUX_DPPN GENMASK(7, 4) 30 + #define USB_MUX_HPDS BIT(8) 31 + #define USB_MUX_HSFL GENMASK(11, 9) 18 32 19 33 struct yoga_c630_ucsi { 20 34 struct yoga_c630_ec *ec; 21 35 struct ucsi *ucsi; 36 + struct auxiliary_device *bridge; 22 37 struct notifier_block nb; 23 38 u16 version; 24 39 }; ··· 86 71 return yoga_c630_ec_ucsi_write(uec->ec, (u8*)&command); 87 72 } 88 73 74 + static int yoga_c630_ucsi_sync_control(struct ucsi *ucsi, 75 + u64 command, 76 + u32 *cci, 77 + void *data, size_t size) 78 + { 79 + int ret; 80 + 81 + /* 82 + * EC doesn't return connector's DP mode even though it is supported. 83 + * Fake it. 84 + */ 85 + if (UCSI_COMMAND(command) == UCSI_GET_ALTERNATE_MODES && 86 + UCSI_GET_ALTMODE_GET_CONNECTOR_NUMBER(command) == 1 && 87 + UCSI_ALTMODE_RECIPIENT(command) == UCSI_RECIPIENT_CON && 88 + UCSI_ALTMODE_OFFSET(command) == 0) { 89 + static const struct ucsi_altmode alt = { 90 + .svid = USB_TYPEC_DP_SID, 91 + .mid = USB_TYPEC_DP_MODE, 92 + }; 93 + 94 + dev_dbg(ucsi->dev, "faking DP altmode for con1\n"); 95 + memset(data, 0, size); 96 + memcpy(data, &alt, min(sizeof(alt), size)); 97 + *cci = UCSI_CCI_COMMAND_COMPLETE | UCSI_SET_CCI_LENGTH(sizeof(alt)); 98 + return 0; 99 + } 100 + 101 + /* 102 + * EC can return AltModes present on CON1 (port0, right) for CON2 103 + * (port1, left) too. Ignore all requests going to CON2 (it doesn't 104 + * support DP anyway). 105 + */ 106 + if (UCSI_COMMAND(command) == UCSI_GET_ALTERNATE_MODES && 107 + UCSI_GET_ALTMODE_GET_CONNECTOR_NUMBER(command) == 2) { 108 + dev_dbg(ucsi->dev, "ignoring altmodes for con2\n"); 109 + memset(data, 0, size); 110 + *cci = UCSI_CCI_COMMAND_COMPLETE; 111 + return 0; 112 + } 113 + 114 + ret = ucsi_sync_control_common(ucsi, command, cci, data, size); 115 + if (ret < 0) 116 + return ret; 117 + 118 + /* UCSI_GET_CURRENT_CAM is off-by-one on all ports */ 119 + if (UCSI_COMMAND(command) == UCSI_GET_CURRENT_CAM && data) 120 + ((u8 *)data)[0]--; 121 + 122 + return ret; 123 + } 124 + 125 + static bool yoga_c630_ucsi_update_altmodes(struct ucsi *ucsi, 126 + u8 recipient, 127 + struct ucsi_altmode *orig, 128 + struct ucsi_altmode *updated) 129 + { 130 + int i; 131 + 132 + if (orig[0].svid == 0 || recipient != UCSI_RECIPIENT_SOP) 133 + return false; 134 + 135 + /* EC is nice and repeats altmodes again and again. Ignore copies. */ 136 + for (i = 1; i < UCSI_MAX_ALTMODES; i++) { 137 + if (orig[i].svid == orig[0].svid) { 138 + dev_dbg(ucsi->dev, "Found duplicate altmodes, starting from %d\n", i); 139 + memset(&orig[i], 0, (UCSI_MAX_ALTMODES - i) * sizeof(*orig)); 140 + break; 141 + } 142 + } 143 + 144 + return false; 145 + } 146 + 147 + static void yoga_c630_ucsi_update_connector(struct ucsi_connector *con) 148 + { 149 + if (con->num == 1) 150 + con->typec_cap.orientation_aware = true; 151 + } 152 + 89 153 static const struct ucsi_operations yoga_c630_ucsi_ops = { 90 154 .read_version = yoga_c630_ucsi_read_version, 91 155 .read_cci = yoga_c630_ucsi_read_cci, 92 156 .poll_cci = yoga_c630_ucsi_read_cci, 93 157 .read_message_in = yoga_c630_ucsi_read_message_in, 94 - .sync_control = ucsi_sync_control_common, 158 + .sync_control = yoga_c630_ucsi_sync_control, 95 159 .async_control = yoga_c630_ucsi_async_control, 160 + .update_altmodes = yoga_c630_ucsi_update_altmodes, 161 + .update_connector = yoga_c630_ucsi_update_connector, 96 162 }; 163 + 164 + static void yoga_c630_ucsi_read_port0_status(struct yoga_c630_ucsi *uec) 165 + { 166 + int val; 167 + unsigned int muxc, ccst, dppn, hpds, hsfl; 168 + 169 + val = yoga_c630_ec_read16(uec->ec, LENOVO_EC_USB_MUX); 170 + 171 + muxc = FIELD_GET(USB_MUX_MUXC, val); 172 + ccst = FIELD_GET(USB_MUX_CCST, val); 173 + dppn = FIELD_GET(USB_MUX_DPPN, val); 174 + hpds = FIELD_GET(USB_MUX_HPDS, val); 175 + hsfl = FIELD_GET(USB_MUX_HSFL, val); 176 + 177 + dev_dbg(uec->ucsi->dev, " mux %04x (muxc %d ccst %d dppn %d hpds %d hsfl %d)\n", 178 + val, 179 + muxc, ccst, dppn, hpds, hsfl); 180 + 181 + if (uec->ucsi->connector && uec->ucsi->connector[0].port) 182 + typec_set_orientation(uec->ucsi->connector[0].port, 183 + ccst == 1 ? 184 + TYPEC_ORIENTATION_REVERSE : 185 + TYPEC_ORIENTATION_NORMAL); 186 + 187 + if (uec->bridge) 188 + drm_aux_hpd_bridge_notify(&uec->bridge->dev, 189 + dppn != 0 ? 190 + connector_status_connected : 191 + connector_status_disconnected); 192 + 193 + } 97 194 98 195 static int yoga_c630_ucsi_notify(struct notifier_block *nb, 99 196 unsigned long action, void *data) ··· 217 90 switch (action) { 218 91 case LENOVO_EC_EVENT_USB: 219 92 case LENOVO_EC_EVENT_HPD: 93 + yoga_c630_ucsi_read_port0_status(uec); 220 94 ucsi_connector_change(uec->ucsi, 1); 221 95 return NOTIFY_OK; 222 96 ··· 249 121 uec->ec = ec; 250 122 uec->nb.notifier_call = yoga_c630_ucsi_notify; 251 123 124 + device_for_each_child_node_scoped(&adev->dev, fwnode) { 125 + u32 port; 126 + 127 + ret = fwnode_property_read_u32(fwnode, "reg", &port); 128 + if (ret < 0) { 129 + dev_err(&adev->dev, "missing reg property of %pfwP\n", fwnode); 130 + return ret; 131 + } 132 + 133 + /* DP is only on port0 */ 134 + if (port != 0) 135 + continue; 136 + 137 + uec->bridge = devm_drm_dp_hpd_bridge_alloc(&adev->dev, to_of_node(fwnode)); 138 + if (IS_ERR(uec->bridge)) 139 + return PTR_ERR(uec->bridge); 140 + } 141 + 252 142 uec->ucsi = ucsi_create(&adev->dev, &yoga_c630_ucsi_ops); 253 143 if (IS_ERR(uec->ucsi)) 254 144 return PTR_ERR(uec->ucsi); ··· 279 133 280 134 ret = yoga_c630_ec_register_notify(ec, &uec->nb); 281 135 if (ret) 282 - return ret; 136 + goto err_destroy; 283 137 284 - return ucsi_register(uec->ucsi); 138 + ret = ucsi_register(uec->ucsi); 139 + if (ret) 140 + goto err_unregister; 141 + 142 + if (uec->bridge) { 143 + ret = devm_drm_dp_hpd_bridge_add(&adev->dev, uec->bridge); 144 + if (ret) 145 + goto err_ucsi_unregister; 146 + } 147 + 148 + return 0; 149 + 150 + err_ucsi_unregister: 151 + ucsi_unregister(uec->ucsi); 152 + 153 + err_unregister: 154 + yoga_c630_ec_unregister_notify(uec->ec, &uec->nb); 155 + 156 + err_destroy: 157 + ucsi_destroy(uec->ucsi); 158 + 159 + return ret; 285 160 } 286 161 287 162 static void yoga_c630_ucsi_remove(struct auxiliary_device *adev) 288 163 { 289 164 struct yoga_c630_ucsi *uec = auxiliary_get_drvdata(adev); 290 165 291 - yoga_c630_ec_unregister_notify(uec->ec, &uec->nb); 292 166 ucsi_unregister(uec->ucsi); 167 + yoga_c630_ec_unregister_notify(uec->ec, &uec->nb); 168 + ucsi_destroy(uec->ucsi); 293 169 } 294 170 295 171 static const struct auxiliary_device_id yoga_c630_ucsi_id_table[] = {
-1
include/linux/fsl_devices.h
··· 118 118 #define FSL_USB2_PORT0_ENABLED 0x00000001 119 119 #define FSL_USB2_PORT1_ENABLED 0x00000002 120 120 121 - #define FLS_USB2_WORKAROUND_ENGCM09152 (1 << 0) 122 121 123 122 struct spi_device; 124 123
+15 -1
include/linux/usb.h
··· 1455 1455 * @sg: scatter gather buffer list, the buffer size of each element in 1456 1456 * the list (except the last) must be divisible by the endpoint's 1457 1457 * max packet size if no_sg_constraint isn't set in 'struct usb_bus' 1458 + * @sgt: used to hold a scatter gather table returned by usb_alloc_noncoherent(), 1459 + * which describes the allocated non-coherent and possibly non-contiguous 1460 + * memory and is guaranteed to have 1 single DMA mapped segment. The 1461 + * allocated memory needs to be freed by usb_free_noncoherent(). 1458 1462 * @num_mapped_sgs: (internal) number of mapped sg entries 1459 1463 * @num_sgs: number of entries in the sg list 1460 1464 * @transfer_buffer_length: How big is transfer_buffer. The transfer may ··· 1625 1621 void *transfer_buffer; /* (in) associated data buffer */ 1626 1622 dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */ 1627 1623 struct scatterlist *sg; /* (in) scatter gather buffer list */ 1624 + struct sg_table *sgt; /* (in) scatter gather table for noncoherent buffer */ 1628 1625 int num_mapped_sgs; /* (internal) mapped sg entries */ 1629 1626 int num_sgs; /* (in) number of entries in the sg list */ 1630 1627 u32 transfer_buffer_length; /* (in) data buffer length */ ··· 1787 1782 extern void usb_kill_anchored_urbs(struct usb_anchor *anchor); 1788 1783 extern void usb_poison_anchored_urbs(struct usb_anchor *anchor); 1789 1784 extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor); 1790 - extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor); 1791 1785 extern void usb_anchor_suspend_wakeups(struct usb_anchor *anchor); 1792 1786 extern void usb_anchor_resume_wakeups(struct usb_anchor *anchor); 1793 1787 extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor); ··· 1830 1826 gfp_t mem_flags, dma_addr_t *dma); 1831 1827 void usb_free_coherent(struct usb_device *dev, size_t size, 1832 1828 void *addr, dma_addr_t dma); 1829 + 1830 + enum dma_data_direction; 1831 + 1832 + void *usb_alloc_noncoherent(struct usb_device *dev, size_t size, 1833 + gfp_t mem_flags, dma_addr_t *dma, 1834 + enum dma_data_direction dir, 1835 + struct sg_table **table); 1836 + void usb_free_noncoherent(struct usb_device *dev, size_t size, 1837 + void *addr, enum dma_data_direction dir, 1838 + struct sg_table *table); 1833 1839 1834 1840 /*-------------------------------------------------------------------* 1835 1841 * SYNCHRONOUS CALL SUPPORT *
+1
include/linux/usb/chipidea.h
··· 72 72 #define CI_HDRC_IMX_HSIC_ACTIVE_EVENT 2 73 73 #define CI_HDRC_IMX_HSIC_SUSPEND_EVENT 3 74 74 #define CI_HDRC_CONTROLLER_VBUS_EVENT 4 75 + #define CI_HDRC_CONTROLLER_PULLUP_EVENT 5 75 76 int (*notify_event) (struct ci_hdrc *ci, unsigned event); 76 77 struct regulator *reg_vbus; 77 78 struct usb_otg_caps ci_otg_caps;
-3
include/linux/usb/composite.h
··· 339 339 struct usb_configuration *, 340 340 int (*)(struct usb_configuration *)); 341 341 342 - void usb_remove_config(struct usb_composite_dev *, 343 - struct usb_configuration *); 344 - 345 342 /* predefined index for usb_composite_driver */ 346 343 enum { 347 344 USB_GADGET_MANUFACTURER_IDX = 0,
-4
include/linux/usb/gadget.h
··· 860 860 int usb_descriptor_fillbuf(void *, unsigned, 861 861 const struct usb_descriptor_header **); 862 862 863 - /* build config descriptor from single descriptor vector */ 864 - int usb_gadget_config_buf(const struct usb_config_descriptor *config, 865 - void *buf, unsigned buflen, const struct usb_descriptor_header **desc); 866 - 867 863 /* copy a NULL-terminated vector of descriptors */ 868 864 struct usb_descriptor_header **usb_copy_descriptors( 869 865 struct usb_descriptor_header **);
-9
include/linux/usb/tegra_usb_phy.h
··· 80 80 bool powered_on; 81 81 }; 82 82 83 - void tegra_usb_phy_preresume(struct usb_phy *phy); 84 - 85 - void tegra_usb_phy_postresume(struct usb_phy *phy); 86 - 87 - void tegra_ehci_phy_restore_start(struct usb_phy *phy, 88 - enum tegra_usb_phy_port_speed port_speed); 89 - 90 - void tegra_ehci_phy_restore_end(struct usb_phy *phy); 91 - 92 83 #endif /* __TEGRA_USB_PHY_H */