EHCI: HSIC: Add debug support for HSIC system error
Halt the system when HSIC system error happens and dump HSIC
link registres. Also, save the address of msm_hsic_hcd
structure to a global pointer.
CRs-Fixed: 375536
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Change-Id: Ia346778911f610338f38492bc1ff0e8a9c7a87c7
diff --git a/drivers/usb/host/ehci-msm-hsic.c b/drivers/usb/host/ehci-msm-hsic.c
index 874c728..e49e2a0 100644
--- a/drivers/usb/host/ehci-msm-hsic.c
+++ b/drivers/usb/host/ehci-msm-hsic.c
@@ -45,6 +45,8 @@
#include <mach/rpm-regulator.h>
#define MSM_USB_BASE (hcd->regs)
+#define USB_REG_START_OFFSET 0x90
+#define USB_REG_END_OFFSET 0x250
struct msm_hsic_hcd {
struct ehci_hcd ehci;
@@ -68,6 +70,8 @@
enum usb_vdd_type vdd_type;
};
+struct msm_hsic_hcd *__mehci;
+
static bool debug_bus_voting_enabled = true;
static unsigned int enable_dbg_log = 1;
@@ -256,6 +260,22 @@
return container_of((void *) mehci, struct usb_hcd, hcd_priv);
}
+static void dump_hsic_regs(struct usb_hcd *hcd)
+{
+ int i;
+ struct msm_hsic_hcd *mehci = hcd_to_hsic(hcd);
+
+ if (atomic_read(&mehci->in_lpm))
+ return;
+
+ for (i = USB_REG_START_OFFSET; i <= USB_REG_END_OFFSET; i += 0x10)
+ pr_info("%p: %08x\t%08x\t%08x\t%08x\n", hcd->regs + i,
+ readl_relaxed(hcd->regs + i),
+ readl_relaxed(hcd->regs + i + 4),
+ readl_relaxed(hcd->regs + i + 8),
+ readl_relaxed(hcd->regs + i + 0xc));
+}
+
#define ULPI_IO_TIMEOUT_USEC (10 * 1000)
#define USB_PHY_VDD_DIG_VOL_NONE 0 /*uV */
@@ -872,6 +892,7 @@
.bus_resume = ehci_hsic_bus_resume,
.log_urb_complete = dbg_log_event,
+ .dump_regs = dump_hsic_regs,
.enable_ulpi_control = ehci_msm_enable_ulpi_control,
.disable_ulpi_control = ehci_msm_disable_ulpi_control,
@@ -1333,6 +1354,8 @@
}
}
+ __mehci = mehci;
+
/*
* This pdev->dev is assigned parent of root-hub by USB core,
* hence, runtime framework automatically calls this driver's