c->activeQueueHead = NULL;
c->activeQueueTail = NULL;
c->lastHwBDProcessed = NULL;
- c->Channel.status = MGC_DMA_STATUS_UNKNOWN;
+ c->Channel.status = MUSB_DMA_STATUS_UNKNOWN;
c->controller = cppi;
c->bLastModeRndis = 0;
c->Channel.private_data = c;
struct cppi_descriptor *bd;
(void) cppi_channel_abort(&c->Channel);
- c->Channel.status = MGC_DMA_STATUS_UNKNOWN;
+ c->Channel.status = MUSB_DMA_STATUS_UNKNOWN;
c->controller = NULL;
/* free all its bds */
DBG(1, "re-allocating DMA%d %cX channel %p\n",
chNum, transmit ? 'T' : 'R', otgCh);
otgCh->hw_ep = ep;
- otgCh->Channel.status = MGC_DMA_STATUS_FREE;
+ otgCh->Channel.status = MUSB_DMA_STATUS_FREE;
DBG(4, "Allocate CPPI%d %cX\n", chNum, transmit ? 'T' : 'R');
otgCh->Channel.private_data = otgCh;
/* for now, leave its cppi IRQ enabled (we won't trigger it) */
c->hw_ep = NULL;
- channel->status = MGC_DMA_STATUS_UNKNOWN;
+ channel->status = MUSB_DMA_STATUS_UNKNOWN;
}
/* Context: controller irqlocked */
struct musb *musb = controller->musb;
switch (pChannel->status) {
- case MGC_DMA_STATUS_BUS_ABORT:
- case MGC_DMA_STATUS_CORE_ABORT:
+ case MUSB_DMA_STATUS_BUS_ABORT:
+ case MUSB_DMA_STATUS_CORE_ABORT:
/* fault irq handler should have handled cleanup */
WARN("%cX DMA%d not cleaned up after abort!\n",
otgChannel->transmit ? 'T' : 'R',
otgChannel->chNo);
//WARN_ON(1);
break;
- case MGC_DMA_STATUS_BUSY:
+ case MUSB_DMA_STATUS_BUSY:
WARN("program active channel? %cX DMA%d\n",
otgChannel->transmit ? 'T' : 'R',
otgChannel->chNo);
//WARN_ON(1);
break;
- case MGC_DMA_STATUS_UNKNOWN:
+ case MUSB_DMA_STATUS_UNKNOWN:
DBG(1, "%cX DMA%d not allocated!\n",
otgChannel->transmit ? 'T' : 'R',
otgChannel->chNo);
/* FALLTHROUGH */
- case MGC_DMA_STATUS_FREE:
+ case MUSB_DMA_STATUS_FREE:
break;
}
- pChannel->status = MGC_DMA_STATUS_BUSY;
+ pChannel->status = MUSB_DMA_STATUS_BUSY;
/* set transfer parameters, then queue up its first segment */
otgChannel->startAddr = dma_addr;
txChannel->activeQueueHead = NULL;
txChannel->activeQueueTail = NULL;
txChannel->Channel.status =
- MGC_DMA_STATUS_FREE;
+ MUSB_DMA_STATUS_FREE;
hw_ep = txChannel->hw_ep;
}
/* all segments completed! */
- rxChannel->Channel.status = MGC_DMA_STATUS_FREE;
+ rxChannel->Channel.status = MUSB_DMA_STATUS_FREE;
hw_ep = rxChannel->hw_ep;
chNum = otgCh->chNo;
switch (channel->status) {
- case MGC_DMA_STATUS_BUS_ABORT:
- case MGC_DMA_STATUS_CORE_ABORT:
+ case MUSB_DMA_STATUS_BUS_ABORT:
+ case MUSB_DMA_STATUS_CORE_ABORT:
/* from RX or TX fault irq handler */
- case MGC_DMA_STATUS_BUSY:
+ case MUSB_DMA_STATUS_BUSY:
/* the hardware needs shutting down */
regs = otgCh->hw_ep->regs;
break;
- case MGC_DMA_STATUS_UNKNOWN:
- case MGC_DMA_STATUS_FREE:
+ case MUSB_DMA_STATUS_UNKNOWN:
+ case MUSB_DMA_STATUS_FREE:
return 0;
default:
return -EINVAL;
* refers to an entire "DMA packet" not just emptying the
* current fifo; most segments need multiple usb packets.
*/
- if (channel->status == MGC_DMA_STATUS_BUSY)
+ if (channel->status == MUSB_DMA_STATUS_BUSY)
udelay(50);
/* scan the current list, reporting any data that was
}
}
- channel->status = MGC_DMA_STATUS_FREE;
+ channel->status = MUSB_DMA_STATUS_FREE;
otgCh->startAddr = 0;
otgCh->currOffset = 0;
otgCh->transferSize = 0;
*/
enum dma_channel_status {
/* unallocated */
- MGC_DMA_STATUS_UNKNOWN,
+ MUSB_DMA_STATUS_UNKNOWN,
/* allocated ... but not busy, no errors */
- MGC_DMA_STATUS_FREE,
+ MUSB_DMA_STATUS_FREE,
/* busy ... transactions are active */
- MGC_DMA_STATUS_BUSY,
+ MUSB_DMA_STATUS_BUSY,
/* transaction(s) aborted due to ... dma or memory bus error */
- MGC_DMA_STATUS_BUS_ABORT,
+ MUSB_DMA_STATUS_BUS_ABORT,
/* transaction(s) aborted due to ... core error or USB fault */
- MGC_DMA_STATUS_CORE_ABORT
+ MUSB_DMA_STATUS_CORE_ABORT
};
struct dma_controller;
static inline enum dma_channel_status
dma_channel_status(struct dma_channel *c)
{
- return (is_dma_capable() && c) ? c->status : MGC_DMA_STATUS_UNKNOWN;
+ return (is_dma_capable() && c) ? c->status : MUSB_DMA_STATUS_UNKNOWN;
}
/**
musb_ep = req->ep;
/* we shouldn't get here while DMA is active ... but we do ... */
- if (dma_channel_status(musb_ep->dma) == MGC_DMA_STATUS_BUSY) {
+ if (dma_channel_status(musb_ep->dma) == MUSB_DMA_STATUS_BUSY) {
DBG(4, "dma pending...\n");
return;
}
csr |= MUSB_TXCSR_P_WZC_BITS;
csr &= ~MUSB_TXCSR_P_SENTSTALL;
musb_writew(epio, MUSB_TXCSR, csr);
- if (dma_channel_status(dma) == MGC_DMA_STATUS_BUSY) {
- dma->status = MGC_DMA_STATUS_CORE_ABORT;
+ if (dma_channel_status(dma) == MUSB_DMA_STATUS_BUSY) {
+ dma->status = MUSB_DMA_STATUS_CORE_ABORT;
musb->dma_controller->channel_abort(dma);
}
DBG(20, "underrun on ep%d, req %p\n", epnum, request);
}
- if (dma_channel_status(dma) == MGC_DMA_STATUS_BUSY) {
+ if (dma_channel_status(dma) == MUSB_DMA_STATUS_BUSY) {
/* SHOULD NOT HAPPEN ... has with cppi though, after
* changing SENDSTALL (and other cases); harmless?
*/
csr, dma ? " (dma)" : "", request);
if (csr & MUSB_RXCSR_P_SENTSTALL) {
- if (dma_channel_status(dma) == MGC_DMA_STATUS_BUSY) {
- dma->status = MGC_DMA_STATUS_CORE_ABORT;
+ if (dma_channel_status(dma) == MUSB_DMA_STATUS_BUSY) {
+ dma->status = MUSB_DMA_STATUS_CORE_ABORT;
(void) musb->dma_controller->channel_abort(dma);
request->actual += musb_ep->dma->actual_len;
}
DBG(4, "%s, incomprx\n", musb_ep->end_point.name);
}
- if (dma_channel_status(dma) == MGC_DMA_STATUS_BUSY) {
+ if (dma_channel_status(dma) == MUSB_DMA_STATUS_BUSY) {
/* "should not happen"; likely RXPKTRDY pending for DMA */
DBG((csr & MUSB_RXCSR_DMAENAB) ? 4 : 1,
"%s busy, csr %04x\n",
}
if (status) {
- if (dma_channel_status(dma) == MGC_DMA_STATUS_BUSY) {
- dma->status = MGC_DMA_STATUS_CORE_ABORT;
+ if (dma_channel_status(dma) == MUSB_DMA_STATUS_BUSY) {
+ dma->status = MUSB_DMA_STATUS_CORE_ABORT;
(void) musb->dma_controller->channel_abort(dma);
}
}
/* second cppi case */
- if (dma_channel_status(dma) == MGC_DMA_STATUS_BUSY) {
+ if (dma_channel_status(dma) == MUSB_DMA_STATUS_BUSY) {
DBG(4, "extra TX%d ready, csr %04x\n", epnum, tx_csr);
goto finish;
/* faults abort the transfer */
if (status) {
/* clean up dma and collect transfer count */
- if (dma_channel_status(dma) == MGC_DMA_STATUS_BUSY) {
- dma->status = MGC_DMA_STATUS_CORE_ABORT;
+ if (dma_channel_status(dma) == MUSB_DMA_STATUS_BUSY) {
+ dma->status = MUSB_DMA_STATUS_CORE_ABORT;
(void) musb->dma_controller->channel_abort(dma);
xfer_len = dma->actual_len;
}
goto finish;
}
- if (unlikely(dma_channel_status(dma) == MGC_DMA_STATUS_BUSY)) {
+ if (unlikely(dma_channel_status(dma) == MUSB_DMA_STATUS_BUSY)) {
/* SHOULD NEVER HAPPEN ... but at least DaVinci has done it */
ERR("RX%d dma busy, csr %04x\n", epnum, rx_csr);
goto finish;
* and also duplicates dma cleanup code above ... plus,
* shouldn't this be the "half full" double buffer case?
*/
- if (dma_channel_status(dma) == MGC_DMA_STATUS_BUSY) {
- dma->status = MGC_DMA_STATUS_CORE_ABORT;
+ if (dma_channel_status(dma) == MUSB_DMA_STATUS_BUSY) {
+ dma->status = MUSB_DMA_STATUS_CORE_ABORT;
(void) musb->dma_controller->channel_abort(dma);
xfer_len = dma->actual_len;
done = TRUE;
pImplChannel->transmit = transmit;
pChannel = &(pImplChannel->Channel);
pChannel->private_data = pImplChannel;
- pChannel->status = MGC_DMA_STATUS_FREE;
+ pChannel->status = MUSB_DMA_STATUS_FREE;
pChannel->max_len = 0x10000;
/* Tx => mode 1; Rx => mode 0 */
pChannel->desired_mode = transmit;
pImplChannel->controller->bmUsedChannels &=
~(1 << pImplChannel->bIndex);
- pChannel->status = MGC_DMA_STATUS_UNKNOWN;
+ pChannel->status = MUSB_DMA_STATUS_UNKNOWN;
}
static void configure_channel(struct dma_channel *pChannel,
pImplChannel->transmit ? "Tx" : "Rx",
packet_sz, dma_addr, len, mode);
- BUG_ON(pChannel->status == MGC_DMA_STATUS_UNKNOWN ||
- pChannel->status == MGC_DMA_STATUS_BUSY);
+ BUG_ON(pChannel->status == MUSB_DMA_STATUS_UNKNOWN ||
+ pChannel->status == MUSB_DMA_STATUS_BUSY);
pChannel->actual_len = 0;
pImplChannel->dwStartAddress = dma_addr;
pImplChannel->len = len;
pImplChannel->wMaxPacketSize = packet_sz;
- pChannel->status = MGC_DMA_STATUS_BUSY;
+ pChannel->status = MUSB_DMA_STATUS_BUSY;
if ((mode == 1) && (len >= packet_sz)) {
configure_channel(pChannel, packet_sz, 1, dma_addr,
u8 *mbase = pImplChannel->controller->pCoreBase;
u16 csr;
- if (pChannel->status == MGC_DMA_STATUS_BUSY) {
+ if (pChannel->status == MUSB_DMA_STATUS_BUSY) {
if (pImplChannel->transmit) {
csr = musb_readw(mbase,
musb_writel(mbase,
MGC_HSDMA_CHANNEL_OFFSET(bChannel, MGC_O_HSDMA_COUNT), 0);
- pChannel->status = MGC_DMA_STATUS_FREE;
+ pChannel->status = MUSB_DMA_STATUS_FREE;
}
return 0;
}
if (csr & (1 << MUSB_HSDMA_BUSERROR_SHIFT)) {
pImplChannel->Channel.status =
- MGC_DMA_STATUS_BUS_ABORT;
+ MUSB_DMA_STATUS_BUS_ABORT;
} else {
dwAddress = musb_readl(mbase,
MGC_HSDMA_CHANNEL_OFFSET(
u8 devctl = musb_readb(mbase,
MUSB_DEVCTL);
- pChannel->status = MGC_DMA_STATUS_FREE;
+ pChannel->status = MUSB_DMA_STATUS_FREE;
/* completed */
if ((devctl & MUSB_DEVCTL_HM)
if (!dmareq_works())
tusb_omap_free_shared_dmareq(chdat);
- channel->status = MGC_DMA_STATUS_FREE;
+ channel->status = MUSB_DMA_STATUS_FREE;
/* Handle only RX callbacks here. TX callbacks musb be handled based
* on the TUSB DMA status interrupt.
chdat->len = len;
channel->actual_len = 0;
chdat->dma_addr = (void __iomem *)dma_addr;
- channel->status = MGC_DMA_STATUS_BUSY;
+ channel->status = MUSB_DMA_STATUS_BUSY;
/* Since we're recycling dma areas, we need to clean or invalidate */
if (chdat->tx) {
tusb_dma->sync_dev = -1;
}
- channel->status = MGC_DMA_STATUS_FREE;
+ channel->status = MUSB_DMA_STATUS_FREE;
return 0;
}
for (i = 0; i < MAX_DMAREQ; i++) {
struct dma_channel *ch = dma_channel_pool[i];
- if (ch->status == MGC_DMA_STATUS_UNKNOWN) {
- ch->status = MGC_DMA_STATUS_FREE;
+ if (ch->status == MUSB_DMA_STATUS_UNKNOWN) {
+ ch->status = MUSB_DMA_STATUS_FREE;
channel = ch;
chdat = ch->private_data;
break;
tusb_omap_dma_free_dmareq(chdat);
DBG(3, "ep%i: Could not get a DMA channel\n", chdat->epnum);
- channel->status = MGC_DMA_STATUS_UNKNOWN;
+ channel->status = MUSB_DMA_STATUS_UNKNOWN;
return NULL;
}
reg |= (1 << (chdat->epnum + 15));
musb_writel(tusb_base, TUSB_DMA_INT_CLEAR, reg);
- channel->status = MGC_DMA_STATUS_UNKNOWN;
+ channel->status = MUSB_DMA_STATUS_UNKNOWN;
if (chdat->ch >= 0) {
omap_stop_dma(chdat->ch);
if (!chdat)
goto cleanup;
- ch->status = MGC_DMA_STATUS_UNKNOWN;
+ ch->status = MUSB_DMA_STATUS_UNKNOWN;
ch->private_data = chdat;
}