Skip to content

Commit 4f066b1

Browse files
committed
Merge tag 'usb-6.16-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB / Thunderbolt fixes from Greg KH: "Here are some USB and Thunderbolt driver fixes for reported problems for 6.16-rc6. Included in here are: - Thunderbolt fixes for some much-reported issues - dwc2 driver fixes - dwc3 driver fixes - new usb-serial driver device ids - gadgetfs configfs fix - musb driver fix - USB hub driver fix All of these have been in linux-next for a while with no reported problems" * tag 'usb-6.16-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: usb: hub: Don't try to recover devices lost during warm reset. usb: dwc2: gadget: Fix enter to hibernation for UTMI+ PHY usb: dwc3: qcom: Don't leave BCR asserted USB: serial: option: add Telit Cinterion FE910C04 (ECM) composition USB: serial: ftdi_sio: add support for NDI EMGUIDE GEMINI usb: gadget: configfs: Fix OOB read on empty string write usb: musb: fix gadget state on disconnect USB: serial: option: add Foxconn T99W640 thunderbolt: Fix bit masking in tb_dp_port_set_hops() thunderbolt: Fix wake on connect at runtime
2 parents 673cf89 + 2521106 commit 4f066b1

File tree

11 files changed

+61
-32
lines changed

11 files changed

+61
-32
lines changed

drivers/thunderbolt/switch.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,7 +1450,7 @@ int tb_dp_port_set_hops(struct tb_port *port, unsigned int video,
14501450
return ret;
14511451

14521452
data[0] &= ~ADP_DP_CS_0_VIDEO_HOPID_MASK;
1453-
data[1] &= ~ADP_DP_CS_1_AUX_RX_HOPID_MASK;
1453+
data[1] &= ~ADP_DP_CS_1_AUX_TX_HOPID_MASK;
14541454
data[1] &= ~ADP_DP_CS_1_AUX_RX_HOPID_MASK;
14551455

14561456
data[0] |= (video << ADP_DP_CS_0_VIDEO_HOPID_SHIFT) &
@@ -3437,15 +3437,15 @@ void tb_sw_set_unplugged(struct tb_switch *sw)
34373437
}
34383438
}
34393439

3440-
static int tb_switch_set_wake(struct tb_switch *sw, unsigned int flags)
3440+
static int tb_switch_set_wake(struct tb_switch *sw, unsigned int flags, bool runtime)
34413441
{
34423442
if (flags)
34433443
tb_sw_dbg(sw, "enabling wakeup: %#x\n", flags);
34443444
else
34453445
tb_sw_dbg(sw, "disabling wakeup\n");
34463446

34473447
if (tb_switch_is_usb4(sw))
3448-
return usb4_switch_set_wake(sw, flags);
3448+
return usb4_switch_set_wake(sw, flags, runtime);
34493449
return tb_lc_set_wake(sw, flags);
34503450
}
34513451

@@ -3521,7 +3521,7 @@ int tb_switch_resume(struct tb_switch *sw, bool runtime)
35213521
tb_switch_check_wakes(sw);
35223522

35233523
/* Disable wakes */
3524-
tb_switch_set_wake(sw, 0);
3524+
tb_switch_set_wake(sw, 0, true);
35253525

35263526
err = tb_switch_tmu_init(sw);
35273527
if (err)
@@ -3603,7 +3603,7 @@ void tb_switch_suspend(struct tb_switch *sw, bool runtime)
36033603
flags |= TB_WAKE_ON_USB4 | TB_WAKE_ON_USB3 | TB_WAKE_ON_PCIE;
36043604
}
36053605

3606-
tb_switch_set_wake(sw, flags);
3606+
tb_switch_set_wake(sw, flags, runtime);
36073607

36083608
if (tb_switch_is_usb4(sw))
36093609
usb4_switch_set_sleep(sw);

drivers/thunderbolt/tb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1317,7 +1317,7 @@ int usb4_switch_read_uid(struct tb_switch *sw, u64 *uid);
13171317
int usb4_switch_drom_read(struct tb_switch *sw, unsigned int address, void *buf,
13181318
size_t size);
13191319
bool usb4_switch_lane_bonding_possible(struct tb_switch *sw);
1320-
int usb4_switch_set_wake(struct tb_switch *sw, unsigned int flags);
1320+
int usb4_switch_set_wake(struct tb_switch *sw, unsigned int flags, bool runtime);
13211321
int usb4_switch_set_sleep(struct tb_switch *sw);
13221322
int usb4_switch_nvm_sector_size(struct tb_switch *sw);
13231323
int usb4_switch_nvm_read(struct tb_switch *sw, unsigned int address, void *buf,

drivers/thunderbolt/usb4.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -403,12 +403,12 @@ bool usb4_switch_lane_bonding_possible(struct tb_switch *sw)
403403
* usb4_switch_set_wake() - Enabled/disable wake
404404
* @sw: USB4 router
405405
* @flags: Wakeup flags (%0 to disable)
406+
* @runtime: Wake is being programmed during system runtime
406407
*
407408
* Enables/disables router to wake up from sleep.
408409
*/
409-
int usb4_switch_set_wake(struct tb_switch *sw, unsigned int flags)
410+
int usb4_switch_set_wake(struct tb_switch *sw, unsigned int flags, bool runtime)
410411
{
411-
struct usb4_port *usb4;
412412
struct tb_port *port;
413413
u64 route = tb_route(sw);
414414
u32 val;
@@ -438,13 +438,11 @@ int usb4_switch_set_wake(struct tb_switch *sw, unsigned int flags)
438438
val |= PORT_CS_19_WOU4;
439439
} else {
440440
bool configured = val & PORT_CS_19_PC;
441-
usb4 = port->usb4;
441+
bool wakeup = runtime || device_may_wakeup(&port->usb4->dev);
442442

443-
if (((flags & TB_WAKE_ON_CONNECT) &&
444-
device_may_wakeup(&usb4->dev)) && !configured)
443+
if ((flags & TB_WAKE_ON_CONNECT) && wakeup && !configured)
445444
val |= PORT_CS_19_WOC;
446-
if (((flags & TB_WAKE_ON_DISCONNECT) &&
447-
device_may_wakeup(&usb4->dev)) && configured)
445+
if ((flags & TB_WAKE_ON_DISCONNECT) && wakeup && configured)
448446
val |= PORT_CS_19_WOD;
449447
if ((flags & TB_WAKE_ON_USB4) && configured)
450448
val |= PORT_CS_19_WOU4;

drivers/usb/core/hub.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5751,6 +5751,7 @@ static void port_event(struct usb_hub *hub, int port1)
57515751
struct usb_device *hdev = hub->hdev;
57525752
u16 portstatus, portchange;
57535753
int i = 0;
5754+
int err;
57545755

57555756
connect_change = test_bit(port1, hub->change_bits);
57565757
clear_bit(port1, hub->event_bits);
@@ -5847,8 +5848,11 @@ static void port_event(struct usb_hub *hub, int port1)
58475848
} else if (!udev || !(portstatus & USB_PORT_STAT_CONNECTION)
58485849
|| udev->state == USB_STATE_NOTATTACHED) {
58495850
dev_dbg(&port_dev->dev, "do warm reset, port only\n");
5850-
if (hub_port_reset(hub, port1, NULL,
5851-
HUB_BH_RESET_TIME, true) < 0)
5851+
err = hub_port_reset(hub, port1, NULL,
5852+
HUB_BH_RESET_TIME, true);
5853+
if (!udev && err == -ENOTCONN)
5854+
connect_change = 0;
5855+
else if (err < 0)
58525856
hub_port_disable(hub, port1, 1);
58535857
} else {
58545858
dev_dbg(&port_dev->dev, "do warm reset, full device\n");

drivers/usb/dwc2/gadget.c

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5389,20 +5389,34 @@ int dwc2_gadget_enter_hibernation(struct dwc2_hsotg *hsotg)
53895389
if (gusbcfg & GUSBCFG_ULPI_UTMI_SEL) {
53905390
/* ULPI interface */
53915391
gpwrdn |= GPWRDN_ULPI_LATCH_EN_DURING_HIB_ENTRY;
5392-
}
5393-
dwc2_writel(hsotg, gpwrdn, GPWRDN);
5394-
udelay(10);
5392+
dwc2_writel(hsotg, gpwrdn, GPWRDN);
5393+
udelay(10);
53955394

5396-
/* Suspend the Phy Clock */
5397-
pcgcctl = dwc2_readl(hsotg, PCGCTL);
5398-
pcgcctl |= PCGCTL_STOPPCLK;
5399-
dwc2_writel(hsotg, pcgcctl, PCGCTL);
5400-
udelay(10);
5395+
/* Suspend the Phy Clock */
5396+
pcgcctl = dwc2_readl(hsotg, PCGCTL);
5397+
pcgcctl |= PCGCTL_STOPPCLK;
5398+
dwc2_writel(hsotg, pcgcctl, PCGCTL);
5399+
udelay(10);
54015400

5402-
gpwrdn = dwc2_readl(hsotg, GPWRDN);
5403-
gpwrdn |= GPWRDN_PMUACTV;
5404-
dwc2_writel(hsotg, gpwrdn, GPWRDN);
5405-
udelay(10);
5401+
gpwrdn = dwc2_readl(hsotg, GPWRDN);
5402+
gpwrdn |= GPWRDN_PMUACTV;
5403+
dwc2_writel(hsotg, gpwrdn, GPWRDN);
5404+
udelay(10);
5405+
} else {
5406+
/* UTMI+ Interface */
5407+
dwc2_writel(hsotg, gpwrdn, GPWRDN);
5408+
udelay(10);
5409+
5410+
gpwrdn = dwc2_readl(hsotg, GPWRDN);
5411+
gpwrdn |= GPWRDN_PMUACTV;
5412+
dwc2_writel(hsotg, gpwrdn, GPWRDN);
5413+
udelay(10);
5414+
5415+
pcgcctl = dwc2_readl(hsotg, PCGCTL);
5416+
pcgcctl |= PCGCTL_STOPPCLK;
5417+
dwc2_writel(hsotg, pcgcctl, PCGCTL);
5418+
udelay(10);
5419+
}
54065420

54075421
/* Set flag to indicate that we are in hibernation */
54085422
hsotg->hibernated = 1;

drivers/usb/dwc3/dwc3-qcom.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -680,12 +680,12 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
680680
ret = reset_control_deassert(qcom->resets);
681681
if (ret) {
682682
dev_err(&pdev->dev, "failed to deassert resets, err=%d\n", ret);
683-
goto reset_assert;
683+
return ret;
684684
}
685685

686686
ret = clk_bulk_prepare_enable(qcom->num_clocks, qcom->clks);
687687
if (ret < 0)
688-
goto reset_assert;
688+
return ret;
689689

690690
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
691691
if (!r) {
@@ -755,8 +755,6 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
755755
dwc3_core_remove(&qcom->dwc);
756756
clk_disable:
757757
clk_bulk_disable_unprepare(qcom->num_clocks, qcom->clks);
758-
reset_assert:
759-
reset_control_assert(qcom->resets);
760758

761759
return ret;
762760
}
@@ -771,7 +769,6 @@ static void dwc3_qcom_remove(struct platform_device *pdev)
771769
clk_bulk_disable_unprepare(qcom->num_clocks, qcom->clks);
772770

773771
dwc3_qcom_interconnect_exit(qcom);
774-
reset_control_assert(qcom->resets);
775772
}
776773

777774
static int dwc3_qcom_pm_suspend(struct device *dev)

drivers/usb/gadget/configfs.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,8 @@ static ssize_t webusb_landingPage_store(struct config_item *item, const char *pa
10651065
unsigned int bytes_to_strip = 0;
10661066
int l = len;
10671067

1068+
if (!len)
1069+
return len;
10681070
if (page[l - 1] == '\n') {
10691071
--l;
10701072
++bytes_to_strip;
@@ -1188,6 +1190,8 @@ static ssize_t os_desc_qw_sign_store(struct config_item *item, const char *page,
11881190
struct gadget_info *gi = os_desc_item_to_gadget_info(item);
11891191
int res, l;
11901192

1193+
if (!len)
1194+
return len;
11911195
l = min_t(int, len, OS_STRING_QW_SIGN_LEN >> 1);
11921196
if (page[l - 1] == '\n')
11931197
--l;

drivers/usb/musb/musb_gadget.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1913,6 +1913,7 @@ static int musb_gadget_stop(struct usb_gadget *g)
19131913
* gadget driver here and have everything work;
19141914
* that currently misbehaves.
19151915
*/
1916+
usb_gadget_set_state(g, USB_STATE_NOTATTACHED);
19161917

19171918
/* Force check of devctl register for PM runtime */
19181919
pm_runtime_mark_last_busy(musb->controller);
@@ -2019,6 +2020,7 @@ void musb_g_disconnect(struct musb *musb)
20192020
case OTG_STATE_B_PERIPHERAL:
20202021
case OTG_STATE_B_IDLE:
20212022
musb_set_state(musb, OTG_STATE_B_IDLE);
2023+
usb_gadget_set_state(&musb->g, USB_STATE_NOTATTACHED);
20222024
break;
20232025
case OTG_STATE_B_SRP_INIT:
20242026
break;

drivers/usb/serial/ftdi_sio.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,8 @@ static const struct usb_device_id id_table_combined[] = {
803803
.driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk },
804804
{ USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID),
805805
.driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk },
806+
{ USB_DEVICE(FTDI_NDI_VID, FTDI_NDI_EMGUIDE_GEMINI_PID),
807+
.driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk },
806808
{ USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) },
807809
{ USB_DEVICE(NOVITUS_VID, NOVITUS_BONO_E_PID) },
808810
{ USB_DEVICE(FTDI_VID, RTSYSTEMS_USB_VX8_PID) },

drivers/usb/serial/ftdi_sio_ids.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@
204204
#define FTDI_NDI_FUTURE_3_PID 0xDA73 /* NDI future device #3 */
205205
#define FTDI_NDI_AURORA_SCU_PID 0xDA74 /* NDI Aurora SCU */
206206

207+
#define FTDI_NDI_VID 0x23F2
208+
#define FTDI_NDI_EMGUIDE_GEMINI_PID 0x0003 /* NDI Emguide Gemini */
209+
207210
/*
208211
* ChamSys Limited (www.chamsys.co.uk) USB wing/interface product IDs
209212
*/

0 commit comments

Comments
 (0)