summaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-11-23 18:11:49 +0000
committerjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-11-23 18:11:49 +0000
commit1f01b9bc98782a1658e9ad0001784d714309fe7b (patch)
tree16290a0ad1efce1a0db3eeabdbe96e65499a4316 /target
parent6c9a138d3cc4bc33bced2352c18c630a9c70fd84 (diff)
[adm5120] fix USB driver to compile with ADMH_VERBOSE_DEBUG defined
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@9593 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rw-r--r--target/linux/adm5120/files/drivers/usb/host/adm5120-dbg.c15
-rw-r--r--target/linux/adm5120/files/drivers/usb/host/adm5120-hcd.c5
-rw-r--r--target/linux/adm5120/files/drivers/usb/host/adm5120-q.c50
3 files changed, 34 insertions, 36 deletions
diff --git a/target/linux/adm5120/files/drivers/usb/host/adm5120-dbg.c b/target/linux/adm5120/files/drivers/usb/host/adm5120-dbg.c
index 17d4ad446..4c814e8b4 100644
--- a/target/linux/adm5120/files/drivers/usb/host/adm5120-dbg.c
+++ b/target/linux/adm5120/files/drivers/usb/host/adm5120-dbg.c
@@ -76,12 +76,12 @@ static inline char *td_togglestring(u32 info)
* small: 0) header + data packets 1) just header
*/
static void __attribute__((unused))
-urb_print(struct admhcd *ahcd, struct urb *urb, char * str, int small)
+urb_print(struct admhcd *ahcd, struct urb *urb, char *str, int small)
{
unsigned int pipe = urb->pipe;
if (!urb->dev || !urb->dev->bus) {
- admhc_dbg("%s URB: no dev", str);
+ admhc_dbg(ahcd, "%s URB: no dev", str);
return;
}
@@ -89,7 +89,7 @@ urb_print(struct admhcd *ahcd, struct urb *urb, char * str, int small)
if (urb->status != 0)
#endif
admhc_dbg(ahcd, "URB-%s %p dev=%d ep=%d%s-%s flags=%x len=%d/%d "
- "stat=%d",
+ "stat=%d\n",
str,
urb,
usb_pipedevice (pipe),
@@ -112,14 +112,14 @@ urb_print(struct admhcd *ahcd, struct urb *urb, char * str, int small)
printk ("\n");
}
if (urb->transfer_buffer_length > 0 && urb->transfer_buffer) {
- printk(KERN_DEBUG __FILE__ ": data(%d/%d):",
+ admhc_dbg(ahcd, "data(%d/%d):",
urb->actual_length,
urb->transfer_buffer_length);
len = usb_pipeout(pipe)?
urb->transfer_buffer_length: urb->actual_length;
for (i = 0; i < 16 && i < len; i++)
- printk (" %02x", ((__u8 *) urb->transfer_buffer) [i]);
- admhc_dbg("%s stat:%d\n", i < len? "...": "", urb->status);
+ printk(" %02x", ((__u8 *)urb->transfer_buffer)[i]);
+ printk("%s stat:%d\n", i < len? "...": "", urb->status);
}
}
#endif /* ADMHC_VERBOSE_DEBUG */
@@ -363,7 +363,8 @@ admhc_dump_ed(const struct admhcd *ahcd, const char *label,
#else /* ifdef DEBUG */
-static inline void urb_print(struct urb * urb, char * str, int small) {}
+static inline void urb_print(struct admhcd *ahcd, struct urb * urb, char * str,
+ int small) {}
static inline void admhc_dump_ed(const struct admhcd *ahcd, const char *label,
const struct ed *ed, int verbose) {}
static inline void admhc_dump_td(const struct admhcd *ahcd, const char *label,
diff --git a/target/linux/adm5120/files/drivers/usb/host/adm5120-hcd.c b/target/linux/adm5120/files/drivers/usb/host/adm5120-hcd.c
index 30fe132d9..90889bfc0 100644
--- a/target/linux/adm5120/files/drivers/usb/host/adm5120-hcd.c
+++ b/target/linux/adm5120/files/drivers/usb/host/adm5120-hcd.c
@@ -45,7 +45,7 @@
#include "../core/hcd.h"
#include "../core/hub.h"
-#define DRIVER_VERSION "v0.10"
+#define DRIVER_VERSION "v0.10.1"
#define DRIVER_AUTHOR "Gabor Juhos <juhosg at openwrt.org>"
#define DRIVER_DESC "ADMtek USB 1.1 Host Controller Driver"
@@ -228,11 +228,12 @@ static int admhc_urb_dequeue(struct usb_hcd *hcd, struct urb *urb)
struct admhcd *ahcd = hcd_to_admhcd(hcd);
unsigned long flags;
+ spin_lock_irqsave(&ahcd->lock, flags);
+
#ifdef ADMHC_VERBOSE_DEBUG
urb_print(ahcd, urb, "DEQUEUE", 1);
#endif
- spin_lock_irqsave(&ahcd->lock, flags);
if (HC_IS_RUNNING(hcd->state)) {
struct urb_priv *urb_priv;
diff --git a/target/linux/adm5120/files/drivers/usb/host/adm5120-q.c b/target/linux/adm5120/files/drivers/usb/host/adm5120-q.c
index 24acc87e7..d93f8b9d5 100644
--- a/target/linux/adm5120/files/drivers/usb/host/adm5120-q.c
+++ b/target/linux/adm5120/files/drivers/usb/host/adm5120-q.c
@@ -38,7 +38,7 @@ __acquires(ahcd->lock)
&& urb->status == 0) {
urb->status = -EREMOTEIO;
#ifdef ADMHC_VERBOSE_DEBUG
- urb_print(urb, "SHORT", usb_pipeout (urb->pipe));
+ urb_print(ahcd, urb, "SHORT", usb_pipeout(urb->pipe));
#endif
}
spin_unlock(&urb->lock);
@@ -53,7 +53,7 @@ __acquires(ahcd->lock)
}
#ifdef ADMHC_VERBOSE_DEBUG
- urb_print(urb, "RET", usb_pipeout (urb->pipe));
+ urb_print(ahcd, urb, "RET", usb_pipeout (urb->pipe));
#endif
/* urb->complete() can reenter this HCD */
@@ -112,7 +112,7 @@ static void periodic_link (struct admhcd *ahcd, struct ed *ed)
unsigned i;
admhc_vdbg (ahcd, "link %sed %p branch %d [%dus.], interval %d\n",
- (ed->hwINFO & cpu_to_hc32 (ahcd, ED_ISO)) ? "iso " : "",
+ (ed->hwINFO & cpu_to_hc32(ahcd, ED_ISO)) ? "iso " : "",
ed, ed->branch, ed->load, ed->interval);
for (i = ed->branch; i < NUM_INTS; i += ed->interval) {
@@ -202,7 +202,7 @@ static void periodic_unlink (struct admhcd *ahcd, struct ed *ed)
admhcd_to_hcd(ahcd)->self.bandwidth_allocated -= ed->load / ed->interval;
admhc_vdbg (ahcd, "unlink %sed %p branch %d [%dus.], interval %d\n",
- (ed->hwINFO & cpu_to_hc32 (ahcd, ED_ISO)) ? "iso " : "",
+ (ed->hwINFO & cpu_to_hc32(ahcd, ED_ISO)) ? "iso " : "",
ed, ed->branch, ed->load, ed->interval);
}
#endif
@@ -333,7 +333,7 @@ static struct ed *ed_get(struct admhcd *ahcd, struct usb_host_endpoint *ep,
*/
static void start_ed_unlink(struct admhcd *ahcd, struct ed *ed)
{
- ed->hwINFO |= cpu_to_hc32 (ahcd, ED_DEQUEUE);
+ ed->hwINFO |= cpu_to_hc32(ahcd, ED_DEQUEUE);
ed_deschedule(ahcd, ed);
/* add this ED into the remove list */
@@ -432,9 +432,7 @@ static void td_submit_urb(struct admhcd *ahcd, struct urb *urb)
int cnt = 0;
u32 info = 0;
int is_out = usb_pipeout(urb->pipe);
- int periodic = 0;
u32 toggle = 0;
- struct td *td;
/* OHCI handles the bulk/interrupt data toggles itself. We just
* use the device toggle bits for resetting, and rely on the fact
@@ -644,15 +642,15 @@ ed_halted(struct admhcd *ahcd, struct td *td, int cc, struct td *rev)
struct urb *urb = td->urb;
struct ed *ed = td->ed;
struct list_head *tmp = td->td_list.next;
- __hc32 toggle = ed->hwHeadP & cpu_to_hc32 (ahcd, ED_C);
+ __hc32 toggle = ed->hwHeadP & cpu_to_hc32(ahcd, ED_C);
admhc_dump_ed(ahcd, "ed halted", td->ed, 1);
/* clear ed halt; this is the td that caused it, but keep it inactive
* until its urb->complete() has a chance to clean up.
*/
- ed->hwINFO |= cpu_to_hc32 (ahcd, ED_SKIP);
+ ed->hwINFO |= cpu_to_hc32(ahcd, ED_SKIP);
wmb();
- ed->hwHeadP &= ~cpu_to_hc32 (ahcd, ED_H);
+ ed->hwHeadP &= ~cpu_to_hc32(ahcd, ED_H);
/* put any later tds from this urb onto the donelist, after 'td',
* order won't matter here: no errors, and nothing was transferred.
@@ -677,9 +675,9 @@ ed_halted(struct admhcd *ahcd, struct td *td, int cc, struct td *rev)
*/
info = next->hwINFO;
#if 0 /* FIXME */
- info |= cpu_to_hc32 (ahcd, TD_DONE);
+ info |= cpu_to_hc32(ahcd, TD_DONE);
#endif
- info &= ~cpu_to_hc32 (ahcd, TD_CC);
+ info &= ~cpu_to_hc32(ahcd, TD_CC);
next->hwINFO = info;
next->next_dl_td = rev;
@@ -738,7 +736,7 @@ skip_ed:
continue;
}
- if (!list_empty (&ed->td_list)) {
+ if (!list_empty(&ed->td_list)) {
struct td *td;
u32 head;
@@ -772,7 +770,7 @@ skip_ed:
rescan_this:
completed = 0;
prev = &ed->hwHeadP;
- list_for_each_safe (entry, tmp, &ed->td_list) {
+ list_for_each_safe(entry, tmp, &ed->td_list) {
struct td *td;
struct urb *urb;
struct urb_priv *urb_priv;
@@ -795,7 +793,7 @@ rescan_this:
*prev = td->hwNextTD | savebits;
/* HC may have partly processed this TD */
- urb_print(urb, "PARTIAL", 1);
+ urb_print(ahcd, urb, "PARTIAL", 1);
td_done(ahcd, urb, td);
/* if URB is done, clean up */
@@ -804,7 +802,7 @@ rescan_this:
finish_urb(ahcd, urb);
}
}
- if (completed && !list_empty (&ed->td_list))
+ if (completed && !list_empty(&ed->td_list))
goto rescan_this;
/* ED's now officially unlinked, hc doesn't see */
@@ -812,10 +810,10 @@ rescan_this:
ed->hwHeadP &= ~cpu_to_hc32(ahcd, ED_H);
ed->hwNextED = 0;
wmb ();
- ed->hwINFO &= ~cpu_to_hc32 (ahcd, ED_SKIP | ED_DEQUEUE);
+ ed->hwINFO &= ~cpu_to_hc32(ahcd, ED_SKIP | ED_DEQUEUE);
/* but if there's work queued, reschedule */
- if (!list_empty (&ed->td_list)) {
+ if (!list_empty(&ed->td_list)) {
if (HC_IS_RUNNING(admhcd_to_hcd(ahcd)->state))
ed_schedule(ahcd, ed);
}
@@ -838,9 +836,7 @@ rescan_this:
static void ed_unhalt(struct admhcd *ahcd, struct ed *ed, struct urb *urb)
{
struct list_head *entry,*tmp;
- struct urb_priv *urb_priv = urb->hcpriv;
- __hc32 toggle = ed->hwHeadP & cpu_to_hc32 (ahcd, ED_C);
-
+ __hc32 toggle = ed->hwHeadP & cpu_to_hc32(ahcd, ED_C);
#ifdef ADMHC_VERBOSE_DEBUG
admhc_dump_ed(ahcd, "UNHALT", ed, 0);
@@ -848,9 +844,9 @@ static void ed_unhalt(struct admhcd *ahcd, struct ed *ed, struct urb *urb)
/* clear ed halt; this is the td that caused it, but keep it inactive
* until its urb->complete() has a chance to clean up.
*/
- ed->hwINFO |= cpu_to_hc32 (ahcd, ED_SKIP);
+ ed->hwINFO |= cpu_to_hc32(ahcd, ED_SKIP);
wmb();
- ed->hwHeadP &= ~cpu_to_hc32 (ahcd, ED_H);
+ ed->hwHeadP &= ~cpu_to_hc32(ahcd, ED_H);
list_for_each_safe(entry, tmp, &ed->td_list) {
struct td *td = list_entry(entry, struct td, td_list);
@@ -913,13 +909,13 @@ static void ed_update(struct admhcd *ahcd, struct ed *ed)
start_ed_unlink(ahcd, ed);
/* ... reenabling halted EDs only after fault cleanup */
- } else if ((ed->hwINFO & cpu_to_hc32 (ahcd,
+ } else if ((ed->hwINFO & cpu_to_hc32(ahcd,
ED_SKIP | ED_DEQUEUE))
- == cpu_to_hc32 (ahcd, ED_SKIP)) {
+ == cpu_to_hc32(ahcd, ED_SKIP)) {
td = list_entry(ed->td_list.next, struct td, td_list);
#if 0
- if (!(td->hwINFO & cpu_to_hc32 (ahcd, TD_DONE))) {
- ed->hwINFO &= ~cpu_to_hc32 (ahcd, ED_SKIP);
+ if (!(td->hwINFO & cpu_to_hc32(ahcd, TD_DONE))) {
+ ed->hwINFO &= ~cpu_to_hc32(ahcd, ED_SKIP);
/* ... hc may need waking-up */
switch (ed->type) {
case PIPE_CONTROL: