linux/drivers/usb/gadget/udc/goku_udc.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Toshiba TC86C001 ("Goku-S") USB Device Controller driver
 *
 * Copyright (C) 2000-2002 Lineo
 *      by Stuart Lynne, Tom Rushworth, and Bruce Balden
 * Copyright (C) 2002 Toshiba Corporation
 * Copyright (C) 2003 MontaVista Software ([email protected])
 */

/*
 * This device has ep0 and three semi-configurable bulk/interrupt endpoints.
 *
 *  - Endpoint numbering is fixed: ep{1,2,3}-bulk
 *  - Gadget drivers can choose ep maxpacket (8/16/32/64)
 *  - Gadget drivers can choose direction (IN, OUT)
 *  - DMA works with ep1 (OUT transfers) and ep2 (IN transfers).
 */

// #define	VERBOSE		/* extra debug messages (success too) */
// #define	USB_TRACE	/* packet-level success messages */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/ioport.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/timer.h>
#include <linux/list.h>
#include <linux/interrupt.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/device.h>
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
#include <linux/prefetch.h>

#include <asm/byteorder.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <linux/unaligned.h>


#include "goku_udc.h"

#define DRIVER_DESC
#define DRIVER_VERSION

static const char driver_name [] =;
static const char driver_desc [] =;

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();


/*
 * IN dma behaves ok under testing, though the IN-dma abort paths don't
 * seem to behave quite as expected.  Used by default.
 *
 * OUT dma documents design problems handling the common "short packet"
 * transfer termination policy; it couldn't be enabled by default, even
 * if the OUT-dma abort problems had a resolution.
 */
static unsigned use_dma =;

#if 0
//#include <linux/moduleparam.h>
/* "modprobe goku_udc use_dma=1" etc
 *	0 to disable dma
 *	1 to use IN dma only (normal operation)
 *	2 to use IN and OUT dma
 */
module_param(use_dma, uint, S_IRUGO);
#endif

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

static void nuke(struct goku_ep *, int status);

static inline void
command(struct goku_udc_regs __iomem *regs, int command, unsigned epnum)
{}

static int
goku_ep_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)
{}

static void ep_reset(struct goku_udc_regs __iomem *regs, struct goku_ep *ep)
{}

static int goku_ep_disable(struct usb_ep *_ep)
{}

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

static struct usb_request *
goku_alloc_request(struct usb_ep *_ep, gfp_t gfp_flags)
{}

static void
goku_free_request(struct usb_ep *_ep, struct usb_request *_req)
{}

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

static void
done(struct goku_ep *ep, struct goku_request *req, int status)
{}

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

static inline int
write_packet(u32 __iomem *fifo, u8 *buf, struct goku_request *req, unsigned max)
{}

// return:  0 = still running, 1 = completed, negative = errno
static int write_fifo(struct goku_ep *ep, struct goku_request *req)
{}

static int read_fifo(struct goku_ep *ep, struct goku_request *req)
{}

static inline void
pio_irq_enable(struct goku_udc *dev,
		struct goku_udc_regs __iomem *regs, int epnum)
{}

static inline void
pio_irq_disable(struct goku_udc *dev,
		struct goku_udc_regs __iomem *regs, int epnum)
{}

static inline void
pio_advance(struct goku_ep *ep)
{}


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

// return:  0 = q running, 1 = q stopped, negative = errno
static int start_dma(struct goku_ep *ep, struct goku_request *req)
{}

static void dma_advance(struct goku_udc *dev, struct goku_ep *ep)
{}

static void abort_dma(struct goku_ep *ep, int status)
{}

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

static int
goku_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
{}

/* dequeue ALL requests */
static void nuke(struct goku_ep *ep, int status)
{}

/* dequeue JUST ONE request */
static int goku_dequeue(struct usb_ep *_ep, struct usb_request *_req)
{}

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

static void goku_clear_halt(struct goku_ep *ep)
{}

static int goku_set_halt(struct usb_ep *_ep, int value)
{}

static int goku_fifo_status(struct usb_ep *_ep)
{}

static void goku_fifo_flush(struct usb_ep *_ep)
{}

static const struct usb_ep_ops goku_ep_ops =;

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

static int goku_get_frame(struct usb_gadget *_gadget)
{}

static struct usb_ep *goku_match_ep(struct usb_gadget *g,
		struct usb_endpoint_descriptor *desc,
		struct usb_ss_ep_comp_descriptor *ep_comp)
{}

static int goku_udc_start(struct usb_gadget *g,
		struct usb_gadget_driver *driver);
static int goku_udc_stop(struct usb_gadget *g);

static const struct usb_gadget_ops goku_ops =;

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

static inline const char *dmastr(void)
{}

#ifdef CONFIG_USB_GADGET_DEBUG_FILES

static const char proc_node_name [] =;

#define FOURBITS
#define EIGHTBITS

static void dump_intmask(struct seq_file *m, const char *label, u32 mask)
{}

static const char *udc_ep_state(enum ep0state state)
{}

static const char *udc_ep_status(u32 status)
{}

static int udc_proc_read(struct seq_file *m, void *v)
{}
#endif	/* CONFIG_USB_GADGET_DEBUG_FILES */

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

static void udc_reinit (struct goku_udc *dev)
{}

static void udc_reset(struct goku_udc *dev)
{}

static void ep0_start(struct goku_udc *dev)
{}

static void udc_enable(struct goku_udc *dev)
{}

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

/* keeping it simple:
 * - one bus driver, initted first;
 * - one function driver, initted second
 */

/* 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
 * disconnect is reported.  then a host may connect again, or
 * the driver might get unbound.
 */
static int goku_udc_start(struct usb_gadget *g,
		struct usb_gadget_driver *driver)
{}

static void stop_activity(struct goku_udc *dev)
{}

static int goku_udc_stop(struct usb_gadget *g)
{}

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

static void ep0_setup(struct goku_udc *dev)
{}

#define ACK

static irqreturn_t goku_irq(int irq, void *_dev)
{}

#undef ACK

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

static void gadget_release(struct device *_dev)
{}

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

static void goku_remove(struct pci_dev *pdev)
{}

/* wrap this driver around the specified pci device, but
 * don't respond over USB until a gadget driver binds to us.
 */

static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{}


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

static const struct pci_device_id pci_ids[] =;
MODULE_DEVICE_TABLE (pci, pci_ids);

static struct pci_driver goku_pci_driver =;

module_pci_driver();