2010-07-05 10:13:08 Blackfin SPI driver not worked with SPI_MODE_0
Michail Kurochkin (BELARUS)
Message: 90914
My device use SPI with CHPA = 0 and CPOL = 0.
How enable SPI_MODE_0 and hardware chip select?
In my board specific file next code:
static struct bfin5xx_spi_chip xxx_info =
{
.enable_dma = 0,
.bits_per_word = 8,
};
static struct spi_board_info xxx[]
{
{
.modalias = "xxx", // Name of spi_driver for this device
.max_speed_hz = 3125000, // max spi clock (SCK) speed in HZ
.bus_num = 0, // Framework bus number
.chip_select = 2,
.platform_data = NULL, // No spi_driver specific config
.controller_data = &xxx_info,
.mode = SPI_MODE_0,
},
};
Driver spi-bfin5xx is not started. Error message: "please use a GPIO as chipselect while CPHA is 0"
In file spi-bfin5xx.c
line 1156:
if (chip->chip_select_num < MAX_CTRL_CS) {
if (!(spi->mode & SPI_CPHA)) {
dev_err(&spi->dev, "please use a GPIO as chipselect while CPHA is 0\n");
goto error;
}
chip->flag = (1 << spi->chip_select) << 8;
} else
chip->cs_gpio = chip->chip_select_num - MAX_CTRL_CS;
What for the given check is necessary?
QuoteReplyEditDelete
2010-07-05 10:44:43 Blackfin SPI driver not worked with SPI_MODE_0
Michael Hennerich (GERMANY)
Message: 90917 Honestly I think this abort/error should be removed or turned into a warning only.
On Blackfin when CPHA is set - the HW controlled SPI SSEL goes inactive between each byte/word.
This has often lead to confusion or undesirable behavior.
docs.blackfin.uclinux.org/doku.php?id=spi
QuoteReplyEditDelete
2010-07-05 11:14:43 Re: Blackfin SPI driver not worked with SPI_MODE_0
Ivan Kuten (BELARUS)
Message: 90919
Michael,
Thanks for reply.
In our case a slave chip connected to SPI really requires SPI CS toggle during each byte read/write, so we just comment out error path in code.
Regards,
Ivan