Hello,
How can I access directly to the configuration registers for the SPI module?
For example, register SPIx_MCR, for configure Fast Continuous Selection Format.
I have tried with IOCTL functions, but SPIDev library only have a few configuration parameters (mode, lsb_first, bits_per_word, max_speed,..,), and it dont allow advanced configurations.
- Kernel 4.14.78
- Yocto Warrior.
- C code.
Thank you.
Regards.
Please refer to tools/spi/spidev_test.c, ioctl() requests let your driver read or override the device's current settings for data transfer parameters.
fd = open(device, O_RDWR);
if (fd < 0)
pabort("can't open device");
/*
* spi mode
*/
ret = ioctl(fd, SPI_IOC_WR_MODE32, &mode);
if (ret == -1)
pabort("can't set spi mode");
ret = ioctl(fd, SPI_IOC_RD_MODE32, &mode);
if (ret == -1)
pabort("can't get spi mode");
/*
* bits per word
*/
ret = ioctl(fd, SPI_IOC_WR_BITS_PER_WORD, &bits);
if (ret == -1)
pabort("can't set bits per word");
ret = ioctl(fd, SPI_IOC_RD_BITS_PER_WORD, &bits);
if (ret == -1)
pabort("can't get bits per word");
Hello Yiping, thank you for your response.
But I already knew those confgurations parameters and I use them succesfully.
I would like to modify specific configurations, for example, to set Fast Continuous Selection Format, the 29th bit of Module Configuration Register (MCR), as it is mentioned in LS1021A reference Manual, charapter 34.4.1.
I wonder if it is possible to modify from user space, using IOCT function.
Or if there is any other way to do it.
Thanks.
Kind regards.
spidev only provides limited userspace APIs. You have to modify SPI driver to set advanced registers.