SPI chip select problem

Antony Pavlov antonynpavlov at gmail.com
Mon Jun 25 03:45:06 EDT 2012


Hi!

I have added spi controller driver for one of my MIPS boards and
found, that there is a problem with chip select.

During initialisation we call *_spi_setup() method. It switch chip
select and frequency for every probing spi slave chip.
But after initialisation __we never__ call this method. So if I have
more than 1 spi slave chip, I can use only last of them.

There is the 'cs_change' flag for *_spi_transfer() method, but this
flag does not used at all!

I have made quick-and-dirty patch:

--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -196,6 +196,8 @@ EXPORT_SYMBOL(spi_register_master);

 int spi_sync(struct spi_device *spi, struct spi_message *message)
 {
+       spi->master->setup(spi);
+
        return spi->master->transfer(spi, message);
 }

-- 
Best regards,
  Antony Pavlov



More information about the barebox mailing list