mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
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 ...
This commit is contained in:
@@ -62,3 +62,13 @@ Description:
|
||||
by VESA DisplayPort Alt Mode on USB Type-C Standard.
|
||||
- 0 when HPD’s logical state is low (HPD_Low) as defined by
|
||||
VESA DisplayPort Alt Mode on USB Type-C Standard.
|
||||
|
||||
What: /sys/bus/typec/devices/.../displayport/irq_hpd
|
||||
Date: June 2025
|
||||
Contact: RD Babiera <rdbabiera@google.com>
|
||||
Description:
|
||||
IRQ_HPD events are sent over the USB PD protocol in Status Update and
|
||||
Attention messages. IRQ_HPD can only be asserted when HPD is high,
|
||||
and is asserted when an IRQ_HPD has been issued since the last Status
|
||||
Update. This is a read only node that returns the number of IRQ events
|
||||
raised in the driver's lifetime.
|
||||
|
||||
@@ -23,6 +23,7 @@ properties:
|
||||
- nvidia,tegra30-udc
|
||||
- nvidia,tegra114-udc
|
||||
- nvidia,tegra124-udc
|
||||
- nxp,s32g2-usb
|
||||
- qcom,ci-hdrc
|
||||
- items:
|
||||
- enum:
|
||||
@@ -37,6 +38,10 @@ properties:
|
||||
- enum:
|
||||
- nuvoton,npcm845-udc
|
||||
- const: nuvoton,npcm750-udc
|
||||
- items:
|
||||
- enum:
|
||||
- nxp,s32g3-usb
|
||||
- const: nxp,s32g2-usb
|
||||
|
||||
clocks:
|
||||
minItems: 1
|
||||
|
||||
@@ -59,7 +59,7 @@ properties:
|
||||
- const: amcc,dwc-otg
|
||||
- const: apm,apm82181-dwc-otg
|
||||
- const: snps,dwc2
|
||||
- const: sophgo,cv1800-usb
|
||||
- const: sophgo,cv1800b-usb
|
||||
- const: st,stm32f4x9-fsotg
|
||||
- const: st,stm32f4x9-hsotg
|
||||
- const: st,stm32f7-hsotg
|
||||
|
||||
@@ -21,6 +21,8 @@ properties:
|
||||
- fsl,imx53-usbmisc
|
||||
- fsl,imx6q-usbmisc
|
||||
- fsl,vf610-usbmisc
|
||||
- nxp,s32g2-usbmisc
|
||||
- nxp,s32g3-usbmisc
|
||||
- items:
|
||||
- enum:
|
||||
- fsl,imx6ul-usbmisc
|
||||
|
||||
@@ -26,19 +26,26 @@ properties:
|
||||
description:
|
||||
The regulator that provides 3.3V or 5.0V core power to the hub.
|
||||
|
||||
peer-hub:
|
||||
$ref: /schemas/types.yaml#/definitions/phandle
|
||||
description:
|
||||
For onboard hub controllers that support USB 3.x and USB 2.0 hubs
|
||||
with shared resets and power supplies, this property is used to identify
|
||||
the hubs with which these are shared.
|
||||
peer-hub: true
|
||||
|
||||
ports:
|
||||
$ref: /schemas/graph.yaml#/properties/ports
|
||||
|
||||
patternProperties:
|
||||
'^port@':
|
||||
$ref: /schemas/graph.yaml#/properties/port
|
||||
|
||||
properties:
|
||||
reg:
|
||||
minimum: 1
|
||||
maximum: 4
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
|
||||
allOf:
|
||||
- $ref: usb-device.yaml#
|
||||
- $ref: usb-hub.yaml#
|
||||
- if:
|
||||
properties:
|
||||
compatible:
|
||||
@@ -62,13 +69,6 @@ allOf:
|
||||
peer-hub: true
|
||||
vdd-supply: true
|
||||
|
||||
patternProperties:
|
||||
"^.*@[0-9a-f]{1,2}$":
|
||||
description: The hard wired USB devices
|
||||
type: object
|
||||
$ref: /schemas/usb/usb-device.yaml
|
||||
additionalProperties: true
|
||||
|
||||
unevaluatedProperties: false
|
||||
|
||||
examples:
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
* NXP LPC32xx SoC USB Device Controller (UDC)
|
||||
|
||||
Required properties:
|
||||
- compatible: Must be "nxp,lpc3220-udc"
|
||||
- reg: Physical base address of the controller and length of memory mapped
|
||||
region.
|
||||
- interrupts: The USB interrupts:
|
||||
* USB Device Low Priority Interrupt
|
||||
* USB Device High Priority Interrupt
|
||||
* USB Device DMA Interrupt
|
||||
* External USB Transceiver Interrupt (OTG ATX)
|
||||
- transceiver: phandle of the associated ISP1301 device - this is necessary for
|
||||
the UDC controller for connecting to the USB physical layer
|
||||
|
||||
Example:
|
||||
|
||||
isp1301: usb-transceiver@2c {
|
||||
compatible = "nxp,isp1301";
|
||||
reg = <0x2c>;
|
||||
};
|
||||
|
||||
usbd@31020000 {
|
||||
compatible = "nxp,lpc3220-udc";
|
||||
reg = <0x31020000 0x300>;
|
||||
interrupt-parent = <&mic>;
|
||||
interrupts = <0x3d 0>, <0x3e 0>, <0x3c 0>, <0x3a 0>;
|
||||
transceiver = <&isp1301>;
|
||||
};
|
||||
@@ -0,0 +1,50 @@
|
||||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/usb/nxp,lpc3220-udc.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: NXP LPC32xx SoC USB Device Controller (UDC)
|
||||
|
||||
maintainers:
|
||||
- Frank Li <Frank.Li@nxp.com>
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
const: nxp,lpc3220-udc
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
interrupts:
|
||||
items:
|
||||
- description: USB Device Low Priority Interrupt
|
||||
- description: USB Device High Priority Interrupt
|
||||
- description: USB Device DMA Interrupt
|
||||
- description: External USB Transceiver Interrupt (OTG ATX)
|
||||
|
||||
clocks:
|
||||
maxItems: 1
|
||||
|
||||
transceiver:
|
||||
description:
|
||||
phandle of the associated ISP1301 device - this is necessary for
|
||||
the UDC controller for connecting to the USB physical layer
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
- interrupts
|
||||
- transceiver
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
usbd@31020000 {
|
||||
compatible = "nxp,lpc3220-udc";
|
||||
reg = <0x31020000 0x300>;
|
||||
interrupt-parent = <&mic>;
|
||||
interrupts = <0x3d 0>, <0x3e 0>, <0x3c 0>, <0x3a 0>;
|
||||
transceiver = <&isp1301>;
|
||||
};
|
||||
@@ -27,6 +27,7 @@ properties:
|
||||
- renesas,usbhs-r9a07g044 # RZ/G2{L,LC}
|
||||
- renesas,usbhs-r9a07g054 # RZ/V2L
|
||||
- renesas,usbhs-r9a08g045 # RZ/G3S
|
||||
- renesas,usbhs-r9a09g056 # RZ/V2N
|
||||
- renesas,usbhs-r9a09g057 # RZ/V2H(P)
|
||||
- const: renesas,rzg2l-usbhs
|
||||
|
||||
|
||||
@@ -45,17 +45,6 @@ This function kills all URBs associated with an anchor. The URBs
|
||||
are called in the reverse temporal order they were submitted.
|
||||
This way no data can be reordered.
|
||||
|
||||
:c:func:`usb_unlink_anchored_urbs`
|
||||
----------------------------------
|
||||
|
||||
|
||||
This function unlinks all URBs associated with an anchor. The URBs
|
||||
are processed in the reverse temporal order they were submitted.
|
||||
This is similar to :c:func:`usb_kill_anchored_urbs`, but it will not sleep.
|
||||
Therefore no guarantee is made that the URBs have been unlinked when
|
||||
the call returns. They may be unlinked later but will be unlinked in
|
||||
finite time.
|
||||
|
||||
:c:func:`usb_scuttle_anchored_urbs`
|
||||
-----------------------------------
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ Then the strings can be specified::
|
||||
|
||||
Further custom string descriptors can be created as directories within the
|
||||
language's directory, with the string text being written to the "s" attribute
|
||||
within the string's directory:
|
||||
within the string's directory::
|
||||
|
||||
$ mkdir strings/0x409/xu.0
|
||||
$ echo <string text> > strings/0x409/xu.0/s
|
||||
@@ -104,9 +104,9 @@ string descriptors to associate those strings with class descriptors.
|
||||
------------------------------
|
||||
|
||||
Each gadget will consist of a number of configurations, their corresponding
|
||||
directories must be created:
|
||||
directories must be created::
|
||||
|
||||
$ mkdir configs/<name>.<number>
|
||||
$ mkdir configs/<name>.<number>
|
||||
|
||||
where <name> can be any string which is legal in a filesystem and the
|
||||
<number> is the configuration's number, e.g.::
|
||||
@@ -246,7 +246,7 @@ a symlink to a function being removed from the configuration, e.g.::
|
||||
...
|
||||
...
|
||||
|
||||
Remove strings directories in configurations:
|
||||
Remove strings directories in configurations::
|
||||
|
||||
$ rmdir configs/<config name>.<number>/strings/<lang>
|
||||
|
||||
@@ -270,7 +270,7 @@ e.g.::
|
||||
...
|
||||
...
|
||||
|
||||
Remove functions (function modules are not unloaded, though):
|
||||
Remove functions (function modules are not unloaded, though)::
|
||||
|
||||
$ rmdir functions/<name>.<instance name>
|
||||
|
||||
@@ -369,18 +369,18 @@ For more information on configfs please see
|
||||
The concepts described above translate to USB gadgets like this:
|
||||
|
||||
1. A gadget has its config group, which has some attributes (idVendor,
|
||||
idProduct etc) and default sub-groups (configs, functions, strings).
|
||||
Writing to the attributes causes the information to be stored in
|
||||
appropriate locations. In the configs, functions and strings sub-groups
|
||||
a user can create their sub-groups to represent configurations, functions,
|
||||
and groups of strings in a given language.
|
||||
idProduct etc) and default sub-groups (configs, functions, strings).
|
||||
Writing to the attributes causes the information to be stored in appropriate
|
||||
locations. In the configs, functions and strings sub-groups a user can
|
||||
create their sub-groups to represent configurations, functions, and groups
|
||||
of strings in a given language.
|
||||
|
||||
2. The user creates configurations and functions, in the configurations
|
||||
creates symbolic links to functions. This information is used when the
|
||||
gadget's UDC attribute is written to, which means binding the gadget
|
||||
to the UDC. The code in drivers/usb/gadget/configfs.c iterates over
|
||||
all configurations, and in each configuration it iterates over all
|
||||
functions and binds them. This way the whole gadget is bound.
|
||||
creates symbolic links to functions. This information is used when the
|
||||
gadget's UDC attribute is written to, which means binding the gadget to the
|
||||
UDC. The code in drivers/usb/gadget/configfs.c iterates over all
|
||||
configurations, and in each configuration it iterates over all functions and
|
||||
binds them. This way the whole gadget is bound.
|
||||
|
||||
3. The file drivers/usb/gadget/configfs.c contains code for
|
||||
|
||||
@@ -388,13 +388,12 @@ functions and binds them. This way the whole gadget is bound.
|
||||
- gadget's default groups (configs, functions, strings)
|
||||
- associating functions with configurations (symlinks)
|
||||
|
||||
4. Each USB function naturally has its own view of what it wants
|
||||
configured, so config_groups for particular functions are defined
|
||||
in the functions implementation files drivers/usb/gadget/f_*.c.
|
||||
4. Each USB function naturally has its own view of what it wants configured, so
|
||||
config_groups for particular functions are defined in the functions
|
||||
implementation files drivers/usb/gadget/f_*.c.
|
||||
|
||||
5. Function's code is written in such a way that it uses
|
||||
|
||||
usb_get_function_instance(), which, in turn, calls request_module.
|
||||
So, provided that modprobe works, modules for particular functions
|
||||
are loaded automatically. Please note that the converse is not true:
|
||||
after a gadget is disabled and torn down, the modules remain loaded.
|
||||
usb_get_function_instance(), which, in turn, calls request_module. So,
|
||||
provided that modprobe works, modules for particular functions are loaded
|
||||
automatically. Please note that the converse is not true: after a gadget is
|
||||
disabled and torn down, the modules remain loaded.
|
||||
|
||||
@@ -376,6 +376,29 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
usbmisc: usbmisc@44064200 {
|
||||
#index-cells = <1>;
|
||||
compatible = "nxp,s32g2-usbmisc";
|
||||
reg = <0x44064200 0x200>;
|
||||
};
|
||||
|
||||
usbotg: usb@44064000 {
|
||||
compatible = "nxp,s32g2-usb";
|
||||
reg = <0x44064000 0x200>;
|
||||
interrupt-parent = <&gic>;
|
||||
interrupts = <GIC_SPI 211 IRQ_TYPE_LEVEL_HIGH>, /* OTG Core */
|
||||
<GIC_SPI 212 IRQ_TYPE_LEVEL_HIGH>; /* OTG Wakeup */
|
||||
clocks = <&clks 94>, <&clks 95>;
|
||||
fsl,usbmisc = <&usbmisc 0>;
|
||||
ahb-burst-config = <0x3>;
|
||||
tx-burst-size-dword = <0x10>;
|
||||
rx-burst-size-dword = <0x10>;
|
||||
phy_type = "ulpi";
|
||||
dr_mode = "host";
|
||||
maximum-speed = "high-speed";
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
i2c0: i2c@401e4000 {
|
||||
compatible = "nxp,s32g2-i2c";
|
||||
reg = <0x401e4000 0x1000>;
|
||||
|
||||
@@ -435,6 +435,29 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
usbmisc: usbmisc@44064200 {
|
||||
#index-cells = <1>;
|
||||
compatible = "nxp,s32g3-usbmisc";
|
||||
reg = <0x44064200 0x200>;
|
||||
};
|
||||
|
||||
usbotg: usb@44064000 {
|
||||
compatible = "nxp,s32g3-usb", "nxp,s32g2-usb";
|
||||
reg = <0x44064000 0x200>;
|
||||
interrupt-parent = <&gic>;
|
||||
interrupts = <GIC_SPI 211 IRQ_TYPE_LEVEL_HIGH>, /* OTG Core */
|
||||
<GIC_SPI 212 IRQ_TYPE_LEVEL_HIGH>; /* OTG Wakeup */
|
||||
clocks = <&clks 94>, <&clks 95>;
|
||||
fsl,usbmisc = <&usbmisc 0>;
|
||||
ahb-burst-config = <0x3>;
|
||||
tx-burst-size-dword = <0x10>;
|
||||
rx-burst-size-dword = <0x10>;
|
||||
phy_type = "ulpi";
|
||||
dr_mode = "host";
|
||||
maximum-speed = "high-speed";
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
i2c0: i2c@401e4000 {
|
||||
compatible = "nxp,s32g3-i2c",
|
||||
"nxp,s32g2-i2c";
|
||||
|
||||
@@ -232,10 +232,6 @@ static int stk1160_start_streaming(struct stk1160 *dev)
|
||||
|
||||
/* submit urbs and enables IRQ */
|
||||
for (i = 0; i < dev->isoc_ctl.num_bufs; i++) {
|
||||
struct stk1160_urb *stk_urb = &dev->isoc_ctl.urb_ctl[i];
|
||||
|
||||
dma_sync_sgtable_for_device(stk1160_get_dmadev(dev), stk_urb->sgt,
|
||||
DMA_FROM_DEVICE);
|
||||
rc = usb_submit_urb(dev->isoc_ctl.urb_ctl[i].urb, GFP_KERNEL);
|
||||
if (rc) {
|
||||
stk1160_err("cannot submit urb[%d] (%d)\n", i, rc);
|
||||
|
||||
@@ -298,9 +298,7 @@ static void stk1160_process_isoc(struct stk1160 *dev, struct urb *urb)
|
||||
static void stk1160_isoc_irq(struct urb *urb)
|
||||
{
|
||||
int i, rc;
|
||||
struct stk1160_urb *stk_urb = urb->context;
|
||||
struct stk1160 *dev = stk_urb->dev;
|
||||
struct device *dma_dev = stk1160_get_dmadev(dev);
|
||||
struct stk1160 *dev = urb->context;
|
||||
|
||||
switch (urb->status) {
|
||||
case 0:
|
||||
@@ -315,10 +313,6 @@ static void stk1160_isoc_irq(struct urb *urb)
|
||||
return;
|
||||
}
|
||||
|
||||
invalidate_kernel_vmap_range(stk_urb->transfer_buffer,
|
||||
urb->transfer_buffer_length);
|
||||
dma_sync_sgtable_for_cpu(dma_dev, stk_urb->sgt, DMA_FROM_DEVICE);
|
||||
|
||||
stk1160_process_isoc(dev, urb);
|
||||
|
||||
/* Reset urb buffers */
|
||||
@@ -327,7 +321,6 @@ static void stk1160_isoc_irq(struct urb *urb)
|
||||
urb->iso_frame_desc[i].actual_length = 0;
|
||||
}
|
||||
|
||||
dma_sync_sgtable_for_device(dma_dev, stk_urb->sgt, DMA_FROM_DEVICE);
|
||||
rc = usb_submit_urb(urb, GFP_ATOMIC);
|
||||
if (rc)
|
||||
stk1160_err("urb re-submit failed (%d)\n", rc);
|
||||
@@ -365,11 +358,9 @@ void stk1160_cancel_isoc(struct stk1160 *dev)
|
||||
|
||||
static void stk_free_urb(struct stk1160 *dev, struct stk1160_urb *stk_urb)
|
||||
{
|
||||
struct device *dma_dev = stk1160_get_dmadev(dev);
|
||||
|
||||
dma_vunmap_noncontiguous(dma_dev, stk_urb->transfer_buffer);
|
||||
dma_free_noncontiguous(dma_dev, stk_urb->urb->transfer_buffer_length,
|
||||
stk_urb->sgt, DMA_FROM_DEVICE);
|
||||
usb_free_noncoherent(dev->udev, stk_urb->urb->transfer_buffer_length,
|
||||
stk_urb->transfer_buffer, DMA_FROM_DEVICE,
|
||||
stk_urb->sgt);
|
||||
usb_free_urb(stk_urb->urb);
|
||||
|
||||
stk_urb->transfer_buffer = NULL;
|
||||
@@ -410,32 +401,19 @@ void stk1160_uninit_isoc(struct stk1160 *dev)
|
||||
static int stk1160_fill_urb(struct stk1160 *dev, struct stk1160_urb *stk_urb,
|
||||
int sb_size, int max_packets)
|
||||
{
|
||||
struct device *dma_dev = stk1160_get_dmadev(dev);
|
||||
|
||||
stk_urb->urb = usb_alloc_urb(max_packets, GFP_KERNEL);
|
||||
if (!stk_urb->urb)
|
||||
return -ENOMEM;
|
||||
stk_urb->sgt = dma_alloc_noncontiguous(dma_dev, sb_size,
|
||||
DMA_FROM_DEVICE, GFP_KERNEL, 0);
|
||||
|
||||
/*
|
||||
* If the buffer allocation failed, we exit but return 0 since
|
||||
* we allow the driver working with less buffers
|
||||
*/
|
||||
if (!stk_urb->sgt)
|
||||
stk_urb->transfer_buffer = usb_alloc_noncoherent(dev->udev, sb_size,
|
||||
GFP_KERNEL, &stk_urb->dma,
|
||||
DMA_FROM_DEVICE, &stk_urb->sgt);
|
||||
if (!stk_urb->transfer_buffer)
|
||||
goto free_urb;
|
||||
|
||||
stk_urb->transfer_buffer = dma_vmap_noncontiguous(dma_dev, sb_size,
|
||||
stk_urb->sgt);
|
||||
if (!stk_urb->transfer_buffer)
|
||||
goto free_sgt;
|
||||
|
||||
stk_urb->dma = stk_urb->sgt->sgl->dma_address;
|
||||
stk_urb->dev = dev;
|
||||
return 0;
|
||||
free_sgt:
|
||||
dma_free_noncontiguous(dma_dev, sb_size, stk_urb->sgt, DMA_FROM_DEVICE);
|
||||
stk_urb->sgt = NULL;
|
||||
|
||||
free_urb:
|
||||
usb_free_urb(stk_urb->urb);
|
||||
stk_urb->urb = NULL;
|
||||
@@ -494,12 +472,13 @@ int stk1160_alloc_isoc(struct stk1160 *dev)
|
||||
urb->transfer_buffer = dev->isoc_ctl.urb_ctl[i].transfer_buffer;
|
||||
urb->transfer_buffer_length = sb_size;
|
||||
urb->complete = stk1160_isoc_irq;
|
||||
urb->context = &dev->isoc_ctl.urb_ctl[i];
|
||||
urb->context = dev;
|
||||
urb->interval = 1;
|
||||
urb->start_frame = 0;
|
||||
urb->number_of_packets = max_packets;
|
||||
urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP;
|
||||
urb->transfer_dma = dev->isoc_ctl.urb_ctl[i].dma;
|
||||
urb->sgt = dev->isoc_ctl.urb_ctl[i].sgt;
|
||||
|
||||
k = 0;
|
||||
for (j = 0; j < max_packets; j++) {
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
#include <media/videobuf2-v4l2.h>
|
||||
#include <media/v4l2-device.h>
|
||||
#include <media/v4l2-ctrls.h>
|
||||
#include <linux/usb.h>
|
||||
#include <linux/usb/hcd.h>
|
||||
|
||||
#define STK1160_VERSION "0.9.5"
|
||||
#define STK1160_VERSION_NUM 0x000905
|
||||
@@ -195,8 +193,3 @@ void stk1160_select_input(struct stk1160 *dev);
|
||||
|
||||
/* Provided by stk1160-ac97.c */
|
||||
void stk1160_ac97_setup(struct stk1160 *dev);
|
||||
|
||||
static inline struct device *stk1160_get_dmadev(struct stk1160 *dev)
|
||||
{
|
||||
return bus_to_hcd(dev->udev->bus)->self.sysdev;
|
||||
}
|
||||
|
||||
@@ -1275,20 +1275,6 @@ static inline enum dma_data_direction uvc_stream_dir(
|
||||
return DMA_TO_DEVICE;
|
||||
}
|
||||
|
||||
static inline struct device *uvc_stream_to_dmadev(struct uvc_streaming *stream)
|
||||
{
|
||||
return bus_to_hcd(stream->dev->udev->bus)->self.sysdev;
|
||||
}
|
||||
|
||||
static int uvc_submit_urb(struct uvc_urb *uvc_urb, gfp_t mem_flags)
|
||||
{
|
||||
/* Sync DMA. */
|
||||
dma_sync_sgtable_for_device(uvc_stream_to_dmadev(uvc_urb->stream),
|
||||
uvc_urb->sgt,
|
||||
uvc_stream_dir(uvc_urb->stream));
|
||||
return usb_submit_urb(uvc_urb->urb, mem_flags);
|
||||
}
|
||||
|
||||
/*
|
||||
* uvc_video_decode_data_work: Asynchronous memcpy processing
|
||||
*
|
||||
@@ -1310,7 +1296,7 @@ static void uvc_video_copy_data_work(struct work_struct *work)
|
||||
uvc_queue_buffer_release(op->buf);
|
||||
}
|
||||
|
||||
ret = uvc_submit_urb(uvc_urb, GFP_KERNEL);
|
||||
ret = usb_submit_urb(uvc_urb->urb, GFP_KERNEL);
|
||||
if (ret < 0)
|
||||
dev_err(&uvc_urb->stream->intf->dev,
|
||||
"Failed to resubmit video URB (%d).\n", ret);
|
||||
@@ -1736,12 +1722,6 @@ static void uvc_video_complete(struct urb *urb)
|
||||
/* Re-initialise the URB async work. */
|
||||
uvc_urb->async_operations = 0;
|
||||
|
||||
/* Sync DMA and invalidate vmap range. */
|
||||
dma_sync_sgtable_for_cpu(uvc_stream_to_dmadev(uvc_urb->stream),
|
||||
uvc_urb->sgt, uvc_stream_dir(stream));
|
||||
invalidate_kernel_vmap_range(uvc_urb->buffer,
|
||||
uvc_urb->stream->urb_size);
|
||||
|
||||
/*
|
||||
* Process the URB headers, and optionally queue expensive memcpy tasks
|
||||
* to be deferred to a work queue.
|
||||
@@ -1750,7 +1730,7 @@ static void uvc_video_complete(struct urb *urb)
|
||||
|
||||
/* If no async work is needed, resubmit the URB immediately. */
|
||||
if (!uvc_urb->async_operations) {
|
||||
ret = uvc_submit_urb(uvc_urb, GFP_ATOMIC);
|
||||
ret = usb_submit_urb(uvc_urb->urb, GFP_ATOMIC);
|
||||
if (ret < 0)
|
||||
dev_err(&stream->intf->dev,
|
||||
"Failed to resubmit video URB (%d).\n", ret);
|
||||
@@ -1765,17 +1745,15 @@ static void uvc_video_complete(struct urb *urb)
|
||||
*/
|
||||
static void uvc_free_urb_buffers(struct uvc_streaming *stream)
|
||||
{
|
||||
struct device *dma_dev = uvc_stream_to_dmadev(stream);
|
||||
struct usb_device *udev = stream->dev->udev;
|
||||
struct uvc_urb *uvc_urb;
|
||||
|
||||
for_each_uvc_urb(uvc_urb, stream) {
|
||||
if (!uvc_urb->buffer)
|
||||
continue;
|
||||
|
||||
dma_vunmap_noncontiguous(dma_dev, uvc_urb->buffer);
|
||||
dma_free_noncontiguous(dma_dev, stream->urb_size, uvc_urb->sgt,
|
||||
uvc_stream_dir(stream));
|
||||
|
||||
usb_free_noncoherent(udev, stream->urb_size, uvc_urb->buffer,
|
||||
uvc_stream_dir(stream), uvc_urb->sgt);
|
||||
uvc_urb->buffer = NULL;
|
||||
uvc_urb->sgt = NULL;
|
||||
}
|
||||
@@ -1786,26 +1764,13 @@ static void uvc_free_urb_buffers(struct uvc_streaming *stream)
|
||||
static bool uvc_alloc_urb_buffer(struct uvc_streaming *stream,
|
||||
struct uvc_urb *uvc_urb, gfp_t gfp_flags)
|
||||
{
|
||||
struct device *dma_dev = uvc_stream_to_dmadev(stream);
|
||||
struct usb_device *udev = stream->dev->udev;
|
||||
|
||||
uvc_urb->sgt = dma_alloc_noncontiguous(dma_dev, stream->urb_size,
|
||||
uvc_stream_dir(stream),
|
||||
gfp_flags, 0);
|
||||
if (!uvc_urb->sgt)
|
||||
return false;
|
||||
uvc_urb->dma = uvc_urb->sgt->sgl->dma_address;
|
||||
|
||||
uvc_urb->buffer = dma_vmap_noncontiguous(dma_dev, stream->urb_size,
|
||||
uvc_urb->sgt);
|
||||
if (!uvc_urb->buffer) {
|
||||
dma_free_noncontiguous(dma_dev, stream->urb_size,
|
||||
uvc_urb->sgt,
|
||||
uvc_stream_dir(stream));
|
||||
uvc_urb->sgt = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
uvc_urb->buffer = usb_alloc_noncoherent(udev, stream->urb_size,
|
||||
gfp_flags, &uvc_urb->dma,
|
||||
uvc_stream_dir(stream),
|
||||
&uvc_urb->sgt);
|
||||
return !!uvc_urb->buffer;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1953,6 +1918,7 @@ static int uvc_init_video_isoc(struct uvc_streaming *stream,
|
||||
urb->complete = uvc_video_complete;
|
||||
urb->number_of_packets = npackets;
|
||||
urb->transfer_buffer_length = size;
|
||||
urb->sgt = uvc_urb->sgt;
|
||||
|
||||
for (i = 0; i < npackets; ++i) {
|
||||
urb->iso_frame_desc[i].offset = i * psize;
|
||||
@@ -2009,6 +1975,7 @@ static int uvc_init_video_bulk(struct uvc_streaming *stream,
|
||||
size, uvc_video_complete, uvc_urb);
|
||||
urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
|
||||
urb->transfer_dma = uvc_urb->dma;
|
||||
urb->sgt = uvc_urb->sgt;
|
||||
|
||||
uvc_urb->urb = urb;
|
||||
}
|
||||
@@ -2120,7 +2087,7 @@ static int uvc_video_start_transfer(struct uvc_streaming *stream,
|
||||
|
||||
/* Submit the URBs. */
|
||||
for_each_uvc_urb(uvc_urb, stream) {
|
||||
ret = uvc_submit_urb(uvc_urb, gfp_flags);
|
||||
ret = usb_submit_urb(uvc_urb->urb, gfp_flags);
|
||||
if (ret < 0) {
|
||||
dev_err(&stream->intf->dev,
|
||||
"Failed to submit URB %u (%d).\n",
|
||||
|
||||
@@ -36,7 +36,7 @@ static bool match_service_id(const struct tb_service_id *id,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (id->match_flags & TBSVC_MATCH_PROTOCOL_VERSION) {
|
||||
if (id->match_flags & TBSVC_MATCH_PROTOCOL_REVISION) {
|
||||
if (id->protocol_revision != svc->prtcrevs)
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -588,7 +588,7 @@ int tb_nvm_read_data(unsigned int address, void *buf, size_t size,
|
||||
* @size: Size of the buffer in bytes
|
||||
* @retries: Number of retries if the block write fails
|
||||
* @write_block: Function that writes block to the flash
|
||||
* @write_block_data: Data passwd to @write_block
|
||||
* @write_block_data: Data passed to @write_block
|
||||
*
|
||||
* This is generic function that writes data to NVM or NVM like device.
|
||||
*
|
||||
|
||||
@@ -3069,7 +3069,7 @@ static int tb_switch_asym_disable(struct tb_switch *sw)
|
||||
* @width: The new link width
|
||||
*
|
||||
* Set device router link width to @width from router upstream port
|
||||
* perspective. Supports also asymmetric links if the routers boths side
|
||||
* perspective. Supports also asymmetric links if the routers both side
|
||||
* of the link supports it.
|
||||
*
|
||||
* Does nothing for host router.
|
||||
|
||||
+82
-90
@@ -980,94 +980,6 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void cxacru_upload_firmware(struct cxacru_data *instance,
|
||||
const struct firmware *fw,
|
||||
const struct firmware *bp)
|
||||
{
|
||||
int ret;
|
||||
struct usbatm_data *usbatm = instance->usbatm;
|
||||
struct usb_device *usb_dev = usbatm->usb_dev;
|
||||
__le16 signature[] = { usb_dev->descriptor.idVendor,
|
||||
usb_dev->descriptor.idProduct };
|
||||
__le32 val;
|
||||
|
||||
usb_dbg(usbatm, "%s\n", __func__);
|
||||
|
||||
/* FirmwarePllFClkValue */
|
||||
val = cpu_to_le32(instance->modem_type->pll_f_clk);
|
||||
ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, PLLFCLK_ADDR, (u8 *) &val, 4);
|
||||
if (ret) {
|
||||
usb_err(usbatm, "FirmwarePllFClkValue failed: %d\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
/* FirmwarePllBClkValue */
|
||||
val = cpu_to_le32(instance->modem_type->pll_b_clk);
|
||||
ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, PLLBCLK_ADDR, (u8 *) &val, 4);
|
||||
if (ret) {
|
||||
usb_err(usbatm, "FirmwarePllBClkValue failed: %d\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Enable SDRAM */
|
||||
val = cpu_to_le32(SDRAM_ENA);
|
||||
ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, SDRAMEN_ADDR, (u8 *) &val, 4);
|
||||
if (ret) {
|
||||
usb_err(usbatm, "Enable SDRAM failed: %d\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Firmware */
|
||||
usb_info(usbatm, "loading firmware\n");
|
||||
ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, FW_ADDR, fw->data, fw->size);
|
||||
if (ret) {
|
||||
usb_err(usbatm, "Firmware upload failed: %d\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Boot ROM patch */
|
||||
if (instance->modem_type->boot_rom_patch) {
|
||||
usb_info(usbatm, "loading boot ROM patch\n");
|
||||
ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, BR_ADDR, bp->data, bp->size);
|
||||
if (ret) {
|
||||
usb_err(usbatm, "Boot ROM patching failed: %d\n", ret);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Signature */
|
||||
ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, SIG_ADDR, (u8 *) signature, 4);
|
||||
if (ret) {
|
||||
usb_err(usbatm, "Signature storing failed: %d\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
usb_info(usbatm, "starting device\n");
|
||||
if (instance->modem_type->boot_rom_patch) {
|
||||
val = cpu_to_le32(BR_ADDR);
|
||||
ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, BR_STACK_ADDR, (u8 *) &val, 4);
|
||||
} else {
|
||||
ret = cxacru_fw(usb_dev, FW_GOTO_MEM, 0x0, 0x0, FW_ADDR, NULL, 0);
|
||||
}
|
||||
if (ret) {
|
||||
usb_err(usbatm, "Passing control to firmware failed: %d\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Delay to allow firmware to start up. */
|
||||
msleep_interruptible(1000);
|
||||
|
||||
usb_clear_halt(usb_dev, usb_sndbulkpipe(usb_dev, CXACRU_EP_CMD));
|
||||
usb_clear_halt(usb_dev, usb_rcvbulkpipe(usb_dev, CXACRU_EP_CMD));
|
||||
usb_clear_halt(usb_dev, usb_sndbulkpipe(usb_dev, CXACRU_EP_DATA));
|
||||
usb_clear_halt(usb_dev, usb_rcvbulkpipe(usb_dev, CXACRU_EP_DATA));
|
||||
|
||||
ret = cxacru_cm(instance, CM_REQUEST_CARD_GET_STATUS, NULL, 0, NULL, 0);
|
||||
if (ret < 0) {
|
||||
usb_err(usbatm, "modem failed to initialize: %d\n", ret);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static int cxacru_find_firmware(struct cxacru_data *instance,
|
||||
char *phase, const struct firmware **fw_p)
|
||||
@@ -1094,8 +1006,14 @@ static int cxacru_heavy_init(struct usbatm_data *usbatm_instance,
|
||||
{
|
||||
const struct firmware *fw, *bp;
|
||||
struct cxacru_data *instance = usbatm_instance->driver_data;
|
||||
int ret = cxacru_find_firmware(instance, "fw", &fw);
|
||||
struct usbatm_data *usbatm = instance->usbatm;
|
||||
struct usb_device *usb_dev = usbatm->usb_dev;
|
||||
__le16 signature[] = { usb_dev->descriptor.idVendor,
|
||||
usb_dev->descriptor.idProduct };
|
||||
__le32 val;
|
||||
int ret;
|
||||
|
||||
ret = cxacru_find_firmware(instance, "fw", &fw);
|
||||
if (ret) {
|
||||
usb_warn(usbatm_instance, "firmware (cxacru-fw.bin) unavailable (system misconfigured?)\n");
|
||||
return ret;
|
||||
@@ -1110,8 +1028,82 @@ static int cxacru_heavy_init(struct usbatm_data *usbatm_instance,
|
||||
}
|
||||
}
|
||||
|
||||
cxacru_upload_firmware(instance, fw, bp);
|
||||
/* FirmwarePllFClkValue */
|
||||
val = cpu_to_le32(instance->modem_type->pll_f_clk);
|
||||
ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, PLLFCLK_ADDR, (u8 *) &val, 4);
|
||||
if (ret) {
|
||||
usb_err(usbatm, "FirmwarePllFClkValue failed: %d\n", ret);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* FirmwarePllBClkValue */
|
||||
val = cpu_to_le32(instance->modem_type->pll_b_clk);
|
||||
ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, PLLBCLK_ADDR, (u8 *) &val, 4);
|
||||
if (ret) {
|
||||
usb_err(usbatm, "FirmwarePllBClkValue failed: %d\n", ret);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Enable SDRAM */
|
||||
val = cpu_to_le32(SDRAM_ENA);
|
||||
ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, SDRAMEN_ADDR, (u8 *) &val, 4);
|
||||
if (ret) {
|
||||
usb_err(usbatm, "Enable SDRAM failed: %d\n", ret);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Firmware */
|
||||
usb_info(usbatm, "loading firmware\n");
|
||||
ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, FW_ADDR, fw->data, fw->size);
|
||||
if (ret) {
|
||||
usb_err(usbatm, "Firmware upload failed: %d\n", ret);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Boot ROM patch */
|
||||
if (instance->modem_type->boot_rom_patch) {
|
||||
usb_info(usbatm, "loading boot ROM patch\n");
|
||||
ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, BR_ADDR, bp->data, bp->size);
|
||||
if (ret) {
|
||||
usb_err(usbatm, "Boot ROM patching failed: %d\n", ret);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
/* Signature */
|
||||
ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, SIG_ADDR, (u8 *) signature, 4);
|
||||
if (ret) {
|
||||
usb_err(usbatm, "Signature storing failed: %d\n", ret);
|
||||
goto done;
|
||||
}
|
||||
|
||||
usb_info(usbatm, "starting device\n");
|
||||
if (instance->modem_type->boot_rom_patch) {
|
||||
val = cpu_to_le32(BR_ADDR);
|
||||
ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, BR_STACK_ADDR, (u8 *) &val, 4);
|
||||
} else {
|
||||
ret = cxacru_fw(usb_dev, FW_GOTO_MEM, 0x0, 0x0, FW_ADDR, NULL, 0);
|
||||
}
|
||||
if (ret) {
|
||||
usb_err(usbatm, "Passing control to firmware failed: %d\n", ret);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Delay to allow firmware to start up. */
|
||||
msleep_interruptible(1000);
|
||||
|
||||
usb_clear_halt(usb_dev, usb_sndbulkpipe(usb_dev, CXACRU_EP_CMD));
|
||||
usb_clear_halt(usb_dev, usb_rcvbulkpipe(usb_dev, CXACRU_EP_CMD));
|
||||
usb_clear_halt(usb_dev, usb_sndbulkpipe(usb_dev, CXACRU_EP_DATA));
|
||||
usb_clear_halt(usb_dev, usb_rcvbulkpipe(usb_dev, CXACRU_EP_DATA));
|
||||
|
||||
ret = cxacru_cm(instance, CM_REQUEST_CARD_GET_STATUS, NULL, 0, NULL, 0);
|
||||
if (ret < 0) {
|
||||
usb_err(usbatm, "modem failed to initialize: %d\n", ret);
|
||||
goto done;
|
||||
}
|
||||
|
||||
done:
|
||||
if (instance->modem_type->boot_rom_patch)
|
||||
release_firmware(bp);
|
||||
release_firmware(fw);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user