9
0
Fork 0

Merge branch 'for-next/usb'

This commit is contained in:
Sascha Hauer 2014-08-07 13:13:47 +02:00
commit 038be0fbb5
45 changed files with 123 additions and 199 deletions

View File

@ -3,9 +3,6 @@
button_name="dfu_bp"
button_wait=5
product_id=0x1234
vendor_id=0x4321
dfu_config="/dev/nand0.barebox.bb(barebox)sr,/dev/nand0.kernel.bb(kernel)r,/dev/nand0.rootfs.bb(rootfs)r"
if [ $at91_udc0.vbus != 1 ]; then
@ -29,7 +26,7 @@ if [ $? = 0 ]; then
echo "Start DFU Mode"
echo ""
led ds5 1
dfu ${dfu_config} -P ${product_id} -V ${vendor_id}
dfu ${dfu_config}
exit
fi
echo "${button_name} released, normal boot"

View File

@ -10,9 +10,6 @@ fi
button_name="dfu_bp"
button_wait=5
product_id=0x1234
vendor_id=0x4321
dfu_config="/dev/nand0.barebox.bb(barebox)sr,/dev/nand0.kernel.bb(kernel)r,/dev/nand0.rootfs.bb(rootfs)r"
if [ $at91_udc0.vbus != 1 ]
@ -54,5 +51,5 @@ echo "Start DFU Mode"
echo ""
led ds7 1
dfu ${dfu_config} -P ${product_id} -V ${vendor_id}
dfu ${dfu_config}
led ds7 0

View File

@ -10,9 +10,6 @@ fi
button_name="dfu_bp"
button_wait=5
product_id=0x1234
vendor_id=0x4321
dfu_config="/dev/nand0.barebox.bb(barebox)sr,/dev/nand0.kernel.bb(kernel)r,/dev/nand0.rootfs.bb(rootfs)r"
if [ $at91_udc0.vbus != 1 ]
@ -54,5 +51,5 @@ echo "Start DFU Mode"
echo ""
led ds2 1
dfu ${dfu_config} -P ${product_id} -V ${vendor_id}
dfu ${dfu_config}
led ds2 0

View File

@ -10,9 +10,6 @@ fi
button_name="dfu_bp"
button_wait=5
product_id=0x1234
vendor_id=0x4321
dfu_config="/dev/nand0.barebox.bb(barebox)sr,/dev/nand0.kernel.bb(kernel)r,/dev/nand0.rootfs.bb(rootfs)r"
if [ $at91_udc0.vbus != 1 ]
@ -54,4 +51,4 @@ echo "Start DFU Mode"
echo ""
led ds5 1
dfu ${dfu_config} -P ${product_id} -V ${vendor_id}
dfu ${dfu_config}

View File

@ -3,9 +3,6 @@
button_name="dfu_bp"
button_wait=5
product_id=0x1234
vendor_id=0x4321
dfu_config="/dev/nand0.barebox.bb(barebox)sr,/dev/nand0.kernel.bb(kernel)r,/dev/nand0.rootfs.bb(rootfs)r"
if [ $at91_udc0.vbus != 1 ]
@ -46,4 +43,4 @@ echo ""
echo "Start DFU Mode"
echo ""
dfu ${dfu_config} -P ${product_id} -V ${vendor_id}
dfu ${dfu_config}

View File

@ -5,9 +5,6 @@ gpio_dfu=95
gpio_name="PC31"
gpio_wait=5
product_id=0x1234
vendor_id=0x4321
dfu_config="/dev/nand0.bootstrap.bb(bootstrap)sr,/dev/nand0.barebox.bb(barebox)sr,/dev/nand0.kernel.bb(kernel)r,/dev/nand0.rootfs.bb(rootfs)r"
echo
@ -30,7 +27,7 @@ if [ $? = 0 ]; then
gpio_get_value ${gpio_dfu}
if [ $? = 0 ]; then
echo "Start DFU Mode"
dfu ${dfu_config} -P ${product_id} -V ${vendor_id}
dfu ${dfu_config}
exit
fi
fi

View File

@ -3,9 +3,6 @@
button_name="dfu_bp"
button_wait=5
product_id=0x1234
vendor_id=0x4321
dfu_config="/dev/nand0.barebox.bb(barebox)sr,/dev/nand0.kernel.bb(kernel)r,/dev/nand0.rootfs.bb(rootfs)r"
if [ $at91_udc0.vbus != 1 ]
@ -46,4 +43,4 @@ echo ""
echo "Start DFU Mode"
echo ""
dfu ${dfu_config} -P ${product_id} -V ${vendor_id}
dfu ${dfu_config}

View File

@ -96,7 +96,7 @@ CONFIG_MTD_M25P80=y
CONFIG_NAND=y
CONFIG_NAND_OMAP_GPMC=y
CONFIG_MTD_UBI=y
CONFIG_USB=y
CONFIG_USB_HOST=y
CONFIG_MCI=y
CONFIG_MCI_STARTUP=y
CONFIG_MCI_OMAP_HSMMC=y

View File

@ -66,7 +66,7 @@ CONFIG_NAND=y
# CONFIG_NAND_ECC_HW_NONE is not set
CONFIG_NAND_ATMEL=y
CONFIG_UBI=y
CONFIG_USB=y
CONFIG_USB_HOST=y
CONFIG_USB_OHCI=y
CONFIG_USB_OHCI_AT91=y
CONFIG_MCI=y

View File

@ -77,7 +77,7 @@ CONFIG_NET_USB_SMSC95XX=y
# CONFIG_SPI is not set
CONFIG_I2C=y
CONFIG_I2C_OMAP=y
CONFIG_USB=y
CONFIG_USB_HOST=y
CONFIG_USB_EHCI=y
CONFIG_MCI=y
CONFIG_MCI_STARTUP=y

View File

@ -74,7 +74,7 @@ CONFIG_NAND=y
# CONFIG_NAND_ECC_HW_NONE is not set
CONFIG_NAND_ATMEL=y
CONFIG_UBI=y
CONFIG_USB=y
CONFIG_USB_HOST=y
CONFIG_USB_EHCI=y
CONFIG_USB_EHCI_ATMEL=y
CONFIG_USB_STORAGE=y

View File

@ -76,7 +76,7 @@ CONFIG_NAND=y
# CONFIG_NAND_ECC_HW_NONE is not set
CONFIG_NAND_ATMEL=y
CONFIG_UBI=y
CONFIG_USB=y
CONFIG_USB_HOST=y
CONFIG_USB_EHCI=y
CONFIG_USB_EHCI_ATMEL=y
CONFIG_USB_STORAGE=y

View File

@ -70,7 +70,7 @@ CONFIG_NAND=y
CONFIG_NAND_ATMEL=y
CONFIG_NAND_ATMEL_PMECC=y
CONFIG_UBI=y
CONFIG_USB=y
CONFIG_USB_HOST=y
CONFIG_USB_EHCI=y
CONFIG_USB_EHCI_ATMEL=y
CONFIG_USB_STORAGE=y

View File

@ -50,7 +50,7 @@ CONFIG_I2C_IMX=y
CONFIG_MTD=y
CONFIG_NAND=y
CONFIG_NAND_IMX=y
CONFIG_USB=y
CONFIG_USB_HOST=y
CONFIG_USB_IMX_CHIPIDEA=y
CONFIG_USB_EHCI=y
CONFIG_USB_ULPI=y

View File

@ -43,7 +43,7 @@ CONFIG_NET_RESOLV=y
CONFIG_NET_USB=y
CONFIG_NET_USB_ASIX=y
# CONFIG_SPI is not set
CONFIG_USB=y
CONFIG_USB_HOST=y
CONFIG_USB_EHCI=y
CONFIG_VIDEO=y
CONFIG_DRIVER_VIDEO_STM=y

View File

@ -31,7 +31,7 @@ CONFIG_NAND=y
CONFIG_NAND_ATMEL=y
CONFIG_UBI=y
CONFIG_DISK_WRITE=y
CONFIG_USB=y
CONFIG_USB_HOST=y
CONFIG_USB_OHCI=y
CONFIG_USB_OHCI_AT91=y
CONFIG_USB_STORAGE=y

View File

@ -89,7 +89,7 @@ CONFIG_DRIVER_CFI=y
CONFIG_CFI_BUFFER_WRITE=y
CONFIG_DISK_INTF_PLATFORM_IDE=y
CONFIG_DISK_PATA_IMX=y
CONFIG_USB=y
CONFIG_USB_HOST=y
CONFIG_USB_IMX_CHIPIDEA=y
CONFIG_USB_EHCI=y
CONFIG_USB_ULPI=y

View File

@ -65,7 +65,7 @@ CONFIG_MTD=y
CONFIG_MTD_RAW_DEVICE=y
CONFIG_NAND=y
CONFIG_NAND_IMX=y
CONFIG_USB=y
CONFIG_USB_HOST=y
CONFIG_USB_EHCI=y
CONFIG_USB_STORAGE=y
CONFIG_USB_GADGET=y

View File

@ -66,7 +66,7 @@ CONFIG_MTD=y
CONFIG_MTD_RAW_DEVICE=y
CONFIG_NAND=y
CONFIG_NAND_IMX=y
CONFIG_USB=y
CONFIG_USB_HOST=y
CONFIG_USB_EHCI=y
CONFIG_USB_STORAGE=y
CONFIG_USB_GADGET=y

View File

@ -53,7 +53,7 @@ CONFIG_CMD_TFTP=y
CONFIG_FS_TFTP=y
CONFIG_DRIVER_NET_FEC_IMX=y
# CONFIG_SPI is not set
CONFIG_USB=y
CONFIG_USB_HOST=y
CONFIG_USB_EHCI=y
CONFIG_ZLIB=y
CONFIG_LZO_DECOMPRESS=y

View File

@ -54,7 +54,7 @@ CONFIG_NET_USB=y
CONFIG_NET_USB_ASIX=y
CONFIG_NET_USB_SMSC95XX=y
# CONFIG_SPI is not set
CONFIG_USB=y
CONFIG_USB_HOST=y
CONFIG_USB_EHCI=y
CONFIG_USB_STORAGE=y
CONFIG_MCI=y

View File

@ -36,7 +36,7 @@ CONFIG_CMD_GPIO=y
CONFIG_NET=y
CONFIG_DRIVER_NET_DM9K=y
# CONFIG_SPI is not set
CONFIG_USB=y
CONFIG_USB_HOST=y
CONFIG_USB_OHCI=y
CONFIG_MCI=y
CONFIG_MCI_S3C=y

View File

@ -47,7 +47,7 @@ CONFIG_NET_RESOLV=y
CONFIG_NET_USB=y
CONFIG_NET_USB_SMSC95XX=y
CONFIG_DISK_INTF_PLATFORM_IDE=y
CONFIG_USB=y
CONFIG_USB_HOST=y
CONFIG_USB_EHCI=y
CONFIG_USB_STORAGE=y
CONFIG_VIDEO=y

View File

@ -92,7 +92,7 @@ CONFIG_NAND=y
CONFIG_NAND_IMX=y
CONFIG_MTD_UBI=y
CONFIG_MTD_UBI_FASTMAP=y
CONFIG_USB=y
CONFIG_USB_HOST=y
CONFIG_USB_EHCI=y
CONFIG_USB_ULPI=y
CONFIG_MCI=y

View File

@ -128,7 +128,7 @@ CONFIG_DISK_AHCI=y
CONFIG_DISK_AHCI_IMX=y
CONFIG_DISK_INTF_PLATFORM_IDE=y
CONFIG_DISK_PATA_IMX=y
CONFIG_USB=y
CONFIG_USB_HOST=y
CONFIG_USB_IMX_CHIPIDEA=y
CONFIG_USB_EHCI=y
CONFIG_USB_ULPI=y

View File

@ -41,7 +41,7 @@ CONFIG_CMD_TIME=y
CONFIG_OF_BAREBOX_DRIVERS=y
CONFIG_DRIVER_SERIAL_NS16550=y
# CONFIG_SPI is not set
CONFIG_USB=y
CONFIG_USB_HOST=y
CONFIG_USB_EHCI=y
CONFIG_USB_STORAGE=y
CONFIG_CLOCKSOURCE_DUMMY=y

View File

@ -66,7 +66,7 @@ CONFIG_NAND=y
# CONFIG_NAND_ECC_HW_SYNDROME is not set
CONFIG_NAND_IMX=y
CONFIG_UBI=y
CONFIG_USB=y
CONFIG_USB_HOST=y
CONFIG_USB_EHCI=y
CONFIG_USB_ULPI=y
CONFIG_VIDEO=y

View File

@ -73,7 +73,7 @@ CONFIG_I2C_OMAP=y
CONFIG_MTD=y
CONFIG_NAND=y
CONFIG_NAND_OMAP_GPMC=y
CONFIG_USB=y
CONFIG_USB_HOST=y
CONFIG_USB_EHCI=y
CONFIG_USB_EHCI_OMAP=y
CONFIG_USB_TWL4030=y

View File

@ -69,7 +69,7 @@ CONFIG_NET_USB_SMSC95XX=y
# CONFIG_SPI is not set
CONFIG_I2C=y
CONFIG_I2C_OMAP=y
CONFIG_USB=y
CONFIG_USB_HOST=y
CONFIG_USB_EHCI=y
CONFIG_MCI=y
CONFIG_MCI_STARTUP=y

View File

@ -76,7 +76,7 @@ CONFIG_MTD=y
CONFIG_NAND=y
CONFIG_NAND_IMX=y
CONFIG_UBI=y
CONFIG_USB=y
CONFIG_USB_HOST=y
CONFIG_USB_EHCI=y
CONFIG_FS_EXT4=y
CONFIG_FS_TFTP=y

View File

@ -61,7 +61,7 @@ CONFIG_MTD=y
CONFIG_NAND=y
CONFIG_NAND_OMAP_GPMC=y
CONFIG_UBI=y
CONFIG_USB=y
CONFIG_USB_HOST=y
CONFIG_VIDEO=y
CONFIG_DRIVER_VIDEO_OMAP=y
CONFIG_IMAGE_RENDERER=y

View File

@ -50,7 +50,7 @@ CONFIG_NAND=y
CONFIG_NAND_ATMEL=y
CONFIG_UBI=y
CONFIG_DISK_ATA=y
CONFIG_USB=y
CONFIG_USB_HOST=y
CONFIG_USB_OHCI=y
CONFIG_USB_OHCI_AT91=y
CONFIG_USB_STORAGE=y

View File

@ -80,7 +80,7 @@ CONFIG_I2C=y
CONFIG_MTD=y
CONFIG_MTD_M25P80=y
CONFIG_DISK_AHCI=y
CONFIG_USB=y
CONFIG_USB_HOST=y
CONFIG_USB_EHCI=y
CONFIG_USB_STORAGE=y
CONFIG_MCI=y

View File

@ -1835,7 +1835,7 @@ config CMD_LED_TRIGGER
config CMD_USB
bool
depends on USB
depends on USB_HOST
prompt "usb command"
default y
help

View File

@ -1,5 +1,5 @@
menuconfig NET_USB
depends on USB
depends on USB_HOST
bool "USB network support"
if NET_USB

View File

@ -6,17 +6,12 @@
#include <malloc.h>
#include <linux/phy.h>
static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
{
return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN);
}
/* handles CDC Ethernet and many other network "bulk data" interfaces */
int usbnet_get_endpoints(struct usbnet *dev)
{
struct usb_device *udev = dev->udev;
int tmp;
struct usb_interface_descriptor *alt = NULL;
struct usb_interface *alt = NULL;
struct usb_endpoint_descriptor *in = NULL, *out = NULL;
struct usb_endpoint_descriptor *status = NULL;
@ -24,13 +19,13 @@ int usbnet_get_endpoints(struct usbnet *dev)
unsigned ep;
in = out = status = NULL;
alt = &udev->config.if_desc[tmp];
alt = &udev->config.interface[tmp];
/* take the first altsetting with in-bulk + out-bulk;
* remember any status endpoint, just in case;
* ignore other endpoints and altsetttings.
*/
for (ep = 0; ep < alt->bNumEndpoints; ep++) {
for (ep = 0; ep < alt->desc.bNumEndpoints; ep++) {
struct usb_endpoint_descriptor *e;
int intr = 0;
@ -63,10 +58,10 @@ int usbnet_get_endpoints(struct usbnet *dev)
if (!alt || !in || !out)
return -EINVAL;
if (alt->bAlternateSetting != 0
if (alt->desc.bAlternateSetting != 0
|| !(dev->driver_info->flags & FLAG_NO_SETINT)) {
tmp = usb_set_interface (dev->udev, alt->bInterfaceNumber,
alt->bAlternateSetting);
tmp = usb_set_interface(dev->udev, alt->desc.bInterfaceNumber,
alt->desc.bAlternateSetting);
if (tmp < 0)
return tmp;
}

View File

@ -1,7 +1,11 @@
menuconfig USB
bool "USB support"
config USB
bool
if USB
menuconfig USB_HOST
select USB
bool "USB Host support"
if USB_HOST
source drivers/usb/imx/Kconfig

View File

@ -1,3 +1,3 @@
obj-y += usb.o
obj-$(CONFIG_USB_HOST) += usb.o
obj-$(CONFIG_OFDEVICE) += of.o

View File

@ -159,10 +159,10 @@ static int usb_set_maxpacket(struct usb_device *dev)
{
int i, ii;
for (i = 0; i < dev->config.bNumInterfaces; i++)
for (ii = 0; ii < dev->config.if_desc[i].bNumEndpoints; ii++)
for (i = 0; i < dev->config.desc.bNumInterfaces; i++)
for (ii = 0; ii < dev->config.interface[i].desc.bNumEndpoints; ii++)
usb_set_maxpacket_ep(dev,
&dev->config.if_desc[i].ep_desc[ii]);
&dev->config.interface[i].ep_desc[ii]);
return 0;
}
@ -193,11 +193,11 @@ static int usb_parse_config(struct usb_device *dev, unsigned char *buffer, int c
le16_to_cpus(&(dev->config.wTotalLength));
dev->config.no_of_if = 0;
index = dev->config.bLength;
index = dev->config.desc.bLength;
/* Ok the first entry must be a configuration entry,
* now process the others */
head = (struct usb_descriptor_header *) &buffer[index];
while (index + 1 < dev->config.wTotalLength) {
while (index + 1 < dev->config.desc.wTotalLength) {
switch (head->bDescriptorType) {
case USB_DT_INTERFACE:
if (((struct usb_interface_descriptor *) \
@ -215,24 +215,24 @@ static int usb_parse_config(struct usb_device *dev, unsigned char *buffer, int c
break;
}
dev->config.no_of_if++;
memcpy(&dev->config.if_desc[ifno],
memcpy(&dev->config.interface[ifno].desc,
&buffer[index], buffer[index]);
dev->config.if_desc[ifno].no_of_ep = 0;
dev->config.if_desc[ifno].num_altsetting = 1;
dev->config.interface[ifno].no_of_ep = 0;
dev->config.interface[ifno].num_altsetting = 1;
curr_if_num =
dev->config.if_desc[ifno].bInterfaceNumber;
dev->config.interface[ifno].desc.bInterfaceNumber;
} else {
/* found alternate setting for the interface */
dev->config.if_desc[ifno].num_altsetting++;
dev->config.interface[ifno].num_altsetting++;
}
break;
case USB_DT_ENDPOINT:
epno = dev->config.if_desc[ifno].no_of_ep;
epno = dev->config.interface[ifno].no_of_ep;
/* found an endpoint */
dev->config.if_desc[ifno].no_of_ep++;
memcpy(&dev->config.if_desc[ifno].ep_desc[epno],
dev->config.interface[ifno].no_of_ep++;
memcpy(&dev->config.interface[ifno].ep_desc[epno],
&buffer[index], buffer[index]);
le16_to_cpus(&(dev->config.if_desc[ifno].ep_desc[epno].\
le16_to_cpus(&(dev->config.interface[ifno].ep_desc[epno].\
wMaxPacketSize));
USB_PRINTF("if %d, ep %d\n", ifno, epno);
break;
@ -411,7 +411,7 @@ static int usb_new_device(struct usb_device *dev)
usb_parse_config(dev, buf, 0);
usb_set_maxpacket(dev);
/* we set the default configuration here */
if (usb_set_configuration(dev, dev->config.bConfigurationValue)) {
if (usb_set_configuration(dev, dev->config.desc.bConfigurationValue)) {
printf("failed to set default configuration " \
"len %d, status %lX\n", dev->act_len, dev->status);
goto err_out;
@ -721,12 +721,12 @@ int usb_get_configuration_no(struct usb_device *dev,
*/
int usb_set_interface(struct usb_device *dev, int interface, int alternate)
{
struct usb_interface_descriptor *if_face = NULL;
struct usb_interface *if_face = NULL;
int ret, i;
for (i = 0; i < dev->config.bNumInterfaces; i++) {
if (dev->config.if_desc[i].bInterfaceNumber == interface) {
if_face = &dev->config.if_desc[i];
for (i = 0; i < dev->config.desc.bNumInterfaces; i++) {
if (dev->config.interface[i].desc.bInterfaceNumber == interface) {
if_face = &dev->config.interface[i];
break;
}
}
@ -1297,21 +1297,21 @@ static int usb_hub_configure(struct usb_device *dev)
static int usb_hub_probe(struct usb_device *dev, int ifnum)
{
struct usb_interface_descriptor *iface;
struct usb_interface *iface;
struct usb_endpoint_descriptor *ep;
int ret;
iface = &dev->config.if_desc[ifnum];
iface = &dev->config.interface[ifnum];
/* Is it a hub? */
if (iface->bInterfaceClass != USB_CLASS_HUB)
if (iface->desc.bInterfaceClass != USB_CLASS_HUB)
return 0;
/* Some hubs have a subclass of 1, which AFAICT according to the */
/* specs is not defined, but it works */
if ((iface->bInterfaceSubClass != 0) &&
(iface->bInterfaceSubClass != 1))
if ((iface->desc.bInterfaceSubClass != 0) &&
(iface->desc.bInterfaceSubClass != 1))
return 0;
/* Multiple endpoints? What kind of mutant ninja-hub is this? */
if (iface->bNumEndpoints != 1)
if (iface->desc.bNumEndpoints != 1)
return 0;
ep = &iface->ep_desc[0];
/* Output endpoint? Curiousier and curiousier.. */
@ -1373,7 +1373,7 @@ static int usb_match_one_id(struct usb_device *usbdev,
/* match any interface */
for (ifno=0; ifno<usbdev->config.no_of_if; ifno++) {
struct usb_interface_descriptor *intf;
intf = &usbdev->config.if_desc[ifno];
intf = &usbdev->config.interface[ifno].desc;
if ((id->match_flags & USB_DEVICE_ID_MATCH_INT_CLASS) &&
(id->bInterfaceClass != intf->bInterfaceClass))

View File

@ -4,6 +4,7 @@ config USB_HAVE_GADGET_DRIVER
menuconfig USB_GADGET
depends on USB_HAVE_GADGET_DRIVER
select USB
bool "USB gadget support"
if USB_GADGET

View File

@ -229,16 +229,29 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer,
qh = &ehci->qh_list[1];
qh->qh_link = cpu_to_hc32((uint32_t)ehci->qh_list | QH_LINK_TYPE_QH);
c = (usb_pipespeed(pipe) != USB_SPEED_HIGH &&
c = (dev->speed != USB_SPEED_HIGH &&
usb_pipeendpoint(pipe) == 0) ? 1 : 0;
endpt = (8 << 28) |
(c << 27) |
(usb_maxpacket(dev, pipe) << 16) |
(0 << 15) |
(1 << 14) |
(usb_pipespeed(pipe) << 12) |
(usb_pipeendpoint(pipe) << 8) |
(0 << 7) | (usb_pipedevice(pipe) << 0);
switch (dev->speed) {
case USB_SPEED_FULL:
endpt |= 0 << 12;
break;
case USB_SPEED_LOW:
endpt |= 1 << 12;
break;
case USB_SPEED_HIGH:
endpt |= 2 << 12;
break;
default:
return -EINVAL;
}
qh->qh_endpt1 = cpu_to_hc32(endpt);
endpt = (1 << 30) |
(dev->portnr << 23) |

View File

@ -794,7 +794,7 @@ static struct ed *ep_add_ed(struct usb_device *usb_dev, unsigned long pipe,
| (usb_pipeisoc(pipe) ? 0x8000 : 0)
| (usb_pipecontrol(pipe) ? 0 : \
(usb_pipeout(pipe) ? 0x800 : 0x1000))
| usb_pipeslow(pipe) << 13
| (usb_dev->speed == USB_SPEED_LOW) << 13
| usb_maxpacket(usb_dev, pipe) << 16);
if (ed->type == PIPE_INTERRUPT && ed->state == ED_UNLINK) {

View File

@ -441,7 +441,7 @@ static void get_transport(struct us_data *us)
}
/* Get the endpoint settings */
static int get_pipes(struct us_data *us, struct usb_interface_descriptor *intf)
static int get_pipes(struct us_data *us, struct usb_interface *intf)
{
unsigned int i;
struct usb_endpoint_descriptor *ep;
@ -455,7 +455,7 @@ static int get_pipes(struct us_data *us, struct usb_interface_descriptor *intf)
* An optional interrupt-in is OK (necessary for CBI protocol).
* We will ignore any others.
*/
for (i = 0; i < intf->bNumEndpoints; i++) {
for (i = 0; i < intf->desc.bNumEndpoints; i++) {
ep = &intf->ep_desc[i];
if (USB_EP_IS_XFER_BULK(ep)) {
@ -517,28 +517,28 @@ static int usb_stor_probe(struct usb_device *usbdev,
struct us_data *us;
int result;
int ifno;
struct usb_interface_descriptor *intf;
struct usb_interface *intf;
US_DEBUGP("Supported USB Mass Storage device detected\n");
/* scan usbdev interfaces again to find one that we can handle */
for (ifno=0; ifno<usbdev->config.no_of_if; ifno++) {
intf = &usbdev->config.if_desc[ifno];
intf = &usbdev->config.interface[ifno];
if (intf->bInterfaceClass == USB_CLASS_MASS_STORAGE &&
intf->bInterfaceSubClass == US_SC_SCSI &&
intf->bInterfaceProtocol == US_PR_BULK)
if (intf->desc.bInterfaceClass == USB_CLASS_MASS_STORAGE &&
intf->desc.bInterfaceSubClass == US_SC_SCSI &&
intf->desc.bInterfaceProtocol == US_PR_BULK)
break;
}
if (ifno >= usbdev->config.no_of_if)
return -ENXIO;
/* select the right interface */
result = usb_set_interface(usbdev, intf->bInterfaceNumber, 0);
result = usb_set_interface(usbdev, intf->desc.bInterfaceNumber, 0);
if (result)
return result;
US_DEBUGP("Selected interface %d\n", (int)intf->bInterfaceNumber);
US_DEBUGP("Selected interface %d\n", (int)intf->desc.bInterfaceNumber);
/* allocate us_data structure */
us = (struct us_data *)malloc(sizeof(struct us_data));
@ -549,9 +549,9 @@ static int usb_stor_probe(struct usb_device *usbdev,
/* initialize the us_data structure */
us->pusb_dev = usbdev;
us->flags = 0;
us->ifnum = intf->bInterfaceNumber;
us->subclass = intf->bInterfaceSubClass;
us->protocol = intf->bInterfaceProtocol;
us->ifnum = intf->desc.bInterfaceNumber;
us->subclass = intf->desc.bInterfaceSubClass;
us->protocol = intf->desc.bInterfaceProtocol;
INIT_LIST_HEAD(&us->blk_dev_list);
/* get standard transport and protocol settings */

View File

@ -23,6 +23,7 @@
#define _USB_H_
#include <driver.h>
#include <usb/ch9.h>
#include <usb/usb_defs.h>
#include <asm/byteorder.h>
@ -39,13 +40,6 @@
#define USB_CNTL_TIMEOUT 100 /* 100ms timeout */
/* String descriptor */
struct usb_string_descriptor {
unsigned char bLength;
unsigned char bDescriptorType;
unsigned short wData[1];
} __attribute__ ((packed));
/* device request (setup) */
struct devrequest {
unsigned char requesttype;
@ -55,77 +49,6 @@ struct devrequest {
unsigned short length;
} __attribute__ ((packed));
/* All standard descriptors have these 2 fields in common */
struct usb_descriptor_header {
unsigned char bLength;
unsigned char bDescriptorType;
} __attribute__ ((packed));
/* Device descriptor */
struct usb_device_descriptor {
unsigned char bLength;
unsigned char bDescriptorType;
unsigned short bcdUSB;
unsigned char bDeviceClass;
unsigned char bDeviceSubClass;
unsigned char bDeviceProtocol;
unsigned char bMaxPacketSize0;
unsigned short idVendor;
unsigned short idProduct;
unsigned short bcdDevice;
unsigned char iManufacturer;
unsigned char iProduct;
unsigned char iSerialNumber;
unsigned char bNumConfigurations;
} __attribute__ ((packed));
/* Endpoint descriptor */
struct usb_endpoint_descriptor {
unsigned char bLength;
unsigned char bDescriptorType;
unsigned char bEndpointAddress;
unsigned char bmAttributes;
unsigned short wMaxPacketSize;
unsigned char bInterval;
unsigned char bRefresh;
unsigned char bSynchAddress;
} __attribute__ ((packed)) __attribute__ ((aligned(2)));
/* Interface descriptor */
struct usb_interface_descriptor {
unsigned char bLength;
unsigned char bDescriptorType;
unsigned char bInterfaceNumber;
unsigned char bAlternateSetting;
unsigned char bNumEndpoints;
unsigned char bInterfaceClass;
unsigned char bInterfaceSubClass;
unsigned char bInterfaceProtocol;
unsigned char iInterface;
unsigned char no_of_ep;
unsigned char num_altsetting;
unsigned char act_altsetting;
struct usb_endpoint_descriptor ep_desc[USB_MAXENDPOINTS];
} __attribute__ ((packed));
/* Configuration descriptor information.. */
struct usb_config_descriptor {
unsigned char bLength;
unsigned char bDescriptorType;
unsigned short wTotalLength;
unsigned char bNumInterfaces;
unsigned char bConfigurationValue;
unsigned char iConfiguration;
unsigned char bmAttributes;
unsigned char MaxPower;
unsigned char no_of_if; /* number of interfaces */
struct usb_interface_descriptor if_desc[USB_MAXINTERFACES];
} __attribute__ ((packed));
enum {
/* Maximum packet size; encoded as 0,1,2,3 = 8,16,32,64 */
PACKET_SIZE_8 = 0,
@ -134,6 +57,23 @@ enum {
PACKET_SIZE_64 = 3,
};
struct usb_interface {
struct usb_interface_descriptor desc;
unsigned char no_of_ep;
unsigned char num_altsetting;
unsigned char act_altsetting;
struct usb_endpoint_descriptor ep_desc[USB_MAXENDPOINTS];
};
struct usb_configuration {
struct usb_config_descriptor desc;
unsigned char no_of_if; /* number of interfaces */
struct usb_interface interface[USB_MAXINTERFACES];
};
struct usb_device {
int devnum; /* Device number on USB bus */
int speed; /* full/low/high */
@ -154,7 +94,7 @@ struct usb_device {
int configno; /* selected config number */
struct usb_device_descriptor *descriptor; /* Device Descriptor */
struct usb_config_descriptor config; /* config descriptor */
struct usb_configuration config; /* config descriptor */
struct devrequest *setup_packet;
int have_langid; /* whether string_langid is valid yet */
@ -361,8 +301,6 @@ void usb_rescan(int force);
#define usb_pipe_endpdev(pipe) (((pipe) >> 8) & 0x7ff)
#define usb_pipeendpoint(pipe) (((pipe) >> 15) & 0xf)
#define usb_pipedata(pipe) (((pipe) >> 19) & 1)
#define usb_pipespeed(pipe) (((pipe) >> 26) & 3)
#define usb_pipeslow(pipe) (usb_pipespeed(pipe) == USB_SPEED_LOW)
#define usb_pipetype(pipe) (((pipe) >> 30) & 3)
#define usb_pipeisoc(pipe) (usb_pipetype((pipe)) == PIPE_ISOCHRONOUS)
#define usb_pipeint(pipe) (usb_pipetype((pipe)) == PIPE_INTERRUPT)

View File

@ -76,12 +76,6 @@
#define USB_DIR_OUT 0
#define USB_DIR_IN 0x80
/* USB device speeds */
#define USB_SPEED_FULL 0x0 /* 12Mbps */
#define USB_SPEED_LOW 0x1 /* 1.5Mbps */
#define USB_SPEED_HIGH 0x2 /* 480Mbps */
#define USB_SPEED_RESERVED 0x3
/* Descriptor types */
#define USB_DT_DEVICE 0x01
#define USB_DT_CONFIG 0x02