Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion drivers/adc/adc_mcux_lpadc.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,7 @@ static DEVICE_API(adc, mcux_lpadc_driver_api) = {
static void mcux_lpadc_config_func_##n(const struct device *dev); \
\
PINCTRL_DT_INST_DEFINE(n); \
CLOCK_CONTROL_DT_SPEC_INST_DEFINE(n, clocks); \
static const struct mcux_lpadc_config mcux_lpadc_config_##n = { \
.base = (ADC_Type *)DT_INST_REG_ADDR(n), \
.voltage_ref = DT_INST_PROP(n, voltage_ref), \
Expand All @@ -575,7 +576,7 @@ static DEVICE_API(adc, mcux_lpadc_driver_api) = {
(DEVICE_DT_GET(DT_PHANDLE(DT_DRV_INST(n),\
nxp_references))), (NULL)),\
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(n)), \
.clock_subsys = (clock_control_subsys_t)DT_INST_CLOCKS_CELL(n, name),\
.clock_subsys = CLOCK_CONTROL_DT_SPEC_INST_GET(n, clocks),\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering 99.99% of uage will be with with prop=clocks, I'd make specialized versions of the macro that include it directly, e.g.

#define CLOCK_CONTROL_DT_SPEC_INST_GET_DEFAULT(inst) /* ... */
Suggested change
.clock_subsys = CLOCK_CONTROL_DT_SPEC_INST_GET(n, clocks),\
.clock_subsys = CLOCK_CONTROL_DT_SPEC_INST_GET_DEFAULT(n),\

Ditto for DEFINE.

Copy link
Member Author

@decsny decsny Sep 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally when I was making this PR, I did do something about this where you optionally don't have to say "clocks", by using variable arguments but I decided for first pass to just be explicit

.ref_supply_val = COND_CODE_1(\
DT_INST_NODE_HAS_PROP(n, nxp_references),\
(DT_PHA(DT_DRV_INST(n), nxp_references, vref_mv)), \
Expand Down
4 changes: 2 additions & 2 deletions drivers/audio/dmic_mcux.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,11 +709,11 @@ static const struct _dmic_ops dmic_ops = {
}; \
\
PINCTRL_DT_INST_DEFINE(idx); \
CLOCK_CONTROL_DT_SPEC_INST_DEFINE(idx, clocks); \
static struct mcux_dmic_cfg mcux_dmic_cfg##idx = { \
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(idx), \
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(idx)), \
.clock_name = (clock_control_subsys_t) \
DT_INST_CLOCKS_CELL(idx, name), \
.clock_name = CLOCK_CONTROL_DT_SPEC_INST_GET(idx, clocks), \
.use2fs = DT_INST_PROP(idx, use2fs), \
}; \
\
Expand Down
5 changes: 3 additions & 2 deletions drivers/can/can_mcux_flexcan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1425,6 +1425,8 @@ static DEVICE_API(can, mcux_flexcan_fd_driver_api) = {
#define FLEXCAN_DEVICE_INIT_MCUX(id) \
PINCTRL_DT_INST_DEFINE(id); \
\
CLOCK_CONTROL_DT_SPEC_INST_DEFINE(id, clocks); \
\
static void mcux_flexcan_irq_config_##id(const struct device *dev); \
static void mcux_flexcan_irq_enable_##id(void); \
static void mcux_flexcan_irq_disable_##id(void); \
Expand All @@ -1433,8 +1435,7 @@ static DEVICE_API(can, mcux_flexcan_fd_driver_api) = {
DEVICE_MMIO_NAMED_ROM_INIT(flexcan_mmio, DT_DRV_INST(id)), \
.common = CAN_DT_DRIVER_CONFIG_INST_GET(id, 0, FLEXCAN_MAX_BITRATE(id)), \
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(id)), \
.clock_subsys = (clock_control_subsys_t) \
DT_INST_CLOCKS_CELL(id, name), \
.clock_subsys = CLOCK_CONTROL_DT_SPEC_INST_GET(id, clocks), \
.clk_source = DT_INST_PROP(id, clk_source), \
IF_ENABLED(CONFIG_CAN_MCUX_FLEXCAN_FD, ( \
.flexcan_fd = DT_INST_NODE_HAS_COMPAT(id, FLEXCAN_FD_DRV_COMPAT), \
Expand Down
3 changes: 2 additions & 1 deletion drivers/can/can_mcux_mcan.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ static const struct can_mcan_ops mcux_mcan_ops = {
#define MCUX_MCAN_INIT(n) \
CAN_MCAN_DT_INST_BUILD_ASSERT_MRAM_CFG(n); \
PINCTRL_DT_INST_DEFINE(n); \
CLOCK_CONTROL_DT_SPEC_INST_DEFINE(n, clocks); \
\
static void mcux_mcan_irq_config_##n(const struct device *dev); \
\
Expand All @@ -206,7 +207,7 @@ static const struct can_mcan_ops mcux_mcan_ops = {
.mram = (mem_addr_t)POINTER_TO_UINT(&mcux_mcan_mram_##n), \
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(n)), \
.clock_subsys = (clock_control_subsys_t) \
DT_INST_CLOCKS_CELL(n, name), \
CLOCK_CONTROL_DT_SPEC_INST_GET(n, clocks), \
.irq_config_func = mcux_mcan_irq_config_##n, \
.pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \
.reset = RESET_DT_SPEC_INST_GET(n), \
Expand Down
36 changes: 36 additions & 0 deletions drivers/clock_control/clock_control_mcux_sim.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,42 @@
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(clock_control);

struct kinetis_sim_spec {
uint32_t name;
uint32_t offset;
uint32_t bits;
};

static int kinetis_sim_get_spec(clock_control_subsys_t subsys, struct kinetis_sim_spec *spec)
{
struct clock_control_dt_spec *dt_spec = subsys;

if (dt_spec->len != 3) {
return -EINVAL;
}

spec->name = dt_spec->cells[0];
spec->offset = dt_spec->cells[1];
spec->bits = dt_spec->cells[2];

return 0;
}

static int kinetis_sim_get_key(clock_control_subsys_t subsys, uint32_t *key)
{
struct kinetis_sim_spec spec;
int ret;

ret = kinetis_sim_get_spec(subsys, &spec);
if (ret) {
return ret;
}

*key = CLK_GATE_DEFINE(spec.offset, spec.bits);

return 0;
}

static int mcux_sim_on(const struct device *dev,
clock_control_subsys_t sub_system)
{
Expand Down
65 changes: 60 additions & 5 deletions drivers/clock_control/clock_control_mcux_syscon.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,48 @@
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(clock_control);

struct lpc_syscon_spec {
uint32_t name;
};

static int lpc_syscon_get_spec(clock_control_subsys_t subsys, struct lpc_syscon_spec *spec)
{
struct clock_control_dt_spec *dt_spec = subsys;

if (dt_spec->len != 1) {
return -EINVAL;
}

spec->name = *(dt_spec->cells);

return 0;
}
Comment on lines +18 to +33
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be clear: this is merely for example, and it would be fine for drivers to do instead

+#define LPC_CELL_NAME 0

static int mcux_lpc_syscon_clock_control_on(const struct device *dev,
					    clock_control_subsys_t sub_system)
{
#if defined(CONFIG_CAN_MCUX_MCAN)
-	if ((uint32_t)sub_system == MCUX_MCAN_CLK) {
+       if (sub_system->cells[LPC_CELL_NAME] == MCUX_MCAN_CLK) {
		CLOCK_EnableClock(kCLOCK_Mcan);
	}
#endif /* defined(CONFIG_CAN_MCUX_MCAN) */

for example?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The drivers can do whatever they want. This lpc syscon driver right now is really bad right now and probably needs the DT binding actually changed and driver optimized so that it isn't 5 million ifs, and is some more useful info instead. The benefit of unifying under these macros is that type of change can be done without having to edit any clock control consumer's code. And nxp has like 10 clock control drivers so I will be leaving these optimization activities to other NXP developer, but right now I'm trying to make it so that they can do that work without all of them having to update 200 consumer drivers for each PR


static int lpc_syscon_get_name(clock_control_subsys_t dt_spec, uint32_t *name)
{
struct lpc_syscon_spec spec;
int ret;

ret = lpc_syscon_get_spec(dt_spec, &spec);
if (ret) {
return ret;
}

*name = spec.name;

return 0;
}

static int mcux_lpc_syscon_clock_control_on(const struct device *dev,
clock_control_subsys_t sub_system)
clock_control_subsys_t subsys)
{
uint32_t sub_system;

lpc_syscon_get_name(subsys, &sub_system);
if (ret) {
return ret;
}

#if defined(CONFIG_CAN_MCUX_MCAN)
if ((uint32_t)sub_system == MCUX_MCAN_CLK) {
CLOCK_EnableClock(kCLOCK_Mcan);
Expand Down Expand Up @@ -149,7 +188,12 @@ static int mcux_lpc_syscon_clock_control_get_subsys_rate(const struct device *de
clock_control_subsys_t sub_system,
uint32_t *rate)
{
uint32_t clock_name = (uint32_t)sub_system;
uint32_t clock_name = 0;

lpc_syscon_get_name(sub_system, &clock_name);
if (ret) {
return ret;
}

switch (clock_name) {

Expand Down Expand Up @@ -602,9 +646,14 @@ __weak int flexspi_clock_set_freq(uint32_t clock_name, uint32_t freq)
static int SYSCON_SET_FUNC_ATTR mcux_lpc_syscon_clock_control_set_subsys_rate(
const struct device *dev, clock_control_subsys_t subsys, clock_control_subsys_rate_t rate)
{
uint32_t clock_name = (uintptr_t)subsys;
uint32_t clock_name;
uint32_t clock_rate = (uintptr_t)rate;

lpc_syscon_get_name(subsys, &clock_name);
if (ret) {
return ret;
}

switch (clock_name) {
case MCUX_FLEXSPI_CLK:
#if defined(CONFIG_MEMC)
Expand Down Expand Up @@ -632,10 +681,16 @@ static int SYSCON_SET_FUNC_ATTR mcux_lpc_syscon_clock_control_set_subsys_rate(
static int mcux_lpc_syscon_clock_control_configure(const struct device *dev,
clock_control_subsys_t sub_system, void *data)
{
uint32_t clock_name = 0;
int flexcomm_num = -1;

lpc_syscon_get_name(sub_system, &clock_name);
if (ret) {
return ret;
}

#ifdef CONFIG_SOC_SERIES_RW6XX
#define FLEXCOMM_LP_CLK_DECODE(n) (n & 0x80)
uint32_t clock_name = (uint32_t)sub_system;
int flexcomm_num = -1;

switch (clock_name) {
case MCUX_FLEXCOMM0_CLK:
Expand Down
4 changes: 2 additions & 2 deletions drivers/counter/counter_mcux_ctimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ static DEVICE_API(counter, mcux_ctimer_driver_api) = {

#define COUNTER_LPC_CTIMER_DEVICE(id) \
static void mcux_lpc_ctimer_irq_config_##id(const struct device *dev); \
CLOCK_CONTROL_DT_SPEC_INST_DEFINE(id, clocks); \
static struct mcux_lpc_ctimer_config mcux_lpc_ctimer_config_##id = { \
.info = { \
.max_top_value = UINT32_MAX, \
Expand All @@ -326,8 +327,7 @@ static DEVICE_API(counter, mcux_ctimer_driver_api) = {
},\
.base = (CTIMER_Type *)DT_INST_REG_ADDR(id), \
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(id)), \
.clock_subsys = \
(clock_control_subsys_t)(DT_INST_CLOCKS_CELL(id, name)),\
.clock_subsys = CLOCK_CONTROL_DT_SPEC_INST_GET(id, clocks),\
.mode = DT_INST_PROP(id, mode), \
.input = DT_INST_PROP(id, input), \
.prescale = DT_INST_PROP(id, prescale), \
Expand Down
3 changes: 2 additions & 1 deletion drivers/counter/counter_mcux_ftm.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ static DEVICE_API(counter, mcux_ftm_driver_api) = {
#define COUNTER_MCUX_FTM_DEVICE_INIT(n) \
static struct mcux_ftm_data mcux_ftm_data_##n; \
static void mcux_ftm_irq_config_##n(const struct device *dev); \
CLOCK_CONTROL_DT_SPEC_INST_DEFINE(n, clocks); \
\
static const struct mcux_ftm_config mcux_ftm_config_##n = { \
.info = \
Expand All @@ -179,7 +180,7 @@ static DEVICE_API(counter, mcux_ftm_driver_api) = {
}, \
.base = (FTM_Type *)DT_INST_REG_ADDR(n), \
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(n)), \
.clock_subsys = (clock_control_subsys_t)DT_INST_CLOCKS_CELL(n, name), \
.clock_subsys = CLOCK_CONTROL_DT_SPEC_INST_GET(n, clocks), \
.ftm_clock_source = (ftm_clock_source_t)(DT_INST_ENUM_IDX(n, clock_source) + 1U), \
.prescale = TO_FTM_PRESCALE_DIVIDE(DT_INST_PROP(n, prescaler)), \
.irq_config_func = mcux_ftm_irq_config_##n, \
Expand Down
5 changes: 4 additions & 1 deletion drivers/counter/counter_mcux_lpit.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ static DEVICE_API(counter, mcux_lpit_driver_api) = {
#define COUNTER_MCUX_LPIT_DEVICE_INIT(n) \
\
/* Setup the IRQ either for parent irq or per channel irq */ \
MCUX_LPIT_SETUP_IRQ_CONFIG(n) \
\
CLOCK_CONTROL_DT_SPEC_INST_DEFINE(n, clocks); \
MCUX_LPIT_SETUP_IRQ_CONFIG(n) \
\
/* Create channel declarations */ \
Expand Down Expand Up @@ -277,7 +280,7 @@ static DEVICE_API(counter, mcux_lpit_driver_api) = {
.num_channels = DT_INST_FOREACH_CHILD_SEP_VARGS(n, DT_NODE_HAS_COMPAT, (+), \
nxp_lpit_channel), \
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(n)), \
.clock_subsys = (clock_control_subsys_t)DT_INST_CLOCKS_CELL(n, name), \
.clock_subsys = CLOCK_CONTROL_DT_SPEC_INST_GET(n, clocks), \
.data = mcux_lpit_##n##_channel_datas, \
.channels = mcux_lpit_##n##_channels, \
}; \
Expand Down
3 changes: 2 additions & 1 deletion drivers/counter/counter_mcux_qtmr.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,13 +302,14 @@ static DEVICE_API(counter, mcux_qtmr_driver_api) = {
};

#define TMR_DEVICE_INIT_MCUX(n) \
CLOCK_CONTROL_DT_SPEC_INST_DEFINE(n, clocks); \
static struct mcux_qtmr_data mcux_qtmr_data_ ## n; \
\
static const struct mcux_qtmr_config mcux_qtmr_config_ ## n = { \
.base = (void *)DT_REG_ADDR(DT_INST_PARENT(n)), \
.clock_dev = DEVICE_DT_GET(DT_CLOCKS_CTLR(DT_INST_PARENT(n))), \
.clock_subsys = \
(clock_control_subsys_t)DT_CLOCKS_CELL(DT_INST_PARENT(n), name), \
CLOCK_CONTROL_DT_SPEC_INST_GET(n, clocks), \
.info = { \
.max_top_value = UINT16_MAX, \
.freq = DT_INST_PROP_OR(n, freq, 0), \
Expand Down
3 changes: 2 additions & 1 deletion drivers/counter/counter_mcux_tpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,13 @@ static DEVICE_API(counter, mcux_tpm_driver_api) = {
#define TPM_DEVICE_INIT_MCUX(n) \
static struct mcux_tpm_data mcux_tpm_data_ ## n; \
static void mcux_tpm_irq_config_ ## n(void); \
CLOCK_CONTROL_DT_SPEC_INST_DEFINE(n, clocks); \
\
static const struct mcux_tpm_config mcux_tpm_config_ ## n = { \
DEVICE_MMIO_NAMED_ROM_INIT(tpm_mmio, DT_DRV_INST(n)), \
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(n)), \
.clock_subsys = \
(clock_control_subsys_t)DT_INST_CLOCKS_CELL(n, name), \
CLOCK_CONTROL_DT_SPEC_INST_GET(n, clocks), \
.tpm_clock_source = kTPM_SystemClock, \
.prescale = TO_TPM_PRESCALE_DIVIDE(DT_INST_PROP(n, prescaler)), \
.info = { \
Expand Down
6 changes: 4 additions & 2 deletions drivers/counter/counter_nxp_mrt.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ DEVICE_API(counter, nxp_mrt_api) = {
/* Initialize all the data structs for active channels */ \
DT_INST_FOREACH_CHILD_STATUS_OKAY(n, NXP_MRT_CHANNEL_DATA_INIT) \
\
/* Define clock control subsystem */ \
CLOCK_CONTROL_DT_SPEC_INST_DEFINE(n, clocks); \
\
/* Create an array of const pointers to the data structs */ \
static struct nxp_mrt_channel_data *const nxp_mrt_##n##_channel_datas \
[DT_INST_PROP(n, num_channels)] = { \
Expand Down Expand Up @@ -367,8 +370,7 @@ DEVICE_API(counter, nxp_mrt_api) = {
}, \
.base = (MRT_Type *)DT_INST_REG_ADDR(n), \
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(n)), \
.clock_subsys = (clock_control_subsys_t) \
DT_INST_CLOCKS_CELL(n, name), \
.clock_subsys = CLOCK_CONTROL_DT_SPEC_INST_GET(n, clocks), \
.irq_config_func = nxp_mrt_##n##_irq_config_func, \
.data = nxp_mrt_##n##_channel_datas, \
.channels = nxp_mrt_##n##_channels, \
Expand Down
6 changes: 4 additions & 2 deletions drivers/counter/counter_nxp_pit.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,9 @@ static DEVICE_API(counter, nxp_pit_driver_api) = {
#define COUNTER_NXP_PIT_DEVICE_INIT(n) \
\
/* Setup the IRQ either for parent irq or per channel irq */ \
CLOCK_CONTROL_DT_SPEC_INST_DEFINE(n, clocks); \
\
/* Setup the IRQ either for parent irq or per channel irq */ \
NXP_PIT_SETUP_IRQ_CONFIG(n) \
\
/* Create channel declarations */ \
Expand Down Expand Up @@ -359,8 +362,7 @@ static DEVICE_API(counter, nxp_pit_driver_api) = {
.num_channels = DT_INST_FOREACH_CHILD_SEP_VARGS( \
n, DT_NODE_HAS_COMPAT, (+), nxp_pit_channel), \
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(n)), \
.clock_subsys = (clock_control_subsys_t) \
DT_INST_CLOCKS_CELL(n, name), \
.clock_subsys = CLOCK_CONTROL_DT_SPEC_INST_GET(n, clocks), \
.data = nxp_pit_##n##_channel_datas, \
.channels = nxp_pit_##n##_channels, \
}; \
Expand Down
6 changes: 4 additions & 2 deletions drivers/ethernet/eth_nxp_enet.c
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,8 @@ BUILD_ASSERT(NXP_ENET_PHY_MODE(DT_DRV_INST(n)) != NXP_ENET_RGMII_MODE || \
\
NXP_ENET_FRAMEINFO_ARRAY(n) \
\
CLOCK_CONTROL_DT_SPEC_INST_DEFINE(n, clocks); \
\
static void nxp_enet_##n##_irq_config_func(void) \
{ \
DT_INST_FOREACH_PROP_ELEM(n, interrupt_names, \
Expand Down Expand Up @@ -965,8 +967,8 @@ BUILD_ASSERT(NXP_ENET_PHY_MODE(DT_DRV_INST(n)) != NXP_ENET_RGMII_MODE || \
const struct nxp_enet_mac_config nxp_enet_##n##_config = { \
.irq_config_func = nxp_enet_##n##_irq_config_func, \
.module_dev = DEVICE_DT_GET(DT_INST_PARENT(n)), \
.clock_dev = DEVICE_DT_GET(DT_CLOCKS_CTLR(DT_INST_PARENT(n))), \
.clock_subsys = (void *)DT_CLOCKS_CELL_BY_IDX( \
.clock_dev = DEVICE_DT_GET(DT_CLOCKS_CTLR(DT_DRV_INST(n))), \
.clock_subsys = CLOCK_CONTROL_DT_SPEC_INST_GET(n, clocks), \
DT_INST_PARENT(n), 0, name), \
.pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \
.buffer_config = {{ \
Expand Down
3 changes: 2 additions & 1 deletion drivers/ethernet/eth_nxp_enet_qos/eth_nxp_enet_qos.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ int nxp_enet_qos_init(const struct device *dev)

#define NXP_ENET_QOS_INIT(n) \
PINCTRL_DT_INST_DEFINE(n); \
CLOCK_CONTROL_DT_SPEC_INST_DEFINE(n, clocks); \
\
static const struct nxp_enet_qos_config enet_qos_##n##_config = { \
.pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(n)), \
.clock_subsys = (void *)DT_INST_CLOCKS_CELL_BY_IDX(n, 0, name), \
.clock_subsys = CLOCK_CONTROL_DT_SPEC_INST_GET(n, clocks), \
.base = (enet_qos_t *)DT_INST_REG_ADDR(n), \
}; \
\
Expand Down
4 changes: 3 additions & 1 deletion drivers/gpio/gpio_lpc11u6x.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,11 @@ static DEVICE_API(gpio, gpio_lpc11u6x_driver_api) = {
* shared between all the ports (IRQ lines, clock).
*/

CLOCK_CONTROL_DT_SPEC_INST_DEFINE(0, clocks);

static const struct gpio_lpc11u6x_shared gpio_lpc11u6x_shared = {
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(0)),
.clock_subsys = (clock_control_subsys_t) DT_INST_PHA(0, clocks, clkid),
.clock_subsys = CLOCK_CONTROL_DT_SPEC_INST_GET(0, clocks),
.gpio_base = DT_INST_REG_ADDR_BY_IDX(0, 0),
.syscon_base = DT_INST_REG_ADDR_BY_IDX(0, 1),
.nirqs = DT_NUM_IRQS(DT_DRV_INST(0)),
Expand Down
4 changes: 3 additions & 1 deletion drivers/i2c/i2c_lpc11u6x.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,8 @@ static DEVICE_API(i2c, i2c_api) = {
\
static void lpc11u6x_i2c_isr_config_##idx(const struct device *dev); \
\
CLOCK_CONTROL_DT_SPEC_INST_DEFINE(idx, clocks); \
\
PINCTRL_DT_INST_DEFINE(idx); \
\
static const struct lpc11u6x_i2c_config i2c_cfg_##idx = { \
Expand All @@ -362,7 +364,7 @@ static const struct lpc11u6x_i2c_config i2c_cfg_##idx = { \
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(idx)), \
.irq_config_func = lpc11u6x_i2c_isr_config_##idx, \
.pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(idx), \
.clkid = DT_INST_PHA_BY_IDX(idx, clocks, 0, clkid), \
.clkid = CLOCK_CONTROL_DT_SPEC_INST_GET(idx, clocks), \
}; \
\
static struct lpc11u6x_i2c_data i2c_data_##idx; \
Expand Down
Loading
Loading