Skip to content

Commit 7c9d92c

Browse files
committed
[nrf fromlist] drivers: spi: nrfx_spim: Add support for non standard frequencies
Disabled frequency set approximation algorithm for spim's with prescaler. Upstream PR: #92436 Signed-off-by: Michal Frankiewicz <[email protected]>
1 parent 51f83ce commit 7c9d92c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/spi/spi_nrfx_spim.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,12 @@ static inline uint32_t get_nrf_spim_frequency(uint32_t frequency)
172172
{
173173
/* Get the highest supported frequency not exceeding the requested one.
174174
*/
175-
if (frequency >= MHZ(32) && (NRF_SPIM_HAS_32_MHZ_FREQ || NRF_SPIM_HAS_PRESCALER)) {
175+
#if (NRF_SPIM_HAS_PRESCALER)
176+
return frequency;
177+
#else
178+
if (frequency >= MHZ(32) && NRF_SPIM_HAS_32_MHZ_FREQ) {
176179
return MHZ(32);
177-
} else if (frequency >= MHZ(16) && (NRF_SPIM_HAS_16_MHZ_FREQ || NRF_SPIM_HAS_PRESCALER)) {
180+
} else if (frequency >= MHZ(16) && NRF_SPIM_HAS_16_MHZ_FREQ) {
178181
return MHZ(16);
179182
} else if (frequency >= MHZ(8)) {
180183
return MHZ(8);
@@ -191,6 +194,7 @@ static inline uint32_t get_nrf_spim_frequency(uint32_t frequency)
191194
} else {
192195
return KHZ(125);
193196
}
197+
#endif /* NRF_SPIM_HAS_PRESCALER */
194198
}
195199

196200
static inline nrf_spim_mode_t get_nrf_spim_mode(uint16_t operation)

0 commit comments

Comments
 (0)