From bc5036896226567f42642edc1c42958e9c45e0d1 Mon Sep 17 00:00:00 2001 From: Naga Himanshu Indraganti Date: Fri, 6 Dec 2024 15:28:45 +0530 Subject: [PATCH] drivers:platform:stm32: Update SPI desc frequency with configured frequency Update SPI descriptor clock frequency value with configured value instead of retaining init params value. Signed-off-by: Naga Himanshu Indraganti --- drivers/platform/stm32/stm32_spi.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/platform/stm32/stm32_spi.c b/drivers/platform/stm32/stm32_spi.c index 23dc1f08cd8..34490ace2d6 100644 --- a/drivers/platform/stm32/stm32_spi.c +++ b/drivers/platform/stm32/stm32_spi.c @@ -58,31 +58,41 @@ static int stm32_spi_config(struct no_os_spi_desc *desc) switch (div) { case 0 ... 2: prescaler = SPI_BAUDRATEPRESCALER_2; + desc->max_speed_hz = sdesc->input_clock / 2; break; case 3 ... 4: prescaler = SPI_BAUDRATEPRESCALER_4; + desc->max_speed_hz = sdesc->input_clock / 4; break; case 5 ... 8: prescaler = SPI_BAUDRATEPRESCALER_8; + desc->max_speed_hz = sdesc->input_clock / 8; break; case 9 ... 16: prescaler = SPI_BAUDRATEPRESCALER_16; + desc->max_speed_hz = sdesc->input_clock / 16; break; case 17 ... 32: prescaler = SPI_BAUDRATEPRESCALER_32; + desc->max_speed_hz = sdesc->input_clock / 32; break; case 33 ... 64: prescaler = SPI_BAUDRATEPRESCALER_64; + desc->max_speed_hz = sdesc->input_clock / 64; break; case 65 ... 128: prescaler = SPI_BAUDRATEPRESCALER_128; + desc->max_speed_hz = sdesc->input_clock / 128; break; default: prescaler = SPI_BAUDRATEPRESCALER_256; + desc->max_speed_hz = sdesc->input_clock / 256; break; } - } else + } else { prescaler = SPI_BAUDRATEPRESCALER_64; + desc->max_speed_hz = sdesc->input_clock / 64; + } switch (desc->device_id) { #if defined(SPI1)