lkml.org 
[lkml]   [2011]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/6] SPI: add ability to say we want a cs change after every transfer.
Date
This allows a number of drivers to make use of utility functions
such spi_write_then_read as well as making use of regmap possible.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
---
drivers/spi/spi.c | 8 ++++++++
include/linux/spi/spi.h | 2 ++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 4d1b9f5..bee8aee 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -781,6 +781,14 @@ static int __spi_async(struct spi_device *spi, struct spi_message *message)
}
}

+ if (spi->cs_between_transfers) {
+ struct spi_transfer *xfer;
+ list_for_each_entry(xfer, &message->transfers, transfer_list) {
+ if (!list_is_last(&xfer->transfer_list, &message->transfers))
+ xfer->cs_change = 1;
+ }
+ }
+
message->spi = spi;
message->status = -EINPROGRESS;
return master->transfer(spi, message);
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index bb4f5fb..f1e378d 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -90,6 +90,8 @@ struct spi_device {
void *controller_data;
char modalias[SPI_NAME_SIZE];

+ unsigned cs_between_transfers:1;
+
/*
* likely need more hooks for more protocol options affecting how
* the controller talks to each chip, like:
--
1.7.3.4


\
 
 \ /
  Last update: 2011-09-07 18:15    [from the cache]
©2003-2011 Jasper Spaans