diff --git a/boards/cc2538dk/include/periph_conf.h b/boards/cc2538dk/include/periph_conf.h index 4f020a128f81cab8b2c4957574edbefe834ac100..098df406f4d72d4c16cca47ddfe589b1b94572a6 100644 --- a/boards/cc2538dk/include/periph_conf.h +++ b/boards/cc2538dk/include/periph_conf.h @@ -97,21 +97,6 @@ static const i2c_conf_t i2c_config[] = { #define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0])) /** @} */ -/** - * @brief Pre-calculated clock divider values based on a CLOCK_CORECLOCK (32MHz) - * - * Calculated with (CPSR * (SCR + 1)) = (CLOCK_CORECLOCK / bus_freq), where - * 1 < CPSR < 255 and - * 0 < SCR < 256 - */ -static const spi_clk_conf_t spi_clk_config[] = { - { .cpsr = 10, .scr = 31 }, /* 100khz */ - { .cpsr = 2, .scr = 39 }, /* 400khz */ - { .cpsr = 2, .scr = 15 }, /* 1MHz */ - { .cpsr = 2, .scr = 2 }, /* ~4.5MHz */ - { .cpsr = 2, .scr = 1 } /* ~10.7MHz */ -}; - /** * @name SPI configuration * @{ diff --git a/boards/openmote-b/include/periph_conf.h b/boards/openmote-b/include/periph_conf.h index a952f66aee58c352ce379aa6b296685bed1a8a7a..ec5a11bcf717a89b816e71431e9792b75ecc86d0 100644 --- a/boards/openmote-b/include/periph_conf.h +++ b/boards/openmote-b/include/periph_conf.h @@ -124,20 +124,6 @@ static const i2c_conf_t i2c_config[] = { #define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0])) /** @} */ -/** - * @brief Pre-calculated clock divider values based on a CLOCK_CORECLOCK (32MHz) - * - * Calculated with (CPSR * (SCR + 1)) = (CLOCK_CORECLOCK / bus_freq), - * where 1 < CPSR < 255 and 0 < SCR < 256 - */ -static const spi_clk_conf_t spi_clk_config[] = { - { .cpsr = 10, .scr = 31 }, /* 100khz */ - { .cpsr = 2, .scr = 39 }, /* 400khz */ - { .cpsr = 2, .scr = 15 }, /* 1MHz */ - { .cpsr = 2, .scr = 2 }, /* ~4.5MHz */ - { .cpsr = 2, .scr = 1 } /* ~10.7MHz */ -}; - /** * @name SPI configuration * @{ diff --git a/boards/openmote-cc2538/include/periph_conf.h b/boards/openmote-cc2538/include/periph_conf.h index 912c8bbf5a7d686fcfcc3c7961a692b327633f08..2db19aae76ee47f4e5bc985409e739cecde1594e 100644 --- a/boards/openmote-cc2538/include/periph_conf.h +++ b/boards/openmote-cc2538/include/periph_conf.h @@ -120,21 +120,6 @@ static const i2c_conf_t i2c_config[] = { #define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0])) /** @} */ -/** - * @brief Pre-calculated clock divider values based on a CLOCK_CORECLOCK (32MHz) - * - * Calculated with (CPSR * (SCR + 1)) = (CLOCK_CORECLOCK / bus_freq), where - * 1 < CPSR < 255 and - * 0 < SCR < 256 - */ -static const spi_clk_conf_t spi_clk_config[] = { - { .cpsr = 10, .scr = 31 }, /* 100khz */ - { .cpsr = 2, .scr = 39 }, /* 400khz */ - { .cpsr = 2, .scr = 15 }, /* 1MHz */ - { .cpsr = 2, .scr = 2 }, /* ~4.5MHz */ - { .cpsr = 2, .scr = 1 } /* ~10.7MHz */ -}; - /** * @name SPI configuration * @{ diff --git a/boards/remote-pa/include/periph_conf.h b/boards/remote-pa/include/periph_conf.h index c5fe4f3db732a70106371f8779eeeac18176cf26..a21e022c7c94e8617d437f3e7e86f6944031ca84 100644 --- a/boards/remote-pa/include/periph_conf.h +++ b/boards/remote-pa/include/periph_conf.h @@ -45,21 +45,6 @@ static const i2c_conf_t i2c_config[] = { #define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0])) /** @} */ -/** - * @brief Pre-calculated clock divider values based on a CLOCK_CORECLOCK (32MHz) - * - * Calculated with (CPSR * (SCR + 1)) = (CLOCK_CORECLOCK / bus_freq), where - * 1 < CPSR < 255 and - * 0 < SCR < 256 - */ -static const spi_clk_conf_t spi_clk_config[] = { - { .cpsr = 10, .scr = 31 }, /* 100khz */ - { .cpsr = 2, .scr = 39 }, /* 400khz */ - { .cpsr = 2, .scr = 15 }, /* 1MHz */ - { .cpsr = 2, .scr = 2 }, /* ~4.5MHz */ - { .cpsr = 2, .scr = 1 } /* ~10.7MHz */ -}; - /** * @name SPI configuration * @{ diff --git a/boards/remote-reva/include/periph_conf.h b/boards/remote-reva/include/periph_conf.h index ebec0f3207a7e31d637276023bf6732609b08031..c2d713d2d91c95891d791612dcaf19ee38df6892 100644 --- a/boards/remote-reva/include/periph_conf.h +++ b/boards/remote-reva/include/periph_conf.h @@ -49,21 +49,6 @@ static const i2c_conf_t i2c_config[] = { * @name SPI configuration * @{ */ -/** - * @brief Pre-calculated clock divider values based on a CLOCK_CORECLOCK (32MHz) - * - * Calculated with (CPSR * (SCR + 1)) = (CLOCK_CORECLOCK / bus_freq), where - * 1 < CPSR < 255 and - * 0 < SCR < 256 - */ -static const spi_clk_conf_t spi_clk_config[] = { - { .cpsr = 10, .scr = 31 }, /* 100khz */ - { .cpsr = 2, .scr = 39 }, /* 400khz */ - { .cpsr = 2, .scr = 15 }, /* 1MHz */ - { .cpsr = 2, .scr = 2 }, /* ~4.5MHz */ - { .cpsr = 2, .scr = 1 } /* ~10.7MHz */ -}; - static const spi_conf_t spi_config[] = { { .dev = SSI0, diff --git a/boards/remote-revb/include/periph_conf.h b/boards/remote-revb/include/periph_conf.h index 07e6a15479b8610934c48a008fc4d9b3b2351bf8..8b7322a3fa67741135604667c809f4e0919db2e5 100644 --- a/boards/remote-revb/include/periph_conf.h +++ b/boards/remote-revb/include/periph_conf.h @@ -52,21 +52,6 @@ static const i2c_conf_t i2c_config[] = { * @name SPI configuration * @{ */ -/** - * @brief Pre-calculated clock divider values based on a CLOCK_CORECLOCK (32MHz) - * - * Calculated with (CPSR * (SCR + 1)) = (CLOCK_CORECLOCK / bus_freq), where - * 1 < CPSR < 255 and - * 0 < SCR < 256 - */ -static const spi_clk_conf_t spi_clk_config[] = { - { .cpsr = 10, .scr = 31 }, /* 100khz */ - { .cpsr = 2, .scr = 39 }, /* 400khz */ - { .cpsr = 2, .scr = 15 }, /* 1MHz */ - { .cpsr = 2, .scr = 2 }, /* ~4.5MHz */ - { .cpsr = 2, .scr = 1 } /* ~10.7MHz */ -}; - static const spi_conf_t spi_config[] = { { .dev = SSI0, diff --git a/cpu/cc2538/include/periph_cpu.h b/cpu/cc2538/include/periph_cpu.h index 0508516e9629c7faf4d3cb9454c8ce69e1a78bab..6ebce4cc6f9726d6daa52fa082100da60403c8b4 100644 --- a/cpu/cc2538/include/periph_cpu.h +++ b/cpu/cc2538/include/periph_cpu.h @@ -195,6 +195,23 @@ typedef struct { uint8_t scr; /**< SCR clock divider */ } spi_clk_conf_t; +#ifndef BOARD_HAS_SPI_CLK_CONF +/** + * @brief Pre-calculated clock divider values based on a CLOCK_CORECLOCK (32MHz) + * + * SPI bus frequency = CLOCK_CORECLOCK / (CPSR * (SCR + 1)), with + * CPSR = 2..254 and even, + * SCR = 0..255 + */ +static const spi_clk_conf_t spi_clk_config[] = { + { .cpsr = 64, .scr = 4 }, /* 100khz */ + { .cpsr = 16, .scr = 4 }, /* 400khz */ + { .cpsr = 32, .scr = 0 }, /* 1.0MHz */ + { .cpsr = 2, .scr = 2 }, /* 5.3MHz */ + { .cpsr = 2, .scr = 1 } /* 8.0MHz */ +}; +#endif /* BOARD_HAS_SPI_CLK_CONF */ + /** * @name SPI configuration data structure * @{