#include <linux/module.h>
#include <linux/pci.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/timer.h>
#include <linux/list.h>
#include <linux/interrupt.h>
#include <linux/usb.h>
#include <linux/usb/hcd.h>
#include <linux/moduleparam.h>
#include <linux/dma-mapping.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include <asm/irq.h>
#include <asm/unaligned.h>
#include <linux/irq.h>
#include <linux/platform_device.h>
#define DRIVER_VERSION …
#define OXU_DEVICEID …
#define OXU_REV_MASK …
#define OXU_REV_SHIFT …
#define OXU_REV_2100 …
#define OXU_BO_SHIFT …
#define OXU_BO_MASK …
#define OXU_MAJ_REV_SHIFT …
#define OXU_MAJ_REV_MASK …
#define OXU_MIN_REV_SHIFT …
#define OXU_MIN_REV_MASK …
#define OXU_HOSTIFCONFIG …
#define OXU_SOFTRESET …
#define OXU_SRESET …
#define OXU_PIOBURSTREADCTRL …
#define OXU_CHIPIRQSTATUS …
#define OXU_CHIPIRQEN_SET …
#define OXU_CHIPIRQEN_CLR …
#define OXU_USBSPHLPWUI …
#define OXU_USBOTGLPWUI …
#define OXU_USBSPHI …
#define OXU_USBOTGI …
#define OXU_CLKCTRL_SET …
#define OXU_SYSCLKEN …
#define OXU_USBSPHCLKEN …
#define OXU_USBOTGCLKEN …
#define OXU_ASO …
#define OXU_SPHPOEN …
#define OXU_OVRCCURPUPDEN …
#define OXU_ASO_OP …
#define OXU_COMPARATOR …
#define OXU_USBMODE …
#define OXU_VBPS …
#define OXU_ES_LITTLE …
#define OXU_CM_HOST_ONLY …
#define EHCI_TUNE_CERR …
#define EHCI_TUNE_RL_HS …
#define EHCI_TUNE_RL_TT …
#define EHCI_TUNE_MULT_HS …
#define EHCI_TUNE_MULT_TT …
#define EHCI_TUNE_FLS …
struct oxu_hcd;
struct ehci_caps { … } __packed;
struct ehci_regs { … } __packed;
#define QTD_NEXT(dma) …
struct ehci_qtd { … } __aligned(…);
#define QTD_MASK …
#define IS_SHORT_READ(token) …
#define Q_NEXT_TYPE(dma) …
#define Q_TYPE_QH …
#define QH_NEXT(dma) …
#define EHCI_LIST_END …
ehci_shadow;
struct ehci_qh { … } __aligned(…);
#define OXU_OTG_CORE_OFFSET …
#define OXU_OTG_CAP_OFFSET …
#define OXU_SPH_CORE_OFFSET …
#define OXU_SPH_CAP_OFFSET …
#define OXU_OTG_MEM …
#define OXU_SPH_MEM …
#define DEFAULT_I_TDPS …
#define QHEAD_NUM …
#define QTD_NUM …
#define SITD_NUM …
#define MURB_NUM …
#define BUFFER_NUM …
#define BUFFER_SIZE …
struct oxu_info { … };
struct oxu_buf { … } __aligned(…);
struct oxu_onchip_mem { … } __aligned(…);
#define EHCI_MAX_ROOT_PORTS …
struct oxu_murb { … };
struct oxu_hcd { … };
#define EHCI_IAA_JIFFIES …
#define EHCI_IO_JIFFIES …
#define EHCI_ASYNC_JIFFIES …
#define EHCI_SHRINK_JIFFIES …
enum ehci_timer_action { … };
#define oxu_dbg(oxu, fmt, args...) …
#define oxu_err(oxu, fmt, args...) …
#define oxu_info(oxu, fmt, args...) …
#ifdef CONFIG_DYNAMIC_DEBUG
#define DEBUG
#endif
static inline struct usb_hcd *oxu_to_hcd(struct oxu_hcd *oxu)
{ … }
static inline struct oxu_hcd *hcd_to_oxu(struct usb_hcd *hcd)
{ … }
#undef OXU_URB_TRACE
#undef OXU_VERBOSE_DEBUG
#ifdef OXU_VERBOSE_DEBUG
#define oxu_vdbg …
#else
#define oxu_vdbg(oxu, fmt, args...) …
#endif
#ifdef DEBUG
static int __attribute__((__unused__))
dbg_status_buf(char *buf, unsigned len, const char *label, u32 status)
{ … }
static int __attribute__((__unused__))
dbg_intr_buf(char *buf, unsigned len, const char *label, u32 enable)
{ … }
static const char *const fls_strings[] = …;
static int dbg_command_buf(char *buf, unsigned len,
const char *label, u32 command)
{ … }
static int dbg_port_buf(char *buf, unsigned len, const char *label,
int port, u32 status)
{ … }
#else
static inline int __attribute__((__unused__))
dbg_status_buf(char *buf, unsigned len, const char *label, u32 status)
{ return 0; }
static inline int __attribute__((__unused__))
dbg_command_buf(char *buf, unsigned len, const char *label, u32 command)
{ return 0; }
static inline int __attribute__((__unused__))
dbg_intr_buf(char *buf, unsigned len, const char *label, u32 enable)
{ return 0; }
static inline int __attribute__((__unused__))
dbg_port_buf(char *buf, unsigned len, const char *label, int port, u32 status)
{ return 0; }
#endif
#define dbg_status(oxu, label, status) …
#define dbg_cmd(oxu, label, command) …
#define dbg_port(oxu, label, port, status) …
static int log2_irq_thresh;
module_param(log2_irq_thresh, int, S_IRUGO);
MODULE_PARM_DESC(…) …;
static unsigned park;
module_param(park, uint, S_IRUGO);
MODULE_PARM_DESC(…) …;
static bool ignore_oc;
module_param(ignore_oc, bool, S_IRUGO);
MODULE_PARM_DESC(…) …;
static void ehci_work(struct oxu_hcd *oxu);
static int oxu_hub_control(struct usb_hcd *hcd,
u16 typeReq, u16 wValue, u16 wIndex,
char *buf, u16 wLength);
static inline u32 oxu_readl(void __iomem *base, u32 reg)
{ … }
static inline void oxu_writel(void __iomem *base, u32 reg, u32 val)
{ … }
static inline void timer_action_done(struct oxu_hcd *oxu,
enum ehci_timer_action action)
{ … }
static inline void timer_action(struct oxu_hcd *oxu,
enum ehci_timer_action action)
{ … }
static int handshake(struct oxu_hcd *oxu, void __iomem *ptr,
u32 mask, u32 done, int usec)
{ … }
static int ehci_halt(struct oxu_hcd *oxu)
{ … }
static void tdi_reset(struct oxu_hcd *oxu)
{ … }
static int ehci_reset(struct oxu_hcd *oxu)
{ … }
static void ehci_quiesce(struct oxu_hcd *oxu)
{ … }
static int check_reset_complete(struct oxu_hcd *oxu, int index,
u32 __iomem *status_reg, int port_status)
{ … }
static void ehci_hub_descriptor(struct oxu_hcd *oxu,
struct usb_hub_descriptor *desc)
{ … }
static int oxu_buf_alloc(struct oxu_hcd *oxu, struct ehci_qtd *qtd, int len)
{ … }
static void oxu_buf_free(struct oxu_hcd *oxu, struct ehci_qtd *qtd)
{ … }
static inline void ehci_qtd_init(struct ehci_qtd *qtd, dma_addr_t dma)
{ … }
static inline void oxu_qtd_free(struct oxu_hcd *oxu, struct ehci_qtd *qtd)
{ … }
static struct ehci_qtd *ehci_qtd_alloc(struct oxu_hcd *oxu)
{ … }
static void oxu_qh_free(struct oxu_hcd *oxu, struct ehci_qh *qh)
{ … }
static void qh_destroy(struct kref *kref)
{ … }
static struct ehci_qh *oxu_qh_alloc(struct oxu_hcd *oxu)
{ … }
static inline struct ehci_qh *qh_get(struct ehci_qh *qh)
{ … }
static inline void qh_put(struct ehci_qh *qh)
{ … }
static void oxu_murb_free(struct oxu_hcd *oxu, struct oxu_murb *murb)
{ … }
static struct oxu_murb *oxu_murb_alloc(struct oxu_hcd *oxu)
{ … }
static void ehci_mem_cleanup(struct oxu_hcd *oxu)
{ … }
static int ehci_mem_init(struct oxu_hcd *oxu, gfp_t flags)
{ … }
static int qtd_fill(struct ehci_qtd *qtd, dma_addr_t buf, size_t len,
int token, int maxpacket)
{ … }
static inline void qh_update(struct oxu_hcd *oxu,
struct ehci_qh *qh, struct ehci_qtd *qtd)
{ … }
static void qh_refresh(struct oxu_hcd *oxu, struct ehci_qh *qh)
{ … }
static void qtd_copy_status(struct oxu_hcd *oxu, struct urb *urb,
size_t length, u32 token)
{ … }
static void ehci_urb_done(struct oxu_hcd *oxu, struct urb *urb)
__releases(oxu->lock)
__acquires(oxu->lock)
{ … }
static void start_unlink_async(struct oxu_hcd *oxu, struct ehci_qh *qh);
static void unlink_async(struct oxu_hcd *oxu, struct ehci_qh *qh);
static void intr_deschedule(struct oxu_hcd *oxu, struct ehci_qh *qh);
static int qh_schedule(struct oxu_hcd *oxu, struct ehci_qh *qh);
#define HALT_BIT …
static unsigned qh_completions(struct oxu_hcd *oxu, struct ehci_qh *qh)
{ … }
#define hb_mult(wMaxPacketSize) …
#define max_packet(wMaxPacketSize) …
static void qtd_list_free(struct oxu_hcd *oxu,
struct urb *urb, struct list_head *head)
{ … }
static struct list_head *qh_urb_transaction(struct oxu_hcd *oxu,
struct urb *urb,
struct list_head *head,
gfp_t flags)
{ … }
static struct ehci_qh *qh_make(struct oxu_hcd *oxu,
struct urb *urb, gfp_t flags)
{ … }
static void qh_link_async(struct oxu_hcd *oxu, struct ehci_qh *qh)
{ … }
#define QH_ADDR_MASK …
static struct ehci_qh *qh_append_tds(struct oxu_hcd *oxu,
struct urb *urb, struct list_head *qtd_list,
int epnum, void **ptr)
{ … }
static int submit_async(struct oxu_hcd *oxu, struct urb *urb,
struct list_head *qtd_list, gfp_t mem_flags)
{ … }
static void end_unlink_async(struct oxu_hcd *oxu)
{ … }
static void start_unlink_async(struct oxu_hcd *oxu, struct ehci_qh *qh)
{ … }
static void scan_async(struct oxu_hcd *oxu)
{ … }
static union ehci_shadow *periodic_next_shadow(union ehci_shadow *periodic,
__le32 tag)
{ … }
static void periodic_unlink(struct oxu_hcd *oxu, unsigned frame, void *ptr)
{ … }
static unsigned short periodic_usecs(struct oxu_hcd *oxu,
unsigned frame, unsigned uframe)
{ … }
static int enable_periodic(struct oxu_hcd *oxu)
{ … }
static int disable_periodic(struct oxu_hcd *oxu)
{ … }
static int qh_link_periodic(struct oxu_hcd *oxu, struct ehci_qh *qh)
{ … }
static void qh_unlink_periodic(struct oxu_hcd *oxu, struct ehci_qh *qh)
{ … }
static void intr_deschedule(struct oxu_hcd *oxu, struct ehci_qh *qh)
{ … }
static int check_period(struct oxu_hcd *oxu,
unsigned frame, unsigned uframe,
unsigned period, unsigned usecs)
{ … }
static int check_intr_schedule(struct oxu_hcd *oxu,
unsigned frame, unsigned uframe,
const struct ehci_qh *qh, __le32 *c_maskp)
{ … }
static int qh_schedule(struct oxu_hcd *oxu, struct ehci_qh *qh)
{ … }
static int intr_submit(struct oxu_hcd *oxu, struct urb *urb,
struct list_head *qtd_list, gfp_t mem_flags)
{ … }
static inline int itd_submit(struct oxu_hcd *oxu, struct urb *urb,
gfp_t mem_flags)
{ … }
static inline int sitd_submit(struct oxu_hcd *oxu, struct urb *urb,
gfp_t mem_flags)
{ … }
static void scan_periodic(struct oxu_hcd *oxu)
{ … }
static void ehci_turn_off_all_ports(struct oxu_hcd *oxu)
{ … }
static void ehci_port_power(struct oxu_hcd *oxu, int is_on)
{ … }
static void ehci_work(struct oxu_hcd *oxu)
{ … }
static void unlink_async(struct oxu_hcd *oxu, struct ehci_qh *qh)
{ … }
static irqreturn_t oxu210_hcd_irq(struct usb_hcd *hcd)
{ … }
static irqreturn_t oxu_irq(struct usb_hcd *hcd)
{ … }
static void oxu_watchdog(struct timer_list *t)
{ … }
static int oxu_hcd_init(struct usb_hcd *hcd)
{ … }
static int oxu_reset(struct usb_hcd *hcd)
{ … }
static int oxu_run(struct usb_hcd *hcd)
{ … }
static void oxu_stop(struct usb_hcd *hcd)
{ … }
static void oxu_shutdown(struct usb_hcd *hcd)
{ … }
static int __oxu_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
gfp_t mem_flags)
{ … }
static int oxu_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
gfp_t mem_flags)
{ … }
static int oxu_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
{ … }
static void oxu_endpoint_disable(struct usb_hcd *hcd,
struct usb_host_endpoint *ep)
{ … }
static int oxu_get_frame(struct usb_hcd *hcd)
{ … }
static int oxu_hub_status_data(struct usb_hcd *hcd, char *buf)
{ … }
static inline unsigned int oxu_port_speed(struct oxu_hcd *oxu,
unsigned int portsc)
{ … }
#define PORT_WAKE_BITS …
static int oxu_hub_control(struct usb_hcd *hcd, u16 typeReq,
u16 wValue, u16 wIndex, char *buf, u16 wLength)
{ … }
#ifdef CONFIG_PM
static int oxu_bus_suspend(struct usb_hcd *hcd)
{ … }
static int oxu_bus_resume(struct usb_hcd *hcd)
{ … }
#else
static int oxu_bus_suspend(struct usb_hcd *hcd)
{
return 0;
}
static int oxu_bus_resume(struct usb_hcd *hcd)
{
return 0;
}
#endif
static const struct hc_driver oxu_hc_driver = …;
static void oxu_configuration(struct platform_device *pdev, void __iomem *base)
{ … }
static int oxu_verify_id(struct platform_device *pdev, void __iomem *base)
{ … }
static const struct hc_driver oxu_hc_driver;
static struct usb_hcd *oxu_create(struct platform_device *pdev,
unsigned long memstart, unsigned long memlen,
void __iomem *base, int irq, int otg)
{ … }
static int oxu_init(struct platform_device *pdev,
unsigned long memstart, unsigned long memlen,
void __iomem *base, int irq)
{ … }
static int oxu_drv_probe(struct platform_device *pdev)
{ … }
static void oxu_remove(struct platform_device *pdev, struct usb_hcd *hcd)
{ … }
static void oxu_drv_remove(struct platform_device *pdev)
{ … }
static void oxu_drv_shutdown(struct platform_device *pdev)
{ … }
#if 0
static int oxu_drv_suspend(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct usb_hcd *hcd = dev_get_drvdata(dev);
return 0;
}
static int oxu_drv_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct usb_hcd *hcd = dev_get_drvdata(dev);
return 0;
}
#else
#define oxu_drv_suspend …
#define oxu_drv_resume …
#endif
static struct platform_driver oxu_driver = …;
module_platform_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;