[PATCH v3 5/6] sandbox: Enable memio operations in board_init

Simon Glass sjg at chromium.org
Wed Jun 17 05:12:14 CEST 2020


Hi Pratyush,

On Thu, 11 Jun 2020 at 13:45, Pratyush Yadav <p.yadav at ti.com> wrote:
>
> initr_dm_devices() is called somewhere after board_init(). It can be
> used by drivers to initialize devices to some default bootup state.
> Those devices might use mmio read/write operations to perform the
> initialization.
>
> One such example is the mux devices. The mux framework initializes the
> muxes to their default state after idle state in
> mux_uclass_post_probe(). One type of mux controller is the MMIO mux
> controller. Initializing a MMIO mux to idle state can require a mmio
> read and write operation.
>
> With memio disabled, the reads return 0 and the writes go off into the
> void. This makes it impossible to initialize muxes to their idle state
> on boot, and consequentially makes it impossible to test that in
> sandbox.
>
> These same initializations work fine on actual hardware (tested on TI
> J721E EVM). So, enable memio operations on boot so devices like mux can
> perform whatever initialization they need. state_reset_for_test() will
> disable it before running tests so tests still need to enable memio
> manually.

We have a similar issue with PCI and we only enable it when needed.
Can we do something similar here?

>
> Signed-off-by: Pratyush Yadav <p.yadav at ti.com>
> ---
>  board/sandbox/sandbox.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/board/sandbox/sandbox.c b/board/sandbox/sandbox.c
> index 1372003018..d7eb207822 100644
> --- a/board/sandbox/sandbox.c
> +++ b/board/sandbox/sandbox.c
> @@ -55,6 +55,8 @@ int board_init(void)
>         if (IS_ENABLED(CONFIG_LED))
>                 led_default_state();
>
> +       sandbox_set_enable_memio(true);
> +
>         return 0;
>  }
>
> --
> 2.27.0
>

Regards,
Simon


More information about the U-Boot mailing list