From cb47ed206bb72e7c3581fe1432e1e26bb4fffbda Mon Sep 17 00:00:00 2001 From: Chekhov Ma Date: Tue, 13 Aug 2024 14:05:12 +0800 Subject: [PATCH] boards: imx93_evk: document the configuration of board muxes Document the added board level driver to control EXP_SEL muxes Signed-off-by: Chekhov Ma --- boards/nxp/imx93_evk/board.c | 12 ++++-------- boards/nxp/imx93_evk/doc/index.rst | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/boards/nxp/imx93_evk/board.c b/boards/nxp/imx93_evk/board.c index 02f6b2b6165..169b6899849 100644 --- a/boards/nxp/imx93_evk/board.c +++ b/boards/nxp/imx93_evk/board.c @@ -11,8 +11,7 @@ LOG_MODULE_REGISTER(board_control, CONFIG_BOARD_MIMX93_EVK_LOG_LEVEL); -#if DT_HAS_COMPAT_STATUS_OKAY(imx93evk_exp_sel) && \ - IS_ENABLED(CONFIG_BOARD_MIMX93_EVK_EXP_SEL_INIT) +#if DT_HAS_COMPAT_STATUS_OKAY(imx93evk_exp_sel) && IS_ENABLED(CONFIG_BOARD_MIMX93_EVK_EXP_SEL_INIT) #define BOARD_EXP_SEL_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(imx93evk_exp_sel) @@ -22,8 +21,7 @@ LOG_MODULE_REGISTER(board_control, CONFIG_BOARD_MIMX93_EVK_LOG_LEVEL); static int board_init_exp_sel(void) { int rc = 0; - const struct gpio_dt_spec mux = - GPIO_DT_SPEC_GET(BOARD_EXP_SEL_NODE, mux_gpios); + const struct gpio_dt_spec mux = GPIO_DT_SPEC_GET(BOARD_EXP_SEL_NODE, mux_gpios); uint32_t pin_state = DT_ENUM_IDX(BOARD_EXP_SEL_NODE, mux); if (!gpio_is_ready_dt(&mux)) { @@ -43,10 +41,8 @@ static int board_init_exp_sel(void) LOG_ERR("Write EXP_SEL Pin error %d", rc); return rc; } - LOG_INF("EXP_SEL mux %c with priority %d", - pin_state ? 'B' : 'A', - CONFIG_BOARD_MIMX93_EVK_EXP_SEL_INIT_PRIO - ); + LOG_INF("EXP_SEL mux %c with priority %d", pin_state ? 'B' : 'A', + CONFIG_BOARD_MIMX93_EVK_EXP_SEL_INIT_PRIO); return 0; } diff --git a/boards/nxp/imx93_evk/doc/index.rst b/boards/nxp/imx93_evk/doc/index.rst index dd088694d2e..1c937c288d8 100644 --- a/boards/nxp/imx93_evk/doc/index.rst +++ b/boards/nxp/imx93_evk/doc/index.rst @@ -85,6 +85,35 @@ Serial Port This board configuration uses a single serial communication channel with the CPU's UART4. +Board MUX Control +----------------- + +This board configuration uses a series of digital multiplexers to switch between +different board functions. The multiplexers are controlled by a GPIO signal called +``EXP_SEL`` from onboard GPIO expander ADP5585. It can be configured to select +function set "A" or "B" by dts configuration if board control module is enabled. +The following dts node is defined: + +.. code-block:: dts + + board_exp_sel: board-exp-sel { + compatible = "imx93evk-exp-sel"; + mux-gpios = <&gpio_exp0 4 GPIO_ACTIVE_HIGH>; + mux = "A"; + }; + +Following steps are required to configure the ``EXP_SEL`` signal: + +1. Enable Kconfig option ``CONFIG_BOARD_MIMX93_EVK_EXP_SEL_INIT``. +2. Select ``mux="A";`` or ``mux="B";`` in ``&board_exp_sel`` devicetree node. + +Kconfig option ``CONFIG_BOARD_MIMX93_EVK_EXP_SEL_INIT`` is enabled if a board +function that requires configuring the mux is enabled. The MUX option is +automatically selected if certain board function is enabled, and takes precedence +over dts config. For instance, if ``CONFIG_CAN`` is enabled, MUX A is selected +even if ``mux="B";`` is configured in dts, and an warning would be reported in +the log. + Programming and Debugging *************************