chdat              61 drivers/usb/musb/tusb6010_omap.c static inline int tusb_omap_use_shared_dmareq(struct tusb_omap_dma_ch *chdat)
chdat              63 drivers/usb/musb/tusb6010_omap.c 	u32		reg = musb_readl(chdat->tbase, TUSB_DMA_EP_MAP);
chdat              66 drivers/usb/musb/tusb6010_omap.c 		dev_dbg(chdat->musb->controller, "ep%i dmareq0 is busy for ep%i\n",
chdat              67 drivers/usb/musb/tusb6010_omap.c 			chdat->epnum, reg & 0xf);
chdat              71 drivers/usb/musb/tusb6010_omap.c 	if (chdat->tx)
chdat              72 drivers/usb/musb/tusb6010_omap.c 		reg = (1 << 4) | chdat->epnum;
chdat              74 drivers/usb/musb/tusb6010_omap.c 		reg = chdat->epnum;
chdat              76 drivers/usb/musb/tusb6010_omap.c 	musb_writel(chdat->tbase, TUSB_DMA_EP_MAP, reg);
chdat              81 drivers/usb/musb/tusb6010_omap.c static inline void tusb_omap_free_shared_dmareq(struct tusb_omap_dma_ch *chdat)
chdat              83 drivers/usb/musb/tusb6010_omap.c 	u32		reg = musb_readl(chdat->tbase, TUSB_DMA_EP_MAP);
chdat              85 drivers/usb/musb/tusb6010_omap.c 	if ((reg & 0xf) != chdat->epnum) {
chdat              87 drivers/usb/musb/tusb6010_omap.c 			chdat->epnum, reg & 0xf);
chdat              90 drivers/usb/musb/tusb6010_omap.c 	musb_writel(chdat->tbase, TUSB_DMA_EP_MAP, 0);
chdat             100 drivers/usb/musb/tusb6010_omap.c 	struct tusb_omap_dma_ch	*chdat = to_chdat(channel);
chdat             101 drivers/usb/musb/tusb6010_omap.c 	struct tusb_omap_dma	*tusb_dma = chdat->tusb_dma;
chdat             102 drivers/usb/musb/tusb6010_omap.c 	struct musb		*musb = chdat->musb;
chdat             104 drivers/usb/musb/tusb6010_omap.c 	struct musb_hw_ep	*hw_ep = chdat->hw_ep;
chdat             112 drivers/usb/musb/tusb6010_omap.c 		chdat->epnum, chdat->tx ? "tx" : "rx");
chdat             114 drivers/usb/musb/tusb6010_omap.c 	if (chdat->tx)
chdat             122 drivers/usb/musb/tusb6010_omap.c 	if (unlikely(remaining > chdat->transfer_len)) {
chdat             124 drivers/usb/musb/tusb6010_omap.c 			chdat->tx ? "tx" : "rx", remaining);
chdat             128 drivers/usb/musb/tusb6010_omap.c 	channel->actual_len = chdat->transfer_len - remaining;
chdat             129 drivers/usb/musb/tusb6010_omap.c 	pio = chdat->len - channel->actual_len;
chdat             131 drivers/usb/musb/tusb6010_omap.c 	dev_dbg(musb->controller, "DMA remaining %lu/%u\n", remaining, chdat->transfer_len);
chdat             138 drivers/usb/musb/tusb6010_omap.c 		buf = phys_to_virt((u32)chdat->dma_addr) + chdat->transfer_len;
chdat             139 drivers/usb/musb/tusb6010_omap.c 		if (chdat->tx) {
chdat             140 drivers/usb/musb/tusb6010_omap.c 			dma_unmap_single(dev, chdat->dma_addr,
chdat             141 drivers/usb/musb/tusb6010_omap.c 						chdat->transfer_len,
chdat             145 drivers/usb/musb/tusb6010_omap.c 			dma_unmap_single(dev, chdat->dma_addr,
chdat             146 drivers/usb/musb/tusb6010_omap.c 						chdat->transfer_len,
chdat             154 drivers/usb/musb/tusb6010_omap.c 		tusb_omap_free_shared_dmareq(chdat);
chdat             158 drivers/usb/musb/tusb6010_omap.c 	musb_dma_completion(musb, chdat->epnum, chdat->tx);
chdat             164 drivers/usb/musb/tusb6010_omap.c 	if ((chdat->transfer_len < chdat->packet_sz)
chdat             165 drivers/usb/musb/tusb6010_omap.c 			|| (chdat->transfer_len % chdat->packet_sz != 0)) {
chdat             168 drivers/usb/musb/tusb6010_omap.c 		if (chdat->tx) {
chdat             170 drivers/usb/musb/tusb6010_omap.c 			musb_ep_select(mbase, chdat->epnum);
chdat             184 drivers/usb/musb/tusb6010_omap.c 	struct tusb_omap_dma_ch		*chdat = to_chdat(channel);
chdat             185 drivers/usb/musb/tusb6010_omap.c 	struct tusb_omap_dma		*tusb_dma = chdat->tusb_dma;
chdat             186 drivers/usb/musb/tusb6010_omap.c 	struct musb			*musb = chdat->musb;
chdat             188 drivers/usb/musb/tusb6010_omap.c 	struct musb_hw_ep		*hw_ep = chdat->hw_ep;
chdat             219 drivers/usb/musb/tusb6010_omap.c 	if (chdat->tx)
chdat             227 drivers/usb/musb/tusb6010_omap.c 			chdat->tx ? "tx" : "rx", dma_remaining);
chdat             231 drivers/usb/musb/tusb6010_omap.c 	chdat->transfer_len = len & ~0x1f;
chdat             234 drivers/usb/musb/tusb6010_omap.c 		chdat->transfer_packet_sz = chdat->transfer_len;
chdat             236 drivers/usb/musb/tusb6010_omap.c 		chdat->transfer_packet_sz = packet_sz;
chdat             238 drivers/usb/musb/tusb6010_omap.c 	dma_data = chdat->dma_data;
chdat             240 drivers/usb/musb/tusb6010_omap.c 		if (tusb_omap_use_shared_dmareq(chdat) != 0) {
chdat             241 drivers/usb/musb/tusb6010_omap.c 			dev_dbg(musb->controller, "could not get dma for ep%i\n", chdat->epnum);
chdat             253 drivers/usb/musb/tusb6010_omap.c 	chdat->packet_sz = packet_sz;
chdat             254 drivers/usb/musb/tusb6010_omap.c 	chdat->len = len;
chdat             256 drivers/usb/musb/tusb6010_omap.c 	chdat->dma_addr = dma_addr;
chdat             260 drivers/usb/musb/tusb6010_omap.c 	if (chdat->tx) {
chdat             287 drivers/usb/musb/tusb6010_omap.c 		chdat->epnum, chdat->tx ? "tx" : "rx", &dma_addr,
chdat             288 drivers/usb/musb/tusb6010_omap.c 		chdat->transfer_len, len, chdat->transfer_packet_sz, packet_sz);
chdat             304 drivers/usb/musb/tusb6010_omap.c 					chdat->transfer_len, dma_dir,
chdat             317 drivers/usb/musb/tusb6010_omap.c 		chdat->epnum, chdat->tx ? "tx" : "rx",
chdat             326 drivers/usb/musb/tusb6010_omap.c 	musb_ep_select(mbase, chdat->epnum);
chdat             327 drivers/usb/musb/tusb6010_omap.c 	if (chdat->tx) {
chdat             344 drivers/usb/musb/tusb6010_omap.c 	if (chdat->tx) {
chdat             348 drivers/usb/musb/tusb6010_omap.c 		psize |= chdat->transfer_packet_sz;
chdat             352 drivers/usb/musb/tusb6010_omap.c 			TUSB_EP_CONFIG_XFR_SIZE(chdat->transfer_len));
chdat             357 drivers/usb/musb/tusb6010_omap.c 		psize |= (chdat->transfer_packet_sz << 16);
chdat             361 drivers/usb/musb/tusb6010_omap.c 			TUSB_EP_CONFIG_XFR_SIZE(chdat->transfer_len));
chdat             369 drivers/usb/musb/tusb6010_omap.c 	struct tusb_omap_dma_ch	*chdat = to_chdat(channel);
chdat             371 drivers/usb/musb/tusb6010_omap.c 	if (chdat->dma_data)
chdat             372 drivers/usb/musb/tusb6010_omap.c 		dmaengine_terminate_all(chdat->dma_data->chan);
chdat             379 drivers/usb/musb/tusb6010_omap.c static inline int tusb_omap_dma_allocate_dmareq(struct tusb_omap_dma_ch *chdat)
chdat             381 drivers/usb/musb/tusb6010_omap.c 	u32		reg = musb_readl(chdat->tbase, TUSB_DMA_EP_MAP);
chdat             395 drivers/usb/musb/tusb6010_omap.c 	reg |= (chdat->epnum << (dmareq_nr * 5));
chdat             396 drivers/usb/musb/tusb6010_omap.c 	if (chdat->tx)
chdat             398 drivers/usb/musb/tusb6010_omap.c 	musb_writel(chdat->tbase, TUSB_DMA_EP_MAP, reg);
chdat             400 drivers/usb/musb/tusb6010_omap.c 	chdat->dma_data = &chdat->tusb_dma->dma_pool[dmareq_nr];
chdat             405 drivers/usb/musb/tusb6010_omap.c static inline void tusb_omap_dma_free_dmareq(struct tusb_omap_dma_ch *chdat)
chdat             409 drivers/usb/musb/tusb6010_omap.c 	if (!chdat || !chdat->dma_data || chdat->dma_data->dmareq < 0)
chdat             412 drivers/usb/musb/tusb6010_omap.c 	reg = musb_readl(chdat->tbase, TUSB_DMA_EP_MAP);
chdat             413 drivers/usb/musb/tusb6010_omap.c 	reg &= ~(0x1f << (chdat->dma_data->dmareq * 5));
chdat             414 drivers/usb/musb/tusb6010_omap.c 	musb_writel(chdat->tbase, TUSB_DMA_EP_MAP, reg);
chdat             416 drivers/usb/musb/tusb6010_omap.c 	chdat->dma_data = NULL;
chdat             430 drivers/usb/musb/tusb6010_omap.c 	struct tusb_omap_dma_ch	*chdat = NULL;
chdat             447 drivers/usb/musb/tusb6010_omap.c 			chdat = ch->private_data;
chdat             455 drivers/usb/musb/tusb6010_omap.c 	chdat->musb = tusb_dma->controller.musb;
chdat             456 drivers/usb/musb/tusb6010_omap.c 	chdat->tbase = tusb_dma->tbase;
chdat             457 drivers/usb/musb/tusb6010_omap.c 	chdat->hw_ep = hw_ep;
chdat             458 drivers/usb/musb/tusb6010_omap.c 	chdat->epnum = hw_ep->epnum;
chdat             459 drivers/usb/musb/tusb6010_omap.c 	chdat->completed_len = 0;
chdat             460 drivers/usb/musb/tusb6010_omap.c 	chdat->tusb_dma = tusb_dma;
chdat             462 drivers/usb/musb/tusb6010_omap.c 		chdat->tx = 1;
chdat             464 drivers/usb/musb/tusb6010_omap.c 		chdat->tx = 0;
chdat             470 drivers/usb/musb/tusb6010_omap.c 	if (!chdat->dma_data) {
chdat             472 drivers/usb/musb/tusb6010_omap.c 			ret = tusb_omap_dma_allocate_dmareq(chdat);
chdat             476 drivers/usb/musb/tusb6010_omap.c 			chdat->dma_data = &tusb_dma->dma_pool[0];
chdat             480 drivers/usb/musb/tusb6010_omap.c 	dma_data = chdat->dma_data;
chdat             483 drivers/usb/musb/tusb6010_omap.c 		chdat->epnum,
chdat             484 drivers/usb/musb/tusb6010_omap.c 		chdat->tx ? "tx" : "rx",
chdat             491 drivers/usb/musb/tusb6010_omap.c 	tusb_omap_dma_free_dmareq(chdat);
chdat             493 drivers/usb/musb/tusb6010_omap.c 	dev_dbg(musb->controller, "ep%i: Could not get a DMA channel\n", chdat->epnum);
chdat             501 drivers/usb/musb/tusb6010_omap.c 	struct tusb_omap_dma_ch	*chdat = to_chdat(channel);
chdat             502 drivers/usb/musb/tusb6010_omap.c 	struct musb		*musb = chdat->musb;
chdat             504 drivers/usb/musb/tusb6010_omap.c 	dev_dbg(musb->controller, "Release for ep%i\n", chdat->epnum);
chdat             508 drivers/usb/musb/tusb6010_omap.c 	dmaengine_terminate_sync(chdat->dma_data->chan);
chdat             509 drivers/usb/musb/tusb6010_omap.c 	tusb_omap_dma_free_dmareq(chdat);
chdat             616 drivers/usb/musb/tusb6010_omap.c 		struct tusb_omap_dma_ch	*chdat;
chdat             624 drivers/usb/musb/tusb6010_omap.c 		chdat = kzalloc(sizeof(struct tusb_omap_dma_ch), GFP_KERNEL);
chdat             625 drivers/usb/musb/tusb6010_omap.c 		if (!chdat)
chdat             629 drivers/usb/musb/tusb6010_omap.c 		ch->private_data = chdat;