Skip to content

Commit c9a1405

Browse files
committed
* 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
1 parent 2aee540 commit c9a1405

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2021-11-27 Joerg Wunsch <[email protected]>
2+
3+
Submitted by Lars Ollén:
4+
* linux_spi.c (linuxspi_open): ensure correct SPI mode is
5+
set (submitted in the audit trail of patch #9816).
6+
17
2021-11-27 Joerg Wunsch <[email protected]>
28

39
* linuxspi.c: Use -B <bitclock> rather than -b <baudrate>

linuxspi.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,13 @@ static int linuxspi_open(PROGRAMMER *pgm, char *port)
166166
return -1;
167167
}
168168

169+
uint32_t mode = SPI_MODE_0 | SPI_NO_CS;
170+
ret = ioctl(fd_spidev, SPI_IOC_WR_MODE32, &mode);
171+
if (ret == -1) {
172+
avrdude_message(MSG_INFO, "%s: error: Unable to set SPI mode %0X on %s\n",
173+
progname, mode, spidev);
174+
goto close_spidev;
175+
}
169176
fd_gpiochip = open(gpiochip, 0);
170177
if (fd_gpiochip < 0) {
171178
avrdude_message(MSG_INFO, "\n%s error: Unable to open the gpiochip %s", progname, gpiochip);

0 commit comments

Comments
 (0)