From edd8824a74e7d8ce3151927762d6a5db07cdbb69 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Tue, 18 Dec 2018 20:52:24 -0500 Subject: [PATCH] spi: add quirks system Not all SPI chips are the same. Add a system to differentiate them. Signed-off-by: Sean Cross --- spi.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spi.c b/spi.c index 1f45427..2aa24f3 100644 --- a/spi.c +++ b/spi.c @@ -10,10 +10,22 @@ #include "rpi.h" #include "spi.h" +enum ff_spi_quirks { + // There is no separate "Write SR 2" command. Instead, + // you must write SR2 after writing SR1 + SQ_SR2_FROM_SR1 = (1 << 0), + + // Don't issue a "Write Enable" command prior to writing + // a status register + SQ_SKIP_SR_WEL = (1 << 1), +}; + struct ff_spi { enum spi_state state; enum spi_type type; enum spi_type desired_type; + struct spi_id id; + enum ff_spi_quirks quirks; struct { int clk;