USB driver updates, the driver passes usbtests 1-10 now

SVN-Revision: 9592
This commit is contained in:
Gabor Juhos 2007-11-23 15:53:35 +00:00
parent 60898bc0c5
commit 5a1a5dcf58
6 changed files with 959 additions and 463 deletions

View file

@ -33,8 +33,6 @@ static inline char *ed_statestring(int state)
return "UNLINK"; return "UNLINK";
case ED_OPER: case ED_OPER:
return "OPER"; return "OPER";
case ED_NEW:
return "NEW";
} }
return "?STATE"; return "?STATE";
} }
@ -70,6 +68,8 @@ static inline char *td_togglestring(u32 info)
return "?TOGGLE"; return "?TOGGLE";
} }
/*-------------------------------------------------------------------------*/
#ifdef DEBUG #ifdef DEBUG
/* debug| print the main components of an URB /* debug| print the main components of an URB
@ -81,7 +81,7 @@ urb_print(struct admhcd *ahcd, struct urb * urb, char * str, int small)
unsigned int pipe = urb->pipe; unsigned int pipe = urb->pipe;
if (!urb->dev || !urb->dev->bus) { if (!urb->dev || !urb->dev->bus) {
admhc_dbg(ahcd, "%s URB: no dev", str); admhc_dbg("%s URB: no dev", str);
return; return;
} }
@ -89,7 +89,7 @@ urb_print(struct admhcd *ahcd, struct urb * urb, char * str, int small)
if (urb->status != 0) if (urb->status != 0)
#endif #endif
admhc_dbg(ahcd, "URB-%s %p dev=%d ep=%d%s-%s flags=%x len=%d/%d " admhc_dbg(ahcd, "URB-%s %p dev=%d ep=%d%s-%s flags=%x len=%d/%d "
"stat=%d\n", "stat=%d",
str, str,
urb, urb,
usb_pipedevice (pipe), usb_pipedevice (pipe),
@ -106,20 +106,20 @@ urb_print(struct admhcd *ahcd, struct urb * urb, char * str, int small)
int i, len; int i, len;
if (usb_pipecontrol(pipe)) { if (usb_pipecontrol(pipe)) {
admhc_dbg(admhc, "setup(8): "); admhc_dbg(ahcd, "setup(8):");
for (i = 0; i < 8 ; i++) for (i = 0; i < 8 ; i++)
printk (" %02x", ((__u8 *) urb->setup_packet) [i]); printk (" %02x", ((__u8 *) urb->setup_packet) [i]);
printk ("\n"); printk ("\n");
} }
if (urb->transfer_buffer_length > 0 && urb->transfer_buffer) { if (urb->transfer_buffer_length > 0 && urb->transfer_buffer) {
admhc_dbg(admhc, "data(%d/%d): ", printk(KERN_DEBUG __FILE__ ": data(%d/%d):",
urb->actual_length, urb->actual_length,
urb->transfer_buffer_length); urb->transfer_buffer_length);
len = usb_pipeout(pipe)? len = usb_pipeout(pipe)?
urb->transfer_buffer_length: urb->actual_length; urb->transfer_buffer_length: urb->actual_length;
for (i = 0; i < 16 && i < len; i++) for (i = 0; i < 16 && i < len; i++)
printk (" %02x", ((__u8 *) urb->transfer_buffer) [i]); printk (" %02x", ((__u8 *) urb->transfer_buffer) [i]);
printk ("%s stat:%d\n", i < len? "...": "", urb->status); admhc_dbg("%s stat:%d\n", i < len? "...": "", urb->status);
} }
} }
#endif /* ADMHC_VERBOSE_DEBUG */ #endif /* ADMHC_VERBOSE_DEBUG */
@ -318,18 +318,6 @@ static void admhc_dump_td(const struct admhcd *ahcd, const char *label,
(tmp & TD_IE) ? " IE" : ""); (tmp & TD_IE) ? " IE" : "");
} }
static void admhc_dump_up(const struct admhcd *ahcd, const char *label,
const struct urb_priv *up)
{
int i;
admhc_dbg(ahcd, "%s urb/%p:\n", label, up->urb);
for (i = 0; i < up->td_cnt; i++) {
struct td *td = up->td[i];
admhc_dump_td(ahcd, " ->", td);
}
}
/* caller MUST own hcd spinlock if verbose is set! */ /* caller MUST own hcd spinlock if verbose is set! */
static void __attribute__((unused)) static void __attribute__((unused))
admhc_dump_ed(const struct admhcd *ahcd, const char *label, admhc_dump_ed(const struct admhcd *ahcd, const char *label,
@ -352,22 +340,23 @@ admhc_dump_ed(const struct admhcd *ahcd, const char *label,
ED_FA_GET(tmp)); ED_FA_GET(tmp));
tmp = hc32_to_cpup(ahcd, &ed->hwHeadP); tmp = hc32_to_cpup(ahcd, &ed->hwHeadP);
admhc_dbg(ahcd, " tds: head %08x tail %08x %s%s\n", admhc_dbg(ahcd, " tds: head %08x tail %08x %s%s%s\n",
tmp & TD_MASK, tmp & TD_MASK,
hc32_to_cpup (ahcd, &ed->hwTailP), hc32_to_cpup (ahcd, &ed->hwTailP),
(tmp & ED_C) ? data1 : data0, (tmp & ED_C) ? data1 : data0,
(tmp & ED_H) ? " HALT" : ""); (tmp & ED_H) ? " HALT" : "",
verbose ? " td list follows" : " (not listing)");
if (ed->urb_active) if (verbose) {
admhc_dump_up(ahcd, " active ", ed->urb_active); struct list_head *tmp;
if ((verbose) && (!list_empty(&ed->urb_pending))) { /* use ed->td_list because HC concurrently modifies
struct list_head *entry; * hwNextTD as it accumulates ed_donelist.
/* dump pending URBs */ */
list_for_each(entry, &ed->urb_pending) { list_for_each(tmp, &ed->td_list) {
struct urb_priv *up; struct td *td;
up = list_entry(entry, struct urb_priv, pending); td = list_entry(tmp, struct td, td_list);
admhc_dump_up(ahcd, " pending ", up); admhc_dump_td (ahcd, " ->", td);
} }
} }
} }
@ -375,8 +364,6 @@ admhc_dump_ed(const struct admhcd *ahcd, const char *label,
#else /* ifdef DEBUG */ #else /* ifdef DEBUG */
static inline void urb_print(struct urb * urb, char * str, int small) {} static inline void urb_print(struct urb * urb, char * str, int small) {}
static inline void admhc_dump_up(const struct admhcd *ahcd, const char *label,
const struct urb_priv *up) {}
static inline void admhc_dump_ed(const struct admhcd *ahcd, const char *label, static inline void admhc_dump_ed(const struct admhcd *ahcd, const char *label,
const struct ed *ed, int verbose) {} const struct ed *ed, int verbose) {}
static inline void admhc_dump_td(const struct admhcd *ahcd, const char *label, static inline void admhc_dump_td(const struct admhcd *ahcd, const char *label,
@ -396,44 +383,6 @@ static inline void remove_debug_files(struct admhcd *bus) { }
#else #else
static ssize_t
show_urb_priv(struct admhcd *ahcd, char *buf, size_t count,
struct urb_priv *up)
{
unsigned temp, size = count;
int i;
if (!up)
return 0;
temp = scnprintf(buf, size,"\n\turb %p ", up->urb);
size -= temp;
buf += temp;
for (i = 0; i< up->td_cnt; i++) {
struct td *td;
u32 dbp, cbl, info;
td = up->td[i];
info = hc32_to_cpup(ahcd, &td->hwINFO);
dbp = hc32_to_cpup(ahcd, &td->hwDBP);
cbl = hc32_to_cpup(ahcd, &td->hwCBL);
temp = scnprintf(buf, size,
"\n\t\ttd %p %s %d %s%scc=%x (%08x,%08x)",
td,
td_pidstring(info),
TD_BL_GET(cbl),
(info & TD_OWN) ? "WORK " : "DONE ",
(cbl & TD_IE) ? "IE " : "",
TD_CC_GET(info), info, cbl);
size -= temp;
buf += temp;
}
return count - size;
}
static ssize_t static ssize_t
show_list(struct admhcd *ahcd, char *buf, size_t count, struct ed *ed) show_list(struct admhcd *ahcd, char *buf, size_t count, struct ed *ed)
{ {
@ -446,10 +395,15 @@ show_list(struct admhcd *ahcd, char *buf, size_t count, struct ed *ed)
while (ed) { while (ed) {
u32 info = hc32_to_cpu(ahcd, ed->hwINFO); u32 info = hc32_to_cpu(ahcd, ed->hwINFO);
u32 headp = hc32_to_cpu(ahcd, ed->hwHeadP); u32 headp = hc32_to_cpu(ahcd, ed->hwHeadP);
u32 tailp = hc32_to_cpu(ahcd, ed->hwTailP);
struct list_head *entry;
struct td *td;
temp = scnprintf(buf, size, temp = scnprintf(buf, size,
"ed/%p %s %cs dev%d ep%d %s%smax %d %08x%s%s %s", "ed/%p %s %s %cs dev%d ep%d %s%smax %d %08x%s%s %s"
" h:%08x t:%08x",
ed, ed,
ed_statestring(ed->state),
ed_typestring (ed->type), ed_typestring (ed->type),
(info & ED_SPEED_FULL) ? 'f' : 'l', (info & ED_SPEED_FULL) ? 'f' : 'l',
info & ED_FA_MASK, info & ED_FA_MASK,
@ -460,36 +414,29 @@ show_list(struct admhcd *ahcd, char *buf, size_t count, struct ed *ed)
info, info,
(info & ED_SKIP) ? " S" : "", (info & ED_SKIP) ? " S" : "",
(headp & ED_H) ? " H" : "", (headp & ED_H) ? " H" : "",
(headp & ED_C) ? "DATA1" : "DATA0"); (headp & ED_C) ? data1 : data0,
headp & ED_MASK,tailp);
size -= temp; size -= temp;
buf += temp; buf += temp;
if (ed->urb_active) { list_for_each(entry, &ed->td_list) {
temp = scnprintf(buf, size, "\nactive urb:"); u32 dbp, cbl;
td = list_entry(entry, struct td, td_list);
info = hc32_to_cpup (ahcd, &td->hwINFO);
dbp = hc32_to_cpup (ahcd, &td->hwDBP);
cbl = hc32_to_cpup (ahcd, &td->hwCBL);
temp = scnprintf(buf, size,
"\n\ttd/%p %s %d %s%scc=%x urb %p (%08x,%08x)",
td,
td_pidstring(info),
TD_BL_GET(cbl),
(info & TD_OWN) ? "" : "DONE ",
(cbl & TD_IE) ? "IE " : "",
TD_CC_GET (info), td->urb, info, cbl);
size -= temp; size -= temp;
buf += temp; buf += temp;
temp = show_urb_priv(ahcd, buf, size, ed->urb_active);
size -= temp;
buf += temp;
}
if (!list_empty(&ed->urb_pending)) {
struct list_head *entry;
temp = scnprintf(buf, size, "\npending urbs:");
size -= temp;
buf += temp;
list_for_each(entry, &ed->urb_pending) {
struct urb_priv *up;
up = list_entry(entry, struct urb_priv,
pending);
temp = show_urb_priv(ahcd, buf, size, up);
size -= temp;
buf += temp;
}
} }
temp = scnprintf(buf, size, "\n"); temp = scnprintf(buf, size, "\n");
@ -498,7 +445,6 @@ show_list(struct admhcd *ahcd, char *buf, size_t count, struct ed *ed)
ed = ed->ed_next; ed = ed->ed_next;
} }
return count - size; return count - size;
} }
@ -524,6 +470,108 @@ show_async(struct class_device *class_dev, char *buf)
} }
static CLASS_DEVICE_ATTR(async, S_IRUGO, show_async, NULL); static CLASS_DEVICE_ATTR(async, S_IRUGO, show_async, NULL);
#define DBG_SCHED_LIMIT 64
static ssize_t
show_periodic(struct class_device *class_dev, char *buf)
{
struct usb_bus *bus;
struct usb_hcd *hcd;
struct admhcd *ahcd;
struct ed **seen, *ed;
unsigned long flags;
unsigned temp, size, seen_count;
char *next;
unsigned i;
if (!(seen = kmalloc(DBG_SCHED_LIMIT * sizeof *seen, GFP_ATOMIC)))
return 0;
seen_count = 0;
bus = class_get_devdata(class_dev);
hcd = bus_to_hcd(bus);
ahcd = hcd_to_admhcd(hcd);
next = buf;
size = PAGE_SIZE;
temp = scnprintf(next, size, "size = %d\n", NUM_INTS);
size -= temp;
next += temp;
/* dump a snapshot of the periodic schedule (and load) */
spin_lock_irqsave(&ahcd->lock, flags);
for (i = 0; i < NUM_INTS; i++) {
if (!(ed = ahcd->periodic [i]))
continue;
temp = scnprintf(next, size, "%2d [%3d]:", i, ahcd->load [i]);
size -= temp;
next += temp;
do {
temp = scnprintf(next, size, " ed%d/%p",
ed->interval, ed);
size -= temp;
next += temp;
for (temp = 0; temp < seen_count; temp++) {
if (seen [temp] == ed)
break;
}
/* show more info the first time around */
if (temp == seen_count) {
u32 info = hc32_to_cpu (ahcd, ed->hwINFO);
struct list_head *entry;
unsigned qlen = 0;
/* qlen measured here in TDs, not urbs */
list_for_each (entry, &ed->td_list)
qlen++;
temp = scnprintf(next, size,
" (%cs dev%d ep%d%s qlen %u"
" max %d %08x%s%s)",
(info & ED_SPEED_FULL) ? 'f' : 'l',
ED_FA_GET(info),
ED_EN_GET(info),
(info & ED_ISO) ? "iso" : "int",
qlen,
ED_MPS_GET(info),
info,
(info & ED_SKIP) ? " K" : "",
(ed->hwHeadP &
cpu_to_hc32(ahcd, ED_H)) ?
" H" : "");
size -= temp;
next += temp;
if (seen_count < DBG_SCHED_LIMIT)
seen [seen_count++] = ed;
ed = ed->ed_next;
} else {
/* we've seen it and what's after */
temp = 0;
ed = NULL;
}
} while (ed);
temp = scnprintf(next, size, "\n");
size -= temp;
next += temp;
}
spin_unlock_irqrestore(&ahcd->lock, flags);
kfree (seen);
return PAGE_SIZE - size;
}
static CLASS_DEVICE_ATTR(periodic, S_IRUGO, show_periodic, NULL);
#undef DBG_SCHED_LIMIT
static ssize_t static ssize_t
show_registers(struct class_device *class_dev, char *buf) show_registers(struct class_device *class_dev, char *buf)
{ {
@ -610,6 +658,7 @@ static inline void create_debug_files (struct admhcd *ahcd)
int retval; int retval;
retval = class_device_create_file(cldev, &class_device_attr_async); retval = class_device_create_file(cldev, &class_device_attr_async);
retval = class_device_create_file(cldev, &class_device_attr_periodic);
retval = class_device_create_file(cldev, &class_device_attr_registers); retval = class_device_create_file(cldev, &class_device_attr_registers);
admhc_dbg(ahcd, "created debug files\n"); admhc_dbg(ahcd, "created debug files\n");
} }
@ -619,6 +668,7 @@ static inline void remove_debug_files (struct admhcd *ahcd)
struct class_device *cldev = admhcd_to_hcd(ahcd)->self.class_dev; struct class_device *cldev = admhcd_to_hcd(ahcd)->self.class_dev;
class_device_remove_file(cldev, &class_device_attr_async); class_device_remove_file(cldev, &class_device_attr_async);
class_device_remove_file(cldev, &class_device_attr_periodic);
class_device_remove_file(cldev, &class_device_attr_registers); class_device_remove_file(cldev, &class_device_attr_registers);
} }

View file

@ -202,6 +202,7 @@ static int usb_hcd_adm5120_remove(struct platform_device *pdev)
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
/* TODO */
static int usb_hcd_adm5120_suspend(struct platform_device *dev) static int usb_hcd_adm5120_suspend(struct platform_device *dev)
{ {
struct usb_hcd *hcd = platform_get_drvdata(dev); struct usb_hcd *hcd = platform_get_drvdata(dev);

View file

@ -45,7 +45,7 @@
#include "../core/hcd.h" #include "../core/hcd.h"
#include "../core/hub.h" #include "../core/hub.h"
#define DRIVER_VERSION "v0.06" #define DRIVER_VERSION "v0.10"
#define DRIVER_AUTHOR "Gabor Juhos <juhosg at openwrt.org>" #define DRIVER_AUTHOR "Gabor Juhos <juhosg at openwrt.org>"
#define DRIVER_DESC "ADMtek USB 1.1 Host Controller Driver" #define DRIVER_DESC "ADMtek USB 1.1 Host Controller Driver"
@ -58,8 +58,7 @@
#define ADMHC_INTR_INIT \ #define ADMHC_INTR_INIT \
( ADMHC_INTR_MIE | ADMHC_INTR_INSM | ADMHC_INTR_FATI \ ( ADMHC_INTR_MIE | ADMHC_INTR_INSM | ADMHC_INTR_FATI \
| ADMHC_INTR_RESI | ADMHC_INTR_TDC | ADMHC_INTR_BABI \ | ADMHC_INTR_RESI | ADMHC_INTR_TDC | ADMHC_INTR_BABI )
| ADMHC_INTR_7 | ADMHC_INTR_6 )
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
@ -115,12 +114,10 @@ static int admhc_urb_enqueue(struct usb_hcd *hcd, struct usb_host_endpoint *ep,
/* 1 TD for setup, 1 for ACK, plus ... */ /* 1 TD for setup, 1 for ACK, plus ... */
td_cnt = 2; td_cnt = 2;
if (urb->transfer_buffer_length) /* FALLTHROUGH */
td_cnt++;
break;
case PIPE_BULK: case PIPE_BULK:
/* one TD for every 4096 Bytes (can be upto 8K) */ /* one TD for every 4096 Bytes (can be upto 8K) */
td_cnt = urb->transfer_buffer_length / TD_DATALEN_MAX; td_cnt += urb->transfer_buffer_length / TD_DATALEN_MAX;
/* ... and for any remaining bytes ... */ /* ... and for any remaining bytes ... */
if ((urb->transfer_buffer_length % TD_DATALEN_MAX) != 0) if ((urb->transfer_buffer_length % TD_DATALEN_MAX) != 0)
td_cnt++; td_cnt++;
@ -156,7 +153,6 @@ static int admhc_urb_enqueue(struct usb_hcd *hcd, struct usb_host_endpoint *ep,
return -ENOMEM; return -ENOMEM;
urb_priv->ed = ed; urb_priv->ed = ed;
urb_priv->urb = urb;
spin_lock_irqsave(&ahcd->lock, flags); spin_lock_irqsave(&ahcd->lock, flags);
/* don't submit to a dead HC */ /* don't submit to a dead HC */
@ -179,8 +175,13 @@ static int admhc_urb_enqueue(struct usb_hcd *hcd, struct usb_host_endpoint *ep,
goto fail; goto fail;
} }
/* schedule the ed if needed */
if (ed->state == ED_IDLE) {
ret = ed_schedule(ahcd, ed);
if (ret < 0)
goto fail0;
if (ed->type == PIPE_ISOCHRONOUS) { if (ed->type == PIPE_ISOCHRONOUS) {
if (ed->state == ED_NEW) {
u16 frame = admhc_frame_no(ahcd); u16 frame = admhc_frame_no(ahcd);
/* delay a few frames before the first TD */ /* delay a few frames before the first TD */
@ -192,25 +193,25 @@ static int admhc_urb_enqueue(struct usb_hcd *hcd, struct usb_host_endpoint *ep,
/* yes, only URB_ISO_ASAP is supported, and /* yes, only URB_ISO_ASAP is supported, and
* urb->start_frame is never used as input. * urb->start_frame is never used as input.
*/ */
} else
urb->start_frame = ed->last_iso + ed->interval;
} }
} else if (ed->type == PIPE_ISOCHRONOUS)
urb->start_frame = ed->last_iso + ed->interval;
/* fill the TDs and link them to the ed; and
* enable that part of the schedule, if needed
* and update count of queued periodic urbs
*/
urb->hcpriv = urb_priv; urb->hcpriv = urb_priv;
td_submit_urb(ahcd, urb_priv->urb); td_submit_urb(ahcd, urb);
/* append it to the ED's queue */
list_add_tail(&urb_priv->pending, &ed->urb_pending);
/* schedule the ED */
ret = ed_schedule(ahcd, ed);
#ifdef ADMHC_VERBOSE_DEBUG
admhc_dump_ed(ahcd, "admhc_urb_enqueue", urb_priv->ed, 1);
#endif
fail0:
spin_unlock(&urb->lock); spin_unlock(&urb->lock);
fail: fail:
if (ret) { if (ret)
urb_priv = urb->hcpriv;
urb_priv_free(ahcd, urb_priv); urb_priv_free(ahcd, urb_priv);
}
spin_unlock_irqrestore(&ahcd->lock, flags); spin_unlock_irqrestore(&ahcd->lock, flags);
return ret; return ret;
@ -225,43 +226,32 @@ fail:
static int admhc_urb_dequeue(struct usb_hcd *hcd, struct urb *urb) static int admhc_urb_dequeue(struct usb_hcd *hcd, struct urb *urb)
{ {
struct admhcd *ahcd = hcd_to_admhcd(hcd); struct admhcd *ahcd = hcd_to_admhcd(hcd);
struct urb_priv *up;
unsigned long flags; unsigned long flags;
up = urb->hcpriv;
if (!up)
return 0;
spin_lock_irqsave(&ahcd->lock, flags);
#ifdef ADMHC_VERBOSE_DEBUG #ifdef ADMHC_VERBOSE_DEBUG
urb_print(ahcd, urb, "DEQEUE", 1); urb_print(ahcd, urb, "DEQUEUE", 1);
#endif #endif
spin_lock_irqsave(&ahcd->lock, flags);
if (HC_IS_RUNNING(hcd->state)) { if (HC_IS_RUNNING(hcd->state)) {
struct urb_priv *urb_priv;
/* Unless an IRQ completed the unlink while it was being /* Unless an IRQ completed the unlink while it was being
* handed to us, flag it for unlink and giveback, and force * handed to us, flag it for unlink and giveback, and force
* some upcoming INTR_SF to call finish_unlinks() * some upcoming INTR_SF to call finish_unlinks()
*/ */
if (up->ed->urb_active != up) { urb_priv = urb->hcpriv;
list_del(&up->pending); if (urb_priv) {
finish_urb(ahcd, urb); if (urb_priv->ed->state == ED_OPER)
} else { start_ed_unlink(ahcd, urb_priv->ed);
ed_start_deschedule(ahcd, up->ed);
} }
} else { } else {
/* /*
* with HC dead, we won't respect hc queue pointers * with HC dead, we won't respect hc queue pointers
* any more ... just clean up every urb's memory. * any more ... just clean up every urb's memory.
*/ */
if (up->ed->urb_active != up) { if (urb->hcpriv)
list_del(&up->pending);
finish_urb(ahcd, urb); finish_urb(ahcd, urb);
} else {
finish_urb(ahcd, urb);
up->ed->urb_active = NULL;
up->ed->state = ED_IDLE;
}
} }
spin_unlock_irqrestore(&ahcd->lock, flags); spin_unlock_irqrestore(&ahcd->lock, flags);
@ -273,6 +263,7 @@ static int admhc_urb_dequeue(struct usb_hcd *hcd, struct urb *urb)
/* frees config/altsetting state for endpoints, /* frees config/altsetting state for endpoints,
* including ED memory, dummy TD, and bulk/intr data toggle * including ED memory, dummy TD, and bulk/intr data toggle
*/ */
static void admhc_endpoint_disable(struct usb_hcd *hcd, static void admhc_endpoint_disable(struct usb_hcd *hcd,
struct usb_host_endpoint *ep) struct usb_host_endpoint *ep)
{ {
@ -298,8 +289,8 @@ rescan:
if (!HC_IS_RUNNING(hcd->state)) { if (!HC_IS_RUNNING(hcd->state)) {
sanitize: sanitize:
ed->state = ED_UNLINK; ed->state = ED_IDLE;
admhc_finish_unlinks(ahcd, 0); finish_unlinks(ahcd, 0);
} }
switch (ed->state) { switch (ed->state) {
@ -312,9 +303,8 @@ sanitize:
spin_unlock_irqrestore(&ahcd->lock, flags); spin_unlock_irqrestore(&ahcd->lock, flags);
schedule_timeout_uninterruptible(1); schedule_timeout_uninterruptible(1);
goto rescan; goto rescan;
case ED_IDLE: case ED_IDLE: /* fully unlinked */
case ED_NEW: /* fully unlinked */ if (list_empty(&ed->td_list)) {
if (list_empty(&ed->urb_pending)) {
td_free (ahcd, ed->dummy); td_free (ahcd, ed->dummy);
ed_free (ahcd, ed); ed_free (ahcd, ed);
break; break;
@ -324,11 +314,10 @@ sanitize:
/* caller was supposed to have unlinked any requests; /* caller was supposed to have unlinked any requests;
* that's not our job. can't recover; must leak ed. * that's not our job. can't recover; must leak ed.
*/ */
admhc_err(ahcd, "leak ed %p (#%02x) %s act %p%s\n", admhc_err(ahcd, "leak ed %p (#%02x) state %d%s\n",
ed, ep->desc.bEndpointAddress, ed, ep->desc.bEndpointAddress, ed->state,
ed_statestring(ed->state), list_empty(&ed->td_list) ? "" : " (has tds)");
ed->urb_active, td_free(ahcd, ed->dummy);
list_empty(&ed->urb_pending) ? "" : " (has urbs)");
break; break;
} }
@ -347,9 +336,15 @@ static int admhc_get_frame_number(struct usb_hcd *hcd)
static void admhc_usb_reset(struct admhcd *ahcd) static void admhc_usb_reset(struct admhcd *ahcd)
{ {
admhc_dbg(ahcd, "usb reset\n"); #if 0
ahcd->hc_control = admhc_readl(ahcd, &ahcd->regs->control);
ahcd->hc_control &= OHCI_CTRL_RWC;
admhc_writel(ahcd, ahcd->hc_control, &ahcd->regs->control);
#else
/* FIXME */
ahcd->host_control = ADMHC_BUSS_RESET; ahcd->host_control = ADMHC_BUSS_RESET;
admhc_writel(ahcd, ahcd->host_control ,&ahcd->regs->host_control); admhc_writel(ahcd, ahcd->host_control ,&ahcd->regs->host_control);
#endif
} }
/* admhc_shutdown forcibly disables IRQs and DMA, helping kexec and /* admhc_shutdown forcibly disables IRQs and DMA, helping kexec and
@ -361,12 +356,12 @@ admhc_shutdown(struct usb_hcd *hcd)
{ {
struct admhcd *ahcd; struct admhcd *ahcd;
admhc_dbg(ahcd, "shutdown\n");
ahcd = hcd_to_admhcd(hcd); ahcd = hcd_to_admhcd(hcd);
admhc_intr_disable(ahcd, ADMHC_INTR_MIE); admhc_intr_disable(ahcd, ADMHC_INTR_MIE);
admhc_dma_disable(ahcd); admhc_dma_disable(ahcd);
admhc_usb_reset(ahcd); admhc_usb_reset(ahcd);
/* flush the writes */
admhc_writel_flush(ahcd);
} }
/*-------------------------------------------------------------------------* /*-------------------------------------------------------------------------*
@ -398,7 +393,7 @@ static void admhc_eds_cleanup(struct admhcd *ahcd)
ahcd->ed_head = NULL; ahcd->ed_head = NULL;
} }
#define ED_DUMMY_INFO 0 #define ED_DUMMY_INFO (ED_SPEED_FULL | ED_SKIP)
static int admhc_eds_init(struct admhcd *ahcd) static int admhc_eds_init(struct admhcd *ahcd)
{ {
@ -514,6 +509,17 @@ static int admhc_run(struct admhcd *ahcd)
/* also: power/overcurrent flags in rhdesc */ /* also: power/overcurrent flags in rhdesc */
} }
#if 0 /* TODO: not applicable */
/* Reset USB nearly "by the book". RemoteWakeupConnected was
* saved if boot firmware (BIOS/SMM/...) told us it's connected,
* or if bus glue did the same (e.g. for PCI add-in cards with
* PCI PM support).
*/
if ((ahcd->hc_control & OHCI_CTRL_RWC) != 0
&& !device_may_wakeup(hcd->self.controller))
device_init_wakeup(hcd->self.controller, 1);
#endif
switch (ahcd->host_control & ADMHC_HC_BUSS) { switch (ahcd->host_control & ADMHC_HC_BUSS) {
case ADMHC_BUSS_OPER: case ADMHC_BUSS_OPER:
temp = 0; temp = 0;
@ -531,14 +537,19 @@ static int admhc_run(struct admhcd *ahcd)
break; break;
} }
admhc_writel(ahcd, ahcd->host_control, &ahcd->regs->host_control); admhc_writel(ahcd, ahcd->host_control, &ahcd->regs->host_control);
msleep(temp);
/* flush the writes */
admhc_writel_flush(ahcd);
msleep(temp);
temp = admhc_read_rhdesc(ahcd); temp = admhc_read_rhdesc(ahcd);
if (!(temp & ADMHC_RH_NPS)) { if (!(temp & ADMHC_RH_NPS)) {
/* power down each port */ /* power down each port */
for (temp = 0; temp < ahcd->num_ports; temp++) for (temp = 0; temp < ahcd->num_ports; temp++)
admhc_write_portstatus(ahcd, temp, ADMHC_PS_CPP); admhc_write_portstatus(ahcd, temp, ADMHC_PS_CPP);
} }
/* flush those writes */
admhc_writel_flush(ahcd);
/* 2msec timelimit here means no irqs/preempt */ /* 2msec timelimit here means no irqs/preempt */
spin_lock_irq(&ahcd->lock); spin_lock_irq(&ahcd->lock);
@ -566,10 +577,25 @@ static int admhc_run(struct admhcd *ahcd)
hcd->poll_rh = 1; hcd->poll_rh = 1;
hcd->uses_new_polling = 1; hcd->uses_new_polling = 1;
#if 0
/* wake on ConnectStatusChange, matching external hubs */
admhc_writel(ahcd, RH_HS_DRWE, &ahcd->regs->roothub.status);
#else
/* FIXME roothub_write_status (ahcd, ADMHC_RH_DRWE); */
#endif
/* Choose the interrupts we care about now, others later on demand */
admhc_intr_ack(ahcd, ~0);
admhc_intr_enable(ahcd, ADMHC_INTR_INIT);
admhc_writel(ahcd, ADMHC_RH_NPS | ADMHC_RH_LPSC, &ahcd->regs->rhdesc);
/* flush those writes */
admhc_writel_flush(ahcd);
/* start controller operations */ /* start controller operations */
ahcd->host_control = ADMHC_BUSS_OPER; ahcd->host_control = ADMHC_BUSS_OPER;
admhc_writel(ahcd, ahcd->host_control, &ahcd->regs->host_control); admhc_writel(ahcd, ahcd->host_control, &ahcd->regs->host_control);
hcd->state = HC_STATE_RUNNING;
temp = 20; temp = 20;
while ((admhc_readl(ahcd, &ahcd->regs->host_control) while ((admhc_readl(ahcd, &ahcd->regs->host_control)
@ -582,24 +608,31 @@ static int admhc_run(struct admhcd *ahcd)
mdelay(1); mdelay(1);
} }
#if 0 hcd->state = HC_STATE_RUNNING;
/* FIXME */
/* wake on ConnectStatusChange, matching external hubs */
admhc_writel(ahcd, ADMHC_RH_DRWE, &ahcd->regs->rhdesc);
#endif
/* Choose the interrupts we care about now, others later on demand */
temp = ADMHC_INTR_INIT;
admhc_intr_ack(ahcd, ~0);
admhc_intr_enable(ahcd, temp);
admhc_writel(ahcd, ADMHC_RH_NPS | ADMHC_RH_LPSC, &ahcd->regs->rhdesc);
ahcd->next_statechange = jiffies + STATECHANGE_DELAY; ahcd->next_statechange = jiffies + STATECHANGE_DELAY;
#if 0
/* FIXME: enabling DMA is always failed here for an unknown reason */
admhc_dma_enable(ahcd);
temp = 200;
while ((admhc_readl(ahcd, &ahcd->regs->host_control)
& ADMHC_HC_DMAE) != ADMHC_HC_DMAE) {
if (--temp == 0) {
spin_unlock_irq(&ahcd->lock);
admhc_err(ahcd, "unable to enable DMA!\n");
admhc_dump(ahcd, 1);
return -1;
}
mdelay(1);
}
#endif
spin_unlock_irq(&ahcd->lock); spin_unlock_irq(&ahcd->lock);
mdelay(ADMHC_POTPGT); mdelay(ADMHC_POTPGT);
hcd->state = HC_STATE_RUNNING;
return 0; return 0;
} }
@ -615,38 +648,25 @@ static irqreturn_t admhc_irq(struct usb_hcd *hcd)
u32 ints; u32 ints;
ints = admhc_readl(ahcd, &regs->int_status); ints = admhc_readl(ahcd, &regs->int_status);
if (!(ints & ADMHC_INTR_INTA)) { if ((ints & ADMHC_INTR_INTA) == 0) {
/* no unmasked interrupt status is set */ /* no unmasked interrupt status is set */
admhc_err(ahcd, "spurious interrupt %08x\n", ints);
return IRQ_NONE; return IRQ_NONE;
} }
ints &= admhc_readl(ahcd, &regs->int_enable); ints &= admhc_readl(ahcd, &regs->int_enable);
if (!ints) {
admhc_err(ahcd, "hardware irq problems?\n");
return IRQ_NONE;
}
if (ints & ADMHC_INTR_6) {
admhc_err(ahcd, "unknown interrupt 6\n");
admhc_dump(ahcd, 0);
}
if (ints & ADMHC_INTR_7) {
admhc_err(ahcd, "unknown interrupt 7\n");
admhc_dump(ahcd, 0);
}
if (ints & ADMHC_INTR_FATI) { if (ints & ADMHC_INTR_FATI) {
/* e.g. due to PCI Master/Target Abort */
admhc_disable(ahcd); admhc_disable(ahcd);
admhc_err(ahcd, "Fatal Error, controller disabled\n"); admhc_err(ahcd, "Fatal Error, controller disabled\n");
admhc_dump(ahcd, 1);
admhc_usb_reset(ahcd); admhc_usb_reset(ahcd);
} }
if (ints & ADMHC_INTR_BABI) { if (ints & ADMHC_INTR_BABI) {
admhc_disable(ahcd); admhc_intr_disable(ahcd, ADMHC_INTR_BABI);
admhc_intr_ack(ahcd, ADMHC_INTR_BABI);
admhc_err(ahcd, "Babble Detected\n"); admhc_err(ahcd, "Babble Detected\n");
admhc_usb_reset(ahcd);
} }
if (ints & ADMHC_INTR_INSM) { if (ints & ADMHC_INTR_INSM) {
@ -682,6 +702,7 @@ static irqreturn_t admhc_irq(struct usb_hcd *hcd)
if (ints & ADMHC_INTR_TDC) { if (ints & ADMHC_INTR_TDC) {
admhc_vdbg(ahcd, "Transfer Descriptor Complete\n"); admhc_vdbg(ahcd, "Transfer Descriptor Complete\n");
admhc_intr_ack(ahcd, ADMHC_INTR_TDC);
if (HC_IS_RUNNING(hcd->state)) if (HC_IS_RUNNING(hcd->state))
admhc_intr_disable(ahcd, ADMHC_INTR_TDC); admhc_intr_disable(ahcd, ADMHC_INTR_TDC);
spin_lock(&ahcd->lock); spin_lock(&ahcd->lock);
@ -693,19 +714,45 @@ static irqreturn_t admhc_irq(struct usb_hcd *hcd)
if (ints & ADMHC_INTR_SO) { if (ints & ADMHC_INTR_SO) {
/* could track INTR_SO to reduce available PCI/... bandwidth */ /* could track INTR_SO to reduce available PCI/... bandwidth */
admhc_err(ahcd, "Schedule Overrun\n"); admhc_vdbg(ahcd, "Schedule Overrun\n");
} }
if (ints & ADMHC_INTR_SOFI) { #if 1
spin_lock(&ahcd->lock); spin_lock(&ahcd->lock);
if (ahcd->ed_rm_list)
finish_unlinks(ahcd, admhc_frame_no(ahcd));
if ((ints & ADMHC_INTR_SOFI) != 0 && !ahcd->ed_rm_list
&& HC_IS_RUNNING(hcd->state))
admhc_intr_disable(ahcd, ADMHC_INTR_SOFI);
spin_unlock(&ahcd->lock);
#else
if (ints & ADMHC_INTR_SOFI) {
admhc_vdbg(ahcd, "Start Of Frame\n");
spin_lock(&ahcd->lock);
/* handle any pending ED removes */ /* handle any pending ED removes */
admhc_finish_unlinks(ahcd, admhc_frame_no(ahcd)); finish_unlinks(ahcd, admhc_frameno(ahcd));
/* leaving INTR_SOFI enabled when there's still unlinking
* to be done in the (next frame).
*/
if ((ahcd->ed_rm_list == NULL) ||
HC_IS_RUNNING(hcd->state) == 0)
/*
* disable INTR_SOFI if there are no unlinking to be
* done (in the next frame)
*/
admhc_intr_disable(ahcd, ADMHC_INTR_SOFI);
spin_unlock(&ahcd->lock); spin_unlock(&ahcd->lock);
} }
#endif
if (HC_IS_RUNNING(hcd->state)) { if (HC_IS_RUNNING(hcd->state)) {
admhc_intr_ack(ahcd, ints); admhc_intr_ack(ahcd, ints);
admhc_intr_enable(ahcd, ADMHC_INTR_MIE); admhc_intr_enable(ahcd, ADMHC_INTR_MIE);
admhc_writel_flush(ahcd);
} }
return IRQ_HANDLED; return IRQ_HANDLED;
@ -722,7 +769,7 @@ static void admhc_stop(struct usb_hcd *hcd)
flush_scheduled_work(); flush_scheduled_work();
admhc_usb_reset(ahcd); admhc_usb_reset(ahcd);
admhc_intr_disable(ahcd, ~0); admhc_intr_disable(ahcd, ADMHC_INTR_MIE);
free_irq(hcd->irq, hcd); free_irq(hcd->irq, hcd);
hcd->irq = -1; hcd->irq = -1;

View file

@ -27,6 +27,7 @@ static void admhc_hcd_init(struct admhcd *ahcd)
{ {
ahcd->next_statechange = jiffies; ahcd->next_statechange = jiffies;
spin_lock_init(&ahcd->lock); spin_lock_init(&ahcd->lock);
INIT_LIST_HEAD(&ahcd->pending);
} }
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
@ -75,6 +76,19 @@ static void admhc_mem_cleanup(struct admhcd *ahcd)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
/* ahcd "done list" processing needs this mapping */
static inline struct td *dma_to_td(struct admhcd *ahcd, dma_addr_t td_dma)
{
struct td *td;
td_dma &= TD_MASK;
td = ahcd->td_hash[TD_HASH_FUNC(td_dma)];
while (td && td->td_dma != td_dma)
td = td->td_hash;
return td;
}
/* TDs ... */ /* TDs ... */
static struct td *td_alloc(struct admhcd *ahcd, gfp_t mem_flags) static struct td *td_alloc(struct admhcd *ahcd, gfp_t mem_flags)
{ {
@ -87,13 +101,29 @@ static struct td *td_alloc(struct admhcd *ahcd, gfp_t mem_flags)
/* in case ahcd fetches it, make it look dead */ /* in case ahcd fetches it, make it look dead */
memset(td, 0, sizeof *td); memset(td, 0, sizeof *td);
td->hwNextTD = cpu_to_hc32(ahcd, dma);
td->td_dma = dma; td->td_dma = dma;
/* hashed in td_fill */
return td; return td;
} }
static void td_free(struct admhcd *ahcd, struct td *td) static void td_free(struct admhcd *ahcd, struct td *td)
{ {
struct td **prev = &ahcd->td_hash[TD_HASH_FUNC(td->td_dma)];
while (*prev && *prev != td)
prev = &(*prev)->td_hash;
if (*prev)
*prev = td->td_hash;
#if 0
/* TODO: remove */
else if ((td->hwINFO & cpu_to_hc32(ahcd, TD_DONE)) != 0)
admhc_dbg (ahcd, "no hash for td %p\n", td);
#else
else if ((td->flags & TD_FLAG_DONE) != 0)
admhc_dbg (ahcd, "no hash for td %p\n", td);
#endif
dma_pool_free(ahcd->td_cache, td, td->td_dma); dma_pool_free(ahcd->td_cache, td, td->td_dma);
} }
@ -112,7 +142,8 @@ static struct ed *ed_alloc(struct admhcd *ahcd, gfp_t mem_flags)
memset(ed, 0, sizeof(*ed)); memset(ed, 0, sizeof(*ed));
ed->dma = dma; ed->dma = dma;
INIT_LIST_HEAD(&ed->urb_pending); INIT_LIST_HEAD(&ed->td_list);
INIT_LIST_HEAD(&ed->urb_list);
return ed; return ed;
} }
@ -133,6 +164,7 @@ static void urb_priv_free(struct admhcd *ahcd, struct urb_priv *urb_priv)
if (urb_priv->td[i]) if (urb_priv->td[i])
td_free(ahcd, urb_priv->td[i]); td_free(ahcd, urb_priv->td[i]);
list_del(&urb_priv->pending);
kfree(urb_priv); kfree(urb_priv);
} }
@ -140,23 +172,20 @@ static struct urb_priv *urb_priv_alloc(struct admhcd *ahcd, int num_tds,
gfp_t mem_flags) gfp_t mem_flags)
{ {
struct urb_priv *priv; struct urb_priv *priv;
int i;
/* allocate the private part of the URB */ /* allocate the private part of the URB */
priv = kzalloc(sizeof(*priv) + sizeof(struct td) * num_tds, mem_flags); priv = kzalloc(sizeof(*priv) + sizeof(struct td) * num_tds, mem_flags);
if (!priv) if (!priv)
goto err; goto err;
/* allocate the TDs */ /* allocate the TDs (deferring hash chain updates) */
for (i = 0; i < num_tds; i++) { for (priv->td_cnt = 0; priv->td_cnt < num_tds; priv->td_cnt++) {
priv->td[i] = td_alloc(ahcd, mem_flags); priv->td[priv->td_cnt] = td_alloc(ahcd, mem_flags);
if (priv->td[i] == NULL) if (priv->td[priv->td_cnt] == NULL)
goto err_free; goto err_free;
priv->td[i]->index = i;
} }
INIT_LIST_HEAD(&priv->pending); INIT_LIST_HEAD(&priv->pending);
priv->td_cnt = num_tds;
return priv; return priv;

File diff suppressed because it is too large Load diff

View file

@ -56,24 +56,21 @@ struct ed {
dma_addr_t dma; /* addr of ED */ dma_addr_t dma; /* addr of ED */
struct td *dummy; /* next TD to activate */ struct td *dummy; /* next TD to activate */
struct urb_priv *urb_active; /* active URB */ struct list_head urb_list; /* list of our URBs */
struct list_head urb_pending; /* pending URBs */
struct list_head ed_list; /* list of all EDs*/
struct list_head rm_list; /* for remove list */
/* host's view of schedule */ /* host's view of schedule */
struct ed *ed_next; /* on schedule list */ struct ed *ed_next; /* on schedule list */
struct ed *ed_prev; /* for non-interrupt EDs */ struct ed *ed_prev; /* for non-interrupt EDs */
struct ed *ed_rm_next; /* on rm list */
struct list_head td_list; /* "shadow list" of our TDs */
/* create --> IDLE --> OPER --> ... --> IDLE --> destroy /* create --> IDLE --> OPER --> ... --> IDLE --> destroy
* usually: OPER --> UNLINK --> (IDLE | OPER) --> ... * usually: OPER --> UNLINK --> (IDLE | OPER) --> ...
*/ */
u8 state; u8 state; /* ED_{IDLE,UNLINK,OPER} */
#define ED_NEW 0x00 /* just allocated */ #define ED_IDLE 0x00 /* NOT linked to HC */
#define ED_IDLE 0x01 /* linked into HC, but not running */ #define ED_UNLINK 0x01 /* being unlinked from hc */
#define ED_OPER 0x02 /* linked into HC and running */ #define ED_OPER 0x02 /* IS linked to hc */
#define ED_UNLINK 0x03 /* being unlinked from HC */
u8 type; /* PIPE_{BULK,...} */ u8 type; /* PIPE_{BULK,...} */
@ -121,10 +118,10 @@ struct td {
#define TD_DP_SHIFT 21 /* direction/pid */ #define TD_DP_SHIFT 21 /* direction/pid */
#define TD_DP_MASK 0x3 #define TD_DP_MASK 0x3
#define TD_DP (TD_DP_MASK << TD_DP_SHIFT) #define TD_DP (TD_DP_MASK << TD_DP_SHIFT)
#define TD_DP_GET (((x) >> TD_DP_SHIFT) & TD_DP_MASK)
#define TD_DP_SETUP (0x0 << TD_DP_SHIFT) /* SETUP pid */ #define TD_DP_SETUP (0x0 << TD_DP_SHIFT) /* SETUP pid */
#define TD_DP_OUT (0x1 << TD_DP_SHIFT) /* OUT pid */ #define TD_DP_OUT (0x1 << TD_DP_SHIFT) /* OUT pid */
#define TD_DP_IN (0x2 << TD_DP_SHIFT) /* IN pid */ #define TD_DP_IN (0x2 << TD_DP_SHIFT) /* IN pid */
#define TD_DP_GET(x) (((x) >> TD_DP_SHIFT) & TD_DP_MASK)
#define TD_ISI_SHIFT 8 /* Interrupt Service Interval */ #define TD_ISI_SHIFT 8 /* Interrupt Service Interval */
#define TD_ISI_MASK 0x3f #define TD_ISI_MASK 0x3f
#define TD_ISI_GET(x) (((x) >> TD_ISI_SHIFT) & TD_ISI_MASK) #define TD_ISI_GET(x) (((x) >> TD_ISI_SHIFT) & TD_ISI_MASK)
@ -142,11 +139,19 @@ struct td {
/* rest are purely for the driver's use */ /* rest are purely for the driver's use */
__u8 index; __u8 index;
struct ed *ed;
struct td *td_hash; /* dma-->td hashtable */
struct td *next_dl_td;
struct urb *urb; struct urb *urb;
dma_addr_t td_dma; /* addr of this TD */ dma_addr_t td_dma; /* addr of this TD */
dma_addr_t data_dma; /* addr of data it points to */ dma_addr_t data_dma; /* addr of data it points to */
struct list_head td_list; /* "shadow list", TDs on same ED */
u32 flags;
#define TD_FLAG_DONE (1 << 17) /* retired to done list */
#define TD_FLAG_ISO (1 << 16) /* copy of ED_ISO */
} __attribute__ ((aligned(TD_ALIGN))); /* c/b/i need 16; only iso needs 32 */ } __attribute__ ((aligned(TD_ALIGN))); /* c/b/i need 16; only iso needs 32 */
/* /*
@ -348,7 +353,6 @@ struct admhcd_regs {
/* hcd-private per-urb state */ /* hcd-private per-urb state */
struct urb_priv { struct urb_priv {
struct ed *ed; struct ed *ed;
struct urb *urb;
struct list_head pending; /* URBs on the same ED */ struct list_head pending; /* URBs on the same ED */
u32 td_cnt; /* # tds in this request */ u32 td_cnt; /* # tds in this request */
@ -379,10 +383,13 @@ struct admhcd {
* hcd adds to schedule for a live hc any time, but removals finish * hcd adds to schedule for a live hc any time, but removals finish
* only at the start of the next frame. * only at the start of the next frame.
*/ */
struct ed *ed_head; struct ed *ed_head;
struct ed *ed_tails[4]; struct ed *ed_tails[4];
// struct ed *periodic[NUM_INTS]; /* shadow int_table */ struct ed *ed_rm_list; /* to be removed */
struct ed *periodic[NUM_INTS]; /* shadow int_table */
#if 0 /* TODO: remove? */ #if 0 /* TODO: remove? */
/* /*
@ -398,6 +405,7 @@ struct admhcd {
struct dma_pool *td_cache; struct dma_pool *td_cache;
struct dma_pool *ed_cache; struct dma_pool *ed_cache;
struct td *td_hash[TD_HASH_SIZE]; struct td *td_hash[TD_HASH_SIZE];
struct list_head pending;
/* /*
* driver state * driver state
@ -549,6 +557,15 @@ static inline void admhc_writel(const struct admhcd *ahcd,
#endif #endif
} }
static inline void admhc_writel_flush(const struct admhcd *ahcd)
{
#if 0
/* TODO: remove? */
(void) admhc_readl(ahcd, &ahcd->regs->gencontrol);
#endif
}
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
/* cpu to ahcd */ /* cpu to ahcd */
@ -642,11 +659,20 @@ static inline void admhc_disable(struct admhcd *ahcd)
static inline void periodic_reinit(struct admhcd *ahcd) static inline void periodic_reinit(struct admhcd *ahcd)
{ {
#if 0
u32 fi = ahcd->fminterval & ADMHC_SFI_FI_MASK;
u32 fit = admhc_readl(ahcd, &ahcd->regs->fminterval) & FIT; u32 fit = admhc_readl(ahcd, &ahcd->regs->fminterval) & FIT;
/* TODO: adjust FSLargestDataPacket value too? */ /* TODO: adjust FSLargestDataPacket value too? */
admhc_writel(ahcd, (fit ^ FIT) | ahcd->fminterval, admhc_writel(ahcd, (fit ^ FIT) | ahcd->fminterval,
&ahcd->regs->fminterval); &ahcd->regs->fminterval);
#else
u32 fit = admhc_readl(ahcd, &ahcd->regs->fminterval) & FIT;
/* TODO: adjust FSLargestDataPacket value too? */
admhc_writel(ahcd, (fit ^ FIT) | ahcd->fminterval,
&ahcd->regs->fminterval);
#endif
} }
static inline u32 admhc_read_rhdesc(struct admhcd *ahcd) static inline u32 admhc_read_rhdesc(struct admhcd *ahcd)