/* s3c_hsotg_txfifo_flush - flush Tx FIFO @hsotg: The driver state @idx: The index for the endpoint (0..15)  */
static void s3c_hsotg_txfifo_flush(struct s3c_hsotg *hsotg, unsigned int idx)
/* s3c_hsotg_txfifo_flush - flush Tx FIFO @hsotg: The driver state @idx: The index for the endpoint (0..15)  */
static void s3c_hsotg_txfifo_flush(struct s3c_hsotg *hsotg, unsigned int idx)
{
	int timeout;
	int val;
	writel(GRSTCTL_TXFNUM(idx) | GRSTCTL_TXFFLSH,
		hsotg->regs + GRSTCTL);
	timeout = 100;
	while (1) {
		val = readl(hsotg->regs + GRSTCTL);
		if ((val & (GRSTCTL_TXFFLSH)) == 0)
			break;
		if (--timeout == 0) {
			dev_err(hsotg->dev,
				"%s: timeout flushing fifo (GRSTCTL=%08x)\n",
				__func__, val);
			break;
		}
		udelay(1);
	}
}