From 236b3d16af06f6d98b84d48a7b1f773975f5c1fd Mon Sep 17 00:00:00 2001 From: Jonathan Bell Date: Tue, 22 Oct 2024 15:32:54 +0100 Subject: [PATCH 1/4] usb: xhci-hcd: add a gratuitous doorbell read This may assist in debugging https://github.com/raspberrypi/linux/issues/6141 The symptom is that the Interrupt endpoint for the dongle sometimes has one outstanding TRB, but the lack of USB bus activity suggests that the xHC didn't correctly register the TRB as valid when the doorbell ring happened. Adding this dummy read seems to fix it. Signed-off-by: Jonathan Bell --- drivers/usb/host/xhci-ring.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 46268b208e88fa..ea21fad394788f 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -505,6 +505,8 @@ void xhci_ring_ep_doorbell(struct xhci_hcd *xhci, trace_xhci_ring_ep_doorbell(slot_id, DB_VALUE(ep_index, stream_id)); + /* Incurs ~1.2us round-trip time (and wakes the link) */ + readl(db_addr); writel(DB_VALUE(ep_index, stream_id), db_addr); /* flush the write */ readl(db_addr); From 14717de1504472024e210afaf2fd6736161e524b Mon Sep 17 00:00:00 2001 From: Jonathan Bell Date: Wed, 30 Oct 2024 13:51:45 +0000 Subject: [PATCH 2/4] HACK: bluetooth: extend timeouts to 20 seconds Idea is to capture debug output in this window --- include/net/bluetooth/hci.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 2129d071c3725f..19ea0d63f60ea0 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -425,8 +425,8 @@ enum { /* HCI timeouts */ #define HCI_DISCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ #define HCI_PAIRING_TIMEOUT msecs_to_jiffies(60000) /* 60 seconds */ -#define HCI_INIT_TIMEOUT msecs_to_jiffies(10000) /* 10 seconds */ -#define HCI_CMD_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ +#define HCI_INIT_TIMEOUT msecs_to_jiffies(20000) /* 20 seconds */ +#define HCI_CMD_TIMEOUT msecs_to_jiffies(20000) /* 20 seconds */ #define HCI_NCMD_TIMEOUT msecs_to_jiffies(4000) /* 4 seconds */ #define HCI_ACL_TX_TIMEOUT msecs_to_jiffies(45000) /* 45 seconds */ #define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ From 8c3dfa076ab9638cc5c06f36b9d5289f0b13f058 Mon Sep 17 00:00:00 2001 From: Jonathan Bell Date: Mon, 4 Nov 2024 16:46:54 +0000 Subject: [PATCH 3/4] dts: RP1: disable dwc3 parkmode for FS/LS buses This feature does the opposite of what's advertised - it ceases polling of bulk/control endpoints that respond with NAKs after 16 tries in a frame, leading to a large gap in service until the next SOF. Signed-off-by: Jonathan Bell --- arch/arm64/boot/dts/broadcom/rp1.dtsi | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/arm64/boot/dts/broadcom/rp1.dtsi b/arch/arm64/boot/dts/broadcom/rp1.dtsi index 1f60f3f03a1004..e1c9b879d90a6c 100644 --- a/arch/arm64/boot/dts/broadcom/rp1.dtsi +++ b/arch/arm64/boot/dts/broadcom/rp1.dtsi @@ -1079,7 +1079,6 @@ snps,dis_rxdet_inp3_quirk; snps,parkmode-disable-ss-quirk; snps,parkmode-disable-hs-quirk; - snps,parkmode-disable-fsls-quirk; snps,tx-max-burst = /bits/ 8 <8>; snps,tx-thr-num-pkt = /bits/ 8 <2>; interrupts = ; @@ -1095,7 +1094,6 @@ snps,dis_rxdet_inp3_quirk; snps,parkmode-disable-ss-quirk; snps,parkmode-disable-hs-quirk; - snps,parkmode-disable-fsls-quirk; snps,tx-max-burst = /bits/ 8 <8>; snps,tx-thr-num-pkt = /bits/ 8 <2>; interrupts = ; From 123128da84579a10bc2abd1e388f014fd57f3809 Mon Sep 17 00:00:00 2001 From: Jonathan Bell Date: Mon, 4 Nov 2024 16:49:17 +0000 Subject: [PATCH 4/4] HACK: set dwc3 pagebreak to 1K boundaries Signed-off-by: Jonathan Bell --- drivers/usb/dwc3/core.c | 3 ++- drivers/usb/dwc3/core.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 92bed200f283e9..830454cbdef027 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1221,7 +1221,8 @@ static void dwc3_set_axi_pipe_limit(struct dwc3 *dwc) } cfg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG1); cfg &= ~DWC3_GSBUSCFG1_PIPETRANSLIMIT(15); - cfg |= DWC3_GSBUSCFG1_PIPETRANSLIMIT(dwc->axi_pipe_limit - 1); + cfg |= DWC3_GSBUSCFG1_PIPETRANSLIMIT(dwc->axi_pipe_limit - 1) + cfg |= DWC3_GSBUSCFG1_EN1KPAGE; dwc3_writel(dwc->regs, DWC3_GSBUSCFG1, cfg); } diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 56f46ebdd3427f..83c082a027279c 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -187,6 +187,7 @@ /* Global SoC Bus Configuration Register 1 */ #define DWC3_GSBUSCFG1_PIPETRANSLIMIT(n) (((n) & 0xf) << 8) +#define DWC3_GSBUSCFG1_EN1KPAGE (1 << 12) /* Global Debug LSP MUX Select */ #define DWC3_GDBGLSPMUX_ENDBC BIT(15) /* Host only */