serial: update mchp uart module to use pinctrl
Changes to uart module to support pinctrl Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
This commit is contained in:
parent
f8130d5ce3
commit
156440f3f0
2 changed files with 18 additions and 1 deletions
|
@ -26,6 +26,7 @@
|
|||
#include <linker/sections.h>
|
||||
#include <drivers/clock_control/mchp_xec_clock_control.h>
|
||||
#include <drivers/interrupt_controller/intc_mchp_xec_ecia.h>
|
||||
#include <drivers/pinctrl.h>
|
||||
#include <drivers/uart.h>
|
||||
#include <sys/sys_io.h>
|
||||
#include <spinlock.h>
|
||||
|
@ -173,6 +174,7 @@ struct uart_xec_device_config {
|
|||
uint8_t girq_pos;
|
||||
uint8_t pcr_idx;
|
||||
uint8_t pcr_bitpos;
|
||||
const struct pinctrl_dev_config *pcfg;
|
||||
#if defined(CONFIG_UART_INTERRUPT_DRIVEN) || defined(CONFIG_UART_ASYNC_API)
|
||||
uart_irq_config_func_t irq_config_func;
|
||||
#endif
|
||||
|
@ -367,6 +369,11 @@ static int uart_xec_init(const struct device *dev)
|
|||
return ret;
|
||||
}
|
||||
|
||||
ret = pinctrl_apply_state(dev_cfg->pcfg, PINCTRL_STATE_DEFAULT);
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = uart_xec_configure(dev, &dev_data->uart_config);
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
|
@ -869,6 +876,9 @@ static const struct uart_driver_api uart_xec_driver_api = {
|
|||
DT_INST_PROP_OR(n, hw_flow_control, UART_CFG_FLOW_CTRL_NONE)
|
||||
|
||||
#define UART_XEC_DEVICE_INIT(n) \
|
||||
\
|
||||
PINCTRL_DT_INST_DEFINE(n); \
|
||||
\
|
||||
UART_XEC_IRQ_FUNC_DECLARE(n); \
|
||||
\
|
||||
static const struct uart_xec_device_config uart_xec_dev_cfg_##n = { \
|
||||
|
@ -878,6 +888,7 @@ static const struct uart_driver_api uart_xec_driver_api = {
|
|||
.girq_pos = DT_INST_PROP_BY_IDX(n, girqs, 1), \
|
||||
.pcr_idx = DT_INST_PROP_BY_IDX(n, pcrs, 0), \
|
||||
.pcr_bitpos = DT_INST_PROP_BY_IDX(n, pcrs, 1), \
|
||||
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \
|
||||
DEV_CONFIG_IRQ_FUNC_INIT(n) \
|
||||
}; \
|
||||
static struct uart_xec_dev_data uart_xec_dev_data_##n = { \
|
||||
|
|
|
@ -2,7 +2,7 @@ description: Microchip XEC UART
|
|||
|
||||
compatible: "microchip,xec-uart"
|
||||
|
||||
include: uart-controller.yaml
|
||||
include: [uart-controller.yaml, pinctrl-device.yaml]
|
||||
|
||||
properties:
|
||||
reg:
|
||||
|
@ -26,6 +26,12 @@ properties:
|
|||
required: true
|
||||
description: UART Power Clock Reset(PCR) register index and bit position
|
||||
|
||||
pinctrl-0:
|
||||
required: true
|
||||
|
||||
pinctrl-names:
|
||||
required: true
|
||||
|
||||
"#girq-cells":
|
||||
type: int
|
||||
const: 2
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue