Re: [PATCH v3] target: add usb gadget fabric module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2012-01-18 at 22:56 +0100, Sebastian Andrzej Siewior wrote:
> 
> This fabric uses the target framework to provide a usb gadget device.
> This gadget supports the USB Attached SCSI Protocol (UASP) and Bulk Only
> Transfers (BOT or BBB). BOT is the primary interface, UAS is the
> alternative interface.
> It has been tested with dummy_hcd on HS and SS. On SS USB3 are
> supported. I also took my omap device and tried it there against
> WindowsXP.
> UAS implements basic command passing (i.e. read/write requests) and TASK
> MANAGEMENT functions are missing.
> I had to add a little of error recovery to BOT because Windows was
> issuing some strange commands and it does not complain after the gadget
> responded with CSW.status=1.
> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> ---
> v2..v3:
> - make bot more robust
> - use DELAYED_STATUS for synchronization during set_alt instead of magic
>   tricks with a workqueue
> - better handling of invalid commands
> 
>  drivers/target/Kconfig               |    1 +
>  drivers/target/Makefile              |    1 +
>  drivers/target/usb-gadget/Kconfig    |   10 +
>  drivers/target/usb-gadget/Makefile   |    7 +
>  drivers/target/usb-gadget/bot.c      |  443 +++++++++++++++++++++++
>  drivers/target/usb-gadget/configfs.c |  511 +++++++++++++++++++++++++++
>  drivers/target/usb-gadget/fabric.c   |  638 ++++++++++++++++++++++++++++++++++
>  drivers/target/usb-gadget/gadget.c   |  533 ++++++++++++++++++++++++++++
>  drivers/target/usb-gadget/remove.h   |  110 ++++++
>  drivers/target/usb-gadget/uas.c      |  437 +++++++++++++++++++++++
>  drivers/target/usb-gadget/usbg.h     |  210 +++++++++++
>  drivers/usb/gadget/Kconfig           |    3 +
>  12 files changed, 2904 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/target/usb-gadget/Kconfig
>  create mode 100644 drivers/target/usb-gadget/Makefile
>  create mode 100644 drivers/target/usb-gadget/bot.c
>  create mode 100644 drivers/target/usb-gadget/configfs.c
>  create mode 100644 drivers/target/usb-gadget/fabric.c
>  create mode 100644 drivers/target/usb-gadget/gadget.c
>  create mode 100644 drivers/target/usb-gadget/remove.h
>  create mode 100644 drivers/target/usb-gadget/uas.c
>  create mode 100644 drivers/target/usb-gadget/usbg.h
> 
> diff --git a/drivers/target/Kconfig b/drivers/target/Kconfig
> index 0044492..fc5fa9f 100644
> --- a/drivers/target/Kconfig
> +++ b/drivers/target/Kconfig
> @@ -40,5 +40,6 @@ source "drivers/target/loopback/Kconfig"
>  source "drivers/target/tcm_fc/Kconfig"
>  source "drivers/target/iscsi/Kconfig"
>  source "drivers/target/tcm_vhost/Kconfig"
> +source "drivers/target/usb-gadget/Kconfig"
>  
>  endif
> diff --git a/drivers/target/Makefile b/drivers/target/Makefile
> index f934be6..6b5f526 100644
> --- a/drivers/target/Makefile
> +++ b/drivers/target/Makefile
> @@ -27,3 +27,4 @@ obj-$(CONFIG_LOOPBACK_TARGET)	+= loopback/
>  obj-$(CONFIG_TCM_FC)		+= tcm_fc/
>  obj-$(CONFIG_ISCSI_TARGET)	+= iscsi/
>  obj-$(CONFIG_TCM_VHOST)		+= tcm_vhost/
> +obj-$(CONFIG_TARGET_USB_GADGET)	+= usb-gadget/
> diff --git a/drivers/target/usb-gadget/Kconfig b/drivers/target/usb-gadget/Kconfig
> new file mode 100644
> index 0000000..5fdc756
> --- /dev/null
> +++ b/drivers/target/usb-gadget/Kconfig
> @@ -0,0 +1,10 @@
> +config TARGET_USB_GADGET
> +	tristate "USB Gadget Fabric Module"
> +	depends on TARGET_CORE && CONFIGFS_FS

Dropping the extra depends on TARGET_CORE && CONFIGFS_FS here, as
drivers/target/Kconfig is using 'if TARGET_CORE' with parent level
Kconfig..

> +	depends on USB_GADGET
> +	---help---
> +	This fabric is an USB gadget. Two USB protocols are supported that is
> +	BBB or BOT (Bulk Only Transport) and UAS (USB Attached SCSI). BOT is
> +	advertised on alternative interface 0 (primary) and UAS is on
> +	alternative interface 1. Both protocols can work on USB2.0 and USB3.0.
> +	UAS utilizes the USB 3.0 feature called streams support.
> diff --git a/drivers/target/usb-gadget/Makefile b/drivers/target/usb-gadget/Makefile
> new file mode 100644
> index 0000000..264b4c7
> --- /dev/null
> +++ b/drivers/target/usb-gadget/Makefile
> @@ -0,0 +1,7 @@
> +CFLAGS_gadget.o			:= -I$(srctree)/drivers/usb/gadget
> +tcm_usb_gadget-objs		:= configfs.o \
> +					fabric.o \
> +					bot.o \
> +					uas.o \
> +					gadget.o
> +obj-$(CONFIG_TARGET_USB_GADGET)	+= tcm_usb_gadget.o

Btw, at some point ahead of RFC for mainline these will need to be
condensed into fewer source files, but for now I don't have a objection
with the source layout as-is for merging into lio-core for testing..

Nice work on this one!  :)

--nab


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux