From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 02/15] usb: xhci: add various debugging prints
Date: Mon, 19 Feb 2024 14:38:22 +0100 [thread overview]
Message-ID: <20240219133835.3886399-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20240219133835.3886399-1-a.fatoum@pengutronix.de>
For debugging potential issues around the driver, add some debug
prints.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/usb/host/xhci-ring.c | 8 ++++++++
drivers/usb/host/xhci.c | 16 +++++++++++++---
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 547047305dd0..804384e0307f 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -461,6 +461,14 @@ union xhci_trb *xhci_wait_for_event(struct xhci_ctrl *ctrl, trb_type expected,
BUG_ON(GET_COMP_CODE(
le32_to_cpu(event->generic.field[2])) !=
COMP_SUCCESS);
+ else
+ dev_dbg(ctrl->dev, "Unexpected XHCI event TRB, skipping... "
+ "(%08x %08x %08x %08x)\n",
+ le32_to_cpu(event->generic.field[0]),
+ le32_to_cpu(event->generic.field[1]),
+ le32_to_cpu(event->generic.field[2]),
+ le32_to_cpu(event->generic.field[3]));
+
xhci_acknowledge_event(ctrl);
} while (!is_timeout_non_interruptible(start, timeout_ms * MSECOND));
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index f149e784524d..01817d9c79cd 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -151,6 +151,8 @@ static int xhci_start(struct xhci_ctrl *ctrl)
u32 temp;
int ret;
+ dev_dbg(ctrl->dev, "Starting the controller\n");
+
temp = xhci_readl(&hcor->or_usbcmd);
temp |= (CMD_RUN);
xhci_writel(&hcor->or_usbcmd, temp);
@@ -1088,8 +1090,10 @@ static int xhci_submit_root(struct usb_device *udev, unsigned long pipe,
static int _xhci_submit_int_msg(struct usb_device *udev, unsigned long pipe,
void *buffer, int length, int interval)
{
- if (usb_pipetype(pipe) != PIPE_INTERRUPT)
+ if (usb_pipetype(pipe) != PIPE_INTERRUPT) {
+ dev_err(&udev->dev, "non-interrupt pipe (type=%lu)", usb_pipetype(pipe));
return -EINVAL;
+ }
/*
* xHCI uses normal TRBs for both bulk and interrupt. When the
@@ -1112,8 +1116,10 @@ static int _xhci_submit_int_msg(struct usb_device *udev, unsigned long pipe,
static int _xhci_submit_bulk_msg(struct usb_device *udev, unsigned long pipe,
void *buffer, int length, int timeout_ms)
{
- if (usb_pipetype(pipe) != PIPE_BULK)
+ if (usb_pipetype(pipe) != PIPE_BULK) {
+ dev_err(&udev->dev, "non-bulk pipe (type=%lu)", usb_pipetype(pipe));
return -EINVAL;
+ }
return xhci_bulk_tx(udev, pipe, length, buffer, timeout_ms);
}
@@ -1137,8 +1143,10 @@ static int _xhci_submit_control_msg(struct usb_device *udev, unsigned long pipe,
struct xhci_ctrl *ctrl = xhci_get_ctrl(udev);
int ret = 0;
- if (usb_pipetype(pipe) != PIPE_CONTROL)
+ if (usb_pipetype(pipe) != PIPE_CONTROL) {
+ dev_err(&udev->dev, "non-control pipe (type=%lu)", usb_pipetype(pipe));
return -EINVAL;
+ }
if (usb_pipedevice(pipe) == ctrl->rootdev)
return xhci_submit_root(udev, pipe, buffer, setup);
@@ -1218,6 +1226,8 @@ static int xhci_lowlevel_stop(struct xhci_ctrl *ctrl)
xhci_reset(ctrl);
+ dev_dbg(ctrl->dev, "Disabling event ring interrupts\n");
+
temp = xhci_readl(&ctrl->hcor->or_usbsts);
xhci_writel(&ctrl->hcor->or_usbsts, temp & ~STS_EINT);
temp = xhci_readl(&ctrl->ir_set->irq_pending);
--
2.39.2
next prev parent reply other threads:[~2024-02-19 13:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-19 13:38 [PATCH 00/15] usb: xhci: pull in fixes from U-Boot v2024.01 Ahmad Fatoum
2024-02-19 13:38 ` [PATCH 01/15] usb: xhci: usb: xhci: avoid type conversion of void * Ahmad Fatoum
2024-02-19 13:38 ` Ahmad Fatoum [this message]
2024-02-19 13:38 ` [PATCH 03/15] usb: xhci: call xhci_flush_cache where appropriate Ahmad Fatoum
2024-02-19 13:38 ` [PATCH 04/15] usb: xhci: use macros for formatting values Ahmad Fatoum
2024-02-19 13:38 ` [PATCH 05/15] usb: xhci: Add missing endian conversions (cpu_to_leXX / leXX_to_cpu) Ahmad Fatoum
2024-02-19 13:38 ` [PATCH 06/15] usb: xhci: Add missing xhci_readl() Ahmad Fatoum
2024-02-19 13:38 ` [PATCH 07/15] usb: xhci: don't use xhci_writeq for normal SDRAM Ahmad Fatoum
2024-02-19 13:38 ` [PATCH 08/15] usb: xhci: support non-1:1 mapped xHCI Ahmad Fatoum
2024-02-19 13:38 ` [PATCH 09/15] usb: xhci: reset endpoint on USB stall Ahmad Fatoum
2024-02-19 13:38 ` [PATCH 10/15] usb: xhci: Fix root hub descriptor Ahmad Fatoum
2024-02-19 13:38 ` [PATCH 11/15] usb: xhci: Guard all calls to xhci_wait_for_event Ahmad Fatoum
2024-02-19 13:38 ` [PATCH 12/15] usb: xhci: Better error handling in abort_td() Ahmad Fatoum
2024-02-19 13:38 ` [PATCH 13/15] usb: xhci: Allow context state errors when halting an endpoint Ahmad Fatoum
2024-02-19 13:38 ` [PATCH 14/15] usb: xhci: Recover from halted bulk endpoints Ahmad Fatoum
2024-02-19 13:38 ` [PATCH 15/15] usb: xhci: Do not panic on event timeouts Ahmad Fatoum
2024-02-20 11:07 ` [PATCH 00/15] usb: xhci: pull in fixes from U-Boot v2024.01 Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240219133835.3886399-3-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox