drivers: serial: pl011: Add capability for handling reset device
Reset the device on initializing if the node inherits `reset-device.yaml`. Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
This commit is contained in:
parent
155fee5924
commit
80b8ef80b3
|
@ -21,6 +21,9 @@
|
|||
#if defined(CONFIG_PINCTRL)
|
||||
#include <zephyr/drivers/pinctrl.h>
|
||||
#endif
|
||||
#if IS_ENABLED(CONFIG_RESET)
|
||||
#include <zephyr/drivers/reset.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CPU_CORTEX_M
|
||||
#include <cmsis_compiler.h>
|
||||
|
@ -35,6 +38,9 @@ struct pl011_config {
|
|||
#if defined(CONFIG_PINCTRL)
|
||||
const struct pinctrl_dev_config *pincfg;
|
||||
#endif
|
||||
#if IS_ENABLED(CONFIG_RESET)
|
||||
const struct reset_dt_spec reset;
|
||||
#endif
|
||||
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
|
||||
uart_irq_config_func_t irq_config_func;
|
||||
#endif
|
||||
|
@ -408,6 +414,15 @@ static int pl011_init(const struct device *dev)
|
|||
|
||||
DEVICE_MMIO_MAP(dev, K_MEM_CACHE_NONE);
|
||||
|
||||
#if IS_ENABLED(CONFIG_RESET)
|
||||
if (config->reset.dev) {
|
||||
ret = reset_line_toggle_dt(&config->reset);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If working in SBSA mode, we assume that UART is already configured,
|
||||
* or does not require configuration at all (if UART is emulated by
|
||||
|
@ -505,6 +520,13 @@ static int pl011_init(const struct device *dev)
|
|||
#define PINCTRL_INIT(n)
|
||||
#endif /* CONFIG_PINCTRL */
|
||||
|
||||
#if IS_ENABLED(CONFIG_RESET)
|
||||
#define RESET_INIT(n) \
|
||||
IF_ENABLED(DT_INST_NODE_HAS_PROP(0, resets), (.reset = RESET_DT_SPEC_INST_GET(n),))
|
||||
#else
|
||||
#define RESET_INIT(n)
|
||||
#endif
|
||||
|
||||
#define ARM_PL011_DEFINE(n) \
|
||||
static inline int pwr_on_arm_pl011_##n(void) \
|
||||
{ \
|
||||
|
|
Loading…
Reference in a new issue