summaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2007-08-10 19:23:53 +0000
committerGabor Juhos <juhosg@openwrt.org>2007-08-10 19:23:53 +0000
commit92bfc02547a7672fa744314f6efe513744e2a9df (patch)
treec0c0ee86609202f029a394570756ac3a59d0144c /target
parent8c9dcd936fc44031a35362b730d7557a3692d7b3 (diff)
downloadmaster-31e0f0ae-92bfc02547a7672fa744314f6efe513744e2a9df.tar.gz
master-31e0f0ae-92bfc02547a7672fa744314f6efe513744e2a9df.tar.bz2
master-31e0f0ae-92bfc02547a7672fa744314f6efe513744e2a9df.zip
USB driver fixes * fix allocation of the ED/TD descriptors * remove some unused fields from admhcd struct
SVN-Revision: 8391
Diffstat (limited to 'target')
-rw-r--r--target/linux/adm5120-2.6/files/drivers/usb/host/adm5120-hcd.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/target/linux/adm5120-2.6/files/drivers/usb/host/adm5120-hcd.c b/target/linux/adm5120-2.6/files/drivers/usb/host/adm5120-hcd.c
index 03e401a224..7a7076357c 100644
--- a/target/linux/adm5120-2.6/files/drivers/usb/host/adm5120-hcd.c
+++ b/target/linux/adm5120-2.6/files/drivers/usb/host/adm5120-hcd.c
@@ -90,6 +90,7 @@ MODULE_AUTHOR("Jeroen Vreeken (pe1rxq@amsat.org)");
#define ADMHCD_REG_HOSTHEAD 0x80
#define ADMHCD_NUMPORTS 2
+#define ADMHCD_DESC_ALIGN 16
struct admhcd_ed {
/* Don't change first four, they used for DMA */
@@ -155,13 +156,12 @@ static int admhcd_td_err[16] = {
#define ADMHCD_TD_ERRMASK 0x38000000
#define ADMHCD_TD_ERRSHIFT 27
-#define TD(td) ((struct admhcd_td *)(((u32)(td)) & ~0xf))
-#define ED(ed) ((struct admhcd_ed *)(((u32)(ed)) & ~0xf))
+#define TD(td) ((struct admhcd_td *)(((u32)(td)) & ~(ADMHCD_DESC_ALIGN-1)))
+#define ED(ed) ((struct admhcd_ed *)(((u32)(ed)) & ~(ADMHCD_DESC_ALIGN-1)))
struct admhcd {
spinlock_t lock;
- void __iomem *data_reg;
/* Root hub registers */
u32 rhdesca;
u32 rhdescb;
@@ -173,7 +173,6 @@ struct admhcd {
u32 base;
u32 dma_en;
unsigned long flags;
-
};
static inline struct admhcd *hcd_to_admhcd(struct usb_hcd *hcd)
@@ -217,12 +216,12 @@ static struct admhcd_td *admhcd_td_alloc(struct admhcd_ed *ed, struct urb *urb)
{
struct admhcd_td *tdn, *td;
- tdn = kzalloc(sizeof(*tdn), GFP_ATOMIC);
+ tdn = kzalloc(sizeof(*tdn)+ADMHCD_DESC_ALIGN, GFP_ATOMIC);
if (!tdn)
return NULL;
tdn->real = tdn;
- tdn = (struct admhcd_td *)KSEG1ADDR(tdn);
+ tdn = TD(KSEG1ADDR(tdn));
if (ed->cur == NULL) {
ed->cur = tdn;
ed->head = tdn;
@@ -283,12 +282,12 @@ static struct admhcd_ed *admhcd_get_ed(struct admhcd *ahcd,
}
}
if (!found) {
- found = kzalloc(sizeof(*found), GFP_ATOMIC);
+ found = kzalloc(sizeof(*found)+ADMHCD_DESC_ALIGN, GFP_ATOMIC);
if (!found)
goto out;
found->real = found;
found->ep = ep;
- found = (struct admhcd_ed *)KSEG1ADDR(found);
+ found = ED(KSEG1ADDR(found));
found->control = usb_pipedevice(pipe) |
(usb_pipeendpoint(pipe) << ADMHCD_ED_EPSHIFT) |
(usb_pipeint(pipe) ? ADMHCD_ED_INT : 0) |
@@ -900,7 +899,6 @@ static int __init adm5120hcd_probe(struct platform_device *pdev)
hcd->regs = data_reg;
ahcd = hcd_to_admhcd(hcd);
- ahcd->data_reg = data_reg;
ahcd->base = (u32)data_reg;
spin_lock_init(&ahcd->lock);
@@ -921,7 +919,7 @@ out_dev:
out_unmap:
iounmap(data_reg);
out_mem:
- release_mem_region(pdev->resource[0].start, pdev->resource[0].end - pdev->resource[0].start +1);
+ release_mem_region(data->start, resource_len(data));
out:
return err;
}