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

// SPDX-License-Identifier: GPL-2.0+
/*
 * MAX3420 Device Controller driver for USB.
 *
 * Author: Jaswinder Singh Brar <[email protected]>
 * (C) Copyright 2019-2020 Linaro Ltd
 *
 * Based on:
 *	o MAX3420E datasheet
 *		https://datasheets.maximintegrated.com/en/ds/MAX3420E.pdf
 *	o MAX342{0,1}E Programming Guides
 *		https://pdfserv.maximintegrated.com/en/an/AN3598.pdf
 *		https://pdfserv.maximintegrated.com/en/an/AN3785.pdf
 */

#include <linux/delay.h>
#include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/bitfield.h>
#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/prefetch.h>
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
#include <linux/spi/spi.h>
#include <linux/gpio/consumer.h>

#define MAX3420_MAX_EPS
#define MAX3420_EP_MAX_PACKET
#define MAX3420_EPNAME_SIZE

#define MAX3420_ACKSTAT

#define MAX3420_SPI_DIR_RD
#define MAX3420_SPI_DIR_WR

/* SPI commands: */
#define MAX3420_SPI_DIR_SHIFT
#define MAX3420_SPI_REG_SHIFT

#define MAX3420_REG_EP0FIFO
#define MAX3420_REG_EP1FIFO
#define MAX3420_REG_EP2FIFO
#define MAX3420_REG_EP3FIFO
#define MAX3420_REG_SUDFIFO
#define MAX3420_REG_EP0BC
#define MAX3420_REG_EP1BC
#define MAX3420_REG_EP2BC
#define MAX3420_REG_EP3BC

#define MAX3420_REG_EPSTALLS
	#define ACKSTAT
	#define STLSTAT
	#define STLEP3IN
	#define STLEP2IN
	#define STLEP1OUT
	#define STLEP0OUT
	#define STLEP0IN

#define MAX3420_REG_CLRTOGS
	#define EP3DISAB
	#define EP2DISAB
	#define EP1DISAB
	#define CTGEP3IN
	#define CTGEP2IN
	#define CTGEP1OUT

#define MAX3420_REG_EPIRQ
#define MAX3420_REG_EPIEN
	#define SUDAVIRQ
	#define IN3BAVIRQ
	#define IN2BAVIRQ
	#define OUT1DAVIRQ
	#define OUT0DAVIRQ
	#define IN0BAVIRQ

#define MAX3420_REG_USBIRQ
#define MAX3420_REG_USBIEN
	#define OSCOKIRQ
	#define RWUDNIRQ
	#define BUSACTIRQ
	#define URESIRQ
	#define SUSPIRQ
	#define NOVBUSIRQ
	#define VBUSIRQ
	#define URESDNIRQ

#define MAX3420_REG_USBCTL
	#define HOSCSTEN
	#define VBGATE
	#define CHIPRES
	#define PWRDOWN
	#define CONNECT
	#define SIGRWU

#define MAX3420_REG_CPUCTL
	#define IE

#define MAX3420_REG_PINCTL
	#define EP3INAK
	#define EP2INAK
	#define EP0INAK
	#define FDUPSPI
	#define INTLEVEL
	#define POSINT
	#define GPXB
	#define GPXA

#define MAX3420_REG_REVISION

#define MAX3420_REG_FNADDR
	#define FNADDR_MASK

#define MAX3420_REG_IOPINS
#define MAX3420_REG_IOPINS2
#define MAX3420_REG_GPINIRQ
#define MAX3420_REG_GPINIEN
#define MAX3420_REG_GPINPOL
#define MAX3420_REG_HIRQ
#define MAX3420_REG_HIEN
#define MAX3420_REG_MODE
#define MAX3420_REG_PERADDR
#define MAX3420_REG_HCTL
#define MAX3420_REG_HXFR
#define MAX3420_REG_HRSL

#define ENABLE_IRQ
#define IOPIN_UPDATE
#define REMOTE_WAKEUP
#define CONNECT_HOST
#define HCONNECT
#define HDISCONNECT
#define UDC_START
#define START
#define STOP
#define ENABLE_EP
#define ENABLE
#define DISABLE
#define STALL_EP
#define STALL
#define UNSTALL

#define MAX3420_CMD(c)
#define MAX3420_SPI_CMD_RD(c)
#define MAX3420_SPI_CMD_WR(c)

struct max3420_req {};

struct max3420_ep {};

struct max3420_udc {};

#define to_max3420_req(r)
#define to_max3420_ep(e)
#define to_udc(g)

#define DRIVER_DESC
static const char driver_name[] =;

/* Control endpoint configuration.*/
static const struct usb_endpoint_descriptor ep0_desc =;

static void spi_ack_ctrl(struct max3420_udc *udc)
{}

static u8 spi_rd8_ack(struct max3420_udc *udc, u8 reg, int actstat)
{}

static u8 spi_rd8(struct max3420_udc *udc, u8 reg)
{}

static void spi_wr8_ack(struct max3420_udc *udc, u8 reg, u8 val, int actstat)
{}

static void spi_wr8(struct max3420_udc *udc, u8 reg, u8 val)
{}

static void spi_rd_buf(struct max3420_udc *udc, u8 reg, void *buf, u8 len)
{}

static void spi_wr_buf(struct max3420_udc *udc, u8 reg, void *buf, u8 len)
{}

static int spi_max3420_enable(struct max3420_ep *ep)
{}

static int spi_max3420_stall(struct max3420_ep *ep)
{}

static int spi_max3420_rwkup(struct max3420_udc *udc)
{}

static void max3420_nuke(struct max3420_ep *ep, int status);
static void __max3420_stop(struct max3420_udc *udc)
{}

static void __max3420_start(struct max3420_udc *udc)
{}

static int max3420_start(struct max3420_udc *udc)
{}

static irqreturn_t max3420_vbus_handler(int irq, void *dev_id)
{}

static irqreturn_t max3420_irq_handler(int irq, void *dev_id)
{}

static void max3420_getstatus(struct max3420_udc *udc)
{}

static void max3420_set_clear_feature(struct max3420_udc *udc)
{}

static void max3420_handle_setup(struct max3420_udc *udc)
{}

static void max3420_req_done(struct max3420_req *req, int status)
{}

static int max3420_do_data(struct max3420_udc *udc, int ep_id, int in)
{}

static int max3420_handle_irqs(struct max3420_udc *udc)
{}

static int max3420_thread(void *dev_id)
{}

static int max3420_ep_set_halt(struct usb_ep *_ep, int stall)
{}

static int __max3420_ep_enable(struct max3420_ep *ep,
			       const struct usb_endpoint_descriptor *desc)
{}

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

static void max3420_nuke(struct max3420_ep *ep, int status)
{}

static void __max3420_ep_disable(struct max3420_ep *ep)
{}

static int max3420_ep_disable(struct usb_ep *_ep)
{}

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

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

static int max3420_ep_queue(struct usb_ep *_ep, struct usb_request *_req,
			    gfp_t ignored)
{}

static int max3420_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
{}

static const struct usb_ep_ops max3420_ep_ops =;

static int max3420_wakeup(struct usb_gadget *gadget)
{}

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

static int max3420_udc_stop(struct usb_gadget *gadget)
{}

static const struct usb_gadget_ops max3420_udc_ops =;

static void max3420_eps_init(struct max3420_udc *udc)
{}

static int max3420_probe(struct spi_device *spi)
{}

static void max3420_remove(struct spi_device *spi)
{}

static const struct of_device_id max3420_udc_of_match[] =;
MODULE_DEVICE_TABLE(of, max3420_udc_of_match);

static struct spi_driver max3420_driver =;

module_spi_driver();

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