@@ -99,9 +99,6 @@ struct fpga_ice40_config {
99
99
uint8_t leading_clocks ;
100
100
uint8_t trailing_clocks ;
101
101
fpga_api_load load ;
102
- #ifdef CONFIG_PINCTRL
103
- const struct pinctrl_dev_config * pincfg ;
104
- #endif
105
102
};
106
103
107
104
static void fpga_ice40_crc_to_str (uint32_t crc , char * s )
@@ -299,9 +296,7 @@ static int fpga_ice40_load_gpio(const struct device *dev, uint32_t *image_ptr, u
299
296
(void )gpio_pin_configure_dt (& config -> bus .config .cs .gpio , GPIO_OUTPUT_HIGH );
300
297
(void )gpio_pin_configure_dt (& config -> clk , GPIO_DISCONNECTED );
301
298
(void )gpio_pin_configure_dt (& config -> pico , GPIO_DISCONNECTED );
302
- #ifdef CONFIG_PINCTRL
303
- (void )pinctrl_apply_state (config -> pincfg , PINCTRL_STATE_DEFAULT );
304
- #endif
299
+ spi_apply_default_pin_state_dt (& config -> bus );
305
300
306
301
k_spin_unlock (& data -> lock , key );
307
302
@@ -438,9 +433,7 @@ static int fpga_ice40_load_spi(const struct device *dev, uint32_t *image_ptr, ui
438
433
unlock :
439
434
(void )gpio_pin_configure_dt (& config -> creset , GPIO_OUTPUT_HIGH );
440
435
(void )gpio_pin_configure_dt (& config -> bus .config .cs .gpio , GPIO_OUTPUT_HIGH );
441
- #ifdef CONFIG_PINCTRL
442
- (void )pinctrl_apply_state (config -> pincfg , PINCTRL_STATE_DEFAULT );
443
- #endif
436
+ spi_apply_default_pin_state_dt (& config -> bus );
444
437
445
438
k_spin_unlock (& data -> lock , key );
446
439
@@ -553,14 +546,6 @@ static int fpga_ice40_init(const struct device *dev)
553
546
: (FPGA_ICE40_LOAD_MODE(inst) == FPGA_ICE40_LOAD_MODE_GPIO ? fpga_ice40_load_gpio \
554
547
: NULL))
555
548
556
- #ifdef CONFIG_PINCTRL
557
- #define FPGA_ICE40_PINCTRL_CONFIG (inst ) .pincfg = PINCTRL_DT_DEV_CONFIG_GET(DT_INST_PARENT(inst)),
558
- #define FPGA_ICE40_PINCTRL_DEFINE (inst ) PINCTRL_DT_DEFINE(DT_INST_PARENT(inst))
559
- #else
560
- #define FPGA_ICE40_PINCTRL_CONFIG (inst )
561
- #define FPGA_ICE40_PINCTRL_DEFINE (inst )
562
- #endif
563
-
564
549
#define FPGA_ICE40_DEFINE (inst ) \
565
550
BUILD_ASSERT(FPGA_ICE40_LOAD_MODE(inst) == FPGA_ICE40_LOAD_MODE_SPI || \
566
551
FPGA_ICE40_LOAD_MODE(inst) == FPGA_ICE40_LOAD_MODE_GPIO); \
@@ -576,7 +561,6 @@ static int fpga_ice40_init(const struct device *dev)
576
561
BUILD_ASSERT(FPGA_ICE40_TRAILING_CLOCKS(inst) <= UINT8_MAX); \
577
562
BUILD_ASSERT(FPGA_ICE40_MHZ_DELAY_COUNT(inst) >= 0); \
578
563
\
579
- FPGA_ICE40_PINCTRL_DEFINE(inst); \
580
564
static struct fpga_ice40_data fpga_ice40_data_##inst; \
581
565
\
582
566
static const struct fpga_ice40_config fpga_ice40_config_##inst = { \
@@ -593,7 +577,7 @@ static int fpga_ice40_init(const struct device *dev)
593
577
.leading_clocks = FPGA_ICE40_LEADING_CLOCKS(inst), \
594
578
.trailing_clocks = FPGA_ICE40_TRAILING_CLOCKS(inst), \
595
579
.load = FPGA_ICE40_LOAD_FUNC(inst), \
596
- FPGA_ICE40_PINCTRL_CONFIG(inst)}; \
580
+ }; \
597
581
\
598
582
DEVICE_DT_INST_DEFINE(inst, fpga_ice40_init, NULL, &fpga_ice40_data_##inst, \
599
583
&fpga_ice40_config_##inst, POST_KERNEL, CONFIG_FPGA_INIT_PRIORITY, \
0 commit comments