diff --git a/arch/arm/boards/at91sam9260ek/env/bin/init_board b/arch/arm/boards/at91sam9260ek/env/bin/init_board index 27d767d..f1b476d 100644 --- a/arch/arm/boards/at91sam9260ek/env/bin/init_board +++ b/arch/arm/boards/at91sam9260ek/env/bin/init_board @@ -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 @@ 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" diff --git a/arch/arm/boards/at91sam9261ek/env/bin/init_board b/arch/arm/boards/at91sam9261ek/env/bin/init_board index 8e849c6..39a7f08 100644 --- a/arch/arm/boards/at91sam9261ek/env/bin/init_board +++ b/arch/arm/boards/at91sam9261ek/env/bin/init_board @@ -10,9 +10,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 ] @@ -54,5 +51,5 @@ echo "" led ds7 1 -dfu ${dfu_config} -P ${product_id} -V ${vendor_id} +dfu ${dfu_config} led ds7 0 diff --git a/arch/arm/boards/at91sam9263ek/env/bin/init_board b/arch/arm/boards/at91sam9263ek/env/bin/init_board index f2e6294..44972a5 100644 --- a/arch/arm/boards/at91sam9263ek/env/bin/init_board +++ b/arch/arm/boards/at91sam9263ek/env/bin/init_board @@ -10,9 +10,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 ] @@ -54,5 +51,5 @@ echo "" led ds2 1 -dfu ${dfu_config} -P ${product_id} -V ${vendor_id} +dfu ${dfu_config} led ds2 0 diff --git a/arch/arm/boards/at91sam9n12ek/env/bin/init_board b/arch/arm/boards/at91sam9n12ek/env/bin/init_board index b41b638..6b44044 100644 --- a/arch/arm/boards/at91sam9n12ek/env/bin/init_board +++ b/arch/arm/boards/at91sam9n12ek/env/bin/init_board @@ -10,9 +10,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 ] @@ -54,4 +51,4 @@ echo "" led ds5 1 -dfu ${dfu_config} -P ${product_id} -V ${vendor_id} +dfu ${dfu_config} diff --git a/arch/arm/boards/qil-a926x/env/bin/init_board b/arch/arm/boards/qil-a926x/env/bin/init_board index 0a6baf7..09ba7cc 100644 --- a/arch/arm/boards/qil-a926x/env/bin/init_board +++ b/arch/arm/boards/qil-a926x/env/bin/init_board @@ -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 "Start DFU Mode" echo "" -dfu ${dfu_config} -P ${product_id} -V ${vendor_id} +dfu ${dfu_config} diff --git a/arch/arm/boards/telit-evk-pro3/env/init/usb b/arch/arm/boards/telit-evk-pro3/env/init/usb index 47429f5..176c04b 100644 --- a/arch/arm/boards/telit-evk-pro3/env/init/usb +++ b/arch/arm/boards/telit-evk-pro3/env/init/usb @@ -5,9 +5,6 @@ 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 @@ 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 diff --git a/arch/arm/boards/usb-a926x/env/bin/init_board b/arch/arm/boards/usb-a926x/env/bin/init_board index 0a6baf7..09ba7cc 100644 --- a/arch/arm/boards/usb-a926x/env/bin/init_board +++ b/arch/arm/boards/usb-a926x/env/bin/init_board @@ -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 "Start DFU Mode" echo "" -dfu ${dfu_config} -P ${product_id} -V ${vendor_id} +dfu ${dfu_config} diff --git a/arch/arm/configs/am335x_defconfig b/arch/arm/configs/am335x_defconfig index d3feb10..4dc6cbf 100644 --- a/arch/arm/configs/am335x_defconfig +++ b/arch/arm/configs/am335x_defconfig @@ -96,7 +96,7 @@ 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 diff --git a/arch/arm/configs/animeo_ip_defconfig b/arch/arm/configs/animeo_ip_defconfig index ca8d2f1..825c5e4 100644 --- a/arch/arm/configs/animeo_ip_defconfig +++ b/arch/arm/configs/animeo_ip_defconfig @@ -66,7 +66,7 @@ # 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 diff --git a/arch/arm/configs/archosg9_defconfig b/arch/arm/configs/archosg9_defconfig index 0a6ad68..66fbf1a 100644 --- a/arch/arm/configs/archosg9_defconfig +++ b/arch/arm/configs/archosg9_defconfig @@ -77,7 +77,7 @@ # 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 diff --git a/arch/arm/configs/at91sam9m10g45ek_defconfig b/arch/arm/configs/at91sam9m10g45ek_defconfig index b088976..02bb983 100644 --- a/arch/arm/configs/at91sam9m10g45ek_defconfig +++ b/arch/arm/configs/at91sam9m10g45ek_defconfig @@ -74,7 +74,7 @@ # 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 diff --git a/arch/arm/configs/at91sam9m10ihd_defconfig b/arch/arm/configs/at91sam9m10ihd_defconfig index c3df023..cc40850 100644 --- a/arch/arm/configs/at91sam9m10ihd_defconfig +++ b/arch/arm/configs/at91sam9m10ihd_defconfig @@ -76,7 +76,7 @@ # 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 diff --git a/arch/arm/configs/at91sam9x5ek_defconfig b/arch/arm/configs/at91sam9x5ek_defconfig index 93975d4..48c88bd 100644 --- a/arch/arm/configs/at91sam9x5ek_defconfig +++ b/arch/arm/configs/at91sam9x5ek_defconfig @@ -70,7 +70,7 @@ 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 diff --git a/arch/arm/configs/ccmx51_defconfig b/arch/arm/configs/ccmx51_defconfig index cc2baa2..4c54d4d 100644 --- a/arch/arm/configs/ccmx51_defconfig +++ b/arch/arm/configs/ccmx51_defconfig @@ -50,7 +50,7 @@ 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 diff --git a/arch/arm/configs/chumbyone_defconfig b/arch/arm/configs/chumbyone_defconfig index 5eb5962..92b59b8 100644 --- a/arch/arm/configs/chumbyone_defconfig +++ b/arch/arm/configs/chumbyone_defconfig @@ -43,7 +43,7 @@ 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 diff --git a/arch/arm/configs/dss11_defconfig b/arch/arm/configs/dss11_defconfig index 0785b9a..f15fb6b 100644 --- a/arch/arm/configs/dss11_defconfig +++ b/arch/arm/configs/dss11_defconfig @@ -31,7 +31,7 @@ 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 diff --git a/arch/arm/configs/efika-mx-smartbook_defconfig b/arch/arm/configs/efika-mx-smartbook_defconfig index 753e9b6..c078ff1 100644 --- a/arch/arm/configs/efika-mx-smartbook_defconfig +++ b/arch/arm/configs/efika-mx-smartbook_defconfig @@ -89,7 +89,7 @@ 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 diff --git a/arch/arm/configs/eukrea_cpuimx25_defconfig b/arch/arm/configs/eukrea_cpuimx25_defconfig index e81fb70..7f7776d 100644 --- a/arch/arm/configs/eukrea_cpuimx25_defconfig +++ b/arch/arm/configs/eukrea_cpuimx25_defconfig @@ -65,7 +65,7 @@ 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 diff --git a/arch/arm/configs/eukrea_cpuimx35_defconfig b/arch/arm/configs/eukrea_cpuimx35_defconfig index bec7336..7569cde 100644 --- a/arch/arm/configs/eukrea_cpuimx35_defconfig +++ b/arch/arm/configs/eukrea_cpuimx35_defconfig @@ -66,7 +66,7 @@ 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 diff --git a/arch/arm/configs/freescale-mx25-3ds_defconfig b/arch/arm/configs/freescale-mx25-3ds_defconfig index 65d8f20..ead8cbf 100644 --- a/arch/arm/configs/freescale-mx25-3ds_defconfig +++ b/arch/arm/configs/freescale-mx25-3ds_defconfig @@ -53,7 +53,7 @@ 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 diff --git a/arch/arm/configs/freescale-mx6-arm2_defconfig b/arch/arm/configs/freescale-mx6-arm2_defconfig index 7489c47..f4119f0 100644 --- a/arch/arm/configs/freescale-mx6-arm2_defconfig +++ b/arch/arm/configs/freescale-mx6-arm2_defconfig @@ -54,7 +54,7 @@ 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 diff --git a/arch/arm/configs/friendlyarm_mini2440_defconfig b/arch/arm/configs/friendlyarm_mini2440_defconfig index 6cbafef..25db5be 100644 --- a/arch/arm/configs/friendlyarm_mini2440_defconfig +++ b/arch/arm/configs/friendlyarm_mini2440_defconfig @@ -36,7 +36,7 @@ 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 diff --git a/arch/arm/configs/imx233-olinuxino_defconfig b/arch/arm/configs/imx233-olinuxino_defconfig index 3f444f1..75b5911 100644 --- a/arch/arm/configs/imx233-olinuxino_defconfig +++ b/arch/arm/configs/imx233-olinuxino_defconfig @@ -47,7 +47,7 @@ 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 diff --git a/arch/arm/configs/imx_defconfig b/arch/arm/configs/imx_defconfig index 8751ccc..c106f39 100644 --- a/arch/arm/configs/imx_defconfig +++ b/arch/arm/configs/imx_defconfig @@ -92,7 +92,7 @@ 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 diff --git a/arch/arm/configs/imx_v7_defconfig b/arch/arm/configs/imx_v7_defconfig index 0a4f2fe..cad47fd 100644 --- a/arch/arm/configs/imx_v7_defconfig +++ b/arch/arm/configs/imx_v7_defconfig @@ -128,7 +128,7 @@ 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 diff --git a/arch/arm/configs/module-mb7707_defconfig b/arch/arm/configs/module-mb7707_defconfig index 9a4f1d1..843dd59 100644 --- a/arch/arm/configs/module-mb7707_defconfig +++ b/arch/arm/configs/module-mb7707_defconfig @@ -41,7 +41,7 @@ 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 diff --git a/arch/arm/configs/neso_defconfig b/arch/arm/configs/neso_defconfig index 846eca0..278916a 100644 --- a/arch/arm/configs/neso_defconfig +++ b/arch/arm/configs/neso_defconfig @@ -66,7 +66,7 @@ # 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 diff --git a/arch/arm/configs/omap3530_beagle_defconfig b/arch/arm/configs/omap3530_beagle_defconfig index 1ef4825..3068fbb 100644 --- a/arch/arm/configs/omap3530_beagle_defconfig +++ b/arch/arm/configs/omap3530_beagle_defconfig @@ -73,7 +73,7 @@ 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 diff --git a/arch/arm/configs/panda_defconfig b/arch/arm/configs/panda_defconfig index dab407c..3399bd2 100644 --- a/arch/arm/configs/panda_defconfig +++ b/arch/arm/configs/panda_defconfig @@ -69,7 +69,7 @@ # 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 diff --git a/arch/arm/configs/phytec-phycore-imx31_defconfig b/arch/arm/configs/phytec-phycore-imx31_defconfig index 7f19b4a..b83f74a 100644 --- a/arch/arm/configs/phytec-phycore-imx31_defconfig +++ b/arch/arm/configs/phytec-phycore-imx31_defconfig @@ -76,7 +76,7 @@ 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 diff --git a/arch/arm/configs/phytec-phycore-omap4460_defconfig b/arch/arm/configs/phytec-phycore-omap4460_defconfig index 8d5543f..4c7042c 100644 --- a/arch/arm/configs/phytec-phycore-omap4460_defconfig +++ b/arch/arm/configs/phytec-phycore-omap4460_defconfig @@ -61,7 +61,7 @@ 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 diff --git a/arch/arm/configs/pm9g45_defconfig b/arch/arm/configs/pm9g45_defconfig index 2079bcf..d3a5624 100644 --- a/arch/arm/configs/pm9g45_defconfig +++ b/arch/arm/configs/pm9g45_defconfig @@ -50,7 +50,7 @@ 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 diff --git a/arch/arm/configs/solidrun_cubox_defconfig b/arch/arm/configs/solidrun_cubox_defconfig index 2937949..7ba42a9 100644 --- a/arch/arm/configs/solidrun_cubox_defconfig +++ b/arch/arm/configs/solidrun_cubox_defconfig @@ -80,7 +80,7 @@ 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 diff --git a/commands/Kconfig b/commands/Kconfig index 8ee0805..7ca2122 100644 --- a/commands/Kconfig +++ b/commands/Kconfig @@ -1835,7 +1835,7 @@ config CMD_USB bool - depends on USB + depends on USB_HOST prompt "usb command" default y help diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig index adb1b0b..5bad954 100644 --- a/drivers/net/usb/Kconfig +++ b/drivers/net/usb/Kconfig @@ -1,5 +1,5 @@ menuconfig NET_USB - depends on USB + depends on USB_HOST bool "USB network support" if NET_USB diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 13f58e3..a51cfda 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -6,17 +6,12 @@ #include #include -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 @@ 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 @@ 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; } diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index 0b349bf..eedd20e 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig @@ -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 diff --git a/drivers/usb/core/Makefile b/drivers/usb/core/Makefile index 368fb56..a74f141 100644 --- a/drivers/usb/core/Makefile +++ b/drivers/usb/core/Makefile @@ -1,3 +1,3 @@ -obj-y += usb.o +obj-$(CONFIG_USB_HOST) += usb.o obj-$(CONFIG_OFDEVICE) += of.o diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 9c1571d..f572432 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -159,10 +159,10 @@ { 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 @@ 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 @@ 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 @@ 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_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_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 @@ /* match any interface */ for (ifno=0; ifnoconfig.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)) diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 97a7d21..7d5a346 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -4,6 +4,7 @@ menuconfig USB_GADGET depends on USB_HAVE_GADGET_DRIVER + select USB bool "USB gadget support" if USB_GADGET diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 2da3edd..d30c3aa 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -229,16 +229,29 @@ 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) | diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 8bf20d0..3d18a73 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c @@ -794,7 +794,7 @@ | (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) { diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index e4b08b9..5149761 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c @@ -441,7 +441,7 @@ } /* 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 @@ * 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 @@ 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; ifnoconfig.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 @@ /* 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 */ diff --git a/include/usb/usb.h b/include/usb/usb.h index 4877e32..ff5242b 100644 --- a/include/usb/usb.h +++ b/include/usb/usb.h @@ -23,6 +23,7 @@ #define _USB_H_ #include +#include #include #include @@ -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 @@ 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 @@ 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 @@ 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 @@ #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) diff --git a/include/usb/usb_defs.h b/include/usb/usb_defs.h index 13eb330..ace20e4 100644 --- a/include/usb/usb_defs.h +++ b/include/usb/usb_defs.h @@ -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