I have encountered a weakness in the bsp architecture when using multiple kinds of modes in spi devices. The basic issue is this, in the initialization for spi devices in init_spi.c one passes in clock phase and polarity through the MCF5XXX_QSPI_INIT_STRUCT structure. If you have two devices with different phase/polarity, the you must reset the mode with an ioctl before each read/write ioctl. One must do this because the last phase/polarity set is what is used, not what a specfic device is configured with. This also is true of baud rate if my code reading is correct. In addition, it would be nice if the FRAMESIZE was added to the MCF5XXX_QSPI_INIT_STRUCT so that it could be stored and used.
An application in theory could in one task could set the phase/polarity, be swapped out, have another task set phase/polarity, be swapped out, then have the first task swap back in and send its data with the incorrect settings. Even without the task switching issues, it is combersome to have to always set the phase/polarity before each read/write operation.
I have modified my spi_pol_mcf5xxx_qspi.c function _mcf5xxx_qspi_polled_tx_rx() to explicitly call the ioctl to set mode and baud IO_IOCTL_SPI_SET_MODE and IO_IOCTL_SPI_SET_BAUD before transmitting.
Around line 668 I added
if ( SPI_OK != _mcf5xxx_qspi_polled_ioctl( io_info_ptr, IO_IOCTL_SPI_SET_MODE, &io_info_ptr->INIT.CLOCK_POL_PHASE, 0 ) )
if ( SPI_OK != _mcf5xxx_qspi_polled_ioctl( io_info_ptr, IO_IOCTL_SPI_SET_BAUD, &io_info_ptr->INIT.BAUD_RATE, 0 ) )
If the FRAMESIZE was stored, I would set it here also.
M8R-jw5952 at mailinator dot com