#undef VERBOSE
#undef PACKET_TRACE
#include <linux/module.h>
#include <linux/moduleparam.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/sl811.h>
#include <linux/usb/hcd.h>
#include <linux/platform_device.h>
#include <linux/prefetch.h>
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/byteorder.h>
#include <asm/unaligned.h>
#include "sl811.h"
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_ALIAS(…) …;
#define DRIVER_VERSION …
#undef USE_B
#define QUIRK3
static const char hcd_name[] = …;
static void port_power(struct sl811 *sl811, int is_on)
{ … }
static void setup_packet(
struct sl811 *sl811,
struct sl811h_ep *ep,
struct urb *urb,
u8 bank,
u8 control
)
{ … }
static void status_packet(
struct sl811 *sl811,
struct sl811h_ep *ep,
struct urb *urb,
u8 bank,
u8 control
)
{ … }
static void in_packet(
struct sl811 *sl811,
struct sl811h_ep *ep,
struct urb *urb,
u8 bank,
u8 control
)
{ … }
static void out_packet(
struct sl811 *sl811,
struct sl811h_ep *ep,
struct urb *urb,
u8 bank,
u8 control
)
{ … }
static inline void sofirq_on(struct sl811 *sl811)
{ … }
static inline void sofirq_off(struct sl811 *sl811)
{ … }
static struct sl811h_ep *start(struct sl811 *sl811, u8 bank)
{ … }
#define MIN_JIFFIES …
static inline void start_transfer(struct sl811 *sl811)
{ … }
static void finish_request(
struct sl811 *sl811,
struct sl811h_ep *ep,
struct urb *urb,
int status
) __releases(sl811->lock) __acquires(sl811->lock)
{ … }
static void
done(struct sl811 *sl811, struct sl811h_ep *ep, u8 bank)
{ … }
#ifdef QUIRK2
static inline u8 checkdone(struct sl811 *sl811)
{
u8 ctl;
u8 irqstat = 0;
if (sl811->active_a && time_before_eq(sl811->jiffies_a, jiffies)) {
ctl = sl811_read(sl811, SL811_EP_A(SL11H_HOSTCTLREG));
if (ctl & SL11H_HCTLMASK_ARM)
sl811_write(sl811, SL811_EP_A(SL11H_HOSTCTLREG), 0);
dev_dbg(sl811_to_hcd(sl811)->self.controller,
"%s DONE_A: ctrl %02x sts %02x\n",
(ctl & SL11H_HCTLMASK_ARM) ? "timeout" : "lost",
ctl,
sl811_read(sl811, SL811_EP_A(SL11H_PKTSTATREG)));
irqstat |= SL11H_INTMASK_DONE_A;
}
#ifdef USE_B
if (sl811->active_b && time_before_eq(sl811->jiffies_b, jiffies)) {
ctl = sl811_read(sl811, SL811_EP_B(SL11H_HOSTCTLREG));
if (ctl & SL11H_HCTLMASK_ARM)
sl811_write(sl811, SL811_EP_B(SL11H_HOSTCTLREG), 0);
dev_dbg(sl811_to_hcd(sl811)->self.controller,
"%s DONE_B: ctrl %02x sts %02x\n",
(ctl & SL11H_HCTLMASK_ARM) ? "timeout" : "lost",
ctl,
sl811_read(sl811, SL811_EP_B(SL11H_PKTSTATREG)));
irqstat |= SL11H_INTMASK_DONE_A;
}
#endif
return irqstat;
}
#endif
static irqreturn_t sl811h_irq(struct usb_hcd *hcd)
{ … }
#define MAX_PERIODIC_LOAD …
static int balance(struct sl811 *sl811, u16 period, u16 load)
{ … }
static int sl811h_urb_enqueue(
struct usb_hcd *hcd,
struct urb *urb,
gfp_t mem_flags
) { … }
static int sl811h_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
{ … }
static void
sl811h_endpoint_disable(struct usb_hcd *hcd, struct usb_host_endpoint *hep)
{ … }
static int
sl811h_get_frame(struct usb_hcd *hcd)
{ … }
static int
sl811h_hub_status_data(struct usb_hcd *hcd, char *buf)
{ … }
static void
sl811h_hub_descriptor (
struct sl811 *sl811,
struct usb_hub_descriptor *desc
) { … }
static void
sl811h_timer(struct timer_list *t)
{ … }
static int
sl811h_hub_control(
struct usb_hcd *hcd,
u16 typeReq,
u16 wValue,
u16 wIndex,
char *buf,
u16 wLength
) { … }
#ifdef CONFIG_PM
static int
sl811h_bus_suspend(struct usb_hcd *hcd)
{ … }
static int
sl811h_bus_resume(struct usb_hcd *hcd)
{ … }
#else
#define sl811h_bus_suspend …
#define sl811h_bus_resume …
#endif
static void dump_irq(struct seq_file *s, char *label, u8 mask)
{ … }
static int sl811h_debug_show(struct seq_file *s, void *unused)
{ … }
DEFINE_SHOW_ATTRIBUTE(…);
static void create_debug_file(struct sl811 *sl811)
{ … }
static void remove_debug_file(struct sl811 *sl811)
{ … }
static void
sl811h_stop(struct usb_hcd *hcd)
{ … }
static int
sl811h_start(struct usb_hcd *hcd)
{ … }
static const struct hc_driver sl811h_hc_driver = …;
static void
sl811h_remove(struct platform_device *dev)
{ … }
static int
sl811h_probe(struct platform_device *dev)
{ … }
#ifdef CONFIG_PM
static int
sl811h_suspend(struct platform_device *dev, pm_message_t state)
{ … }
static int
sl811h_resume(struct platform_device *dev)
{ … }
#else
#define sl811h_suspend …
#define sl811h_resume …
#endif
struct platform_driver sl811h_driver = …;
EXPORT_SYMBOL(…);
module_platform_driver(…) …;