drivers: spi: use CPU clock frequency in configuration on CC13XX/CC26XX
The SPI peripheral should be configured using the CPU clock speed and not the system clock speed. This used to be fine because they were the same before #19232, but now that the system clock is RTC-based (which has a different frequency), we can no longer make that assumption. Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
This commit is contained in:
parent
1b263ba0a6
commit
27c035fff4
1 changed files with 2 additions and 3 deletions
|
@ -9,7 +9,6 @@
|
|||
LOG_MODULE_REGISTER(spi_cc13xx_cc26xx);
|
||||
|
||||
#include <drivers/spi.h>
|
||||
#include <sys_clock.h>
|
||||
|
||||
#include <driverlib/prcm.h>
|
||||
#include <driverlib/ssi.h>
|
||||
|
@ -83,7 +82,7 @@ static int spi_cc13xx_cc26xx_configure(struct device *dev,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (2 * config->frequency > sys_clock_hw_cycles_per_sec()) {
|
||||
if (2 * config->frequency > DT_CPU_CLOCK_FREQUENCY) {
|
||||
LOG_ERR("Frequency greater than supported in master mode");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -113,7 +112,7 @@ static int spi_cc13xx_cc26xx_configure(struct device *dev,
|
|||
SSIDisable(cfg->base);
|
||||
|
||||
/* Configure SSI */
|
||||
SSIConfigSetExpClk(cfg->base, sys_clock_hw_cycles_per_sec(), prot,
|
||||
SSIConfigSetExpClk(cfg->base, DT_CPU_CLOCK_FREQUENCY, prot,
|
||||
SSI_MODE_MASTER, config->frequency, 8);
|
||||
|
||||
if (SPI_MODE_GET(config->operation) & SPI_MODE_LOOP) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue