drivers: i2c_cc32xx: Get clock frequency from DTS
The i2c_cc32xx driver used system clock frequency as a base for I2C clock frequency calculation. This commit corrects that by obtaining the needed value from DTS. Please note, that for I2C devices the clock-frequency property specifies SCK frequency, instead of frequency of the clock driving peripheral. To solve that problem, a new property was added. Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
This commit is contained in:
parent
5f6cae38db
commit
8f22b16b6c
2 changed files with 2 additions and 1 deletions
|
@ -103,7 +103,7 @@ static int i2c_cc32xx_configure(struct device *dev, u32_t dev_config_raw)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
MAP_I2CMasterInitExpClk(base, CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC,
|
||||
MAP_I2CMasterInitExpClk(base, DT_I2C_0_CLOCK_FREQUENCY,
|
||||
bitrate_id);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#define DT_I2C_0_LABEL DT_TI_CC32XX_I2C_40020000_LABEL
|
||||
#define DT_I2C_0_BASE_ADDRESS DT_TI_CC32XX_I2C_40020000_BASE_ADDRESS
|
||||
#define DT_I2C_0_BITRATE DT_TI_CC32XX_I2C_40020000_CLOCK_FREQUENCY
|
||||
#define DT_I2C_0_CLOCK_FREQUENCY DT_TI_CC32XX_I2C_40020000_CLOCKS_CLOCK_FREQUENCY
|
||||
#define DT_I2C_0_IRQ DT_TI_CC32XX_I2C_40020000_IRQ_0
|
||||
#define DT_I2C_0_IRQ_PRIORITY DT_TI_CC32XX_I2C_40020000_IRQ_0_PRIORITY
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue