Commit de0dafba authored by shanshe's avatar shanshe
Browse files

USB fixes for reading/writing big files

parent 79470c76
......@@ -30,16 +30,17 @@ uint32_t virt_to_phys(void* addr) {
}
// FIXME
int tmr=0;
unsigned long tmr=0;
void udelay(int us) {
usleep(us);
}
void mdelay(int ms) {
usleep(1000*ms);
}
int get_timer(int i) {
unsigned long get_timer(unsigned long i) {
mdelay(1);
return tmr++;
tmr++;
return (tmr-i);
}
#ifndef CONFIG_USB_MAX_CONTROLLER_COUNT
......@@ -256,7 +257,7 @@ static int ehci_td_buffer(struct qTD *td, void *buf, size_t sz)
int idx;
if (addr != ALIGN(addr, ARCH_DMA_MINALIGN))
printf("EHCI-HCD: Misaligned buffer address (%p vs %x)\n", buf, ALIGN(addr, ARCH_DMA_MINALIGN));
printf("EHCI-HCD: Misaligned buffer address (%p vs %lx)\n", buf, ALIGN(addr, ARCH_DMA_MINALIGN));
flush_dcache_range(addr, ALIGN(addr + sz, ARCH_DMA_MINALIGN));
......@@ -322,7 +323,7 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer,
uint32_t endpt, maxpacket, token, usbsts;
uint32_t c, toggle;
uint32_t cmd;
int timeout;
unsigned long timeout;
int ret = 0;
struct ehci_ctrl *ctrl = ehci_get_ctrl(dev);
......
......@@ -33,6 +33,8 @@
#include <stdio.h>
#include <string.h>
void mdelay(int ms);
static inline void *malloc_cache_aligned(size_t size)
{
return memalign(ARCH_DMA_MINALIGN, ALIGN(size, ARCH_DMA_MINALIGN));
......
......@@ -49,7 +49,7 @@
* This is the timeout to allow for submitting an urb in ms. We allow more
* time for a BULK device to react - some are slow.
*/
#define USB_TIMEOUT_MS(pipe) (usb_pipebulk(pipe) ? 20000 : 4000) // FIXME quadrupled
#define USB_TIMEOUT_MS(pipe) (usb_pipebulk(pipe) ? 500 : 100) // FIXME quadrupled, shanshe restored original values
/* device request (setup) */
struct devrequest {
......
......@@ -36,6 +36,9 @@
#include "usb.h"
unsigned long get_timer(unsigned long i);
void mdelay(int ms);
#define max(x, y) ({ \
typeof(x) _max1 = (x); \
typeof(y) _max2 = (y); \
......@@ -400,7 +403,7 @@ static int usb_scan_port(struct usb_device_scan *usb_scan)
portstatus = le16_to_cpu(portsts->wPortStatus);
portchange = le16_to_cpu(portsts->wPortChange);
printf("[usb-hub] Port %d Status %X Change %X\n", i + 1, portstatus, portchange);
// printf("[usb-hub] Port %d Status %X Change %X\n", i + 1, portstatus, portchange);
/*
* No connection change happened, wait a bit more.
......
......@@ -44,6 +44,8 @@
#undef BBB_COMDAT_TRACE
#undef BBB_XPORT_TRACE
void mdelay(int ms);
#include "scsi.h"
/* direction table -- this indicates the direction of the data
* transfer for each command code -- a 1 indicates input
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment