Hi Cédric,

On Tue, Jul 7, 2026 at 10:27 PM Cédric Le Goater <[email protected]> wrote:
>
> Bin, Philippe,
>
> On 7/7/26 16:05, Cédric Le Goater wrote:
> >
> >>> This breaks the test_arm_emcraft_sf2 functional test:
> >>>
> >>> not ok 1 test_emcraft_sf2.EmcraftSf2Machine.test_arm_emcraft_sf2
> >>>
> >>
> >>
> >> No problem on my side.
> >>
> > Sorry. you are right ! It fails too.
> >
> > So we have a machine using a Spansion flash.
> >
> >      spi_flash = qdev_new("s25sl12801"); /* Spansion S25FL128SDPBHICO */
> >
> >
> > C.
>
>
> Here is the fix. Feel free to merge in patch 4.

Thanks for the quick fix.

>
> Thanks,
>
> C.
>
>  From 17ae23e5bc3629a5a301f14f47125f6f685ca9d9 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= <[email protected]>
> Date: Tue, 7 Jul 2026 16:23:29 +0200
> Subject: [PATCH] hw/arm/msf2-som: Fix spansion-cr2nv value for S25FL128S
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> The emcraft-sf2 board set spansion-cr2nv to 1, which the old m25p80
> code treated as a byte count. With the dummy cycle to byte conversion
> fix, CR2V=1 at SPI x1 is 1 bit, not byte-aligned, and triggers an
> assertion. Use the S25FL128S default of 0x8 (8 cycles = 1 byte at
> SPI x1), preserving the same runtime behavior.
>
> Signed-off-by: Cédric Le Goater <[email protected]>
> ---
>   hw/arm/msf2-som.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/arm/msf2-som.c b/hw/arm/msf2-som.c
> index caf6e7e1ad7d..1ada1a136130 100644
> --- a/hw/arm/msf2-som.c
> +++ b/hw/arm/msf2-som.c
> @@ -84,7 +84,7 @@ static void emcraft_sf2_s2s010_init(MachineState *machine)
>       /* Attach SPI flash to SPI0 controller */
>       spi_bus = qdev_get_child_bus(dev, "spi0");
>       spi_flash = qdev_new("s25sl12801"); /* Spansion S25FL128SDPBHICO */
> -    qdev_prop_set_uint8(spi_flash, "spansion-cr2nv", 1);
> +    qdev_prop_set_uint8(spi_flash, "spansion-cr2nv", 0x8);

Indeed the default reset value of cr2nv[3:0] is 8 according to the
flash datasheet.

Reviewed-by: Bin Meng <[email protected]>

>       if (dinfo) {
>           qdev_prop_set_drive_err(spi_flash, "drive",
>                                   blk_by_legacy_dinfo(dinfo), &error_fatal);
> --

Regards,
Bin

Reply via email to