Skip to content

Commit

Permalink
[PATCH] SPI: infrastructure to initialize spi_device.mode early
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David Brownell authored and Linus Torvalds committed Jun 28, 2006
1 parent 8f7c588 commit 980a01c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions drivers/spi/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 5 additions & 1 deletion include/linux/spi/spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
};
Expand Down

0 comments on commit 980a01c

Please sign in to comment.