]> err.no Git - linux-2.6/commitdiff
[PATCH] SPI: infrastructure to initialize spi_device.mode early
authorDavid Brownell <david-b@pacbell.net>
Wed, 28 Jun 2006 14:47:15 +0000 (07:47 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 28 Jun 2006 22:51:01 +0000 (15:51 -0700)
This patch adds earlier initialization of spi_device.mode, as needed
on boards using nondefault chipselect polarity.  An example would be
ones using the RS5C348 RTC without an external signal inverter between
the RTC chipselect and the SPI controller.

Without this mechanism, the first setup() call for that chip would
wrongly enable chips, corrupting transfers to/from other chips sharing
that SPI bus.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/spi/spi.c
include/linux/spi/spi.h

index 1cea4a6799fe66c3e6fd94eaf56b3ed52b13e2cb..ed1cdf6ac8f34dbe5d61a6b172b49ccea1bfdddd 100644 (file)
@@ -210,6 +210,7 @@ spi_new_device(struct spi_master *master, struct spi_board_info *chip)
        proxy->master = master;
        proxy->chip_select = chip->chip_select;
        proxy->max_speed_hz = chip->max_speed_hz;
+       proxy->mode = chip->mode;
        proxy->irq = chip->irq;
        proxy->modalias = chip->modalias;
 
index e928c0dcc29755d31c2ba5b7f1d96b1f3ac50b1e..c8bb68099eb9e35bf5ae2edba0c43244ca95ff5b 100644 (file)
@@ -642,10 +642,14 @@ struct spi_board_info {
        u16             bus_num;
        u16             chip_select;
 
+       /* mode becomes spi_device.mode, and is essential for chips
+        * where the default of SPI_CS_HIGH = 0 is wrong.
+        */
+       u8              mode;
+
        /* ... may need additional spi_device chip config data here.
         * avoid stuff protocol drivers can set; but include stuff
         * needed to behave without being bound to a driver:
-        *  - chipselect polarity
         *  - quirks like clock rate mattering when not selected
         */
 };