drivers: serial: NXP: Convert clock control to use DEVICE_DT_GET

Replace device_get_binding with DEVICE_DT_GET for getting access
to the clock controller device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2021-02-11 19:23:55 -06:00 committed by Maureen Helm
commit 09c054b13c
5 changed files with 15 additions and 45 deletions

View file

@ -24,7 +24,7 @@
struct mcux_flexcomm_config {
USART_Type *base;
char *clock_name;
const struct device *clock_dev;
clock_control_subsys_t clock_subsys;
uint32_t baud_rate;
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
@ -248,15 +248,9 @@ static int mcux_flexcomm_init(const struct device *dev)
const struct mcux_flexcomm_config *config = dev->config;
usart_config_t usart_config;
uint32_t clock_freq;
const struct device *clock_dev;
/* Get the clock frequency */
clock_dev = device_get_binding(config->clock_name);
if (clock_dev == NULL) {
return -EINVAL;
}
if (clock_control_get_rate(clock_dev, config->clock_subsys,
if (clock_control_get_rate(config->clock_dev, config->clock_subsys,
&clock_freq)) {
return -EINVAL;
}
@ -323,7 +317,7 @@ static const struct uart_driver_api mcux_flexcomm_driver_api = {
#define UART_MCUX_FLEXCOMM_DECLARE_CFG(n, IRQ_FUNC_INIT) \
static const struct mcux_flexcomm_config mcux_flexcomm_##n##_config = { \
.base = (USART_Type *)DT_INST_REG_ADDR(n), \
.clock_name = DT_INST_CLOCKS_LABEL(n), \
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(n)), \
.clock_subsys = \
(clock_control_subsys_t)DT_INST_CLOCKS_CELL(n, name),\
.baud_rate = DT_INST_PROP(n, current_speed), \