1. 07 Jan, 2009 40 commits
    • Alan Stern's avatar
      USB: storage: set bounce limit for non-DMA-capable host controllers · 96983d2d
      Alan Stern authored
      This patch (as1175) makes usb-storage set a SCSI device's
      request-queue bounce limit such that all buffers will be located in
      addressable memory (i.e., not in high memory) if the host controller's
      dma_mask is NULL.  This is necessary when the host controller doesn't
      support DMA: If a buffer is in high memory then the both the virtual
      and DMA addresses produced by the scatter-gather library will be NULL,
      preventing the HCD from accessing the buffer's data.
      
      In particular, the isp1760 driver needs this when used on a system
      with more than 1 GB of memory.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      CC: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
      Acked-by: default avatarJens Axboe <jens.axboe@oracle.com>
      Tested-by: default avatarThomas Hommel <Thomas.Hommel@gefanuc.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      96983d2d
    • Alan Stern's avatar
      USB: usb-storage: merge ATAPI and QIC-157 protocol routines · 3dae5345
      Alan Stern authored
      This patch (as1174) merges usb-storage's QIC-157 and ATAPI protocol
      routines.  Since the two functions are identical, there's no reason to
      keep them separate.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      3dae5345
    • Alan Stern's avatar
      USB: usb-storage: merge CB and CBI transport routines · 64648a9d
      Alan Stern authored
      This patch (as1173) merges usb-storage's CB and CBI transports into a
      single routine.  So much of their code is common, it's silly to keep
      them separate.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      CC: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      64648a9d
    • Alan Stern's avatar
      USB: g_file_storage: add CD-ROM emulation · 12aae68a
      Alan Stern authored
      This patch (as1172) adds the ability to emulate a CD-ROM drive to
      g_file_storage.  The emulation is limited, since it presents as a disc
      containing a single data track and no audio tracks.  Still, it may
      come in useful on occasion.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      12aae68a
    • Ben Efros's avatar
      USB: storage: Flag devices known to support SANE_SENSE · dbe6e0c0
      Ben Efros authored
      Add a few devices known to have support for larger sense buffers.
      Supporting SANE_SENSE does not necessarily mean SAT-1 or SAT-2 is fully
      supported.
      
      Depends on SANE_SENSE patch [1].  Incorporates the Maxtor and Western
      Digital devices originally submitted by Matthieu CASTET [2]. 
      
      [1] https://lists.one-eyed-alien.net/pipermail/usb-storage/2008-November/004181.html
      [2] http://marc.info/?l=linux-usb&m=121762869915609&w=2Signed-off-by: default avatarBen Efros <ben@pc-doctor.com>
      Signed-off-by: default avatarMatthew Dharm <mdharm-usb@one-eyed-alien.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      dbe6e0c0
    • Ben Efros's avatar
      USB: storage devices and SAT · 1537e0ad
      Ben Efros authored
      Add the SANE SENSE flag to indicate that a device is capable of handling
      more than 18-bytes of sense data.  This functionality is required for
      USB-ATA bridges implementing SAT.  A future patch will actually enable this
      function for several devices.
      
      The logic behind this is that we can detect support for SANE_SENSE in a few ways:
       1) ATA PASS THROUGH (12) or (16) execute successfully
       2) SPC-3 or higher is in use
       3) A previous CHECK CONDITION occurred with sense format 70-73 and had
          a length greater than 18-bytes total
      Signed-off-by: default avatarBen Efros <ben@pc-doctor.com>
      Signed-off-by: default avatarMatthew Dharm <mdharm-usb@one-eyed-alien.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      
      1537e0ad
    • Alan Stern's avatar
      USB: usb-storage: remove us->sensebuf · a658367d
      Alan Stern authored
      This patch (as1171) removes us->sensebuf, since it isn't used anywhere.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      
      a658367d
    • Alan Stern's avatar
      usb-storage: clean up unusual_devs.h · f9dc8f99
      Alan Stern authored
      This patch (as1170) removes some duplicate entries in unusual_devs.h
      and rearranges a few others to put the list in proper numerical order.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      f9dc8f99
    • Alan Stern's avatar
      USB: announce new devices earlier · 6cd13201
      Alan Stern authored
      This patch (as1166) changes usb_new_device().  Now new devices will be
      announced in the log _prior_ to being registered; this way the "new
      device" lines will appear before all the output from driver probing,
      which seems much more logical.
      
      Also, the patch adds a call to usb_stop_pm() to the failure pathway,
      so that the parent's count of unsuspended children will remain correct
      if registration fails.  In order for this to work properly, the code
      to increment that count has to be moved forward, before the first
      point where a failure can occur.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      6cd13201
    • Pete Zaitcev's avatar
      USB: Allow usbmon as a module even if usbcore is builtin · f150fa1a
      Pete Zaitcev authored
      usbmon can only be built as a module if usbcore is a module too. Trivial
      changes to the relevant Kconfig and Makefile (and a few trivial changes
      elsewhere) allow usbmon to be built as a module even if usbcore is
      builtin.
      
      This is verified to work in all 9 permutations (3 correctly prohibited
      by Kconfig, 6 build a suitable result).
      Signed-off-by: default avatarPaul Bolle <pebolle@tiscali.nl>
      Signed-off-by: default avatarPete Zaitcev <zaitcev@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      f150fa1a
    • Qinghuang Feng's avatar
      USB: serial: ipw.c: mark {__init|__exit} for usb_ipw_{init|exit} · 5e5b0e5d
      Qinghuang Feng authored
      mark {__init|__exit} for usb_ipw_{init|exit} ()
      Signed-off-by: default avatarQinghuang Feng <qhfeng.kernel@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      5e5b0e5d
    • Qinghuang Feng's avatar
      USB: gadget: pxa27x_udc.c: cleanup kernel-doc · 1c53e6cb
      Qinghuang Feng authored
      no argument named @index in pio_irq_disable, and
      no argument named @req in inc_ep_stats_bytes,
      remove them.
      Signed-off-by: default avatarQinghuang Feng <qhfeng.kernel@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      1c53e6cb
    • Magnus Damm's avatar
      USB: m66592 and r8a66597 resource changes · 0a2e5b9b
      Magnus Damm authored
      Use the more common platform_get_resource() together with index instead
      of depending on the resource name and platform_get_resource_by_name().
      Replace the resource_len() implementation with resource_size().
      Signed-off-by: default avatarMagnus Damm <damm@igel.co.jp>
      Acked-by: default avatarYoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      0a2e5b9b
    • Jean Delvare's avatar
      USB: Convert ohci-pnx4008 to a new-style i2c driver · 3a407e73
      Jean Delvare authored
      The legacy i2c binding model will go away soon, convert ohci-pnx4008
      to use the new binding model instead.
      Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      3a407e73
    • Inaky Perez-Gonzalez's avatar
      USB: Introduce usb_queue_reset() to do resets from atomic contexts · dc023dce
      Inaky Perez-Gonzalez authored
      This patch introduces a new call to be able to do a USB reset from an
      atomic contect. This is quite helpful in USB callbacks to handle
      errors (when the only thing that can be done is to do a device
      reset).
      
      It is done queuing a work struct that will do the actual reset. The
      struct is "attached" to an interface so pending requests from an
      interface are removed when said interface is unbound from the driver.
      
      The call flow then becomes:
      
      usb_queue_reset_device()
        __usb_queue_reset_device() [workqueue]
          usb_reset_device()
      
      usb_probe_interface()
        usb_cancel_queue_reset()      [error path]
      
      usb_unbind_interface()
        usb_cancel_queue_reset()
      
      usb_driver_release_interface()
        usb_cancel_queue_reset()
      
      Note usb_cancel_queue_reset() needs smarts to try not to unqueue when
      it is actually being executed. This happens when we run the reset from
      the workqueue: usb_reset_device() is called and on interface unbind
      time, usb_cancel_queue_reset() would be called. That would deadlock on
      cancel_work_sync(). To avoid that, we set (before running
      usb_reset_device()) usb_intf->reset_running and clear it inmediately
      after returning.
      
      Patch is against 2.6.28-rc2 and depends on
      http://marc.info/?l=linux-usb&m=122581634925308&w=2 (as submitted by
      Alan Stern).
      Signed-off-by: default avatarInaky Perez-Gonzalez <inaky@linux.intel.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      dc023dce
    • Alan Stern's avatar
      USB: add asynchronous autosuspend/autoresume support · 9ac39f28
      Alan Stern authored
      This patch (as1160b) adds support routines for asynchronous autosuspend
      and autoresume, with accompanying documentation updates.  There
      already are several potential users of this interface, and others are
      likely to arise as autosuspend support becomes more widespread.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      9ac39f28
    • Alan Stern's avatar
      USB: usb-storage: add "quirks=" module parameter · d4f373e5
      Alan Stern authored
      This patch (as1163b) adds a "quirks=" module parameter to usb-storage.
      This will allow people to make short-term changes to their
      unusual_devs list without rebuilding the entire driver.  Testing will
      become much easier, and less-sophisticated users will be able to
      access their buggy devices after a simple config-file change instead
      of having to wait for a new kernel release.
      
      The patch also adds a documentation entry for usb-storage's
      "delay_use" parameter, which has been around for years but but was
      never listed among the kernel parameters.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      d4f373e5
    • Kay Sievers's avatar
    • Kay Sievers's avatar
    • Vitaly Bordug's avatar
      USB: powerpc: Workaround for the PPC440EPX USBH_23 errata [take 3] · 796bcae7
      Vitaly Bordug authored
      A published errata for ppc440epx states, that when running Linux with
      both EHCI and OHCI modules loaded, the EHCI module experiences a fatal
      error when a high-speed device is connected to the USB2.0, and
      functions normally if OHCI module is not loaded.
      
      There used to be recommendation to use only hi-speed or full-speed
      devices with specific conditions, when respective module was unloaded.
      Later, it was observed that ohci suspend is enough to keep things
      going, and it was turned into workaround, as explained below.
      
      Quote from original descriprion:
      
      The 440EPx USB 2.0 Host controller is an EHCI compliant controller.  In
      USB 2.0 Host controllers, each EHCI controller has one or more companion
      controllers, which may be OHCI or UHCI.  An USB 2.0 Host controller will
      contain one or more ports.  For each port, only one of the controllers
      is connected at any one time. In the 440EPx, there is only one OHCI
      companion controller, and only one USB 2.0 Host port.
      All ports on an USB 2.0 controller default to the companion
      controller.  If you load only an ohci driver, it will have control of
      the ports and any deviceplugged in will operate, although high speed
      devices will be forced to operate at full speed.  When an ehci driver
      is loaded, it explicitly takes control of the ports.  If there is a
      device connected, and / or every time there is a new device connected,
      the ehci driver determines if the device is high speed or not.  If it
      is high speed, the driver retains control of the port.  If it is not,
      the driver explicitly gives the companion controller control of the
      port.
      
      The is a software workaround that uses
      Initial version of the software workaround was posted to
      linux-usb-devel:
      
      http://www.mail-archive.com/linux-usb-devel@lists.sourceforge.net/msg54019.html
      
      and later available from amcc.com:
      http://www.amcc.com/Embedded/Downloads/download.html?cat=1&family=15&ins=2
      
      The patch below is generally based on the latter, but reworked to
      powerpc/of_device USB drivers, and uses a few devicetree inquiries to
      get rid of (some) hardcoded defines.
      Signed-off-by: default avatarVitaly Bordug <vitb@kernel.crashing.org>
      Signed-off-by: default avatarStefan Roese <sr@denx.de>
      Cc: David Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      796bcae7
    • Anton Vorontsov's avatar
      USB: fsl_qe_udc: Check for muram allocation errors · cd40c4c4
      Anton Vorontsov authored
      The QE UDC doesn't check for cpm_muram_alloc() return values, this
      might cause all sorts of misbehaviour when cpm_muram_alloc() failed
      to allocate the muram memory.
      
      While at at, change few dev_dbg() calls to dev_err(), so that the
      driver would not die silently.
      Signed-off-by: default avatarAnton Vorontsov <avorontsov@ru.mvista.com>
      Cc: David Brownell <dbrownell@users.sourceforge.net>
      Cc: Kumar Gala <galak@kernel.crashing.org>
      Cc: Li Yang <leoli@freescale.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      cd40c4c4
    • Alan Stern's avatar
      USB: change interface to usb_lock_device_for_reset() · 011b15df
      Alan Stern authored
      This patch (as1161) changes the interface to
      usb_lock_device_for_reset().  The existing interface is apparently not
      very clear, judging from the fact that several of its callers don't
      use it correctly.  The new interface always returns 0 for success and
      it always requires the caller to unlock the device afterward.
      
      The new routine will not return immediately if it is called while the
      driver's probe method is running.  Instead it will wait until the
      probe is over and the device has been unlocked.  This shouldn't cause
      any problems; I don't know of any cases where drivers call
      usb_lock_device_for_reset() during probe.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Cc: Pete Zaitcev <zaitcev@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      011b15df
    • Ilpo Järvinen's avatar
      USB: usbtmc: indent & braces disagree, something else is desired · 857cc4df
      Ilpo Järvinen authored
      It seems that there's rather involved way to say something
      which is commonly written in a plain simple form.
      
      Some type changes would probably be necessary to get gcc
      to do bitops instead of divide but it's no worse after my
      change than before I think.
      Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@helsinki.fi>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      857cc4df
    • Oliver Neukum's avatar
      USB: power availability check for berry_charge · b404299f
      Oliver Neukum authored
      this introduces a sanity check into berry_charge to give up before
      damage is done if we lack juice.
      Signed-off-by: default avatarOliver Neukum <oneukum@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      b404299f
    • Phil Endecott's avatar
      USB: Remove restrictions on signal numbers in devio.c · ff8973d9
      Phil Endecott authored
      Just over a year ago (!) I had this brief exchange with Alan Stern:
      
      >> It seems that the signal that can be used with USBDEVFS_DISCSIGNAL and 
      >> in usbdevfs_urb.signr is limited to the real-time signals SIGRTMIN to 
      >> SIGRTMAX. What's the rationale for this restriction? I believe that a 
      >> process can kill() itself with any signal number, can't it? I was 
      >> planning to use SIGIO for usbdevfs_urb.signr and SIGTERM (uncaught) for 
      >> USBDEVFS_DISCSIGNAL. I don't think I'll have a problem with using 
      >> SIGRTMIN+n instead, but I'm curious to know if there's some subtle 
      >> problem with the non-real-time signals that I should be aware of.
      >
      > I don't know of any reason for this restriction.
      
      Since no-one else could think of a reason either, I offer the following 
      patch which allows any signal to be used with USBDEVFS_DISCSIGNAL and 
      usbdevfs_urb.signr.
      Signed-off-by: default avatarPhil Endecott <usbpatch@chezphil.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      ff8973d9
    • Harvey Harrison's avatar
      USB: wusb: annotate association types withe proper endianness · d767d888
      Harvey Harrison authored
      Also a trivial annotation in rh.c for:
      drivers/usb/wusbcore/rh.c:366:9: warning: incorrect type in assignment (different base types)
      drivers/usb/wusbcore/rh.c:366:9:    expected unsigned short [unsigned] [short] [usertype] <noident>
      drivers/usb/wusbcore/rh.c:366:9:    got restricted __le16 [usertype] <noident>
      drivers/usb/wusbcore/rh.c:367:9: warning: incorrect type in assignment (different base types)
      drivers/usb/wusbcore/rh.c:367:9:    expected unsigned short [unsigned] [short] [usertype] <noident>
      drivers/usb/wusbcore/rh.c:367:9:    got restricted __le16 [usertype] <noident>
      
      Association types annotation fixes piles of warnings similar to:
      drivers/usb/wusbcore/cbaf.c:238:30: warning: incorrect type in initializer (different base types)
      drivers/usb/wusbcore/cbaf.c:238:30:    expected restricted __le16 [usertype] id
      drivers/usb/wusbcore/cbaf.c:238:30:    got int
      drivers/usb/wusbcore/cbaf.c:238:30: warning: incorrect type in initializer (different base types)
      drivers/usb/wusbcore/cbaf.c:238:30:    expected restricted __le16 [usertype] len
      drivers/usb/wusbcore/cbaf.c:238:30:    got int
      Signed-off-by: default avatarHarvey Harrison <harvey.harrison@gmail.com>
      Cc: David Vrabel <david.vrabel@csr.com>
      Cc: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      d767d888
    • Steven Noonan's avatar
      USB: EHCI pci-quirks.c: don't wait so long for BIOS handoff · d859bffc
      Steven Noonan authored
      Instead of waiting a painful 5000ms, quirk_usb_disable_ehci() now does a
      1000ms loop to wait for the BIOS to acknowledge the handoff.
      
      The five second delay is really quite irritating to have to deal with
      every boot up, and I very seriously doubt any non-broken bios takes more
      than a second to do the actual handoff.
      Signed-off-by: default avatarSteven Noonan <steven@uplinklabs.net>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: David Brownell <david-b@pacbell.net>
      Cc: Jeff Garzik <jeff@garzik.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      d859bffc
    • Alan Stern's avatar
      USB: straighten out inline code in sysfs.c · 92b0da15
      Alan Stern authored
      This patch (as1156) straightens out some code in usbcore.  The
      usb_create_intf_ep_files() and usb_remove_intf_ep_files() routines
      don't need to be separate inlines; they should be moved bodily into
      the places where they get used.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      
      92b0da15
    • Harvey Harrison's avatar
      USB: avoid needless address-taking of function parameters · da2bbdcc
      Harvey Harrison authored
      There's no need to take the address of the function params or local variables
      when the direct value byteswapping routines are available.
      Signed-off-by: default avatarHarvey Harrison <harvey.harrison@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      da2bbdcc
    • Anton Vorontsov's avatar
      USB: protect hcd.h from multiple inclusions · aa459e6a
      Anton Vorontsov authored
      This will let us use this header in other header files.
      Will be needed for the FHCI USB Host driver.
      Signed-off-by: default avatarAnton Vorontsov <avorontsov@ru.mvista.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      aa459e6a
    • Rodolfo Giometti's avatar
      usb host: Oxford OXU210HP HCD driver. · b92a78e5
      Rodolfo Giometti authored
      This driver implements the support for Oxford OXU210HP USB high-speed host,
      no peripheral nor OTG.
      Signed-off-by: default avatarRodolfo Giometti <giometti@linux.it>
      Cc: Kan Liu <kan.k.liu@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      b92a78e5
    • Vikram Pandita's avatar
      USB: Avoid 20ms delay in EHCI resume · 3a4e72cb
      Vikram Pandita authored
      For function ehci_bus_resume()
      - Added flag resume_needed
        No need to wait for 20ms if no port was suspended
      
      - Change mdelay to msleep
      
      - release and reacquire the spinlock around mdelay
      Signed-off-by: default avatarvikram pandita <vikram.pandita@ti.com>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      3a4e72cb
    • Arjan van de Ven's avatar
      USB: use pci_ioremap_bar() in drivers/usb · 8e8ce4b6
      Arjan van de Ven authored
      Use the newly introduced pci_ioremap_bar() function in drivers/usb.
      pci_ioremap_bar() just takes a pci device and a bar number, with the goal
      of making it really hard to get wrong, while also having a central place
      to stick sanity checks.
      Signed-off-by: default avatarArjan van de Ven <arjan@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      8e8ce4b6
    • roel kluin's avatar
      USB: clean up redundant tests on unsigned · e64a5219
      roel kluin authored
      temp, bytes and param->{length,sglen,vary} are unsigned so
      these tests do nothing.
      Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      e64a5219
    • Sergey Ovcharenko's avatar
      USB: storage: unusual_devs.h additions for Macpower MasterBox · 3b438e30
      Sergey Ovcharenko authored
      Jason Johnston reported these problems with his external USB hard drive:
      http://bugs.gentoo.org/show_bug.cgi?id=250789
      
      The number of reported sectors is off-by-one.
      
      /proc/bus/usb/devices:
      T:  Bus=01 Lev=02 Prnt=08 Port=00 Cnt=01 Dev#=  9 Spd=480 MxCh= 0
      D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=0dc4 ProdID=0073 Rev= 0.00
      S:  Manufacturer=Macpower Technology Co.LTD.
      S:  Product=USB 2.0 3.5" DEVICE
      S:  SerialNumber=03006C
      C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=100mA
      I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      Signed-off-by: default avatarSergey Ovcharenko <velegrin@mail.mipt.ru>
      Signed-off-by: default avatarPhil Dibowitz <phil@ipom.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      3b438e30
    • Paulo Afonso Graner Fessel's avatar
      USB: storage: recognizing and enabling Nokia 5200 cell phoes · b8d23491
      Paulo Afonso Graner Fessel authored
      This patch corrects the issue when one connects a Nokia 5200 cell
      phone in data storage mode. If one uses an unpatched unusual_devs.h,
      the following messages appear on /var/log/messages:
      
      Dec 12 01:03:24 alberich kernel: usb 4-2: new full speed USB device
      using uhci_hcd and address 3
      Dec 12 01:03:25 alberich kernel: usb 4-2: configuration #1 chosen from 1 choice
      Dec 12 01:03:25 alberich kernel: scsi10 : SCSI emulation for USB Mass
      Storage devices
      Dec 12 01:03:25 alberich kernel: usb 4-2: New USB device found,
      idVendor=0421, idProduct=04bd
      Dec 12 01:03:25 alberich kernel: usb 4-2: New USB device strings:
      Mfr=1, Product=2, SerialNumber=3
      Dec 12 01:03:25 alberich kernel: usb 4-2: Product: Nokia 5200
      Dec 12 01:03:25 alberich kernel: usb 4-2: Manufacturer: Nokia
      Dec 12 01:03:25 alberich kernel: usb 4-2: SerialNumber: 353930018354523
      Dec 12 01:03:25 alberich kernel: usbcore: registered new interface driver ub
      Dec 12 01:03:30 alberich kernel: scsi 10:0:0:0: Direct-Access
      Nokia    Nokia 5200       0000 PQ: 0 AN
      SI: 4
      Dec 12 01:03:30 alberich kernel: sd 10:0:0:0: [sdg] 3985409 512-byte
      hardware sectors (2041 MB)
      Dec 12 01:03:30 alberich kernel: sd 10:0:0:0: [sdg] Write Protect is off
      Dec 12 01:03:30 alberich kernel: sd 10:0:0:0: [sdg] Assuming drive
      cache: write through
      Dec 12 01:03:30 alberich kernel: sd 10:0:0:0: [sdg] 3985409 512-byte
      hardware sectors (2041 MB)
      Dec 12 01:03:30 alberich kernel: sd 10:0:0:0: [sdg] Write Protect is off
      Dec 12 01:03:30 alberich kernel: sd 10:0:0:0: [sdg] Assuming drive
      cache: write through
      Dec 12 01:03:30 alberich kernel:  sdg: sdg1
      Dec 12 01:03:30 alberich kernel: sd 10:0:0:0: [sdg] Attached SCSI removable disk
      Dec 12 01:03:30 alberich kernel: sd 10:0:0:0: Attached scsi generic sg9 type 0
      Dec 12 01:03:30 alberich kernel: sd 10:0:0:0: [sdg] Sense Key : No
      Sense [current]
      Dec 12 01:03:30 alberich kernel: sd 10:0:0:0: [sdg] Add. Sense: No
      additional sense information
      Dec 12 01:03:30 alberich kernel: sd 10:0:0:0: [sdg] Sense Key : No
      Sense [current]
      Dec 12 01:03:30 alberich kernel: sd 10:0:0:0: [sdg] Add. Sense: No
      additional sense information
      Dec 12 01:03:30 alberich kernel: sd 10:0:0:0: [sdg] Sense Key : No
      Sense [current]
      
      (...)
      
      The MicroSD card in the phone remains inaccessible and finally the
      cell phone turns itself off. The patch solves this problem and makes
      the cell phone fully accessible:
      
      [root@alberich kernel-linus-2.6.27.5-1mdv]# df -h
      Sist. Arq.            Tam   Usad Disp  Uso% Montado em
      /dev/sda6              31G  5,2G   26G  17% /
      /dev/sda1              92M   27M   61M  31% /boot
      /dev/mapper/homevg-homelv  240G  237G  3,5G  99% /home
      /dev/sda3              21G  7,9G   13G  40% /mnt/windows
      /dev/sdg1             2,0G  287M  1,7G  15% /media/disk <--------
      
      I've found necessary to use the FL_US_CAPACITY_FIX switch, as without
      it the cell phone is recognized but it went berserk when performing
      low-level functions on it (a fdisk -l /dev/uba for example).
      
      lsusb -v output follows:
      
      Bus 004 Device 004: ID 0421:04bd Nokia Mobile Phones
      Device Descriptor:
        bLength                18
        bDescriptorType         1
        bcdUSB               2.00
        bDeviceClass            0 (Defined at Interface level)
        bDeviceSubClass         0
        bDeviceProtocol         0
        bMaxPacketSize0        64
        idVendor           0x0421 Nokia Mobile Phones
        idProduct          0x04bd
        bcdDevice            6.03
        iManufacturer           1 Nokia
        iProduct                2 Nokia 5200
        iSerial                 3 353930018354523
        bNumConfigurations      1
        Configuration Descriptor:
          bLength                 9
          bDescriptorType         2
          wTotalLength           32
          bNumInterfaces          1
          bConfigurationValue     1
          iConfiguration          0
          bmAttributes         0xc0
            Self Powered
          MaxPower              100mA
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        0
            bAlternateSetting       0
            bNumEndpoints           2
            bInterfaceClass         8 Mass Storage
            bInterfaceSubClass      6 SCSI
            bInterfaceProtocol     80 Bulk (Zip)
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x81  EP 1 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0040  1x 64 bytes
              bInterval               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x01  EP 1 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0040  1x 64 bytes
              bInterval               0
      Device Status:     0x0001
        Self Powered
      Signed-off-by: default avatarPaulo Afonso Graner Fessel <pfessel@gmail.com>
      Signed-off-by: default avatarPhil Dibowitz <phil@ipom.com>
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      b8d23491
    • Oliver Neukum's avatar
      USB: storage: extend unusual range for 067b:3507 · b1636399
      Oliver Neukum authored
      This device has been released in a new revision which is still buggy.
      Signed-off-by: default avatarOliver Neukum <oneukum@suse.de>
      Signed-off-by: default avatarPhil Dibowitz <phil@ipom.com>
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      b1636399
    • Nguyen Anh Quynh's avatar
      USB: another unusual_devs entry for another bad Argosy storage device · e2673b28
      Nguyen Anh Quynh authored
      I have another Argosy USB storage device, which has the same problem
      with the Argosy USB storage device already fixed in 2.6.27.7. But this
      device has another product ID (840:84), so this patch adds a new entry
      into unusual_devs to fix the mount problem.
      
      I enclose here two patches: one against 2.6.27.8, and another against
      the latest linus-git tree.
      
      
      The information about the Argosy device is like below:
      
      #lsusb -v -d 840:84
      Bus 005 Device 005: ID 0840:0084 Argosy Research, Inc.
      Device Descriptor:
        bLength                18
        bDescriptorType         1
        bcdUSB               2.00
        bDeviceClass            0 (Defined at Interface level)
        bDeviceSubClass         0
        bDeviceProtocol         0
        bMaxPacketSize0        64
        idVendor           0x0840 Argosy Research, Inc.
        idProduct          0x0084
        bcdDevice            0.01
        iManufacturer           1 Generic
        iProduct                2 USB 2.0 Storage Device
        iSerial                 3 8400000000002549
        bNumConfigurations      1
        Configuration Descriptor:
          bLength                 9
          bDescriptorType         2
          wTotalLength           32
          bNumInterfaces          1
          bConfigurationValue     1
          iConfiguration          0
          bmAttributes         0xc0
            Self Powered
          MaxPower                2mA
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        0
            bAlternateSetting       0
            bNumEndpoints           2
            bInterfaceClass         8 Mass Storage
            bInterfaceSubClass      6 SCSI
            bInterfaceProtocol     80 Bulk (Zip)
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x01  EP 1 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x82  EP 2 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
      Device Qualifier (for other device speed):
        bLength                10
        bDescriptorType         6
        bcdUSB               2.00
        bDeviceClass            0 (Defined at Interface level)
        bDeviceSubClass         0
        bDeviceProtocol         0
        bMaxPacketSize0        64
        bNumConfigurations      1
      Device Status:     0x0000
        (Bus Powered)
      
      Before the patch, dmesg returns a lot of information like below (my
      dmesg is overflown):
      ....
      [  138.833390] sd 7:0:0:0: [sdb] Add. Sense: No additional sense information
      [  138.877631] sd 7:0:0:0: [sdb] Sense Key : No Sense [current]
      [  138.877643] sd 7:0:0:0: [sdb] Add. Sense: No additional sense information
      [  138.921906] sd 7:0:0:0: [sdb] Sense Key : No Sense [current]
      [  138.921923] sd 7:0:0:0: [sdb] Add. Sense: No additional sense information
      ....
      
      After the fix, dmesg returns below information:
      ....
      usb 5-1: new high speed USB device using ehci_hcd and address 5
      usb 5-1: configuration #1 chosen from 1 choice
      scsi7 : SCSI emulation for USB Mass Storage devices
      usb-storage: device found at 5
      usb-storage: waiting for device to settle before scanning
      usb-storage: device scan complete
      scsi 7:0:0:0: Direct-Access     HTS54808 0M9AT00          MG4O PQ: 0 ANSI: 0
      sd 7:0:0:0: [sdb] 156301488 512-byte hardware sectors (80026 MB)
      sd 7:0:0:0: [sdb] Write Protect is off
      sd 7:0:0:0: [sdb] Mode Sense: 03 00 00 00
      sd 7:0:0:0: [sdb] Assuming drive cache: write through
      sd 7:0:0:0: [sdb] 156301488 512-byte hardware sectors (80026 MB)
      sd 7:0:0:0: [sdb] Write Protect is off
      sd 7:0:0:0: [sdb] Mode Sense: 03 00 00 00
      sd 7:0:0:0: [sdb] Assuming drive cache: write through
       sdb: sdb1
      sd 7:0:0:0: [sdb] Attached SCSI disk
      sd 7:0:0:0: Attached scsi generic sg1 type 0
      kjournald starting.  Commit interval 5 seconds
      EXT3 FS on sdb1, internal journal
      EXT3-fs: recovery complete.
      EXT3-fs: mounted filesystem with ordered data mode.
      
      Cc: Kuniyasu Suzaki <k.suzaki@aist.go.jp>
      Signed-off-by: default avatarNguyen Anh Quynh <aquynh@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      e2673b28
    • Daniel Drake's avatar
      USB: unusual_devs.h additions for Pentax K10D · e3f47f89
      Daniel Drake authored
      Jaak Ristioja reported problems with his Pentax K10D camera:
      https://bugs.gentoo.org/show_bug.cgi?id=250406
      
      /proc/bus/usb/devices:
      T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=12  MxCh= 0
      D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=0a17 ProdID=006e Rev= 1.00
      S:  Manufacturer=PENTAX Corporation
      S:  Product=K10D
      C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=  2mA
      I:* If#= 0 Alt= 0 #EPs= 3 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
      E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
      E:  Ad=83(I) Atr=03(Int.) MxPS=  64 Ivl=100ms
      The number of reported sectors is off-by-one.
      Signed-off-by: default avatarDaniel Drake <dsd@gentoo.org>
      Cc: Kadianakis George <desnacked@gmail.com>
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarPhil Dibowitz <phil@ipom.com>
      e3f47f89
    • Linus Torvalds's avatar
      Fix up 64-bit byte swaps for most 32-bit architectures · ede6f5ae
      Linus Torvalds authored
      The __SWAB_64_THRU_32__ case of a 64-bit byte swap was depending on the
      no-longer-existant ___swab32() method (three underscores).  We got rid
      of some of the worst indirection and complexity, and now it should just
      use the 32-bit swab function that was defined right above it.
      Reported-and-tested-by: default avatarNicolas Pitre <nico@cam.org>
      Reported-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Harvey Harrison <harvey.harrison@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ede6f5ae