@@ -12,7 +12,6 @@ LOG_MODULE_DECLARE(spi_lpspi, CONFIG_SPI_LOG_LEVEL);
12
12
#include "spi_nxp_lpspi_priv.h"
13
13
14
14
struct lpspi_driver_data {
15
- size_t fill_len ;
16
15
uint8_t word_size_bytes ;
17
16
};
18
17
@@ -126,7 +125,7 @@ static inline void lpspi_fill_tx_fifo(const struct device *dev, const uint8_t *b
126
125
buf_remaining_bytes -= word_size ;
127
126
}
128
127
129
- LOG_DBG ("Filled TX FIFO to %d words (%d bytes)" , lpspi_data -> fill_len , offset );
128
+ LOG_DBG ("Filled TX FIFO to %d words (%d bytes)" , fill_len , offset );
130
129
}
131
130
132
131
/* just fills TX fifo with the specified amount of NOPS */
@@ -187,34 +186,26 @@ static void lpspi_next_tx_fill(const struct device *dev)
187
186
actual_filled += next_buf_fill ;
188
187
}
189
188
190
- lpspi_data -> fill_len = actual_filled ;
189
+ spi_context_update_tx ( ctx , lpspi_data -> word_size_bytes , actual_filled ) ;
191
190
}
192
191
193
192
static inline void lpspi_handle_tx_irq (const struct device * dev )
194
193
{
195
194
LPSPI_Type * base = (LPSPI_Type * )DEVICE_MMIO_NAMED_GET (dev , reg_base );
196
195
struct lpspi_data * data = dev -> data ;
197
- struct lpspi_driver_data * lpspi_data = (struct lpspi_driver_data * )data -> driver_data ;
198
196
struct spi_context * ctx = & data -> ctx ;
199
197
200
198
base -> SR = LPSPI_SR_TDF_MASK ;
201
199
202
200
/* If we receive a TX interrupt but no more data is available,
203
- * we can be sure that all data has been written to the bus .
201
+ * we can be sure that all data has been written to the fifo .
204
202
* Disable the interrupt to signal that we are done.
205
203
*/
206
204
if (!spi_context_tx_on (ctx )) {
207
205
base -> IER &= ~LPSPI_IER_TDIE_MASK ;
208
206
return ;
209
207
}
210
208
211
- while (spi_context_tx_on (ctx ) && lpspi_data -> fill_len > 0 ) {
212
- size_t this_buf_words_sent = MIN (lpspi_data -> fill_len , ctx -> tx_len );
213
-
214
- spi_context_update_tx (ctx , lpspi_data -> word_size_bytes , this_buf_words_sent );
215
- lpspi_data -> fill_len -= this_buf_words_sent ;
216
- }
217
-
218
209
lpspi_next_tx_fill (dev );
219
210
}
220
211
@@ -272,7 +263,6 @@ static void lpspi_isr(const struct device *dev)
272
263
max_fill - tx_current_fifo_len : 0 ;
273
264
274
265
lpspi_fill_tx_fifo_nop (dev , fill_len );
275
- lpspi_data -> fill_len = fill_len ;
276
266
}
277
267
278
268
if ((DIV_ROUND_UP (spi_context_rx_len_left (ctx , word_size_bytes ), word_size_bytes ) == 1 ) &&
0 commit comments