All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] davinci: spi: replace existing SPI driver
@ 2010-06-14 15:54 Brian Niebuhr
       [not found] ` <1276530901-4413-1-git-send-email-bniebuhr-JaPwekKOx1yaMJb+Lgu22Q@public.gmane.org>
  0 siblings, 1 reply; 16+ messages in thread
From: Brian Niebuhr @ 2010-06-14 15:54 UTC (permalink / raw)
  To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

NOTE

This patch requires the EDMA patch at:

http://linux.davincidsp.com/pipermail/davinci-linux-open-source/2010-March/018022.html

which has since been reverted out of the davinci kernel.


INTRODUCTION

I have been working on a custom OMAP-L138 board that has multiple spi
devices (seven) on one controller.  These devices have a wide range of
transfer parameters (speed, phase, polarity, internal and gpio chip
selects).  During my testing I found multiple errors in the davinci spi
driver as a result of this complex setup.  The primary issues were:

1. There is a race condition due to the SPIBUF read busy-waits for slow
        devices
2. I found some DMA transfer length errors under some conditions
3. The chip select code caused extra byte transfers (with no chip
        select active) due to writes to SPIDAT1
4. Several issues prevented using multiple SPI devices, especially
        the DMA code, as disucussed previously on the davinci list.

The fixes to these problems were not simple.  I ended up making fairly
large changes to the driver, and those changes are contained in these
patches.  The full list of changes follows.

CHANGE LIST

1. davinci_spi_chipelect() now performs both activation and deactivation
        of chip selects.  This lets spi_bitbang fully control chip
        select activation, as intended by the SPI API.
2. Chip select activation does not cause extra writes to the SPI bus
3. Chip select activation does not use SPIDEF for control.  This change
        will also allow for implementation of inverted (active high)
        chip selects in the future.
4. Added back gpio chip select capability from the old driver
5. Fixed prescale calculation for non-integer fractions of spi clock
6. Allow specification of SPI transfer parameters on a per-device
        (instead of per-controller) basis
7. Allow specification of polled, interrupt-based, or DMA operation on
        a per-device basis
8. Allow DMA with when more than one device is connected
9. Combined pio and dma txrx_bufs functions into one since they share
        large parts of their functionality, and to simplify item (8).
10. Use only SPIFMT0 to allow more than 4 devices

TESTING

I have tested the driver using a custom SPI stress test on my
OMAP-L138-based board with three devices connected.  I have tested
configurations with all three devices polled, all three interrupt-based,
all three DMA, and a mixture.

I have compiled with the davinci_all_defconfig, but I don't have EVMs
for the other davinci platforms to test with.

SUMMARY

This patch solves a lot of issues that should save a lot of people time
down the road.  Since I posted the original patch I have had at least 5
people contact me personally to get help applying the patch because SPI
was broken on their boards.  I have heard back from at least 2 that the
original patch worked for them.  

I appreciate any testing and feedback that others can provide.

Brian Niebuhr (3):
  davinci: spi: remove old Davinci SPI driver
  davinci: spi: add replacement SPI driver
  davinci: spi: modify platform data for updated SPI driver

 arch/arm/mach-davinci/board-dm355-evm.c     |   10 +
 arch/arm/mach-davinci/board-dm355-leopard.c |   10 +
 arch/arm/mach-davinci/board-dm365-evm.c     |   10 +
 arch/arm/mach-davinci/dm355.c               |    6 -
 arch/arm/mach-davinci/dm365.c               |    6 -
 arch/arm/mach-davinci/include/mach/spi.h    |   41 +-
 drivers/spi/davinci_spi.c                   | 1196 ++++++++++-----------------
 drivers/spi/davinci_spi.h                   |  186 +++++
 8 files changed, 681 insertions(+), 784 deletions(-)
 create mode 100644 drivers/spi/davinci_spi.h


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo

^ permalink raw reply	[flat|nested] 16+ messages in thread
[parent not found: <1275923348-8533-1-git-send-email-bniebuhr@efjohnson.com>]

end of thread, other threads:[~2010-06-29 22:43 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-14 15:54 [PATCH 0/3] davinci: spi: replace existing SPI driver Brian Niebuhr
     [not found] ` <1276530901-4413-1-git-send-email-bniebuhr-JaPwekKOx1yaMJb+Lgu22Q@public.gmane.org>
2010-06-14 15:54   ` [PATCH 1/3] davinci: spi: remove old Davinci " Brian Niebuhr
     [not found]     ` <1276530901-4413-2-git-send-email-bniebuhr-JaPwekKOx1yaMJb+Lgu22Q@public.gmane.org>
2010-06-14 15:55       ` [PATCH 2/3] davinci: spi: add replacement " Brian Niebuhr
     [not found]         ` <1276530901-4413-3-git-send-email-bniebuhr-JaPwekKOx1yaMJb+Lgu22Q@public.gmane.org>
2010-06-14 15:55           ` [PATCH 3/3] davinci: spi: modify platform data for updated " Brian Niebuhr
2010-06-29 22:43           ` [PATCH 2/3] davinci: spi: add replacement " Grant Likely
2010-06-27  6:03   ` [spi-devel-general] [PATCH 0/3] davinci: spi: replace existing " Grant Likely
     [not found]     ` <AANLkTilTTgTchq_w0CktXokOxGX32lmRyPqrTyFI9LCF-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-06-27  8:25       ` Tejun Heo
2010-06-28 17:57       ` [spi-devel-general] " Nori, Sekhar
     [not found]         ` <B85A65D85D7EB246BE421B3FB0FBB59301E77EDA9C-/tLxBxkBPtCIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2010-06-28 18:27           ` Grant Likely
     [not found]             ` <AANLkTikSU105SxoX6m0u0DhDoGQ0047eSGurpivfn74s-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-06-29  8:01               ` Grant Likely
     [not found]                 ` <AANLkTilT2mZsbgt3fyjEpFheI6U2qNpyW-2ruC7tcvkH-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-06-29 21:49                   ` Grant Likely
     [not found] <1275923348-8533-1-git-send-email-bniebuhr@efjohnson.com>
     [not found] ` <004201cb0878$eaff2ac0$c0fd8040$@raj@ti.com>
2010-06-14 19:13   ` Brian Niebuhr
     [not found]     ` <BA34378D1528D04CB3C865B8BAB2472B024CC7-mqUZVEcnZosHtCCSzi1I5PfQPhDVBs+grNQQ6b5fDX0@public.gmane.org>
2010-06-15 11:02       ` Sudhakar Rajashekhara
2010-06-15 11:02       ` Sudhakar Rajashekhara
     [not found] ` <B85A65D85D7EB246BE421B3FB0FBB59301E744A8C4@dbde02.ent.ti.com>
2010-06-14 19:15   ` Brian Niebuhr
     [not found]     ` <BA34378D1528D04CB3C865B8BAB2472B024CCA-mqUZVEcnZosHtCCSzi1I5PfQPhDVBs+grNQQ6b5fDX0@public.gmane.org>
2010-06-16 19:34       ` Grant Likely

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.