mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-26 06:30:39 +00:00
Merge branch 'master' of git://git.denx.de/u-boot-usb
This commit is contained in:
commit
26f6a2b7f3
12 changed files with 475 additions and 427 deletions
182
common/cmd_usb.c
182
common/cmd_usb.c
|
@ -40,29 +40,30 @@ char * usb_get_class_desc(unsigned char dclass)
|
|||
{
|
||||
switch (dclass) {
|
||||
case USB_CLASS_PER_INTERFACE:
|
||||
return("See Interface");
|
||||
return "See Interface";
|
||||
case USB_CLASS_AUDIO:
|
||||
return("Audio");
|
||||
return "Audio";
|
||||
case USB_CLASS_COMM:
|
||||
return("Communication");
|
||||
return "Communication";
|
||||
case USB_CLASS_HID:
|
||||
return("Human Interface");
|
||||
return "Human Interface";
|
||||
case USB_CLASS_PRINTER:
|
||||
return("Printer");
|
||||
return "Printer";
|
||||
case USB_CLASS_MASS_STORAGE:
|
||||
return("Mass Storage");
|
||||
return "Mass Storage";
|
||||
case USB_CLASS_HUB:
|
||||
return("Hub");
|
||||
return "Hub";
|
||||
case USB_CLASS_DATA:
|
||||
return("CDC Data");
|
||||
return "CDC Data";
|
||||
case USB_CLASS_VENDOR_SPEC:
|
||||
return("Vendor specific");
|
||||
return "Vendor specific";
|
||||
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) {
|
||||
case USB_CLASS_PER_INTERFACE:
|
||||
|
@ -88,10 +89,12 @@ void usb_display_class_sub(unsigned char dclass,unsigned char subclass,unsigned
|
|||
break;
|
||||
default:
|
||||
printf("reserved");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf("reserved");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case USB_CLASS_MASS_STORAGE:
|
||||
|
@ -132,10 +135,12 @@ void usb_display_class_sub(unsigned char dclass,unsigned char subclass,unsigned
|
|||
break;
|
||||
default:
|
||||
printf("reserved");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
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];
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -151,29 +156,45 @@ void usb_display_string(struct usb_device *dev,int index)
|
|||
void usb_display_desc(struct usb_device *dev)
|
||||
{
|
||||
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),
|
||||
(dev->descriptor.bcdUSB>>8) & 0xff,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);
|
||||
printf("%d: %s, USB Revision %x.%x\n", dev->devnum,
|
||||
usb_get_class_desc(dev->config.if_desc[0].bInterfaceClass),
|
||||
(dev->descriptor.bcdUSB>>8) & 0xff,
|
||||
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) {
|
||||
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");
|
||||
} else {
|
||||
printf(" - Class: (from Interface) %s\n",
|
||||
usb_get_class_desc(
|
||||
dev->config.if_desc[0].bInterfaceClass));
|
||||
}
|
||||
else {
|
||||
printf(" - Class: (from Interface) %s\n",usb_get_class_desc(dev->config.if_desc[0].bInterfaceClass));
|
||||
}
|
||||
printf(" - PacketSize: %d Configurations: %d\n",dev->descriptor.bMaxPacketSize0,dev->descriptor.bNumConfigurations);
|
||||
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);
|
||||
printf(" - PacketSize: %d Configurations: %d\n",
|
||||
dev->descriptor.bMaxPacketSize0,
|
||||
dev->descriptor.bNumConfigurations);
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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(" - Interfaces: %d %s%s%dmA\n",config->bNumInterfaces,(config->bmAttributes & 0x40) ? "Self Powered " : "Bus Powered ",
|
||||
(config->bmAttributes & 0x20) ? "Remote Wakeup " : "",config->MaxPower*2);
|
||||
printf(" - Interfaces: %d %s%s%dmA\n", config->bNumInterfaces,
|
||||
(config->bmAttributes & 0x40) ? "Self Powered " : "Bus Powered ",
|
||||
(config->bmAttributes & 0x20) ? "Remote Wakeup " : "",
|
||||
config->MaxPower*2);
|
||||
if (config->iConfiguration) {
|
||||
printf(" - ");
|
||||
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(" - Alternate Setting %d, Endpoints: %d\n",ifdesc->bAlternateSetting,ifdesc->bNumEndpoints);
|
||||
printf(" - Alternate Setting %d, Endpoints: %d\n",
|
||||
ifdesc->bAlternateSetting, ifdesc->bNumEndpoints);
|
||||
printf(" - Class ");
|
||||
usb_display_class_sub(ifdesc->bInterfaceClass,ifdesc->bInterfaceSubClass,ifdesc->bInterfaceProtocol);
|
||||
usb_display_class_sub(ifdesc->bInterfaceClass,
|
||||
ifdesc->bInterfaceSubClass, ifdesc->bInterfaceProtocol);
|
||||
printf("\n");
|
||||
if (ifdesc->iInterface) {
|
||||
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)
|
||||
{
|
||||
printf(" - Endpoint %d %s ",epdesc->bEndpointAddress & 0xf,(epdesc->bEndpointAddress & 0x80) ? "In" : "Out");
|
||||
switch((epdesc->bmAttributes & 0x03))
|
||||
{
|
||||
case 0: printf("Control"); break;
|
||||
case 1: printf("Isochronous"); break;
|
||||
case 2: printf("Bulk"); break;
|
||||
case 3: printf("Interrupt"); break;
|
||||
printf(" - Endpoint %d %s ", epdesc->bEndpointAddress & 0xf,
|
||||
(epdesc->bEndpointAddress & 0x80) ? "In" : "Out");
|
||||
switch ((epdesc->bmAttributes & 0x03)) {
|
||||
case 0:
|
||||
printf("Control");
|
||||
break;
|
||||
case 1:
|
||||
printf("Isochronous");
|
||||
break;
|
||||
case 2:
|
||||
printf("Bulk");
|
||||
break;
|
||||
case 3:
|
||||
printf("Interrupt");
|
||||
break;
|
||||
}
|
||||
printf(" MaxPacket %d", epdesc->wMaxPacketSize);
|
||||
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++) {
|
||||
/* search for children */
|
||||
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;
|
||||
while (i++ < dev->parent->maxchild) {
|
||||
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 */
|
||||
printf("\b+-");
|
||||
/* correct last child */
|
||||
if (last_child) {
|
||||
if (last_child)
|
||||
pre[index-1] = ' ';
|
||||
}
|
||||
} /* if not root hub */
|
||||
else
|
||||
printf(" ");
|
||||
|
@ -275,11 +308,11 @@ void usb_show_tree_graph(struct usb_device *dev,char *pre)
|
|||
pre[index++] = ' ';
|
||||
pre[index++] = has_child ? '|' : ' ';
|
||||
pre[index] = 0;
|
||||
printf(" %s (%s, %dmA)\n",usb_get_class_desc(dev->config.if_desc[0].bInterfaceClass),
|
||||
dev->slow ? "1.5MBit/s" : "12MBit/s",dev->config.MaxPower * 2);
|
||||
if (strlen(dev->mf) ||
|
||||
strlen(dev->prod) ||
|
||||
strlen(dev->serial))
|
||||
printf(" %s (%s, %dmA)\n", usb_get_class_desc(
|
||||
dev->config.if_desc[0].bInterfaceClass),
|
||||
dev->slow ? "1.5MBit/s" : "12MBit/s",
|
||||
dev->config.MaxPower * 2);
|
||||
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\n", pre);
|
||||
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)) {
|
||||
/* 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);
|
||||
info.start = 0;
|
||||
info.blksz = 0x200;
|
||||
info.size = 2880;
|
||||
printf("error reading partinfo...try to boot raw\n");
|
||||
}
|
||||
if ((strncmp((char *)info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
|
||||
(strncmp((char *)info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)) {
|
||||
if ((strncmp((char *)info.type, BOOT_PART_TYPE,
|
||||
sizeof(info.type)) != 0) &&
|
||||
(strncmp((char *)info.type, BOOT_PART_COMP,
|
||||
sizeof(info.type)) != 0)) {
|
||||
printf("\n** Invalid partition type \"%.32s\""
|
||||
" (expect \"" BOOT_PART_TYPE "\")\n",
|
||||
info.type);
|
||||
|
@ -425,7 +461,9 @@ int do_usbboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
|||
}
|
||||
|
||||
#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 (!fit_check_format(fit_hdr)) {
|
||||
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 */
|
||||
|
||||
|
||||
/*********************************************************************************
|
||||
/******************************************************************************
|
||||
* usb command intepreter
|
||||
*/
|
||||
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
|
||||
if (argc == 2) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
else { /* forced stop, switch console in to serial */
|
||||
} else {
|
||||
/* forced stop, switch console in to serial */
|
||||
console_assign(stdin, "serial");
|
||||
usb_kbd_deregister();
|
||||
}
|
||||
|
@ -517,8 +556,7 @@ int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
|||
usb_display_config(dev);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
int d;
|
||||
|
||||
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) {
|
||||
printf("*** NO Device avaiable ***\n");
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
usb_display_desc(dev);
|
||||
usb_display_config(dev);
|
||||
}
|
||||
|
@ -542,16 +579,8 @@ int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
|||
return 0;
|
||||
}
|
||||
#ifdef CONFIG_USB_STORAGE
|
||||
if (strncmp(argv[1], "scan", 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) {
|
||||
if (strncmp(argv[1], "stor", 4) == 0)
|
||||
return usb_stor_info();
|
||||
}
|
||||
|
||||
if (strncmp(argv[1], "part", 4) == 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
devno = simple_strtoul(argv[2], NULL, 16);
|
||||
stor_dev = usb_stor_get_dev(devno);
|
||||
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 cnt = simple_strtoul(argv[4], NULL, 16);
|
||||
unsigned long n;
|
||||
printf ("\nUSB read: device %d block # %ld, count %ld ... ",
|
||||
usb_stor_curr_dev, blk, cnt);
|
||||
printf("\nUSB read: device %d block # %ld, count %ld"
|
||||
" ... ", usb_stor_curr_dev, blk, cnt);
|
||||
stor_dev = usb_stor_get_dev(usb_stor_curr_dev);
|
||||
n = stor_dev->block_read(usb_stor_curr_dev, blk, cnt, (ulong *)addr);
|
||||
printf ("%ld blocks read: %s\n",n,(n==cnt) ? "OK" : "ERROR");
|
||||
n = stor_dev->block_read(usb_stor_curr_dev, blk, cnt,
|
||||
(ulong *)addr);
|
||||
printf("%ld blocks read: %s\n", n,
|
||||
(n == cnt) ? "OK" : "ERROR");
|
||||
if (n == cnt)
|
||||
return 0;
|
||||
return 1;
|
||||
|
@ -613,20 +643,17 @@ int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
|||
printf("\n Device %d: ", dev);
|
||||
stor_dev = usb_stor_get_dev(dev);
|
||||
dev_print(stor_dev);
|
||||
if (stor_dev->type == DEV_TYPE_UNKNOWN) {
|
||||
if (stor_dev->type == DEV_TYPE_UNKNOWN)
|
||||
return 1;
|
||||
}
|
||||
usb_stor_curr_dev = dev;
|
||||
printf("... is now current device\n");
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
printf("\nUSB device %d: ", usb_stor_curr_dev);
|
||||
stor_dev = usb_stor_get_dev(usb_stor_curr_dev);
|
||||
dev_print(stor_dev);
|
||||
if (stor_dev->type == DEV_TYPE_UNKNOWN) {
|
||||
if (stor_dev->type == DEV_TYPE_UNKNOWN)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
|
@ -646,7 +673,8 @@ U_BOOT_CMD(
|
|||
"usb info [dev] - show available USB devices\n"
|
||||
"usb storage - show details of USB storage devices\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"
|
||||
" to memory address `addr'\n"
|
||||
);
|
||||
|
|
26
common/usb.c
26
common/usb.c
|
@ -87,11 +87,12 @@ static int hub_port_reset(struct usb_device *dev, int port,
|
|||
* wait_ms
|
||||
*/
|
||||
|
||||
void __inline__ wait_ms(unsigned long ms)
|
||||
inline void wait_ms(unsigned long ms)
|
||||
{
|
||||
while (ms-- > 0)
|
||||
udelay(1000);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* Init USB Device
|
||||
*/
|
||||
|
@ -245,9 +246,9 @@ int usb_maxpacket(struct usb_device *dev, unsigned long pipe)
|
|||
{
|
||||
/* direction is out -> use emaxpacket out */
|
||||
if ((pipe & USB_DIR_IN) == 0)
|
||||
return(dev->epmaxpacketout[((pipe>>15) & 0xf)]);
|
||||
return dev->epmaxpacketout[((pipe>>15) & 0xf)];
|
||||
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
|
||||
|
@ -793,7 +794,8 @@ int usb_new_device(struct usb_device *dev)
|
|||
* reset of the device (Linux uses the same sequence)
|
||||
* Some equipment is said to work only with such init sequence; this
|
||||
* 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;
|
||||
int port = -1;
|
||||
|
@ -847,10 +849,18 @@ int usb_new_device(struct usb_device *dev)
|
|||
dev->epmaxpacketin[0] = dev->descriptor.bMaxPacketSize0;
|
||||
dev->epmaxpacketout[0] = dev->descriptor.bMaxPacketSize0;
|
||||
switch (dev->descriptor.bMaxPacketSize0) {
|
||||
case 8: dev->maxpacketsize = PACKET_SIZE_8; 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;
|
||||
case 8:
|
||||
dev->maxpacketsize = PACKET_SIZE_8;
|
||||
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;
|
||||
|
||||
|
|
|
@ -25,15 +25,22 @@ include $(TOPDIR)/config.mk
|
|||
|
||||
LIB := $(obj)libusb.a
|
||||
|
||||
COBJS-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o
|
||||
|
||||
COBJS-y += isp116x-hcd.o
|
||||
COBJS-y += sl811_usb.o
|
||||
COBJS-y += usb_ohci.o
|
||||
# core
|
||||
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_mpc8xx.o
|
||||
COBJS-y += usbdcore_omap1510.o
|
||||
COBJS-$(CONFIG_OMAP1510) += usbdcore_omap1510.o
|
||||
COBJS-$(CONFIG_OMAP1610) += usbdcore_omap1510.o
|
||||
COBJS-$(CONFIG_MPC885_FAMILY) += usbdcore_mpc8xx.o
|
||||
endif
|
||||
|
||||
COBJS := $(COBJS-y)
|
||||
SRCS := $(COBJS:.o=.c)
|
||||
|
|
|
@ -56,8 +56,6 @@
|
|||
*/
|
||||
|
||||
#include <common.h>
|
||||
|
||||
#ifdef CONFIG_USB_ISP116X_HCD
|
||||
#include <asm/io.h>
|
||||
#include <usb.h>
|
||||
#include <malloc.h>
|
||||
|
@ -1441,5 +1439,3 @@ int usb_lowlevel_stop(void)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_USB_ISP116X_HCD */
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
*/
|
||||
|
||||
#include <common.h>
|
||||
#ifdef CONFIG_USB_SL811HS
|
||||
#include <mpc8xx.h>
|
||||
#include <usb.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;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_USB_SL811HS */
|
||||
|
|
|
@ -46,9 +46,6 @@
|
|||
*/
|
||||
|
||||
#include <common.h>
|
||||
|
||||
#ifdef CONFIG_USB_OHCI_NEW
|
||||
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
#if defined(CONFIG_PCI_OHCI)
|
||||
|
@ -2016,4 +2013,3 @@ int usb_lowlevel_stop(void)
|
|||
ohci_inited = 0;
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_USB_OHCI_NEW */
|
||||
|
|
|
@ -51,8 +51,6 @@
|
|||
*/
|
||||
|
||||
#include <common.h>
|
||||
|
||||
#if defined(CONFIG_USB_DEVICE)
|
||||
#include "usbdcore.h"
|
||||
|
||||
#if 0
|
||||
|
@ -597,5 +595,3 @@ int ep0_recv_setup (struct urb *urb)
|
|||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -58,8 +58,6 @@
|
|||
*/
|
||||
#include <common.h>
|
||||
#include <config.h>
|
||||
|
||||
#if defined(CONFIG_MPC885_FAMILY) && defined(CONFIG_USB_DEVICE)
|
||||
#include <commproc.h>
|
||||
#include "usbdcore.h"
|
||||
#include "usbdcore_mpc8xx.h"
|
||||
|
@ -1398,5 +1396,3 @@ static u32 mpc8xx_udc_alloc (u32 data_size, u32 alignment)
|
|||
|
||||
return retaddr;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_MPC885_FAMILY && CONFIG_USB_DEVICE) */
|
||||
|
|
|
@ -27,9 +27,6 @@
|
|||
*/
|
||||
|
||||
#include <common.h>
|
||||
|
||||
#if ((defined(CONFIG_OMAP1510) || defined(CONFIG_OMAP1610)) && defined(CONFIG_USB_DEVICE))
|
||||
|
||||
#include <asm/io.h>
|
||||
#ifdef CONFIG_OMAP_SX1
|
||||
#include <i2c.h>
|
||||
|
@ -1566,4 +1563,3 @@ void udc_unset_nak (int epid)
|
|||
{
|
||||
/* TODO: implement this functionality in omap1510 */
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -184,7 +184,7 @@ static void get_name (dir_entry *dirent, char *s_name)
|
|||
if (*s_name == DELETED_FLAG)
|
||||
*s_name = '\0';
|
||||
else if (*s_name == aRING)
|
||||
*s_name = 'å';
|
||||
*s_name = DELETED_FLAG;
|
||||
downcase (s_name);
|
||||
}
|
||||
|
||||
|
@ -489,7 +489,7 @@ get_vfatname(fsdata *mydata, int curclust, __u8 *cluster,
|
|||
|
||||
l_name[idx] = '\0';
|
||||
if (*l_name == DELETED_FLAG) *l_name = '\0';
|
||||
else if (*l_name == aRING) *l_name = 'å';
|
||||
else if (*l_name == aRING) *l_name = DELETED_FLAG;
|
||||
downcase(l_name);
|
||||
|
||||
/* Return the real directory entry */
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
#define ATTR_VFAT (ATTR_RO | ATTR_HIDDEN | ATTR_SYS | ATTR_VOLUME)
|
||||
|
||||
#define DELETED_FLAG ((char)0xe5) /* Marks deleted files when in name[0] */
|
||||
#define aRING 0x05 /* Used to represent 'å' 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
|
||||
* dir entries
|
||||
|
|
|
@ -57,7 +57,6 @@ struct devrequest {
|
|||
unsigned short length;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
/* All standard descriptors have these 2 fields in common */
|
||||
struct usb_descriptor_header {
|
||||
unsigned char bLength;
|
||||
|
@ -82,7 +81,6 @@ struct usb_device_descriptor {
|
|||
unsigned char bNumConfigurations;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
/* Endpoint descriptor */
|
||||
struct usb_endpoint_descriptor {
|
||||
unsigned char bLength;
|
||||
|
@ -93,8 +91,8 @@ struct usb_endpoint_descriptor {
|
|||
unsigned char bInterval;
|
||||
unsigned char bRefresh;
|
||||
unsigned char bSynchAddress;
|
||||
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Interface descriptor */
|
||||
struct usb_interface_descriptor {
|
||||
unsigned char bLength;
|
||||
|
@ -110,6 +108,7 @@ struct usb_interface_descriptor {
|
|||
unsigned char no_of_ep;
|
||||
unsigned char num_altsetting;
|
||||
unsigned char act_altsetting;
|
||||
|
||||
struct usb_endpoint_descriptor ep_desc[USB_MAXENDPOINTS];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
@ -148,9 +147,10 @@ struct usb_device {
|
|||
int maxpacketsize;
|
||||
/* one bit for each endpoint ([0] = IN, [1] = OUT) */
|
||||
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];
|
||||
/* [0] = IN, [1] = OUT */
|
||||
int epmaxpacketin[16]; /* INput 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_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 transfer_len, struct devrequest *setup);
|
||||
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_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);
|
||||
int usb_control_msg(struct usb_device *dev, unsigned int pipe,
|
||||
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 usb_disable_asynch(int disable);
|
||||
int usb_maxpacket(struct usb_device *dev, unsigned long pipe);
|
||||
void __inline__ wait_ms(unsigned long ms);
|
||||
int usb_get_configuration_no(struct usb_device *dev,unsigned char *buffer,int cfgno);
|
||||
int usb_get_report(struct usb_device *dev, int ifnum, unsigned char type, unsigned char id, void *buf, int size);
|
||||
inline void wait_ms(unsigned long ms);
|
||||
int usb_get_configuration_no(struct usb_device *dev, unsigned char *buffer,
|
||||
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,
|
||||
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_string(struct usb_device *dev, int index, char *buf, size_t size);
|
||||
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:
|
||||
*
|
||||
* - 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
|
||||
* - endpoint: bits 15-18
|
||||
* - Data0/1: bit 19
|
||||
* - 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
|
||||
* 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... */
|
||||
#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 usb_sndctrlpipe(dev,endpoint) ((PIPE_CONTROL << 30) | create_pipe(dev,endpoint))
|
||||
#define usb_rcvctrlpipe(dev,endpoint) ((PIPE_CONTROL << 30) | create_pipe(dev,endpoint) | USB_DIR_IN)
|
||||
#define usb_sndisocpipe(dev,endpoint) ((PIPE_ISOCHRONOUS << 30) | create_pipe(dev,endpoint))
|
||||
#define usb_rcvisocpipe(dev,endpoint) ((PIPE_ISOCHRONOUS << 30) | create_pipe(dev,endpoint) | 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)
|
||||
#define usb_sndctrlpipe(dev, endpoint) ((PIPE_CONTROL << 30) | \
|
||||
create_pipe(dev, endpoint))
|
||||
#define usb_rcvctrlpipe(dev, endpoint) ((PIPE_CONTROL << 30) | \
|
||||
create_pipe(dev, endpoint) | \
|
||||
USB_DIR_IN)
|
||||
#define usb_sndisocpipe(dev, endpoint) ((PIPE_ISOCHRONOUS << 30) | \
|
||||
create_pipe(dev, endpoint))
|
||||
#define usb_rcvisocpipe(dev, endpoint) ((PIPE_ISOCHRONOUS << 30) | \
|
||||
create_pipe(dev, endpoint) | \
|
||||
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 */
|
||||
#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> ep) & 1)
|
||||
#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 */
|
||||
#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_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_pipein(pipe) (((pipe) >> 7) & 1)
|
||||
|
|
Loading…
Reference in a new issue