#include <linux/module.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/ioport.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/timer.h>
#include <linux/list.h>
#include <linux/interrupt.h>
#include <linux/moduleparam.h>
#include <linux/device.h>
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
#include <linux/prefetch.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include <asm/byteorder.h>
#include <asm/irq.h>
#include <asm/unaligned.h>
#define DRIVER_DESC …
#define DRIVER_VERSION …
#define EP_DONTUSE …
#define USE_RDK_LEDS …
static const char driver_name[] = …;
static const char driver_desc[] = …;
static const u32 ep_bit[9] = …;
static const char ep0name[] = …;
#define EP_INFO …
static const struct { … } ep_info_dft[] = …, ep_info_adv[] = …;
#undef EP_INFO
static ushort fifo_mode;
module_param(fifo_mode, ushort, 0644);
static bool enable_suspend;
module_param(enable_suspend, bool, 0444);
#define DIR_STRING(bAddress) …
static char *type_string(u8 bmAttributes)
{ … }
#include "net2280.h"
#define valid_bit …
#define dma_done_ie …
static void ep_clear_seqnum(struct net2280_ep *ep);
static void stop_activity(struct net2280 *dev,
struct usb_gadget_driver *driver);
static void ep0_start(struct net2280 *dev);
static inline void enable_pciirqenb(struct net2280_ep *ep)
{ … }
static int
net2280_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)
{ … }
static int handshake(u32 __iomem *ptr, u32 mask, u32 done, int usec)
{ … }
static const struct usb_ep_ops net2280_ep_ops;
static void ep_reset_228x(struct net2280_regs __iomem *regs,
struct net2280_ep *ep)
{ … }
static void ep_reset_338x(struct net2280_regs __iomem *regs,
struct net2280_ep *ep)
{ … }
static void nuke(struct net2280_ep *);
static int net2280_disable(struct usb_ep *_ep)
{ … }
static struct usb_request
*net2280_alloc_request(struct usb_ep *_ep, gfp_t gfp_flags)
{ … }
static void net2280_free_request(struct usb_ep *_ep, struct usb_request *_req)
{ … }
static void write_fifo(struct net2280_ep *ep, struct usb_request *req)
{ … }
static void out_flush(struct net2280_ep *ep)
{ … }
static int read_fifo(struct net2280_ep *ep, struct net2280_request *req)
{ … }
static void fill_dma_desc(struct net2280_ep *ep,
struct net2280_request *req, int valid)
{ … }
static const u32 dmactl_default = …;
static inline void spin_stop_dma(struct net2280_dma_regs __iomem *dma)
{ … }
static inline void stop_dma(struct net2280_dma_regs __iomem *dma)
{ … }
static void start_queue(struct net2280_ep *ep, u32 dmactl, u32 td_dma)
{ … }
static void start_dma(struct net2280_ep *ep, struct net2280_request *req)
{ … }
static inline void
queue_dma(struct net2280_ep *ep, struct net2280_request *req, int valid)
{ … }
static void
done(struct net2280_ep *ep, struct net2280_request *req, int status)
{ … }
static int
net2280_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
{ … }
static inline void
dma_done(struct net2280_ep *ep, struct net2280_request *req, u32 dmacount,
int status)
{ … }
static int scan_dma_completions(struct net2280_ep *ep)
{ … }
static void restart_dma(struct net2280_ep *ep)
{ … }
static void abort_dma(struct net2280_ep *ep)
{ … }
static void nuke(struct net2280_ep *ep)
{ … }
static int net2280_dequeue(struct usb_ep *_ep, struct usb_request *_req)
{ … }
static int net2280_fifo_status(struct usb_ep *_ep);
static int
net2280_set_halt_and_wedge(struct usb_ep *_ep, int value, int wedged)
{ … }
static int net2280_set_halt(struct usb_ep *_ep, int value)
{ … }
static int net2280_set_wedge(struct usb_ep *_ep)
{ … }
static int net2280_fifo_status(struct usb_ep *_ep)
{ … }
static void net2280_fifo_flush(struct usb_ep *_ep)
{ … }
static const struct usb_ep_ops net2280_ep_ops = …;
static int net2280_get_frame(struct usb_gadget *_gadget)
{ … }
static int net2280_wakeup(struct usb_gadget *_gadget)
{ … }
static int net2280_set_selfpowered(struct usb_gadget *_gadget, int value)
{ … }
static int net2280_pullup(struct usb_gadget *_gadget, int is_on)
{ … }
static struct usb_ep *net2280_match_ep(struct usb_gadget *_gadget,
struct usb_endpoint_descriptor *desc,
struct usb_ss_ep_comp_descriptor *ep_comp)
{ … }
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 = …;
#ifdef CONFIG_USB_GADGET_DEBUG_FILES
static ssize_t function_show(struct device *_dev, struct device_attribute *attr,
char *buf)
{ … }
static DEVICE_ATTR_RO(function);
static ssize_t registers_show(struct device *_dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(registers);
static ssize_t queues_show(struct device *_dev, struct device_attribute *attr,
char *buf)
{ … }
static DEVICE_ATTR_RO(queues);
#else
#define device_create_file …
#define device_remove_file …
#endif
static void set_fifo_mode(struct net2280 *dev, int mode)
{ … }
static void defect7374_disable_data_eps(struct net2280 *dev)
{ … }
static void defect7374_enable_data_eps_zero(struct net2280 *dev)
{ … }
static void usb_reset_228x(struct net2280 *dev)
{ … }
static void usb_reset_338x(struct net2280 *dev)
{ … }
static void usb_reset(struct net2280 *dev)
{ … }
static void usb_reinit_228x(struct net2280 *dev)
{ … }
static void usb_reinit_338x(struct net2280 *dev)
{ … }
static void usb_reinit(struct net2280 *dev)
{ … }
static void ep0_start_228x(struct net2280 *dev)
{ … }
static void ep0_start_338x(struct net2280 *dev)
{ … }
static void ep0_start(struct net2280 *dev)
{ … }
static int net2280_start(struct usb_gadget *_gadget,
struct usb_gadget_driver *driver)
{ … }
static void stop_activity(struct net2280 *dev, 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 void handle_ep_small(struct net2280_ep *ep)
{ … }
static struct net2280_ep *get_ep_by_addr(struct net2280 *dev, u16 wIndex)
{ … }
static void defect7374_workaround(struct net2280 *dev, struct usb_ctrlrequest r)
{ … }
static void ep_clear_seqnum(struct net2280_ep *ep)
{ … }
static void handle_stat0_irqs_superspeed(struct net2280 *dev,
struct net2280_ep *ep, struct usb_ctrlrequest r)
{ … }
static void usb338x_handle_ep_intr(struct net2280 *dev, u32 stat0)
{ … }
static void handle_stat0_irqs(struct net2280 *dev, u32 stat)
{ … }
#define DMA_INTERRUPTS …
#define PCI_ERROR_INTERRUPTS …
static void handle_stat1_irqs(struct net2280 *dev, u32 stat)
__releases(dev->lock)
__acquires(dev->lock)
{ … }
static irqreturn_t net2280_irq(int irq, void *_dev)
{ … }
static void gadget_release(struct device *_dev)
{ … }
static void net2280_remove(struct pci_dev *pdev)
{ … }
static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{ … }
static void net2280_shutdown(struct pci_dev *pdev)
{ … }
static const struct pci_device_id pci_ids[] = …;
MODULE_DEVICE_TABLE(pci, pci_ids);
static struct pci_driver net2280_pci_driver = …;
module_pci_driver(…) …;
MODULE_DESCRIPTION(…);
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;