14
14
#include <hal/nrf_clock.h>
15
15
#include <string.h>
16
16
17
- #define LOG_DOMAIN "spi_nrfx_spim"
18
- #define LOG_LEVEL CONFIG_SPI_LOG_LEVEL
19
17
#include <logging/log.h>
20
- LOG_MODULE_REGISTER (spi_nrfx_spim );
18
+ LOG_MODULE_REGISTER (spi_nrfx_spim , CONFIG_SPI_LOG_LEVEL );
21
19
22
20
#include "spi_context.h"
23
21
@@ -247,26 +245,26 @@ static void anomaly_58_workaround_clear(struct spi_nrfx_data *dev_data)
247
245
248
246
static int anomaly_58_workaround_init (const struct device * dev )
249
247
{
250
- struct spi_nrfx_data * data = dev -> data ;
251
- const struct spi_nrfx_config * config = dev -> config ;
248
+ struct spi_nrfx_data * dev_data = dev -> data ;
249
+ const struct spi_nrfx_config * dev_config = dev -> config ;
252
250
nrfx_err_t err_code ;
253
251
254
- data -> anomaly_58_workaround_active = false;
252
+ dev_data -> anomaly_58_workaround_active = false;
255
253
256
- if (config -> anomaly_58_workaround ) {
257
- err_code = nrfx_ppi_channel_alloc (& data -> ppi_ch );
254
+ if (dev_config -> anomaly_58_workaround ) {
255
+ err_code = nrfx_ppi_channel_alloc (& dev_data -> ppi_ch );
258
256
if (err_code != NRFX_SUCCESS ) {
259
257
LOG_ERR ("Failed to allocate PPI channel" );
260
258
return - ENODEV ;
261
259
}
262
260
263
- err_code = nrfx_gpiote_channel_alloc (& data -> gpiote_ch );
261
+ err_code = nrfx_gpiote_channel_alloc (& dev_data -> gpiote_ch );
264
262
if (err_code != NRFX_SUCCESS ) {
265
263
LOG_ERR ("Failed to allocate GPIOTE channel" );
266
264
return - ENODEV ;
267
265
}
268
266
LOG_DBG ("PAN 58 workaround enabled for %s: ppi %u, gpiote %u" ,
269
- dev -> name , data -> ppi_ch , data -> gpiote_ch );
267
+ dev -> name , dev_data -> ppi_ch , dev_data -> gpiote_ch );
270
268
}
271
269
272
270
return 0 ;
@@ -432,8 +430,8 @@ static int spim_nrfx_pm_action(const struct device *dev,
432
430
enum pm_device_action action )
433
431
{
434
432
int ret = 0 ;
435
- struct spi_nrfx_data * data = dev -> data ;
436
- const struct spi_nrfx_config * config = dev -> config ;
433
+ struct spi_nrfx_data * dev_data = dev -> data ;
434
+ const struct spi_nrfx_config * dev_config = dev -> config ;
437
435
438
436
switch (action ) {
439
437
case PM_DEVICE_ACTION_RESUME :
@@ -443,9 +441,9 @@ static int spim_nrfx_pm_action(const struct device *dev,
443
441
break ;
444
442
445
443
case PM_DEVICE_ACTION_SUSPEND :
446
- if (data -> initialized ) {
447
- nrfx_spim_uninit (& config -> spim );
448
- data -> initialized = false;
444
+ if (dev_data -> initialized ) {
445
+ nrfx_spim_uninit (& dev_config -> spim );
446
+ dev_data -> initialized = false;
449
447
}
450
448
break ;
451
449
@@ -492,16 +490,16 @@ static int spim_nrfx_pm_action(const struct device *dev,
492
490
": cannot enable both pull-up and pull-down on MISO line"); \
493
491
static int spi_##idx##_init(const struct device *dev) \
494
492
{ \
495
- struct spi_nrfx_data *data = dev->data; \
496
- int err; \
493
+ struct spi_nrfx_data *dev_data = dev->data; \
494
+ int err; \
497
495
IRQ_CONNECT(NRFX_IRQ_NUMBER_GET(NRF_SPIM##idx), \
498
496
DT_IRQ(SPIM(idx), priority), \
499
497
nrfx_isr, nrfx_spim_##idx##_irq_handler, 0); \
500
- err = spi_context_cs_configure_all(&data ->ctx); \
501
- if (err < 0) { \
502
- return err; \
503
- } \
504
- spi_context_unlock_unconditionally(&data ->ctx); \
498
+ err = spi_context_cs_configure_all(&dev_data ->ctx); \
499
+ if (err < 0) { \
500
+ return err; \
501
+ } \
502
+ spi_context_unlock_unconditionally(&dev_data ->ctx); \
505
503
COND_CODE_1(CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58, \
506
504
(return anomaly_58_workaround_init(dev);), \
507
505
(return 0;)) \
0 commit comments