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
This commit is contained in:
Hemant Kumar 2012-07-02 15:33:07 -07:00 committed by Stephen Boyd
parent 917e83e6f4
commit 5192c55046
3 changed files with 27 additions and 0 deletions

View file

@ -977,6 +977,9 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
/* PCI errors [4.15.2.4] */
if (unlikely ((status & STS_FATAL) != 0)) {
ehci_err(ehci, "fatal error\n");
if (hcd->driver->dump_regs)
hcd->driver->dump_regs(hcd);
panic("System error\n");
dbg_cmd(ehci, "fatal", cmd);
dbg_status(ehci, "fatal", status);
ehci_halt(ehci);

View file

@ -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 @@ struct msm_hsic_hcd {
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 @@ static inline struct usb_hcd *hsic_to_hcd(struct msm_hsic_hcd *mehci)
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 @@ static struct hc_driver msm_hsic_driver = {
.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 @@ static int __devinit ehci_hsic_msm_probe(struct platform_device *pdev)
}
}
__mehci = mehci;
/*
* This pdev->dev is assigned parent of root-hub by USB core,
* hence, runtime framework automatically calls this driver's

View file

@ -349,6 +349,7 @@ struct hc_driver {
/* to log completion events*/
void (*log_urb_complete)(struct urb *urb, char * event,
unsigned extra);
void (*dump_regs)(struct usb_hcd *);
void (*enable_ulpi_control)(struct usb_hcd *hcd, u32 linestate);
void (*disable_ulpi_control)(struct usb_hcd *hcd);
};