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:
parent
7b26544547
commit
09c054b13c
5 changed files with 15 additions and 45 deletions
|
@ -16,7 +16,7 @@
|
|||
|
||||
struct mcux_lpuart_config {
|
||||
LPUART_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
|
||||
|
@ -239,15 +239,9 @@ static int mcux_lpuart_configure_init(const struct device *dev,
|
|||
{
|
||||
const struct mcux_lpuart_config *config = dev->config;
|
||||
struct mcux_lpuart_data *data = dev->data;
|
||||
const struct device *clock_dev;
|
||||
uint32_t clock_freq;
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -429,7 +423,7 @@ static const struct uart_driver_api mcux_lpuart_driver_api = {
|
|||
#define LPUART_MCUX_DECLARE_CFG(n, IRQ_FUNC_INIT) \
|
||||
static const struct mcux_lpuart_config mcux_lpuart_##n##_config = { \
|
||||
.base = (LPUART_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), \
|
||||
IRQ_FUNC_INIT \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue