This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM1705 spidev1.4 and spidev1.5 accesses hang processor

Other Parts Discussed in Thread: AM1705

Hi all,

I have need to create 6 spi devices on bus1 of our custom board using am1705 SoC. I have successfully created the spidevs and installed the proper structures for using gpio chip selects with each one. There are also two such spidevs on bus 0 along with the spi flash similar to evm board.

The problem I am seeing is that I can successfully talk to all spi devices except spidev1.4 and spidev1.5. The processor hangs and must be rebooted. To prove these particular devices are not the issue I moved them up in the modalias list of spi_board_info so that they were spidev1.2 and 1.3 and the spidev_test did not hang. I also verified with a o-scope that the cs pin did fire at the device.

Is there a bug here, or a limit on the number of devices on each spi bus?

thanks as always,

Dan

  • There seems to be a hard-coded limit here:

    drivers/spi/spi-davinci.c
    ...
    #define SPI_MAX_CHIPSELECT 2
    ...
    struct davinci_spi {
    ...
      u8  bytes_per_word[SPI_MAX_CHIPSELECT];
      u32 speed;
    ...
    }
    ...
    static int davinci_spi_setup_transfer(struct spi_device *spi,
                                          struct spi_transfer *t)
    {
    ...
      dspi->bytes_per_word[spi->chip_select] = 1;
    ...
    }
    ...

    The bytes_per_word has a limit of 2 and that should allow for spidev1.0 and spidev1.2. I think you get away with with 1.2 and 1.3 because there is 2 bytes of padding between bytes_per_word and speed for alignment purposes. Use of spidev1.4 will write into the speed field. Try bumping up SPI_MAX_CHIPSELECT from 2 to 6. You'll get 8 anyways because of alignment padding.

  • Thanks! That worked.