Skip to content

Commit f1b57f6

Browse files
mmahadevan108nashif
authored andcommitted
drivers: i3c: Move clocking code out of NXP I3C driver
The clocking code present inside the NXP I3C is SoC specific. This has been moved to the SoC folder which makes this driver more flexible to clock architecture variations between SoC's and SDK driver clock API variations. Signed-off-by: Mahesh Mahadevan <[email protected]>
1 parent e14c4f4 commit f1b57f6

File tree

1 file changed

+5
-31
lines changed

1 file changed

+5
-31
lines changed

drivers/i3c/i3c_mcux.c

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -98,27 +98,8 @@ struct mcux_i3c_data {
9898
/** Condvar for waiting for bus to be in IDLE state */
9999
struct k_condvar condvar;
100100

101-
struct {
102-
/**
103-
* Clock divider for use when generating clock for
104-
* I3C Push-pull mode.
105-
*/
106-
uint8_t clk_div_pp;
107-
108-
/**
109-
* Clock divider for use when generating clock for
110-
* I3C open drain mode.
111-
*/
112-
uint8_t clk_div_od;
113-
114-
/**
115-
* Clock divider for the slow time control clock.
116-
*/
117-
uint8_t clk_div_tc;
118-
119-
/** I3C open drain clock frequency in Hz. */
120-
uint32_t i3c_od_scl_hz;
121-
} clocks;
101+
/** I3C open drain clock frequency in Hz. */
102+
uint32_t i3c_od_scl_hz;
122103

123104
#ifdef CONFIG_I3C_USE_IBI
124105
struct {
@@ -1912,8 +1893,8 @@ static int mcux_i3c_configure(const struct device *dev,
19121893
master_config.baudRate_Hz.i3cPushPullBaud = ctrl_cfg->scl.i3c;
19131894
master_config.enableOpenDrainHigh = dev_cfg->disable_open_drain_high_pp ? false : true;
19141895

1915-
if (dev_data->clocks.i3c_od_scl_hz) {
1916-
master_config.baudRate_Hz.i3cOpenDrainBaud = dev_data->clocks.i3c_od_scl_hz;
1896+
if (dev_data->i3c_od_scl_hz) {
1897+
master_config.baudRate_Hz.i3cOpenDrainBaud = dev_data->i3c_od_scl_hz;
19171898
}
19181899

19191900
/* Initialize hardware */
@@ -1979,10 +1960,6 @@ static int mcux_i3c_init(const struct device *dev)
19791960
goto err_out;
19801961
}
19811962

1982-
CLOCK_SetClkDiv(kCLOCK_DivI3cClk, data->clocks.clk_div_pp);
1983-
CLOCK_SetClkDiv(kCLOCK_DivI3cSlowClk, data->clocks.clk_div_od);
1984-
CLOCK_SetClkDiv(kCLOCK_DivI3cTcClk, data->clocks.clk_div_tc);
1985-
19861963
ret = pinctrl_apply_state(config->pincfg, PINCTRL_STATE_DEFAULT);
19871964
if (ret != 0) {
19881965
goto err_out;
@@ -2159,12 +2136,9 @@ static const struct i3c_driver_api mcux_i3c_driver_api = {
21592136
DT_INST_PROP(id, disable_open_drain_high_pp), \
21602137
}; \
21612138
static struct mcux_i3c_data mcux_i3c_data_##id = { \
2162-
.clocks.i3c_od_scl_hz = DT_INST_PROP_OR(id, i3c_od_scl_hz, 0), \
2139+
.i3c_od_scl_hz = DT_INST_PROP_OR(id, i3c_od_scl_hz, 0), \
21632140
.common.ctrl_config.scl.i3c = DT_INST_PROP_OR(id, i3c_scl_hz, 0), \
21642141
.common.ctrl_config.scl.i2c = DT_INST_PROP_OR(id, i2c_scl_hz, 0), \
2165-
.clocks.clk_div_pp = DT_INST_PROP(id, clk_divider), \
2166-
.clocks.clk_div_od = DT_INST_PROP(id, clk_divider_slow), \
2167-
.clocks.clk_div_tc = DT_INST_PROP(id, clk_divider_tc), \
21682142
}; \
21692143
DEVICE_DT_INST_DEFINE(id, \
21702144
mcux_i3c_init, \

0 commit comments

Comments
 (0)