@@ -32,7 +32,6 @@ static int lpc11u6x_i2c_configure(const struct device *dev,
32
32
{
33
33
const struct lpc11u6x_i2c_config * cfg = dev -> config ;
34
34
struct lpc11u6x_i2c_data * data = dev -> data ;
35
- const struct device * clk_dev ;
36
35
uint32_t speed ;
37
36
int ret ;
38
37
uint8_t mux_selection = PINCTRL_STATE_DEFAULT ;
@@ -59,13 +58,8 @@ static int lpc11u6x_i2c_configure(const struct device *dev,
59
58
return - ENOTSUP ;
60
59
}
61
60
62
- clk_dev = device_get_binding (cfg -> clock_drv );
63
- if (!clk_dev ) {
64
- return - EINVAL ;
65
- }
66
-
67
61
k_mutex_lock (& data -> mutex , K_FOREVER );
68
- lpc11u6x_i2c_set_bus_speed (cfg , clk_dev , speed );
62
+ lpc11u6x_i2c_set_bus_speed (cfg , cfg -> clock_dev , speed );
69
63
70
64
ret = pinctrl_apply_state (cfg -> pincfg , mux_selection );
71
65
if (ret ) {
@@ -313,7 +307,6 @@ static int lpc11u6x_i2c_init(const struct device *dev)
313
307
{
314
308
const struct lpc11u6x_i2c_config * cfg = dev -> config ;
315
309
struct lpc11u6x_i2c_data * data = dev -> data ;
316
- const struct device * clk_dev ;
317
310
int err ;
318
311
319
312
err = pinctrl_apply_state (cfg -> pincfg , PINCTRL_STATE_DEFAULT );
@@ -322,14 +315,10 @@ static int lpc11u6x_i2c_init(const struct device *dev)
322
315
}
323
316
324
317
/* Configure clock and de-assert reset for I2Cx */
325
- clk_dev = device_get_binding (cfg -> clock_drv );
326
- if (!clk_dev ) {
327
- return - EINVAL ;
328
- }
329
- clock_control_on (clk_dev , (clock_control_subsys_t ) cfg -> clkid );
318
+ clock_control_on (cfg -> clock_dev , (clock_control_subsys_t ) cfg -> clkid );
330
319
331
320
/* Configure bus speed. Default is 100KHz */
332
- lpc11u6x_i2c_set_bus_speed (cfg , clk_dev , 100000 );
321
+ lpc11u6x_i2c_set_bus_speed (cfg , cfg -> clock_dev , 100000 );
333
322
334
323
/* Clear all control bytes and enable I2C interface */
335
324
cfg -> base -> con_clr = LPC11U6X_I2C_CONTROL_AA | LPC11U6X_I2C_CONTROL_SI |
@@ -362,7 +351,7 @@ PINCTRL_DT_INST_DEFINE(idx); \
362
351
static const struct lpc11u6x_i2c_config i2c_cfg_##idx = { \
363
352
.base = \
364
353
(struct lpc11u6x_i2c_regs *) DT_INST_REG_ADDR(idx), \
365
- .clock_drv = DT_LABEL(DT_INST_PHANDLE (idx, clocks )), \
354
+ .clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR (idx)), \
366
355
.irq_config_func = lpc11u6x_i2c_isr_config_##idx, \
367
356
.pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(idx), \
368
357
.clkid = DT_INST_PHA_BY_IDX(idx, clocks, 0, clkid), \
0 commit comments