/* Allocate dmareq0 to the current channel unless it's already taken  */
static int tusb_omap_use_shared_dmareq(struct tusb_omap_dma_ch *chdat)
/* Allocate dmareq0 to the current channel unless it's already taken  */
static int tusb_omap_use_shared_dmareq(struct tusb_omap_dma_ch *chdat)
{
	u32		reg = musb_readl(chdat->tbase, TUSB_DMA_EP_MAP);
	if (reg != 0) {
		DBG(3, "ep%i dmareq0 is busy for ep%i\n",
			chdat->epnum, reg & 0xf);
		return -EAGAIN;
	}
	if (chdat->tx)
		reg = (1 << 4) | chdat->epnum;
	else
		reg = chdat->epnum;
	musb_writel(chdat->tbase, TUSB_DMA_EP_MAP, reg);
	return 0;
}