1. 10 6月, 2013 1 次提交
  2. 23 2月, 2013 1 次提交
  3. 10 1月, 2013 2 次提交
  4. 08 11月, 2012 1 次提交
  5. 31 10月, 2012 1 次提交
    • S
      usb: gadget: always update HS/SS descriptors and create a copy of them · 10287bae
      Sebastian Andrzej Siewior 提交于
      HS and SS descriptors are staticaly created. They are updated during the
      bind process with the endpoint address, string id or interface numbers.
      
      After that, the descriptor chain is linked to struct usb_function which
      is used by composite in order to serve the GET_DESCRIPTOR requests,
      number of available configs and so on.
      
      There is no need to assign the HS descriptor only if the UDC supports
      HS speed because composite won't report those to the host if HS support
      has not been reached. The same reasoning is valid for SS.
      
      This patch makes sure each function updates HS/SS descriptors
      unconditionally and uses the newly introduced helper function to create a
      copy the descriptors for the speed which is supported by the UDC.
      
      While at that, also rename f->descriptors to f->fs_descriptors in order
      to make it more explicit what that means.
      
      Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      10287bae
  6. 10 9月, 2012 2 次提交
    • S
      usb: gadget: remove usb_gadget_controller_number() · ed9cbda6
      Sebastian Andrzej Siewior 提交于
      The bcdDevice field is defined as
      |Device release number in binary-coded decimal
      in the USB 2.0 specification. We use this field to distinguish the UDCs
      from each other. In theory this could be used on the host side to apply
      certain quirks if the "special" UDC in combination with this gadget is
      used. This hasn't been done as far as I am aware. In practice it would
      be better to fix the UDC driver before shipping since a later release
      might not need this quirk anymore.
      
      There are some driver in tree (on the host side) which use the bcdDevice
      field to figure out special workarounds for a given firmware revision.
      This seems to make sense. Therefore this patch converts all gadgets
      (except a few) to use the kernel version instead a random 2 or 3 plus
      the UDC number. The few that don't report kernel's version are:
      - webcam
        This one reports always a version 0x10 so allow it to do so in future.
      - nokia
        This one reports always 0x211. The comment says that this gadget works
        only if the UDC supports altsettings so I added a check for this.
      - serial
        This one reports 0x2400 + UDC number. Since the gadget version is 2.4
        this could make sense. Therefore bcdDevice is 0x2400 here.
      
      I also remove various gadget_is_<name> macros which are unused. The
      remaining few macros should be moved to feature / bug bitfield.
      Acked-by: NMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      ed9cbda6
    • S
      usb: gadget: Provide a default implementation of default manufacturer string · cc2683c3
      Sebastian Andrzej Siewior 提交于
      Some gadgets provide custom entry here. Some may override it with an
      etntry that is also created by composite if there was no value sumbitted
      at all.
      This patch removes all "custom manufacturer" strings which are the same
      as these which are created by composite. Then it moves the creation of
      the default manufacturer string to usb_composite_overwrite_options() in
      case no command line argument has been used and the entry is still an
      empty string.
      By doing this we get rid of the global variable "composite_manufacturer"
      in composite.
      Acked-by: NMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      cc2683c3
  7. 02 7月, 2012 1 次提交
  8. 15 6月, 2012 2 次提交
  9. 04 6月, 2012 1 次提交
  10. 04 5月, 2012 1 次提交
  11. 12 4月, 2012 1 次提交
    • A
      USB: gadget: storage gadgets send wrong error code for unknown commands · c85dcdac
      Alan Stern 提交于
      This patch (as1539) fixes a minor bug in the mass-storage gadget
      drivers.  When an unknown command is received, the error code sent
      back is "Invalid Field in CDB" rather than "Invalid Command".  This is
      because the bitmask of CDB bytes allowed to be nonzero is incorrect.
      
      When handling an unknown command, we don't care which command bytes
      are nonzero.  All the bits in the mask should be set, not just eight
      of them.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: <Michal Nazarewicz <mina86@mina86.com>
      CC: <stable@vger.kernel.org>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      c85dcdac
  12. 29 2月, 2012 2 次提交
  13. 24 1月, 2012 3 次提交
    • F
      usb: gadget: f_mass_storage: Use "bool" instead of "int" in fsg_module_parameters · 4b5203f1
      Fabio Estevam 提交于
      Fix the following build warnings:
      
       CC [M]  drivers/usb/gadget/acm_ms.o
      drivers/usb/gadget/acm_ms.c: In function ‘__check_ro’:
      drivers/usb/gadget/acm_ms.c:119: warning: return from incompatible pointer type
      drivers/usb/gadget/acm_ms.c: In function ‘__check_removable’:
      drivers/usb/gadget/acm_ms.c:119: warning: return from incompatible pointer type
      drivers/usb/gadget/acm_ms.c: In function ‘__check_cdrom’:
      drivers/usb/gadget/acm_ms.c:119: warning: return from incompatible pointer type
      drivers/usb/gadget/acm_ms.c: In function ‘__check_nofua’:
      drivers/usb/gadget/acm_ms.c:119: warning: return from incompatible pointer type
      drivers/usb/gadget/acm_ms.c: In function ‘__check_stall’:
      drivers/usb/gadget/acm_ms.c:119: warning: return from incompatible pointer type
        CC [M]  drivers/usb/gadget/mass_storage.o
      drivers/usb/gadget/mass_storage.c: In function ‘__check_ro’:
      drivers/usb/gadget/mass_storage.c:94: warning: return from incompatible pointer type
      drivers/usb/gadget/mass_storage.c: In function ‘__check_removable’:
      drivers/usb/gadget/mass_storage.c:94: warning: return from incompatible pointer type
      drivers/usb/gadget/mass_storage.c: In function ‘__check_cdrom’:
      drivers/usb/gadget/mass_storage.c:94: warning: return from incompatible pointer type
      drivers/usb/gadget/mass_storage.c: In function ‘__check_nofua’:
      drivers/usb/gadget/mass_storage.c:94: warning: return from incompatible pointer type
      drivers/usb/gadget/mass_storage.c: In function ‘__check_stall’:
      drivers/usb/gadget/mass_storage.c:94: warning: return from incompatible pointer type
      
      Declare the fsg_module_parameters fields as "bool" so that they can match the types
      passed in FSG_MODULE_PARAM_ARRAY macro.
      
      Since commit 493c90ef (module_param: check that bool parameters really are bool.),
      moduleparam.h was changed in a way that the "bool" parameter type now really
      requires "bool" type and no longer allows "unsigned int".
      Signed-off-by: NFabio Estevam <fabio.estevam@freescale.com>
      Acked-by: NMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      4b5203f1
    • S
      usb: gadget: f_mass_storage: remove one FSG_NO_INTR_EP · fcc0bb5a
      Sebastian Andrzej Siewior 提交于
      Remove one define of FSG_NO_INTR_EP and we still have that we can use.
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Acked-by: NMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      fcc0bb5a
    • M
      usb: gadget: update Michal Nazarewicz's email address · 54b8360f
      Michal Nazarewicz 提交于
      The m.nazarewicz@samsung.com email address is no longer valid,
      so this commit replaces it with mina86@mina86.com which is
      employer-agnostic and thus should be valid for foreseeable
      feature.
      Signed-off-by: NMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      54b8360f
  14. 12 12月, 2011 3 次提交
  15. 15 11月, 2011 2 次提交
  16. 14 10月, 2011 2 次提交
  17. 09 9月, 2011 3 次提交
    • P
      usb: gadget: storage: make FSG_NUM_BUFFERS variable size · 6532c7fd
      Per Forlin 提交于
      FSG_NUM_BUFFERS is set to 2 as default.
      Usually 2 buffers are enough to establish a good buffering pipeline.
      The number may be increased in order to compensate a for bursty VFS
      behaviour.
      
      Here follows a description of system that may require more than
      2 buffers.
       * CPU ondemand governor active
       * latency cost for wake up and/or frequency change
       * DMA for IO
      
      Use case description.
       * Data transfer from MMC via VFS to USB.
       * DMA shuffles data from MMC and to USB.
       * The CPU wakes up every now and then to pass data in and out from VFS,
         which cause the bursty VFS behaviour.
      
      Test set up
       * Running dd on the host reading from the mass storage device
       * cmdline: dd if=/dev/sdb of=/dev/null bs=4k count=$((256*100))
       * Caches are dropped on the host and on the device before each run
      
      Measurements on a Snowball board with ondemand_governor active.
      
      FSG_NUM_BUFFERS 2
      104857600 bytes (105 MB) copied, 5.62173 s, 18.7 MB/s
      104857600 bytes (105 MB) copied, 5.61811 s, 18.7 MB/s
      104857600 bytes (105 MB) copied, 5.57817 s, 18.8 MB/s
      
      FSG_NUM_BUFFERS 4
      104857600 bytes (105 MB) copied, 5.26839 s, 19.9 MB/s
      104857600 bytes (105 MB) copied, 5.2691 s, 19.9 MB/s
      104857600 bytes (105 MB) copied, 5.2711 s, 19.9 MB/s
      
      There may not be one optimal number for all boards. This is why
      the number is added to Kconfig. If selecting USB_GADGET_DEBUG_FILES
      this value may be set by a module parameter as well.
      Signed-off-by: NPer Forlin <per.forlin@linaro.org>
      Acked-by: NMichal Nazarewicz <mina86@mina86.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      6532c7fd
    • A
      USB: gadget: storage: remove alignment assumption · 04eee25b
      Alan Stern 提交于
      This patch (as1481) fixes a problem affecting g_file_storage and
      g_mass_storage when running at SuperSpeed.  The two drivers currently
      assume that the bulk-out maxpacket size can evenly divide the SCSI
      block size, which is 512 bytes.  But SuperSpeed bulk endpoints have a
      maxpacket size of 1024, so the assumption is no longer true.
      
      This patch removes that assumption from the drivers, by getting rid of
      a small optimization (they try to align VFS reads and writes on page
      cache boundaries).  If a command's starting logical block address is
      512 bytes below the end of a page, it's not okay to issue a USB
      command for just those 512 bytes when the maxpacket size is 1024 -- it
      would result in either babble (for an OUT transfer) or a short packet
      (for an IN transfer).
      
      Also, for backward compatibility, the test for writes extending beyond
      the end of the backing storage has to be changed.  If the host tries
      to do this, we should accept the data that fits in the backing storage
      and ignore the rest.  Because the storage's end may not align with a
      USB packet boundary, this means we may have to accept a USB OUT
      transfer that extends beyond the end of the storage and then write out
      only the part of the data that fits.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      04eee25b
    • P
      usb: gadget: storage: adapt logic block size to bound block devices · 3f565a36
      Peiyu Li 提交于
      Now the mass storage driver has fixed logic block size of 512 bytes.
      
      The mass storage gadget read/write bound devices only through VFS, so the
      bottom level devices actually are just RAW devices to the driver and connected
      PC. As a RAW, hosts can always format, read and write it right in 512 bytes
      logic block and don't care about the actual logic block size of devices bound
      to the gadget.
      
      But if we want to share the bound block device partition between target board
      and PC, in case the logic block size of the bound block device is 4KB, we
      execute the following steps:
      
      1. connect a board with mass storage gadget to PC(the board has set one
      	partition of on-board block device as file name of the mass storage)
      2. PC format the mass storage to VFAT by default logic block size and
      	read/write it
      3. disconnect boards from PC
      4. target board mount the partition as VFAT
      
      Step 4 will fail since kernel on target thinks the logic block size of the
      bound partition as 4KB.
      A typical error is "FAT: logical sector size too small for device (logical
      sector size = 512)"
      
      If we execute opposite steps:
      1. format the partition to VFAT on target board and read/write this partition
      2. connect the board to Windows PC as usb mass storage gadget, windows will
      	think the disk is not formatted
      
      So the conclusion is that only as a gadget, the mass storage driver has no any
      problem.  But being shared VFAT or other filesystem on PC and target board, it
      will fail.
      
      This patch adapts logic block size to bound block devices and fix the issue.
      
      Cc: Michal Nazarewicz <mina86@mina86.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NPeiyu Li <peiyu.li@csr.com>
      Signed-off-by: NXianglong Du <xianglong.du@csr.com>
      Signed-off-by: NHuayi Li <huayi.li@csr.com>
      Signed-off-by: NBarry Song <Baohua.Song@csr.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      3f565a36
  18. 24 8月, 2011 1 次提交
    • K
      USB: use usb_endpoint_maxp() instead of le16_to_cpu() · 29cc8897
      Kuninori Morimoto 提交于
      Now ${LINUX}/drivers/usb/* can use usb_endpoint_maxp(desc) to get maximum packet size
      instead of le16_to_cpu(desc->wMaxPacketSize).
      This patch fix it up
      
      Cc: Armin Fuerst <fuerst@in.tum.de>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: Johannes Erdfelt <johannes@erdfelt.com>
      Cc: Vojtech Pavlik <vojtech@suse.cz>
      Cc: Oliver Neukum <oliver@neukum.name>
      Cc: David Kubicek <dave@awk.cz>
      Cc: Johan Hovold <jhovold@gmail.com>
      Cc: Brad Hards <bhards@bigpond.net.au>
      Acked-by: NFelipe Balbi <balbi@ti.com>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Thomas Dahlmann <dahlmann.thomas@arcor.de>
      Cc: David Brownell <david-b@pacbell.net>
      Cc: David Lopo <dlopo@chipidea.mips.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Michal Nazarewicz <m.nazarewicz@samsung.com>
      Cc: Xie Xiaobo <X.Xie@freescale.com>
      Cc: Li Yang <leoli@freescale.com>
      Cc: Jiang Bo <tanya.jiang@freescale.com>
      Cc: Yuan-hsin Chen <yhchen@faraday-tech.com>
      Cc: Darius Augulis <augulis.darius@gmail.com>
      Cc: Xiaochen Shen <xiaochen.shen@intel.com>
      Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Cc: OKI SEMICONDUCTOR, <toshiharu-linux@dsn.okisemi.com>
      Cc: Robert Jarzmik <robert.jarzmik@free.fr>
      Cc: Ben Dooks <ben@simtec.co.uk>
      Cc: Thomas Abraham <thomas.ab@samsung.com>
      Cc: Herbert Pötzl <herbert@13thfloor.at>
      Cc: Arnaud Patard <arnaud.patard@rtp-net.org>
      Cc: Roman Weissgaerber <weissg@vienna.at>
      Acked-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: Tony Olech <tony.olech@elandigitalsystems.com>
      Cc: Florian Floe Echtler <echtler@fs.tum.de>
      Cc: Christian Lucht <lucht@codemercs.com>
      Cc: Juergen Stuber <starblue@sourceforge.net>
      Cc: Georges Toth <g.toth@e-biz.lu>
      Cc: Bill Ryder <bryder@sgi.com>
      Cc: Kuba Ober <kuba@mareimbrium.org>
      Cc: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
      Signed-off-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      29cc8897
  19. 29 6月, 2011 2 次提交
  20. 11 5月, 2011 2 次提交
  21. 15 4月, 2011 1 次提交
    • G
      Revert "usb: usb_storage: do not align length of request for CBW to maxp size" · 98346f7d
      Greg Kroah-Hartman 提交于
      This reverts commit 806e8f8f.
      
      To quote Alan Stern:
      	The necessity for this patch has been under discussion.
      
      	It turns out the UDC that Mian has been working on and Felipe's
      	UDC have contradictory requirements.  Mian's UDC driver wants a
      	bulk-OUT transfer length to be shorter than the maxpacket size
      	if a short packet is expected, whereas Felipe's UDC hardware
      	always needs bulk-OUT transfer lengths to be evenly divisible by
      	the maxpacket size.
      
      	Mian has agreed to go back over the driver to resolve this
      	conflict.  This means we probably will not want this patch after
      	all.  (In fact, we may ultimately decide to change the gadget
      	framework to require that bulk-OUT transfer lengths _always_ be
      	divisible by the maxpacket size -- only the g_file_storage and
      	g_mass_storage gadgets would need to be changed.)
      
      Cc: Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com>
      Cc: Michal Nazarewicz <mina86@mina86.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      98346f7d
  22. 14 4月, 2011 4 次提交
  23. 05 2月, 2011 1 次提交
    • J
      USB, Mass Storage, composite, gadget: Fix build failure and memset of a struct · a283c03a
      Jesper Juhl 提交于
      Trying to compile drivers/usb/gadget/f_mass_storage.o currently fails and
      spews a ton of warnings :
      
        CC      drivers/usb/gadget/f_mass_storage.o
      drivers/usb/gadget/f_mass_storage.c:436:22: error: field ‘function’ has incomplete type
      drivers/usb/gadget/f_mass_storage.c: In function ‘fsg_from_func’:
      drivers/usb/gadget/f_mass_storage.c:466:9: warning: type defaults to ‘int’ in declaration of ‘__mptr’
      drivers/usb/gadget/f_mass_storage.c:466:9: warning: initialization from incompatible pointer type
      drivers/usb/gadget/f_mass_storage.c: At top level:
      drivers/usb/gadget/f_mass_storage.c:2743:15: warning: ‘struct usb_composite_dev’ declared inside parameter list
      drivers/usb/gadget/f_mass_storage.c:2743:15: warning: its scope is only this definition or declaration, which is probably not what you want
      drivers/usb/gadget/f_mass_storage.c: In function ‘fsg_common_init’:
      drivers/usb/gadget/f_mass_storage.c:2745:34: error: dereferencing pointer to incomplete type
      drivers/usb/gadget/f_mass_storage.c:2775:23: error: dereferencing pointer to incomplete type
      drivers/usb/gadget/f_mass_storage.c:2779:3: error: implicit declaration of function ‘usb_string_id’
      drivers/usb/gadget/f_mass_storage.c: At top level:
      drivers/usb/gadget/f_mass_storage.c:2984:60: warning: ‘struct usb_configuration’ declared inside parameter list
      drivers/usb/gadget/f_mass_storage.c:3003:57: warning: ‘struct usb_configuration’ declared inside parameter list
      drivers/usb/gadget/f_mass_storage.c: In function ‘fsg_bind’:
      drivers/usb/gadget/f_mass_storage.c:3006:31: error: dereferencing pointer to incomplete type
      drivers/usb/gadget/f_mass_storage.c:3013:2: error: implicit declaration of function ‘usb_interface_id’
      drivers/usb/gadget/f_mass_storage.c:3033:3: error: dereferencing pointer to incomplete type
      drivers/usb/gadget/f_mass_storage.c:3034:6: error: dereferencing pointer to incomplete type
      drivers/usb/gadget/f_mass_storage.c:3043:4: error: dereferencing pointer to incomplete type
      drivers/usb/gadget/f_mass_storage.c:3044:7: error: dereferencing pointer to incomplete type
      drivers/usb/gadget/f_mass_storage.c:3045:26: error: dereferencing pointer to incomplete type
      drivers/usb/gadget/f_mass_storage.c: At top level:
      drivers/usb/gadget/f_mass_storage.c:3067:14: warning: ‘struct usb_configuration’ declared inside parameter list
      drivers/usb/gadget/f_mass_storage.c:3067:14: warning: ‘struct usb_composite_dev’ declared inside parameter list
      drivers/usb/gadget/f_mass_storage.c: In function ‘fsg_bind_config’:
      drivers/usb/gadget/f_mass_storage.c:3093:2: error: implicit declaration of function ‘usb_add_function’
      drivers/usb/gadget/f_mass_storage.c: At top level:
      drivers/usb/gadget/f_mass_storage.c:3103:9: warning: ‘struct usb_configuration’ declared inside parameter list
      drivers/usb/gadget/f_mass_storage.c:3103:9: warning: ‘struct usb_composite_dev’ declared inside parameter list
      drivers/usb/gadget/f_mass_storage.c: In function ‘fsg_add’:
      drivers/usb/gadget/f_mass_storage.c:3105:2: warning: passing argument 1 of ‘fsg_bind_config’ from incompatible pointer type
      drivers/usb/gadget/f_mass_storage.c:3065:12: note: expected ‘struct usb_composite_dev *’ but argument is of type ‘struct usb_composite_dev *’
      drivers/usb/gadget/f_mass_storage.c:3105:2: warning: passing argument 2 of ‘fsg_bind_config’ from incompatible pointer type
      drivers/usb/gadget/f_mass_storage.c:3065:12: note: expected ‘struct usb_configuration *’ but argument is of type ‘struct usb_configuration *’
      drivers/usb/gadget/f_mass_storage.c: At top level:
      drivers/usb/gadget/f_mass_storage.c:3190:23: warning: ‘struct usb_composite_dev’ declared inside parameter list
      drivers/usb/gadget/f_mass_storage.c:3195:23: warning: ‘struct usb_composite_dev’ declared inside parameter list
      drivers/usb/gadget/f_mass_storage.c:3193:1: error: conflicting types for ‘fsg_common_from_params’
      drivers/usb/gadget/f_mass_storage.c:3188:1: note: previous declaration of ‘fsg_common_from_params’ was here
      drivers/usb/gadget/f_mass_storage.c: In function ‘fsg_common_from_params’:
      drivers/usb/gadget/f_mass_storage.c:3199:2: warning: passing argument 2 of ‘fsg_common_init’ from incompatible pointer type
      drivers/usb/gadget/f_mass_storage.c:2741:27: note: expected ‘struct usb_composite_dev *’ but argument is of type ‘struct usb_composite_dev *’
      make[1]: *** [drivers/usb/gadget/f_mass_storage.o] Error 1
      make: *** [drivers/usb/gadget/f_mass_storage.o] Error 2
      
      This is due to the missing include of linux/usb/composite.h - this patch
      adds the missing include.
      
      In addition there's also a problem in fsg_common_init() where we memset
      'common', but we use the size of a pointer to 'struct fsg_common' as the
      size argument to memset(), not the actual size of the struct. This patch
      fixes the sizeof so we zero the entire struct as intended.
      Signed-off-by: NJesper Juhl <jj@chaosbits.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      a283c03a