* linux_spi.c (linuxspi_open): ensure correct SPI mode is

Submitted by Lars Ollén:
set (submitted in the audit trail of patch #9816).




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1498 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Joerg Wunsch 2021-11-27 20:18:44 +00:00
parent 2aee540bfa
commit c9a1405547
2 changed files with 13 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2021-11-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Lars Ollén:
* linux_spi.c (linuxspi_open): ensure correct SPI mode is
set (submitted in the audit trail of patch #9816).
2021-11-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* linuxspi.c: Use -B <bitclock> rather than -b <baudrate>

View File

@ -166,6 +166,13 @@ static int linuxspi_open(PROGRAMMER *pgm, char *port)
return -1;
}
uint32_t mode = SPI_MODE_0 | SPI_NO_CS;
ret = ioctl(fd_spidev, SPI_IOC_WR_MODE32, &mode);
if (ret == -1) {
avrdude_message(MSG_INFO, "%s: error: Unable to set SPI mode %0X on %s\n",
progname, mode, spidev);
goto close_spidev;
}
fd_gpiochip = open(gpiochip, 0);
if (fd_gpiochip < 0) {
avrdude_message(MSG_INFO, "\n%s error: Unable to open the gpiochip %s", progname, gpiochip);