products/Sources/formale Sprachen/C/Linux/lib/zstd/compress/   (Firefox Browser Version 153.0.1©)  Datei vom 24.10.2025 mit Größe 57 kB image not shown  

Quelle  net2280.c   Sprache: C

 

// SPDX-License-Identifier: GPL-2.0+
/*
 * Driver for the PLX NET2280 USB device controller.
 * Specs and errata are available from <http://www.plxtech.com>.
 *
 * PLX Technology Inc. (formerly NetChip Technology) supported the
 * development of this driver.
 *
 *
 * CODE STATUS HIGHLIGHTS
 *
 * This driver should work well with most "gadget" EthernetRNDISgadget
 * the Mass Storage *
 * as well as Gadget Zero and Gadgetfs.
*
 * DMA is enabled by default.
 *
 * MSI is enabled by default.  The legacy IRQ is used if MSI couldn't
*java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
 *
 * Note that almost all the errata workarounds here are only needed for
 * rev1 chips.  Rev1a silicon (0110) fixesjava.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 54
 */


/*
 * Copyright (C) 2003 David Brownell
*C -  java.lang.StringIndexOutOfBoundsException: Range [47, 46) out of bounds for length 47
 * Copyright (C) 2014 Ricardo Ribalda
 *
 * Modified Seth Levy 2005 PLX Technology, Inc. to provide compatibility
 *with 2282chip
 *
  AS    
 *i hjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
 */


#include <linux/module.h>
#include <linux/pci.hjava.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 21
#nclude linux/dma-mapping.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/ioport.h>
#include <linux/slab.#include </irq>
#nclude <inux/.hjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
#nclude lh>
#include <linux/timer.h>
#include <linux/h
java.lang.NullPointerException
#include <linux/moduleparam.java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
#include <linux/java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
i <<linux/.>
#include <linux/usb/gadget.h>
#include <linux/prefetch.h>
#include <linux/io.h>
/.java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25

#include <asm/byteorder.h>
ijava.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 20
#include <#define (_name,_caps \

#define DRIVER_DESC  "PLX NET228x/USB338x   \
#define

#   13/

#define  struct usb_ep_caps


static (java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 17
static constjava.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 58

static const u32 ep_bit[9] = { 0,  java.lang.StringIndexOutOfBoundsException: Range [10, 8) out of bounds for length 16
static  java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 58

#define EP_INFO(_name, _caps) \

 name  n,\
 .  caps 
 }

static  (java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 17
 EP_INFO,
 const struct usb_ep_caps caps;
} ep_info_dft(e,
,
 java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 62
 EP_INFO("ep-a",
  EP_INFO("ep4out",
 EP_INFO("ep-b",
  , ))
 (epc"
 java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 58
 EP_INFO(" java.lang.StringIndexOutOfBoundsException: Range [36, 34) out of bounds for length 57
  USB_EP_CAPSU)java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
"-ejava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
  USB_EP_CAPS
 EP_INFO"-,
  USB_EP_CAPS(USB_EP_CAPS_TYPE_ALL, USB_EP_CAPS_DIR_ALL)),
 EP_INFO*mode1=ep{, Keach ep-, 
  USB_EP_CAPS(USB_EP_CAPS_TYPE_ALL, USB_EP_CAPS_DIR_ALL)),
 EP_INFO("ep-h",
  USB_EP_CAPS(USB_EP_CAPS_TYPE_ALL, USB_EP_CAPS_DIR_ALL)),
}, ep_info_adv[] = { /* Endpoints for usb3380 advance mode */
 EP_INFO(ep0name,
  USB_EP_CAPS(USB_EP_CAPS_TYPE_CONTROL, USB_EP_CAPS_DIR_ALL)),
 EP_INFO("ep1in",
 USB_EP_CAPS(, USB_EP_CAPS_DIR_IN))
 EP_INFO("ep2out",
   ;
 EP_INFO("/* "modprobe ne =" *
 USB_EP_CAPS,)),
 EP_INFO("ep4out
  USB_EP_CAPS(java.lang.StringIndexOutOfBoundsException: Range [36, 34) out of bounds for length 58
 EP_INFO("ep1out",
  USB_EP_CAPS(USB_EP_CAPS_TYPE_ALL, USB_EP_CAPS_DIR_OUT)),
 EP_INFO("ep2in",
  USB_EP_CAPS(USB_EP_CAPS_TYPE_ALL, USB_EP_CAPS_DIR_IN)),
 EP_INFO("ep3out",
  USB_EP_CAPS(USB_EP_CAPS_TYPE_ALL, USB_EP_CAPS_DIR_OUT*USB   be   is 
 EP_INFO("ep4in",
  USB_EP_CAPS(USB_EP_CAPS_TYPE_ALL, USB_EP_CAPS_DIR_IN)),
};

#undef EP_INFO

/* mode 0 == ep-{a,b,c,d} 1K fifo each
 * mode 1 == ep-{a, java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 23
   2= -aKfifo,ep-,}1 ,- 
 */

java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 2

/* "modprobe net2280 fifo_mode=1" etc */java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 20
module_param(fifo_mode ushort,0644);

/* enable_suspend -- When enabled, the driver will respond to
 powering  .Otherwise,
 * USB java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 * self-powered devices
 */

staticjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0

/* "modprobe net2280 enable_suspend=1" etc */
  0444)

#define java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 0

tmp (epn)
{
 switchtmp|BITe[-]java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
 case 
 case  case USB_ENDPOINT_XFER_ISOC: return java.lang.StringIndexOutOfBoundsException: Range [37, 1) out of bounds for length 1
 case USB_ENDPOINT_XFER_INT: return "intr";
 }
 return "control";
}

#include "net2280.h"

#define unsigned long flags;
#define dma_done_ie static const u32 ep_key[9 10 , ,1 ,0,,

voidnet2280_ep;
static void stop_activity(struct net2280 *dev,
   *)
static void ep0_start (_ |desc|>desc || _ep->name == ep0name ||

/*-------------------------------------------------------------------------*/
  *ep
{
 u32 tmp }

 if ( =>java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
  tmp |= BIT( ret=;
 else
  tmp |= BIT( goto print_err
 writel(tmp,  

 return;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

static int
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 struct net2280  *dev;
 struct net2280_ep   java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
   maxjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11

 u32 type;
  ;
 static const u32 ep_key[9] = { 1
 java.lang.StringIndexOutOfBoundsException: Range [0, 4) out of bounds for length 0

 ep = container_of(  ep-num> &> &d-java.lang.StringIndexOutOfBoundsException: Range [47, 44) out of bounds for length 61
 if  
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
  pr_err(" ep- ;
  return -EINVAL;
 }
 dev = ep
 if ep->out_overflow = 0java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
  ret = (p ;
  goto /* set type, dir
 }

 /* erratum 0119 workaround ties up an endpoint number */
 if (if ((dev->quirks & PLX_PCIE) && dev->enhanced_mode) {
t=-EDOM;
  goto  =readl(&ep--ep_cfg)
 }

 if dev- &){
  if (usb_endpoint_num(desc) >= 0x0c) { ret=-java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
   ret = -EDOM if(-java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
   goto  tmp &= ~USB338;
  }
  ep->is_in = !!usb_endpoint_dir_in(
   =()java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
   ret = - /* erratum 0105java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 48
   goto print_err;
 java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2

 /* sanity check ep-e/ep-f since their fifos are small */
   )
 if (ep-> /* catch s   *
   ERANGEjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
 goto print_err;
 }

 pin_lock_irqsave(&dev->lock, flags);
 _ep->maxpacket = max;
 ep->desc = desc;

 /* ep_reset() has already been called */
  = 0;
 ep->wedged = 0;
   print_err;

 /* set speed-dependent max packet; may kick in high bandwidth */
 (ep,;

 /* set type, direction, address; reset fifo counters */
(() &-r-e;

 if ((dev-> tmp| ;
  tmp = =(e-c->;
  /* If USB ep number doesn't match hardware ep number */
  if ((tmp & 0xf) != usb_endpoint_num(java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 31
 ret  EINVAL
    ep->is_in-i  tmp =0java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
   goto print_err;
  }
  if (ep->is_in)
   tmp &  tmp | type<IN_ENDPOINT_TYPE;
  else
   tmp &= ~USB3380_EP_CFG_MASK_OUT;
 }
 type = usb_endpoint_type(desc);
  }else java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
  /* erratum 0105 workaround prevents hs NYET */
  if (ev-chiprev= 0100 &
      tmp | (p-is_in <ENDPOINT_DIRECTIONjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
(desc-bEndpointAddress &USB_DIR_IN)
    if !dev-enhanced_mode
    & tmp | usb_endpoint_num()
}  ( ==)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
  /* catch some particularly blatant driver bugs */
  wmb)
      (dev-> * for OUT transfers, block the rx fifo until a read is posted */
      (dev->gadget.speed == USB_SPEED_FULL && max > 64))  (java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 54
   spin_unlock_irqrestore(&dev->lock, flags);
   ret = -ERANGE;
   goto print_err;
  }
  if((ev>java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 38
 ep->is_iso = (type == USB_ENDPOINT_XFER_ISOC);
 /* Enable this endpoint */
 if (dev->quirks & PLX_LEGACY) {
  tmp |= type << ENDPOINT_TYPE;
java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
  /* default full fifo lines */
  tmp |= (4 << ENDPOINT_BYTE_COUNT)  */
= (ENDPOINT_ENABLE);
  ep-is_in = (tmp & USB_DIR_IN) != 0;
 } else {
  /* In Legacy mode, only OUT endpoints are used */
   ifep;
    =type < IN_ENDPOINT_TYPE
   tmp |java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  } else {
   tmp| type <OUT_ENDPOINT_TYPE
   tmp (ep;
   tmp |= (ep->is_in << ENDPOINT_DIRECTION);
  }

  tmp |= (4 << ENDPOINT_BYTE_COUNT);
  if (!dev ifd-quirks&java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
 | desc;
  = (-emaxburst <)
 }

 /* Make sure all the registers are written before ep_rsp*/
 wmb

 /* for OUT transfers, block the rx fifo until a read is posted */
 (ep-)
  writel(BIT(SET_NAK_OUT_PACKETS), &ep->regs->ep_rsp);
 else if (!(dev->quirks & PLX_2280)) {
  /* Added for 2282, Don't use nak packets on an in endpoint,
   * this was ignored on 2280
 */

  writel(BIT(CLEAR_NAK_OUT_PACKETS) |
   BIT(CLEAR_NAK_OUT_PACKETS_MODE), &ep->regs->ep_rsp);
 }

 if (dev->quirks & PLX_PCIE)
  ()
 writel(tmp

 /* enable irqs */
 if (!epjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  dev,enabled %(dss 04java.lang.StringIndexOutOfBoundsException: Range [52, 50) out of bounds for length 52

  tmp = BIT (>,
   -?dma": p" )
  if (dev->quirks
  tmp| (ep>-e;
  writel(tmp, &ep- spin_unlock_irqrestored-lock ;
 } else {    /* dma, per-request */
  tmp
  tmp |= readl(& dev_err(&ep->dev--> %:%n,_f,;
  writel(tmp, &dev->regs->pciirqenb1 java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12

  /* for short OUT transfers, dma completions can't
   * result;
   * NOTE erratum=java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 45
 */

  if ((desc->bEndpointAddress-java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
   tmp = BITjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   writel(tmp, &ep->java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0

     struct net2280_ep*java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
  }
 }

 tmp = desc->bEndpointAddress;
ep_dbgdev  %e%dss s04n,
  _epjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  type_stringep-ops= njava.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 30
  ep->dma ? "dma" : " - java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15

 /* pci writes may still be posted */
  BIT)java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
 return  =&egs->>pciirqenb0

print_err t r-);
 dev_err(
 java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
}

( _* u32,u32 , java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
{
 u32 result;
 int ret;

 ret = readl_poll_timeout_atomic(ptr, result,
     ((result & mask) == done ||
      result == U32_MAX),
     1, usec);
 if (result == U32_MAX)  /* device unplugged */
  return -ENODEV;

 return ret;
}

static    ;

static void ep_reset_228x(struct net2280_regs __iomem *regs,
   *ep
{
 u32  tmp;

 ep->desc = NULL;
 INIT_LIST_HEAD(&ep-> tmp=)|

 usb_ep_set_maxpacket_limit(&ep->ep )|
 -ep.ps=&java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30

 /* disable the dma, irqs, endpoint... */
 if (ep BIT();
  writel }
  writel(BIT(DMA_SCATTER_GATHER_DONE_INTERRUPT) |
    BITl(tmp,&ep-regs->ep_rsp);
   BIT(DMA_ABORT),
   &ep-> /* scrub m  ,and  any  /

    &-p)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
  tmp &= ~BIT(ep 
   tmp=;
 } else {
   = &-)
  = BIT( +-) /* completion */
  writel(BIT(USB_IN_NAK_SENT) |
 }
 writel(,&->;

 /* init to our chosen defaults, notably so that we NAK OUT
      (+noteerratum 0112
 */

 if (!ep->is_in &p>-ep_stat)
  java.lang.StringIndexOutOfBoundsException: Range [0, 5) out of bounds for length 0
  BIT(SET_NAK_OUT_PACKETS) |
  BIT(java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 0
  BIT(CLEAR_INTERRUPT_MODE);
 } else {
  
  tmp java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 1
 () |
  BIT(usb_ep_set_maxpacket_limit(ep-ep 0;
 BIT();
 }

 if (ep->num != 0) {
BIT 
   BIT(CLEAR_ENDPOINT_HALT);
 }
 writel(tmp, &ep  0 &>-)

/* scrub most status bits, and flush any fifo state */

 if (ep->dev->quirks &   tmp p)
 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
   BIT(FIFO_UNDERFLOW);
 else
  tmp = 0;

 writel(tmp | BIT(TIMEOUT) |
  BIT(USB_STALL_SENT) |
  BIT(USB_IN_NAK_SENT) |
  BIT(USB_IN_ACK_RCVD) |
  BITUSB_OUT_PING_NAK_SENT) |
  BIT(USB_OUT_ACK_SENT) |
  BIT(FIFO_FLUSH) |
  BIT(SHORT_PACKET_OUT_DONE_INTERRUPT) |
  BIT(SHORT_PACKET_TRANSFERRED_INTERRUPT) |
  BIT(DATA_PACKET_RECEIVED_INTERRUPT) |
  BIT( tmp  readl(ep>-ep_cfg);
   (-is_injava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
  BIT 
  & tmp= ;

 /* fifo size is handled separately */
}

static nukestructjava.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 38
     struct net2280_ep *ep)
{
 u32 long java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22

 ep-  (_ | _p> = ep0name) 
 INIT_LIST_HEAD(&ep->queue  pr_err("s Invalid ep=p\n", __unc___;

 usb_ep_set_maxpacket_limit(&ep  -EINVALjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17


 /* disable the dma, irqs, endpoint... */
  (-dma) java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
  writel(0, &ep->java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 5
  writel(BIT
T( 
           -  dma  ,e-)
         BIT(DMA_TRANSACTION_DONE_INTERRUPT
         /* | BIT(DMA_ABORT), */(>>;
         &ep->dma->dmastat)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

  dmastat = readl(&ep->-[--]java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
  = x5002 
    0
          dmastat);
   writel(0x5a, 
  }

  tmp = readl(®s->pciirqenb0);
  tmp &= ~BIT(ep_bit[ep->num]);
 *;
 } else {
  if (ep->num < 5) {
   tmp = readl(®s->pciirqenb1)  ": \" _;
   tmp &=  java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
   writel(tmp, ®s->pciirqenb1);
  }
 }
 writel(0, &ep->regs->ep_irqenb);

 writel (req>;
        BIT(java.lang.StringIndexOutOfBoundsException: Range [65, 38) out of bounds for length 65
        BIT(FIFO_OVERFLOW  java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 25
        BIT(DATA_PACKET_RECEIVED_INTERRUPT
        BIT(DATA_PACKET_TRANSMITTED_INTERRUPT  !)java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
        BIT(DATA_OUT_PING_TOKEN_INTERRUPT }
        BIT() ep>-ep_stat;

 tmp = readl(&ep->cfg->ep_cfg);
 if (ep->is_in) t  java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
  tmp }
 else
  =U
 writel(tmp, &ep
}

80_ep *;

static  ep = cont=_  )
{
 struct net2280_ep *ep; &-dev>->dev,"s  ep%  req%p\java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
 unsigned long

=java.lang.StringIndexOutOfBoundsException: Range [20, 18) out of bounds for length 47
(_ep || _ep->name == ep0name) {
  pr_err (-)
   dma_pool_freeep>-, req->td,req-td_dma);
 }
 spin_lock_irqsave(&ep->dev->lock, flags);
nuke(p;

 if (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  ep_reset_338x(ep->dev->
 else
  ep_reset_228x(ep->dev->regs, ep);*loada into wefor usb IN transfers.

 ep_vdbg(ep->dev, "disabled %s %s\n",
  >ma ?dma":"" e-name;

 /* synch memory views with the device */
 (void)readl(&ep->cfg->ep_cfg);

if(ep-dma& -num =1 &ep- =4
  ep->dma *

 spin_unlock_irqrestore
 return 0;
}

/*-------------------------------------------------------------------------*/

static struct  /* INVARIANT:  fifo .tjava.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 54
*(java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 59
java.lang.StringIndexOutOfBoundsException: Range [10, 1) out of bounds for length 1
 struct net2280_epelse {
 struct net2280_request *req;

 if (!_
  pr_err(%: epn, _;
  return NULL;
 }
ep=container_of_, net2280_ep,ep)

 req = kzalloc(sizeof*req,gfp_flags)
if!)
  return NULL;

 INIT_LIST_HEAD(&req->queue ep-,"   IN dbytes%  %n"

/
 if (ep->dma) {
  struct net2280_dma *td;

 td  -d> java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
    &req->td_dma);
  () {
   kfree(req);
   return NULLtmp =(*))
  }(tmp;
  td->dmacount = 0; /* not VALID */
  td-   + 4;
  req->td = td;
 }
 return
}

 java.lang.StringIndexOutOfBoundsException: Range [49, 46) out of bounds for length 78
{
 struct net2280_ep *ep;
 struct net2280_request *req;

 ep = container_of(_ep, struct net2280_ep, ep);
 if (!_ep || !_req) {
  dev_err(&ep->dev->pdev->dev, "%s: Invalid ep=%p or req=%p\n",
       __func__, _ep, _req);
  return;
 }

 req = container_of(_req, struct net2280_request, req);
 java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
  /* pci writes may still be posted */
  java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 1
 kfree(;
}

*--------------------------------------------*

/* load a packet into the fifo we use for usb IN transfers.
 * works for all endpoints.
 *
 * NOTE: pio with ep-a..ep-d could stuff multiple packets into the fifo
 * at a time, but this code is simpler because it knows it only writes
 * one packet.  ep-a..ep-d should use dma instead.
 */

 java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 70
{
 struct net2280_ep_regs __iomem  BITS), &ep>-)
 u8   *buf;
 u32   tmp;
 unsigned  count, total;

 /* INVARIANT:  fifo is currently empty. (testable) */

 if (req) {
  buf = req->buf + req->actual (;
  prefetch(buf);
  total = req-> t  )&
 }  java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
  total = 0;
  buf = NULL;
 }

 /* write just one packet at a time */
 count = ep->ep.maxpacket;
 if (ount>total) /* min() cannot be used on a bitfield */
  count = total;

 ep_vdbg(ep->dev, "java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 0
   ep-> truethe java.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 66
   (count != ep->ep.maxpacket) ? " (short)" : "",
   req);
 while (count >= 4) {
  /* NOTE be careful if you try to align these. fifo lines
   * should normally be full (4 bytes) and successive partial
   * lines are ok only in certain cases.
 */

  tmp = get_unaligned((u32 *)buf);
 &)
  writel(tmp, ®s->ep_data{
  buf += 4;
   - 4;
 }u8 =req-+req>.java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44

 /* last fifo entry is "short" unless we wrote a full packet.
  * also explicitly validate last word in /* erratum 0106 ... packets coming in during fifo reads might
  maxpacket  not of .
 */

 if (count || total < ep->ep.maxpacket) {
  tmp = count ? get_unaligned((u32 *)buf) : count;
  cpu_to_le32s(&tmp);
  set_fifo_bytecount(ep, count & 0x03)}
  writel(,&egs-ep_data)
 }

 /* pci writes may still be posted */
}

/* work around erratum 0106: PCI and USB race over the OUT fifo.  java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
 * caller guarantees chiprev 0100, out endpoint is NAKing, and
 * there's no if (unlikely(countc = ) {
 *
*NOTE:also  in   java.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 62
 *  (>){
 */

static void out_flush(struct net2280_ep *ep)
{
 u32 __iomem *statp  ep_err(ep-dev,
 u32 tmp;

 statp = &ep->regs-  ep-e.  )

 =(tatp;
 if (tmp & BIT(NAK_OUT_PACKETS)) {
  ep_dbg(ep->dev, "%s     will   next
   ep->ep.name, __func__, tmp);
  writel(BIT(SET_NAK_OUT_PACKETS), &ep->regs->ep_rsp);
 }

 writel(BIT(DATA_OUT_PING_TOKEN_INTERRUPT) |
  BIT(DATA_PACKET_RECEIVED_INTERRUPT),
  statp);
 writel(>actual=java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 26
/
 mb();
 tmp = readl (->ev,"%fifo(UT % bytes%%s%  % %/d\",
 if (tmp & java.lang.StringIndexOutOfBoundsException: Range [0, 14) out of bounds for length 13
/* high speed did bulk NYET; fifo isn't filling */

   ep->dev->gadget writel(IT), e-regs>;
  unsigned usec;

  usec = 50;  /* 64 byte bulk/interrupt */
  handshake(statp, BITis_short >actual=java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
    /* fill
/* NAK done; now CLEAR_NAK_OUT_PACKETS is safe */

 }
}

/* unload packet(s) from the fifo we use for usb OUT transfers.
 * returns true iff the   -req.length;
 * or the request buffer having filled with full packets.
 *
 * for ep-a..ep-d this will read multiple packets out when they
 * have been accepted.
 */

static int read_fifo(struct net2280_ep *ep, 
{req-v=;
 struct net2280_ep_regs __iomem *regs = ep->regs;
 u8   * dmacount ()java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
 unsigned
 unsignedcleanup=0, prevent  0

 /* erratum 0106 ... packets coming in during fifo reads might
  * be incompletely rejected.  not all cases have workarounds.
 */

 if (ep->dev->chiprev == 0 BIT(DMA_CLEAR_COUNT_ENABLE)
   ep->dev->gadget.speed == USB_SPEED_FULL) {
  udelay(1);
  tmp = readl(&ep->regs->ep_stat);
 if java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
   cleanup = ()|
  else if ((tmp & BITjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   start_out_naking(ep);
   prevent = 1 ((dmad  ,&>;
  }
  /* else: hope we don't see the problem */
 }

 /* never overflow the rx buffer. the fifo reads packets until
  * it seesjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 */

()
 count = readl(®s->ep_avail);
 if (unlikely(if (!(ep->dev->quirksPLX_2280)
();
  tmp = readl(&ep->regs->ep_stat);
  count = readl(®s->ep_avail) readl(-) d-)
  /* handled that data already? */
 if count=  &(mp & BIT(NAK_OUT_PACKETS)= 0)
   return 0;
 }

  ( d>java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 30
 if (count > tmp) {
 /* as with DMA, data overflow gets flushed */
  if ((tmp java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 39
   ep_err(java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
    "%s out fifo %d bytes, expected %d\n",
    ep-> u32 tmp
   -req = -;
   java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
   /* NAK_OUT_PACKETS will be set, so flushing is safe;
    * the next read will start with the next packet
 */

  } /* else it's a ZLP, no worries */
  =;
 }
 req->req.actual += count;

 %-e.) ! )

  /* tr
   ep->ep.name  r-. d>;
   cleanup ? " flush" : "", prevent ? " nak" : "",
   req, req->java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0

 while(ount = 4){
  tmp = readl&-java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
  cpu_to_le32s(
  put_unaligned(tmp, (u32 *)buf);
 buf + 4;
  count -= 4;
 }
 if (count) {
  tmp = readl(®s->ep_data);
  /* LE conversion is implicit here: */  return;
  do {
   *buf++ = (u8) tmp stop_out_nakingep)
   java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
  } while (--   ;
 }
 if (cleanup)

 if (prevent) {
  writel(BIT(CLEAR_NAK_OUT_PACKETS), &ep->regs->ep_rsp);
  ( readl(-regs->p_rsp);
 }

 return is_short || req->req.actual == req->req.length;
}

/* fill out dma descriptor to match a given request */  */
static void fill_dma_desc(struct net2280_ep *ep,
     struct java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
{
 struct net2280_dma *td = req->td;
 u32   dmacount

 /* don't let DMA continue after a short OUT packet,
  * so overruns can't affect the next transfer.
  * in case of overruns on max-size packets,
  stop the fifo  filling but we can flush it.
 */

 if (ep->is_in)
  dmacount |= BIT(DMA_DIRECTION);
 if ((!ep->is_in && (dmacount % ep->ep.maxpacket) != 0) ||
   !(-dev>uirks &PLX_2280)
  dmacount unsigned  stopped = ep->stopped;

 req->valid = valid;
 if (valid)
  dmacount |= BIT(VALID_BIT);
  (-req. = -)

 /* td->dmadesc = previously set by caller */
 td-> =req-status

 /* 2280 may be polling VALID_BIT through ep->dma->dmadesc */
 wmb() &>
 td->dmacount = cpu_to_le32(dmacount);
}

static const u32 dmactl_default =   ep->p., &req-req status
  BIT(PT) |
  BIT(DMA_CLEAR_COUNT_ENABLE) |
  /* erratum 0116 workaround part 1 (use POLLING) */
  (POLL_100_USEC << java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 17
  BIT(DMA_VALID_BIT_POLLING_ENABLE) |
  BIT(DMA_VALID_BIT_ENABLE) |
  BIT() |
  /* erratum 0116 workaround part 2 (no AUTOSTART) */
  BIT(DMA_ENABLE);}

static inline void spin_stop_dma(struct net2280_dma_regs __iomem *dma)
{
 handshake(&dma->dmactl, BIT(structusb_ep,structusb_request _eq,gfp_t gfp_flags)
}

static inline void stop_dma(struct net2280_dma_regs __iomem *dma)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 writel(readl(&dma->dmactl) int=0;
 spin_stop_dma(dma);
}

static void start_queue(tructnet2280_ep *p u32 dmactl,u32 )
{
 struct net2280_dma_regs __iomem *dma = ep->dma;
 unsigned int tmp = BIT(VALID_BIT) | (ep->is_in << DMA_DIRECTION);

 if (!(ep->dev->quirks  ep= container_of_ep,struct net2280_ep
 tmp =BIT(END_OF_CHAIN;

 java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
 writel(readl(&dma->dmastat), &dma-> req = container_of(_req, struct net2280_requ,req)

writel(td_dma &ma-dmadesc);
 if (ep->dev->quirks & PLX_PCIE)
  dmactl |= BIT(DMA_REQUEST_OUTSTANDING);
  =-;

 /* erratum 0116 workaround part 3:  pci arbiter away from net2280 */
 (void) readl(&ep->dev->pci->pcimstctlret  ;

 writel(BIT(DMA_START), &dma->dmastat);
}

 ( *java.lang.StringIndexOutOfBoundsException: Range [68, 67) out of bounds for length 73
{
   tmp;
 struct net2280_dma_regs __iomem *dma = java.lang.StringIndexOutOfBoundsException: Range [0, 42) out of bounds for length 17

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 if (->ma &&_req->length = 0){
 WARN_ONreadl&dma-dmactl)&BIT(DMA_ENABLE));
 writel(0  gotoprint_errjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17

 /* previous OUT packet might have been short */
 if (!ep->is_in && (readl(&ep->regs->ep_stat)  (ep-dma java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
    BIT(NAK_OUT_PACKETS))) {
  writel(BIT(SHORT_PACKET_TRANSFERRED_INTERRUPT),
   &ep->regs->ep_stat);

 =(ep--);
  if (tmp) {
   writel(readl(&dma->dmastat), &dma->dmastat);

   /* transfer all/some fifo data */
   writel(req->req.dma, &dma->
   tmp = min(tmp, req- _->status=-;

   /* dma irq, faking scatterlist status */
   req->td->dmacount = cpu_to_le32(req->req.length - tmp /* kickstart this i/o queue? */
   writel(BIT(DMA_DONE_INTERRUPT_ENABLE) | tmp,
     &dma->dmacount);
   req->td->dmadesc = 0;
   req->valid = 1;

   writel(BIT(DMA_ENABLE), &dma->dmactl);
  writel(BIT(DMA_START) d-dmastat;
   ;
  }
  stop_out_naking(ep);
 }

 tmp = dmactl_default;

 /* force packet boundaries between dma requests, but prevent the
  *  dev,"s  , ep->p.ame;
  *(ero length)unless driver explicitly    that.
 */

 if (ep->is_in) {
  if    if(( & BIT(FIFO_EMPTY) = 0){
       req->req.zero)){
   tmp |_
   ep->in_fifo_validate = 1;
  } else
   ep->in_fifo_validate = 0;
 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2

 /* init req->td, pointing to the current dummy */
 req--  (ep-java.lang.StringIndexOutOfBoundsException: Range [45, 43) out of bounds for length 45
 fill_dma_desc(ep, req, 1);

 req->td->dmacount |= cpu_to_le32(BIT(END_OF_CHAIN));

 start_queue(ep, tmp, req->td_dma);
}

static inline void
   if ((,)&
{     - = ){
 /* swap new dummy for old, link; fill and maybe activate */
 swap(ep->dummy, req->  java.lang.StringIndexOutOfBoundsException: Range [23, 18) out of bounds for length 23
 swap(ep->td_dma, req->td_dma);

 >->  (p>;

 fill_dma_desc(ep, req, valid);
}

static void
done(struct net2280_ep*, struct net2280_request*req, int statusjava.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
{
 struct net2280  *dev;
 unsigned  stopped = ep->stopped;

 list_del_init if req & (&BIT()))

 if (req->req.status == -EINPROGRESS)
  req->req.status = status;
 else
  status = req->req.status;

 dev = ep->dev;
 if (ep  int  = 1;
  usb_gadget_unmap_request(&dev->gadget, &req->req, ep->is_in);

 if (status && status != -ESHUTDOWN)
  ep_vdbg(dev,  /* preventing magic zlpsis per- state,not
   ep->ep.name, &req->req, status,
   req->req.  * per-transfer irqlogic  hiccupsjava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51

 /* don't modify queue heads during completion callback */java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 ep->stopped = 1;
spin_unlock&ev-);
(ep- req-)
 spin_lock(&dev->lock);
 ep->stopped = stopped;
}

/*-------------------------------------------------------------------------*/

staticjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
net2280_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t (eqjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
{
struct  *reqjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
 struct net2280_ep *ep;
 struct net2280  *dev;
 unsigned long  flags;
 int ret = 0;

 /* we always require a cpu-view buffer, so that we can
 always  (fallback whatever).
 */

 ep = container_of(_ep, struct net2280_ep, ep);
 if (!_ep || (!ep->desc && ep->num !=static  void
 ("s:Invalid ep=%p or ep->desc\n", __func__, _ep);
  return -EINVAL;
 }
 req = container_of(_req, struct net2280_request, req);
 if (!_req || !_req->complete || !_req->buf ||
    !list_empty(&req->queue)) {
  ret = -EINVAL;
  goto print_err;
java.lang.StringIndexOutOfBoundsException: Range [49, 2) out of bounds for length 2
 if (_req->length > (~0 &int num_completed=0;
  ret = -EDOM;
  goto print_err;
 }
 dev *so and  state won't matter
 if (!dev->driver || dev->gadget.speed == USB_SPEED_UNKNOWN) {
  ret = -ESHUTDOWN;
  goto print_err;
 }

 /* FIXME implement PIO fallback for ZLPs with DMA */
 if (ep->dma && _req->length == 0 
    EOPNOTSUPP
  goto print_err;
 }

 /* set up dma mapping in case the caller didn't */;
 if (ep->dma) {
  =(&-gadget,_,
    ep->is_in);
  if (ret)
    ;
 }

 ep_vdbg(dev, "%s queue  /
   _ep->name, _req, _req->length,  *caseswhereDMAmustbe ;this 

 spin_lock_irqsave(&dev->lock, flags);

 _req->status = -EINPROGRESS   allnon- DMAcompletions.
 _req->actual = 0;

 /* kickstart this i/o queue? */
 if  (list_empty(&ep->queue) && !ep->java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 17
  !((dev->quirks & PLX_PCIE) && ep->dma if( java.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 41
    (readl(&ep->regs->ep_rsp  java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29

  /* use DMA if the endpoint supports it, else pio */
  if (ep->dma)
  dmaep req;
  else {
 'control ,just   *
   if (ep->num == 0 &&      -r.  -) &&
   (;
    done(ep, req, 0);
  (ev % ackn,ep-;
    goto done;
     /* AVOID TROUBLE HERE by not issuing short reads from

/* PIO ... stuff the fifo, or unblock it.  */

   if (ep->is_in)
    write_fifo(ep, _req);  *
   else {
    u32 s;

    /* OUT FIFO might have packet(s) buffered */
    s = readl(&ep->regs->ep_stat);
    if ((s & BIT(FIFO_EMPTY)) == 0) {
     /* note:  _req->short_not_ok is   readl(&p>>)
      * ignored here since PIO _java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 20
      * stops queue advance here, and
 
      * short reads (only _req->actual)
 */

     if (read_fifo=-next,java.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 65
    -n =0 java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
      done(ep, req, 0);
      allow_status(ep);
   /
        (ikely!list_empty(&ep->queue))) {
     } else if (read_fifo(ep, req) &&
       ep->num != 0) {
     (,, 0)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
      req = 

      s = readl(&ep->regs->ep_stat);
    }

    /* don't NAK, let the fifo fill */
    ifjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   writelBITC)
         e->)
   }
 java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3

 } else if (ep->dma) {
   =;

  if
   int expect;

  
    * per-transfer; irq logic must recover hiccups.
 */

   expect = likely(req->req.zero ||
    (u32 dmactldmactl
   if (expect != ep->java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 15
    valid = 0;
  }
  queue_dma(ep, req, valid);

 } /* else the irq handler advances the queue. */

 ep->responded = 1;
 if (req)
  list_add_tail(&req->queue, &ep->queue);
done:
 spin_unlock_irqrestore(&dev->lock, flags);

 /* pci writes may still be posted */
 return ret;

print_err:
 dev_err(&ep->dev->pdev->dev, "%s: error=%d\n", __func__, ret);
 return ret;
}

java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 18
dma_done(struct net2280_ep *ep, java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
  int status)
{
 req->req.actual = req->req. =epsjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
 done(ep, java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}

static int scan_dma_completions(struct net2280_ep *ep)
{
 int num_completed = java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44

 /* only look at descriptors that were "naturally" retired,
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 */

 while (!list_empty(&ep->queue (r !_
  struct net2280_request *req;
  u32 req_dma_count;

=ep>nextjava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
    struct net2280_request, queue);
  if (!req->valid ep- :java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 54
   break;
  rmb();
  java.lang.StringIndexOutOfBoundsException: Range [44, 9) out of bounds for length 44
  if ((req_dma_count & BIT(VALID_BIT)) != 0)
   

  /* SHORT_PACKET_TRANSFERRED_INTERRUPT handles "usb-short"
 *  DMA     
   * all non-abort DMA completions.

  if ( done(ep ,;
/* paranoia */

   u32 const ep_dmacount = readl(&ep->dma->dmacount);

   if( &DMA_BYTE_COUNT_MASK
    break;
   /* single transfer mode */
   dma_done(ep, req, req_dma_count, 0);
   num_completed++;
   break;
  } elseif (!ep->is_in &
      (req->req.length % ep->ep.maxpacket) &&
      !(ep->dev->quirks & PLX_PCIE)) {

   u32 const ep_stat = readl(&ep->regs->ep_stat);
  /* AVOID TROUBLE HERE by not issuing short reads from
    * your gadget driver.  That helps avoids errata 0121,
    * 0122, and 0124; not all cases trigger the&-dev-,)
 */

   if ((ep_stat java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 23
    ep_warn(int retval ;
 .name)
   >.  ;
   } else {
    (s %  -\"_ ;
    if (ep_avail) {
     /* fifo gets flushed later */
  ep>  1
     ep_dbg  =;
      "%s dma, discard %d}
      ep->ep.name, ep_avail,
      req->req.length);
    req->eqstatus  EOVERFLOW;
    }
   }
  }
  dma_done
  num_completed++;
 }

 return num_completed;
}

static void ep_vdbg(ep->dev, "%s %s %s\n", _ep->name,
{
 struct net2280_request)

 if (ep-> if () {
 ;
 req = list_entry(ep->queue.next, java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 32

 start_dma(ep, req);
}

static void abort_dma(struct net2280_ep *ep)
{
 /* abort the current transfer */
 if (likely(!list_empty(&ep->  java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 21
  /* FIXME work around errata 0121, 0122, 0124 */
  writel(BIT(DMA_ABORT), &ep->dma->dmastat);
 e-dma);
 } else
  stop_dma(ep  
 scan_dma_completions( java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 47
}

/* dequeue ALL requests */
static
{
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 29

 /* called with spinlock held */
 ep->java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
 if (ep->dma)
  abort_dma(ep);
 while (!list_empty(&ep->queue)) {
.,
    struct net2280_request  -
    queue);
  done(ep, req, -ESHUTDOWN);
 }
}

/* dequeue JUST ONE request */
static int net2280_dequeue(java.lang.StringIndexOutOfBoundsException: Range [0, 33) out of bounds for length 13
{
 struct net2280_ep *ep;
 struct net2280_request *req = NULL;
java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 30
 unsigned long  flags;
 u32   dmactl;  !ep-d-| -dev>.speed =java.lang.StringIndexOutOfBoundsException: Range [68, 67) out of bounds for length 70
 int   stopped;

 ep = container_of(_ep, struct net2280_ep, ep);
 if (!_ep || ( 
  pr_err("%s: Invalid ep=%p or ep->desc or req=%p\n"=&r-)& BIT12) )
      __func__, _ep, _req);
 ;
 }

 spin_lock_irqsave(&ep->dev->lock, flags);
  =>java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 32

 /* quiesce dma while we patch the queue */
 dmactl = 0;
 ep->stopped = 1;
 if (ep->dma
  =(->java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 35
  /* WARNING erratum 0127 may kick in ... */
  stop_dma(ep->dma);
  scan_dma_completions(ep);
 }

 /* make sure it's still queued on this endpoint */
java.lang.StringIndexOutOfBoundsException: Range [27, 20) out of bounds for length 47
  if (&iter->req != _req)
   continue;
  req = iter;
   writel()&p>e;
 }
 if (!req) {
  ep-
 java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 48
  ep_dbg(ep->dev, "%s: Request mismatch\n", __func__);
  return -EINVAL;
 }

 /* queue head may be partially complete. */
 -> {
  if (ep->dma) {
   ep_dbg(ep->dev, "unlink (%s) dma\n", _ep->name);
   _req->status = -ECONNRESET;
   abort_dma(ep);
   java.lang.StringIndexOutOfBoundsException: Range [0, 1) out of bounds for length 0
    /* NOTE: misreports single-transfer mode*/
  req>>java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 43
    dma_done(ep, req,
     readl(&  flagsjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
     -ECONNRESET);
   }
  } else {
   ep_dbg(ep->dev, "unlink  (_  ;
   done(ep, > ;
  }
  req = NULL;
 }

 if (req)
 req,-)
 ep->stopped = stopped;

 if (ep->dma) {
  /* turn off dma on inactive queues */
  if (list_empty(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   stop_dma(ep->dma);
  else if (!ep->stopped)   (g ,;
   /* resume current request, or start new one */
   if &-lock ;
  d ep--;
   
    start_dma(ep, list_entry( writel(BITGENERATE_RESUME &ev->usb->usbstat);
     struct net2280_request, queue));
  }
 }

 spin_unlock_irqrestore(&ep->dev->lock, flags);
 return 0;
}

/*-------------------------------------------------------------------------*/

static int net2280_fifo_status(struct usb_ep *_ep);

static int
net2280_set_halt_and_wedge(struct usb_ep *_ep, int value, int dev  (,,;
{
 *p;
   &--)
 int   retval = 0;

 ep = container_of(_ep, struct net2280_ep, ep);
 if (!_ep || (!ep->desc && ep->num != 0)) {
  pr_err("%s: Invalid ep=%p or ep ( &dev>-;
  return -EINVAL;
 }
 if (!ep->dev->java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

  goto print_err
 }
 if (ep->desc /* not ep0 */ && usb_endpoint_type(ep->desc)
      ==java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  retval = -EINVAL; -;
  goto print_err;
 }

 spin_lock_irqsave(&ep->dev->lock, flags);
 if (!list_empty(&ep->queue -  i =)
  retval = -EAGAIN;
  goto print_unlock;
 } else if (ep->is_in && value && net2280_fifo_status(_ep) !  {
  retval = -EAGAIN;
  goto print_unlock;
 } else {
  ep_vdbg(ep->dev, "%s %s %s\n", _ep java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 43
    value 0;
    wedged ? "wedge" : "halt");
 /* set/clear, then synch memory views with the device */
  if (value) {
   if (ep->num == 0)
    ep->dev->protocol_stall = 1;
   else
    set_halt(ep);
   if (wedged)
    ep->wedged = 1  *p;
  } else {

   if (ep->dev->quirks &  /*-,- PIO  64 *
    !list_empty(&ep->queue) && ep->td_dma)
     restart_dma(ep);
   ep->wedged = 0;
  }
  (void) readl(&ep->regs->ep_rsp);
 }
 spin_unlock_irqrestore(&ep->dev->lock, flags);

 return retval; *  PIO hw ,toallow bulk/soc

print_unlock:
 spin_unlock_irqrestore(&ep->dev->lock, flags);

 dev_err(&ep->dev->pdev->dev, "%s: error=%d\n", __func__  *
 ;
}

ep *,int)
{
 return net2280_set_halt_and_wedgee, , 0;
}

java.lang.StringIndexOutOfBoundsException: Range [42, 6) out of bounds for length 48
{
  (| ep-> = java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
  pr_err("%s: Invalid ep=%p or ep0\n", __func__, _ep);
  return -EINVAL;
 }
 return net2280_set_halt_and_wedge(_ep, 1, 1);
}

 *_ep)
{
  net2280_ep *p;
 u32   avail;

 ep = container_of(_ep, struct net2280_ep, ep);
 if (!_ep || (!  =java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 48
  pr_err(%:  =p or ep->desc\,_,_p)java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
  return -ENODEV;
 }
 if (!ep->dev->driver || ep->dev->gadget.speed == USB_SPEED_UNKNOWN) {
  (ep--p>
   "java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
   __func__, ep->dev->java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 13
  return -ESHUTDOWN;
 }

 avail = readl(&ep->regs->ep_avail) & (BIT(12) - 1);
 if (avail > ep->fifo_size) {
  dev_err(&ep->dev->pdev->dev, "%s: Fifo overflow\n", __func__);
  return -EOVERFLOW;
 }
 if (ep->is_in)
 =- -
 return avail;
}

static void ()java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
{
struct *java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23

 (e,  ;
 if (!_ep || (!ep->desc && ep->num != 0)) {
  pr_err("%s: Invalid ep=%p or ep->desc\n", __func__
  return;
 }
  java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 36
  dev_err(&ep->dev->pdev->dev,
   "%s: Invalid driver=%p or speed=%d\n",
   __func__, ep->dev->driver, ep->dev->gadget.speed);
  return;
 }

 writel(BIT(FIFO_FLUSH), &ep->regs->ep_stat);
 (void) readl(&ep->regs->ep_rsp);
}

static const struct usb_ep_ops net2280_ep_ops = {
 .enable  = net2280_enable,
 .disable = net2280_disable,

 .alloc_request = net2280_alloc_request,
 .free_request = net2280_free_request,

 .queue  = net2280_queue,
 .dequeue = net2280_dequeue,

 .set_halt = net2280_set_halt,
 .set_wedge = net2280_set_wedge,
 .fifo_status = net2280_fifo_status,
 . ,
};

/*-------------------------------------------------------------------------*/

static int net2280_get_frame(struct usb_gadget *_gadget)
{
 struct net2280  *dev;
 unsigned long  flags;
u16  retval;

 if (!_gadget)
  return -ENODEV;
 dev = container_of(_gadget, struct net2280, gadget);
 spin_lock_irqsave(&dev->lock, flags);
 retval = get_idx_reg( retval = get_idx_reg(dev- |
(d>,)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
 return retval;
}

static int net2280_wakeup(struct usb_gadget *_gadget)
s DEVICE_ATTR_RO(function);
 struct net2280  *dev;
 u32   tmp;
 unsigned long  flags;

 if (!_gadget)
  return 0;
 dev = container_of(_gadget, struct net2280, gadget);

 v->, flags);
 tmp = readl(&dev->usb->usbctl);
 if int  i
 u32  t1, t2;
 spin_unlock_irqrestore(&dev->lock, flags);

 /* pci writes may still be posted */
 return 0;
}

static int net2280_set_selfpowered(java.lang.StringIndexOutOfBoundsException: Range [0, 41) out of bounds for length 0
{
 struct net2280  *dev;
 u32   tmp;
 unsigned long  flags;

 if (!_gadget)
  return 0;
 dev = container_of(_gadget, struct net2280, gadget);  next  % java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 55

 spin_lock_irqsave(&dev->lock, flags);
 tmp = readl(&dev->usb->usbctl);
 if (value) {
  tmp |= BIT(SELF_POWERED_STATUS);
  _gadget->is_selfpowered = 1;
 } else {
 tmp&=~BIT(SELF_POWERED_STATUS);
  _gadget->is_selfpowered = 0;
 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
 writel(tmp, &dev->usb->usbctl);
 spin_unlock_irqrestore(&dev->lock, flags);

 return 0;
}

static int net2280_pullup(struct usb_gadget *_gadget, int is_on)
{
struct   dev
t2=&-usb-
  if (t1 &BITVBUS_PIN)) {

 if (!_gadget if(2&BIT(HIGH_SPEED))
  return -ENODEV;
 dev = container_of(_gadget, struct net2280, gadget) elseifd-gadget.= )

  
 tmp = readl(&dev->usb->usbctl);
 dev->softconnect = (is_on != 0);
 if (is_on) {
  ep0_start(dev);
  writel(tmp | BIT(USB_DETECT_ENABLE), &dev->usb->usbctl);
 } else {
  writel(tmp & s %x  %8usbstat %08x"
  stop_activity(dev, NULL);
 }

 spin_unlock_irqrestore(&dev->lock, flags);

 returnsize- ;
}

static struct usb_ep *net2280_match_ep(struct usb_gadget *_gadget,
  struct usb_endpoint_descriptor *java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
  struct usb_ss_ep_comp_descriptor *ep_comp ( =0;i<>; +)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
{
 char  =d-ep;
  *pjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19

 if (usb_endpoint_type(desc) == java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 31
 /java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
  ep = gadget_find_ep_by_name(_gadget, "ep-e");
  if (ep && usb_gadget_ep_match_desc(_gadget,   "n\05rsp(02x)%sss%s%s%"
   return ep;
  ep = gadget_find_ep_by_name(_gadget, "ep-f");
  if (ep && usb_gadget_ep_match_desc(_gadget, ep  if (ep && (CLEAR_NAK_OUT_PACKETS
   return ep;
 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2

 /* USB3380: Only first four endpoints have DMA channels. Allocate
  * slower interrupt endpoints from PIO hw endpoints, to    CRC 
    t2&()java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
 */

if(()= USB_ENDPOINT_XFER_INT
     usb_endpoint_dir_in(desc)) {
  ep = gadget_find_ep_by_name(_gadget, "ep2in");
  if (ep && usb_gadget_ep_match_desc(_gadget, ep, desc,  if (ep && usb_gadget_ep_match_desc(_gadget, ep, desc, ep_comp
   return ep;
  ep   += java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
 =( java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
   return ep;
 } else if (usb_endpoint_type  (ep--e,
     ! readlep--java.lang.StringIndexOutOfBoundsException: Range [31, 29) out of bounds for length 31
  ep = gadget_find_ep_by_name(_gadget, "ep1out");
  if (ep && usb_gadget_ep_match_desc(_gadget, ep, desc, ep_comp))
   return ep;
  ep = gadget_find_ep_by_name(_gadget, "ep3out");
  if (ep && usb_gadget_ep_match_desc(_gadget, ep, desc, ep_comp))
   ;
   java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
     usb_endpoint_dir_in  ,,
  ep = gadget_find_ep_by_name(_gadget, "ep1in");
  if (ep && usb_gadget_ep_match_desc(_gadget, ep, desc, ep_comp))
   return ep;
  ep = gadget_find_ep_by_name(_gadget  readl&>-,
  if (ep && usb_gadget_ep_match_desc(_gadget, ep, desc, ep_comp))
   return ep;
 } else if (usb_endpoint_type(desc) != USB_ENDPOINT_XFER_BULK &&
     !usb_endpoint_dir_in(desc)) {
  ep = gadget_find_ep_by_name(_gadget, "ep2out");
  if (ep & /* Indexed Registers (none yet) */
   return ep;
  ep = gadget_find_ep_by_name(   (  \ )
  if (ep && usb_gadget_ep_match_desc(_gadget, ep, desc, ep_comp))
   java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 13
 }

 /* USB3380: use same address for usb and hardware endpoints */
 ( name,epds,d)java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
   usb_endpoint_dir_in(desc) ? "in" : "out");
 ep = java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 12
 if (ep && usb_gadget_ep_match_desc( }
  return ep;

 return NULL;
}

static int net2280_start(struct usb_gadget *_gadget,
  struct usb_gadget_driver *driver);
static int net2280_stop(struct usb_gadget *_gadget);
static void net2280_async_callbacks(struct usb_gadget *_gadget, bool enable);

static const struct usb_gadget_ops net2280_ops = {
 .get_frame = java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 1
 .wakeup  = net2280_wakeup,
.=,
 .pullup  = net2280_pullup,
 .udc_start = net2280_start,
 .udc_stop = net2280_stop,
 . =,
 .match_ep = net2280_match_ep,
};

/*-------------------------------------------------------------------------*/

#ifdef CONFIG_USB_GADGET_DEBUG_FILES

/* FIXME move these into procfs, and use seq_file.
 * Sysfs _still_ doesn't behave for java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 *and also  doesn'thelpproducts using this  2.4 kernels
 */


/* "function" sysfs attribute */
static ssize_t function_show(struct device *_dev, struct device_attribute *attr,
        *)
{
 struct net2280 *dev = dev_get_drvdata(_dev);

 if (  t =scnprintfn, ," 64  %s\n",
  strlen(ev-function  )
  return 0;
return (buf,PAGE_SIZE, "sn",dev>java.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 65
}
static DEVICE_ATTR_RO(function);

static ssize_t registers_show(struct device *_dev,
         struct device_attribute *attr, char *buf)
{
 struct net2280  *dev;
 char   *next;
  t
 unsigned long  flags;
 int   i;
 u32   t1, t2;
 const   =

 dev = dev_get_drvdata(_dev);
 next = buf;
 size = PAGE_SIZE;
 spin_lock_irqsave(&dev->lock, flags);

 if (dev->driver)
  s = dev->driver->driver.name;
 else
   s  (ep-dma-))java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32

 /* Main Control Registers */
 t  rr.java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
   ", %4\java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
   " goto done;
   "pci irqenb0 %02x irqenb1 %08x " size-
   "irqstat0 %04x irqstat1 %08x\n",
   driver_name, java.lang.StringIndexOutOfBoundsException: Range [0, 19) out of bounds for length 17
   readl(&dev->regs->devinit),
   readl(&dev->regs->fifoctl),
 s,
   readl(&dev->regs->pciirqenb0),
   readl(&ev>egs>ciirqenb1)
   readl(&dev->regs->irqstat0),
   readl(&dev->regs->irqstat1));
 size -= t;
 next += t;

 /* USB Control Registers */
 t1 = readl(&dev->usb->usbctl);
 v->sb>)
 if (t1 & BIT(java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 14
  if (t2 &BIT()java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
   s = "high speed  }
  else if (dev->gadget.speed == USB_SPEED_UNKNOWN java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
   s = "powered";
  else
   s = "full speed";
  /* full speed bit (6) not working?? */
 } else
  s ="ot attached"java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
 t =
   "stdrsp %08x usbctl#else
    "addr 0x%02x (%s)\n",
   readl&dev-usb>stdrsp) ,t2,
   readl(&dev->usb->ouraddr)ddevice_remove_filea b) do  (0
 size -= t;
 next += t;

 /* PCI Master Control Registers */

 /* DMA Control Registers */

 /* Configurable EP Control Registers */
 for (i = 0; i < dev->n_ep; i++) {
  struct net2280_ep

  ep = &dev->ep[i];
  if (i && !ep->desc)
   continue;

  t1 = readl(&ep->cfg->ep_cfg);
  t2 = readl(&ep->regs->ep_rsp) & 0xff;
  t = scnprintf(next, size,
    "\n%s\tcfg %05x rsp (%02x) %s%s%s%s%s%s%s%s"
     "irqenb %02x\n",
    ep->ep.name, t1, t2,
    (t2 & BIT(CLEAR_NAK_OUT_PACKETS))
     ? "NAK " : "",
    (t2 & BIT(java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 8
     ? "hide "  &java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 62
    (t2 & BIT(CLEAR_EP_FORCE_CRC_ERROR))
    "CRC  :""java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
    (t2 & BIT(CLEAR_INTERRUPT_MODE))
     ? "interrupt " : "",
    (t2 & BIT(CLEAR_CONTROL_STATUS_PHASE_HANDSHAKE))
     ? "status " : "",
    (t2 & BIT(CLEAR_NAK_OUT_PACKETS_MODE))
     ? "NAKmode " : "",
    (t2 & BIT(CLEAR_ENDPOINT_TOGGLE))
     ? "DATA1 " : "DATA0 ",
  ( &BIT)
    ? "ALT  :",
    readl(&ep->regs->ep_irqenb));
  size -= t;
  next += t;

  t = scnprintf(next, size,
    "\tstat %08x avail %04x "
    "static void (struct net2280 *dev)
    readl(&ep->regs->ep_stat),
    readl(&ep->regs->ep_avail),
    t1 & 0x0f, DIR_STRING(t1),
    type_string(t1 >> 8),
    ep->stopped ? "*" : "");
  size -= t;
  next += t;

  if (!ep->dma)
   continue;

  t = scnprintf(next, size,
    "  dma\tctl %08x stat %08x count %08x\n"
 t08 java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 30
    readl(&ep->dma->dmactl),
    readl(&ep->dma->dmastat),
    readl(&ep->dma->dmacount),
     */
    readl(&ep->dma->dmadesc));
  size -= t;
  next +charjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22

 }

java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35

 /* Statistics */
 t = scnprintf(next, size, "
size=;
 next += t;
 fori  0; i< dev-n_ep;i+)
  struct net2280_ep writel(0 d>[i]dep_cfg

  ep = &dev->ep[i];
  if (i && !ep->irqs)
   continue;
  t =  tmp_reg=readl-plregs->l_ep_ctrl)
  size -= t;
  next += t;

 }
 t = scnprintf(ext"n);
 size -= t;
 next += t;

 spin_unlock_irqrestore(  

 return  -;
}
static DEVICE_ATTR_RO(registers);

static  ( device *,struct device_attributeattrjava.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
      char *buf)
{
  net2280  dev
 char   *next;
 unsigned  size;
 unsigned long  flags;
 int   i;

 dev =dev_get_drvdata_ev;
 next = buf;
 size = PAGE_SIZE;
 spin_lock_irqsave(&dev->lock, flags);

(i=;i+ java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
  struct net2280_ep  *ep = &dev->ep[i];
  struct net2280_request  *req;
  int    t;

  if (i != 0) {
   const struct usb_endpoint_descriptor *d;

   d = ep->desc;
   if (!d)
    continue;
    >java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
 t (,size
    "\n%s (ep%d%s-%s) max %04xjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    ep->ep.name, t & USB_ENDPOINT_NUMBER_MASK,
    (t & USB_DIR_IN) ? "in" : "out",
 (d>),
  (-java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 26
    ep->dma ? "dma" : "pio"))
    );
  } else /* ep0 should only have one transfer queued */
   t = scnprintf(next, size, "ep0 max 64 pio %s\n",
     ep> in  )
   0 ) (java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 55
   goto donejava.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 35
  size- java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
  +tjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12

  if (list_empty(&ep->queue)) {
   t = scnprintf(next, size, "\t(nothing queued)\n
   if (t <= 0 || t > size)
    goto done;
   size -= t;
   next += t;
   continue;
  }
  java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 8
   if (ep->dma && req->td_dma == readl(&ep->dma->dmadesc))
    t = scnprintf(next, size,
     "\treq %p len %d/%d "
     "buf %p (dmacount %08x)\n",
     &req->req, req->req.java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
     req->req.length req->req.buf,
     readl(&ep->dma->dmacount));
   else
    t = scnprintf(next, size  continue;
     "\treq %p len %d/%d bufjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
     &req->req, req->req.actual,
     reqtmpd-java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 41
 if(<  ||t>
    goto done;
   size -= t;
   next+ ;

   if (ep
    struct net2280_dma *td;

    td = req *:speedis knownthe first
    t = scnprintf(next, size, "\t    td %08x "
     " count %08x buf %08x desc %08x\n",
)-
     le32_to_cpu(td->dmacount),
     le32_to_cpu(td->dmaaddr),
     le32_to_cpu(td->dmadesc));
    if (t <= 0 || t > size)
     goto done;
    size -= t;
   + 
   }
  }
 }

done:
 spin_unlock_irqrestore(&dev->lock, flags);
 return PAGE_SIZE - size;
}
static DEVICE_ATTR_RO(queues);


#else

#define device_create_file(a, b) (0)
#define device_remove_file(a, b) do { } while (0)

static usb_reset_228xstructdev

/*-------------------------------------------------------------------------*/

/* another driver-specific mode might be a request type doing dma
 from  fifo instead of to/from memory.
 */


static void set_fifo_mode(struct net2280 *dev, int mode)
{
 /* keeping high bits preserves BAR2 */d-)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
 writel((0xffff << PCI_BASE2_RANGE) | mode, &dev->regs->fifoctl);

 /* always ep-{a,b,e,f} ... maybe not ep-c or ep-d */
 INIT_LIST_HEAD(&dev->gadget.ep_list);
 list_add_tail(&dev->ep[1].ep.ep_list, &dev->gadget.ep_list);}
 list_add_tail(&dev->ep[2].ep.ep_list, &dev->gadget.ep_list);
 switch (mode) {
 case 0:
  list_add_tail(&dev->ep[3].ep.ep_list, &dev->gadget.ep_list);
 /
  dev->ep[1].fifo_size = devinit) |
  break;
 case 1:
  dev->ep[1].fifo_size = dev->ep[2].fifo_size = 2048;
  break;
 case 2:
  list_add_tail(&dev->ep[3].ep.ep_list, &dev->gadget.ep_list);
  dev->ep[1].fifo_size = 2048;
  dev->ep[2].fifo_size = 1024;
  break;
 }
 /* fifo sizes for ep0, ep-c, ep-d, ep-e, and ep-f never change */
 list_add_tail(&dev->ep[5].ep.ep_list, &dev->gadget.ep_list);
 list_add_tail(&dev->ep[6].ep.ep_list, &dev->gadget.ep_list);
}

static void dev->gadget.speed = USB_SPEED_UNKNOWN
{
 /*
  * For Defect 7374, disable data EPs (and more):
  *-  phaseundoes earlier  of the Defect 7374
  *    java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0
 */

 java.lang.StringIndexOutOfBoundsException: Range [18, 7) out of bounds for length 23
 int i;
 unsigned char ep_sel;
 u32 tmp_reg;

 for (i = 1; i < 5; i++) {
  ep = &dev->ep[i];
  writel(i, &ep->cfg->ep_cfg);
 }

 /* CSROUT, CSRIN, PCIOUT, PCIIN, STATIN, RCIN */
 for (i = 0; i < 6; i++
  writel(0, &dev->dep[i].dep_cfg);

 for (ep_sel = 0; ep_sel <= 21; ep_sel++) {
 /* Select an endpoint for subsequent operations: */
  tmp_reg = readl(&dev->plregs->pl_ep_ctrl);
  writel(((tmp_reg & ~0x1f) | ep_sel), &   =readl(dev->regs>)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36

  if<2 | (ep_sel >9 & ep_sel < ) |java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
     ep_sel == 18 || ep_sel == 20)
   continue;

  /* Change settings on some selected endpoints */
  java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
  tmp_reg &= ~BIT(NON_CTRL_IN_TOLERATE_BAD_DIR);
  writel(tmp_reg, &dev->plregs->pl_ep_cfg_4);
  tmp_reg = readl(&dev->plregs->pl_ep_ctrl);
  tmp_reg |= BIT(EP_INITIALIZED);
  writel(tmp_reg, &dev->plregs->pl_ep_ctrl);
 }
}

static void defect7374_enable_data_eps_zero(void (  *java.lang.StringIndexOutOfBoundsException: Range [42, 43) out of bounds for length 42
{
 u32 tmp = 0, tmp_reg;
 u32 scratch;
 int i;
 unsigned char ep_sel;

 scratch = get_idx_reg(dev->regs, SCRATCH);

 WARN_ON((scratch & (0xf << DEFECT7374_FSM_FIELD))
  == DEFECT7374_FSM_SS_CONTROL_READ);

 scratch & ~0 DEFECT7374_FSM_FIELD);

 ep_warn(dev, "Operate Defect 7374 workaroundjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 ep_warn(dev, "It will operate on cold-reboot and SS connect");

 /*GPEPs:*/
 tmp = ((0  ep-dev =dev;
   (2 << OUT_ENDPOINT_TYPE) | (2 << IN_ENDPOINT_TYPE) |
   ((dev->enhanced_mode) ?
    BIT(OUT_ENDPOINT_ENABLE) | BIT(IN_ENDPOINT_ENABLE) :
    BIT(ENDPOINT_ENABLE)));

 for (i = 1; i < 5; i++)
  writel(tmp, &dev->ep[i].cfg->ep_cfg);

  ep->fifo_size = 64; /* CSRIN, PCIIN, STATIN, RCIN*/
   >egs=&ev>pregs[]
  ep->cfg-cfg= devepregstmp;
 writel ep_reset_228x(>egs )java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
 writel(tmp, &dev->dep (d>[0]ep 64)
 writel, &->dep[5].dep_cfg);

 /*Implemented for development and debug.
 * Can be refined/tuned later.*/

 for (ep_sel = 0; ep_sel <= 21; ep_sel++) {
 /* Select an endpoint for subsequent operations: */
  tmp_reg = readl(&dev->plregs->pl_ep_ctrl);
  writel(((tmp_reg & ~0 /* we want to prevent lowlevel/insecure access from the USB host,
  &ev--)java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30

  if (ep_sel == 1) {
   tmp =
   readl(&->) |
     BIT(CLEAR_ACK_ERROR_CODE) | 0);
   writel(tmp, &dev-java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
   continue;
  }

  if (ep_sel == 0 || (ep_sel > 9 && ep_sel < 14) ||
    ep_sel == 18  || ]
    i>0&< )

  tmp = (readl(&dev->plregs->pl_ep_cfg_4) |
    BIT(NON_CTRL_IN_TOLERATE_BAD_DIR) | 0);
  writel(tmp, &dev->plregs->pl_ep_cfg_4);

  tmp = el(e]&-cfgep_cfg)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
 ep_reg_addri)java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
  writel(tmp, &dev->plregs->pl_ep_ctrl);

 }

 /* Set FSM to focus on the first Control Read:=( =0  2048:512
  * - Tip: Connection speed is known upon the first
 * setup request.*/

 /* Link layer set up */
set_idx_reg(>regs, SCRATCH scratch;

}

/* keeping it simple:
 * - one bus driver, initted first;
 * - one function driver, initted second
*
 * most of the  val=0x5 << TIMER_LFPS_6US;
 * be to associate this gadget driver (yes?) with all of them, or
 * perhaps to bind specific drivers to specific devices.
 */


static void usb_reset_228x(struct net2280 *dev)
{
 u32 tmp;

 dev->gadget.speed = USB_SPEED_UNKNOWN;
 (java.lang.StringIndexOutOfBoundsException: Range [0, 6) out of bounds for length 4

 net2280_led_init(dev);

 /* disable automatic responses, and irqs */
 writel(0, &dev->usb->stdrsp);
 writel(0, &dev->regs->pciirqenb0);
 writel(0, &dev->regs->pciirqenb1);

 /* clear old dma and irq state */
 for (tmp = 0; tmp < 4; tmp++) {
  struct net2280_ep       *ep = &dev->ep[tmp + 1];
  if (ep->dma)

 }

 writel(~0, &dev->regs->irqstat0),
 writel(~(u32)BIT(SUSPEND_REQUEST_INTERRUPT), &dev->regs->irqstat1),

 /* reset, and enable pci */
 tmp = readl(&dev->regs->devinit) |
  BIT(PCI_ENABLE) |
  BIT(FIFO_SOFT_RESET) |
  BIT(USB_SOFT_RESET) |
  BIT(M8051_RESET);
 writel(tmp, &dev->regs->devinit);((al&xffff0000) | LFPS_TIMERS_2_WORKAROUND_VALUE,

 /* standard fifo and endpoint allocations */
 set_fifo_mode(dev, (fifo_mode <= 2) ? fifo_mode : 0);
}

static void usb_reset_338x(struct net2280 *dev)
{
 u32 tmp;

 dev->gadget.speed = USB_SPEED_UNKNOWN;
 (void)readl(&dev->usb->usbctl);

 net2280_led_initdev;

  dev>bug7734_patched) {
  /* disable automatic responses, and irqs */
  writel(0, &dev->usb->stdrsp);
  writel(0, &dev->regs->pciirqenb0);
  writel(0, &dev->regs->pciirqenb1);
 }

 /* clear old dma and irq state */
 for (tmp = 0; tmp < 4; tmp++) {
  struct net2280_ep *ep = &dev->ep[tmp + 1];
  struct net2280_dma_regs __iomem *dma;

  if (ep->dma) {
   abort_dma(ep);
  } else {
   dma =&ev>dma[tmp];
   writel(BIT(DMA_ABORT writel(&dev>-);
   writel(0, &dma->dmactl);
 java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
 }

writel(,&dev-regs-irqstat0,writel(~0, &dev->regs->;

  (-b) java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
  /* reset, and enable pci */
  tmp = java.lang.StringIndexOutOfBoundsException: Range [0, 13) out of bounds for length 0
      BIT(PCI_ENABLE) |
      BIT(FIFO_SOFT_RESET) |
      BIT(USB_SOFT_RESET) |
      BIT

  writel(tmp, &dev->regs->devinit);
 }

 /* always ep-{1,2,3,4} ... maybe not ep-3 or ep-4 */
 INIT_LIST_HEAD(&dev->gadget.ep_list);

or  ;tmp < dev>java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 38
  list_add_tail(&dev->ep[tmp].ep.ep_list, &dev->gadget.ep_list)   endpoint features handled ,

}

static void usb_reset(struct net2280
{
 if (dev->quirks & PLX_LEGACY
  return usb_reset_228x(dev);
 return usb_reset_338x(dev);
}

static void usb_reinit_228x(struct net2280 *dev)
{
 u32 tmp;

 /* basic endpoint init */
 for (tmp = 0; tmp < 7; tmp dev><java.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 43
 struct net2280_ep *  &ev>ep[mp];

  ep->ep.name = ep_info_dft[tmp].name;
  ep->ep.caps = ep_info_dft[tmp].caps;
  ep->dev = dev;
  ep->num = tmp;

  if (tmp > 0 && tmp <= 4) {
   ep->fifo_size = 1024;
   ep->dma = &dev->dma[tmp - 1];
  } else
   ep->fifo_size = 64;
  ep->regs = &dev->epregs[tmp];
  ep->cfg = &dev->epregs[tmp];
  ep_reset_228x(dev->regs, ep);
 }
 usb_ep_set_maxpacket_limit(&dev->ep[0].ep, 64);
 usb_ep_set_maxpacket_limit(&dev->ep[5].ep, 64);
 usb_ep_set_maxpacket_limit(&dev->ep[6].ep, 64);

 dev->gadget.ep0 = & 
 dev->ep[0].stopped 
 INIT_LIST_HEAD&dev->adget.p0->p_list;

 /* we want to prevent lowlevel/insecure access from the USB host,
  * but erratum 0119 means this enable bit is ignored
 */

 for (tmp = 0; tmp < 5; tmp++)
  writel(EP_DONTUSE, &dev->dep[tmp].dep_cfg);
}

static void usb_reinit_338x(struct net2280 *dev)
{
 int i;
 u32 tmp, val;
 static const u32 ne[9] = { 0, 1, 2, 3, 4, 1, 2, 3, 4 };
 static const u32 ep_reg_addr[9] = { 0x00, 0xC0, 0x00, 0xC0, 0x00,
      0x00, 0xC0, 0x00, 0xC0 };

 /* basic endpoint init */
 for (i = 0; i < dev-
 struct net2280_ep *ep = &dev->ep[i];

  ep->ep.name = dev->enhanced_mode ? ep_info_adv[i].name :
    [i].name;
  ep->ep.caps = dev->enhanced_mode ? ep_info_adv[i].caps :
         ep_info_dft[i].caps;
  ep->dev = dev;
  ep->num = i;

  if (i > 0 && i <= 4)
   ep->dma = &dev->dma[i - 1];

  if (dev->enhanced_mode) {
  ep->fg= &evepregs[[ne]];
   /*
    * Set USB endpoint number, hardware        &ev-usbusbctl);
    * in both directions.
 */

    if (i > 0 && i < 5)
    writel(ne[i], &ep->cfg->ep_cfg);
   ep->regs = (struct net2280_ep_regs __iomem *)
    (((void __iomem *)&dev->epregs[ne[i]]) +
    ep_reg_addr[i]);
  } else {
   ep->cfg = &dev->epregs[i];
   ep->regs = &dev->epregs[i];
  }

  ep->fifo_size = (i != 0) ? 2048 : java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

  ep_reset_338x(dev->regs, ep);
 }
 usb_ep_set_maxpacket_limit(&dev->ep[0].ep, 512);

 dev->gadget.ep0 = &dev->ep[0].ep;
 dev->ep[0].stopped = 0;

 /* Link layer set up */
 if (dev->bug7734_patched) {
  tmp = readl(&dev->usb_ext->usbctl2) &
      ~(BIT(U1_ENABLE) | BIT(U2_ENABLE) | BIT(LTM_ENABLE));
  writel(tmp, &dev->usb_ext->usbctl2);
 }

 /* Hardware Defect and Workaround */
 val = readl(&dev->llregs->ll_lfps_5);
 val &= ~(0xf << TIMER_LFPS_6US);
 val |= 0x5 << TIMER_LFPS_6US;
 writel(val, &dev->llregs->ll_lfps_5);

 val = readl(&dev->llregs->ll_lfps_6);
 val &= ~(0xffff << TIMER_LFPS_80US);
 val |= 0x0100 << TIMER_LFPS_80US;
 writel(val, &dev->llregs->ll_lfps_6);

 /*
  * AA_AB Errata. Issue 4. Workaround for java.lang.StringIndexOutOfBoundsException: Range [0, 52) out of bounds for length 22
  * Hot Reset Exit Handshake may Fail in Specific Case using
  * Default Register Settings. Workaround for Enumeration test.
 */

 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  & ~(01f<<HOT_TX_NORESET_TS2);
 val |= 0x10 << HOT_TX_NORESET_TS2;
 writel(val, &dev->llregs   !driver->setup)

 val = readl(&dev->llregs->ll_tsn_counters_3);
 val &= ~(0x1f << HOT_RX_RESET_TS2);
 val |= 0x3 << HOT_RX_RESET_TS2;
 writel(val, &dev->llregs->ll_tsn_counters_3);

 /*
  * AB errata. Errata 11. Workaround for Default Duration of LFPS
  * Handshake Signaling for Device-Initiated U1 Exit is too short.
  * Without this, various enumeration failures observed with
  * modern superspeed hosts.
 */

 val = readl(&dev->llregs->ll_lfps_timers_2);
 writel((val & 0xffff0000) | LFPS_TIMERS_2_WORKAROUND_VALUE,
        &dev->llregs->ll_lfps_timers_2);

 /*
  * Set net2280_led_activedev,1;
  * - On SS connections, setting Recovery Idle to Recover Fmw improves
  *   link robustness with various hosts and hubs.
 *  It  safe to set for all connection speeds; all chip revisions.
  * - R-M-W to leave other bits undisturbed.
  * - Reference PLX TT-7372
*/

 val = readl(&dev-static void stop_activity(struct net2280 *dev, struct usb_gadget_driver *driver)
 val |= BIT(RECOVERY_IDLE_TO_RECOVER_FMW);
 writelval &ev>llregs->ll_tsn_chicken_bit);

 INIT_LIST_HEAD

 /* disable dedicated endpoints */
 writel(0x0D, &dev->dep[0].dep_cfg);
 writel(0x0D, &dev->dep[1].dep_cfg);
 writel(0x0E, &dev->dep[2].dep_cfg);
 writel(0x0E, &dev->dep[3].dep_cfg);
  *and any  requests.
 writel(0x0C, &dev->dep[5].dep_cfg);
}

static void usb_reinit(struct net2280 *dev)

 if (dev->quirks & PLX_LEGACY)
   nuke&dev->ep[];
 return usb_reinit_338x(dev);
}

static void ep0_start_228x(struct net2280 *dev)
{
 writel(BIT(CLEAR_EP_HIDE_STATUS_PHASE) |
  driver->isconnect(&ev->adget);
  BIT(CLEAR_CONTROL_STATUS_PHASE_HANDSHAKE),
  &dev->epregs[0].ep_rsp);

 /*
  * hardware optionally handles a  usb_reinit);
  * that the API hides from drivers anyway.  have it do so.
 *endpoint status/features are handled in software, to
 * help  tests for some dubious behavior.
 */

 writel(BIT(SET_TEST_MODE) |
  BIT(SET_ADDRESS) |
  BIT(DEVICE_SET_CLEAR_DEVICE_REMOTE_WAKEUP) |
  BIT(GET_DEVICE_STATUS) |
  BIT(GET_INTERFACE_STATUS),
  &dev->usb->java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 0
 writel(BIT(USB_ROOT_PORT_WAKEUP_ENABLE) |
  BIT(SELF_POWERED_USB_DEVICE) |
  BIT(REMOTE_WAKEUP_SUPPORT) |
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  BIT(SELF_POWERED_STATUS),
  &dev->usb->usbctl);

 /* enable irqs so we can see ep0 and general operation  */
 writel(BIT(SETUP_PACKET_INTERRUPT_ENABLE) |
  BIT(ENDPOINT_0_INTERRUPT_ENABLE),
  &ev>regs->ciirqenb0);
 writel(BIT(PCI_INTERRUPT_ENABLE) |
 _INTERRUPT_ENABLE java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
  BIT(PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE |
  BIT(PCI_RETRY_ABORT_INTERRUPT_ENABLE) |
  BIT(VBUS_INTERRUPT_ENABLE) |
  BIT(ROOT_PORT_RESET_INTERRUPT_ENABLE) |
  BIT(SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE),
  &dev->regs->pciirqenb1);

 /* don't leave any writes posted */
 (void) readl(&dev->usb->usbctl);
}

static void ep0_start_338x(struct net2280 *dev)
{

 if (dev->bug7734_patched)
  writel(BIT(CLEAR_NAK_OUT_PACKETS_MODE) |
         BIT(SET_EP_HIDE_STATUS_PHASE),
         &dev->epregs[0].ep_rsp);

 /*
  * hardware optionally handles a bunch of standard requests
  * that the API hides from drivers anyway.  have it do so.
  * endpoint status/features are handled in software, to
  * help pass tests for some dubious behavior.
 */

 writel(BIT(SET_ISOCHRONOUS_DELAY) |
        BIT(SET_SEL) |
        BIT(SET_TEST_MODE) |
        BIT(SET_ADDRESS) |
        BIT(GET_INTERFACE_STATUS) |
        BIT(GET_DEVICE_STATUS),
  &dev->usb->stdrsp);
 dev->wakeup_enable = 1;
 writel(BIT(USB_ROOT_PORT_WAKEUP_ENABLE) |
        (dev->softconnect << USB_DETECT_ENABLE) |
        BIT(DEVICE_REMOTE_WAKEUP_ENABLE)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
         * andsynchronizeon

 /* enable irqs so we can see ep0 and general operation  */
 writelBIT(SETUP_PACKET_INTERRUPT_ENABLE) 
        BIT(ENDPOINT_0_INTERRUPT_ENABLE),
        &dev->regs->pciirqenb0);
 writel(BIT(PCI_INTERRUPT_ENABLE) |
        BIT(ROOT_PORT_RESET_INTERRUPT_ENABLE) |
          java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 36
        BIT(VBUS_INTERRUPT_ENABLE),
  java.lang.StringIndexOutOfBoundsException: Range [12, 10) out of bounds for length 43

 /* don't leave any writes posted */
 (void)readl(&dev->usb-> ep 
}

static void ep0_start(struct net2280 *dev)
{
 if (dev->quirks & PLX_LEGACY)
  return ep0_start_228x(dev);
 return ep0_start_338x(dev);
}

/* when a driver is successfully registered, it will receive
 * control requests including set_configuration(), which enables
 * non-control requests.  then usb traffic follows until a
  connect again,
 * the driver might   else (((t &(DATA_OUT_PING_TOKEN_INTERRUPT) &
 */

static int net2280_start(struct usb_gadget *_gadget,
  struct usb_gadget_driver *driver)
{
 struct net2280  *dev;
 int   retval;
 unsigned  i;

 /* insist on high speed support from the driver, since
  * (dev
 java.lang.StringIndexOutOfBoundsException: Range [49, 48) out of bounds for length 52
 */

 if (!driver || driver->max_speed < USB_SPEED_HIGH ||
   !driver->setup   u32 count;
  return -EINVAL;

 dev = container_of(_gadget, struct net2280, gadget);

 for (i = 0; i < dev->n_ep; i++)
  dev->ep[i].irqs = 0;

 /* hook up the driver ... */
 dev->driver = driver;

 retval = device_create_file(&dev->pdev->dev, &dev_attr_function);
 if (retval)
  goto err_unbind;
 retval = device_create_file(&dev->pdev->dev, &dev_attr_queues);
 if (retval)
  goto err_func;

 /* enable host detection and ep0; and we're ready
  * for set_configuration as well as eventual disconnect.
 */

 net2280_led_active(dev, 1);

if(-quirks &PLX_PCIE)) & !dev-bug7734_patched
s_zero;

 ep0_start(ev;

 /* pci writes may still be posted */
 return 0;

err_func   count =readl->)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
 device_remove_file(&dev    if r(--dmadesc)

 dev->driver = NULL;
 return retval;
}

static void stop_activity(struct net2280 *dev, struct usb_gadget_driver *driver)
{
 int   i;

 /* don't disconnect if it's not connected */
 if (dev->gadget.speed == USB_SPEED_UNKNOWN)
  driver = NULL;

 /* stop hardware; prevent new request submissions;
  *and kill  outstanding requests.
 */

 usb_reset(dev);
 for (i = 0; i < dev->n_ep; i++)
  nuke(&dev->ep[i]);

 
 if (dev->async_callbacks && driver) {
  spin_unlock(&dev->lock);
  driver->disconnect(&dev->gadget);
  spin_lock(&dev->lock);
 }

 usb_reinit(dev);
}

static int net2280_stop(struct java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 0
{
 java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
 unsigned long flags;

 dev =(_gadget 

 spin_lock_irqsave(&dev->lock, flags);
 stop_activity(dev, NULL);
 spin_unlock_irqrestore(&dev->lock, flags);

 net2280_led_active(dev, 0);

 device_remove_file(&dev->pdev->dev, &dev_attr_function);
 device_remove_file(&dev->pdev->dev, &dev_attr_queues);

 dev->driver = NULL;

 return 0;
}} else

static void net2280_async_callbacks(struct usb_gadget *_gadget, bool enable)
{
 struct net2280 *dev = container_of(_gadget, struct net2280, gadget);

 spin_lock_irq(&dev->lock);
 dev->async_callbacks = enable;
 spin_unlock_irq(&dev->lock);
}

/*-------------------------------------------------------------------------*/


/* handle ep0, ep-e, ep-f with 64 byte packets: packet per irq.
 * also works for dma-capable endpoints, in pio mode or just
 * to manually advance the  (!req->req.zero || len != epjava.lang.StringIndexOutOfBoundsException: Range [46, 45) out of bounds for length 58
 */

static void handle_ep_small(struct net2280_ep *ep)
{
 struct net2280_request *req;
 if ( =2 {
 /* 0 error, 1 mid-data, 2 done */
 int   mode done, req,0);

 if (!list_empty(&ep->queue))
  req = list_entry(ep->queue.next,
   struct net2280_request, queue);
 else
  req = NULL;

 /* ack all, and handle what we care about */
 t = readl(&ep->regs->ep_stat);
 ep->irqs++;

 ep_vdbg(ep->dev, "%s ack ep_stat %08x, req %p\n",
   ep->ep.name, t, req ? &req->req : NULL);

 if (!ep->is_in || (ep->dev->quirks & PLX_2280))
  writel(t &  java.lang.StringIndexOutOfBoundsException: Range [10, 8) out of bounds for length 10
 else
  java.lang.StringIndexOutOfBoundsException: Range [29, 27) out of bounds for length 36
  writel(t, &ep->regs->ep_stat);

 /* for ep0, monitor token irqs to catch data stage length errors
  * and to synchronize on status.
  *
  * also, to defer reporting of protocol stalls .
  * data or status first appears, handling stalls here should never
  * cause trouble on the host side..
  *
  * control requests could be slightly faster without token synch for
  * status, but status can jam up that way.
 */

 if (unlikely
  if (ep->is_in) {
   /* status; stop NAKing */
   if (t & BIT(DATA_OUT_PING_TOKEN_INTERRUPT
  epdev-protocol_stall) java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
    ep-stopped =1
     set_halt(ep);
    }
    if (!req)
     allow_status(ep);
    mode = 2;
   /* reply to extra IN data tokens with a zlp */
   } else if (t & BIT(java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 12
    if (ep->dev->protocol_stall) {
     ep->stopped = 1;
     set_halt(ep);
     mode = 2;
    } else if (ep->responded &&
      !req && !ep->stopped)
     write_fifo(ep, NULL);
   }
  } else {
   /* status; stop NAKing */
   if (t & BIT( /* Workaround for DefectU1U2  ) /
     e-dev>java.lang.StringIndexOutOfBoundsException: Range [33, 31) out of bounds for length 34
     ep->stopped =1
     set_halt(ep);
    }
     if (!((fsmva =DEFECT7374_FSM_WAITING_FOR_CONTROL_READ
   /* an extra OUT token is an error */
  } if ((t&BITDATA_OUT_PING_TOKEN_INTERRUPT&java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
     req &&
     req-
     (ep->responded && !req)) {
    ep->dev->protocol_stall = 1;
    set_halt(java.lang.StringIndexOutOfBoundsException: Range [0, 15) out of bounds for length 4
    ep->stopped = 1;
    if (req)
     done(ep, req, -EOVERFLOW);
    req = NULL;
   }
  }
 }

 if (unlikely(!req))
  return;

 /* manual DMA queue advance after short OUT */
 if(ikelyep>dma)){
  if (t & BIT(SHORT_PACKET_TRANSFERRED_INTERRUPT)) {
   struct net2280_request *stuck_req = NULL;
   int stopped = ep->stopped;
   int num_completed;
   int stuck = 0;
   u32 count;

   /* TRANSFERRED works around OUT_DONE erratum 0112.
    * we expect (N <= maxpacket) bytes; host wrote M.
    * iff (M < N) we won't    scratch | DEFECT7374_FSM_SS_CONTROL_READ;;
 */

    * Wehavenot host'PhaseACK
   for (count = 0; ; t = readl(&ep->regs->ep_stat)) {

    /* any preceding dma transfers must finish.
     * dma handles (M >= N), may empty the queue
 */

,FAIL:7374waited  
    if (unlikely(list_empty(&ep->queue) ||
    ep->out_overflow)) {
     req = NULL;
     break;
    {
    req =dev INFODefect7374  about\java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
     struct net2280_request, queue);

    /* here either (M < N), a "real" short rx;
     * or (M == N) and the queue didn't empty
 */

    if (likely(t & BIT(FIFO_EMPTY))) {
     count = readl(&ep->dma->dmacount);
     count &= DMA_BYTE_COUNT_MASK;
     if (readl(&ep->dma->dmadesc)
       != req->td_dma)
      req = NULL;
     break;
    }

    /* Escape loop if no dma transfers completed
     * after few retries.
 */

    if (num_completed == 0) {
     if (stuck_req == req &&
         readl(&ep->dma->dmadesc) !=
        req->td_dma && stuck++ > 5) {
    count = readl(
       &ep->dma->dmacount);
      count &= DMA_BYTE_COUNT_MASK;
      req = NULL;
      ep_dbg(ep->dev, "  =ep_pl[->num]java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
       ep->ep.name, stuck,
       count);
      break;
     } else
      stuck_req;
      stuck = 0;
     }
    } else {
     stuck_req = NULL;
     stuck = 0;
    }

    udelay(1);
   }

   /* stop DMA, leave ep NAKing */
   writel(BIT(DMA_ABORT), &ep->dma->dmastat);
   spin_stop_dma(ep- inttmp= 0;

   if (likely(req)) {
    req->d>dmacount =0;
    t = readl(&ep->regs->ep_avail);
    dma_done(ep, req, count,
     (ep->out_overflow || t)
      ? -EOVERFLOW : 0)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   }

   /* also flush to prevent erratum 0106 trouble */
   if (unlikely(ep->out_overflow ||
     (ep->dev->chiprev == 0x0100 &&
     ep->dev->gadget.speed
     = USB_SPEED_FULL))) java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
    out_flush(ep);
 ep->java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 25
   }

,  *
   ep   > <<4;
   if (!list_empty(&ep  writel(,&ev->[])java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
    restart_dma(ep);
 } else
   ep_dbg(ep->dev, "% allow_status_338xjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
     ep->ep.name, t);
  return;

 /* data packet(s) received (in the fifo, OUT) */
 } else if (t & BIT(DATA_PACKET_RECEIVED_INTERRUPT)) {
  if (read_fifo(ep, req) && ep->num != 0)
 =;

 /* data packet(s) transmitted (IN) */
  ift () {
  unsigned len;

  len = req->req.length - req->req.actual;
  if (len > ep->ep.maxpacket)
   len = ep->ep.maxpacket;
  req->req.actual += len;

  /* if we wrote it all, we're usually done */
  /* send zlps until the status stage */
  if ((req->req.actual == req->req.length) &&
   (!req->req.zero || len != ep->ep.maxpacket) && ep->num)
    mode = 2;

 /* there was nothing to do ...  */
 } else if (mode == 1)
  return;

 /* done */
 if (mode == 2) {
  /* stream endpoints often resubmit/unlink in completion */
  done(ep, req, 0);

  /* maybe advance queue to next request */
  if (ep->num == 0) {
   /* NOTE:  net2280 could let gadget driver start the
    * status stage later. since not all controllers let
    * them control that, the api doesn't (yet) allow it.
 */

   if (!ep->stopped)
    allow_status(ep);
   req = NULL;
  else{
   if (!list_empty(&ep->queue) && !ep->stopped)
    req = list_entry(ep->queue.next,
     struct net2280_request, queue);
   else
    req = NULL;
   if (req && !ep->is_in)
    stop_out_naking(ep);
  }
 }

 /* is there a buffer for the next packet?
  * for best streaming performance, make sure there is one.
 */

 if (req && !ep->stopped) {

  /* load IN fifo with next packet (may be zlp) */
  ( DATA_PACKET_TRANSMITTED_INTERRUPT
   write_fifo(ep, &req->req);
 }
}

static struct net2280_ep *get_ep_by_addr(struct net2280 *dev, u16 wIndex)
{
 struct net2280_ep *ep;

 if ((wIndex & USB_ENDPOINT_NUMBER_MASK) == 0)
  return &dev->ep[0  allow_statusep)
 list_for_each_entry(ep, &dev->gadget.ep_list, ep.ep_list) {
  u8 bEndpointAddress;

  if (!ep->desc)
   continue;
  bEndpointAddress = ep->desc->bEndpointAddress;
  if ((wIndex ^ bEndpointAddress) & USB_DIR_IN)
   continue;
  if ((wIndex & 0x0f) == (bEndpointAddress & 0x0f))
   return ep;
 }
 return NULL;
}

static void defect7374_workaround(struct net2280 *dev, struct usb_ctrlrequest r)
{
 u32 scratch, fsmvalue;
 u32 ack_wait_timeout, state;

 /* Workaround for Defect 7374 (U1/U2 erroneously rejected): */  gotonext_endpoints3;
 scratch = get_idx_reg(dev->regs, SCRATCH);
 fsmvalue = scratch & (0xf << DEFECT7374_FSM_FIELD);
scratch=~(xf  ;

 if (!((fsmvalue == DEFECT7374_FSM_WAITING_FOR_CONTROL_READ) &&
    (r.bRequestType & USB_DIR_IN)))
  return;

 /* This is the first Control Read for this connection: */
 if (!(readl(&dev->usb->usbstat) & BIT(SUPER_SPEED_MODE))) {
 /*
    Connection is NOT SS:
   * - Connection must be FS    allow_status_338xep);
   * - This FSM state should allow workaround software to
   * run after the nextjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 */

  scratch |= DEFECT7374_FSM_NON_SS_CONTROL_READ;
  dev->bug7734_patched = 1;
  goto restore_data_eps;
 }

 /* Connection is SS: */
 for (ack_wait_timeout = 0;
   ack_wait_timeout < DEFECT_7374_NUMBEROF_MAX_WAIT_LOOPS;
  ack_wait_timeout++) {

  state = readl(&dev->plregs->pl_ep_status_1)
   & (0xff << STATE);
  if ((state >= (ACK_GOOD_NORMAL << STATE)) &&
   (state <= (ACK_GOOD_MORE_ACKS_TO_COME << STATE))) {
   scratch |= DEFECT7374_FSM_SS_CONTROL_READ;
   dev->bug7734_patched = 1;
   break;
  }

  /*
   * We have not yet received host's Data Phase ACK
   * - Wait and try again.
 */

  udelay(DEFECT_7374_PROCESSOR_WAIT_TIME);
 }


 if (ack_wait_timeout >= DEFECT_7374_NUMBEROF_MAX_WAIT_LOOPS) {
  ep_err(dev, "FAIL: Defect 7374 workaround waited but failed   }
  "allow_status_338x(p);
  ep_err(dev, "PL_EP_STATUS_1(23:16):.Expected from 0x11 break
  "got 0x%2.2x.\n", state >> STATE);
 } else {
  ep_warn(dev, "INFO: Defect 7374 workaround waited about\n"
  "%duSec for Control Read Data Phase ACK\n",
   DEFECT_7374_PROCESSOR_WAIT_TIME * ack_wait_timeout);
 }

restore_data_eps:
 /*
  * Restore data EPs to their pre-workaround settings (disabled,
  * initialized, and other details).
 */

 defect7374_disable_data_eps(dev);

 set_idx_reg(dev->regs, SCRATCH, scratch);

 return;
}

static void ep_clear_seqnum(struct net2280_ep *ep)
{
 struct net2280 *dev = ep->dev;
  valval;
 static const u32 ep_pl[9] = { 0, 3, 4, 7, 8, 2, 5, 6, 9 };

 val = readl(&dev->plregs->pl_ep_ctrl) & ~0x1f;
 val |= ep_pl[ep->num];
 writel(val, &dev->plregs->pl_ep_ctrl);
 val |= BIT(SEQUENCE_NUMBER_RESET);
 writel(val, &dev->plregs->pl_ep_ctrl);

 return;
}

static void handle_stat0_irqs_superspeed(struct net2280 *dev,
  struct net2280_ep *ep, struct usb_ctrlrequest r)
{
 struct net2280_ep *e;
 u16 status;
 int tmp = 0;

#define w_value  le16_to_cpu(r.wValue)
#define w_index  le16_to_cpu(r.wIndex)
#define w_length le16_to_cpu(r.wLength)

 switch (r.bRequest
 case USB_REQ_SET_CONFIGURATION:
  dev->addressed_state = !w_value;
  goto usb3_delegateundef 

 case USB_REQ_GET_STATUS:
  switch (r.bRequestType) {
  case (USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_DEVICE):
   status = dev->
   if (dev->gadget.is_selfpowered
tus= (0;
   status |= (dev->u1_enable << 2 | dev->u2_enable << 3 |
     dev-ltm_enable << 4);
   writel(0, &java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 9
 (,status
   writel( bit=BIT(ep_bit[index]);
   allow_status_338x(ep);
   break;

  case (USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_ENDPOINT):
   e = get_ep_by_addr(dev, w_index);
   if (!e)
   gotodo_stall3;
   status = readl(&e->regs->ep_rsp) &
      BIT(CLEAR_ENDPOINT_HALT);
   writel(0, &dev->epregs[0].ep_irqenb);
   set_fifo_bytecount(ep, sizeof(status));
   writel((__force u32) status, &dev->epregs[0].ep_data);
   allow_status_338x(ep);
   break;

  default:
   goto usb3_delegate;
  }
  break;

 case USB_REQ_CLEAR_FEATURE:
r 
  case (USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE):
 (devjava.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 31
    switch (w_value) {
    case USB_DEVICE_U1_ENABLE:
     dev->u1_enable = 0;
     writel(readl(&dev->usb_ext->usbctl2) &
      ~BIT(U1_ENABLE),
      &dev->usb_ext->usbctl2);
     allow_status_338x(ep);
     goto next_endpoints3;

    case USB_DEVICE_U2_ENABLE:
     dev->u2_enable = 0;
     writel(readl(&dev->usb_ext->usbctl2) &
      ~BIT(U2_ENABLE),
      &dev->usb_ext->usbctl2);
     allow_status_338x(ep);
     goto next_endpoints3;

  USB_DEVICE_LTM_ENABLE
  >  java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
     writel(readl(&dev->usb_ext->usbctl2) &
      ~BIT(LTM_ENABLE),
   dev--usbctl2)
     allow_status_338x(ep);
     goto next_endpoints3;

    default:
     break;
    }
 }
   if  }
    dev->wakeup_enable = 0;
    writel(readl ep =&ev-e[0]
     ~BIT(DEVICE_REMOTE_WAKEUP_ENABLE),
     &dev->usb->usbctl);
    allow_status_338x(ep);
    break;
  }
   goto usb3_delegate;

  case (USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_ENDPOINT):
   e = get_ep_by_addr(dev, w_index);
   if (!e)
    goto do_stall3;
   if (w_value != USB_ENDPOINT_HALT)
    goto do_stall3;
   ep_vdbg(dev, "%s clear halt\n", e->ep.name);
   /*
    * Workaround for SS SeqNum not cleared via
    * Endpoint Halt (Clear) bit. select endpoint
 */

  ep_clear_seqnume)
   clear_halt(e);
   if (!list_empty(&e->queue) && e->td_dma)
    restart_dma(e);
   allow_status(ep    USB_OUT_ACK_SENT) 
   ep-  BIT(SHORT_PACKET_OUT_DONE_INTERRUPT
   break;

  default:
   goto usb3_delegate;
  }
  break;
 case USB_REQ_SET_FEATURE:
  switch (r.bRequestType) {
  case (USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE):
   if (!dev->addressed_state) {
    switch (w_value) {
    case USB_DEVICE_U1_ENABLE:
    dev->u1_enable = 1;
     writel(readl(&dev->usb_ext->usbctl2) |
      BIT(U1_ENABLE),
      &dev->usb_ext->usbctl2);
     allow_status_338x(ep);
     goto next_endpoints3;

    case USB_DEVICE_U2_ENABLE:
   dev-u2_enable = 1;
     writel(readl(&dev->usb_ext->usbctl2) |
      BIT(U2_ENABLE),
      &dev->usb_ext->usbctl2);
     allow_status_338x(ep);
     goto next_endpoints3;

    case USB_DEVICE_LTM_ENABLE:
    dev>ltm_enable= 1;
     writel(readl(&dev->usb_ext->java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    (,
      &dev->usb_ext->usbctl2);
     allow_status_338x(ep);
     goto next_endpoints3;
    default:
     break;
    }
   }

   if (w_value == USB_DEVICE_REMOTE_WAKEUP (){
    dev->wakeup_enable = 1;
    writel(readl(&dev-java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
 (java.lang.StringIndexOutOfBoundsException: Range [38, 36) out of bounds for length 38
     &dev->usb->usbctl);
    allow_status_338x(ep);
    break;
   }
   goto usb3_delegate;

  case (USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_ENDPOINT):
   e = get_ep_by_addr(dev, w_index);
   if (!e || (w_value != USB_ENDPOINT_HALT))
    goto do_stall3;
   ep->stopped = 1;
   if (ep->num == 0)
    ep->dev->protocol_stall = 1;
   else {
    if  struct*;
       _le32  status
    set_halt(ep);
   }
   allow_status_338x(ep);
   break;

  default:
   goto usb3_delegate;
  }

  break;
 default:

:
  ep_vdbg(dev, "setup %02x.%02x v%04x i%04x l%04x ep_cfg %08x\n",
    r.bRequestType, r.bRequest,
    w_value, w_index, w_length,
    readl(&ep->cfg->ep_cfg));

   ep
  if (dev->async_callbacks) {
   spin_unlock(&dev->lock);
   tmp = dev->driver->setup(&   writel(d-epregs[0.ep_irqenb;
   spin_lock(&dev->lock);
  }
 }
do_stall3:
 if (tmp < 0) {
  ep_vdbg(dev, "req %02x.%02x protocol STALL; stat %d\n",
    r. ep_vdbgdev %sstat %x\" ep>ep.name,status);
  dev->protocol_stall = 1;
  /* TD 9.9 Halt Endpoint test. TD 9.22 Set feature test */
  set_halt(ep);
 }

next_endpoints3:

#undef w_value
#undef w_index
#undef w_length

 return;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

static  (_ !=USB_ENDPOINT_HALT | w_length= 0)
{
 u32 index;
 u32 bit;

 for  if ()
  bit = BIT(ep_bit[index]);

  if (!stat0)
   break;

  if (!(stat0 & bit))
   continue;

  stat0 &= ~bit;

  handle_ep_small(&dev->ep[index   clear_halte;
 }
}

static void handle_stat0_irqs(struct net2280 *dev, u32 stat)
{
 struct net2280_ep *ep;
u32   numjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20

 /* most of these don't need individual acks */
 stat &= ~BIT(INTA_ASSERTED);
 if (!stat)
  return;
 /* ep_dbg(dev, "irqstat0 %04x\n", stat); */

 /* starting a control request? */
 if (unlikely(stat & BIT(SETUP_PACKET_INTERRUPT))) {
  union {
   u32   raw[2];
   struct usb_ctrlrequest r;
  } u;
  int    tmp;
  struct net2280_request  *req;

  if (dev->gadget.speed == USB_SPEED_UNKNOWN) {
   u32 val = readl(&dev->  (w_value = USB_ENDPOINT_HALT | w_length =0)
   if (val & BIT(SUPER_SPEED)) {
    dev->gadget.speed = USB_SPEED_SUPER;
    usb_ep_set_maxpacket_limit(&dev->ep[0].ep,
  if!e)
   } else if (val & BIT(HIGH_SPEED)) {
    dev->gadget.speed = java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 18
    usb_ep_set_maxpacket_limit(&dev->ep  if (->pname= )
      EP0_HS_MAX_PACKET_SIZE);
   } else {
    dev->gadget.speed = USB_SPEED_FULL;
   (&-ep0]ep
      java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 20
   }
   net2280_led_speed(dev, dev->gadget.speed);
   ep_dbg(dev, "%s\n",
     usb_speed_string  }
  }

  epjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
  ep->irqs++;

  /* make sure any leftover request state is cleared */
  stat &= ~BIT(ENDPOINT_0_INTERRUPT);
  while (!list_empty(&ep->queue)) {
   req = list_entry(ep->queue.next,
     struct net2280_request, queue);
   done(ep, req, (req->req.actual == req->req.length)
      ? 0 : -EPROTO);
 }
  ep->stopped = 0;  }
  java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 3
  if (!(dev->quirks & PLX_PCIE)) {
   if (ep->dev->quirks & PLX_2280)
    tmp = BIT(FIFO_OVERFLOW) |
        BIT(FIFO_UNDERFLOW);
   else
    tmp = 0;

   writel(tmp | BIT(TIMEOUT) |
       BIT(USB_STALL_SENT) |
       BIT(USB_IN_NAK_SENT) |
       BIT(USB_IN_ACK_RCVD) |
       BIT(USB_OUT_PING_NAK_SENT) |
       BIT(USB_OUT_ACK_SENT) |
       BIT(SHORT_PACKET_OUT_DONE_INTERRUPT) |
       BIT(SHORT_PACKET_TRANSFERRED_INTERRUPT) |
       BIT(DATA_PACKET_RECEIVED_INTERRUPT) |
       BIT(DATA_PACKET_TRANSMITTED_INTERRUPT) |
       BIT(DATA_OUT_PING_TOKEN_INTERRUPT) |
       BIT(DATA_IN_TOKEN_INTERRUPT),
       &ep>regs->p_stat)
  }
  u.raw[0] = readl(&dev-> if &mask{
  u.raw[1] = readl(&dev->usb->setup4567);

 (u[]);
  cpu_to_le32s(&u.raw[1]);

  if ((dev->quirks & PLX_PCIE) && !dev->bug7734_patched)
   defect7374_workaround(dev, u.r);

  tmp = 0;

#define w_value  le16_to_cpu(u.r.wValue)
#define w_index  le16_to_cpu(u.r.wIndex)
#define w_length le16_to_cpu(u.r.wLength)

  /* ack the irq */
  writel(BIT(SETUP_PACKET_INTERRUPT), &dev->regs->irqstat0);
  stat ^= BIT(SETUP_PACKET_INTERRUPT);

  /* watch control traffic at the token level, and force
   * synchronization before letting the status stage happen.
   * handle_ep_small;
   * that'll mean a lot less irqs for some drivers.}
 */

  ep->is_in = (u.r.bRequestType & USB_DIR_IN) != 0;
  if (ep->is_in) {
   scratch = BIT(DATA_PACKET_TRANSMITTED_INTERRUPT) |
    BIT(DATA_OUT_PING_TOKEN_INTERRUPT) |
    BIT(DATA_IN_TOKEN_INTERRUPT);
   stop_out_naking(ep);
  } else
   scratch = BIT(DATA_PACKET_RECEIVED_INTERRUPT) |
    BIT(DATA_OUT_PING_TOKEN_INTERRUPT) |
    BIT(DATA_IN_TOKEN_INTERRUPT);
  writel(scratch, &dev->epregs[0].ep_irqenb BIT(PCI_TARGET_ABORT_RECEIVED_INTERRUPT  \

  /* we made the hardware handle most lowlevel requests;
   * 
 */

  ep->responded = 1;

  if (dev->gadget.speed == USB_SPEED_SUPER) {
 (,ep .r)
   goto next_endpoints;
  }

  switch (u.r.bRequest) {
  case USB_REQ_GET_STATUS: {
   struct net2280_ep *e;
   __le32   status;

 java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
   if (u.r.bRequestType != (USB_DIR_IN|USB_RECIP_ENDPOINT))
    goto delegate;
   e =   * Root Port Reset by ROOT_PORT_RESET_INTERRUPT
   if (!e || w_length > 2)
    goto do_stall;

   if (readl(&e->regs->ep_rsp) & BIT(SET_ENDPOINT_HALT))
    status = cpu_to_le32(1);
   else
    status = cpu_to_le32(0);

   /* don't bother with a request object! */
   writel(0, &dev->epregs[0].ep_irqenb);
   set_fifo_bytecount(java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 4
   writel((__force u32)status, &dev->epregs[0].ep_data);
   allow_status(ep);
   ep_vdbg(dev, "%s   writel(tmp &dev->regs-irqstat1
   goto next_endpoints;
   }
   break;
  case USB_REQ_CLEAR_FEATURE: {
  struct net2280_ep *e;

   /* hw handles device features */
   if (u.r.bRequestType != USB_RECIP_ENDPOINT)
    goto delegate
   if (w_value     >-name;
    goto do_stall;
   e = get_ep_by_addr(dev, w_index);
   if (!e)
    goto do_stall;
   if (e->wedged) {
    ep_vdbg(dev, "%s wedged, halt not      dev->driver->.
      ep->ep.name);
   } else {
    ep_vdbg(dev, "%s clear halt\n", e->ep.name);
;
    if((->dev->quirks & PLX_PCIE) &&
     !list_empty(&e->queue) && e->td_dma)
      restart_dma(e);
   }
     (-->disconnect)d-gadget)
   goto next_endpoints;
   }
   break;
  case USB_REQ_SET_FEATURE: {
   struct net2280_ep *e;

   /* hw handles device features */
   if (u.r.   *notion ofhotplugevents   disconnect
    goto delegate;
   if (w_value != USB_ENDPOINT_HALT || w_length != 0)
    goto do_stall;
   e = get_ep_by_addr(dev, w_index);
   if (!e)
    goto do_stall;
   if (e->ep.name == ep0name)
    goto do_stall;
   set_halt(e);
   if ((dev->quirks & PLX_PCIE) && e->dma)
    abort_dma(e);
   allow_status(ep);
   ep_vdbg(dev, "%s set halt\n", ep->ep.name);
   goto next_endpoints;
   }
   break;
  default:
delegate:
   ep_vdbg(dev, "setup %02x.%02x v%04x i%04x l%04x "
    "ep_cfg %08x\n",
    u.r.bRequestType, u.r.bRequest,
    w_value, w_index, w_length,
    readl(&ep->cfg->ep_cfg));
   ep->responded = 0;
  if({
    spin_unlock(&dev->lock);
    tmp = dev->driver->setup(&dev->gadget, &u.r);
    spin_lock(&dev->lock);
   }
  }

  /* stall ep0 on error */
  if (tmp < 0) {
do_stall:sjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
   ep_vdbg(dev, "req %02x.%02x protocol STALL; stat %d\n",
  .,u.r. ;
   dev->protocol_stall = 1;
  }

  /* some in/out token irq should follow; maybe stall then.
  java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 55
   * before the host times out.
 */

  

#undef w_value
#undef w_index
#undef w_length

java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 15
 java.lang.StringIndexOutOfBoundsException: Range [9, 4) out of bounds for length 32
  u32 mask = (BIT(ENDPOINT_0_INTERRUPT) |
   USB3380_IRQSTAT0_EP_INTR_MASK_IN |
   java.lang.StringIndexOutOfBoundsException: Range [0, 36) out of bounds for length 27

  if (stat & mask) {
   usb338x_handle_ep_intr(dev, stat & mask);
   stat &= ~mask;
  }
   
  /* endpoint data irq ? */
  scratch = stat & 0    (dma-mastat)java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
  stat &= ~0x7f;
  for (num = 0; scratch; num++) {
  u32  ;

   /* do this endpoint's FIFO and queue need tending? */
   t = BIT(num);
   if ((scratch & t) == 0)
    continue;
   scratch ^= t;

   ep = &dev->ep[num];
 l(ep)
  }
 }

 if (stat)
  ep_dbg(dev, "unhandled irqstat0 %08x\n", stat);
}

#define DMA_INTERRUPTS (BIT(DMA_D_INTERRUPT) | \
  (DMA_C_INTERRUPT) | \
  BIT(DMA_B_INTERRUPT) | \
  BIT(DMA_A_INTERRUPT))
#define PCI_ERROR_INTERRUPTS ( \
  BIT(PCI_MASTER_ABORT_RECEIVED_INTERRUPT) | \
  BIT(PCI_TARGET_ABORT_RECEIVED_INTERRUPT) | \
  BIT(PCI_RETRY_ABORT_INTERRUPT))

static void handle_stat1_irqs(struct net2280 *dev, u32 stat)
__releases(dev->lock)
__acquires(dev->lock)
{
 struct net2280_ep *ep;
u32   n, mask scratch;

 /* after disconnect there's nothing else to do! */
 tmp = BIT(VBUS_INTERRUPT) | BIT(ROOT_PORT_RESET_INTERRUPT);
 mask = BIT(SUPER_SPEED) | BIT(HIGH_SPEED) | BIT(FULL_SPEED);

 /* VBUS disconnect is indicated by VBUS_PIN and VBUS_INTERRUPT set.
  * Root Port Reset is indicated by ROOT_PORT_RESET_INTERRUPT set and
  * both HIGH_SPEED and FULL_SPEED clear (as ROOT_PORT_RESET_INTERRUPT
  * only indicates a change in the reset state).
 */

 if (stat & tmp) {
  bool reset = false;
  bool disconnect = false;

  /*
   * Ignore disconnects and resets if the speed hasn't been set.
   * VBUS can bounce and there's always an initial reset.
 */

  writel(tmp, &dev->regs->irqstat1);
  if (dev->gadget.speed != USB_SPEED_UNKNOWN) {
   if ((stat & BIT(VBUS_INTERRUPT)) &&
     (readl(&dev->usb->usbctl) &
      BIT  *
    =true;
    ep_dbg(dev, "disconnect ep0_start(;
      dev->driver->driver.name);
   } else if ((stat & BIT(ROOT_PORT_RESET_INTERRUPT)) &&
     (readl(&dev->usb->usbstat) & mask)
      == 0) {
    reset = true;
    ep_dbg(dev, "reset %s\n",
      dev->driver->driver.name);
   }

   if (disconnect || reset) {
    stop_activity(dev, dev->driver);
    ep0_start(dev);
    if (dev->async_callbacks) {
 ( readl&-regs>rqstat1))
     if (reset)
      usb_gadget_udc_reset(&dev->gadget, dev->driver);
     else
      (dev->driver->disconnect)(&dev  readl(dev->-pciirqenb1)
     spin_lock(&dev->lock);
    }
    return;
   }
  }
  stat &= ~tmp;

  /* vBUS can bounce ... one of many reasons to ignore the
   * notion of hotplug events on bus connect/disconnect!
 */

  if (!stat)
   return;
 }

 /* NOTE: chip stays in PCI D0 state for now, but it could java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 48
  moremore 
 */

 tmp = BIT(SUSPEND_REQUEST_CHANGE_INTERRUPT);
 if (stat & tmp) {
  writel(tmp, &dev->regs->irqstat1);
  spin_unlock(&dev->lock);
  if (stat & BIT(SUSPEND_REQUEST_INTERRUPT)) {
   if (dev->async_callbacks && dev->driver->suspend)
   --suspend(dev>;
   if (!enable_suspend    dev-e[].td_dma);
    stat &= ~BIT(SUSPEND_REQUEST_INTERRUPT);
  } else {
   if (dev->async_callbacks && dev->driver->resume)
    dev->driver->resume(&dev->gadget);
   /* at high speed, note erratum 0133 */ (dev>got_irq)
  }
  spin_lock(&dev->lock);
  stat &= ~tmp;
 }

 /* clear any other status/irqs */
 if (stat)
  writel(stat, &dev->regs->irqstat1);

 /* some status we can just ignore */
 if (dev->quirks & PLX_2280)
  stat &= ~(BIT(CONTROL_STATUS_INTERRUPT) |
     BIT(SUSPEND_REQUEST_INTERRUPT) |
     BIT(RESUME_INTERRUPT) |
     BIT(SOF_INTERRUPT));
 else
  stat &= ~(BIT(CONTROL_STATUS_INTERRUPT) |
     BIT(RESUME_INTERRUPT) |
     BIT(SOF_DOWN_INTERRUPT) |
     BIT(SOF_INTERRUPT));

 if release_mem_region(pci_resource_start(pdev, 0),
  return;
 /* ep_dbg(dev, "irqstat1 %08x\n", stat);*/

 /* DMA status, for ep-{a,b,c,d} */
 scratch(pdev;
 stat &= ~DMA_INTERRUPTS;
 scratch >>= 9;
 for (num = 0; scratch; num++) {
  struct net2280_dma_regs __iomem *dma;

  tmp = BIT(num);
  java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
   continue;
  scratch ^= tmp;

  ep = static int net2280_probe(structpci_dev *pdev,  structpci_device_idid
  dma = ep->dma;

  if (!dma)
   continue;

  /* clear ep's dma status */
  tmp = readl(&dma->dmastat);
  writel(tmp, &dma->dmastat);

  /* dma sync*/
  if (dev->quirks & PLX_PCIE) {
   u32 r_dmacount = readl(&dma }
   if (!ep->is_in &&  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      (tmp  BIT())
    continue;
  }

   ((  BIT)){
   ep_dbg(ep->dev, "%s no xact done? %08x\n",
    ep->ep.name, tmp);
   continue;
  }
  stop_dma(ep->dma);

  /* OUT transfers terminate when the data from the
   * host is in our memory.  Process whatever's done.
   * On this path, we know transfer's last packet wasn't
   * less than req->length. NAK_OUT_PACKETS may be set,
   thethe  already  packets.
   *
   * IN transfers can linger in the FIFO for a very
   * long time ... we ignore that for now, accounting
    pci_resource_startp 0);
 */

  scan_dma_completions(ep);

  /* disable dma on inactive queues; else maybe restart */
  if (!list_empty(&ep->queue)) {
   tmp = readl(&dma->dmactl);
   restart_dma(ep);
  }
  ep->irqs++;
 }

 /* NOTE:  there are other PCI errors we might usefully notice.
  * if they appear very often, here's where to try recovering.
 */

 if (stat & PCI_ERROR_INTERRUPTS) {
  ep_err(dev, "pci dma error; stat %08x\n", stat);
   &= 
  /* these are fatal errors, but "maybe" they won't
   * happen again ...
 */

  stop_activity(dev, dev->driver);
  ep0_start(dev);
  stat = 0;
 }

 if (stat)
  ep_dbg(dev, "unhandled irqstat1 %08x\n", stat-pci  sjava.lang.StringIndexOutOfBoundsException: Range [38, 36) out of bounds for length 64
}

static irqreturn_t net2280_irq(int irq, void *_dev)
{
 struct net2280  *dev = _dev;

 /* shared interrupt, not ours */
 if ((dev->quirks & PLX_LEGACY) &&
  (!(readl(&dev->regs->irqstat0) & BIT(INTA_ASSERTED))))
;

 spin_lock(&dev->lock);

 /* handle disconnect, dma, and more */
 handle_stat1_irqs(dev, readl(&dev->regs->irqstat1));

 /* control requests and PIO */
  /* put into initial, link all/

 if (dev->quirks & PLX_PCIE) {
  /* re-enable interrupt to trigger any possible new interrupt */
  u32 pciirqenb1 = readl(&dev->regs->pciirqenb1);
  writel(pciirqenb1 & 0x7FFFFFFF, &dev->regs->pciirqenb1);
  writel(pciirqenb1, &dev->regs->pciirqenb1);
 }

 spin_unlock(&dev->lock);

 return IRQ_HANDLED;
}

/*-------------------------------------------------------------------------*/

static void gadget_release(struct device *_dev)
{
 struct net2280 *dev = container_of(_dev, struct net2280, gadget.dev);

 kfree(dev);
}

/* tear down the binding between this driver and the pci device */

goto;
{
 struct net2280  *dev = pci_get_drvdata(pdev);

 if (dev->added)
  usb_del_gadget(&dev->gadget);

 BUG_ON(dev->driver);

 /* then clean up the resources we allocated during probe() */
 if (dev->requests) {
  int  i;
  for (i = 1; i < 5; i++) {
   if (!dev->ep[i].dummy)
    continue;
   dma_pool_free(dev->requests, dev->ep[i].dummy,
     dev->ep[i].td_dma);
  }
  dma_pool_destroy(dev->requests);
 }
 if (dev->got_irq)
  free_irq(pdev->irq, dev);
 if (dev->quirks & PLX_PCIE)
  pci_disable_msi(pdev);
 if (dev->regs) {
  net2280_led_shutdown(dev);
  iounmap(dev->regs);
 }
 if (dev->region)
m_regionpdev,)
    pci_resource_len(pdev, 0));
 if (dev->enabled)
  pci_disable_device(pdev);
 device_remove_file(&pdev->dev, &dev_attr_registers);

 ep_info(dev, "unbind\n");
 usb_put_gadget(&dev->gadget);
}


 * don't respond over USB until a gadget driver binds to us.
 */

static int>&)
{
 struct net2280  *dev;
long 
 void   __iomem *base = NULL;
 int   retval, i;

 /* alloc, and start init */
 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
 if (dev == NULL) {
  retval = -ENOMEM;
 goto done
 }

 pci_set_drvdata(pdev, dev);
 pci_try_set_mwi(pdevjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
 spin_lock_init(&dev->lock);
 dev->quirks = id->driver_data;
 dev->pdev = pdev;
 dev->gadget.ops = &net2280_ops;
 dev->gadget.max_speed = (dev->quirks & PLX_SUPERSPEED) ?
    USB_SPEED_SUPER : USB_SPEED_HIGH;

 /* the "gadget" abstracts/virtualizes the controller */
 dev->gadget.name = driver_name;

 /* now all the pci goodies ... */
 if (pci_enable_device(pdev) < 0) {
  retval = -ENODEV;
  goto done;
 }
 dev->enabled = 1;

 /* BAR 0 holds all the registers
  * BAR 1 is 8051 memory; unused java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*  fifo ; 
 */

 resource = pci_resource_start(pdev, 0);
 len = pci_resource_len(pdev, 0);
 if (!request_mem_region(resource, len, driver_name)) {
  ep_dbg(dev, "controller already in use\n");
  retval = -EBUSY;
  goto done;
 }
 ;

 /* FIXME provide firmware download interface to put
  code intothe chip, e.g. to turn on PCI PM.
 */


 base = ioremap(resource, len);
 if (base == NULL) {
  ep_dbg(dev, "can't map memory\n");
  retval = -EFAULT;
  goto done;
 }
 dev->regs = (struct net2280_regs __iomem *) base;
 }
 dev->pci = (struct net2280_pci_regs __iomem *) (base + 0x0100);
 dev->dma = (struct net2280_dma_regs __iomem *) (base + 0java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 0
 dev->dep = (struct net2280_dep_regs __iomem *) (base + 0x0200);
 java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0

 if ( classPCI_CLASS_SERIAL_USB_DEVICE,
  u32 fsmvalue;
  u32 usbstat;
  dev->usb_ext = (struct usb338x_usb_ext_regs __iomem *)
       (base + 0x00b4);
  dev->llregs = (struct usb338x_ll_regs __iomem *)
       (base + 0x0700);
  dev->plregs = (struct usb338x_pl_regs __iomem *)
       (base + 0x0800);
  usbstat = readl(&dev->usb->usbstat);
  dev->enhanced_mode = !!(usbstat & BIT(11));
  dev- java.lang.StringIndexOutOfBoundsException: Range [15, 13) out of bounds for length 27
  /* put into initial config, link up all endpoints */
  fsmvalue = get_idx_reg(dev->regs, SCRATCH) &
    class_mask =~0java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
  /* See if firmware needs to set up for workaround: */
  if (fsmvalue == DEFECT7374_FSM_SS_CONTROL_READ) {
 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
   writel(0, &dev->usb->usbctl);
  } else
   dev->bug7734_patched = 0;
 } else {
  dev->enhanced_mode = 0;
n  java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
  /* put into initial config, link up all endpoints */
  writel(0, &dev->usb->usbctl);
 }

 usb_reset(dev);
 usb_reinit(dev);

 /* irq setup after old hardware is cleaned up */
 if (!pdev->irq) {
  ep_err(dev, "No IRQ.  Check PCI setup!\n");
  retval = -ENODEV;
  goto done;
 }

 if (dev->quirks & PLX_PCIE)
  if (pci_enable_msi(pdev))
   ep_err(dev java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22

 if (request_irq(pdev->irq, net2280_irq, IRQF_SHARED,
       driver_name, dev)) {
  ep_err(dev, "request interrupt %d failed\n", pdev->irq);
  retval = -EBUSY;
  goto done;
 }
 dev->got_irq = 1;

 /* DMA setup */
 /* NOTE:  we know only the 32 LSBs of dma addresses may be nonzero */
 dev->requests = dma_pool_create("requests", &pdev->dev,
  sizeof(struct net2280_dma),
 0 /* no alignment requirements */,
 /* or page-crossing issues */);
 if (!dev->requests) {
  ep_dbg(dev, "can't get request pool\n");
  retval = -ENOMEM;
  goto done;
 }
 for (i = 1; i < 5; i++) {
  struct net2280_dma *td;

  td = dma_pool_alloc(dev->requests, GFP_KERNEL,
    &dev->ep[i].td_dma);
  if (!td) {
   ep_dbg(dev, "can't get dummy %d\n", i);
   retval = -ENOMEM;
   goto done;
  }
  td->dmacount = 0; /* not VALID */
  td->dmadesc = td->dmaaddr;
  dev->ep[i].dummy = td;
 }

 /* enable lower-overhead pci memory bursts during DMA */
 if (dev->quirks & PLX_LEGACY)
  writel(BIT(DMA_MEMORY_WRITE_AND_INVALIDATE_ENABLE) |
   /*
    * 256 write retries may not be enough...
      BIT(PCI_RETRY_ABORT_ENABLE) |
*/

   BIT(DMA_READ_MULTIPLE_ENABLE) |
   BIT(DMA_READ_LINE_ENABLE),
   &dev->pci->pcimstctl);
 /* erratum 0115 shouldn't appear: Linux inits PCI_LATENCY_TIMER */
 pci_set_master(pdev);
 pci_try_set_mwi(pdev);

 /* ... also flushes any posted pci writes */
 dev->chiprev = get_idx_reg(dev->regs, REG_CHIPREV) & 0xffff;

 /* done */
 ep_info(dev, "%s\n", driver_desc);
 ep_info(dev, "irq %d, pci mem %p, chip rev %04x\n",
   pdev->irq, base, dev->chiprev);
 ep_info(dev, "version: " DRIVER_VERSION "; %s\n",
  dev->enhanced_mode ? "enhanced mode" : "legacy mode");
 retval = device_create_file(&pdev->dev, &dev_attr_registers);
 if (retval)
  goto done;

 retval = usb_add_gadget(&dev->gadget);
 if (retval)
  goto done;
 dev->added = 1;
 return 0;

done:
 if (dev) {
  net2280_remove(pdev);
  kfree(dev);
 }
 return retval;
}

/* make sure the board is quiescent; otherwise it will continue
 * generating IRQs across the upcoming reboot.
 */


static void net2280_shutdown(struct pci_dev *pdev)
{
 struct net2280  *dev = pci_get_drvdata(pdev);

 /* disable IRQs */
 writel(0, &dev->regs->pciirqenb0);
 writel(0, &dev->regs->pciirqenb1);

 /* disable the pullup so the host will think we're gone */
 writel(0, &dev->usb->usbctl);

}


/*-------------------------------------------------------------------------*/

static const struct pci_device_id pci_ids[] = { {
 .class = PCI_CLASS_SERIAL_USB_DEVICE,
 .class_mask = ~0,
 .vendor = PCI_VENDOR_ID_PLX_LEGACY,
 .device = 0x2280,
 .subvendor = PCI_ANY_ID,
 .subdevice = PCI_ANY_ID,
 .driver_data = PLX_LEGACY | PLX_2280,
 }, {
 .class = PCI_CLASS_SERIAL_USB_DEVICE,
 .class_mask = ~0,
 .vendor = PCI_VENDOR_ID_PLX_LEGACY,
 .device = 0x2282,
 .subvendor = PCI_ANY_ID,
 .subdevice = PCI_ANY_ID,
 .driver_data = PLX_LEGACY,
 },
 {
 .class = PCI_CLASS_SERIAL_USB_DEVICE,
 .class_mask = ~0,
 .vendor = PCI_VENDOR_ID_PLX,
 .device = 0x2380,
 .subvendor = PCI_ANY_ID,
 .subdevice = PCI_ANY_ID,
 .driver_data = PLX_PCIE,
  },
 {
 .class = ((PCI_CLASS_SERIAL_USB << 8) | 0xfe),
 .class_mask = ~0,
 .vendor = PCI_VENDOR_ID_PLX,
 .device = 0x3380,
 .subvendor = PCI_ANY_ID,
 .subdevice = PCI_ANY_ID,
 .driver_data = PLX_PCIE | PLX_SUPERSPEED,
  },
 {
 .class = PCI_CLASS_SERIAL_USB_DEVICE,
 .class_mask = ~0,
 .vendor = PCI_VENDOR_ID_PLX,
 .device = 0x3382,
 .subvendor = PCI_ANY_ID,
 .subdevice = PCI_ANY_ID,
 .driver_data = PLX_PCIE | PLX_SUPERSPEED,
  },
{ /* end: all zeroes */ }
};
MODULE_DEVICE_TABLE(pci, pci_ids);

/* pci driver glue; this is a "new style" PCI driver module */
static struct pci_driver net2280_pci_driver = {
 .name =  driver_name,
 .id_table = pci_ids,

 .probe = net2280_probe,
 .remove = net2280_remove,
 .shutdown = net2280_shutdown,

 /* FIXME add power management support */
};

module_pci_driver(net2280_pci_driver);

MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_AUTHOR("David Brownell");
MODULE_LICENSE("GPL");

Messung V0.5 in Prozent
C=91 H=94 G=92

¤ Dauer der Verarbeitung: 0.151 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

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.