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

// SPDX-License-Identifier: GPL-2.0+
/*
 * Copyright (C) 2011 Marvell International Ltd. All rights reserved.
 * Author: Chao Xie <[email protected]>
 *	   Neil Zhang <[email protected]>
 */

#include <linux/module.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/dmapool.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/ioport.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/err.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/usb/otg.h>
#include <linux/pm.h>
#include <linux/io.h>
#include <linux/irq.h>
#include <linux/platform_device.h>
#include <linux/clk.h>
#include <linux/platform_data/mv_usb.h>
#include <asm/unaligned.h>

#include "mv_udc.h"

#define DRIVER_DESC

#define ep_dir(ep)

/* timeout value -- usec */
#define RESET_TIMEOUT
#define FLUSH_TIMEOUT
#define EPSTATUS_TIMEOUT
#define PRIME_TIMEOUT
#define READSAFE_TIMEOUT

#define LOOPS_USEC_SHIFT
#define LOOPS_USEC
#define LOOPS(timeout)

static DECLARE_COMPLETION(release_done);

static const char driver_name[] =;

static void nuke(struct mv_ep *ep, int status);
static void stop_activity(struct mv_udc *udc, struct usb_gadget_driver *driver);

/* for endpoint 0 operations */
static const struct usb_endpoint_descriptor mv_ep0_desc =;

static void ep0_reset(struct mv_udc *udc)
{}

/* protocol ep0 stall, will automatically be cleared on new transaction */
static void ep0_stall(struct mv_udc *udc)
{}

static int process_ep_req(struct mv_udc *udc, int index,
	struct mv_req *curr_req)
{}

/*
 * done() - retire a request; caller blocked irqs
 * @status : request status to be set, only works when
 * request is still in progress.
 */
static void done(struct mv_ep *ep, struct mv_req *req, int status)
	__releases(&ep->udc->lock)
	__acquires(&ep->udc->lock)
{}

static int queue_dtd(struct mv_ep *ep, struct mv_req *req)
{}

static struct mv_dtd *build_dtd(struct mv_req *req, unsigned *length,
		dma_addr_t *dma, int *is_last)
{}

/* generate dTD linked list for a request */
static int req_to_dtd(struct mv_req *req)
{}

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

static int  mv_ep_disable(struct usb_ep *_ep)
{}

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

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

static void mv_ep_fifo_flush(struct usb_ep *_ep)
{}

/* queues (submits) an I/O request to an endpoint */
static int
mv_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
{}

static void mv_prime_ep(struct mv_ep *ep, struct mv_req *req)
{}

/* dequeues (cancels, unlinks) an I/O request from an endpoint */
static int mv_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
{}

static void ep_set_stall(struct mv_udc *udc, u8 ep_num, u8 direction, int stall)
{}

static int ep_is_stall(struct mv_udc *udc, u8 ep_num, u8 direction)
{}

static int mv_ep_set_halt_wedge(struct usb_ep *_ep, int halt, int wedge)
{}

static int mv_ep_set_halt(struct usb_ep *_ep, int halt)
{}

static int mv_ep_set_wedge(struct usb_ep *_ep)
{}

static const struct usb_ep_ops mv_ep_ops =;

static int udc_clock_enable(struct mv_udc *udc)
{}

static void udc_clock_disable(struct mv_udc *udc)
{}

static void udc_stop(struct mv_udc *udc)
{}

static void udc_start(struct mv_udc *udc)
{}

static int udc_reset(struct mv_udc *udc)
{}

static int mv_udc_enable_internal(struct mv_udc *udc)
{}

static int mv_udc_enable(struct mv_udc *udc)
{}

static void mv_udc_disable_internal(struct mv_udc *udc)
{}

static void mv_udc_disable(struct mv_udc *udc)
{}

static int mv_udc_get_frame(struct usb_gadget *gadget)
{}

/* Tries to wake up the host connected to this gadget */
static int mv_udc_wakeup(struct usb_gadget *gadget)
{}

static int mv_udc_vbus_session(struct usb_gadget *gadget, int is_active)
{}

static int mv_udc_pullup(struct usb_gadget *gadget, int is_on)
{}

static int mv_udc_start(struct usb_gadget *, struct usb_gadget_driver *);
static int mv_udc_stop(struct usb_gadget *);
/* device controller usb_gadget_ops structure */
static const struct usb_gadget_ops mv_ops =;

static int eps_init(struct mv_udc *udc)
{}

/* delete all endpoint requests, called with spinlock held */
static void nuke(struct mv_ep *ep, int status)
{}

static void gadget_reset(struct mv_udc *udc, struct usb_gadget_driver *driver)
{}
/* stop all USB activities */
static void stop_activity(struct mv_udc *udc, struct usb_gadget_driver *driver)
{}

static int mv_udc_start(struct usb_gadget *gadget,
		struct usb_gadget_driver *driver)
{}

static int mv_udc_stop(struct usb_gadget *gadget)
{}

static void mv_set_ptc(struct mv_udc *udc, u32 mode)
{}

static void prime_status_complete(struct usb_ep *ep, struct usb_request *_req)
{}

static int
udc_prime_status(struct mv_udc *udc, u8 direction, u16 status, bool empty)
{}

static void mv_udc_testmode(struct mv_udc *udc, u16 index)
{}

static void ch9setaddress(struct mv_udc *udc, struct usb_ctrlrequest *setup)
{}

static void ch9getstatus(struct mv_udc *udc, u8 ep_num,
	struct usb_ctrlrequest *setup)
{}

static void ch9clearfeature(struct mv_udc *udc, struct usb_ctrlrequest *setup)
{}

static void ch9setfeature(struct mv_udc *udc, struct usb_ctrlrequest *setup)
{}

static void handle_setup_packet(struct mv_udc *udc, u8 ep_num,
	struct usb_ctrlrequest *setup)
	__releases(&ep->udc->lock)
	__acquires(&ep->udc->lock)
{}

/* complete DATA or STATUS phase of ep0 prime status phase if needed */
static void ep0_req_complete(struct mv_udc *udc,
	struct mv_ep *ep0, struct mv_req *req)
{}

static void get_setup_data(struct mv_udc *udc, u8 ep_num, u8 *buffer_ptr)
{}

static void irq_process_tr_complete(struct mv_udc *udc)
{}

static void irq_process_reset(struct mv_udc *udc)
{}

static void handle_bus_resume(struct mv_udc *udc)
{}

static void irq_process_suspend(struct mv_udc *udc)
{}

static void irq_process_port_change(struct mv_udc *udc)
{}

static void irq_process_error(struct mv_udc *udc)
{}

static irqreturn_t mv_udc_irq(int irq, void *dev)
{}

static irqreturn_t mv_udc_vbus_irq(int irq, void *dev)
{}

static void mv_udc_vbus_work(struct work_struct *work)
{}

/* release device structure */
static void gadget_release(struct device *_dev)
{}

static void mv_udc_remove(struct platform_device *pdev)
{}

static int mv_udc_probe(struct platform_device *pdev)
{}

#ifdef CONFIG_PM
static int mv_udc_suspend(struct device *dev)
{}

static int mv_udc_resume(struct device *dev)
{}

static const struct dev_pm_ops mv_udc_pm_ops =;
#endif

static void mv_udc_shutdown(struct platform_device *pdev)
{}

static struct platform_driver udc_driver =;

module_platform_driver();
MODULE_ALIAS();
MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();