@@ -19,7 +19,7 @@ LOG_MODULE_REGISTER(mcux_flexcomm);
1919
2020struct mcux_flexcomm_config {
2121 I2C_Type * base ;
22- char * clock_name ;
22+ const struct device * clock_dev ;
2323 clock_control_subsys_t clock_subsys ;
2424 void (* irq_config_func )(const struct device * dev );
2525 uint32_t bitrate ;
@@ -28,15 +28,13 @@ struct mcux_flexcomm_config {
2828struct mcux_flexcomm_data {
2929 i2c_master_handle_t handle ;
3030 struct k_sem device_sync_sem ;
31- const struct device * dev_clock ;
3231 status_t callback_status ;
3332};
3433
3534static int mcux_flexcomm_configure (const struct device * dev ,
3635 uint32_t dev_config_raw )
3736{
3837 const struct mcux_flexcomm_config * config = dev -> config ;
39- struct mcux_flexcomm_data * data = dev -> data ;
4038 I2C_Type * base = config -> base ;
4139 uint32_t clock_freq ;
4240 uint32_t baudrate ;
@@ -64,7 +62,7 @@ static int mcux_flexcomm_configure(const struct device *dev,
6462 }
6563
6664 /* Get the clock frequency */
67- if (clock_control_get_rate (data -> dev_clock , config -> clock_subsys ,
65+ if (clock_control_get_rate (config -> clock_dev , config -> clock_subsys ,
6866 & clock_freq )) {
6967 return - EINVAL ;
7068 }
@@ -187,13 +185,8 @@ static int mcux_flexcomm_init(const struct device *dev)
187185
188186 k_sem_init (& data -> device_sync_sem , 0 , UINT_MAX );
189187
190- data -> dev_clock = device_get_binding (config -> clock_name );
191- if (data -> dev_clock == NULL ) {
192- return - ENODEV ;
193- }
194-
195188 /* Get the clock frequency */
196- if (clock_control_get_rate (data -> dev_clock , config -> clock_subsys ,
189+ if (clock_control_get_rate (config -> clock_dev , config -> clock_subsys ,
197190 & clock_freq )) {
198191 return - EINVAL ;
199192 }
@@ -225,7 +218,7 @@ static const struct i2c_driver_api mcux_flexcomm_driver_api = {
225218 static void mcux_flexcomm_config_func_##id(const struct device *dev); \
226219 static const struct mcux_flexcomm_config mcux_flexcomm_config_##id = { \
227220 .base = (I2C_Type *) DT_INST_REG_ADDR(id), \
228- .clock_name = DT_INST_CLOCKS_LABEL( id), \
221+ .clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR( id)), \
229222 .clock_subsys = \
230223 (clock_control_subsys_t)DT_INST_CLOCKS_CELL(id, name),\
231224 .irq_config_func = mcux_flexcomm_config_func_##id, \
0 commit comments