Message ID | 20200611194506.7263-6-p.yadav@ti.com |
---|---|
State | New |
Headers | show |
Series | drivers: Add a framework for MUX drivers | expand |
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
Hi Simon, On 16/06/20 09:12PM, Simon Glass wrote: > Hi Pratyush, > > On Thu, 11 Jun 2020 at 13:45, Pratyush Yadav <p.yadav@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? I went and looked, but I can't figure out how we do it for PCI. Any pointers? > > > > Signed-off-by: Pratyush Yadav <p.yadav@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; > > } -- Regards, Pratyush Yadav Texas Instruments India
Hi Pratyush, On Mon, 3 Aug 2020 at 05:34, Pratyush Yadav <p.yadav@ti.com> wrote: > > Hi Simon, > > On 16/06/20 09:12PM, Simon Glass wrote: > > Hi Pratyush, > > > > On Thu, 11 Jun 2020 at 13:45, Pratyush Yadav <p.yadav@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? > > I went and looked, but I can't figure out how we do it for PCI. Any > pointers? Yes it is enable_pci_map in arch/sandbox/cpu/cpu.c Regards, Simon
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; }
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. Signed-off-by: Pratyush Yadav <p.yadav at ti.com> --- board/sandbox/sandbox.c | 2 ++ 1 file changed, 2 insertions(+)