Skip to content

Commit 670062e

Browse files
committed
Merge tag 'usb-6.4-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB / Thunderbolt fixes from Greg KH: "Here are some small USB and Thunderbolt driver fixes and new device ids for 6.4-rc7 to resolve some reported problems. Included in here are: - new USB serial device ids - USB gadget core fixes for long-dissussed problems - dwc3 bugfixes for reported issues. - typec driver fixes - thunderbolt driver fixes All of these have been in linux-next this week with no reported issues" * tag 'usb-6.4-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: usb: gadget: udc: core: Prevent soft_connect_store() race usb: gadget: udc: core: Offload usb_udc_vbus_handler processing usb: typec: Fix fast_role_swap_current show function usb: typec: ucsi: Fix command cancellation USB: dwc3: fix use-after-free on core driver unbind USB: dwc3: qcom: fix NULL-deref on suspend usb: dwc3: gadget: Reset num TRBs before giving back the request usb: gadget: udc: renesas_usb3: Fix RZ/V2M {modprobe,bind} error USB: serial: option: add Quectel EM061KGL series thunderbolt: Mask ring interrupt on Intel hardware as well thunderbolt: Do not touch CL state configuration during discovery thunderbolt: Increase DisplayPort Connection Manager handshake timeout thunderbolt: dma_test: Use correct value for absent rings when creating paths
2 parents 3c0eb44 + 286d997 commit 670062e

File tree

12 files changed

+198
-70
lines changed

12 files changed

+198
-70
lines changed

drivers/thunderbolt/dma_test.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,9 @@ static int dma_test_start_rings(struct dma_test *dt)
192192
}
193193

194194
ret = tb_xdomain_enable_paths(dt->xd, dt->tx_hopid,
195-
dt->tx_ring ? dt->tx_ring->hop : 0,
195+
dt->tx_ring ? dt->tx_ring->hop : -1,
196196
dt->rx_hopid,
197-
dt->rx_ring ? dt->rx_ring->hop : 0);
197+
dt->rx_ring ? dt->rx_ring->hop : -1);
198198
if (ret) {
199199
dma_test_free_rings(dt);
200200
return ret;
@@ -218,9 +218,9 @@ static void dma_test_stop_rings(struct dma_test *dt)
218218
tb_ring_stop(dt->tx_ring);
219219

220220
ret = tb_xdomain_disable_paths(dt->xd, dt->tx_hopid,
221-
dt->tx_ring ? dt->tx_ring->hop : 0,
221+
dt->tx_ring ? dt->tx_ring->hop : -1,
222222
dt->rx_hopid,
223-
dt->rx_ring ? dt->rx_ring->hop : 0);
223+
dt->rx_ring ? dt->rx_ring->hop : -1);
224224
if (ret)
225225
dev_warn(&dt->svc->dev, "failed to disable DMA paths\n");
226226

drivers/thunderbolt/nhi.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,14 @@ static int ring_interrupt_index(const struct tb_ring *ring)
5656

5757
static void nhi_mask_interrupt(struct tb_nhi *nhi, int mask, int ring)
5858
{
59-
if (nhi->quirks & QUIRK_AUTO_CLEAR_INT)
60-
return;
61-
iowrite32(mask, nhi->iobase + REG_RING_INTERRUPT_MASK_CLEAR_BASE + ring);
59+
if (nhi->quirks & QUIRK_AUTO_CLEAR_INT) {
60+
u32 val;
61+
62+
val = ioread32(nhi->iobase + REG_RING_INTERRUPT_BASE + ring);
63+
iowrite32(val & ~mask, nhi->iobase + REG_RING_INTERRUPT_BASE + ring);
64+
} else {
65+
iowrite32(mask, nhi->iobase + REG_RING_INTERRUPT_MASK_CLEAR_BASE + ring);
66+
}
6267
}
6368

6469
static void nhi_clear_interrupt(struct tb_nhi *nhi, int ring)

drivers/thunderbolt/tb.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,7 @@ static void tb_scan_port(struct tb_port *port)
737737
{
738738
struct tb_cm *tcm = tb_priv(port->sw->tb);
739739
struct tb_port *upstream_port;
740+
bool discovery = false;
740741
struct tb_switch *sw;
741742
int ret;
742743

@@ -804,8 +805,10 @@ static void tb_scan_port(struct tb_port *port)
804805
* tunnels and know which switches were authorized already by
805806
* the boot firmware.
806807
*/
807-
if (!tcm->hotplug_active)
808+
if (!tcm->hotplug_active) {
808809
dev_set_uevent_suppress(&sw->dev, true);
810+
discovery = true;
811+
}
809812

810813
/*
811814
* At the moment Thunderbolt 2 and beyond (devices with LC) we
@@ -835,10 +838,14 @@ static void tb_scan_port(struct tb_port *port)
835838
* CL0s and CL1 are enabled and supported together.
836839
* Silently ignore CLx enabling in case CLx is not supported.
837840
*/
838-
ret = tb_switch_enable_clx(sw, TB_CL1);
839-
if (ret && ret != -EOPNOTSUPP)
840-
tb_sw_warn(sw, "failed to enable %s on upstream port\n",
841-
tb_switch_clx_name(TB_CL1));
841+
if (discovery) {
842+
tb_sw_dbg(sw, "discovery, not touching CL states\n");
843+
} else {
844+
ret = tb_switch_enable_clx(sw, TB_CL1);
845+
if (ret && ret != -EOPNOTSUPP)
846+
tb_sw_warn(sw, "failed to enable %s on upstream port\n",
847+
tb_switch_clx_name(TB_CL1));
848+
}
842849

843850
if (tb_switch_is_clx_enabled(sw, TB_CL1))
844851
/*

drivers/thunderbolt/tunnel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ static int tb_dp_xchg_caps(struct tb_tunnel *tunnel)
526526
* Perform connection manager handshake between IN and OUT ports
527527
* before capabilities exchange can take place.
528528
*/
529-
ret = tb_dp_cm_handshake(in, out, 1500);
529+
ret = tb_dp_cm_handshake(in, out, 3000);
530530
if (ret)
531531
return ret;
532532

drivers/usb/dwc3/core.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1929,6 +1929,11 @@ static int dwc3_remove(struct platform_device *pdev)
19291929
pm_runtime_disable(&pdev->dev);
19301930
pm_runtime_dont_use_autosuspend(&pdev->dev);
19311931
pm_runtime_put_noidle(&pdev->dev);
1932+
/*
1933+
* HACK: Clear the driver data, which is currently accessed by parent
1934+
* glue drivers, before allowing the parent to suspend.
1935+
*/
1936+
platform_set_drvdata(pdev, NULL);
19321937
pm_runtime_set_suspended(&pdev->dev);
19331938

19341939
dwc3_free_event_buffers(dwc);

drivers/usb/dwc3/dwc3-qcom.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,16 @@ static void dwc3_qcom_interconnect_exit(struct dwc3_qcom *qcom)
308308
/* Only usable in contexts where the role can not change. */
309309
static bool dwc3_qcom_is_host(struct dwc3_qcom *qcom)
310310
{
311-
struct dwc3 *dwc = platform_get_drvdata(qcom->dwc3);
311+
struct dwc3 *dwc;
312+
313+
/*
314+
* FIXME: Fix this layering violation.
315+
*/
316+
dwc = platform_get_drvdata(qcom->dwc3);
317+
318+
/* Core driver may not have probed yet. */
319+
if (!dwc)
320+
return false;
312321

313322
return dwc->xhci;
314323
}

drivers/usb/dwc3/gadget.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ static void dwc3_gadget_del_and_unmap_request(struct dwc3_ep *dep,
198198
list_del(&req->list);
199199
req->remaining = 0;
200200
req->needs_extra_trb = false;
201+
req->num_trbs = 0;
201202

202203
if (req->request.status == -EINPROGRESS)
203204
req->request.status = status;

0 commit comments

Comments
 (0)