/* special ep0 version of the above. no UBCR0 or double buffering; status handshaking is magic. most device protocols don't need control-OUT. CDC vendor commands (and RNDIS), mass storage CB/CBI, and some other protocols do use them.  */
static int read_ep0_fifo(struct pxa25x_ep *ep, struct pxa25x_request *req)
/* special ep0 version of the above. no UBCR0 or double buffering; status handshaking is magic. most device protocols don't need control-OUT. CDC vendor commands (and RNDIS), mass storage CB/CBI, and some other protocols do use them.  */
static int read_ep0_fifo(struct pxa25x_ep *ep, struct pxa25x_request *req)
{
	u8 *buf, byte;
	unsigned bufferspace;
	buf = req->req.buf + req->req.actual;
	bufferspace = req->req.length - req->req.actual;
	while (readl(&ep->dev->regs->udccs[0]) & UDCCS0_RNE) {
		byte = (u8)readb(&ep->dev->regs->uddr0);
		if (unlikely(bufferspace == 0)) {
			if (req->req.status != -EOVERFLOW)
				printf("%s overflow\n", ep->ep.name);
			req->req.status = -EOVERFLOW;
		} else {
			*buf++ = byte;
			req->req.actual++;
			bufferspace--;
		}
	}
	writel(UDCCS0_OPR | UDCCS0_IPR, &ep->dev->regs->udccs[0]);
	if (req->req.actual >= req->req.length)
		return 1;
	return 0;
}