#include <linux/delay.h>
#include <linux/device.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/ioport.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/pci.h>
#include <linux/platform_device.h>
#include <linux/prefetch.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/timer.h>
#include <linux/usb.h>
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
#include <asm/byteorder.h>
#include <asm/unaligned.h>
#include "net2272.h"
#define DRIVER_DESC …
static const char driver_name[] = …;
static const char driver_vers[] = …;
static const char driver_desc[] = …;
static const char ep0name[] = …;
static const char * const ep_name[] = …;
#ifdef CONFIG_USB_NET2272_DMA
static bool use_dma = …;
module_param(use_dma, bool, 0644);
static ushort dma_ep = …;
module_param(dma_ep, ushort, 0644);
static ushort dma_mode = …;
module_param(dma_mode, ushort, 0644);
#else
#define use_dma …
#define dma_ep …
#define dma_mode …
#endif
static ushort fifo_mode;
module_param(fifo_mode, ushort, 0644);
static ushort enable_suspend;
module_param(enable_suspend, ushort, 0644);
static void assert_out_naking(struct net2272_ep *ep, const char *where)
{ … }
#define ASSERT_OUT_NAKING(ep) …
static void stop_out_naking(struct net2272_ep *ep)
{ … }
#define PIPEDIR(bAddress) …
static char *type_string(u8 bmAttributes)
{ … }
static char *buf_state_string(unsigned state)
{ … }
static char *dma_mode_string(void)
{ … }
static void net2272_dequeue_all(struct net2272_ep *);
static int net2272_kick_dma(struct net2272_ep *, struct net2272_request *);
static int net2272_fifo_status(struct usb_ep *);
static const struct usb_ep_ops net2272_ep_ops;
static int
net2272_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)
{ … }
static void net2272_ep_reset(struct net2272_ep *ep)
{ … }
static int net2272_disable(struct usb_ep *_ep)
{ … }
static struct usb_request *
net2272_alloc_request(struct usb_ep *_ep, gfp_t gfp_flags)
{ … }
static void
net2272_free_request(struct usb_ep *_ep, struct usb_request *_req)
{ … }
static void
net2272_done(struct net2272_ep *ep, struct net2272_request *req, int status)
{ … }
static int
net2272_write_packet(struct net2272_ep *ep, u8 *buf,
struct net2272_request *req, unsigned max)
{ … }
static int
net2272_write_fifo(struct net2272_ep *ep, struct net2272_request *req)
{ … }
static void
net2272_out_flush(struct net2272_ep *ep)
{ … }
static int
net2272_read_packet(struct net2272_ep *ep, u8 *buf,
struct net2272_request *req, unsigned avail)
{ … }
static int
net2272_read_fifo(struct net2272_ep *ep, struct net2272_request *req)
{ … }
static void
net2272_pio_advance(struct net2272_ep *ep)
{ … }
static int
net2272_request_dma(struct net2272 *dev, unsigned ep, u32 buf,
unsigned len, unsigned dir)
{ … }
static void
net2272_start_dma(struct net2272 *dev)
{ … }
static int
net2272_kick_dma(struct net2272_ep *ep, struct net2272_request *req)
{ … }
static void net2272_cancel_dma(struct net2272 *dev)
{ … }
static int
net2272_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
{ … }
static void
net2272_dequeue_all(struct net2272_ep *ep)
{ … }
static int
net2272_dequeue(struct usb_ep *_ep, struct usb_request *_req)
{ … }
static int
net2272_set_halt_and_wedge(struct usb_ep *_ep, int value, int wedged)
{ … }
static int
net2272_set_halt(struct usb_ep *_ep, int value)
{ … }
static int
net2272_set_wedge(struct usb_ep *_ep)
{ … }
static int
net2272_fifo_status(struct usb_ep *_ep)
{ … }
static void
net2272_fifo_flush(struct usb_ep *_ep)
{ … }
static const struct usb_ep_ops net2272_ep_ops = …;
static int
net2272_get_frame(struct usb_gadget *_gadget)
{ … }
static int
net2272_wakeup(struct usb_gadget *_gadget)
{ … }
static int
net2272_set_selfpowered(struct usb_gadget *_gadget, int value)
{ … }
static int
net2272_pullup(struct usb_gadget *_gadget, int is_on)
{ … }
static int net2272_start(struct usb_gadget *_gadget,
struct usb_gadget_driver *driver);
static int net2272_stop(struct usb_gadget *_gadget);
static void net2272_async_callbacks(struct usb_gadget *_gadget, bool enable);
static const struct usb_gadget_ops net2272_ops = …;
static ssize_t
registers_show(struct device *_dev, struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(registers);
static void
net2272_set_fifo_mode(struct net2272 *dev, int mode)
{ … }
static void
net2272_usb_reset(struct net2272 *dev)
{ … }
static void
net2272_usb_reinit(struct net2272 *dev)
{ … }
static void
net2272_ep0_start(struct net2272 *dev)
{ … }
static int net2272_start(struct usb_gadget *_gadget,
struct usb_gadget_driver *driver)
{ … }
static void
stop_activity(struct net2272 *dev, struct usb_gadget_driver *driver)
{ … }
static int net2272_stop(struct usb_gadget *_gadget)
{ … }
static void net2272_async_callbacks(struct usb_gadget *_gadget, bool enable)
{ … }
static void
net2272_handle_dma(struct net2272_ep *ep)
{ … }
static void
net2272_handle_ep(struct net2272_ep *ep)
{ … }
static struct net2272_ep *
net2272_get_ep_by_addr(struct net2272 *dev, u16 wIndex)
{ … }
static const u8 net2272_test_packet[] = …;
static void
net2272_set_test_mode(struct net2272 *dev, int mode)
{ … }
static void
net2272_handle_stat0_irqs(struct net2272 *dev, u8 stat)
{ … }
static void
net2272_handle_stat1_irqs(struct net2272 *dev, u8 stat)
{ … }
static irqreturn_t net2272_irq(int irq, void *_dev)
{ … }
static int net2272_present(struct net2272 *dev)
{ … }
static void
net2272_gadget_release(struct device *_dev)
{ … }
static void
net2272_remove(struct net2272 *dev)
{ … }
static struct net2272 *net2272_probe_init(struct device *dev, unsigned int irq)
{ … }
static int
net2272_probe_fin(struct net2272 *dev, unsigned int irqflags)
{ … }
#ifdef CONFIG_USB_PCI
static int
net2272_rdk1_probe(struct pci_dev *pdev, struct net2272 *dev)
{ … }
static int
net2272_rdk2_probe(struct pci_dev *pdev, struct net2272 *dev)
{ … }
static int
net2272_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{ … }
static void
net2272_rdk1_remove(struct pci_dev *pdev, struct net2272 *dev)
{ … }
static void
net2272_rdk2_remove(struct pci_dev *pdev, struct net2272 *dev)
{ … }
static void
net2272_pci_remove(struct pci_dev *pdev)
{ … }
static struct pci_device_id pci_ids[] = …;
MODULE_DEVICE_TABLE(pci, pci_ids);
static struct pci_driver net2272_pci_driver = …;
static int net2272_pci_register(void)
{ … }
static void net2272_pci_unregister(void)
{ … }
#else
static inline int net2272_pci_register(void) { return 0; }
static inline void net2272_pci_unregister(void) { }
#endif
static int
net2272_plat_probe(struct platform_device *pdev)
{ … }
static void
net2272_plat_remove(struct platform_device *pdev)
{ … }
static struct platform_driver net2272_plat_driver = …;
MODULE_ALIAS(…) …;
static int __init net2272_init(void)
{ … }
module_init(…) …;
static void __exit net2272_cleanup(void)
{ … }
module_exit(net2272_cleanup);
MODULE_DESCRIPTION(…);
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;