[PATCH 06/49] spi: davinci: set chip-select mode in SPIDEF only once

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com Quit writing the same constant value determining the chip-select mode when no transmissions are in progress in davinci_spi_chipelect(). Instead just setup the SPIDEF register once during probe. Signed-off-by: Brian Niebuhr bnieb...@efjohnson.com

[PATCH 22/49] spi: davinci: remove unnecessary 'count' variable in driver private data

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com The variable count in DaVinci SPI driver's private data is largely unused and its minor use can easily be eliminated. Remove the variable. Signed-off-by: Brian Niebuhr bnieb...@efjohnson.com Tested-By: Michael Williamson

[PATCH 46/49] spi: davinci: add EF Johnson Technologies copyright

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com Add copyright for EF Johnson Technologies since the driver has been majorly overhauled by Brian. Signed-off-by: Brian Niebuhr bnieb...@efjohnson.com Signed-off-by: Sekhar Nori nsek...@ti.com --- drivers/spi/davinci_spi.c |1 + 1 files changed, 1

[PATCH 30/49] spi: davinci: remove unnecessary call to davinci_spi_setup_transfer()

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com Remove unnecessary call to davinci_spi_setup_transfer() at the end of davinci_spi_setup(). davinci_spi_setup_transfer() is registered as the setup_transfer callback for the bitbang layer and is called independently by the bitbang layer to setup the

[PATCH 19/49] spi: davinci: simplify calculation of edma acount value

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com The EDMA acount (called data_type in davinci_spi_bufs_dma()) is simply the bytes_per_word obtained in the transfer setup function. The current code calculates the acount value from bytes_per_word in a convoluted manner. Simplify the code. Signed-off-by:

[PATCH 29/49] spi: davinci: remove unnecessary function davinci_spi_bufs_prep()

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com The function davinci_spi_bufs_prep() is doing stuff that davinci_spi_setup() is doing. Eliminate it and move the work to davinci_spi_setup() Signed-off-by: Brian Niebuhr bnieb...@efjohnson.com Tested-By: Michael Williamson

[PATCH 41/49] spi: davinci: let DMA operation be specified on per-device basis

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com Let DMA operation be specified on a per-device basis instead of selecting it once during probe. A side effect of this is the need to combine the PIO and DMA buffer txrx_bufs routine. This is good since they anyway share some common functionality.

[PATCH 36/49] spi: davinci: fix DMA event generation stoppage

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com Do not stop SPI DMA event generation in either transmit or receive DMA event call back because the single setting affects both transmit and receive event generation. Depending on the order in which the callbacks happen, transmit or receive events can

[PATCH 25/49] spi: davinci: remove non-useful interrupt mode support

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com The interrupt mode support as it stands is another version of poll mode. Even when interrupt mode is selected, the code tight loops on interrupt status register, rendering it totally useless. A completion variable is initialized, but never used. Remove

[PATCH 40/49] spi: davinci: remove usage of additional completion variables for DMA

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com The DMA code does not use the existing completion variable 'done' which is being used for interrupt mode transfers. Instead it uses two different completion variables specific to DMA mode transfers. Eliminate the usage of new completion variables for

[PATCH 10/49] spi: davinci: simplify prescalar calculation

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com Simplify pre-scalar calculation and move it into a seprate function. Refuse to correct invalid pre-scalar values silently as this might lead to unexpected bugs and lower performance. Instead an error will force users to dig into the root-cause of the

[PATCH 13/49] spi: davinci: consolidate setup of SPIFMTn in one function

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com Consolidate the setup of SPIFMTn register under davinci_spi_setup_transfer() simplifying the code and avoiding unnecessary reads and writes to the register. The two inline functions {set|clear}_fmt_bits() can be eliminated because of this.

[PATCH 37/49] spi: davinci: do not allocate DMA channels during SPI device setup

2010-11-17 Thread Sekhar Nori
Do not allocate (and de-allocate) SPI DMA channels during setup (and cleanup) for each SPI device. Instead, allocate the DMA channels once duing probe and use them for the life time of the driver. This makes sense since there are dedicated DMA channels meant for SPI use. This also helps remove

[PATCH 18/49] spi: davinci: eliminate unnecessary update of davinci_spi-count

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com The count member of davinci_spi is internal to the driver and is not shared with framework. Eliminate its unnecessary update. Signed-off-by: Brian Niebuhr bnieb...@efjohnson.com Tested-By: Michael Williamson michael.william...@criticallink.com

[PATCH 11/49] spi: davinci: remove 'wait_enable' platform data member

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com The SPI_READY bit of struct spi_device:mode serves the purpose of letting the SPI master know if the slave can signal if it is ready for transfer or not. The 'wait_enable' platform data was duplicating this functionality. Use the framework provided

[PATCH 20/49] spi: davinci: check for NULL buffer pointer before using it

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com In the davinci_spi_{tx|rx}_u{8|16}() functions, check for buffer pointer being valid before using it. While providing for better error checking, this change will help simplify code in the caller. Signed-off-by: Brian Niebuhr bnieb...@efjohnson.com

[PATCH 09/49] spi: davinci: enable GPIO lines to be used as chip selects

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com Sometimes, the chip selects provided by SPI module are muxed with other functionality and cannot be used in some designs. In such cases, it becomes convenient to use an available GPIO line as chip select. This patch enables the DaVinci SPI driver to

[PATCH 31/49] spi: davinci: do not store DMA channel information per chip select

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com Do not store DMA channel related information per chip-select since that information does not depend on the chip select. The same DMA channels can be used for transfers on all chip-selects since the transfer happens one-at-a-time. Signed-off-by: Brian

[PATCH 43/49] spi: davinci: enable and power-up SPI only when required

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com Enable SPI only when active transfers are in progress. Keep it in local low power when not in use. Signed-off-by: Brian Niebuhr bnieb...@efjohnson.com Tested-By: Michael Williamson michael.william...@criticallink.com Signed-off-by: Sekhar Nori

[PATCH 38/49] spi: davinci: fix EDMA CC errors at end of transfers

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com Use a dummy param slot linked to itself to take care of the extra sync event that gets sent to EDMA controller after the last byte has been transferred. The dummy PaRAM slot that is linked to the actual DMA PaRAM slot absorbs this event and prevents a

[PATCH 27/49] spi: davinci: add support for interrupt mode

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com Add support for SPI interrupt mode operation. Define a per chip-select io type variable which specifies if the transfers on this chip-select should happen in interrupt mode or polled mode. Introduce a new function davinci_spi_process_events() to help

[PATCH 02/49] spi: davinci: whitespace cleanup

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com Cleanup unnecessary white space from various parts of the file. Signed-off-by: Brian Niebuhr bnieb...@efjohnson.com Tested-By: Michael Williamson michael.william...@criticallink.com Signed-off-by: Sekhar Nori nsek...@ti.com ---

[PATCH 03/49] spi: davinci: remove unused variable 'pdata'

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com The 'pdata' variable is unused in couple of routines. Remove such occurences. Signed-off-by: Brian Niebuhr bnieb...@efjohnson.com Tested-By: Michael Williamson michael.william...@criticallink.com Signed-off-by: Sekhar Nori nsek...@ti.com ---

[PATCH 04/49] spi: davinci: removed unused #defines

2010-11-17 Thread Sekhar Nori
Remove unused defines from code which should help in easy reading of code. Also, use the opportuinity to keep the SPIGCR1 register defines together. Tested-By: Michael Williamson michael.william...@criticallink.com Tested-By: Brian Niebuhr bnieb...@efjohnson.com Signed-off-by: Sekhar Nori

[PATCH 49/49] spi: davinci: kconfig: add manufacturer name to prompt string

2010-11-17 Thread Sekhar Nori
Add manufacturer name to the Kconfig prompt string and move the controller name to the begining of the prompt. This helps locate the driver easily among the list of existing drivers. While at it, also add information about being able to build the driver as module. Tested-By: Brian Niebuhr

[PATCH 32/49] spi: davinci: always start transmit DMA

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com Due to the full duplex nature of the SPI bus, the SPI master on DaVinci needs transmit to be active even if the tranfer is only meant to collect receive data. The current code achieves this by using a temporary zeroed buffer to provide DMA data in case

[PATCH 47/49] spi: davinci: remove unnecessary private data member 'region_size'

2010-11-17 Thread Sekhar Nori
Remove unnecesary private data member 'region_size' being used to store the size of SPI memory region. Instead, get the memory resource size directly from the platform data. Tested-By: Brian Niebuhr bnieb...@efjohnson.com Signed-off-by: Sekhar Nori nsek...@ti.com --- drivers/spi/davinci_spi.c |

[PATCH 16/49] spi: davinci: remove unused members of davinci_spi_slave

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com Several members of struct davinci_spi_slave are unused in code. Remove such members. Signed-off-by: Brian Niebuhr bnieb...@efjohnson.com Tested-By: Michael Williamson michael.william...@criticallink.com Signed-off-by: Sekhar Nori nsek...@ti.com ---

[PATCH 14/49] spi: davinci: setup chip-select timers values only if timer enabled

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com Setup chip-select timers values only if timer is enabled (timer_disbled in spi configuration is false). As a nice side effect, this patch removes code duplicated in davinci_spi_bufs_pio() and davinci_spi_bufs_dma(). Signed-off-by: Brian Niebuhr

[PATCH 24/49] spi: davinci: remove unnecessary completion variable initialization

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com The completion variable 'done' is unnecessarly initialized by the function davinci_spi_bufs_dma() where as it is not used for DMA transfers at all. Remove the unnecessary initialization. Signed-off-by: Brian Niebuhr bnieb...@efjohnson.com Tested-By:

[PATCH 44/49] spi: davinci: setup the driver owner

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com Setup the owner member of the platform driver to THIS_MODULE instead of leaving it NULL. Signed-off-by: Brian Niebuhr bnieb...@efjohnson.com Tested-By: Michael Williamson michael.william...@criticallink.com Signed-off-by: Sekhar Nori nsek...@ti.com ---

[PATCH 08/49] spi: davinci: remove unnecessary data transmit on CS disable

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com On TI DaVinci's SPI controller, the SPIDAT1 register which controls the chip slect status, also has data transmit register in the lower 16 bits. Writing to the whole 32-bits triggers an additional data transmit every time the chip select is disabled.

[PATCH 21/49] spi: davinci: remove unnecessary disable of SPI

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com In the davinci_spi_bufs_dma() function, SPI is briefly disabled before enabling it immediately back again. Remove this unnecessary disable. Signed-off-by: Brian Niebuhr bnieb...@efjohnson.com Tested-By: Michael Williamson

[PATCH 48/49] spi: davinci: shorten variable names

2010-11-17 Thread Sekhar Nori
Shorten names of local variables and structure members where possible. Local variables: * 'davinci_spi' is being renamed 'dspi' * 'davinci_spi_dma' is being renamed 'dma' Structure members: * 'dma_{tx|rx}_channel' is being renamed '{tx|rx}_channel' since the structure containing them is

[PATCH 42/49] spi: davinci: remove non-useful clk_internal platform data

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com The clk_internal platform data member which contols the CLKMOD bit in Global Control Register 1 is not useful since CLKMOD needs be set to 1 *always* to ensure master mode operation. Remove this platform data. Signed-off-by: Brian Niebuhr

[PATCH 34/49] spi: davinci: always start receive DMA

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com In keeping with the full duplex nature of the SPI bus. Always start receive DMA along with transmit DMA. If there is no receive buffer provided with the transfer, use a temporary buffer to receive the data to be thrown away.

[PATCH 26/49] spi: davinci: simplify poll mode transfers

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com Use the fact that the get_tx and get_rx can now cope with NULL buffer pointers to simplify the poll mode transfer code. While at it, check for SPI errors every transfer rather than at the end of the whole transfer. Signed-off-by: Brian Niebuhr

[PATCH 17/49] spi: davinci: eliminate the single member structure davinci_spi_slave

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com The struct davinci_spi_slave has a single member. Eliminate it and store the per-chipselect data in struct davinci_spi directly. Signed-off-by: Brian Niebuhr bnieb...@efjohnson.com Tested-By: Michael Williamson michael.william...@criticallink.com

[PATCH 45/49] spi: davinci: add additional comments

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com Add comments describing the platform data members and per-chip-select SPI configuration structure. Also, add some comments describing the what happens during the driver probe. Signed-off-by: Brian Niebuhr bnieb...@efjohnson.com Tested-By: Michael

[PATCH 07/49] spi: davinci: enable both activation and deactivation of chip-selects

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com Let davinci_spi_chipselect() perform both activation and deactivation of chip selects. This lets spi_bitbang fully control chip select activation, as intended by the SPI API. With this change, the chip select activation code need not be duplicated in

[PATCH 12/49] spi: davinci: make chip-slect specific parameters really chip-select specific

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com Some chip-select specific paramterers like wdelay, parity, usage of chip-select timers (and the actual timer values) are included in platform data forcing the same behaviour across all chip-selects. Create a new davinci_spi_config data structure which

[PATCH 39/49] spi: davinci: handle DMA completion errors correctly

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com Do not simply clean the DMA channel on a DMA completion error. Instead, use wcount and rcount members of davinci_spi to detecion non-completion of DMA and signal EIO to the application. Signed-off-by: Brian Niebuhr bnieb...@efjohnson.com Tested-By:

[PATCH 35/49] spi: davinci: use edma_write_slot() to setup EDMA PaRAM slot

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com Currently a series of EDMA API calls are being made to setup various aspects of EDMA PaRAM slots for receive and transmit. Instead setup the PaRAM using a local structure and write once to the hardware using edma_write_slot() Signed-off-by: Brian

[PATCH 01/49] spi: davinci: fix checkpatch errors

2010-11-17 Thread Sekhar Nori
From: Brian Niebuhr bnieb...@efjohnson.com Fix the following checkpatch error: WARNING: unnecessary whitespace before a quoted newline + dev_info(pdev-dev, Controller at 0x%p \n, davinci_spi-base); Signed-off-by: Brian Niebuhr bnieb...@efjohnson.com Tested-By: Michael Williamson

[PATCH 23/49] spi: davinci: do not treat Tx interrupt being set as error

2010-11-17 Thread Sekhar Nori
In davinci_spi_check_error(), Tx interrupt being set is treated as error. This function is only meant to flag bus error conditions and Tx interrupt being set at that point is not a bus error but rather a driver bug. Stop checking for Tx interrupt and flagging that as an IO error. Tested-By:

[PATCH 00/49] spi: davinci: re-write existing driver

2010-11-17 Thread Sekhar Nori
This patch series represents a break-up into reviewable portions of the work originally done by Brian and posted here: https://patchwork.kernel.org/patch/114924/ While this series does not exactly add up to what Brian's patch is, it is pretty close functionally. This series was tested by me on

[PATCH 05/49] spi: davinci: remove unnecessary typecast

2010-11-17 Thread Sekhar Nori
The typecasting of SPI base address to davinci_spi_reg is unused. Remove it. Tested-By: Michael Williamson michael.william...@criticallink.com Tested-By: Brian Niebuhr bnieb...@efjohnson.com Signed-off-by: Sekhar Nori nsek...@ti.com --- drivers/spi/davinci_spi.c |3 +-- 1 files changed, 1

Re: [PATCH 05/49] spi: davinci: remove unnecessary typecast

2010-11-17 Thread Sergei Shtylyov
Hello. On 17-11-2010 13:43, Sekhar Nori wrote: The typecasting of SPI base address to davinci_spi_reg is unused. You mean unnecessary? Remove it. Tested-By: Michael Williamsonmichael.william...@criticallink.com Tested-By: Brian Niebuhrbnieb...@efjohnson.com Signed-off-by: Sekhar

RE: [PATCH 05/49] spi: davinci: remove unnecessary typecast

2010-11-17 Thread Nori, Sekhar
Hi Sergei, On Wed, Nov 17, 2010 at 16:45:06, Sergei Shtylyov wrote: Hello. On 17-11-2010 13:43, Sekhar Nori wrote: The typecasting of SPI base address to davinci_spi_reg is unused. You mean unnecessary? I used unused because struct davinci_spi_reg is actually undefined. Thanks,

Re: [PATCH v5 04/12] spi: add ti-ssp spi master driver

2010-11-17 Thread Mark Brown
On Tue, Nov 16, 2010 at 07:17:18PM -0500, Cyril Chemparathy wrote: The ability to wait on multiple devices may come handy. In this This is essential for any helpers, otherwise we can't cope easily with mixes of GPIO and power or with regulators from multiple chips (like an extra DCDC, for

Re: [PATCH 00/49] spi: davinci: re-write existing driver

2010-11-17 Thread Grant Likely
On Wed, Nov 17, 2010 at 04:13:32PM +0530, Sekhar Nori wrote: This patch series represents a break-up into reviewable portions of the work originally done by Brian and posted here: https://patchwork.kernel.org/patch/114924/ While this series does not exactly add up to what Brian's patch

Re: [PATCH v5 04/12] spi: add ti-ssp spi master driver

2010-11-17 Thread David Brownell
On Tue, Nov 16, 2010 at 07:17:18PM -0500, Cyril Chemparathy wrote: The ability to wait on multiple devices may come handy. ... You mean you'd like to add such a mechanism to the framework? Or do you want a driver-specific mechanism (non-portable)? If I had to do that, I'd just use

Re: [PATCH v5 04/12] spi: add ti-ssp spi master driver

2010-11-17 Thread Grant Likely
On Tue, Nov 16, 2010 at 07:17:18PM -0500, Cyril Chemparathy wrote: On 11/16/2010 02:47 AM, Grant Likely wrote: On Tue, Nov 16, 2010 at 12:22 AM, Grant Likely grant.lik...@secretlab.ca wrote: On Mon, Nov 15, 2010 at 02:12:06PM -0500, Cyril Chemparathy wrote: This patch adds an SPI master

Re: [PATCH v5 04/12] spi: add ti-ssp spi master driver

2010-11-17 Thread Mark Brown
On Wed, Nov 17, 2010 at 09:11:30AM -0700, Grant Likely wrote: To start, I'm not a fan of matching by name. It's fragile because it makes assumptions about how devices will be names when they actually appear (ie. Sometimes .id is dynamically assigned). Ideally I'd prefer to have direct

Re: [PATCH v5 04/12] spi: add ti-ssp spi master driver

2010-11-17 Thread Cyril Chemparathy
On 11/17/2010 10:25 AM, David Brownell wrote: On Tue, Nov 16, 2010 at 07:17:18PM -0500, Cyril Chemparathy wrote: The ability to wait on multiple devices may come handy. ... You mean you'd like to add such a mechanism to the framework? Ideally in the framework. This appears to be a

Re: [PATCH v5 04/12] spi: add ti-ssp spi master driver

2010-11-17 Thread Greg KH
On Wed, Nov 17, 2010 at 09:11:30AM -0700, Grant Likely wrote: Also, any dependency tracking must work across bus_types. It is not sufficient to only handle the platform_devices use-case. All bus types have this need. Agreed. I see a few potential approaches. Option 1: Add a list of

RE: [PATCH 00/49] spi: davinci: re-write existing driver

2010-11-17 Thread Nori, Sekhar
Hi Grant, On Wed, Nov 17, 2010 at 20:54:26, Grant Likely wrote: On Wed, Nov 17, 2010 at 04:13:32PM +0530, Sekhar Nori wrote: This patch series represents a break-up into reviewable portions of the work originally done by Brian and posted here: https://patchwork.kernel.org/patch/114924/