static int ulpi_read(struct msm_hsic_hcd *mehci, u32 reg) { struct usb_hcd *hcd = hsic_to_hcd(mehci); int cnt = 0; /* initiate read operation */ writel_relaxed(ULPI_RUN | ULPI_READ | ULPI_ADDR(reg), USB_ULPI_VIEWPORT); /* wait for completion */ while (cnt < ULPI_IO_TIMEOUT_USEC) { if (!(readl_relaxed(USB_ULPI_VIEWPORT) & ULPI_RUN)) break; udelay(1); cnt++; } if (cnt >= ULPI_IO_TIMEOUT_USEC) { dev_err(mehci->dev, "ulpi_read: timeout ULPI_VIEWPORT: %08x\n", readl_relaxed(USB_ULPI_VIEWPORT)); dev_err(mehci->dev, "PORTSC: %08x USBCMD: %08x FRINDEX: %08x\n", readl_relaxed(USB_PORTSC), readl_relaxed(USB_USBCMD), readl_relaxed(USB_FRINDEX)); /*frame counter increments afte 125us*/ udelay(130); dev_err(mehci->dev, "ulpi_read: FRINDEX: %08x\n", readl_relaxed(USB_FRINDEX)); return -ETIMEDOUT; } return ULPI_DATA_READ(readl_relaxed(USB_ULPI_VIEWPORT)); }
static int msm_ulpi_read(struct msm_hcd *mhcd, u32 reg) { struct usb_hcd *hcd = mhcd_to_hcd(mhcd); unsigned long timeout; /* initiate read operation */ writel_relaxed(ULPI_RUN | ULPI_READ | ULPI_ADDR(reg), USB_ULPI_VIEWPORT); /* wait for completion */ timeout = jiffies + usecs_to_jiffies(ULPI_IO_TIMEOUT_USECS); while (readl_relaxed(USB_ULPI_VIEWPORT) & ULPI_RUN) { if (time_after(jiffies, timeout)) { dev_err(mhcd->dev, "msm_ulpi_read: timeout %08x\n", readl_relaxed(USB_ULPI_VIEWPORT)); dev_err(mhcd->dev, "PORTSC: %08x USBCMD: %08x\n", readl_relaxed(USB_PORTSC), readl_relaxed(USB_USBCMD)); return -ETIMEDOUT; } udelay(1); } return ULPI_DATA_READ(readl_relaxed(USB_ULPI_VIEWPORT)); }
static unsigned ulpi_read(struct usb_info *ui, unsigned reg) { unsigned timeout = 100000; /* initiate read operation */ writel(ULPI_RUN | ULPI_READ | ULPI_ADDR(reg), USB_ULPI_VIEWPORT); /* wait for completion */ while ((readl(USB_ULPI_VIEWPORT) & ULPI_RUN) && (--timeout)) ; if (timeout == 0) { ERROR("ulpi_read: timeout %08x\n", readl(USB_ULPI_VIEWPORT)); return 0xffffffff; } return ULPI_DATA_READ(readl(USB_ULPI_VIEWPORT)); }
static unsigned ulpi_read(void __iomem *usb_base, unsigned reg) { unsigned timeout = 100000; /* initiate read operation */ writel(ULPI_RUN | ULPI_READ | ULPI_ADDR(reg), USB_ULPI_VIEWPORT); /* wait for completion */ while ((readl(USB_ULPI_VIEWPORT) & ULPI_RUN) && (--timeout)) cpu_relax(); if (timeout == 0) { printk(KERN_ERR "ulpi_read: timeout %08x\n", readl(USB_ULPI_VIEWPORT)); return 0xffffffff; } return ULPI_DATA_READ(readl(USB_ULPI_VIEWPORT)); }
static int ulpi_read(struct usb_phy *phy, u32 reg) { struct msm_otg *motg = container_of(phy, struct msm_otg, phy); int cnt = 0; /* initiate read operation */ writel(ULPI_RUN | ULPI_READ | ULPI_ADDR(reg), USB_ULPI_VIEWPORT); /* wait for completion */ while (cnt < ULPI_IO_TIMEOUT_USEC) { if (!(readl(USB_ULPI_VIEWPORT) & ULPI_RUN)) break; udelay(1); cnt++; } if (cnt >= ULPI_IO_TIMEOUT_USEC) { dev_err(phy->dev, "ulpi_read: timeout %08x\n", readl(USB_ULPI_VIEWPORT)); return -ETIMEDOUT; } return ULPI_DATA_READ(readl(USB_ULPI_VIEWPORT)); }