mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* USB Cleanup patches
@ 2014-07-18 12:44 Sascha Hauer
  2014-07-18 12:44 ` [PATCH 1/4] USB: Kconfig: introduce USB_HOST symbol Sascha Hauer
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Sascha Hauer @ 2014-07-18 12:44 UTC (permalink / raw)
  To: barebox

We have the USB Host stack from U-Boot and the USB Device stack
from the Kernel. Both have some conflicting definitiions of
some structs. This series cleans this up.

Sascha

----------------------------------------------------------------
Sascha Hauer (4):
      USB: Kconfig: introduce USB_HOST symbol
      USB: introduce usb_interface/usb_configuration structs
      USB: Use descriptors from ch9.h
      USB: Remove conflicting USB_SPEED_* definitions

 arch/arm/configs/am335x_defconfig                  |  2 +-
 arch/arm/configs/animeo_ip_defconfig               |  2 +-
 arch/arm/configs/archosg9_defconfig                |  2 +-
 arch/arm/configs/at91sam9m10g45ek_defconfig        |  2 +-
 arch/arm/configs/at91sam9m10ihd_defconfig          |  2 +-
 arch/arm/configs/at91sam9x5ek_defconfig            |  2 +-
 arch/arm/configs/ccmx51_defconfig                  |  2 +-
 arch/arm/configs/chumbyone_defconfig               |  2 +-
 arch/arm/configs/dss11_defconfig                   |  2 +-
 arch/arm/configs/efika-mx-smartbook_defconfig      |  2 +-
 arch/arm/configs/eukrea_cpuimx25_defconfig         |  2 +-
 arch/arm/configs/eukrea_cpuimx35_defconfig         |  2 +-
 arch/arm/configs/freescale-mx25-3ds_defconfig      |  2 +-
 arch/arm/configs/freescale-mx6-arm2_defconfig      |  2 +-
 arch/arm/configs/friendlyarm_mini2440_defconfig    |  2 +-
 arch/arm/configs/imx233-olinuxino_defconfig        |  2 +-
 arch/arm/configs/imx_defconfig                     |  2 +-
 arch/arm/configs/imx_v7_defconfig                  |  2 +-
 arch/arm/configs/module-mb7707_defconfig           |  2 +-
 arch/arm/configs/neso_defconfig                    |  2 +-
 arch/arm/configs/omap3530_beagle_defconfig         |  2 +-
 arch/arm/configs/panda_defconfig                   |  2 +-
 arch/arm/configs/phytec-phycore-imx31_defconfig    |  2 +-
 arch/arm/configs/phytec-phycore-omap4460_defconfig |  2 +-
 arch/arm/configs/pm9g45_defconfig                  |  2 +-
 arch/arm/configs/solidrun_cubox_defconfig          |  2 +-
 commands/Kconfig                                   |  2 +-
 drivers/net/usb/Kconfig                            |  2 +-
 drivers/net/usb/usbnet.c                           | 17 ++--
 drivers/usb/Kconfig                                | 10 ++-
 drivers/usb/core/Makefile                          |  2 +-
 drivers/usb/core/usb.c                             | 52 ++++++------
 drivers/usb/gadget/Kconfig                         |  1 +
 drivers/usb/host/ehci-hcd.c                        | 17 +++-
 drivers/usb/host/ohci-hcd.c                        |  2 +-
 drivers/usb/storage/usb.c                          | 24 +++---
 include/usb/usb.h                                  | 92 ++++------------------
 include/usb/usb_defs.h                             |  6 --
 38 files changed, 112 insertions(+), 167 deletions(-)

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/4] USB: Kconfig: introduce USB_HOST symbol
  2014-07-18 12:44 USB Cleanup patches Sascha Hauer
@ 2014-07-18 12:44 ` Sascha Hauer
  2014-07-18 12:44 ` [PATCH 2/4] USB: introduce usb_interface/usb_configuration structs Sascha Hauer
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2014-07-18 12:44 UTC (permalink / raw)
  To: barebox

This renames USB to USB_HOST since this is what the symbol really
means. Introduce a USB symbol which is selected by both USB_GADGET
and USB_HOST. This gives us a symbol to let common USB code depend
on.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/configs/am335x_defconfig                  |  2 +-
 arch/arm/configs/animeo_ip_defconfig               |  2 +-
 arch/arm/configs/archosg9_defconfig                |  2 +-
 arch/arm/configs/at91sam9m10g45ek_defconfig        |  2 +-
 arch/arm/configs/at91sam9m10ihd_defconfig          |  2 +-
 arch/arm/configs/at91sam9x5ek_defconfig            |  2 +-
 arch/arm/configs/ccmx51_defconfig                  |  2 +-
 arch/arm/configs/chumbyone_defconfig               |  2 +-
 arch/arm/configs/dss11_defconfig                   |  2 +-
 arch/arm/configs/efika-mx-smartbook_defconfig      |  2 +-
 arch/arm/configs/eukrea_cpuimx25_defconfig         |  2 +-
 arch/arm/configs/eukrea_cpuimx35_defconfig         |  2 +-
 arch/arm/configs/freescale-mx25-3ds_defconfig      |  2 +-
 arch/arm/configs/freescale-mx6-arm2_defconfig      |  2 +-
 arch/arm/configs/friendlyarm_mini2440_defconfig    |  2 +-
 arch/arm/configs/imx233-olinuxino_defconfig        |  2 +-
 arch/arm/configs/imx_defconfig                     |  2 +-
 arch/arm/configs/imx_v7_defconfig                  |  2 +-
 arch/arm/configs/module-mb7707_defconfig           |  2 +-
 arch/arm/configs/neso_defconfig                    |  2 +-
 arch/arm/configs/omap3530_beagle_defconfig         |  2 +-
 arch/arm/configs/panda_defconfig                   |  2 +-
 arch/arm/configs/phytec-phycore-imx31_defconfig    |  2 +-
 arch/arm/configs/phytec-phycore-omap4460_defconfig |  2 +-
 arch/arm/configs/pm9g45_defconfig                  |  2 +-
 arch/arm/configs/solidrun_cubox_defconfig          |  2 +-
 commands/Kconfig                                   |  2 +-
 drivers/net/usb/Kconfig                            |  2 +-
 drivers/usb/Kconfig                                | 10 +++++++---
 drivers/usb/core/Makefile                          |  2 +-
 drivers/usb/gadget/Kconfig                         |  1 +
 31 files changed, 37 insertions(+), 32 deletions(-)

diff --git a/arch/arm/configs/am335x_defconfig b/arch/arm/configs/am335x_defconfig
index 0c92c96..8af38e5 100644
--- a/arch/arm/configs/am335x_defconfig
+++ b/arch/arm/configs/am335x_defconfig
@@ -95,7 +95,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
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=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
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_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
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=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
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=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
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=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
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_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
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_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
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=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
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_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
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=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
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=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
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_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
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=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
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_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
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_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
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=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
diff --git a/arch/arm/configs/imx_v7_defconfig b/arch/arm/configs/imx_v7_defconfig
index 66fc123..eca244d 100644
--- a/arch/arm/configs/imx_v7_defconfig
+++ b/arch/arm/configs/imx_v7_defconfig
@@ -127,7 +127,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
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_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
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=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
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_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
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_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
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_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
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_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
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=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
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_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
diff --git a/commands/Kconfig b/commands/Kconfig
index 61816f5..174a5b6 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -1818,7 +1818,7 @@ config CMD_LED_TRIGGER
 
 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/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/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 @@ config USB_HAVE_GADGET_DRIVER
 
 menuconfig USB_GADGET
 	depends on USB_HAVE_GADGET_DRIVER
+	select USB
 	bool "USB gadget support"
 
 if USB_GADGET
-- 
2.0.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/4] USB: introduce usb_interface/usb_configuration structs
  2014-07-18 12:44 USB Cleanup patches Sascha Hauer
  2014-07-18 12:44 ` [PATCH 1/4] USB: Kconfig: introduce USB_HOST symbol Sascha Hauer
@ 2014-07-18 12:44 ` Sascha Hauer
  2014-07-18 12:44 ` [PATCH 3/4] USB: Use descriptors from ch9.h Sascha Hauer
  2014-07-18 12:44 ` [PATCH 4/4] USB: Remove conflicting USB_SPEED_* definitions Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2014-07-18 12:44 UTC (permalink / raw)
  To: barebox

Currently we have two conflicting definitions of struct usb_config_descriptor
and struct usb_interface_descriptor in the tree. This is because the USB code
uses additional fields in the structs for internal housekeeping. Add
struct usb_interface and struct struct usb_configuration with the housekeeping
data and embed the corresponding hardware structs into them. This frees the
way to use the definitions from ch9.h in the next step.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/net/usb/usbnet.c  | 12 +++++------
 drivers/usb/core/usb.c    | 52 +++++++++++++++++++++++------------------------
 drivers/usb/storage/usb.c | 24 +++++++++++-----------
 include/usb/usb.h         | 35 +++++++++++++++----------------
 4 files changed, 62 insertions(+), 61 deletions(-)

diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 13f58e3..e9edf40 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -16,7 +16,7 @@ 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 +24,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 +63,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;
 	}
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 @@ 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))
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 @@ 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 */
diff --git a/include/usb/usb.h b/include/usb/usb.h
index 4877e32..74b97a9 100644
--- a/include/usb/usb.h
+++ b/include/usb/usb.h
@@ -39,13 +39,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;
@@ -102,12 +95,6 @@ struct usb_interface_descriptor {
 	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));
 
 
@@ -121,9 +108,6 @@ struct usb_config_descriptor {
 	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 {
@@ -134,6 +118,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 +155,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 */
-- 
2.0.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/4] USB: Use descriptors from ch9.h
  2014-07-18 12:44 USB Cleanup patches Sascha Hauer
  2014-07-18 12:44 ` [PATCH 1/4] USB: Kconfig: introduce USB_HOST symbol Sascha Hauer
  2014-07-18 12:44 ` [PATCH 2/4] USB: introduce usb_interface/usb_configuration structs Sascha Hauer
@ 2014-07-18 12:44 ` Sascha Hauer
  2014-07-18 12:44 ` [PATCH 4/4] USB: Remove conflicting USB_SPEED_* definitions Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2014-07-18 12:44 UTC (permalink / raw)
  To: barebox

Use the descriptors from ch9.h instead of duplicating them
in usb.h

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/net/usb/usbnet.c |  5 ----
 include/usb/usb.h        | 63 +-----------------------------------------------
 2 files changed, 1 insertion(+), 67 deletions(-)

diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index e9edf40..a51cfda 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -6,11 +6,6 @@
 #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)
 {
diff --git a/include/usb/usb.h b/include/usb/usb.h
index 74b97a9..a0bc1d2 100644
--- a/include/usb/usb.h
+++ b/include/usb/usb.h
@@ -23,6 +23,7 @@
 #define _USB_H_
 
 #include <driver.h>
+#include <usb/ch9.h>
 #include <usb/usb_defs.h>
 #include <asm/byteorder.h>
 
@@ -48,68 +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;
-} __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;
-} __attribute__ ((packed));
-
 enum {
 	/* Maximum packet size; encoded as 0,1,2,3 = 8,16,32,64 */
 	PACKET_SIZE_8   = 0,
-- 
2.0.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 4/4] USB: Remove conflicting USB_SPEED_* definitions
  2014-07-18 12:44 USB Cleanup patches Sascha Hauer
                   ` (2 preceding siblings ...)
  2014-07-18 12:44 ` [PATCH 3/4] USB: Use descriptors from ch9.h Sascha Hauer
@ 2014-07-18 12:44 ` Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2014-07-18 12:44 UTC (permalink / raw)
  To: barebox

We have USB_SPEED_* definitions as macros in usb_defs.h and as an enum
in ch9.h. The defines in usb.h correspond to hardware bits in the
ehci controller. Get rid of them and keep the hardware independent
enums.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/usb/host/ehci-hcd.c | 17 +++++++++++++++--
 drivers/usb/host/ohci-hcd.c |  2 +-
 include/usb/usb.h           |  2 --
 include/usb/usb_defs.h      |  6 ------
 4 files changed, 16 insertions(+), 11 deletions(-)

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 @@ 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) |
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 @@ 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) {
diff --git a/include/usb/usb.h b/include/usb/usb.h
index a0bc1d2..ff5242b 100644
--- a/include/usb/usb.h
+++ b/include/usb/usb.h
@@ -301,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)
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
-- 
2.0.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-07-18 12:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-18 12:44 USB Cleanup patches Sascha Hauer
2014-07-18 12:44 ` [PATCH 1/4] USB: Kconfig: introduce USB_HOST symbol Sascha Hauer
2014-07-18 12:44 ` [PATCH 2/4] USB: introduce usb_interface/usb_configuration structs Sascha Hauer
2014-07-18 12:44 ` [PATCH 3/4] USB: Use descriptors from ch9.h Sascha Hauer
2014-07-18 12:44 ` [PATCH 4/4] USB: Remove conflicting USB_SPEED_* definitions Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox