summaryrefslogtreecommitdiff
path: root/drivers/sl811_usb.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2004-05-05 19:44:41 +0000
committerwdenk <wdenk>2004-05-05 19:44:41 +0000
commit32877d66aa5f49469ee3ade6a258290f587ea420 (patch)
tree3abac28fa7bf6100781307decec970efa0b62e3d /drivers/sl811_usb.c
parent62b4ac98a46cd091042b8d2801cb989a8c7c538d (diff)
downloadu-boot-imx-32877d66aa5f49469ee3ade6a258290f587ea420.zip
u-boot-imx-32877d66aa5f49469ee3ade6a258290f587ea420.tar.gz
u-boot-imx-32877d66aa5f49469ee3ade6a258290f587ea420.tar.bz2
* Fix memory leak in the NAND-specific JFFS2 code
* Fix SL811 USB controller when attached to a USB hub
Diffstat (limited to 'drivers/sl811_usb.c')
-rw-r--r--drivers/sl811_usb.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/sl811_usb.c b/drivers/sl811_usb.c
index ce5afe0..5136cdc 100644
--- a/drivers/sl811_usb.c
+++ b/drivers/sl811_usb.c
@@ -226,7 +226,12 @@ int usb_lowlevel_stop(void)
return 0;
}
-int sl811_send_packet(int dir_to_host, int data1, __u8 *buffer, int len)
+static int calc_needed_buswidth(int bytes, int low_speed)
+{
+ return bytes * 8 + 512;
+}
+
+static int sl811_send_packet(int dir_to_host, int data1, __u8 *buffer, int len)
{
__u8 ctrl = SL811_USB_CTRL_ARM | SL811_USB_CTRL_ENABLE;
__u16 status = 0;
@@ -248,7 +253,7 @@ int sl811_send_packet(int dir_to_host, int data1, __u8 *buffer, int len)
if (!dir_to_host && len)
sl811_write_buf(0x10, buffer, len);
- if (sl811_read(SL811_SOFCNTDIV)*64 < len * 8 * 2)
+ if (sl811_read(SL811_SOFCNTDIV)*64 < calc_needed_buswidth(len, 0))
ctrl |= SL811_USB_CTRL_SOF;
else
ctrl &= ~SL811_USB_CTRL_SOF;
@@ -494,7 +499,7 @@ static int ascii2utf (char *s, u8 *utf, int utfmax)
* root_hub_string is used by each host controller's root hub code,
* so that they're identified consistently throughout the system.
*/
-int usb_root_hub_string (int id, int serial, char *type, __u8 *data, int len)
+static int usb_root_hub_string (int id, int serial, char *type, __u8 *data, int len)
{
char buf [30];
@@ -503,7 +508,7 @@ int usb_root_hub_string (int id, int serial, char *type, __u8 *data, int len)
/* language ids */
if (id == 0) {
- *data++ = 4; *data++ = 3; /* 4 bytes data */
+ *data++ = 3; *data++ = 4; /* 4 bytes data */
*data++ = 0; *data++ = 0; /* some language id */
return 4;