14 Sep, 2008

2 commits

  • Fixes two DMA bugs in the pxa2xx_spi driver. The first bug is in all
    versions of this driver; the second was introduced in the 2.6.20 kernel,
    and prevents using the driver with chips like m25p16 flash (which can
    issue large DMA reads).

    1. Zero length transfers are permitted for use to insert timing,
    but pxa2xx_spi.c will fail if this is requested in DMA mode.
    Fixed by using programmed I/O (PIO) mode for such transfers.

    2. Transfers larger than 8191 are not permitted in DMA mode. A
    test for length rejects all large transfers regardless of DMA
    or PIO mode. Worked around by rejecting only large transfers
    with DMA mapped buffers, and forcing all other transfers
    larger than 8191 to use PIO mode. A rate limited warning is
    issued for DMA transfers forced to PIO mode.

    This patch should apply to all kernels back to and including 2.6.20;
    it was test patched against 2.6.20. An additional patch would be
    required for older kernels, but those versions are very buggy anyway.

    Signed-off-by: Ned Forrester
    Cc: Vernon Sauder
    Cc: Eric Miao
    Signed-off-by: David Brownell
    Cc: [2.6.25.x, 2.6.26.x]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ned Forrester
     
  • Fixes several chipselect bugs in the pxa2xx_spi driver. These bugs are in
    all versions of this driver and prevent using it with chips like m25p16
    flash.

    1. The spi_transfer.cs_change flag is handled too early:
    before spi_transfer.delay_usecs applies, thus making the
    delay ineffective at holding chip select.

    2. spi_transfer.delay_usecs is ignored on the last transfer
    of a message (likewise not holding chipselect long enough).

    3. If spi_transfer.cs_change is set on the last transfer, the
    chip select is always disabled, instead of the intended
    meaning: optionally holding chip select enabled for the
    next message.

    Those first three bugs were fixed with a relocation of delays
    and chip select de-assertions.

    4. If a message has the cs_change flag set on the last transfer,
    and had the chip select stayed enabled as requested (see 3,
    above), it would not have been disabled if the next message is
    for a different chip. Fixed by dropping chip select regardless
    of cs_change at end of a message, if there is no next message
    or if the next message is for a different chip.

    This patch should apply to all kernels back to and including 2.6.20;
    it was test patched against 2.6.20. An additional patch would be
    required for older kernels, but those versions are very buggy anyway.

    Signed-off-by: Ned Forrester
    Cc: Vernon Sauder
    Cc: Eric Miao
    Signed-off-by: David Brownell
    Cc: [2.6.25.x, 2.6.26.x]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ned Forrester
     

07 Aug, 2008

2 commits


27 Jul, 2008

1 commit

  • Add per-device dma_mapping_ops support for CONFIG_X86_64 as POWER
    architecture does:

    This enables us to cleanly fix the Calgary IOMMU issue that some devices
    are not behind the IOMMU (http://lkml.org/lkml/2008/5/8/423).

    I think that per-device dma_mapping_ops support would be also helpful for
    KVM people to support PCI passthrough but Andi thinks that this makes it
    difficult to support the PCI passthrough (see the above thread). So I
    CC'ed this to KVM camp. Comments are appreciated.

    A pointer to dma_mapping_ops to struct dev_archdata is added. If the
    pointer is non NULL, DMA operations in asm/dma-mapping.h use it. If it's
    NULL, the system-wide dma_ops pointer is used as before.

    If it's useful for KVM people, I plan to implement a mechanism to register
    a hook called when a new pci (or dma capable) device is created (it works
    with hot plugging). It enables IOMMUs to set up an appropriate
    dma_mapping_ops per device.

    The major obstacle is that dma_mapping_error doesn't take a pointer to the
    device unlike other DMA operations. So x86 can't have dma_mapping_ops per
    device. Note all the POWER IOMMUs use the same dma_mapping_error function
    so this is not a problem for POWER but x86 IOMMUs use different
    dma_mapping_error functions.

    The first patch adds the device argument to dma_mapping_error. The patch
    is trivial but large since it touches lots of drivers and dma-mapping.h in
    all the architecture.

    This patch:

    dma_mapping_error() doesn't take a pointer to the device unlike other DMA
    operations. So we can't have dma_mapping_ops per device.

    Note that POWER already has dma_mapping_ops per device but all the POWER
    IOMMUs use the same dma_mapping_error function. x86 IOMMUs use device
    argument.

    [akpm@linux-foundation.org: fix sge]
    [akpm@linux-foundation.org: fix svc_rdma]
    [akpm@linux-foundation.org: build fix]
    [akpm@linux-foundation.org: fix bnx2x]
    [akpm@linux-foundation.org: fix s2io]
    [akpm@linux-foundation.org: fix pasemi_mac]
    [akpm@linux-foundation.org: fix sdhci]
    [akpm@linux-foundation.org: build fix]
    [akpm@linux-foundation.org: fix sparc]
    [akpm@linux-foundation.org: fix ibmvscsi]
    Signed-off-by: FUJITA Tomonori
    Cc: Muli Ben-Yehuda
    Cc: Andi Kleen
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: Avi Kivity
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    FUJITA Tomonori
     

13 May, 2008

1 commit

  • There is a typo in pxa2xx_spi.c, comment says "Enable the SSP clock", code
    says: clk_disable ... so after resume, the SSP is dead.

    Signed-off-by: David Brownell
    Cc: Ned Forrester
    Cc: Stephen Street
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric BENARD
     

28 Apr, 2008

1 commit

  • Various cleanups to pxa2xx_spi suggested by "sparse": make sure that
    register addresess are "void __iomem *", and make a few functions properly
    static.

    Signed-off-by: David Brownell
    Cc: Ned Forrester
    Cc: Stephen Street
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Brownell
     

11 Apr, 2008

1 commit

  • Since 43cc71eed1250755986da4c0f9898f9a635cb3bf, the platform modalias is
    prefixed with "platform:". Add MODULE_ALIAS() to the hotpluggable SPI
    platform drivers, to allow module auto loading.

    [dbrownell@users.sourceforge.net: more drivers: registration fixes]
    Signed-off-by: Kay Sievers
    Signed-off-by: David Brownell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kay Sievers
     

24 Feb, 2008

1 commit

  • Fixes a sequencing bug in spi driver pxa2xx_spi.c in which the chip select
    for a transfer may be asserted before the clock polarity is set on the
    interface. As a result of this bug, the clock signal may have the wrong
    polarity at transfer start, so it may need to make an extra half transition
    before the intended clock/data signals begin. (This probably means all
    transfers are one bit out of sequence.)

    This only occurs on the first transfer following a change in clock polarity
    in systems using more than one more than one such polarity. The fix
    assures that the clock mode is properly set before asserting chip select.

    This bug was introduced in a patch merged on 2006/12/10, kernel 2.6.20.
    The patch defines an additional bit in: include/asm-arm/arch-pxa/regs-ssp.h
    for 2.6.25 and newer kernels but this addition must be made in:
    include/asm-arm/arch-pxa/pxa-regs.h for kernels between 2.6.20 and 2.6.24,
    inclusive

    Signed-off-by: Ned Forrester
    Signed-off-by: David Brownell
    Cc: Russell King
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ned Forrester
     

07 Feb, 2008

1 commit

  • Remove some more references to dev->power.power_state. That field is overdue
    for removal, but we can't do that while it's still referenced in the kernel.
    The only reason to update it was to make the /sys/devices/.../power/state
    files (now removed) work better.

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

    David Brownell
     

26 Jan, 2008

2 commits


11 Dec, 2007

1 commit


17 Oct, 2007

3 commits

  • 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
     
  • Shrink the runtime footprint of various SPI drivers:

    - Move the probe() routine into the init section where practical,
    using platform_driver_probe() to make that safe. This often saves
    around 1KB. Using platform_driver_probe() can also be a correctness
    fix, if the probe routine is already marked __init but the driver
    struct keeps a dangling pointer to it after init section removal.

    - Likewise move remove() routines into the exit sections.

    These changes would be inappropriate iff the platform devices were
    actually hotpluggable (e.g. they're found on optional addon cards,
    or in an FPGA that's dynamically reprogrammed). In these cases,
    that's not the situation; it's an SOC controller and the only device
    is initialized before these drivers.

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

    David Brownell
     
  • This patch cleans up duplicate includes in
    drivers/spi/

    Signed-off-by: Jesper Juhl
    Acked-by: David Brownell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jesper Juhl
     

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
     

13 Feb, 2007

1 commit

  • 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
     

08 Feb, 2007

2 commits


27 Jan, 2007

1 commit

  • Currently the spi mode can be set to the wrong mode if you are switching
    from any mode other than mode 0. This is because the mode is set using a
    bitwise or on uncleared bits. The following patch clears the mode bits
    before setting the new mode. I've also modified it to use the appropriate
    defines from pxa-regs.h for readability.

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

    Justin Clacherty
     

11 Dec, 2006

1 commit

  • Stabilize PIO mode transfers against a range of word sizes and FIFO
    thresholds and fixes word size setup/override issues.

    1) 16 and 32 bit DMA/PIO transfers broken due to timing differences.
    2) Potential for bad transfer counts due to transfer size assumptions.
    3) Setup function broken is multiple ways.
    4) Per transfer bit_per_word changes break DMA setup in pump_tranfers.
    5) False positive timeout are not errors.
    6) Changes in pxa2xx_spi_chip not effective in calls to setup.
    7) Timeout scaling wrong for PXA255 NSSP.
    8) Driver leaks memory while busy during unloading.

    Known issues:

    SPI_CS_HIGH and SPI_LSB_FIRST settings in struct spi_device are not handled.

    Testing:

    This patch has been test against the "random length, random bits/word,
    random data (verified on loopback) and stepped baud rate by octaves
    (3.6MHz to 115kHz)" test. It is robust in PIO mode, using any
    combination of tx and rx thresholds, and also in DMA mode (which
    internally computes the thresholds).

    Much thanks to Ned Forrester for exhaustive reviews, fixes and testing.
    The driver is substantially better for his efforts.

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

    Stephen Street
     

06 Dec, 2006

1 commit


07 Oct, 2006

1 commit

  • - Eliminate casts to/from void*

    - Eliminate checks for conditions that never occur. These typically
    fall into two classes:

    1) Checking for 'dev_id == NULL', then it is never called with
    NULL as an argument.

    2) Checking for invalid irq number, when the only caller (the
    system) guarantees the irq handler is called with the proper
    'irq' number argument.

    Signed-off-by: Jeff Garzik

    Jeff Garzik
     

05 Oct, 2006

1 commit

  • Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
    of passing regs around manually through all ~1800 interrupt handlers in the
    Linux kernel.

    The regs pointer is used in few places, but it potentially costs both stack
    space and code to pass it around. On the FRV arch, removing the regs parameter
    from all the genirq function results in a 20% speed up of the IRQ exit path
    (ie: from leaving timer_interrupt() to leaving do_IRQ()).

    Where appropriate, an arch may override the generic storage facility and do
    something different with the variable. On FRV, for instance, the address is
    maintained in GR28 at all times inside the kernel as part of general exception
    handling.

    Having looked over the code, it appears that the parameter may be handed down
    through up to twenty or so layers of functions. Consider a USB character
    device attached to a USB hub, attached to a USB controller that posts its
    interrupts through a cascaded auxiliary interrupt controller. A character
    device driver may want to pass regs to the sysrq handler through the input
    layer which adds another few layers of parameter passing.

    I've build this code with allyesconfig for x86_64 and i386. I've runtested the
    main part of the code on FRV and i386, though I can't test most of the drivers.
    I've also done partial conversion for powerpc and MIPS - these at least compile
    with minimal configurations.

    This will affect all archs. Mostly the changes should be relatively easy.
    Take do_IRQ(), store the regs pointer at the beginning, saving the old one:

    struct pt_regs *old_regs = set_irq_regs(regs);

    And put the old one back at the end:

    set_irq_regs(old_regs);

    Don't pass regs through to generic_handle_irq() or __do_IRQ().

    In timer_interrupt(), this sort of change will be necessary:

    - update_process_times(user_mode(regs));
    - profile_tick(CPU_PROFILING, regs);
    + update_process_times(user_mode(get_irq_regs()));
    + profile_tick(CPU_PROFILING);

    I'd like to move update_process_times()'s use of get_irq_regs() into itself,
    except that i386, alone of the archs, uses something other than user_mode().

    Some notes on the interrupt handling in the drivers:

    (*) input_dev() is now gone entirely. The regs pointer is no longer stored in
    the input_dev struct.

    (*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
    something different depending on whether it's been supplied with a regs
    pointer or not.

    (*) Various IRQ handler function pointers have been moved to type
    irq_handler_t.

    Signed-Off-By: David Howells
    (cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)

    David Howells
     

22 May, 2006

1 commit

  • Fix some outstanding issues with the pxa2xx_spi driver when running on a
    PXA270:

    - Wrong timeout calculation in the setup function due to different
    peripheral clock rates in the PXAxxx family.

    - Bad handling of SSSR_TFS interrupts in interrupt_transfer function.

    - Added locking to interface between the pump_messages workqueue and the
    pump_transfers tasklet.

    Much thanks to Juergen Beisert for the extensive testing on the PXA270.

    Signed-off-by: Stephen Street
    Signed-off-by: David Brownell
    Cc: Russell King
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stephen Street
     

17 May, 2006

2 commits

  • Fix two outstanding issues with the pxa2xx_spi driver:

    1) Bad cast in the function u32_writer. Thanks to Henrik Bechmann
    2) Adds support for per transfer changes to speed and bits per word

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

    Stephen Street
     
  • This driver turns a PXA2xx synchronous serial port (SSP) into a SPI master
    controller (see Documentation/spi/spi_summary). The driver has the following
    features:

    - Support for any PXA2xx SSP
    - SSP PIO and SSP DMA data transfers.
    - External and Internal (SSPFRM) chip selects.
    - Per slave device (chip) configuration.
    - Full suspend, freeze, resume support.

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

    Stephen Street