@@ -81,6 +81,7 @@ static volatile uint8_t ce_vios_count;
8181static volatile uint8_t ce_vios [DEVICES_MAX ];
8282static volatile uint8_t data_vios_count ;
8383static volatile uint8_t data_vios [DATA_PINS_MAX ];
84+ static volatile uint8_t clk_vio ;
8485static volatile nrfe_mspi_dev_config_t nrfe_mspi_devices [DEVICES_MAX ];
8586static volatile nrfe_mspi_xfer_config_t nrfe_mspi_xfer_config ;
8687static volatile nrfe_mspi_xfer_config_t * nrfe_mspi_xfer_config_ptr = & nrfe_mspi_xfer_config ;
@@ -191,22 +192,22 @@ static void configure_clock(enum mspi_cpp_mode cpp_mode)
191192 switch (cpp_mode ) {
192193 case MSPI_CPP_MODE_0 : {
193194 vio_config .clk_polarity = 0 ;
194- WRITE_BIT (out , pin_to_vio_map [ NRFE_MSPI_SCK_PIN_NUMBER ] , VPRCSR_NORDIC_OUT_LOW );
195+ WRITE_BIT (out , clk_vio , VPRCSR_NORDIC_OUT_LOW );
195196 break ;
196197 }
197198 case MSPI_CPP_MODE_1 : {
198199 vio_config .clk_polarity = 1 ;
199- WRITE_BIT (out , pin_to_vio_map [ NRFE_MSPI_SCK_PIN_NUMBER ] , VPRCSR_NORDIC_OUT_LOW );
200+ WRITE_BIT (out , clk_vio , VPRCSR_NORDIC_OUT_LOW );
200201 break ;
201202 }
202203 case MSPI_CPP_MODE_2 : {
203204 vio_config .clk_polarity = 1 ;
204- WRITE_BIT (out , pin_to_vio_map [ NRFE_MSPI_SCK_PIN_NUMBER ] , VPRCSR_NORDIC_OUT_HIGH );
205+ WRITE_BIT (out , clk_vio , VPRCSR_NORDIC_OUT_HIGH );
205206 break ;
206207 }
207208 case MSPI_CPP_MODE_3 : {
208209 vio_config .clk_polarity = 0 ;
209- WRITE_BIT (out , pin_to_vio_map [ NRFE_MSPI_SCK_PIN_NUMBER ] , VPRCSR_NORDIC_OUT_HIGH );
210+ WRITE_BIT (out , clk_vio , VPRCSR_NORDIC_OUT_HIGH );
210211 break ;
211212 }
212213 }
@@ -240,7 +241,7 @@ static void xfer_execute(nrfe_mspi_xfer_packet_msg_t *xfer_packet, volatile uint
240241 xfer_params .cpp_mode = device -> cpp ;
241242 xfer_params .ce_polarity = device -> ce_polarity ;
242243 xfer_params .bus_widths = io_modes [device -> io_mode ];
243- xfer_params .clk_vio = pin_to_vio_map [ NRFE_MSPI_SCK_PIN_NUMBER ] ;
244+ xfer_params .clk_vio = clk_vio ;
244245
245246 /* Fix position of command and address if command/address length is < BITS_IN_WORD,
246247 * so that leading zeros would not be printed instead of data bits.
@@ -371,12 +372,9 @@ static void config_pins(nrfe_mspi_pinctrl_soc_pin_msg_t *pins_cfg)
371372 VPRCSR_NORDIC_DIR_INPUT );
372373 data_vios_count ++ ;
373374 } else if (fun == NRF_FUN_SDP_MSPI_SCK ) {
374- WRITE_BIT (xfer_params .tx_direction_mask ,
375- pin_to_vio_map [NRFE_MSPI_SCK_PIN_NUMBER ],
376- VPRCSR_NORDIC_DIR_OUTPUT );
377- WRITE_BIT (xfer_params .rx_direction_mask ,
378- pin_to_vio_map [NRFE_MSPI_SCK_PIN_NUMBER ],
379- VPRCSR_NORDIC_DIR_OUTPUT );
375+ clk_vio = pin_to_vio_map [pin_number ];
376+ WRITE_BIT (xfer_params .tx_direction_mask , clk_vio , VPRCSR_NORDIC_DIR_OUTPUT );
377+ WRITE_BIT (xfer_params .rx_direction_mask , clk_vio , VPRCSR_NORDIC_DIR_OUTPUT );
380378 }
381379 }
382380 nrf_vpr_csr_vio_dir_set (xfer_params .tx_direction_mask );
0 commit comments