#include <linux/jiffies.h>
#include <linux/module.h>
#include <linux/spi/spi.h>
#include <linux/usb.h>
#include <linux/usb/hcd.h>
#include <linux/of.h>
#include <linux/platform_data/max3421-hcd.h>
#define DRIVER_DESC …
#define DRIVER_VERSION …
#define USB_MAX_FRAME_NUMBER …
#define USB_MAX_RETRIES …
#define POWER_BUDGET …
#define PORT_C_MASK …
#define MAX3421_GPOUT_COUNT …
enum max3421_rh_state { … };
enum pkt_state { … };
enum scheduling_pass { … };
enum { … };
struct max3421_dma_buf { … };
struct max3421_hcd { … };
struct max3421_ep { … };
#define MAX3421_FIFO_SIZE …
#define MAX3421_SPI_DIR_RD …
#define MAX3421_SPI_DIR_WR …
#define MAX3421_SPI_DIR_SHIFT …
#define MAX3421_SPI_REG_SHIFT …
#define MAX3421_REG_RCVFIFO …
#define MAX3421_REG_SNDFIFO …
#define MAX3421_REG_SUDFIFO …
#define MAX3421_REG_RCVBC …
#define MAX3421_REG_SNDBC …
#define MAX3421_REG_USBIRQ …
#define MAX3421_REG_USBIEN …
#define MAX3421_REG_USBCTL …
#define MAX3421_REG_CPUCTL …
#define MAX3421_REG_PINCTL …
#define MAX3421_REG_REVISION …
#define MAX3421_REG_IOPINS1 …
#define MAX3421_REG_IOPINS2 …
#define MAX3421_REG_GPINIRQ …
#define MAX3421_REG_GPINIEN …
#define MAX3421_REG_GPINPOL …
#define MAX3421_REG_HIRQ …
#define MAX3421_REG_HIEN …
#define MAX3421_REG_MODE …
#define MAX3421_REG_PERADDR …
#define MAX3421_REG_HCTL …
#define MAX3421_REG_HXFR …
#define MAX3421_REG_HRSL …
enum { … };
enum { … };
enum { … };
enum { … };
enum { … };
enum { … };
enum { … };
enum { … };
static const int hrsl_to_error[] = …;
#define MAX3421_HXFR_BULK_IN(ep) …
#define MAX3421_HXFR_SETUP …
#define MAX3421_HXFR_BULK_OUT(ep) …
#define MAX3421_HXFR_ISO_IN(ep) …
#define MAX3421_HXFR_ISO_OUT(ep) …
#define MAX3421_HXFR_HS_IN …
#define MAX3421_HXFR_HS_OUT …
#define field(val, bit) …
static inline s16
frame_diff(u16 left, u16 right)
{ … }
static inline struct max3421_hcd *
hcd_to_max3421(struct usb_hcd *hcd)
{ … }
static inline struct usb_hcd *
max3421_to_hcd(struct max3421_hcd *max3421_hcd)
{ … }
static u8
spi_rd8(struct usb_hcd *hcd, unsigned int reg)
{ … }
static void
spi_wr8(struct usb_hcd *hcd, unsigned int reg, u8 val)
{ … }
static void
spi_rd_buf(struct usb_hcd *hcd, unsigned int reg, void *buf, size_t len)
{ … }
static void
spi_wr_buf(struct usb_hcd *hcd, unsigned int reg, void *buf, size_t len)
{ … }
static void
max3421_set_speed(struct usb_hcd *hcd, struct usb_device *dev)
{ … }
static void
max3421_set_address(struct usb_hcd *hcd, struct usb_device *dev, int epnum)
{ … }
static int
max3421_ctrl_setup(struct usb_hcd *hcd, struct urb *urb)
{ … }
static int
max3421_transfer_in(struct usb_hcd *hcd, struct urb *urb)
{ … }
static int
max3421_transfer_out(struct usb_hcd *hcd, struct urb *urb, int fast_retransmit)
{ … }
static void
max3421_next_transfer(struct usb_hcd *hcd, int fast_retransmit)
{ … }
static int
max3421_select_and_start_urb(struct usb_hcd *hcd)
{ … }
static int
max3421_check_unlink(struct usb_hcd *hcd)
{ … }
static void
max3421_slow_retransmit(struct usb_hcd *hcd)
{ … }
static void
max3421_recv_data_available(struct usb_hcd *hcd)
{ … }
static void
max3421_handle_error(struct usb_hcd *hcd, u8 hrsl)
{ … }
static int
max3421_transfer_in_done(struct usb_hcd *hcd, struct urb *urb)
{ … }
static int
max3421_transfer_out_done(struct usb_hcd *hcd, struct urb *urb)
{ … }
static void
max3421_host_transfer_done(struct usb_hcd *hcd)
{ … }
static void
max3421_detect_conn(struct usb_hcd *hcd)
{ … }
static irqreturn_t
max3421_irq_handler(int irq, void *dev_id)
{ … }
#ifdef DEBUG
static void
dump_eps(struct usb_hcd *hcd)
{
struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
struct max3421_ep *max3421_ep;
struct usb_host_endpoint *ep;
char ubuf[512], *dp, *end;
unsigned long flags;
struct urb *urb;
int epnum, ret;
spin_lock_irqsave(&max3421_hcd->lock, flags);
list_for_each_entry(max3421_ep, &max3421_hcd->ep_list, ep_list) {
ep = max3421_ep->ep;
dp = ubuf;
end = dp + sizeof(ubuf);
*dp = '\0';
list_for_each_entry(urb, &ep->urb_list, urb_list) {
ret = scnprintf(dp, end - dp, " %p(%d.%s %d/%d)", urb,
usb_pipetype(urb->pipe),
usb_urb_dir_in(urb) ? "IN" : "OUT",
urb->actual_length,
urb->transfer_buffer_length);
if (ret == end - dp - 1)
break;
dp += ret;
}
epnum = usb_endpoint_num(&ep->desc);
pr_info("EP%0u %u lst %04u rtr %u nak %6u rxmt %u: %s\n",
epnum, max3421_ep->pkt_state, max3421_ep->last_active,
max3421_ep->retries, max3421_ep->naks,
max3421_ep->retransmit, ubuf);
}
spin_unlock_irqrestore(&max3421_hcd->lock, flags);
}
#endif
static int
max3421_handle_irqs(struct usb_hcd *hcd)
{ … }
static int
max3421_reset_hcd(struct usb_hcd *hcd)
{ … }
static int
max3421_urb_done(struct usb_hcd *hcd)
{ … }
static int
max3421_spi_thread(void *dev_id)
{ … }
static int
max3421_reset_port(struct usb_hcd *hcd)
{ … }
static int
max3421_reset(struct usb_hcd *hcd)
{ … }
static int
max3421_start(struct usb_hcd *hcd)
{ … }
static void
max3421_stop(struct usb_hcd *hcd)
{ … }
static int
max3421_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags)
{ … }
static int
max3421_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
{ … }
static void
max3421_endpoint_disable(struct usb_hcd *hcd, struct usb_host_endpoint *ep)
{ … }
static int
max3421_get_frame_number(struct usb_hcd *hcd)
{ … }
static int
max3421_hub_status_data(struct usb_hcd *hcd, char *buf)
{ … }
static inline void
hub_descriptor(struct usb_hub_descriptor *desc)
{ … }
static void
max3421_gpout_set_value(struct usb_hcd *hcd, u8 pin_number, u8 value)
{ … }
static int
max3421_hub_control(struct usb_hcd *hcd, u16 type_req, u16 value, u16 index,
char *buf, u16 length)
{ … }
static int
max3421_bus_suspend(struct usb_hcd *hcd)
{ … }
static int
max3421_bus_resume(struct usb_hcd *hcd)
{ … }
static const struct hc_driver max3421_hcd_desc = …;
static int
max3421_of_vbus_en_pin(struct device *dev, struct max3421_hcd_platform_data *pdata)
{ … }
static int
max3421_probe(struct spi_device *spi)
{ … }
static void
max3421_remove(struct spi_device *spi)
{ … }
static const struct of_device_id max3421_of_match_table[] = …;
MODULE_DEVICE_TABLE(of, max3421_of_match_table);
static struct spi_driver max3421_driver = …;
module_spi_driver(…) …;
MODULE_DESCRIPTION(…);
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;