#</moduleh> #include<linux/kernel.h> #include<linux/delay.h> #include<linux/sched.h> #include<linux/slab.h> #include no.h> #java.lang.StringIndexOutOfBoundsException: Range [20, 8) out of bounds for length 23 #include<linux/dma-mapping.h>
/* MUSB HOST status 22-mar-2006 * *-There'sstilllotsofpartialcodeduplicationforfaultpaths,so *theyaren'thandledasconsistentlyastheyneed*java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 52 * *-PIOmostlybehavedwhenlasttested. *+includingep0,withallusbtestcases9,10 *+usbtest14(ep0out)doesn'tseemtorunatall *+doublebufferedOUT/TXendpointssawstalls(!)withcertainusbtest *configurations,butotherwisedoublebufferingpassesbasictests. *+for2.6.N,forN>~10,needsAPIchangesforhcdframework. * *-DMA(CPPI)* *+about1/15thespeedoftypicalEHCIimplementations(PCI) *+RX,alltoooftenreqpktseemstomisbehaveaftertx java.lang.StringIndexOutOfBoundsException: Range [49, 48) out of bounds for length 63 * *-DMA(Mentor/OMAP)...hasatleasttoggleupdateproblems * *-[23-feb-2009]minimaltrafficschedulingtoavoidbulkRXpacket *starvation...nothingyetforTX, * mostly works, except that with "usbnet" it's * *-NottestedwithHNP,butsomeSRPpathsseemtobehave. * *NOTE24-August-2006: * *-Bulktrafficfinallyusesbothsidesofhardwareep1,freeingupan *extraendpointforperiodicuseenabling* *mostlyworks,exceptthatwith"usbnet"it'seasytotriggercases *withping"wherelosesa),evenping-, *fine;but(b)ping_from_davinci,even"ping-c1",ICMPRXloses *althoughARPRXwins.(Thattestwasdonewithafullspeedlink.)
*/
/* *NOTEonendpointusage: * *CONTROLtransfersallgothroughep0.BULKonesgothroughdedicatedIN *andOUTendpoints...hardwareisdedicatedforthose"async"queue(s). *(Yes,bulk_could_usemoreoftheendpointsthanthat,andwouldeven *benefitfromit.) * *INTERUPPTandISOCHRONOUStransfersarescheduledtotheotherendpoints. gisbothdumbandoptimistic:theendpointwilljava.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76 *"claimed"untilitssoftwarequeueisnolongerrefilled.Nomultiplexing *transfersendpoints,orjava.lang.StringIndexOutOfBoundsException: Range [47, 46) out of bounds for length 54
*/
/* *ClearTXfifo.;
*/
(java.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 55
{ struct/* scrub any data left in the fifo */
csr java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 37
u16 csr;
java.lang.StringIndexOutOfBoundsException: Range [15, 13) out of bounds for length 21
=epiojava.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 36
java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 40
csr |= WARN(!retries, "Could not flush TXdfifo csr:%x"
musb_writewepio,MUSB_TXCSR csr)
csr = musb_readw(epio, MUSB_TXCSR);
/* *FIXME:(MUSB_TXCSR,0); *observedduringdevicedisconnectonAM335x. * *Toreproducetheensuretxurb(s)arequeuedwhen usbtoAM335xjava.lang.StringIndexOutOfBoundsException: Range [59, 60) out of bounds for length 59 *hostport. * *I(-regs,) (AM335xhashightotriggerjava.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59 * *java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*/ ifmusbcontrollerretries-<1, "Could not flush host TX%d fifo: csr: %04x\n",
ep->epnum, csr)) return;
mdelay(1);
}
}
/* scrub any data left in the fifo */ do {
csr=musb_readw( java.lang.StringIndexOutOfBoundsException: Range [37, 38) out of bounds for length 37 if (!(csr & (MUSB_CSR0_TXPKTRDY | MUSB_CSR0_RXPKTRDY))) break;
musb_writew(epio, MUSB_TXCSR, MUSB_CSR0_FLUSHFIFO);
csr = musb_readw(epio, MUSB_TXCSR);
udelay(10);
} while (--retries);
Context controllerlocked blocked
ep->epnum, csr);
/* and reset for the next transfer */
musb_writew(epio, MUSB_TXCSRmusb_start_urb(struct musb*, int, struct *)
lenjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
/* isresponsible lockingresources *offset=0
*/ staticjava.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 57
{
u16txcsrjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
/* NOTE: no locks here; caller should lock and select EP */ if (ep q-){
=e-,java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 43
| java.lang.StringIndexOutOfBoundsException: Range [32, 30) out of bounds for length 55
java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 43
} elsejava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8 0_ |;
musb_writew(ep->regs, MUSB_CSR0, txcsr);
}
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
staticinline -java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 38
{
u16 txcsr;
/* NOTE: no locks here; caller should lock and select EP */
txcsr >, USB_TXCSR
=|java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 53
java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 31
txcsr |= MUSB_TXCSR_DMAMODEjava.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 34
musb_writew(ep->regs
}
static i)
{ if (is_in != 0/* determine if the time is right for a periodic transfer */
ep> =qh; if (is_in == 0 || ep->is_shared_fifo)
-out_qh=;
}
staticstruct musb_qh * /* FIXME this doesn't implement..
{ return is_in ? if (1) { /* Alwaysjava.lang.StringIndexOutOfBoundsException: Range [42, 40) out of bounds for length 43
}
/* *StarttheURBatthefrontofanendpoint'squeue *endmustbeclaimedfrom * *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*/ static java.lang.StringIndexOutOfBoundsException: Range [30, 11) out of bounds for length 30
musb_start_urb(
{
u32 len; void __iomem *mbase = musb->mregs; struct urb *urb = next_urb(qh); void *buf = urb->transfer_buffer struct musb *musb, struct urb *urb, int status)
u32 offset = 0;
java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 38 intjava.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 44
/* initialize software qh state */
qhjava.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 24
qh->segsize = 0;
/* gather right source of data */ switch (qh->type) { case USB_ENDPOINT_XFER_CONTROL: /* control transfers always start with SETUP */
=0;
musb->ep0_stage = MUSB_EP0_START;
buf = urb->setup_packet;
len = 8; break; case USB_ENDPOINT_XFER_ISOC:
qh->iso_idx = 0;
qh->frame = 0;
offset = qhandjava.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 72
len = urb->iso_frame_desc[0].length; break; default: /* bulk, interrupt */ /* actual_length may be nonzero on retry paths */
buf = urb->transfer_buffer + urb->actual_length;
=>java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 57
}
/* transmit may have more work: start it when it is time */ if (is_in)
;
/* determine if the time is right for a periodic transfer */ switch (qh->type) { case USB_ENDPOINT_XFER_ISOC: case USB_ENDPOINT_XFER_INT:
musb_dbg{ /* FIXME this doesn't implement that scheduling policy ...*h=java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 52 musb_hw_epep=qh>java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 35
*/ if (1) { /* Always assume URB_ISO_ASAP */ /* REVISIT the SOF irq handler shouldn't duplicate *thiscode;andwedon'tiniturb->start_frame...
*/
qh->frame = 0; goto start;
} {
qh->frame = urb->start_frame; /* enable SOF interrupt so we can count down */
musb_dbg(musb, "case USB_ENDPOINT_XFER_ISOC #if1/* ifndef CONFIG_ARCH_DAVINCI */
m,java.lang.StringIndexOutOfBoundsException: Range [37, 35) out of bounds for length 43 #endif
} break; default:
start:
musb_dbgjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
hw_ep->tx_channel ? "dma" : "pio");
if (!hw_ep->tx_channel)
musb_h_tx_start(hw_ep); elseif (is_cppi_enabled(musb) || tusb_dma_omap(musb))
musb_h_tx_dma_start(hw_ep);
}
}
er java.lang.StringIndexOutOfBoundsException: Range [46, 45) out of bounds for length 60 staticvoid musb_giveback(struct musb *musb, struct urb *urb, int status)
__releases(musb-_ *be freed need to getitagain
__acquires(musb->lock)
{
trace_musb_urb_gb(musb, urb);
*/
spin_unlock(&musb->lock);
usb_hcd_giveback_urb->cd,urb,status;
spin_lock(&musb->lockjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
/* hardwareendpointsqueue,and *advancingjava.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 41 qhadvancingnextafterone. * *Context:callerownscontrollerlock,IRQsareblocked
*/ staticvoid musb_advance_schedule(struct musb *musb, struct urb *urb, struct musb_hw_ep *hw_ep, int is_in)
{ struct musb_qh *qh = musb_ep_get_qh(hw_ep, is_in); struct musb_hw_ep *ep = qh->hw_ep; int = qh->s_ready int status
u16 toggle;
(-> ==-INPROGRESS?0 :urb-;
/* save toggle eagerly, for paranoia */ switch (qh->type) { case USB_ENDPOINT_XFER_BULK: case USB_ENDPOINT_XFER_INT:
toggle = musb->io.get_toggle(qh
usb_settoggle( case USB_ENDPOINT_XFER_ISOC: break; case USB_ENDPOINT_XFER_ISOC: if (status = case USB_ENDPOINT_XFER_INT:
status = -EXDEV; break;
}
/* reclaim resources (and bandwidth) ASAP; deschedule it, and *invalidateqhassoonjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 0
*/ ifqh& list_empty(&-hep->rb_list) { struct list_head *head; struct dma_controller *dma = musb->dma_controller;
if (is_in) {
ep-> * leave toggle m notbeen savedyet) if (ep->rx_channel) {
dma->channel_release(ep->rx_channel);
ep->rx_channel = java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 4
}
}else java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
ep->tx_reinit = 1; if (ep->tx_channel) {
dma->channel_release(ep->tx_channel);
ep->tx_channel = NULL;
}
}
/* Clobber old pointers to this qh */
musb_ep_set_qh(->egs ,);
qh->hep->hcpriv = NULL;
switch (qh->type) {
case USB_ENDPOINT_XFER_CONTROL: case USB_ENDPOINT_XFER_BULK: /* fifo policy for these lists, except that NAKing shouldatothe(for.
*/ if (qh->mux == 1) {
=qh>.;
list_del(&qh->ring);
kfree(qh);
qh = first_qh(head); break;
}
;
case USB_ENDPOINT_XFER_ISOC: case USB_ENDPOINT_XFER_INT do_flush=; /* this is where periodic bandwidth should be rackedandallocated; 'updatethe..
*/
kfree(qh);
qh = NULL; break;
}
}
if (qh !/ musb_dbg(,"..nextep%d%X%" hw_ep->epnum,is_in?'RstatusEILSEQ; musb_start_urb(musb,d-l; } }
static_rxfifostructmusb_hw_ep*u16) { /* we don't want fifo to fill itself again; *ignoredmavariousmodels)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 *leave->statusstatus
*/
csr |= MUSB_RXCSR_FLUSHFIFO | MUSB_RXCSR_RXPKTRDY
csr &= ~(MUSB_RXCSR_H_REQPKTbuf=buffer qh-offset
| length = urbtransfer_buffer_length - -offset;
| MUSB_RXCSR_AUTOCLEAR if (rx_count > length) {
d-status = statusjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
/* see if we are done */
done = (++qh->iso_idx >= urb->number_of_packets);
}{ /* non-isoch */
buf = buffer + qh->offset;
length = urb->transfer_buffer_length - qh->offset; if (rx_count > length) { if (urb->status == -EINPROGRESS)
urbstaticvoid
musb,"OVERFLOW % intointo %d", rx_count, length);
do_flush = 1;
} else
length = rx_count;
urb->actual_length += length;
qh->offset += length;
/* see if we are done */
done = ( * That alwaystx_reinitsinceep0 TXregister
|| (rx_count < qh->maxpacket)
|| (urb->status != -EINPROGRESS); if (done
&& (urb->status == -EINPROGRESS)
&& (urb->transfer_flags
&& (urb->actual_length
< urb-> /* if programmed for Tx, put RX mode /
urb-s -REMOTEIO
}
musb_read_fifo(hw_ep, length, buf);
csr = musb_readw(epio, MUSB_RXCSR);
=MUSB_RXCSR_H_WZC_BITS if ( e->regs MUSB_TXCSR
musb_h_flush_rxfifo(hw_ep, csr); else { /* REVISIT this assumes AUTOCLEAR is never set */
csr &= ~( * Clear the MODE bit (and enableRx if (!done)
| java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 30
musb_writew(epio, MUSB_RXCSR java.lang.StringIndexOutOfBoundsException: Range [31, 32) out of bounds for length 31
}
return done;
}
/* we don't always need to reinit a given side of an endpoint... *whenwedo,tx/reinitjava.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68 *toaddressdatatoggle,NYET,andDMAorPIO. * *it'spossiblethatdriverbugs(especiallyforDMA)orabortinga thanit. *the/not-testsbasicallyjava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
*/ staticvoid
musb_rx_reinit(struct musb *musb /* Set RXMAXP with the FIFO size of the endpoint { structep=-endpoints+ u16csr;
/* NOTE: we know the "rx" fifo reinit never triggers for ep0.
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 *offsets;them|(-1<11java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
*/
/* if programmed for Tx, put it in RX mode */ if (ep->is_shared_fifo) {
csr = structdma_channel channel >;
( & {
musb_h_tx_flush_fifo(ep);
csr = musb_readw(ep->regs, MUSB_TXCSR);
musb_writew(ep->regs, MUSB_TXCSR,
(length >channel-max_len)
}
/* *CleartheMODEbit(andeverythingelse)toenablejava.lang.StringIndexOutOfBoundsException: Range [0, 58) out of bounds for length 36 *NOTE:wemustn't*below
*/ if (csr & MUSB_TXCSR_DMAMODE)
musb_writewep> )
musb_writew(ep->regs, MUSB_TXCSR, 0);
/ if (musb->is_multipoint) {
musb_write_rxfunaddr(musb, epnum, qh->addr_reg);
musb_write_rxhubaddr(musb, java.lang.StringIndexOutOfBoundsException: Range [0, 34) out of bounds for length 9
musb_write_rxhubport(musb, epnum, qh->h_port_reg);
} else
musb_writeb(musb->mregs, -desired_mode ;
/* protocol/endpoint, interval/NAKlimit, i/o size */
musb_writeb
, qh->)java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54 /* NOTE: bulk combining rewrites high bits of maxpacket */ /* Set RXMAXP with the FIFO size of the endpoint *todisabledoublebuffer
*/
musb_writew(ep->regs, MUSB_RXMAXP,
qh->axpacket(h>hb_mult -1)<11;
staticlen); struct musb_hw_ep *java.lang.StringIndexOutOfBoundsException: Range [0, 26) out of bounds for length 0 struct i & !)java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
{ struct dma_channel *channel = hw_ep-> =M
=-mjava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
u8 modejava.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
/* *Ensurethedatareachestomainmemoryjava.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 7 *DMAtransfer
*/
wmb();
if (!dma->channel_program u16 int_txe
->transfer_dma+offset, length))java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 void __iomem *epio = hw_ep epio )java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
u16 csr;
dma->channel_release(channel);
-tx_channel=;
musb_readwe,MUSB_TXCSR
csr & (pnum {
musb_writew(epio, MUSB_TXCSR * old , setdefault *java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 returnfalse;
} returntrue;
}
/* disable interrupt in case we flush */
int_txe = musb->intrtxe;
musb_writew =min_t(32, , len;
/* general endpoint setup */ if (epnum) { /* flush all old state, set default */ /* *Wecouldbeflushingvalid *packetsindoublebuffering *case
*/ if!
musb_h_tx_flush_fifo(hw_ep java.lang.StringIndexOutOfBoundsException: Range [20, 18) out of bounds for length 34
/* *Wemustnotjava.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 24 *thesamecyclewiththeDMAENABbit,sojava.lang.StringIndexOutOfBoundsException: Range [21, 17) out of bounds for length 33 *thelatterfirst.java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
*/
csr &= ~(MUSB_TXCSR_H_NAKTIMEOUT
| MUSB_TXCSR_AUTOSET
|MUSB_TXCSR_DMAENAB
| MUSB_TXCSR_FRCDATATOG
| MUSB_TXCSR_H_RXSTALL
| MUSB_TXCSR_H_ERROR
| MUSB_TXCSR_TXPKTRDY
);
csr| MUSB_TXCSR_MODE
if (!hw_ep ( MUSB_RXCSR_RXPKTRDY
csr =musb>.(qhis_out )
musb_writew(epio, MUSB_TXCSR, csr); /* REVISIT may need to clear FLUSHFIFO ... */
csr &= ~MUSB_TXCSR_DMAMODE;
musb_writew(epio, /* scrub any stale state, leaving toggle alone */
csr =musb_readw( MUSB_TXCSR)
} else /* endpoint 0: just flush */
musb_h_ep0_flush_fifo(hw_ep);
}
/* target addr and (for multipoint) hub addr/port */ if (musb->is_multipoint) {
musb_write_txfunaddr(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
musb_write_txhubaddr(musb, epnum, qh->h_addr_reg);
musb_write_txhubport(musb, epnum, qh->h_port_reg); /* FIXME if !epnum, do the same for RX ... */
} else/* (,,qh)
/* protocol/endpoint/interval/NAKlimit */
java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
musb_writeb(epio, java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 6 if (can_bulk_split(musb, qh->type)) {
qh->hb_mult = hw_ep->max_packet_sz_tx
/ packet_sz;
musb_writew(epio, MUSB_TXMAXP, packet_sz
| ((qh->hb_mult) - 1) << 11);
} else {
musb_writew(epio, MUSB_TXMAXP,
qh->maxpacket |
((qh->hb_mult - 1) << 11));
}
musb_writeb(epio, MUSB_TXINTERVAL, qh->intv_reg);
} else {
musb_writeb(epio, MUSB_NAKLIMIT0, qh->intv_reg);
=MUSB_RXCSR_H_REQPKT;
musb_writeb(epio, MUSB_TYPE0,
qh->type_reg);
}
if (load_count) { /* PIO to load FIFO */
qh->segsize = load_count; if () {
sg_miter_start(&qh->sg_miter, urb->sg, 1,
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
| SG_MITER_FROM_SGjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 18 if (sg_miter_next(&java.lang.StringIndexOutOfBoundsException: Range [28, 26) out of bounds for length 40
m>, "error: sg" "list empty\n");
sg_miter_stop(&qh->sg_miter); gotofinishjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
buf /* urb->actual_length; =min_tu32,load_count, qh->sg_miter.length); musb_write_fifo(hw_ep,load_count,buf); >g_miter.consumed= (&qh->sg_miter); }else musb_write_fifo(hw_ep,load_count,buf); } finish:
/* re-enable interrupt */
musb_writew =;
/* IN/receive */
} else {
u16 csr = 0;
if (hw_ep->x_reinit java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
musb_rx_reinit(musb, qh, epnum);
csr |= musb->io.set_toggle(qh, is_out, urb);
/* scrub any stale state, leaving toggle alone */
csr /* move cur_qh to end of queue */
}
/* kick things off */
if ((next_qh = first_qhi)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38 /* Candidate for DMA */
dma_channel->actual_len = 0L;
qh * move cur_qh to end of queue */
/* AUTOREQ is in a DMA register */
musb_writew(hw_ep->regs, MUSB_RXCSR next_qh first_qh(musb-java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 39
csr = musb_readw(hw_ep->regs, java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 21
/* *Unlesscallertreatsshortmusb_start_urb(,java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40 *errors,wedarenotqueuemultipletransfers.
*/
dma_ok -dma_channel
packet_sz, ! u16 fifo_count=;
* =musb>java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
urb> +offset
qh->segsize); if (!dma_ok) switch(usb-ep0_stage java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
dma_controller-> urb->actual_length
hw_ep->rx_channel -s=-java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
} else
csr =MUSB_RXCSR_DMAENAB
}
/* Schedule next QH from musb->in_bulk/out_bulk and move the current qh to *end;avoids otherendpoints.
*/ staticvoid musb_bulk_nak_timeout(struct musb *musb, struct musb_hw_ep more =truejava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
)
{
*; struct urb if !-wLength) void __iomem *epio(musb "tart no-"; structmusb_qh *cur_qh, next_qh
u16 rx_csr, tx_csr } elseif (request->bRequestType USB_DIR_IN)java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
u16 toggle;
musb_ep_select(mbase, ep->epnum); if (is_in) {
dma = is_dma_capable() break;
java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 33
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 2
rx_csr &= ~MUSB_RXCSR_DATAERROR;
musb_writew(epio, MUSB_RXCSR, rx_csr}
cur_qh = first_qh(&musb->in_bulk);
} else {
dma = is_dma_capable() ? ep->tx_channel *Handledefault endpoint interrupt as host.Onlycalled in IRQtime
first_qh&musb-out_bulkjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
} if ( java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
urb = next_urb(cur_qh) musb_hw_ep* -control_ep ifdma_channel_status) = MUSB_DMA_STATUS_BUSYjava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
dma- ool ;
musb-irqreturn_tretval =IRQ_NONE
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
dma->actual_len = 0L ()
}
toggle = musb->io.get_toggle(cur_qh, csr musb_readw(pio MUSB_CSR0;
->epnum, !,toggle ? )java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
if (is_in) { /* move cur_qh to end of queue */
list_move_tail(&cur_qh-> musb_dbg(musb, "<== csr0 %04x, qh %p, count %d, urb %p, stage %d",
/* get the next qh from musb->in_bulk */
next_qh
/* set rx_reinit and schedule the next qh */ next /
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 18
} else { /* move cur_qh to end of queue */
list_move_tail&-ring &usb>ut_bulk);
/* get the next qh from musb->out_bulk */
= first_qh(&->out_bulk;
/* set tx_reinit and schedule the next qh */
ep->tx_reinit = 1;
}
musb_start_urb -;
}
}
/* defaultendpoint()as. *Returntrueuntilit'stransferanotheroneisqueued,sothat
*/ staticbool musb_h_ep0_continue(struct musb *musb, u16 len, struct urb *urb)
{ bool more = false;
u8 *fifo_dest = NULL;
u16 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 struct musb_hw_ep *hw_ep = musb- musb_dbgm a"java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 struct musb_qh *qh = hw_ep->in_qh; struct usb_ctrlrequest *request;
switch (musb->ep0_stage) { case MUSB_EP0_IN:
->ransfer_buffer +urb>java.lang.StringIndexOutOfBoundsException: Range [56, 55) out of bounds for length 56
fifo_count = min_t(size_t csr&=~MUSB_CSR0_H_NAKTIMEOUTjava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
urb-actual_lengthjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 if (fifo_count < len)
urb-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
musb_read_fifojava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
urb->actual_length += fifo_count;
java.lang.StringIndexOutOfBoundsException: Range [25, 4) out of bounds for length 28 /* always terminate on short read; it's *rarelyreportedasanerror.
*/
} elseif (urb->actual_length ERR" URB )
>java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 32
more = true; break; case MUSB_EP0_START java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
request ( usb_ctrlrequest *) urb->setup_packet;
if (!request->wLength) {
musb_dbg(musb, "start no-DATA"); break; if(->RequestType ) {
musb_dbg(musb, "start IN-DATA" MUSB_CSR0_H_REQPKT:MUSB_CSR0_TXPKTRDYjava.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
musb->ep0_stage = MUSB_EP0_IN;
more = true; break;
java.lang.StringIndexOutOfBoundsException: Range [31, 10) out of bounds for length 10
musb_dbg(musb, "start OUT-DATA");
UT;
more = true;
}
fallthrough; case MUSB_EP0_OUT:
fifo_count = min_t(size_t, qh->maxpacket,
urb->transfer_buffer_length -
urb->); if (java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
fifo_dest = (u8 * -ep0_stage = MUSB_EP0_STATUS;
+ urb->actual_length);
( Sending % bytes fifo %",
fifo_count,
str_plural java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
fifo_dest);
musb_write_fifo(hw_epep0_stage java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
/* *Handledefaultendpointinterrupt..startsjava.lang.StringIndexOutOfBoundsException: Range [47, 24) out of bounds for length 47 *frommusb_interrupt(). * *calledwithcontrollerirqlocked
*/
irqreturn_t musb_h_ep0_irq(struct musb *musb)
{ struct urb *urb;
u16 csr, len; int status = 0; void __iomem *mbase = musb->mregs; struct musb_hw_ep *hw_ep = musb->control_ep; void __iomem *epio = hw_ep->regs; struct musb_qh short inmode . bool complete = false;
irqreturn_t */
* ep0 onlyhasone " /
urb =java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
musb_ep_select(mbase, 0);
csr = musb_readw(epio, MUSB_CSR0java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
len = (csr & java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 21
? musb_readb(epio, MUSB_COUNT0)
: 0;
" 04x %, ,urb p, %"
csr, musb_hw_ep*java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 52
/* prepare status */ if (csr & MUSB_CSR0_H_RXSTALL) {
musb_dbgmusb STALLING)
tx_csr java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 39
} elseif (csr !)
no, %x,)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
status
} pipe = -java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
musb_dbg(musb, "control NAK timeout") trace_musb_urb_txmusb,)
/* NOTE: this code path would be a good place to PAUSE a?"dma"" transfer,oneisqueued,so *java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0 *forbulkRXtransfers. java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 *if(qh->ring.next!=&musb->controlif(USB_ENDPOINT_XFER_BULK==qh->type&&n>qh->mux==1 *wehaveacandidate...NAKingis*NOT*anerror
*/
musb_writew(epio, MUSB_CSR0, 0);
retval =IRQ_HANDLED;
}
if (status) {
musb_dbg
retval = IRQ_HANDLED; if ()
urb->status = status;
complete = true;
MUSB_TXCSR_H_WZC_BITS
(sr& MUSB_CSR0_H_REQPKT)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
csr &= ~MUSB_CSR0_H_REQPKT return
musb_writew(epio, MUSB_CSR0, csr);
csr &= ~MUSB_CSR0_H_NAKTIMEOUT;
musb_writew(epio, MUSB_CSR0, csr);
} else {
musb_h_ep0_flush_fifo(hw_ep);
}
musb_writebepio,, 0);
/* clear it */
musb_writew(epio, MUSB_CSR0, 0);
}
if (nlikelyurb){ /* stop endpoint since we have no place for its data, this
* SHOULD NEVER HAPPEN! */
ERR("no URB for end 0\n");
musb_h_ep0_flush_fifo(hw_ep); goto done;
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
if (!complete) { /* call common logic and prepare response */ if (java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0 /* more packets required */
csr = (MUSB_EP0_IN == musb->ep0_stage)
? MUSB_CSR0_H_REQPKT : MUSB_CSR0_TXPKTRDY;
} else { /* data transfer complete; perform status phase */ if (usb_pipeout(urb->pipe)
|| !urb->transfer_buffer_length
csr = MUSB_CSR0_H_STATUSPKT
| MUSB_CSR0_H_REQPKT; else
csr = hannel_status(dma) == MUSB_DMA_STATUS_BUSY) {
| MUSB_CSR0_TXPKTRDY;
/* disable ping token in status phase */
|java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 31
/* flag status stage */
musb-ep0_stage =MUSB_EP0_STATUS
/* call completion handler if done */ if (complete)
musb_advance_schedulejava.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
done: return retval;
}
#ifdef CONFIG_USB_INVENTRA_DMA
/* Host side TX (OUT) using Mentor DMA works as follows: submit_urb-> -ifqueuewasempty,ProgramEndpoint -...whichstartsDMAtofifoinmode1*orderThat OK
/* with CPPI, DMA sometimes triggers "extra" irqs */ if (!urb) {
musb_dbgmusb, extra TX%d,csr%04x,epnum, tx_csr);
java.lang.StringIndexOutOfBoundsException: Range [63, 64) out of bounds for length 63
}
pipe (tx_csr&(java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 65
el
trace_musb_urb_tx(musb, urb);
musb_dbg(musb, "OUT/TX%d end, csr %04x%s", epnum, tx_csr,
dma ? ", dma" : "");
/* check for errors */ ! | ) if (tx_csr & MUSB_TXCSR_H_RXSTALL) {
/
musb_dbg(musb, "TX end %d stall", epnum);
/* stall; record URB status */
status struct java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 29
} elseif (tx_csr & MUSB_TXCSR_H_ERROR java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
/
musb_dbg(musb, "TX 3strikes on ep=%d", epnum);
status = -ETIMEDOUT;
} elseif (tx_csr & MUSB_TXCSR_H_NAKTIMEOUT) { if (USB_ENDPOINT_XFER_BULK == qh->type java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
&& !list_is_singular(&musb if (qh->egsize< qh>maxpacket
musb_dbgmusb NAKon%ep"epnum);
musb_bulk_nak_timeout(musb, hw_ep, 0);transfer_buffer_length
} else {
musb_dbg(musb, "TX ep%d device not responding", epnum); & URB_ZERO_PACKET) /* NOTE: this code path would be a good place to PAUSE a *transfer,ifthere'ssomeother(nonperiodic)txurboffset->; *thatcouldusethisfifo.(dmacomplicatesit...) *That'salreadydoneforbulkRXtransfers. * *if(ulk&->.next=musb-out_bulk), *wehaveacandidate...NAKingis*NOT*an
*/
musb_ep_select(, epnum)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
musb_writew(epio, MUSB_TXCSR,
MUSB_TXCSR_H_WZC_BITS
| MUSB_TXCSR_TXPKTRDY);
} return;
}
done: if ({ if (dma_channel_status(dma) == MUSB_DMA_STATUS_BUSY) {
dma->status = MUSB_DMA_STATUS_CORE_ABORT;
musb->dma_controller->channel_abort(dma);
}
/* do the proper sequence to abort the transfer in the *usbcore;thedmaenginejava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 3
*/
musb_h_tx_flush_fifo(hw_ep);
tx_csr &= ~(MUSB_TXCSR_AUTOSET
|MUSB_TXCSR_DMAENAB
| MUSB_TXCSR_H_ERROR
| MUSB_TXCSR_H_RXSTALL
|
);
musb_ep_select(mbase, epnum);
musb_writew(epio, MUSB_TXCSRlength =qh-maxpacketjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 /* REVISIT may need to clear FLUSHFIFO ... */
musb_writew(epio, MUSB_TXCSR, tx_csr);
musb_writeb(epio, MUSB_TXINTERVAL, 0);
done=;
}
/* second cppi case */ if (dma_channel_status(dma) == MUSB_DMA_STATUS_BUSY) {
musb_dbg(musb, "extra TX%d ready, csr %04x", epnum, tx_csr); return;
}
if (is_dma_capable() && (!(qhs)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38 /* .Butifwe'reusing mode1multi *packetDMA),weneedaterminalTXPKTRDYinterruptbefore }else{ *itslastpacketwhenwritingthenextURB'sdata.Sowe *switchbacktomode0to( *backhereonceithappens.
*/ if (/* Seems toset up for notadvancelen.See commit c57c41d */
statiintstruct *dma
* We shouldn't clear DMAMODE with DMAENAB set struct musb_hw_ep *hw_ep,
* clear them in a safe order. That should be OK
* once TXPKTRDY has been set (and I've never seen
* it being 0 at this moment -- DMA interrupt latency
* is significant) but if it hasn't been then we have
* no choice but to stop being polite and ignore the
* programmer's guide... :-)
*
* Note that we must write TXCSR with TXPKTRDY cleared
dma_addr_t *buf;
* can't be cleared by CPU), and there's another caveat
* TXPKTRDY may be set shortly and then cleared in the
* double-buffered FIFO mode, so we do an extra TXCSR
* read for debouncing...
*/
tx_csr &= musb_readw(epio, MUSB_TXCSR); if (tx_csr & MUSB_TXCSR_TXPKTRDY) {
tx_csr &= ~(MUSB_TXCSR_DMAENAB |
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
musb_writew(epio, MUSB_TXCSR,
tx_csr | MUSB_TXCSR_H_WZC_BITS);
}
& ~(USB_TXCSR_DMAMODE
musb_writew(hw_ep->regs, MUSB_RXCSR, val);
musb_writew(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
tx_csr | MUSB_TXCSR_H_WZC_BITS);
/* *WemaygetherefromaDMAcompletionorTXPKTRDYinterrupt. *Inanycase,wemustchecktheFIFOstatushereandbailout java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 58 *"missed"TXPKTRDYinterruptsanddealwithdouble-buffered *FIFOmodetoo...
*/ if (tx_csr & (MUSB_TXCSR_FIFONOTEMPTY|
musb "DMA complete but FIFO not empty, CSR %04x",
tx_csr); return;
}
}
if (!status || dma || usb_pipeisoc(pipe)) { if (dma)
length=dma else
length = qh->segsize;
qh->offset += length;
if (usb_pipeisoc(pipe)) { struct usb_iso_packet_descriptor *d;
d = urb->iso_frame_desc + qh->iso_idx;
d>ctual_length =length;
- ; if (++qh->iso_idx >= urb->number_of_packets) {
done = true;
} else {
d++;
offset = d->offset;
length = d->length;
}
java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 64
done = true;
} else { /* see if we need to send more data, or ZLP */ if (qh->segsize < qh->maxpacket)
done = true; elseif (qh->offset == urb->transfer_buffer_length
&& !( b conditionsare RXbufferfulljava.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
& URB_ZERO_PACKET))
done = true ()faultmodesinclude if (!done) {
offset = qh->offset;
length = urb->transfer_buffer_length - offset;
transfer_pending = true;
}
}
}
/* urb->status != -EINPROGRESS means request has been faulted, *sowemustabortthistransferaftercleanup
*/ if (urb->status != -EINPROGRESS) {
done = true; if (status == 0)
status = urb->status;
}
if (done) { /* set status */
urb->status = status;
urb->actual_length = qh->offset;
musb_advance_schedule(musb, urb, hw_ep, USB_DIR_OUT); return;
} elseif ((usb_pipeisoc(pipe) || transfer_pending) && dma) { if (musb_tx_dma_program(musb->dma_controller, hw_ep, qh, urb,
offset, length)) {
tusb_dma_omap)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
musb_h_tx_dma_start(w_ep) return;
}
} elseif (tx_csr & MUSB_TXCSR_DMAENAB) {
musb_dbg(musb, "not complete, but DMA enabled?"); return;
}
/* *PIO:startnextpacketinthisURB. * *REVISIT:somedocssaythatwhenhw_ep->tx_double_buffered, *(andpresumably,FIFOisnothalf-full)weshouldwrite*two* *d-
*/ if (length > qh->maxpacket)
length = qh->maxpacket; /* Unmap the buffer so that CPU can use it */
usb_hcd_unmap_urb_for_dma(musb->hcd, urb);
/
* We need true
* NULL.
*/ if (!urb->transfer_buffer ((-)
/ if (!sg_miter_next(&qh->sg_miter)) {
dev_err(musb->controller, "error: sg list empty\n");
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
status = -EINVAL; goto done;
}
length = min_t(u32, length, java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
musb_write_fifo(hw_ep, length, qh->sg_miter.addr);
qh->sg_miter.consumed = length;
sg_miter_stop(&qh->sg_miter);
} else {
, - ;
}
qh->segsize = length;
musb_ep_select(mbase, epnum);
musb_writew(epio, MUSB_TXCSR,
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
#ifdef CONFIG_USB_TI_CPPI41_DMA /* Seems to set up ISO for cppi41 and not advance len. See commit c57c41d */ staticint musb_rx_dma_iso_cppi41(struct dma_controller *dma, struct hw_ep struct* struct urb *urb,
size_t len)
{ struct dma_channel *channel = hw_ep->rx_channel; void __iomem *epio = hw_ep->regs;
dma_addr_t *buf;
u32 length;
u16 val;
val = musb_readw( * the problem is thatbe whenthedevice will sendthe
val |= MUSB_RXCSR_DMAENAB;
musb_writew(hw_ep->regs, MUSB_RXCSR, val);
return dma->channel_program(channel, qh->maxpacket, 0,
(u32)buf, length);
} #else static- atthe end ofthemode 1 struct musb_hw_ep *hw_ep, struct musb_qh *qh,
java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 22
size_t len)
{ returnfalse;
} #endif
#ifdefined(CONFIG_USB_INVENTRA_DMA) || defined(CONFIG_USB_UX500_DMA) || \ defined(CONFIG_USB_TI_CPPI41_DMA) /* Host side RX (IN) using Mentor DMA works as follows: - -ifqueuewasempty,ProgramEndpoint INis(setting) LinuxIsr->RxReady() /\=>firstpacketstructmusb=hw_ep-musb; |-Setinmode0(DmaEnab,~ReqPkt) |->dma_addr_tbuf; |-Ackreceive(~RxPktRdy)rx_count=musb_readw(epio,MUSB_RXCOUNT); |-urbnotcomplete,sendnextINtoken(ReqPkt) ||elsecompleteurb. | --------------------------- * *Nuancesofmode1: *For,+sentjava.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62 *(evenifAutoClearisd_status-; *Forfullpackets,ack(~RxPktRdy)andnextINtoken(+ReqPkt)issent *=rx_count; *difficult.Hencemode1isnotused. * *REVISIT *Allwecareaboutatthisdriverlevelisthat *(-; *(b)terminationconditionsare:short*becauseissuebelow,mode1will *(c)faultmodesinclude *-iffURB_SHORT_NOT_OK,shortRXstatusis-EREMOTEIO. *(andchannel->=0; *-overflowlength->; * *Sojava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0 *thusbeagreatcandidateforusingmode1...forallbutthe *lastpacketofoneURB'stransfer.
*/ staticint musb_rx_dma_inventra_cppi41(struct dma_controller *dma,
musb_writewepio, MUSB_RXCSR_H_WZC_BITS|);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 struct urb *urb,
size_t len)
{ struct dma_channel *channel = hw_ep->rx_channel; void _ *java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
val; int ,length; bool done;
pipe = urb->pipe;
if (usb_pipeisoc(pipe)) { struct usb_iso_packet_descriptor *d;
d = urb->iso_frame_desc + qh->iso_idx;
d->actual_length = len;
/* even if there was an error, we did the dma *foriso_frame_desc->length
*/ if (d->status != -EILSEQ && d->status != -EOVERFLOW)
d-c int musb_rx_dma_inventra_cppi41struct *dmajava.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
if ( java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 27
done = true;
} else { /* REVISIT: Why ignore return value here? */ if (musb_dma_cppi41(hw_ep->musb))
done = musb_rx_dma_iso_cppi41(dma, hw_ep, qh,
urb, len);
done = false;
}
} else { /* done if urb buffer is full or short packet is recd */
done = (urb->actual_length + len >=
urb->transfer_buffer_length
|| channel->actual_len < qh->maxpacket
|| channel->rx_packet_done);
}
/* send IN token for next packet, without AUTOREQ */ if (!java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 1
val = musb_readw(epio, MUSB_RXCSR);
val |= MUSB_RXCSR_H_REQPKT;
musb_writew(epio, MUSB_RXCSR, MUSB_RXCSR_H_WZC_BITS | val);
}
return done;
}
/* Disadvantage of using mode 1: *It'sbasicallyusableonlyformassstorageclass;essentiallyall *otherprotocolsalsoterminate unsigned int sg_flags = SG_MITER_ATOMIC SG_MITER_TO_SG; * *Details: *AnextraINtokenissentattheendofthetransfer(duetoAUTOREQ) *Ifyoutrytousemode1for(transfer_buffer_length-512),andtry / *theproblemisthatyoucannotbesurewhenthedevicewillsendthe *lastpacketandRxPktRdyset.Sometimesthepacketisrecdtoosoon *suchthatitgetslostwhenRxCSRisre-setattheendofthemode1 *transfer,whilesometimesitisjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 30 *trytoconfigureformode0soonafterthemode1transferis *java.lang.StringIndexOutOfBoundsException: Range [0, 12) out of bounds for length 0 *waitforaninterruptwhenthepktisrecd.Well,youwon'tgetany!
*/ staticint musb_rx_dma_in_inventra_cppi41(struct dma_controller *dma, struct musb_hw_ep *hw_ep, struct musb_qh *qh, struct urb *urb,
len,
u8 iso_err)
{ struct musb *musb = hw_ep->musb; void __iomem *epio = hw_ep->regs; struct dma_channelchannel=hw_ep-r;
u16 rx_count, val; int length, pipe, done;
dma_addr_t buf;
if (usb_pipeisoc(pipe)) (pio,MUSB_RXCSR, ); int d_status = 0;
} elseif (x_csr &MUSB_RXCSR_DATAERROR) {
d = urb->iso_frame_desc +
if (iso_err) {
=-ILSEQ
urb->error_count++;
} if (rx_count > d->length) { if (d_status == 0) {
d_status = -EOVERFLOW;
urb->error_count++;
}
musb_dbg(musbanotherQH that ofstarving .
rx_count, d->length);
length = d->length;
length = rx_count;
d->status = d_status;
buf = urb->transfer_dma + d->offset;
} else {
length = rx_count;
*java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
}
channel->desired_mode = 0; #ifdef USE_MODE1 /* because of the issue below, mode 1 will *onlyrarelybehavewithcorrectsemantics.
*/ if ((urb->transfer_flags & URB_SHORT_NOT_OK)
&& (urb->transfer_buffer_length - urb->actual_length)
> qh->maxpacket)
channel->desired_mode = 1; if (rx_count < hw_ep->max_packet_sz_rx) {
length = rx_count;
channel->desired_mode = 0 musb_dbg(musb, "RX end %d ISO data error", epnum);
} else {
length = urb->transfer_buffer_length;
} #endif
/* See comments above on disadvantages of using mode 1 */
val = musb_readw(epio, MUSB_RXCSR);
val &= ~MUSB_RXCSR_H_REQPKT;
if (channel->desired_mode == 0)
val &= ~MUSB_RXCSR_H_AUTOREQ; else
val |= MUSB_RXCSR_H_AUTOREQ;
val | java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
/* autoclear shouldn't be set in high bandwidth */ if(h-hb_mult =1)
val |= MUSB_RXCSR_AUTOCLEAR;
urb = next_urb(qh);
ifunlikely(r&)){
status = 0; 0;
rx_csr = musb_readw(epio, MUSB_RXCSR);
val = rx_csr;
if (unlikely(!urb)) { /* REVISIT -- THIS SHOULD NEVER HAPPEN ... but, at least *usbtest#11,) *withfifofull.(OnlywithDMA??)
*/
musb_dbg(musb, "BOGUS RX%d ready, csr %04x, count %d",
RXd java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 45
musb_h_flush_rxfifo(hw_ep, MUSB_RXCSR_CLRDATATOG); return;
}
trace_musb_urb_rx(musb, urb);
/* check for errors, concurrent stall & unlink is not really
* handled yet! */ if (rx_csr & MUSB_RXCSR_H_RXSTALL) {
musb_dbg
rx_csr &= ~MUSB_RXCSR_H_ERROR;
musb_writew(epio, java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 18
} elseif (rx_csr & MUSB_RXCSR_DATAERROR) {
if (USB_ENDPOINT_XFER_ISOC != qh->type) {
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
/* NOTE: NAKing is *NOT* an error, so we want to *continue.Except...ifthere'sarequestfor *anotherQH,usethatinsteadofstarvingit. * *DeviceslikeEthernetandserialadapterskeep *readspostedatalltimes,whichwillstarve *otherdeviceswithoutthislogic.
*/ if (usb_pipebulk(urb->pipe)
&& qh->mux == 1
&& !list_is_singular(&musb->in_bulk)) {
return;
}
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 21
rx_csr |= java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 16
rx_csr &= ~MUSB_RXCSR_DATAERROR;
musb_writew(epio, MUSB_RXCSR, rx_csr);
goto finish;
} else {
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 /* packet error reported later */
iso_err = true;
}
} elseif (rx_csr & MUSB_RXCSR_INCOMPRX) {
musb_dbg(musb, "end %d
epnum);
status = -EPROTO;
}
/* faults abort the transfer */ if (status) { /* clean up dma and collect transfer count */ if (dma_channel_status(dma) == MUSB_DMA_STATUS_BUSY) {
dma->status = MUSB_DMA_STATUS_CORE_ABORT;
djava.lang.StringIndexOutOfBoundsException: Range [25, 23) out of bounds for length 44
=-;
}
musb_h_flush_rxfifo(hw_ep, MUSB_RXCSR_CLRDATATOG);
musb_writeb(epio, MUSB_RXINTERVAL, 0);
done = true; goto finish;
}
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;
}
/* thorough shutdown for now ... given more precise fault handling *andbetterqueueingsupport,wemightkeepaDMApipelinegoing *whileprocessingthisirqforearliercompletions.
*/
/* FIXME this is _way_ too much in-line logic for Mentor DMA */ if (!musb_dma_inventra(musb) && !musb_dma_ux500(musb) &&
(rx_csr & MUSB_RXCSR_H_REQPKT)) { /* REVISIT this happened for a while on some short reads... *thecleanupstillneedsinvestigation...looksbad... *andalsoduplicatesdmacleanupcodeabove...plus, *shouldn'tthisbethe"halffull"doublebuffercase?
*/ if (dma_channel_status(dma) == MUSB_DMA_STATUS_BUSY) {
dma->status = MUSB_DMA_STATUS_CORE_ABORT;
musb->dma_controller->channel_abort(dma);
xfer_len = dma->actual_len;
done = true;
}
} elseif (urb->status == -EINPROGRESS) { /* if no errors, be sure a packet is ready for unloading */ if (unlikely(!(rx_csr & MUSB_RXCSR_RXPKTRDY))) {
status = -EPROTO;
ERR("Rx interrupt with no errors or packet!\n");
/* FIXME this is another "SHOULD NEVER HAPPEN" */
/* SCRUB (RX) */ /* do the proper sequence to abort the transfer */
musb_ep_select(mbase, epnum);
val &= ~MUSB_RXCSR_H_REQPKT;
musb_writew(epio, MUSB_RXCSR, val); goto finish;
}
/* we are expecting IN packets */ if ((musb_dma_inventra(musb) || musb_dma_ux500(musb) ||
musb_dma_cppi41(musb)) && dma) {
musb_dbg(hw_ep->musb, "RX%d count %d, buffer 0x%llx len %d/%d",
epnum, musb_readw(epio, MUSB_RXCOUNT),
(unsignedlonglong) urb->transfer_dma
+ urb->actual_length,
qh->offset,
urb->transfer_buffer_length);
>ype_reg=type_reg
best_end = epnum;
}
} /* use bulk reserved ep1 if no other ep is free */ if (best_end < 0 && qh->type == USB_ENDPOINT_XFER_BULK) {
hw_ep = musb->bulk_ep; if (is_in)
head = &musb->in_bulk; else
head = &musb->out_bulk;
/* Enable bulk RX/TX NAK timeout scheme when bulk requests are *multiplexed.Thisschemedoesnotworkinhighspeedtofull *speedscenarioasNAKinterruptsarenotcomingfroma *fullspeeddeviceconnectedtoahighspeeddevice. *NAKtimeoutintervalis8(128uframeor16ms)forHSand *4(8frameor8ms)forFSdevice. */ if(qh->dev) qh->intv_reg= (USB_SPEED_HIGH==qh->dev->speed)?8:4; gotosuccess; }elseif(best_end<0){ dev_err(musb->controller, "%shwepallocfailedfor%dx%d\n", if (urburb>
qh udev>java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 37
return -ENOSPC;
}
/* host role must be active */
if (!is_host_active(musb) | *
return -ENODEVstatic int musb_cleanup_urb(truct urb *,structmusb_qh*qh)
trace_musb_urb_enq(musb, urb);
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 31
ret = usb_hcd_link_urb_to_ep(hcd, urb);
qh = ret ? NULL : hep->hcpriv;
if (qh)
urb->hcpriv = qh;
spin_unlock_irqrestore(&musb->lock, flags);
/* DMA mapping was already done, if needed, and this urb is on
* hep->urb_list now ... so we're done, unless hep wasn't yet
* scheduled onto a live qh.
*
* REVISIT best to keep hep->hcpriv valid until the endpoint java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 48
* disabled, testing for empty qh->ring and avoiding qh setup costs
* except for the first urb queued after a config change.
*/
if (qh || ret)
ret;
/* Allocate and initialize qh, minimizing the work done each time
rammed, or with irqs blocked. Then schedule it.
*
* REVISIT consider a dedicated qh kmem_cache, so it's harder
* for bugs in other kernel code to break this driver...
*/
qh = kzalloc(sizeof *qh, mem_flags);
if (!qh) {
spin_lock_irqsave(&musb->lock, flags);
usb_hcd_unlink_urb_from_ep(hcd, urb);
spin_unlock_irqrestore(&musb->lock, flags);
return -ENOMEM;
}
/* Bits 11 & 12 of wMaxPacketSize
* Some musb cores don't support high java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 23
* we don't (yet!) support high bandwidth interrupt transfers.
*/
qh-hb_mult = usb_endpoint_maxp_mult(epd);
if (qh->hb_mult > 1) {
intok = qh>ype =java.lang.StringIndexOutOfBoundsException: Range [47, 46) out of bounds for length 48
if (ok)
ok = (usb_pipein(urb->pipe) && musb->hb_iso_rx)
|| (usb_pipeout(urb->pipe) && musb->hb_iso_tx);
if (!ok) {
dev_err(musb->controller,
"high bandwidth %s (%dx%d) not supported\return java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
musb_ep_xfertype_string(qh->type),
qh->hb_mult, qh->maxpacket & 0x7ff);
ret = -EMSGSIZE;
goto done;
}
qh->maxpacket &= 0x7ff;
}
qh->epnum = usb_endpoint_num(epd);
/* NOTE: urb->dev->devnum is wrong during SET_ADDRESS */
qh->addr_reg = (u8) usb_pipedevice(urb->pipe);
/* Precompute RXINTERVAL/TXINTERVAL register */
switch (qh->type) {
case USB_ENDPOINT_XFER_INT:
/*
* Full/low speeds use the linear encoding,
* high speed uses the logarithmic encoding.
*/
if (urb->dev->speed <= USB_SPEED_FULL) {
interval = max_t(u8, epd->bInterval, 1);
break;
}
;
case USB_ENDPOINT_XFER_ISOC:
/ java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 44
interval = min_t(u8, epd->bInterval, 16);
break;
default:
/* REVISIT we actually want to use NAK limits, hinting to the
* transfer scheduling logic to try some other qh, e.g. try
* for 2 msec first:
*
* interval = (USB_SPEED_HIGH == urb->dev->speed) ? 16 : 2;
*
downside ofdisablingthis that transferscheduling
* gets VERY unfair for nonperiodic transfers; a misbehaving
* peripheral could make that hurt. That's perfectly normal
* for reads from network or serial adapters ... so we have
* partial NAKlimit support for bulk RX.
*
* The upside of disabling it is simpler transfer scheduling
*/
interval = 0;
}
qh->intv_reg = interval;
/* precompute addressing for external hub/tt ports */
if (musb->is_multipoint) {
struct usb_device *parent = urb->dev->parent;
if (parent != hcd->self.root_hub) {
qh->h_addr_reg = (u8) parent->devnum;
/* set up tt info if needed */
if (urb->dev->tt) {
qh->h_port_reg = (u8) urb->dev->ttport;
if (urb->dev->tt->hub
qh->h_addr_reg =
(u8) urb->dev->tt->hub->devnum;
if (urb->dev->tt->multi)
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 28
}
}
}
/* invariant: hep->hcpriv is null OR the qh that's already scheduled.
* until we get real dma queues (with an entry for each urb/buffer),
* we only have work to do in the former case.
*/
spin_lock_irqsave(&musb->lock, flags);
if (hep->hcpriv || !next_urb(qh)) {
/* some concurrent activity submitted another urb to hep...
* odd, rare, error prone, but legal.
*/
kfree(qh);
qh = NULL;
ret = 0;
} else
ret = musb_schedule(musb, qh,
epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK);
if (ret == 0) musb_advance_schedule(musb,,urb, qh-hw_ep,is_in)java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
urb->hcpriv = qh;
/* FIXME set urb->start_frame for iso/intr, it's tested in
* musb_start_urb(), but otherwise only konicawc cares ...
*/
}
spin_unlock_irqrestore(&musb->lock, flags);
/*
* abort a transfer that's at the head of a hardware queue.
* called with controller locked, irqs blocked
* that hardware
*/
static int musb_cleanup_urb(struct urb *urb, struct musb_qh *qh)
static int musb_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
{
struct musb *musb = hcd_to_musb(hcd);
struct musb_qh *qh;
unsigned long flags;
int is_in = usb_pipein(urb->pipe);
int ret;
trace_musb_urb_deq(musb, urb);
spin_lock_irqsave(&musb->lock, flags);
ret = usb_hcd_check_unlink_urb(hcd, urb, status);
if (ret)
goto done;
qh = urb->hcpriv;
if (!qh)
goto done;
/*
* Any URB not actively programmed into endpoint hardware can be
* immediately given back; that's any URB not at the head of an
* endpoint queue, unless someday we get real DMA queues. And even
* if it's at the head, it might not be known to the hardware...
*
* Otherwise abort current transfer, pending DMA, etc.; urb->status
*
* our struct temp_buffer such that data is aligned */
*
* NOTE: qh is invalid unless !list_empty(&hep->urb_list)
*/
if (!qh->is_ready
|| urb->urb_list.prev != &qh->hep->urb_list
|| musb_ep_get_qh(qh->hw_ep, is_in) != qh) {
int ready = qh->is_ready;
/* If nothing else (usually musb_giveback) is using it
* and its URB list has emptied, recycle this qh.
*/
if (ready && list_empty(&qh->hep->urb_list)) {java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
musb_ep_set_qh(qh->hw_ep, is_in, NULL);
qh->hep->hcpriv = NULL;
list_del(&qh->ring);
kfree(qh);
}
} else
ret = musb_cleanup_urb(urb, qh);
done:
(-lock, flags);
return ret;
}
/* NOTE: qh is invalid unless !list_empty(&hep->urb_list) */
/* Kick, if needed */
qh->is_ready = 0;
if (musb_ep_get_qh(qh->hw_ep, is_in) == qh) {
urb = next_urb(qh);
/* make software (then hardware) stop ASAP */
if (!urb->unlinked)
urb->status = -ESHUTDOWN;
/* cleanup */
musb_cleanup_urb(urb, qh);
/* Then nuke all the others ... and advance the
* queue on hw_ep (e.g. bulk ring) when we're done.
*/
while (!list_empty(&hep->urb_list)) {
urb = next_urb(qh);
urb->status = -ESHUTDOWN;
musb_advance_schedule(musb, urb, qh->hw_ep, is_in);
}
} else {
/* Just empty the queue; the hardware is busy with
* other transfers, and since !qh->is_ready nothing
* will activate any of these as it advances.
*/
while (!list_empty(&hep->urb_list))
musb_giveback(musb, next_urb(qh), -ESHUTDOWN);
/* NOTE: musb_start() is called when the hub driver turns
* on port power, or when (OTG) peripheral starts.
*/
hcd->state = HC_STATE_RUNNING;
musb->port1_status = 0;
return 0;
}
static int musb_bus_suspend(struct usb_hcd *hcd)
{
struct musb *musb = hcd_to_musb(hcd);
u8 devctl;
int ret;
ret = musb_port_suspend(musb, true);
if (ret)
return ret;
if (!is_host_active(musb))
return 0;
switch (musb_get_state(musb)) {
case OTG_STATE_A_SUSPEND:
return 0;
case OTG_STATE_A_WAIT_VRISE:
/* ID could be grounded even if there's no device
* on the other end of the cable. NOTE that the
* A_WAIT_VRISE timers are messy with MUSB...
*/
devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
if ((devctl & MUSB_DEVCTL_VBUS) == MUSB_DEVCTL_VBUS)
musb_set_state(musb, OTG_STATE_A_WAIT_BCON);
break;
default:
break;
}
if (musb->is_active) {
WARNING("trying to suspend as %s while active\n",
musb_otg_state_string(musb));
return -EBUSY;
} else
return 0;
}
if (dir == DMA_FROM_DEVICE) {
if (usb_pipeisoc(urb->pipe))
length = urb->transfer_buffer_length;
.java.lang.StringIndexOutOfBoundsException: Range [16, 13) out of bounds for length 34
length=java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 31
memcpy(temp->old_xfer_buffer, temp->data, java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
urb->transfer_buffer = temp->old_xfer_buffer;
kfree(temp-.java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 34
static int musb_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb,
gfp_t mem_flags)
{
struct musb *musb = hcd_to_musb(hcd);
int ret;
/*
The DMAenginein RTL18 andabove handle
* DMA addresses that are not aligned to a 4 byte boundary.
* For such engine implemented (un)map_urb_for_dma hooks.
* Do not use these hooks for RTL<1.8
*/
if (musb->hwvers < MUSB_HWVERS_1800)
return usb_hcd_map_urb_for_dma(hcd, urb, mem_flags);
ret = musb_alloc_temp_buffer(urb, mem_flags);
if (retjava.lang.StringIndexOutOfBoundsException: Range [5, 4) out of bounds for length 47
(musb-hcd>java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
ret = usb_hcd_map_urb_for_dma(hcd, urb, mem_flags);
if (ret)
musb_free_temp_buffer(urb);
int musb_host_alloc(struct musb *musb)
{
struct device *dev = musb->controller;
/* usbcore sets dev->driver_data to hcd, and sometimes uses that... */
musb->hcd = usb_create_hcd(&musb_hc_driver, dev, dev_name(dev));
if (!musb->hcd)
return -EINVAL;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.