Hi Peter,
Sorry about that. When I ran this qtest and I found an error then I
tried to modify npcm_pspi driver to make data register read/write test
pass.

[R +0.080118] writew 0xf0201002 0x4
[S +0.080126] OK
[R +0.080148] readw 0xf0201002
[S +0.080153] OK 0x0000000000000004
[R +0.080168] writew 0xf0201000 0x1234
[S +0.080171] OK
[R +0.080191] readw 0xf0201000
[S +0.080194] OK 0x0000000000001234
[I +0.080445] CLOSED
ok 3 /aarch64/npcm8xx_pspi/data
# End of npcm8xx_pspi tests
# End of aarch64 tests

Here is the change diff of what I modified in npcm_pspi_write_data()
Should I submit this patch for npcm_pspi driver? I'm not sure if I
modified it correctly. Thanks for your time.

 static void npcm_pspi_write_data(NPCMPSPIState *s, uint16_t data)
 {
-    uint16_t value = 0;
+    uint16_t data_l, data_h = 0;

     if (FIELD_EX16(s->regs[R_PSPI_CTL1], PSPI_CTL1, MOD)) {
-        value = ssi_transfer(s->spi, extract16(data, 8, 8)) << 8;
+        data_h = (extract16(data, 8, 8) << 8);
+        ssi_transfer(s->spi, data_h);
     }
-    value |= ssi_transfer(s->spi, extract16(data, 0, 8));
-    s->regs[R_PSPI_DATA] = value;
+    data_l = extract16(data, 0, 8);
+    ssi_transfer(s->spi, data_l);
+    s->regs[R_PSPI_DATA] = (data_h | data_l);

Peter Maydell <peter.mayd...@linaro.org> 於 2025年5月11日 週日 下午9:58寫道:
>
> On Sun, 11 May 2025 at 14:47, Peter Maydell <peter.mayd...@linaro.org> wrote:
> >
> > On Wed, 7 May 2025 at 10:19, Tim Lee <timlee660...@gmail.com> wrote:
> > >
> > > - Created qtest to check initialization of registers in PSPI Module
> > > - Implemented test into Build File
> > >
> > > Tested:
> > > ./build/tests/qtest/npcm8xx-pspi_test
> > >
> > > Signed-off-by: Tim Lee <timlee660...@gmail.com>
> > > ---
> > > Changes since v1:
> > > - MAINTAINERS file not need to change
> > > - Add comment for copyright/license information
> > > - Correct CTL registers to use 16 bits
> > > - Remove printf() in test cases
> >
> >
> >
> > Applied to target-arm.next, thanks.
>
> ...but it fails "make check", so I've dropped it:
>
> not ok /aarch64/npcm8xx_pspi/data - 
> ERROR:../../tests/qtest/npcm8xx_pspi-test.c:
> 80:test_data: assertion failed (output == test): (0x00000000 == 0x00001234)
> Bail out!
> ----------------------------------- stderr -----------------------------------
> **
> ERROR:../../tests/qtest/npcm8xx_pspi-test.c:80:test_data: assertion failed 
> (outp
> ut == test): (0x00000000 == 0x00001234)
>
> (test program exited with status code -6)
>
> thanks
> -- PMM

-- 
Best regards,
Tim Lee

Reply via email to