Hi,
I'm working on a AM1808-based custom board which has LCD interface.
I've ported the code from da850 evm (sdk_5_03_02_00).
The LCD controller is ILI9340 and must be initialized via a SPI port, 9 bits per word.
I want to use SPI1_SCS[2] to address it.
So I've adapted the following files
arch/arm/mach-davinci/board-da850-k5.c
arch/arm/configs/da850.c
arch/arm/mach-davinci/include/mach/mux.h
and now the spi_board_info struct it looks like this
static struct spi_board_info da850_k5_spi_info[] = {
[0] = {
.modalias = "m25p80",
.platform_data = &da850_k5_spiflash_data,
.controller_data = &da850_k5_spiflash_cfg,
.mode = SPI_MODE_0,
.max_speed_hz = 30000000,
.bus_num = 1,
.chip_select = 0,
},
[1] = {
.modalias = "spidev",
.mode = SPI_MODE_0,
.max_speed_hz = 1000000,
.bus_num = 1,
.chip_select = 2,
},
};
The following user space program allows me to interact with the LCD
int main(int argc, char *argv[])
{
int fd;
uint8_t mode = SPI_MODE_0;
uint8_t bits = 16;
uint32_t speed = 1000000;
uint16_t delay = 50;
uint16_t testdata = 0xaa55;
fd = open("/dev/spidev1.2", O_RDWR);
ioctl(fd, SPI_IOC_WR_MODE, &mode);
ioctl(fd, SPI_IOC_WR_BITS_PER_WORD, &bits);
ioctl(fd, SPI_IOC_WR_MAX_SPEED_HZ, &speed);
write(fd, &testdata, 2);
close(fd);
return 0;
}
This program works good, because on the oscilloscope I see the correct waveform.
Now the problem is that really I need 9 bits per word, not 16! (Infact this is a very strange device! the MSB of the word tells if the value is a command or a data)
However it seems that the SPI_IOC_WR_BITS_PER_WORD ioctl accepts only 8 or 16. Can you confirm it ?
So, what can I do ? Do I have to modify drivers/spi/spi.c ???????