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

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) 2011 LAPIS Semiconductor Co., Ltd.
 */
#define pr_fmt(fmt)
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/gpio/consumer.h>
#include <linux/gpio/machine.h>
#include <linux/list.h>
#include <linux/interrupt.h>
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
#include <linux/irq.h>

#define PCH_VBUS_PERIOD
#define PCH_VBUS_INTERVAL

/* Address offset of Registers */
#define UDC_EP_REG_SHIFT

#define UDC_EPCTL_ADDR
#define UDC_EPSTS_ADDR
#define UDC_BUFIN_FRAMENUM_ADDR
#define UDC_BUFOUT_MAXPKT_ADDR
#define UDC_SUBPTR_ADDR
#define UDC_DESPTR_ADDR
#define UDC_CONFIRM_ADDR

#define UDC_DEVCFG_ADDR
#define UDC_DEVCTL_ADDR
#define UDC_DEVSTS_ADDR
#define UDC_DEVIRQSTS_ADDR
#define UDC_DEVIRQMSK_ADDR
#define UDC_EPIRQSTS_ADDR
#define UDC_EPIRQMSK_ADDR
#define UDC_DEVLPM_ADDR
#define UDC_CSR_BUSY_ADDR
#define UDC_SRST_ADDR
#define UDC_CSR_ADDR

/* Endpoint control register */
/* Bit position */
#define UDC_EPCTL_MRXFLUSH
#define UDC_EPCTL_RRDY
#define UDC_EPCTL_CNAK
#define UDC_EPCTL_SNAK
#define UDC_EPCTL_NAK
#define UDC_EPCTL_P
#define UDC_EPCTL_F
#define UDC_EPCTL_S
#define UDC_EPCTL_ET_SHIFT
/* Mask patern */
#define UDC_EPCTL_ET_MASK
/* Value for ET field */
#define UDC_EPCTL_ET_CONTROL
#define UDC_EPCTL_ET_ISO
#define UDC_EPCTL_ET_BULK
#define UDC_EPCTL_ET_INTERRUPT

/* Endpoint status register */
/* Bit position */
#define UDC_EPSTS_XFERDONE
#define UDC_EPSTS_RSS
#define UDC_EPSTS_RCS
#define UDC_EPSTS_TXEMPTY
#define UDC_EPSTS_TDC
#define UDC_EPSTS_HE
#define UDC_EPSTS_MRXFIFO_EMP
#define UDC_EPSTS_BNA
#define UDC_EPSTS_IN
#define UDC_EPSTS_OUT_SHIFT
/* Mask patern */
#define UDC_EPSTS_OUT_MASK
#define UDC_EPSTS_ALL_CLR_MASK
/* Value for OUT field */
#define UDC_EPSTS_OUT_SETUP
#define UDC_EPSTS_OUT_DATA

/* Device configuration register */
/* Bit position */
#define UDC_DEVCFG_CSR_PRG
#define UDC_DEVCFG_SP
/* SPD Valee */
#define UDC_DEVCFG_SPD_HS
#define UDC_DEVCFG_SPD_FS
#define UDC_DEVCFG_SPD_LS

/* Device control register */
/* Bit position */
#define UDC_DEVCTL_THLEN_SHIFT
#define UDC_DEVCTL_BRLEN_SHIFT
#define UDC_DEVCTL_CSR_DONE
#define UDC_DEVCTL_SD
#define UDC_DEVCTL_MODE
#define UDC_DEVCTL_BREN
#define UDC_DEVCTL_THE
#define UDC_DEVCTL_DU
#define UDC_DEVCTL_TDE
#define UDC_DEVCTL_RDE
#define UDC_DEVCTL_RES

/* Device status register */
/* Bit position */
#define UDC_DEVSTS_TS_SHIFT
#define UDC_DEVSTS_ENUM_SPEED_SHIFT
#define UDC_DEVSTS_ALT_SHIFT
#define UDC_DEVSTS_INTF_SHIFT
#define UDC_DEVSTS_CFG_SHIFT
/* Mask patern */
#define UDC_DEVSTS_TS_MASK
#define UDC_DEVSTS_ENUM_SPEED_MASK
#define UDC_DEVSTS_ALT_MASK
#define UDC_DEVSTS_INTF_MASK
#define UDC_DEVSTS_CFG_MASK
/* value for maximum speed for SPEED field */
#define UDC_DEVSTS_ENUM_SPEED_FULL
#define UDC_DEVSTS_ENUM_SPEED_HIGH
#define UDC_DEVSTS_ENUM_SPEED_LOW
#define UDC_DEVSTS_ENUM_SPEED_FULLX

/* Device irq register */
/* Bit position */
#define UDC_DEVINT_RWKP
#define UDC_DEVINT_ENUM
#define UDC_DEVINT_SOF
#define UDC_DEVINT_US
#define UDC_DEVINT_UR
#define UDC_DEVINT_ES
#define UDC_DEVINT_SI
#define UDC_DEVINT_SC
/* Mask patern */
#define UDC_DEVINT_MSK

/* Endpoint irq register */
/* Bit position */
#define UDC_EPINT_IN_SHIFT
#define UDC_EPINT_OUT_SHIFT
#define UDC_EPINT_IN_EP0
#define UDC_EPINT_OUT_EP0
/* Mask patern */
#define UDC_EPINT_MSK_DISABLE_ALL

/* UDC_CSR_BUSY Status register */
/* Bit position */
#define UDC_CSR_BUSY

/* SOFT RESET register */
/* Bit position */
#define UDC_PSRST
#define UDC_SRST

/* USB_DEVICE endpoint register */
/* Bit position */
#define UDC_CSR_NE_NUM_SHIFT
#define UDC_CSR_NE_DIR_SHIFT
#define UDC_CSR_NE_TYPE_SHIFT
#define UDC_CSR_NE_CFG_SHIFT
#define UDC_CSR_NE_INTF_SHIFT
#define UDC_CSR_NE_ALT_SHIFT
#define UDC_CSR_NE_MAX_PKT_SHIFT
/* Mask patern */
#define UDC_CSR_NE_NUM_MASK
#define UDC_CSR_NE_DIR_MASK
#define UDC_CSR_NE_TYPE_MASK
#define UDC_CSR_NE_CFG_MASK
#define UDC_CSR_NE_INTF_MASK
#define UDC_CSR_NE_ALT_MASK
#define UDC_CSR_NE_MAX_PKT_MASK

#define PCH_UDC_CSR(ep)
#define PCH_UDC_EPINT(in, num)

/* Index of endpoint */
#define UDC_EP0IN_IDX
#define UDC_EP0OUT_IDX
#define UDC_EPIN_IDX(ep)
#define UDC_EPOUT_IDX(ep)
#define PCH_UDC_EP0
#define PCH_UDC_EP1
#define PCH_UDC_EP2
#define PCH_UDC_EP3

/* Number of endpoint */
#define PCH_UDC_EP_NUM
#define PCH_UDC_USED_EP_NUM
/* Length Value */
#define PCH_UDC_BRLEN
#define PCH_UDC_THLEN
/* Value of EP Buffer Size */
#define UDC_EP0IN_BUFF_SIZE
#define UDC_EPIN_BUFF_SIZE
#define UDC_EP0OUT_BUFF_SIZE
#define UDC_EPOUT_BUFF_SIZE
/* Value of EP maximum packet size */
#define UDC_EP0IN_MAX_PKT_SIZE
#define UDC_EP0OUT_MAX_PKT_SIZE
#define UDC_BULK_MAX_PKT_SIZE

/* DMA */
#define DMA_DIR_RX
#define DMA_DIR_TX
#define DMA_ADDR_INVALID
#define UDC_DMA_MAXPACKET

/**
 * struct pch_udc_data_dma_desc - Structure to hold DMA descriptor information
 *				  for data
 * @status:		Status quadlet
 * @reserved:		Reserved
 * @dataptr:		Buffer descriptor
 * @next:		Next descriptor
 */
struct pch_udc_data_dma_desc {};

/**
 * struct pch_udc_stp_dma_desc - Structure to hold DMA descriptor information
 *				 for control data
 * @status:	Status
 * @reserved:	Reserved
 * @request:	Control Request
 */
struct pch_udc_stp_dma_desc {} __attribute((packed));

/* DMA status definitions */
/* Buffer status */
#define PCH_UDC_BUFF_STS
#define PCH_UDC_BS_HST_RDY
#define PCH_UDC_BS_DMA_BSY
#define PCH_UDC_BS_DMA_DONE
#define PCH_UDC_BS_HST_BSY
/*  Rx/Tx Status */
#define PCH_UDC_RXTX_STS
#define PCH_UDC_RTS_SUCC
#define PCH_UDC_RTS_DESERR
#define PCH_UDC_RTS_BUFERR
/* Last Descriptor Indication */
#define PCH_UDC_DMA_LAST
/* Number of Rx/Tx Bytes Mask */
#define PCH_UDC_RXTX_BYTES

/**
 * struct pch_udc_cfg_data - Structure to hold current configuration
 *			     and interface information
 * @cur_cfg:	current configuration in use
 * @cur_intf:	current interface in use
 * @cur_alt:	current alt interface in use
 */
struct pch_udc_cfg_data {};

/**
 * struct pch_udc_ep - Structure holding a PCH USB device Endpoint information
 * @ep:			embedded ep request
 * @td_stp_phys:	for setup request
 * @td_data_phys:	for data request
 * @td_stp:		for setup request
 * @td_data:		for data request
 * @dev:		reference to device struct
 * @offset_addr:	offset address of ep register
 * @queue:		queue for requests
 * @num:		endpoint number
 * @in:			endpoint is IN
 * @halted:		endpoint halted?
 * @epsts:		Endpoint status
 */
struct pch_udc_ep {};

/**
 * struct pch_vbus_gpio_data - Structure holding GPIO informaton
 *					for detecting VBUS
 * @port:		gpio descriptor for the VBUS GPIO
 * @intr:		gpio interrupt number
 * @irq_work_fall:	Structure for WorkQueue
 * @irq_work_rise:	Structure for WorkQueue
 */
struct pch_vbus_gpio_data {};

/**
 * struct pch_udc_dev - Structure holding complete information
 *			of the PCH USB device
 * @gadget:		gadget driver data
 * @driver:		reference to gadget driver bound
 * @pdev:		reference to the PCI device
 * @ep:			array of endpoints
 * @lock:		protects all state
 * @stall:		stall requested
 * @prot_stall:		protcol stall requested
 * @registered:		driver registered with system
 * @suspended:		driver in suspended state
 * @connected:		gadget driver associated
 * @vbus_session:	required vbus_session state
 * @set_cfg_not_acked:	pending acknowledgement 4 setup
 * @waiting_zlp_ack:	pending acknowledgement 4 ZLP
 * @data_requests:	DMA pool for data requests
 * @stp_requests:	DMA pool for setup requests
 * @dma_addr:		DMA pool for received
 * @setup_data:		Received setup data
 * @base_addr:		for mapped device memory
 * @bar:		PCI BAR used for mapped device memory
 * @cfg_data:		current cfg, intf, and alt in use
 * @vbus_gpio:		GPIO informaton for detecting VBUS
 */
struct pch_udc_dev {};
#define to_pch_udc(g)

#define PCH_UDC_PCI_BAR_QUARK_X1000
#define PCH_UDC_PCI_BAR

#define PCI_DEVICE_ID_INTEL_QUARK_X1000_UDC
#define PCI_DEVICE_ID_INTEL_EG20T_UDC

#define PCI_DEVICE_ID_ML7213_IOH_UDC
#define PCI_DEVICE_ID_ML7831_IOH_UDC

static const char	ep0_string[] =;
static DEFINE_SPINLOCK(udc_stall_spinlock);	/* stall spin lock */
static bool speed_fs;
module_param_named(speed_fs, speed_fs, bool, S_IRUGO);
MODULE_PARM_DESC();

/**
 * struct pch_udc_request - Structure holding a PCH USB device request packet
 * @req:		embedded ep request
 * @td_data_phys:	phys. address
 * @td_data:		first dma desc. of chain
 * @td_data_last:	last dma desc. of chain
 * @queue:		associated queue
 * @dma_going:		DMA in progress for request
 * @dma_done:		DMA completed for request
 * @chain_len:		chain length
 */
struct pch_udc_request {};

static inline u32 pch_udc_readl(struct pch_udc_dev *dev, unsigned long reg)
{}

static inline void pch_udc_writel(struct pch_udc_dev *dev,
				    unsigned long val, unsigned long reg)
{}

static inline void pch_udc_bit_set(struct pch_udc_dev *dev,
				     unsigned long reg,
				     unsigned long bitmask)
{}

static inline void pch_udc_bit_clr(struct pch_udc_dev *dev,
				     unsigned long reg,
				     unsigned long bitmask)
{}

static inline u32 pch_udc_ep_readl(struct pch_udc_ep *ep, unsigned long reg)
{}

static inline void pch_udc_ep_writel(struct pch_udc_ep *ep,
				    unsigned long val, unsigned long reg)
{}

static inline void pch_udc_ep_bit_set(struct pch_udc_ep *ep,
				     unsigned long reg,
				     unsigned long bitmask)
{}

static inline void pch_udc_ep_bit_clr(struct pch_udc_ep *ep,
				     unsigned long reg,
				     unsigned long bitmask)
{}

/**
 * pch_udc_csr_busy() - Wait till idle.
 * @dev:	Reference to pch_udc_dev structure
 */
static void pch_udc_csr_busy(struct pch_udc_dev *dev)
{}

/**
 * pch_udc_write_csr() - Write the command and status registers.
 * @dev:	Reference to pch_udc_dev structure
 * @val:	value to be written to CSR register
 * @ep:		end-point number
 */
static void pch_udc_write_csr(struct pch_udc_dev *dev, unsigned long val,
			       unsigned int ep)
{}

/**
 * pch_udc_read_csr() - Read the command and status registers.
 * @dev:	Reference to pch_udc_dev structure
 * @ep:		end-point number
 *
 * Return codes:	content of CSR register
 */
static u32 pch_udc_read_csr(struct pch_udc_dev *dev, unsigned int ep)
{}

/**
 * pch_udc_rmt_wakeup() - Initiate for remote wakeup
 * @dev:	Reference to pch_udc_dev structure
 */
static inline void pch_udc_rmt_wakeup(struct pch_udc_dev *dev)
{}

/**
 * pch_udc_get_frame() - Get the current frame from device status register
 * @dev:	Reference to pch_udc_dev structure
 * Retern	current frame
 */
static inline int pch_udc_get_frame(struct pch_udc_dev *dev)
{}

/**
 * pch_udc_clear_selfpowered() - Clear the self power control
 * @dev:	Reference to pch_udc_regs structure
 */
static inline void pch_udc_clear_selfpowered(struct pch_udc_dev *dev)
{}

/**
 * pch_udc_set_selfpowered() - Set the self power control
 * @dev:	Reference to pch_udc_regs structure
 */
static inline void pch_udc_set_selfpowered(struct pch_udc_dev *dev)
{}

/**
 * pch_udc_set_disconnect() - Set the disconnect status.
 * @dev:	Reference to pch_udc_regs structure
 */
static inline void pch_udc_set_disconnect(struct pch_udc_dev *dev)
{}

/**
 * pch_udc_clear_disconnect() - Clear the disconnect status.
 * @dev:	Reference to pch_udc_regs structure
 */
static void pch_udc_clear_disconnect(struct pch_udc_dev *dev)
{}

static void pch_udc_init(struct pch_udc_dev *dev);

/**
 * pch_udc_reconnect() - This API initializes usb device controller,
 *						and clear the disconnect status.
 * @dev:		Reference to pch_udc_regs structure
 */
static void pch_udc_reconnect(struct pch_udc_dev *dev)
{}

/**
 * pch_udc_vbus_session() - set or clearr the disconnect status.
 * @dev:	Reference to pch_udc_regs structure
 * @is_active:	Parameter specifying the action
 *		  0:   indicating VBUS power is ending
 *		  !0:  indicating VBUS power is starting
 */
static inline void pch_udc_vbus_session(struct pch_udc_dev *dev,
					  int is_active)
{}

/**
 * pch_udc_ep_set_stall() - Set the stall of endpoint
 * @ep:		Reference to structure of type pch_udc_ep_regs
 */
static void pch_udc_ep_set_stall(struct pch_udc_ep *ep)
{}

/**
 * pch_udc_ep_clear_stall() - Clear the stall of endpoint
 * @ep:		Reference to structure of type pch_udc_ep_regs
 */
static inline void pch_udc_ep_clear_stall(struct pch_udc_ep *ep)
{}

/**
 * pch_udc_ep_set_trfr_type() - Set the transfer type of endpoint
 * @ep:		Reference to structure of type pch_udc_ep_regs
 * @type:	Type of endpoint
 */
static inline void pch_udc_ep_set_trfr_type(struct pch_udc_ep *ep,
					u8 type)
{}

/**
 * pch_udc_ep_set_bufsz() - Set the maximum packet size for the endpoint
 * @ep:		Reference to structure of type pch_udc_ep_regs
 * @buf_size:	The buffer word size
 * @ep_in:	EP is IN
 */
static void pch_udc_ep_set_bufsz(struct pch_udc_ep *ep,
						 u32 buf_size, u32 ep_in)
{}

/**
 * pch_udc_ep_set_maxpkt() - Set the Max packet size for the endpoint
 * @ep:		Reference to structure of type pch_udc_ep_regs
 * @pkt_size:	The packet byte size
 */
static void pch_udc_ep_set_maxpkt(struct pch_udc_ep *ep, u32 pkt_size)
{}

/**
 * pch_udc_ep_set_subptr() - Set the Setup buffer pointer for the endpoint
 * @ep:		Reference to structure of type pch_udc_ep_regs
 * @addr:	Address of the register
 */
static inline void pch_udc_ep_set_subptr(struct pch_udc_ep *ep, u32 addr)
{}

/**
 * pch_udc_ep_set_ddptr() - Set the Data descriptor pointer for the endpoint
 * @ep:		Reference to structure of type pch_udc_ep_regs
 * @addr:	Address of the register
 */
static inline void pch_udc_ep_set_ddptr(struct pch_udc_ep *ep, u32 addr)
{}

/**
 * pch_udc_ep_set_pd() - Set the poll demand bit for the endpoint
 * @ep:		Reference to structure of type pch_udc_ep_regs
 */
static inline void pch_udc_ep_set_pd(struct pch_udc_ep *ep)
{}

/**
 * pch_udc_ep_set_rrdy() - Set the receive ready bit for the endpoint
 * @ep:		Reference to structure of type pch_udc_ep_regs
 */
static inline void pch_udc_ep_set_rrdy(struct pch_udc_ep *ep)
{}

/**
 * pch_udc_ep_clear_rrdy() - Clear the receive ready bit for the endpoint
 * @ep:		Reference to structure of type pch_udc_ep_regs
 */
static inline void pch_udc_ep_clear_rrdy(struct pch_udc_ep *ep)
{}

/**
 * pch_udc_set_dma() - Set the 'TDE' or RDE bit of device control
 *			register depending on the direction specified
 * @dev:	Reference to structure of type pch_udc_regs
 * @dir:	whether Tx or Rx
 *		  DMA_DIR_RX: Receive
 *		  DMA_DIR_TX: Transmit
 */
static inline void pch_udc_set_dma(struct pch_udc_dev *dev, int dir)
{}

/**
 * pch_udc_clear_dma() - Clear the 'TDE' or RDE bit of device control
 *				 register depending on the direction specified
 * @dev:	Reference to structure of type pch_udc_regs
 * @dir:	Whether Tx or Rx
 *		  DMA_DIR_RX: Receive
 *		  DMA_DIR_TX: Transmit
 */
static inline void pch_udc_clear_dma(struct pch_udc_dev *dev, int dir)
{}

/**
 * pch_udc_set_csr_done() - Set the device control register
 *				CSR done field (bit 13)
 * @dev:	reference to structure of type pch_udc_regs
 */
static inline void pch_udc_set_csr_done(struct pch_udc_dev *dev)
{}

/**
 * pch_udc_disable_interrupts() - Disables the specified interrupts
 * @dev:	Reference to structure of type pch_udc_regs
 * @mask:	Mask to disable interrupts
 */
static inline void pch_udc_disable_interrupts(struct pch_udc_dev *dev,
					    u32 mask)
{}

/**
 * pch_udc_enable_interrupts() - Enable the specified interrupts
 * @dev:	Reference to structure of type pch_udc_regs
 * @mask:	Mask to enable interrupts
 */
static inline void pch_udc_enable_interrupts(struct pch_udc_dev *dev,
					   u32 mask)
{}

/**
 * pch_udc_disable_ep_interrupts() - Disable endpoint interrupts
 * @dev:	Reference to structure of type pch_udc_regs
 * @mask:	Mask to disable interrupts
 */
static inline void pch_udc_disable_ep_interrupts(struct pch_udc_dev *dev,
						u32 mask)
{}

/**
 * pch_udc_enable_ep_interrupts() - Enable endpoint interrupts
 * @dev:	Reference to structure of type pch_udc_regs
 * @mask:	Mask to enable interrupts
 */
static inline void pch_udc_enable_ep_interrupts(struct pch_udc_dev *dev,
					      u32 mask)
{}

/**
 * pch_udc_read_device_interrupts() - Read the device interrupts
 * @dev:	Reference to structure of type pch_udc_regs
 * Retern	The device interrupts
 */
static inline u32 pch_udc_read_device_interrupts(struct pch_udc_dev *dev)
{}

/**
 * pch_udc_write_device_interrupts() - Write device interrupts
 * @dev:	Reference to structure of type pch_udc_regs
 * @val:	The value to be written to interrupt register
 */
static inline void pch_udc_write_device_interrupts(struct pch_udc_dev *dev,
						     u32 val)
{}

/**
 * pch_udc_read_ep_interrupts() - Read the endpoint interrupts
 * @dev:	Reference to structure of type pch_udc_regs
 * Retern	The endpoint interrupt
 */
static inline u32 pch_udc_read_ep_interrupts(struct pch_udc_dev *dev)
{}

/**
 * pch_udc_write_ep_interrupts() - Clear endpoint interupts
 * @dev:	Reference to structure of type pch_udc_regs
 * @val:	The value to be written to interrupt register
 */
static inline void pch_udc_write_ep_interrupts(struct pch_udc_dev *dev,
					     u32 val)
{}

/**
 * pch_udc_read_device_status() - Read the device status
 * @dev:	Reference to structure of type pch_udc_regs
 * Retern	The device status
 */
static inline u32 pch_udc_read_device_status(struct pch_udc_dev *dev)
{}

/**
 * pch_udc_read_ep_control() - Read the endpoint control
 * @ep:		Reference to structure of type pch_udc_ep_regs
 * Retern	The endpoint control register value
 */
static inline u32 pch_udc_read_ep_control(struct pch_udc_ep *ep)
{}

/**
 * pch_udc_clear_ep_control() - Clear the endpoint control register
 * @ep:		Reference to structure of type pch_udc_ep_regs
 * Retern	The endpoint control register value
 */
static inline void pch_udc_clear_ep_control(struct pch_udc_ep *ep)
{}

/**
 * pch_udc_read_ep_status() - Read the endpoint status
 * @ep:		Reference to structure of type pch_udc_ep_regs
 * Retern	The endpoint status
 */
static inline u32 pch_udc_read_ep_status(struct pch_udc_ep *ep)
{}

/**
 * pch_udc_clear_ep_status() - Clear the endpoint status
 * @ep:		Reference to structure of type pch_udc_ep_regs
 * @stat:	Endpoint status
 */
static inline void pch_udc_clear_ep_status(struct pch_udc_ep *ep,
					 u32 stat)
{}

/**
 * pch_udc_ep_set_nak() - Set the bit 7 (SNAK field)
 *				of the endpoint control register
 * @ep:		Reference to structure of type pch_udc_ep_regs
 */
static inline void pch_udc_ep_set_nak(struct pch_udc_ep *ep)
{}

/**
 * pch_udc_ep_clear_nak() - Set the bit 8 (CNAK field)
 *				of the endpoint control register
 * @ep:		reference to structure of type pch_udc_ep_regs
 */
static void pch_udc_ep_clear_nak(struct pch_udc_ep *ep)
{}

/**
 * pch_udc_ep_fifo_flush() - Flush the endpoint fifo
 * @ep:	reference to structure of type pch_udc_ep_regs
 * @dir:	direction of endpoint
 *		  0:  endpoint is OUT
 *		  !0: endpoint is IN
 */
static void pch_udc_ep_fifo_flush(struct pch_udc_ep *ep, int dir)
{}

/**
 * pch_udc_ep_enable() - This api enables endpoint
 * @ep:		reference to structure of type pch_udc_ep_regs
 * @cfg:	current configuration information
 * @desc:	endpoint descriptor
 */
static void pch_udc_ep_enable(struct pch_udc_ep *ep,
			       struct pch_udc_cfg_data *cfg,
			       const struct usb_endpoint_descriptor *desc)
{}

/**
 * pch_udc_ep_disable() - This api disables endpoint
 * @ep:		reference to structure of type pch_udc_ep_regs
 */
static void pch_udc_ep_disable(struct pch_udc_ep *ep)
{}

/**
 * pch_udc_wait_ep_stall() - Wait EP stall.
 * @ep:		reference to structure of type pch_udc_ep_regs
 */
static void pch_udc_wait_ep_stall(struct pch_udc_ep *ep)
{}

/**
 * pch_udc_init() - This API initializes usb device controller
 * @dev:	Rreference to pch_udc_regs structure
 */
static void pch_udc_init(struct pch_udc_dev *dev)
{}

/**
 * pch_udc_exit() - This API exit usb device controller
 * @dev:	Reference to pch_udc_regs structure
 */
static void pch_udc_exit(struct pch_udc_dev *dev)
{}

/**
 * pch_udc_pcd_get_frame() - This API is invoked to get the current frame number
 * @gadget:	Reference to the gadget driver
 *
 * Return codes:
 *	0:		Success
 *	-EINVAL:	If the gadget passed is NULL
 */
static int pch_udc_pcd_get_frame(struct usb_gadget *gadget)
{}

/**
 * pch_udc_pcd_wakeup() - This API is invoked to initiate a remote wakeup
 * @gadget:	Reference to the gadget driver
 *
 * Return codes:
 *	0:		Success
 *	-EINVAL:	If the gadget passed is NULL
 */
static int pch_udc_pcd_wakeup(struct usb_gadget *gadget)
{}

/**
 * pch_udc_pcd_selfpowered() - This API is invoked to specify whether the device
 *				is self powered or not
 * @gadget:	Reference to the gadget driver
 * @value:	Specifies self powered or not
 *
 * Return codes:
 *	0:		Success
 *	-EINVAL:	If the gadget passed is NULL
 */
static int pch_udc_pcd_selfpowered(struct usb_gadget *gadget, int value)
{}

/**
 * pch_udc_pcd_pullup() - This API is invoked to make the device
 *				visible/invisible to the host
 * @gadget:	Reference to the gadget driver
 * @is_on:	Specifies whether the pull up is made active or inactive
 *
 * Return codes:
 *	0:		Success
 *	-EINVAL:	If the gadget passed is NULL
 */
static int pch_udc_pcd_pullup(struct usb_gadget *gadget, int is_on)
{}

/**
 * pch_udc_pcd_vbus_session() - This API is used by a driver for an external
 *				transceiver (or GPIO) that
 *				detects a VBUS power session starting/ending
 * @gadget:	Reference to the gadget driver
 * @is_active:	specifies whether the session is starting or ending
 *
 * Return codes:
 *	0:		Success
 *	-EINVAL:	If the gadget passed is NULL
 */
static int pch_udc_pcd_vbus_session(struct usb_gadget *gadget, int is_active)
{}

/**
 * pch_udc_pcd_vbus_draw() - This API is used by gadget drivers during
 *				SET_CONFIGURATION calls to
 *				specify how much power the device can consume
 * @gadget:	Reference to the gadget driver
 * @mA:		specifies the current limit in 2mA unit
 *
 * Return codes:
 *	-EINVAL:	If the gadget passed is NULL
 *	-EOPNOTSUPP:
 */
static int pch_udc_pcd_vbus_draw(struct usb_gadget *gadget, unsigned int mA)
{}

static int pch_udc_start(struct usb_gadget *g,
		struct usb_gadget_driver *driver);
static int pch_udc_stop(struct usb_gadget *g);

static const struct usb_gadget_ops pch_udc_ops =;

/**
 * pch_vbus_gpio_get_value() - This API gets value of GPIO port as VBUS status.
 * @dev:	Reference to the driver structure
 *
 * Return value:
 *	1: VBUS is high
 *	0: VBUS is low
 *     -1: It is not enable to detect VBUS using GPIO
 */
static int pch_vbus_gpio_get_value(struct pch_udc_dev *dev)
{}

/**
 * pch_vbus_gpio_work_fall() - This API keeps watch on VBUS becoming Low.
 *                             If VBUS is Low, disconnect is processed
 * @irq_work:	Structure for WorkQueue
 *
 */
static void pch_vbus_gpio_work_fall(struct work_struct *irq_work)
{}

/**
 * pch_vbus_gpio_work_rise() - This API checks VBUS is High.
 *                             If VBUS is High, connect is processed
 * @irq_work:	Structure for WorkQueue
 *
 */
static void pch_vbus_gpio_work_rise(struct work_struct *irq_work)
{}

/**
 * pch_vbus_gpio_irq() - IRQ handler for GPIO interrupt for changing VBUS
 * @irq:	Interrupt request number
 * @data:	Reference to the device structure
 *
 * Return codes:
 *	0: Success
 *	-EINVAL: GPIO port is invalid or can't be initialized.
 */
static irqreturn_t pch_vbus_gpio_irq(int irq, void *data)
{}

/**
 * pch_vbus_gpio_init() - This API initializes GPIO port detecting VBUS.
 * @dev:		Reference to the driver structure
 *
 * Return codes:
 *	0: Success
 *	-EINVAL: GPIO port is invalid or can't be initialized.
 */
static int pch_vbus_gpio_init(struct pch_udc_dev *dev)
{}

/**
 * pch_vbus_gpio_free() - This API frees resources of GPIO port
 * @dev:	Reference to the driver structure
 */
static void pch_vbus_gpio_free(struct pch_udc_dev *dev)
{}

/**
 * complete_req() - This API is invoked from the driver when processing
 *			of a request is complete
 * @ep:		Reference to the endpoint structure
 * @req:	Reference to the request structure
 * @status:	Indicates the success/failure of completion
 */
static void complete_req(struct pch_udc_ep *ep, struct pch_udc_request *req,
								 int status)
	__releases(&dev->lock)
	__acquires(&dev->lock)
{}

/**
 * empty_req_queue() - This API empties the request queue of an endpoint
 * @ep:		Reference to the endpoint structure
 */
static void empty_req_queue(struct pch_udc_ep *ep)
{}

/**
 * pch_udc_free_dma_chain() - This function frees the DMA chain created
 *				for the request
 * @dev:	Reference to the driver structure
 * @req:	Reference to the request to be freed
 *
 * Return codes:
 *	0: Success
 */
static void pch_udc_free_dma_chain(struct pch_udc_dev *dev,
				   struct pch_udc_request *req)
{}

/**
 * pch_udc_create_dma_chain() - This function creates or reinitializes
 *				a DMA chain
 * @ep:		Reference to the endpoint structure
 * @req:	Reference to the request
 * @buf_len:	The buffer length
 * @gfp_flags:	Flags to be used while mapping the data buffer
 *
 * Return codes:
 *	0:		success,
 *	-ENOMEM:	dma_pool_alloc invocation fails
 */
static int pch_udc_create_dma_chain(struct pch_udc_ep *ep,
				    struct pch_udc_request *req,
				    unsigned long buf_len,
				    gfp_t gfp_flags)
{}

/**
 * prepare_dma() - This function creates and initializes the DMA chain
 *			for the request
 * @ep:		Reference to the endpoint structure
 * @req:	Reference to the request
 * @gfp:	Flag to be used while mapping the data buffer
 *
 * Return codes:
 *	0:		Success
 *	Other 0:	linux error number on failure
 */
static int prepare_dma(struct pch_udc_ep *ep, struct pch_udc_request *req,
			  gfp_t gfp)
{}

/**
 * process_zlp() - This function process zero length packets
 *			from the gadget driver
 * @ep:		Reference to the endpoint structure
 * @req:	Reference to the request
 */
static void process_zlp(struct pch_udc_ep *ep, struct pch_udc_request *req)
{}

/**
 * pch_udc_start_rxrequest() - This function starts the receive requirement.
 * @ep:		Reference to the endpoint structure
 * @req:	Reference to the request structure
 */
static void pch_udc_start_rxrequest(struct pch_udc_ep *ep,
					 struct pch_udc_request *req)
{}

/**
 * pch_udc_pcd_ep_enable() - This API enables the endpoint. It is called
 *				from gadget driver
 * @usbep:	Reference to the USB endpoint structure
 * @desc:	Reference to the USB endpoint descriptor structure
 *
 * Return codes:
 *	0:		Success
 *	-EINVAL:
 *	-ESHUTDOWN:
 */
static int pch_udc_pcd_ep_enable(struct usb_ep *usbep,
				    const struct usb_endpoint_descriptor *desc)
{}

/**
 * pch_udc_pcd_ep_disable() - This API disables endpoint and is called
 *				from gadget driver
 * @usbep:	Reference to the USB endpoint structure
 *
 * Return codes:
 *	0:		Success
 *	-EINVAL:
 */
static int pch_udc_pcd_ep_disable(struct usb_ep *usbep)
{}

/**
 * pch_udc_alloc_request() - This function allocates request structure.
 *				It is called by gadget driver
 * @usbep:	Reference to the USB endpoint structure
 * @gfp:	Flag to be used while allocating memory
 *
 * Return codes:
 *	NULL:			Failure
 *	Allocated address:	Success
 */
static struct usb_request *pch_udc_alloc_request(struct usb_ep *usbep,
						  gfp_t gfp)
{}

/**
 * pch_udc_free_request() - This function frees request structure.
 *				It is called by gadget driver
 * @usbep:	Reference to the USB endpoint structure
 * @usbreq:	Reference to the USB request
 */
static void pch_udc_free_request(struct usb_ep *usbep,
				  struct usb_request *usbreq)
{}

/**
 * pch_udc_pcd_queue() - This function queues a request packet. It is called
 *			by gadget driver
 * @usbep:	Reference to the USB endpoint structure
 * @usbreq:	Reference to the USB request
 * @gfp:	Flag to be used while mapping the data buffer
 *
 * Return codes:
 *	0:			Success
 *	linux error number:	Failure
 */
static int pch_udc_pcd_queue(struct usb_ep *usbep, struct usb_request *usbreq,
								 gfp_t gfp)
{}

/**
 * pch_udc_pcd_dequeue() - This function de-queues a request packet.
 *				It is called by gadget driver
 * @usbep:	Reference to the USB endpoint structure
 * @usbreq:	Reference to the USB request
 *
 * Return codes:
 *	0:			Success
 *	linux error number:	Failure
 */
static int pch_udc_pcd_dequeue(struct usb_ep *usbep,
				struct usb_request *usbreq)
{}

/**
 * pch_udc_pcd_set_halt() - This function Sets or clear the endpoint halt
 *			    feature
 * @usbep:	Reference to the USB endpoint structure
 * @halt:	Specifies whether to set or clear the feature
 *
 * Return codes:
 *	0:			Success
 *	linux error number:	Failure
 */
static int pch_udc_pcd_set_halt(struct usb_ep *usbep, int halt)
{}

/**
 * pch_udc_pcd_set_wedge() - This function Sets or clear the endpoint
 *				halt feature
 * @usbep:	Reference to the USB endpoint structure
 *
 * Return codes:
 *	0:			Success
 *	linux error number:	Failure
 */
static int pch_udc_pcd_set_wedge(struct usb_ep *usbep)
{}

/**
 * pch_udc_pcd_fifo_flush() - This function Flush the FIFO of specified endpoint
 * @usbep:	Reference to the USB endpoint structure
 */
static void pch_udc_pcd_fifo_flush(struct usb_ep *usbep)
{}

static const struct usb_ep_ops pch_udc_ep_ops =;

/**
 * pch_udc_init_setup_buff() - This function initializes the SETUP buffer
 * @td_stp:	Reference to the SETP buffer structure
 */
static void pch_udc_init_setup_buff(struct pch_udc_stp_dma_desc *td_stp)
{}

/**
 * pch_udc_start_next_txrequest() - This function starts
 *					the next transmission requirement
 * @ep:	Reference to the endpoint structure
 */
static void pch_udc_start_next_txrequest(struct pch_udc_ep *ep)
{}

/**
 * pch_udc_complete_transfer() - This function completes a transfer
 * @ep:		Reference to the endpoint structure
 */
static void pch_udc_complete_transfer(struct pch_udc_ep *ep)
{}

/**
 * pch_udc_complete_receiver() - This function completes a receiver
 * @ep:		Reference to the endpoint structure
 */
static void pch_udc_complete_receiver(struct pch_udc_ep *ep)
{}

/**
 * pch_udc_svc_data_in() - This function process endpoint interrupts
 *				for IN endpoints
 * @dev:	Reference to the device structure
 * @ep_num:	Endpoint that generated the interrupt
 */
static void pch_udc_svc_data_in(struct pch_udc_dev *dev, int ep_num)
{}

/**
 * pch_udc_svc_data_out() - Handles interrupts from OUT endpoint
 * @dev:	Reference to the device structure
 * @ep_num:	Endpoint that generated the interrupt
 */
static void pch_udc_svc_data_out(struct pch_udc_dev *dev, int ep_num)
{}

static int pch_udc_gadget_setup(struct pch_udc_dev *dev)
	__must_hold(&dev->lock)
{}

/**
 * pch_udc_svc_control_in() - Handle Control IN endpoint interrupts
 * @dev:	Reference to the device structure
 */
static void pch_udc_svc_control_in(struct pch_udc_dev *dev)
{}

/**
 * pch_udc_svc_control_out() - Routine that handle Control
 *					OUT endpoint interrupts
 * @dev:	Reference to the device structure
 */
static void pch_udc_svc_control_out(struct pch_udc_dev *dev)
	__releases(&dev->lock)
	__acquires(&dev->lock)
{}


/**
 * pch_udc_postsvc_epinters() - This function enables end point interrupts
 *				and clears NAK status
 * @dev:	Reference to the device structure
 * @ep_num:	End point number
 */
static void pch_udc_postsvc_epinters(struct pch_udc_dev *dev, int ep_num)
{}

/**
 * pch_udc_read_all_epstatus() - This function read all endpoint status
 * @dev:	Reference to the device structure
 * @ep_intr:	Status of endpoint interrupt
 */
static void pch_udc_read_all_epstatus(struct pch_udc_dev *dev, u32 ep_intr)
{}

/**
 * pch_udc_activate_control_ep() - This function enables the control endpoints
 *					for traffic after a reset
 * @dev:	Reference to the device structure
 */
static void pch_udc_activate_control_ep(struct pch_udc_dev *dev)
{}


/**
 * pch_udc_svc_ur_interrupt() - This function handles a USB reset interrupt
 * @dev:	Reference to driver structure
 */
static void pch_udc_svc_ur_interrupt(struct pch_udc_dev *dev)
{}

/**
 * pch_udc_svc_enum_interrupt() - This function handles a USB speed enumeration
 *				done interrupt
 * @dev:	Reference to driver structure
 */
static void pch_udc_svc_enum_interrupt(struct pch_udc_dev *dev)
{}

/**
 * pch_udc_svc_intf_interrupt() - This function handles a set interface
 *				  interrupt
 * @dev:	Reference to driver structure
 */
static void pch_udc_svc_intf_interrupt(struct pch_udc_dev *dev)
{}

/**
 * pch_udc_svc_cfg_interrupt() - This function handles a set configuration
 *				interrupt
 * @dev:	Reference to driver structure
 */
static void pch_udc_svc_cfg_interrupt(struct pch_udc_dev *dev)
{}

/**
 * pch_udc_dev_isr() - This function services device interrupts
 *			by invoking appropriate routines.
 * @dev:	Reference to the device structure
 * @dev_intr:	The Device interrupt status.
 */
static void pch_udc_dev_isr(struct pch_udc_dev *dev, u32 dev_intr)
{}

/**
 * pch_udc_isr() - This function handles interrupts from the PCH USB Device
 * @irq:	Interrupt request number
 * @pdev:	Reference to the device structure
 */
static irqreturn_t pch_udc_isr(int irq, void *pdev)
{}

/**
 * pch_udc_setup_ep0() - This function enables control endpoint for traffic
 * @dev:	Reference to the device structure
 */
static void pch_udc_setup_ep0(struct pch_udc_dev *dev)
{}

/**
 * pch_udc_pcd_reinit() - This API initializes the endpoint structures
 * @dev:	Reference to the driver structure
 */
static void pch_udc_pcd_reinit(struct pch_udc_dev *dev)
{}

/**
 * pch_udc_pcd_init() - This API initializes the driver structure
 * @dev:	Reference to the driver structure
 *
 * Return codes:
 *	0:		Success
 *	-ERRNO:		All kind of errors when retrieving VBUS GPIO
 */
static int pch_udc_pcd_init(struct pch_udc_dev *dev)
{}

/**
 * init_dma_pools() - create dma pools during initialization
 * @dev:	reference to struct pci_dev
 */
static int init_dma_pools(struct pch_udc_dev *dev)
{}

static int pch_udc_start(struct usb_gadget *g,
		struct usb_gadget_driver *driver)
{}

static int pch_udc_stop(struct usb_gadget *g)
{}

static void pch_vbus_gpio_remove_table(void *table)
{}

static int pch_vbus_gpio_add_table(struct device *d, void *table)
{}

static struct gpiod_lookup_table pch_udc_minnow_vbus_gpio_table =;

static int pch_udc_minnow_platform_init(struct device *d)
{}

static int pch_udc_quark_platform_init(struct device *d)
{}

static void pch_udc_shutdown(struct pci_dev *pdev)
{}

static void pch_udc_remove(struct pci_dev *pdev)
{}

static int __maybe_unused pch_udc_suspend(struct device *d)
{}

static int __maybe_unused pch_udc_resume(struct device *d)
{}

static SIMPLE_DEV_PM_OPS(pch_udc_pm, pch_udc_suspend, pch_udc_resume);

platform_init_fn;

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

static const struct pci_device_id pch_udc_pcidev_id[] =;

MODULE_DEVICE_TABLE(pci, pch_udc_pcidev_id);

static struct pci_driver pch_udc_driver =;

module_pci_driver();

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