Skip to content

Commit c84b6ae

Browse files
author
Declan Snyder
committed
WIP converting NXP clock consumers
there might be some copy paste mistakes and stuff, it's just a concept commit at the moment this one will be squashed into the previous one for bisectability
1 parent a190843 commit c84b6ae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+139
-85
lines changed

drivers/adc/adc_mcux_lpadc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,7 @@ static DEVICE_API(adc, mcux_lpadc_driver_api) = {
562562
static void mcux_lpadc_config_func_##n(const struct device *dev); \
563563
\
564564
PINCTRL_DT_INST_DEFINE(n); \
565+
CLOCK_CONTROL_DT_SPEC_INST_DEFINE(n, clocks); \
565566
static const struct mcux_lpadc_config mcux_lpadc_config_##n = { \
566567
.base = (ADC_Type *)DT_INST_REG_ADDR(n), \
567568
.voltage_ref = DT_INST_PROP(n, voltage_ref), \
@@ -575,7 +576,7 @@ static DEVICE_API(adc, mcux_lpadc_driver_api) = {
575576
(DEVICE_DT_GET(DT_PHANDLE(DT_DRV_INST(n),\
576577
nxp_references))), (NULL)),\
577578
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(n)), \
578-
.clock_subsys = (clock_control_subsys_t)DT_INST_CLOCKS_CELL(n, name),\
579+
.clock_subsys = CLOCK_CONTROL_DT_SPEC_INST_GET(n, clocks),\
579580
.ref_supply_val = COND_CODE_1(\
580581
DT_INST_NODE_HAS_PROP(n, nxp_references),\
581582
(DT_PHA(DT_DRV_INST(n), nxp_references, vref_mv)), \

drivers/audio/dmic_mcux.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,11 +709,11 @@ static const struct _dmic_ops dmic_ops = {
709709
}; \
710710
\
711711
PINCTRL_DT_INST_DEFINE(idx); \
712+
CLOCK_CONTROL_DT_SPEC_INST_DEFINE(idx, clocks); \
712713
static struct mcux_dmic_cfg mcux_dmic_cfg##idx = { \
713714
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(idx), \
714715
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(idx)), \
715-
.clock_name = (clock_control_subsys_t) \
716-
DT_INST_CLOCKS_CELL(idx, name), \
716+
.clock_name = CLOCK_CONTROL_DT_SPEC_INST_GET(idx, clocks), \
717717
.use2fs = DT_INST_PROP(idx, use2fs), \
718718
}; \
719719
\

drivers/can/can_mcux_flexcan.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,6 +1425,8 @@ static DEVICE_API(can, mcux_flexcan_fd_driver_api) = {
14251425
#define FLEXCAN_DEVICE_INIT_MCUX(id) \
14261426
PINCTRL_DT_INST_DEFINE(id); \
14271427
\
1428+
CLOCK_CONTROL_DT_SPEC_INST_DEFINE(id, clocks); \
1429+
\
14281430
static void mcux_flexcan_irq_config_##id(const struct device *dev); \
14291431
static void mcux_flexcan_irq_enable_##id(void); \
14301432
static void mcux_flexcan_irq_disable_##id(void); \
@@ -1433,8 +1435,7 @@ static DEVICE_API(can, mcux_flexcan_fd_driver_api) = {
14331435
DEVICE_MMIO_NAMED_ROM_INIT(flexcan_mmio, DT_DRV_INST(id)), \
14341436
.common = CAN_DT_DRIVER_CONFIG_INST_GET(id, 0, FLEXCAN_MAX_BITRATE(id)), \
14351437
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(id)), \
1436-
.clock_subsys = (clock_control_subsys_t) \
1437-
DT_INST_CLOCKS_CELL(id, name), \
1438+
.clock_subsys = CLOCK_CONTROL_DT_SPEC_INST_GET(id, clocks), \
14381439
.clk_source = DT_INST_PROP(id, clk_source), \
14391440
IF_ENABLED(CONFIG_CAN_MCUX_FLEXCAN_FD, ( \
14401441
.flexcan_fd = DT_INST_NODE_HAS_COMPAT(id, FLEXCAN_FD_DRV_COMPAT), \

drivers/can/can_mcux_mcan.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ static const struct can_mcan_ops mcux_mcan_ops = {
195195
#define MCUX_MCAN_INIT(n) \
196196
CAN_MCAN_DT_INST_BUILD_ASSERT_MRAM_CFG(n); \
197197
PINCTRL_DT_INST_DEFINE(n); \
198+
CLOCK_CONTROL_DT_SPEC_INST_DEFINE(n, clocks); \
198199
\
199200
static void mcux_mcan_irq_config_##n(const struct device *dev); \
200201
\
@@ -206,7 +207,7 @@ static const struct can_mcan_ops mcux_mcan_ops = {
206207
.mram = (mem_addr_t)POINTER_TO_UINT(&mcux_mcan_mram_##n), \
207208
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(n)), \
208209
.clock_subsys = (clock_control_subsys_t) \
209-
DT_INST_CLOCKS_CELL(n, name), \
210+
CLOCK_CONTROL_DT_SPEC_INST_GET(n, clocks), \
210211
.irq_config_func = mcux_mcan_irq_config_##n, \
211212
.pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \
212213
.reset = RESET_DT_SPEC_INST_GET(n), \

drivers/counter/counter_mcux_ctimer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ static DEVICE_API(counter, mcux_ctimer_driver_api) = {
318318

319319
#define COUNTER_LPC_CTIMER_DEVICE(id) \
320320
static void mcux_lpc_ctimer_irq_config_##id(const struct device *dev); \
321+
CLOCK_CONTROL_DT_SPEC_INST_DEFINE(id, clocks); \
321322
static struct mcux_lpc_ctimer_config mcux_lpc_ctimer_config_##id = { \
322323
.info = { \
323324
.max_top_value = UINT32_MAX, \
@@ -326,8 +327,7 @@ static DEVICE_API(counter, mcux_ctimer_driver_api) = {
326327
},\
327328
.base = (CTIMER_Type *)DT_INST_REG_ADDR(id), \
328329
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(id)), \
329-
.clock_subsys = \
330-
(clock_control_subsys_t)(DT_INST_CLOCKS_CELL(id, name)),\
330+
.clock_subsys = CLOCK_CONTROL_DT_SPEC_INST_GET(id, clocks),\
331331
.mode = DT_INST_PROP(id, mode), \
332332
.input = DT_INST_PROP(id, input), \
333333
.prescale = DT_INST_PROP(id, prescale), \

drivers/counter/counter_mcux_ftm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ static DEVICE_API(counter, mcux_ftm_driver_api) = {
170170
#define COUNTER_MCUX_FTM_DEVICE_INIT(n) \
171171
static struct mcux_ftm_data mcux_ftm_data_##n; \
172172
static void mcux_ftm_irq_config_##n(const struct device *dev); \
173+
CLOCK_CONTROL_DT_SPEC_INST_DEFINE(n, clocks); \
173174
\
174175
static const struct mcux_ftm_config mcux_ftm_config_##n = { \
175176
.info = \
@@ -179,7 +180,7 @@ static DEVICE_API(counter, mcux_ftm_driver_api) = {
179180
}, \
180181
.base = (FTM_Type *)DT_INST_REG_ADDR(n), \
181182
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(n)), \
182-
.clock_subsys = (clock_control_subsys_t)DT_INST_CLOCKS_CELL(n, name), \
183+
.clock_subsys = CLOCK_CONTROL_DT_SPEC_INST_GET(n, clocks), \
183184
.ftm_clock_source = (ftm_clock_source_t)(DT_INST_ENUM_IDX(n, clock_source) + 1U), \
184185
.prescale = TO_FTM_PRESCALE_DIVIDE(DT_INST_PROP(n, prescaler)), \
185186
.irq_config_func = mcux_ftm_irq_config_##n, \

drivers/counter/counter_mcux_lpit.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,9 @@ static DEVICE_API(counter, mcux_lpit_driver_api) = {
235235
#define COUNTER_MCUX_LPIT_DEVICE_INIT(n) \
236236
\
237237
/* Setup the IRQ either for parent irq or per channel irq */ \
238+
MCUX_LPIT_SETUP_IRQ_CONFIG(n) \
239+
\
240+
CLOCK_CONTROL_DT_SPEC_INST_DEFINE(n, clocks); \
238241
MCUX_LPIT_SETUP_IRQ_CONFIG(n) \
239242
\
240243
/* Create channel declarations */ \
@@ -277,7 +280,7 @@ static DEVICE_API(counter, mcux_lpit_driver_api) = {
277280
.num_channels = DT_INST_FOREACH_CHILD_SEP_VARGS(n, DT_NODE_HAS_COMPAT, (+), \
278281
nxp_lpit_channel), \
279282
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(n)), \
280-
.clock_subsys = (clock_control_subsys_t)DT_INST_CLOCKS_CELL(n, name), \
283+
.clock_subsys = CLOCK_CONTROL_DT_SPEC_INST_GET(n, clocks), \
281284
.data = mcux_lpit_##n##_channel_datas, \
282285
.channels = mcux_lpit_##n##_channels, \
283286
}; \

drivers/counter/counter_mcux_qtmr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,14 @@ static DEVICE_API(counter, mcux_qtmr_driver_api) = {
302302
};
303303

304304
#define TMR_DEVICE_INIT_MCUX(n) \
305+
CLOCK_CONTROL_DT_SPEC_INST_DEFINE(n, clocks); \
305306
static struct mcux_qtmr_data mcux_qtmr_data_ ## n; \
306307
\
307308
static const struct mcux_qtmr_config mcux_qtmr_config_ ## n = { \
308309
.base = (void *)DT_REG_ADDR(DT_INST_PARENT(n)), \
309310
.clock_dev = DEVICE_DT_GET(DT_CLOCKS_CTLR(DT_INST_PARENT(n))), \
310311
.clock_subsys = \
311-
(clock_control_subsys_t)DT_CLOCKS_CELL(DT_INST_PARENT(n), name), \
312+
CLOCK_CONTROL_DT_SPEC_INST_GET(n, clocks), \
312313
.info = { \
313314
.max_top_value = UINT16_MAX, \
314315
.freq = DT_INST_PROP_OR(n, freq, 0), \

drivers/counter/counter_mcux_tpm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,13 @@ static DEVICE_API(counter, mcux_tpm_driver_api) = {
271271
#define TPM_DEVICE_INIT_MCUX(n) \
272272
static struct mcux_tpm_data mcux_tpm_data_ ## n; \
273273
static void mcux_tpm_irq_config_ ## n(void); \
274+
CLOCK_CONTROL_DT_SPEC_INST_DEFINE(n, clocks); \
274275
\
275276
static const struct mcux_tpm_config mcux_tpm_config_ ## n = { \
276277
DEVICE_MMIO_NAMED_ROM_INIT(tpm_mmio, DT_DRV_INST(n)), \
277278
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(n)), \
278279
.clock_subsys = \
279-
(clock_control_subsys_t)DT_INST_CLOCKS_CELL(n, name), \
280+
CLOCK_CONTROL_DT_SPEC_INST_GET(n, clocks), \
280281
.tpm_clock_source = kTPM_SystemClock, \
281282
.prescale = TO_TPM_PRESCALE_DIVIDE(DT_INST_PROP(n, prescaler)), \
282283
.info = { \

drivers/counter/counter_nxp_mrt.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,9 @@ DEVICE_API(counter, nxp_mrt_api) = {
338338
/* Initialize all the data structs for active channels */ \
339339
DT_INST_FOREACH_CHILD_STATUS_OKAY(n, NXP_MRT_CHANNEL_DATA_INIT) \
340340
\
341+
/* Define clock control subsystem */ \
342+
CLOCK_CONTROL_DT_SPEC_INST_DEFINE(n, clocks); \
343+
\
341344
/* Create an array of const pointers to the data structs */ \
342345
static struct nxp_mrt_channel_data *const nxp_mrt_##n##_channel_datas \
343346
[DT_INST_PROP(n, num_channels)] = { \
@@ -367,8 +370,7 @@ DEVICE_API(counter, nxp_mrt_api) = {
367370
}, \
368371
.base = (MRT_Type *)DT_INST_REG_ADDR(n), \
369372
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(n)), \
370-
.clock_subsys = (clock_control_subsys_t) \
371-
DT_INST_CLOCKS_CELL(n, name), \
373+
.clock_subsys = CLOCK_CONTROL_DT_SPEC_INST_GET(n, clocks), \
372374
.irq_config_func = nxp_mrt_##n##_irq_config_func, \
373375
.data = nxp_mrt_##n##_channel_datas, \
374376
.channels = nxp_mrt_##n##_channels, \

0 commit comments

Comments
 (0)