01 Jul, 2009

1 commit

  • Bugfix to spi_bitbang infrastructure: make sure to always set transfer
    parameters on the first pass through the message's per-transfer loop.
    This can matter with drivers that replace the per-word or per-buffer
    transfer primitives, on busses with multiple SPI devices.

    Previously, this could have started messages using the settings left after
    previous messages. The problem was observed when a high speed chip
    (m25p80 type flash) was running very slowly because a low speed device
    (avr8 microcontroller) had previously used the bus. Similar faults could
    have driven the low speed device too fast, or used an unexpected word
    size.

    Acked-by: Steven A. Falco
    Signed-off-by: David Brownell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Brownell
     

19 Jun, 2009

2 commits

  • Move some common spi_setup() error checks into the SPI framework from the
    spi_master controller drivers:

    - Add a new "mode_bits" field to spi_master

    - Use that in spi_setup to validate the spi->mode value being
    requested. Setting this new field is now mandatory for any
    controller supporting more than vanilla SPI_MODE_0.

    - Update all spi_master drivers to:

    * Initialize that field
    * Remove current spi_setup() checks using that value.

    This is a net minor code shrink.

    Signed-off-by: David Brownell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Brownell
     
  • Start moving some spi_setup() functionality into the SPI core from the
    various spi_master controller drivers:

    - Make that function stop being an inline;

    - Move two common idioms from drivers into that new function:
    * Default bits_per_word to 8 if that field isn't set
    * Issue a standardized dev_dbg() message

    This is a net minor source code shrink, and supports enhancments found in
    some follow-up patches.

    Signed-off-by: David Brownell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Brownell
     

07 Jan, 2009

1 commit


28 Apr, 2008

1 commit


14 Mar, 2008

1 commit

  • SPI controller drivers return number of bytes actually transfered from
    bitbang->txrx_bufs() method. This updates handling of short transfers (where
    the transfer size is less than requested):

    - Even zero byte short transfers should report errors;
    - Include short transfers in the total of transferred bytes;
    - Use EREMOTEIO (like USB) not EMSGSIZE to report short transfers

    Short transfers don't normally mean invalid message sizes, but if the
    underlying controller driver needs to use EMSGSIZE it can still do so.

    [db: fix two more minor issues]
    Signed-off-by: Jan Nikitenko
    Signed-off-by: David Brownell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Nikitenko
     

09 Jan, 2008

1 commit


17 Oct, 2007

1 commit

  • Make the SPI framework and drivers stop using class_device. Update docs
    accordingly ... highlighting just which sysfs paths should be
    "safe"/stable.

    Signed-off-by: Tony Jones
    Signed-off-by: David Brownell
    Cc: Greg KH
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tony Jones
     

18 Jul, 2007

1 commit

  • Minor SPI controller driver updates: make the setup() methods reject
    spi->mode bits they don't support, by masking aginst the inverse of bits
    they *do* support. This insures against misbehavior later when new mode
    bits get added.

    Most controllers can't support SPI_LSB_FIRST; more handle SPI_CS_HIGH.
    Support for all four SPI clock/transfer modes is routine.

    Signed-off-by: David Brownell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Brownell
     

17 Mar, 2007

1 commit

  • Fix a bug in the cleanup of an spi_bitbang bus.

    The workqueue associated with the bus was destroyed before the call to
    spi_unregister_master. That meant that spi devices on that bus would be
    unable to do IO in their remove method. The shutdown flag should have been
    able to prevent a segfault, but was never getting set. By waiting to
    destroy the workqueue until after the master is unregistered, devices are
    able to do IO in their remove methods. An added benefit is that neither
    the shutdown flag nor a wait for the queue of messages to empty is needed.

    Signed-off-by: Chris Lesiak
    Signed-off-by: David Brownell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Chris Lesiak
     

13 Feb, 2007

2 commits

  • I'd like to assign NULL to kfree()d members of a structure. I can't do
    that without ugly casting (see the PXA patch) when the structure pointed to
    is const-qualified. I don't really see a reason why the cleanup method
    isn't allowed to alter the object it should clean up. :-)

    No, I didn't test the PXA patch, but I verified that the NULL-assignment
    doesn't stop me from doing rmmod/insmodding my own spi_bitbang-based
    driver.

    Signed-off-by: Hans-Peter Nilsson
    Signed-off-by: David Brownell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Hans-Peter Nilsson
     
  • A small bug-fix for spi_bitbang: it must always call the setup_transfer
    function via the overridable pointer, not assume that its
    spi_bitbang_setup_transfer is sufficient. Otherwise, if all options in the
    transfers are default (0), the overrided function will never be called.

    Granted, the function replacing it must call spi_bitbang_setup_transfer,
    but it might also have other important things to do, even if the second
    argument (the spi_transfer) is NULL. Tested together with the other
    patches on the spi_crisv32_sser and spi_crisv32_gpio drivers (not yet in
    the kernel, will IIUC be submitted as part of the usual
    arch-maintainer-pushes).

    Signed-off-by: Hans-Peter Nilsson
    Signed-off-by: David Brownell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Hans-Peter Nilsson
     

08 Feb, 2007

2 commits


08 Dec, 2006

1 commit


22 Nov, 2006

1 commit


01 Jul, 2006

1 commit


17 May, 2006

4 commits

  • This fixes two problems triggered by the MMC stack updating clocks:

    - SPI masters driver should accept a max clock speed of zero; that's one
    convention for marking idle devices. (Presumably that helps controllers
    that don't autogate clocks to "off" when not in use.)

    - There are more than 1000 nanoseconds per millisecond; setting the clock
    down to 125 KHz now works properly.

    Showing once again that Zero (http://en.wikipedia.org/wiki/Zero) is still
    an inexhaustible number of bugs.

    Signed-off-by: David Brownell
    Signed-off-by: Greg Kroah-Hartman

    David Brownell
     
  • Add spi_device hook for LSB-first word encoding, and update all the
    (in-tree) controller drivers to reject such devices. Eventually,
    some controller drivers will be updated to support lsb-first encodings
    on the wire; no current drivers need this.

    Signed-off-by: David Brownell
    Signed-off-by: Greg Kroah-Hartman

    David Brownell
     
  • Renamed bitbang_transfer_setup to follow convention of other exported symbols
    from spi-bitbang. Exported spi_bitbang_setup_transfer to allow users of
    spi-bitbang to use the function in their own setup_transfer.

    Signed-off-by: Kumar Gala
    Cc: David Brownell
    Signed-off-by: Greg Kroah-Hartman

    Kumar Gala
     
  • Some protocols (like one for some bitmap displays) require different clock
    speed or word size settings for each transfer in an SPI message. This adds
    those parameters to struct spi_transfer. They are to be used when they are
    nonzero; otherwise the defaults from spi_device are to be used.

    The patch also adds a setup_transfer callback to spi_bitbang, uses it for
    messages that use those overrides, and implements it so that the pure
    bitbanging code can help resolve any questions about how it should work.

    Signed-off-by: Imre Deak
    Signed-off-by: David Brownell
    Signed-off-by: Greg Kroah-Hartman

    Imre Deak
     

14 Jan, 2006

2 commits

  • This makes the SPI core and its users access transfers in the SPI message
    structure as linked list not as an array, as discussed on LKML.

    From: David Brownell

    Updates including doc, bugfixes to the list code, add
    spi_message_add_tail(). Plus, initialize things _before_ grabbing the
    locks in some cases (in case it grows more expensive). This also merges
    some bitbang updates of mine that didn't yet make it into the mm tree.

    Signed-off-by: Vitaly Wool
    Signed-off-by: Dmitry Pervushin
    Signed-off-by: David Brownell
    Signed-off-by: Andrew Morton
    Signed-off-by: Greg Kroah-Hartman

    Vitaly Wool
     
  • This adds a bitbanging spi master, hooking up to board/adapter-specific glue
    code which knows how to set and read the signals (gpios etc).

    This code kicks in after the glue code creates a platform_device with the
    right platform_data. That data includes I/O loops, which will usually
    come from expanding an inline function (provided in the header). One goal
    is that the I/O loops should be easily optimized down to a few GPIO register
    accesses, in common cases, for speed and minimized overhead.

    This understands all the currently defined protocol tweaking options in the
    SPI framework, and might eventually serve as as reference implementation.

    - different word sizes (1..32 bits)
    - differing clock rates
    - SPI modes differing by CPOL (affecting chip select and I/O loops)
    - SPI modes differing by CPHA (affecting I/O loops)
    - delays (usecs) after transfers
    - temporarily deselecting chips in mid-transfer

    A lot of hardware could work with this framework, though common types of
    controller can't reach peak performance without switching to a driver
    structure that supports pipelining of transfers (e.g. DMA queues) and maybe
    controllers (e.g. IRQ driven).

    Signed-off-by: David Brownell
    Signed-off-by: Andrew Morton
    Signed-off-by: Greg Kroah-Hartman

    David Brownell