Merge branch 'master' of git://git.denx.de/u-boot-usb

This commit is contained in:
Wolfgang Denk
2008-12-05 00:24:32 +01:00
12 changed files with 475 additions and 427 deletions

View File

@@ -40,29 +40,30 @@ char * usb_get_class_desc(unsigned char dclass)
{ {
switch (dclass) { switch (dclass) {
case USB_CLASS_PER_INTERFACE: case USB_CLASS_PER_INTERFACE:
return("See Interface"); return "See Interface";
case USB_CLASS_AUDIO: case USB_CLASS_AUDIO:
return("Audio"); return "Audio";
case USB_CLASS_COMM: case USB_CLASS_COMM:
return("Communication"); return "Communication";
case USB_CLASS_HID: case USB_CLASS_HID:
return("Human Interface"); return "Human Interface";
case USB_CLASS_PRINTER: case USB_CLASS_PRINTER:
return("Printer"); return "Printer";
case USB_CLASS_MASS_STORAGE: case USB_CLASS_MASS_STORAGE:
return("Mass Storage"); return "Mass Storage";
case USB_CLASS_HUB: case USB_CLASS_HUB:
return("Hub"); return "Hub";
case USB_CLASS_DATA: case USB_CLASS_DATA:
return("CDC Data"); return "CDC Data";
case USB_CLASS_VENDOR_SPEC: case USB_CLASS_VENDOR_SPEC:
return("Vendor specific"); return "Vendor specific";
default: default:
return(""); return "";
} }
} }
void usb_display_class_sub(unsigned char dclass,unsigned char subclass,unsigned char proto) void usb_display_class_sub(unsigned char dclass, unsigned char subclass,
unsigned char proto)
{ {
switch (dclass) { switch (dclass) {
case USB_CLASS_PER_INTERFACE: case USB_CLASS_PER_INTERFACE:
@@ -88,10 +89,12 @@ void usb_display_class_sub(unsigned char dclass,unsigned char subclass,unsigned
break; break;
default: default:
printf("reserved"); printf("reserved");
break;
} }
break; break;
default: default:
printf("reserved"); printf("reserved");
break;
} }
break; break;
case USB_CLASS_MASS_STORAGE: case USB_CLASS_MASS_STORAGE:
@@ -132,10 +135,12 @@ void usb_display_class_sub(unsigned char dclass,unsigned char subclass,unsigned
break; break;
default: default:
printf("reserved"); printf("reserved");
break;
} }
break; break;
default: default:
printf("%s", usb_get_class_desc(dclass)); printf("%s", usb_get_class_desc(dclass));
break;
} }
} }
@@ -143,7 +148,7 @@ void usb_display_string(struct usb_device *dev,int index)
{ {
char buffer[256]; char buffer[256];
if (index != 0) { if (index != 0) {
if (usb_string(dev,index,&buffer[0],256)>0); if (usb_string(dev, index, &buffer[0], 256) > 0)
printf("String: \"%s\"", buffer); printf("String: \"%s\"", buffer);
} }
} }
@@ -151,29 +156,45 @@ void usb_display_string(struct usb_device *dev,int index)
void usb_display_desc(struct usb_device *dev) void usb_display_desc(struct usb_device *dev)
{ {
if (dev->descriptor.bDescriptorType == USB_DT_DEVICE) { if (dev->descriptor.bDescriptorType == USB_DT_DEVICE) {
printf("%d: %s, USB Revision %x.%x\n",dev->devnum,usb_get_class_desc(dev->config.if_desc[0].bInterfaceClass), printf("%d: %s, USB Revision %x.%x\n", dev->devnum,
(dev->descriptor.bcdUSB>>8) & 0xff,dev->descriptor.bcdUSB & 0xff); usb_get_class_desc(dev->config.if_desc[0].bInterfaceClass),
if (strlen(dev->mf) || strlen(dev->prod) || strlen(dev->serial)) (dev->descriptor.bcdUSB>>8) & 0xff,
printf(" - %s %s %s\n",dev->mf,dev->prod,dev->serial); dev->descriptor.bcdUSB & 0xff);
if (strlen(dev->mf) || strlen(dev->prod) ||
strlen(dev->serial))
printf(" - %s %s %s\n", dev->mf, dev->prod,
dev->serial);
if (dev->descriptor.bDeviceClass) { if (dev->descriptor.bDeviceClass) {
printf(" - Class: "); printf(" - Class: ");
usb_display_class_sub(dev->descriptor.bDeviceClass,dev->descriptor.bDeviceSubClass,dev->descriptor.bDeviceProtocol); usb_display_class_sub(dev->descriptor.bDeviceClass,
dev->descriptor.bDeviceSubClass,
dev->descriptor.bDeviceProtocol);
printf("\n"); printf("\n");
} else {
printf(" - Class: (from Interface) %s\n",
usb_get_class_desc(
dev->config.if_desc[0].bInterfaceClass));
} }
else { printf(" - PacketSize: %d Configurations: %d\n",
printf(" - Class: (from Interface) %s\n",usb_get_class_desc(dev->config.if_desc[0].bInterfaceClass)); dev->descriptor.bMaxPacketSize0,
} dev->descriptor.bNumConfigurations);
printf(" - PacketSize: %d Configurations: %d\n",dev->descriptor.bMaxPacketSize0,dev->descriptor.bNumConfigurations); printf(" - Vendor: 0x%04x Product 0x%04x Version %d.%d\n",
printf(" - Vendor: 0x%04x Product 0x%04x Version %d.%d\n",dev->descriptor.idVendor,dev->descriptor.idProduct,(dev->descriptor.bcdDevice>>8) & 0xff,dev->descriptor.bcdDevice & 0xff); dev->descriptor.idVendor, dev->descriptor.idProduct,
(dev->descriptor.bcdDevice>>8) & 0xff,
dev->descriptor.bcdDevice & 0xff);
} }
} }
void usb_display_conf_desc(struct usb_config_descriptor *config,struct usb_device *dev) void usb_display_conf_desc(struct usb_config_descriptor *config,
struct usb_device *dev)
{ {
printf(" Configuration: %d\n", config->bConfigurationValue); printf(" Configuration: %d\n", config->bConfigurationValue);
printf(" - Interfaces: %d %s%s%dmA\n",config->bNumInterfaces,(config->bmAttributes & 0x40) ? "Self Powered " : "Bus Powered ", printf(" - Interfaces: %d %s%s%dmA\n", config->bNumInterfaces,
(config->bmAttributes & 0x20) ? "Remote Wakeup " : "",config->MaxPower*2); (config->bmAttributes & 0x40) ? "Self Powered " : "Bus Powered ",
(config->bmAttributes & 0x20) ? "Remote Wakeup " : "",
config->MaxPower*2);
if (config->iConfiguration) { if (config->iConfiguration) {
printf(" - "); printf(" - ");
usb_display_string(dev, config->iConfiguration); usb_display_string(dev, config->iConfiguration);
@@ -181,12 +202,15 @@ void usb_display_conf_desc(struct usb_config_descriptor *config,struct usb_devic
} }
} }
void usb_display_if_desc(struct usb_interface_descriptor *ifdesc,struct usb_device *dev) void usb_display_if_desc(struct usb_interface_descriptor *ifdesc,
struct usb_device *dev)
{ {
printf(" Interface: %d\n", ifdesc->bInterfaceNumber); printf(" Interface: %d\n", ifdesc->bInterfaceNumber);
printf(" - Alternate Setting %d, Endpoints: %d\n",ifdesc->bAlternateSetting,ifdesc->bNumEndpoints); printf(" - Alternate Setting %d, Endpoints: %d\n",
ifdesc->bAlternateSetting, ifdesc->bNumEndpoints);
printf(" - Class "); printf(" - Class ");
usb_display_class_sub(ifdesc->bInterfaceClass,ifdesc->bInterfaceSubClass,ifdesc->bInterfaceProtocol); usb_display_class_sub(ifdesc->bInterfaceClass,
ifdesc->bInterfaceSubClass, ifdesc->bInterfaceProtocol);
printf("\n"); printf("\n");
if (ifdesc->iInterface) { if (ifdesc->iInterface) {
printf(" - "); printf(" - ");
@@ -197,13 +221,21 @@ void usb_display_if_desc(struct usb_interface_descriptor *ifdesc,struct usb_devi
void usb_display_ep_desc(struct usb_endpoint_descriptor *epdesc) void usb_display_ep_desc(struct usb_endpoint_descriptor *epdesc)
{ {
printf(" - Endpoint %d %s ",epdesc->bEndpointAddress & 0xf,(epdesc->bEndpointAddress & 0x80) ? "In" : "Out"); printf(" - Endpoint %d %s ", epdesc->bEndpointAddress & 0xf,
switch((epdesc->bmAttributes & 0x03)) (epdesc->bEndpointAddress & 0x80) ? "In" : "Out");
{ switch ((epdesc->bmAttributes & 0x03)) {
case 0: printf("Control"); break; case 0:
case 1: printf("Isochronous"); break; printf("Control");
case 2: printf("Bulk"); break; break;
case 3: printf("Interrupt"); break; case 1:
printf("Isochronous");
break;
case 2:
printf("Bulk");
break;
case 3:
printf("Interrupt");
break;
} }
printf(" MaxPacket %d", epdesc->wMaxPacketSize); printf(" MaxPacket %d", epdesc->wMaxPacketSize);
if ((epdesc->bmAttributes & 0x03) == 0x3) if ((epdesc->bmAttributes & 0x03) == 0x3)
@@ -252,7 +284,9 @@ void usb_show_tree_graph(struct usb_device *dev,char *pre)
for (i = 0; i < dev->parent->maxchild; i++) { for (i = 0; i < dev->parent->maxchild; i++) {
/* search for children */ /* search for children */
if (dev->parent->children[i] == dev) { if (dev->parent->children[i] == dev) {
/* found our pointer, see if we have a little sister */ /* found our pointer, see if we have a
* little sister
*/
port = i; port = i;
while (i++ < dev->parent->maxchild) { while (i++ < dev->parent->maxchild) {
if (dev->parent->children[i] != NULL) { if (dev->parent->children[i] != NULL) {
@@ -265,9 +299,8 @@ void usb_show_tree_graph(struct usb_device *dev,char *pre)
} /* for all children of the parent */ } /* for all children of the parent */
printf("\b+-"); printf("\b+-");
/* correct last child */ /* correct last child */
if (last_child) { if (last_child)
pre[index-1] = ' '; pre[index-1] = ' ';
}
} /* if not root hub */ } /* if not root hub */
else else
printf(" "); printf(" ");
@@ -275,11 +308,11 @@ void usb_show_tree_graph(struct usb_device *dev,char *pre)
pre[index++] = ' '; pre[index++] = ' ';
pre[index++] = has_child ? '|' : ' '; pre[index++] = has_child ? '|' : ' ';
pre[index] = 0; pre[index] = 0;
printf(" %s (%s, %dmA)\n",usb_get_class_desc(dev->config.if_desc[0].bInterfaceClass), printf(" %s (%s, %dmA)\n", usb_get_class_desc(
dev->slow ? "1.5MBit/s" : "12MBit/s",dev->config.MaxPower * 2); dev->config.if_desc[0].bInterfaceClass),
if (strlen(dev->mf) || dev->slow ? "1.5MBit/s" : "12MBit/s",
strlen(dev->prod) || dev->config.MaxPower * 2);
strlen(dev->serial)) if (strlen(dev->mf) || strlen(dev->prod) || strlen(dev->serial))
printf(" %s %s %s %s\n", pre, dev->mf, dev->prod, dev->serial); printf(" %s %s %s %s\n", pre, dev->mf, dev->prod, dev->serial);
printf(" %s\n", pre); printf(" %s\n", pre);
if (dev->maxchild > 0) { if (dev->maxchild > 0) {
@@ -362,15 +395,18 @@ int do_usbboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (get_partition_info(stor_dev, part, &info)) { if (get_partition_info(stor_dev, part, &info)) {
/* try to boot raw .... */ /* try to boot raw .... */
strncpy((char *)&info.type[0], BOOT_PART_TYPE, sizeof(BOOT_PART_TYPE)); strncpy((char *)&info.type[0], BOOT_PART_TYPE,
sizeof(BOOT_PART_TYPE));
strncpy((char *)&info.name[0], "Raw", 4); strncpy((char *)&info.name[0], "Raw", 4);
info.start = 0; info.start = 0;
info.blksz = 0x200; info.blksz = 0x200;
info.size = 2880; info.size = 2880;
printf("error reading partinfo...try to boot raw\n"); printf("error reading partinfo...try to boot raw\n");
} }
if ((strncmp((char *)info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) && if ((strncmp((char *)info.type, BOOT_PART_TYPE,
(strncmp((char *)info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)) { sizeof(info.type)) != 0) &&
(strncmp((char *)info.type, BOOT_PART_COMP,
sizeof(info.type)) != 0)) {
printf("\n** Invalid partition type \"%.32s\"" printf("\n** Invalid partition type \"%.32s\""
" (expect \"" BOOT_PART_TYPE "\")\n", " (expect \"" BOOT_PART_TYPE "\")\n",
info.type); info.type);
@@ -425,7 +461,9 @@ int do_usbboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
} }
#if defined(CONFIG_FIT) #if defined(CONFIG_FIT)
/* This cannot be done earlier, we need complete FIT image in RAM first */ /* This cannot be done earlier, we need complete FIT image in RAM
* first
*/
if (genimg_get_format((void *)addr) == IMAGE_FORMAT_FIT) { if (genimg_get_format((void *)addr) == IMAGE_FORMAT_FIT) {
if (!fit_check_format(fit_hdr)) { if (!fit_check_format(fit_hdr)) {
puts("** Bad FIT image format\n"); puts("** Bad FIT image format\n");
@@ -455,7 +493,7 @@ int do_usbboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
#endif /* CONFIG_USB_STORAGE */ #endif /* CONFIG_USB_STORAGE */
/********************************************************************************* /******************************************************************************
* usb command intepreter * usb command intepreter
*/ */
int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
@@ -484,11 +522,12 @@ int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
#ifdef CONFIG_USB_KEYBOARD #ifdef CONFIG_USB_KEYBOARD
if (argc == 2) { if (argc == 2) {
if (usb_kbd_deregister() != 0) { if (usb_kbd_deregister() != 0) {
printf("USB not stopped: usbkbd still using USB\n"); printf("USB not stopped: usbkbd still"
" using USB\n");
return 1; return 1;
} }
} } else {
else { /* forced stop, switch console in to serial */ /* forced stop, switch console in to serial */
console_assign(stdin, "serial"); console_assign(stdin, "serial");
usb_kbd_deregister(); usb_kbd_deregister();
} }
@@ -517,8 +556,7 @@ int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
usb_display_config(dev); usb_display_config(dev);
} }
return 0; return 0;
} } else {
else {
int d; int d;
i = simple_strtoul(argv[2], NULL, 16); i = simple_strtoul(argv[2], NULL, 16);
@@ -533,8 +571,7 @@ int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (dev == NULL) { if (dev == NULL) {
printf("*** NO Device avaiable ***\n"); printf("*** NO Device avaiable ***\n");
return 0; return 0;
} } else {
else {
usb_display_desc(dev); usb_display_desc(dev);
usb_display_config(dev); usb_display_config(dev);
} }
@@ -542,16 +579,8 @@ int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return 0; return 0;
} }
#ifdef CONFIG_USB_STORAGE #ifdef CONFIG_USB_STORAGE
if (strncmp(argv[1], "scan", 4) == 0) { if (strncmp(argv[1], "stor", 4) == 0)
printf(" NOTE: this command is obsolete and will be phased out\n");
printf(" please use 'usb storage' for USB storage devices information\n\n");
usb_stor_info();
return 0;
}
if (strncmp(argv[1], "stor", 4) == 0) {
return usb_stor_info(); return usb_stor_info();
}
if (strncmp(argv[1], "part", 4) == 0) { if (strncmp(argv[1], "part", 4) == 0) {
int devno, ok = 0; int devno, ok = 0;
@@ -566,8 +595,7 @@ int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
print_part(stor_dev); print_part(stor_dev);
} }
} }
} } else {
else {
devno = simple_strtoul(argv[2], NULL, 16); devno = simple_strtoul(argv[2], NULL, 16);
stor_dev = usb_stor_get_dev(devno); stor_dev = usb_stor_get_dev(devno);
if (stor_dev->type != DEV_TYPE_UNKNOWN) { if (stor_dev->type != DEV_TYPE_UNKNOWN) {
@@ -592,11 +620,13 @@ int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
unsigned long blk = simple_strtoul(argv[3], NULL, 16); unsigned long blk = simple_strtoul(argv[3], NULL, 16);
unsigned long cnt = simple_strtoul(argv[4], NULL, 16); unsigned long cnt = simple_strtoul(argv[4], NULL, 16);
unsigned long n; unsigned long n;
printf ("\nUSB read: device %d block # %ld, count %ld ... ", printf("\nUSB read: device %d block # %ld, count %ld"
usb_stor_curr_dev, blk, cnt); " ... ", usb_stor_curr_dev, blk, cnt);
stor_dev = usb_stor_get_dev(usb_stor_curr_dev); stor_dev = usb_stor_get_dev(usb_stor_curr_dev);
n = stor_dev->block_read(usb_stor_curr_dev, blk, cnt, (ulong *)addr); n = stor_dev->block_read(usb_stor_curr_dev, blk, cnt,
printf ("%ld blocks read: %s\n",n,(n==cnt) ? "OK" : "ERROR"); (ulong *)addr);
printf("%ld blocks read: %s\n", n,
(n == cnt) ? "OK" : "ERROR");
if (n == cnt) if (n == cnt)
return 0; return 0;
return 1; return 1;
@@ -613,20 +643,17 @@ int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
printf("\n Device %d: ", dev); printf("\n Device %d: ", dev);
stor_dev = usb_stor_get_dev(dev); stor_dev = usb_stor_get_dev(dev);
dev_print(stor_dev); dev_print(stor_dev);
if (stor_dev->type == DEV_TYPE_UNKNOWN) { if (stor_dev->type == DEV_TYPE_UNKNOWN)
return 1; return 1;
}
usb_stor_curr_dev = dev; usb_stor_curr_dev = dev;
printf("... is now current device\n"); printf("... is now current device\n");
return 0; return 0;
} } else {
else {
printf("\nUSB device %d: ", usb_stor_curr_dev); printf("\nUSB device %d: ", usb_stor_curr_dev);
stor_dev = usb_stor_get_dev(usb_stor_curr_dev); stor_dev = usb_stor_get_dev(usb_stor_curr_dev);
dev_print(stor_dev); dev_print(stor_dev);
if (stor_dev->type == DEV_TYPE_UNKNOWN) { if (stor_dev->type == DEV_TYPE_UNKNOWN)
return 1; return 1;
}
return 0; return 0;
} }
return 0; return 0;
@@ -646,7 +673,8 @@ U_BOOT_CMD(
"usb info [dev] - show available USB devices\n" "usb info [dev] - show available USB devices\n"
"usb storage - show details of USB storage devices\n" "usb storage - show details of USB storage devices\n"
"usb dev [dev] - show or set current USB storage device\n" "usb dev [dev] - show or set current USB storage device\n"
"usb part [dev] - print partition table of one or all USB storage devices\n" "usb part [dev] - print partition table of one or all USB storage"
" devices\n"
"usb read addr blk# cnt - read `cnt' blocks starting at block `blk#'\n" "usb read addr blk# cnt - read `cnt' blocks starting at block `blk#'\n"
" to memory address `addr'\n" " to memory address `addr'\n"
); );

View File

@@ -87,11 +87,12 @@ static int hub_port_reset(struct usb_device *dev, int port,
* wait_ms * wait_ms
*/ */
void __inline__ wait_ms(unsigned long ms) inline void wait_ms(unsigned long ms)
{ {
while (ms-- > 0) while (ms-- > 0)
udelay(1000); udelay(1000);
} }
/*************************************************************************** /***************************************************************************
* Init USB Device * Init USB Device
*/ */
@@ -245,9 +246,9 @@ int usb_maxpacket(struct usb_device *dev, unsigned long pipe)
{ {
/* direction is out -> use emaxpacket out */ /* direction is out -> use emaxpacket out */
if ((pipe & USB_DIR_IN) == 0) if ((pipe & USB_DIR_IN) == 0)
return(dev->epmaxpacketout[((pipe>>15) & 0xf)]); return dev->epmaxpacketout[((pipe>>15) & 0xf)];
else else
return(dev->epmaxpacketin[((pipe>>15) & 0xf)]); return dev->epmaxpacketin[((pipe>>15) & 0xf)];
} }
/* The routine usb_set_maxpacket_ep() is extracted from the loop of routine /* The routine usb_set_maxpacket_ep() is extracted from the loop of routine
@@ -793,7 +794,8 @@ int usb_new_device(struct usb_device *dev)
* reset of the device (Linux uses the same sequence) * reset of the device (Linux uses the same sequence)
* Some equipment is said to work only with such init sequence; this * Some equipment is said to work only with such init sequence; this
* patch is based on the work by Alan Stern: * patch is based on the work by Alan Stern:
* http://sourceforge.net/mailarchive/forum.php?thread_id=5729457&forum_id=5398 * http://sourceforge.net/mailarchive/forum.php?
* thread_id=5729457&forum_id=5398
*/ */
struct usb_device_descriptor *desc; struct usb_device_descriptor *desc;
int port = -1; int port = -1;
@@ -847,10 +849,18 @@ int usb_new_device(struct usb_device *dev)
dev->epmaxpacketin[0] = dev->descriptor.bMaxPacketSize0; dev->epmaxpacketin[0] = dev->descriptor.bMaxPacketSize0;
dev->epmaxpacketout[0] = dev->descriptor.bMaxPacketSize0; dev->epmaxpacketout[0] = dev->descriptor.bMaxPacketSize0;
switch (dev->descriptor.bMaxPacketSize0) { switch (dev->descriptor.bMaxPacketSize0) {
case 8: dev->maxpacketsize = PACKET_SIZE_8; break; case 8:
case 16: dev->maxpacketsize = PACKET_SIZE_16; break; dev->maxpacketsize = PACKET_SIZE_8;
case 32: dev->maxpacketsize = PACKET_SIZE_32; break; break;
case 64: dev->maxpacketsize = PACKET_SIZE_64; break; case 16:
dev->maxpacketsize = PACKET_SIZE_16;
break;
case 32:
dev->maxpacketsize = PACKET_SIZE_32;
break;
case 64:
dev->maxpacketsize = PACKET_SIZE_64;
break;
} }
dev->devnum = addr; dev->devnum = addr;

View File

@@ -25,15 +25,22 @@ include $(TOPDIR)/config.mk
LIB := $(obj)libusb.a LIB := $(obj)libusb.a
COBJS-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o # core
COBJS-y += isp116x-hcd.o
COBJS-y += sl811_usb.o
COBJS-y += usb_ohci.o
COBJS-y += usbdcore.o COBJS-y += usbdcore.o
COBJS-$(CONFIG_USB_OHCI_NEW) += usb_ohci.o
# host
COBJS-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o
COBJS-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o
COBJS-$(CONFIG_USB_SL811HS) += sl811_usb.o
# device
ifdef CONFIG_USB_DEVICE
COBJS-y += usbdcore_ep0.o COBJS-y += usbdcore_ep0.o
COBJS-y += usbdcore_mpc8xx.o COBJS-$(CONFIG_OMAP1510) += usbdcore_omap1510.o
COBJS-y += usbdcore_omap1510.o COBJS-$(CONFIG_OMAP1610) += usbdcore_omap1510.o
COBJS-$(CONFIG_MPC885_FAMILY) += usbdcore_mpc8xx.o
endif
COBJS := $(COBJS-y) COBJS := $(COBJS-y)
SRCS := $(COBJS:.o=.c) SRCS := $(COBJS:.o=.c)

View File

@@ -56,8 +56,6 @@
*/ */
#include <common.h> #include <common.h>
#ifdef CONFIG_USB_ISP116X_HCD
#include <asm/io.h> #include <asm/io.h>
#include <usb.h> #include <usb.h>
#include <malloc.h> #include <malloc.h>
@@ -1441,5 +1439,3 @@ int usb_lowlevel_stop(void)
return 0; return 0;
} }
#endif /* CONFIG_USB_ISP116X_HCD */

View File

@@ -36,7 +36,6 @@
*/ */
#include <common.h> #include <common.h>
#ifdef CONFIG_USB_SL811HS
#include <mpc8xx.h> #include <mpc8xx.h>
#include <usb.h> #include <usb.h>
#include "sl811.h" #include "sl811.h"
@@ -733,5 +732,3 @@ static int sl811_rh_submit_urb(struct usb_device *usb_dev, unsigned long pipe,
return status == 0 ? len : status; return status == 0 ? len : status;
} }
#endif /* CONFIG_USB_SL811HS */

View File

@@ -46,9 +46,6 @@
*/ */
#include <common.h> #include <common.h>
#ifdef CONFIG_USB_OHCI_NEW
#include <asm/byteorder.h> #include <asm/byteorder.h>
#if defined(CONFIG_PCI_OHCI) #if defined(CONFIG_PCI_OHCI)
@@ -2016,4 +2013,3 @@ int usb_lowlevel_stop(void)
ohci_inited = 0; ohci_inited = 0;
return 0; return 0;
} }
#endif /* CONFIG_USB_OHCI_NEW */

View File

@@ -51,8 +51,6 @@
*/ */
#include <common.h> #include <common.h>
#if defined(CONFIG_USB_DEVICE)
#include "usbdcore.h" #include "usbdcore.h"
#if 0 #if 0
@@ -597,5 +595,3 @@ int ep0_recv_setup (struct urb *urb)
} }
return -1; return -1;
} }
#endif

View File

@@ -58,8 +58,6 @@
*/ */
#include <common.h> #include <common.h>
#include <config.h> #include <config.h>
#if defined(CONFIG_MPC885_FAMILY) && defined(CONFIG_USB_DEVICE)
#include <commproc.h> #include <commproc.h>
#include "usbdcore.h" #include "usbdcore.h"
#include "usbdcore_mpc8xx.h" #include "usbdcore_mpc8xx.h"
@@ -1398,5 +1396,3 @@ static u32 mpc8xx_udc_alloc (u32 data_size, u32 alignment)
return retaddr; return retaddr;
} }
#endif /* CONFIG_MPC885_FAMILY && CONFIG_USB_DEVICE) */

View File

@@ -27,9 +27,6 @@
*/ */
#include <common.h> #include <common.h>
#if ((defined(CONFIG_OMAP1510) || defined(CONFIG_OMAP1610)) && defined(CONFIG_USB_DEVICE))
#include <asm/io.h> #include <asm/io.h>
#ifdef CONFIG_OMAP_SX1 #ifdef CONFIG_OMAP_SX1
#include <i2c.h> #include <i2c.h>
@@ -1566,4 +1563,3 @@ void udc_unset_nak (int epid)
{ {
/* TODO: implement this functionality in omap1510 */ /* TODO: implement this functionality in omap1510 */
} }
#endif

View File

@@ -184,7 +184,7 @@ static void get_name (dir_entry *dirent, char *s_name)
if (*s_name == DELETED_FLAG) if (*s_name == DELETED_FLAG)
*s_name = '\0'; *s_name = '\0';
else if (*s_name == aRING) else if (*s_name == aRING)
*s_name = '<EFBFBD>'; *s_name = DELETED_FLAG;
downcase (s_name); downcase (s_name);
} }
@@ -489,7 +489,7 @@ get_vfatname(fsdata *mydata, int curclust, __u8 *cluster,
l_name[idx] = '\0'; l_name[idx] = '\0';
if (*l_name == DELETED_FLAG) *l_name = '\0'; if (*l_name == DELETED_FLAG) *l_name = '\0';
else if (*l_name == aRING) *l_name = '<EFBFBD>'; else if (*l_name == aRING) *l_name = DELETED_FLAG;
downcase(l_name); downcase(l_name);
/* Return the real directory entry */ /* Return the real directory entry */

View File

@@ -67,7 +67,7 @@
#define ATTR_VFAT (ATTR_RO | ATTR_HIDDEN | ATTR_SYS | ATTR_VOLUME) #define ATTR_VFAT (ATTR_RO | ATTR_HIDDEN | ATTR_SYS | ATTR_VOLUME)
#define DELETED_FLAG ((char)0xe5) /* Marks deleted files when in name[0] */ #define DELETED_FLAG ((char)0xe5) /* Marks deleted files when in name[0] */
#define aRING 0x05 /* Used to represent '<27>' in name[0] */ #define aRING 0x05 /* Used as special character in name[0] */
/* Indicates that the entry is the last long entry in a set of long /* Indicates that the entry is the last long entry in a set of long
* dir entries * dir entries

View File

@@ -57,7 +57,6 @@ struct devrequest {
unsigned short length; unsigned short length;
} __attribute__ ((packed)); } __attribute__ ((packed));
/* All standard descriptors have these 2 fields in common */ /* All standard descriptors have these 2 fields in common */
struct usb_descriptor_header { struct usb_descriptor_header {
unsigned char bLength; unsigned char bLength;
@@ -82,7 +81,6 @@ struct usb_device_descriptor {
unsigned char bNumConfigurations; unsigned char bNumConfigurations;
} __attribute__ ((packed)); } __attribute__ ((packed));
/* Endpoint descriptor */ /* Endpoint descriptor */
struct usb_endpoint_descriptor { struct usb_endpoint_descriptor {
unsigned char bLength; unsigned char bLength;
@@ -93,8 +91,8 @@ struct usb_endpoint_descriptor {
unsigned char bInterval; unsigned char bInterval;
unsigned char bRefresh; unsigned char bRefresh;
unsigned char bSynchAddress; unsigned char bSynchAddress;
} __attribute__ ((packed)); } __attribute__ ((packed));
/* Interface descriptor */ /* Interface descriptor */
struct usb_interface_descriptor { struct usb_interface_descriptor {
unsigned char bLength; unsigned char bLength;
@@ -110,6 +108,7 @@ struct usb_interface_descriptor {
unsigned char no_of_ep; unsigned char no_of_ep;
unsigned char num_altsetting; unsigned char num_altsetting;
unsigned char act_altsetting; unsigned char act_altsetting;
struct usb_endpoint_descriptor ep_desc[USB_MAXENDPOINTS]; struct usb_endpoint_descriptor ep_desc[USB_MAXENDPOINTS];
} __attribute__ ((packed)); } __attribute__ ((packed));
@@ -148,9 +147,10 @@ struct usb_device {
int maxpacketsize; int maxpacketsize;
/* one bit for each endpoint ([0] = IN, [1] = OUT) */ /* one bit for each endpoint ([0] = IN, [1] = OUT) */
unsigned int toggle[2]; unsigned int toggle[2];
/* endpoint halts; one bit per endpoint # & direction; */ /* endpoint halts; one bit per endpoint # & direction;
* [0] = IN, [1] = OUT
*/
unsigned int halted[2]; unsigned int halted[2];
/* [0] = IN, [1] = OUT */
int epmaxpacketin[16]; /* INput endpoint specific maximums */ int epmaxpacketin[16]; /* INput endpoint specific maximums */
int epmaxpacketout[16]; /* OUTput endpoint specific maximums */ int epmaxpacketout[16]; /* OUTput endpoint specific maximums */
@@ -185,7 +185,8 @@ struct usb_device {
int usb_lowlevel_init(void); int usb_lowlevel_init(void);
int usb_lowlevel_stop(void); int usb_lowlevel_stop(void);
int submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer,int transfer_len); int submit_bulk_msg(struct usb_device *dev, unsigned long pipe,
void *buffer, int transfer_len);
int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer, int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
int transfer_len, struct devrequest *setup); int transfer_len, struct devrequest *setup);
int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer, int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
@@ -221,7 +222,8 @@ int usb_stop(void); /* stop the USB Controller */
int usb_set_protocol(struct usb_device *dev, int ifnum, int protocol); int usb_set_protocol(struct usb_device *dev, int ifnum, int protocol);
int usb_set_idle(struct usb_device *dev, int ifnum, int duration, int report_id); int usb_set_idle(struct usb_device *dev, int ifnum, int duration,
int report_id);
struct usb_device *usb_get_dev_index(int index); struct usb_device *usb_get_dev_index(int index);
int usb_control_msg(struct usb_device *dev, unsigned int pipe, int usb_control_msg(struct usb_device *dev, unsigned int pipe,
unsigned char request, unsigned char requesttype, unsigned char request, unsigned char requesttype,
@@ -233,11 +235,14 @@ int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
void *buffer, int transfer_len, int interval); void *buffer, int transfer_len, int interval);
void usb_disable_asynch(int disable); void usb_disable_asynch(int disable);
int usb_maxpacket(struct usb_device *dev, unsigned long pipe); int usb_maxpacket(struct usb_device *dev, unsigned long pipe);
void __inline__ wait_ms(unsigned long ms); inline void wait_ms(unsigned long ms);
int usb_get_configuration_no(struct usb_device *dev,unsigned char *buffer,int cfgno); int usb_get_configuration_no(struct usb_device *dev, unsigned char *buffer,
int usb_get_report(struct usb_device *dev, int ifnum, unsigned char type, unsigned char id, void *buf, int size); int cfgno);
int usb_get_report(struct usb_device *dev, int ifnum, unsigned char type,
unsigned char id, void *buf, int size);
int usb_get_class_descriptor(struct usb_device *dev, int ifnum, int usb_get_class_descriptor(struct usb_device *dev, int ifnum,
unsigned char type, unsigned char id, void *buf, int size); unsigned char type, unsigned char id, void *buf,
int size);
int usb_clear_halt(struct usb_device *dev, int pipe); int usb_clear_halt(struct usb_device *dev, int pipe);
int usb_string(struct usb_device *dev, int index, char *buf, size_t size); int usb_string(struct usb_device *dev, int index, char *buf, size_t size);
int usb_set_interface(struct usb_device *dev, int interface, int alternate); int usb_set_interface(struct usb_device *dev, int interface, int alternate);
@@ -286,12 +291,14 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate);
* unsigned int. The encoding is: * unsigned int. The encoding is:
* *
* - max size: bits 0-1 (00 = 8, 01 = 16, 10 = 32, 11 = 64) * - max size: bits 0-1 (00 = 8, 01 = 16, 10 = 32, 11 = 64)
* - direction: bit 7 (0 = Host-to-Device [Out], 1 = Device-to-Host [In]) * - direction: bit 7 (0 = Host-to-Device [Out],
* (1 = Device-to-Host [In])
* - device: bits 8-14 * - device: bits 8-14
* - endpoint: bits 15-18 * - endpoint: bits 15-18
* - Data0/1: bit 19 * - Data0/1: bit 19
* - speed: bit 26 (0 = Full, 1 = Low Speed) * - speed: bit 26 (0 = Full, 1 = Low Speed)
* - pipe type: bits 30-31 (00 = isochronous, 01 = interrupt, 10 = control, 11 = bulk) * - pipe type: bits 30-31 (00 = isochronous, 01 = interrupt,
* 10 = control, 11 = bulk)
* *
* Why? Because it's arbitrary, and whatever encoding we select is really * Why? Because it's arbitrary, and whatever encoding we select is really
* up to us. This one happens to share a lot of bit positions with the UHCI * up to us. This one happens to share a lot of bit positions with the UHCI
@@ -300,24 +307,42 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate);
*/ */
/* Create various pipes... */ /* Create various pipes... */
#define create_pipe(dev,endpoint) \ #define create_pipe(dev,endpoint) \
(((dev)->devnum << 8) | (endpoint << 15) | ((dev)->slow << 26) | (dev)->maxpacketsize) (((dev)->devnum << 8) | (endpoint << 15) | \
((dev)->slow << 26) | (dev)->maxpacketsize)
#define default_pipe(dev) ((dev)->slow << 26) #define default_pipe(dev) ((dev)->slow << 26)
#define usb_sndctrlpipe(dev,endpoint) ((PIPE_CONTROL << 30) | create_pipe(dev,endpoint)) #define usb_sndctrlpipe(dev, endpoint) ((PIPE_CONTROL << 30) | \
#define usb_rcvctrlpipe(dev,endpoint) ((PIPE_CONTROL << 30) | create_pipe(dev,endpoint) | USB_DIR_IN) create_pipe(dev, endpoint))
#define usb_sndisocpipe(dev,endpoint) ((PIPE_ISOCHRONOUS << 30) | create_pipe(dev,endpoint)) #define usb_rcvctrlpipe(dev, endpoint) ((PIPE_CONTROL << 30) | \
#define usb_rcvisocpipe(dev,endpoint) ((PIPE_ISOCHRONOUS << 30) | create_pipe(dev,endpoint) | USB_DIR_IN) create_pipe(dev, endpoint) | \
#define usb_sndbulkpipe(dev,endpoint) ((PIPE_BULK << 30) | create_pipe(dev,endpoint)) USB_DIR_IN)
#define usb_rcvbulkpipe(dev,endpoint) ((PIPE_BULK << 30) | create_pipe(dev,endpoint) | USB_DIR_IN) #define usb_sndisocpipe(dev, endpoint) ((PIPE_ISOCHRONOUS << 30) | \
#define usb_sndintpipe(dev,endpoint) ((PIPE_INTERRUPT << 30) | create_pipe(dev,endpoint)) create_pipe(dev, endpoint))
#define usb_rcvintpipe(dev,endpoint) ((PIPE_INTERRUPT << 30) | create_pipe(dev,endpoint) | USB_DIR_IN) #define usb_rcvisocpipe(dev, endpoint) ((PIPE_ISOCHRONOUS << 30) | \
#define usb_snddefctrl(dev) ((PIPE_CONTROL << 30) | default_pipe(dev)) create_pipe(dev, endpoint) | \
#define usb_rcvdefctrl(dev) ((PIPE_CONTROL << 30) | default_pipe(dev) | USB_DIR_IN) USB_DIR_IN)
#define usb_sndbulkpipe(dev, endpoint) ((PIPE_BULK << 30) | \
create_pipe(dev, endpoint))
#define usb_rcvbulkpipe(dev, endpoint) ((PIPE_BULK << 30) | \
create_pipe(dev, endpoint) | \
USB_DIR_IN)
#define usb_sndintpipe(dev, endpoint) ((PIPE_INTERRUPT << 30) | \
create_pipe(dev, endpoint))
#define usb_rcvintpipe(dev, endpoint) ((PIPE_INTERRUPT << 30) | \
create_pipe(dev, endpoint) | \
USB_DIR_IN)
#define usb_snddefctrl(dev) ((PIPE_CONTROL << 30) | \
default_pipe(dev))
#define usb_rcvdefctrl(dev) ((PIPE_CONTROL << 30) | \
default_pipe(dev) | \
USB_DIR_IN)
/* The D0/D1 toggle bits */ /* The D0/D1 toggle bits */
#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> ep) & 1) #define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> ep) & 1)
#define usb_dotoggle(dev, ep, out) ((dev)->toggle[out] ^= (1 << ep)) #define usb_dotoggle(dev, ep, out) ((dev)->toggle[out] ^= (1 << ep))
#define usb_settoggle(dev, ep, out, bit) ((dev)->toggle[out] = ((dev)->toggle[out] & ~(1 << ep)) | ((bit) << ep)) #define usb_settoggle(dev, ep, out, bit) ((dev)->toggle[out] = \
((dev)->toggle[out] & \
~(1 << ep)) | ((bit) << ep))
/* Endpoint halt control/status */ /* Endpoint halt control/status */
#define usb_endpoint_out(ep_dir) (((ep_dir >> 7) & 1) ^ 1) #define usb_endpoint_out(ep_dir) (((ep_dir >> 7) & 1) ^ 1)
@@ -325,7 +350,8 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate);
#define usb_endpoint_running(dev, ep, out) ((dev)->halted[out] &= ~(1 << (ep))) #define usb_endpoint_running(dev, ep, out) ((dev)->halted[out] &= ~(1 << (ep)))
#define usb_endpoint_halted(dev, ep, out) ((dev)->halted[out] & (1 << (ep))) #define usb_endpoint_halted(dev, ep, out) ((dev)->halted[out] & (1 << (ep)))
#define usb_packetid(pipe) (((pipe) & USB_DIR_IN) ? USB_PID_IN : USB_PID_OUT) #define usb_packetid(pipe) (((pipe) & USB_DIR_IN) ? USB_PID_IN : \
USB_PID_OUT)
#define usb_pipeout(pipe) ((((pipe) >> 7) & 1) ^ 1) #define usb_pipeout(pipe) ((((pipe) >> 7) & 1) ^ 1)
#define usb_pipein(pipe) (((pipe) >> 7) & 1) #define usb_pipein(pipe) (((pipe) >> 7) & 1)