soc: riscv: sifive-freedom: Get coreclk and peripheral clock from DTS.

Rather than specify input clock for each peripheral individually, instead
specify the relevant clocks in DTS.

This will enable easier support for non-default coreclk on fe310 in a
follow-up CL.

Signed-off-by: Shawn Nematbakhsh <shawn@rivosinc.com>
This commit is contained in:
Shawn Nematbakhsh 2022-03-31 10:51:54 -07:00 committed by Carles Cufí
commit c74526919d
18 changed files with 91 additions and 49 deletions

View file

@ -12,6 +12,7 @@ LOG_MODULE_REGISTER(i2c_sifive);
#include <device.h>
#include <drivers/i2c.h>
#include <soc.h>
#include <sys/sys_io.h>
#include "i2c-priv.h"
@ -326,7 +327,7 @@ static struct i2c_driver_api i2c_sifive_api = {
#define I2C_SIFIVE_INIT(n) \
static struct i2c_sifive_cfg i2c_sifive_cfg_##n = { \
.base = DT_INST_REG_ADDR(n), \
.f_sys = DT_INST_PROP(n, input_frequency), \
.f_sys = SIFIVE_PERIPHERAL_CLOCK_FREQUENCY, \
.f_bus = DT_INST_PROP(n, clock_frequency), \
}; \
I2C_DEVICE_DT_INST_DEFINE(n, \