All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alon Bar-Lev <alon.barlev@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [mips][cfi] Unable to write into flash under qemu
Date: Tue, 5 Jul 2016 19:50:56 +0300	[thread overview]
Message-ID: <CAOazyz250xgUDKbLYs0EGn_5zQ4Te8wVvSd8wVYy7wi8qs+OBA@mail.gmail.com> (raw)
In-Reply-To: <577BDBF4.8010807@gmail.com>

Thank you so much!
Erase does not complain any more.

However, write is not working.

Result is always something like:
be040000: 00800080 00800080 00800080 00800080    ................

I enabled the debug info of both u-boot and qemu.
I hope it helps.
I am using master of qemu and u-boot, I get similar behavior in qemu
since ever 1.5.
Any clue?

Regards,
Alon

---

malta # flinfo

Bank # 1: CFI conformant flash (32 x 32)  Size: 4 MB in 64 Sectors
  Intel Extended command set, Manufacturer ID: 0x00, Device ID: 0x00
  Erase timeout: 16384 ms, write timeout: 3 ms
  Buffer write timeout: 3 ms, buffer size: 2048 bytes

  Sector Start Addresses:
  BE000000   RO   BE010000   RO   BE020000   RO   BE030000   RO   BE040000
  BE050000        BE060000        BE070000        BE080000        BE090000
  BE0A0000        BE0B0000        BE0C0000        BE0D0000        BE0E0000
  BE0F0000        BE100000        BE110000        BE120000        BE130000
  BE140000        BE150000        BE160000        BE170000        BE180000
  BE190000        BE1A0000        BE1B0000        BE1C0000        BE1D0000
  BE1E0000        BE1F0000        BE200000        BE210000        BE220000
  BE230000        BE240000        BE250000        BE260000        BE270000
  BE280000        BE290000        BE2A0000        BE2B0000        BE2C0000
  BE2D0000        BE2E0000        BE2F0000        BE300000        BE310000
  BE320000        BE330000        BE340000        BE350000        BE360000
  BE370000        BE380000        BE390000        BE3A0000        BE3B0000
  BE3C0000        BE3D0000        BE3E0000   RO   BE3F0000   RO
malta # erase BE040000 +10000

fwc addr be040000 cmd 50 00000050 32bit x 32 bit
PFLASH: pflash_write: writing offset 0000000000040000 value 00000050
width 4 wcycle 0x0
PFLASH: pflash_write: Clear status bits
fwc addr be040000 cmd 20 00000020 32bit x 32 bit
PFLASH: pflash_write: writing offset 0000000000040000 value 00000020
width 4 wcycle 0x0
PFLASH: pflash_write: block erase at 0000000000040000 bytes 10000
fwc addr be040000 cmd d0 000000d0 32bit x 32 bit
PFLASH: pflash_write: writing offset 0000000000040000 value 000000d0
width 4 wcycle 0x1
PFLASH: pflash_read: status 800080
flash_is_busy: 0
PFLASH: pflash_read: status 800080
fwc addr be040000 cmd ff 000000ff 32bit x 32 bit
PFLASH: pflash_write: writing offset 0000000000040000 value 000000ff
width 4 wcycle 0x0
PFLASH: pflash_write: Read array mode
. done
Erased 1 sectors
malta # cp.b BE000000 BE040000 10
Copy to Flash... fwc addr be040000 cmd 50 00000050 32bit x 32 bit
PFLASH: pflash_write: writing offset 0000000000040000 value 00000050
width 4 wcycle 0x0
PFLASH: pflash_write: Clear status bits
fwc addr be040000 cmd 70 00000070 32bit x 32 bit
PFLASH: pflash_write: writing offset 0000000000040000 value 00000070
width 4 wcycle 0x0
PFLASH: pflash_write: Read status register
fwc addr be040000 cmd e8 000000e8 32bit x 32 bit
PFLASH: pflash_write: writing offset 0000000000040000 value 000000e8
width 4 wcycle 0x0
PFLASH: pflash_write: Write to buffer
PFLASH: pflash_read: status 800080
flash_is_busy: 0
fwc addr be040000 cmd 3 00000003 32bit x 32 bit
PFLASH: pflash_write: writing offset 0000000000040000 value 00000003
width 4 wcycle 0x1
PFLASH: pflash_write: block write of 3 bytes
PFLASH: pflash_read: status 800080
PFLASH: pflash_write: writing offset 0000000000040000 value 00800080
width 4 wcycle 0x2
PFLASH: pflash_data_write: block write offset 0000000000040000 value
800080 counter 0000000000000003
PFLASH: pflash_read: status 800080
PFLASH: pflash_write: writing offset 0000000000040004 value 00800080
width 4 wcycle 0x2
PFLASH: pflash_data_write: block write offset 0000000000040004 value
800080 counter 0000000000000002
PFLASH: pflash_read: status 800080
PFLASH: pflash_write: writing offset 0000000000040008 value 00800080
width 4 wcycle 0x2
PFLASH: pflash_data_write: block write offset 0000000000040008 value
800080 counter 0000000000000001
PFLASH: pflash_read: status 800080
PFLASH: pflash_write: writing offset 000000000004000c value 00800080
width 4 wcycle 0x2
PFLASH: pflash_data_write: block write offset 000000000004000c value
800080 counter 0000000000000000
PFLASH: pflash_write: block write finished
fwc addr be040000 cmd d0 000000d0 32bit x 32 bit
PFLASH: pflash_write: writing offset 0000000000040000 value 000000d0
width 4 wcycle 0x3
PFLASH: pflash_read: status 800080
flash_is_busy: 0
PFLASH: pflash_read: status 800080
fwc addr be040000 cmd ff 000000ff 32bit x 32 bit
PFLASH: pflash_write: writing offset 0000000000040000 value 000000ff
width 4 wcycle 0x0
PFLASH: pflash_write: Read array mode
done
malta # md BE000000
be000000: 10000123 00000000 00000000 00000000    ...#............
be000010: 00000420 00000000 00000000 00000000    ... ............
be000020: 00000000 00000000 00000000 00000000    ................
be000030: 00000000 00000000 00000000 00000000    ................
be000040: 00000000 00000000 00000000 00000000    ................
be000050: 00000000 00000000 00000000 00000000    ................
be000060: 00000000 00000000 00000000 00000000    ................
be000070: 00000000 00000000 00000000 00000000    ................
be000080: 00000000 00000000 00000000 00000000    ................
be000090: 00000000 00000000 00000000 00000000    ................
be0000a0: 00000000 00000000 00000000 00000000    ................
be0000b0: 00000000 00000000 00000000 00000000    ................
be0000c0: 00000000 00000000 00000000 00000000    ................
be0000d0: 00000000 00000000 00000000 00000000    ................
be0000e0: 00000000 00000000 00000000 00000000    ................
be0000f0: 00000000 00000000 00000000 00000000    ................
malta # md BE040000
be040000: 00800080 00800080 00800080 00800080    ................
be040010: ffffffff ffffffff ffffffff ffffffff    ................
be040020: ffffffff ffffffff ffffffff ffffffff    ................
be040030: ffffffff ffffffff ffffffff ffffffff    ................
be040040: ffffffff ffffffff ffffffff ffffffff    ................
be040050: ffffffff ffffffff ffffffff ffffffff    ................
be040060: ffffffff ffffffff ffffffff ffffffff    ................
be040070: ffffffff ffffffff ffffffff ffffffff    ................
be040080: ffffffff ffffffff ffffffff ffffffff    ................
be040090: ffffffff ffffffff ffffffff ffffffff    ................
be0400a0: ffffffff ffffffff ffffffff ffffffff    ................
be0400b0: ffffffff ffffffff ffffffff ffffffff    ................
be0400c0: ffffffff ffffffff ffffffff ffffffff    ................
be0400d0: ffffffff ffffffff ffffffff ffffffff    ................
be0400e0: ffffffff ffffffff ffffffff ffffffff    ................
be0400f0: ffffffff ffffffff ffffffff ffffffff    ................
malta #



On 5 July 2016 at 19:10, Daniel Schwierzeck
<daniel.schwierzeck@gmail.com> wrote:
>
> Hi Alon,
>
> +cc Paul, Stefan
>
> Am 05.07.2016 um 14:04 schrieb Alon Bar-Lev:
> > Hi,
> >
> > Found the debug setting.
> >
> > When I try to erase flash under qemu I get the following error, the
> > erase actually succeeds in the backed file, I see sector as 0xff.
> >
> > Can anyone check if problem is within u-boot or qemu?
> >
> > Thanks!
>
> I've found the problem. Paul sent a fix [1] for pflash in June 2013
> to make 32 Bit access working with YAMON bootloader.
>
> The fix mirrors the flash status value in the upper 16 Bits of the return
> value. Thus U-Boot gets a value of 0x800080 in flash_full_status_check()
> after a block erase command. U-Boot compares the status value in
> flash_isequal() with the expected value of 0x80 but that fails.
>
> Because of this I think pflash support for Malta is broken since Qemu 1.6.0.
>
> A possible fix could be this:
>
> --- a/drivers/mtd/cfi_flash.c
> +++ b/drivers/mtd/cfi_flash.c
> @@ -608,7 +608,7 @@ static int flash_full_status_check (flash_info_t * info, flash_sect_t sector,
>         case CFI_CMDSET_INTEL_EXTENDED:
>         case CFI_CMDSET_INTEL_STANDARD:
>                 if ((retcode == ERR_OK)
> -                   && !flash_isequal (info, sector, 0, FLASH_STATUS_DONE)) {
> +                   && !flash_isset (info, sector, 0, FLASH_STATUS_DONE)) {
>                         retcode = ERR_INVAL;
>                         printf ("Flash %s error at address %lx\n", prompt,
>                                 info->start[sector]);
>
>
>
> BTW: you can enable Qemu pflash debug output in hw/block/pflash_cfi01.c
>
> >
> > ---
> >
> > malta # erase BE230000 BE23FFFF
> >
> > fwc addr be230000 cmd 50 00000050 32bit x 32 bit
> > fwc addr be230000 cmd 20 00000020 32bit x 32 bit
> > fwc addr be230000 cmd d0 000000d0 32bit x 32 bit
> > flash_is_busy: 0
> > is= cmd 80(?) addr be230000 is= 00800080 00000080
> > Flash erase error at address be230000
> > fwc addr be230000 cmd ff 000000ff 32bit x 32 bit
> >  done
> >
> > ---
> >
> > user1 at localhost ~/linux-course/embedded/qemu $ qemu-system-mips -M
> > malta -nographic -net nic,netdev=eth0 -netdev
> > tap,id=eth0,ifname=vm0,script=/bin/true -drive
> > if=pflash,file=/tmp/flash,format=raw -m 256
> >
> >
> >
> >
> > On 5 July 2016 at 03:08, Alon Bar-Lev <alon.barlev@gmail.com> wrote:
> >>
> >> Hello,
> >>
> >> I am using malta board within qemu. I tried recent releases and master of both.
> >> Two years ago in qemu-1.5 and qemu-1.6 I could use erase and cp.b in order to erase and write to the flash.
> >> Now when I try to erase flash I get an error suggesting the erase failed, however, I do see 0xff all over in the device backed file (-pflash).
> >> When I try to write I also receive a failure message.
> >>
> >> I am unsure how to debug this, I went back in time and tried the qemu-1.6 and got same error. I suspect it is has something to do with u-boot CFI driver.
> >>
> >> Can anyone help determine if issue is at qemu side or at u-boot side? How can I debug this?
> >>
> >> Thanks,
> >> Alon
> > _______________________________________________
> > U-Boot mailing list
> > U-Boot at lists.denx.de
> > http://lists.denx.de/mailman/listinfo/u-boot
> >
>
> --
> - Daniel
>

  reply	other threads:[~2016-07-05 16:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-05  0:08 [U-Boot] [mips][cfi] Unable to write into flash under qemu Alon Bar-Lev
2016-07-05 12:04 ` Alon Bar-Lev
2016-07-05 16:10   ` Daniel Schwierzeck
2016-07-05 16:50     ` Alon Bar-Lev [this message]
2016-07-05 17:05       ` Daniel Schwierzeck
2016-07-05 17:17         ` Alon Bar-Lev
2016-07-05 17:34           ` Daniel Schwierzeck
2016-07-05 17:57             ` Alon Bar-Lev
2016-07-10 20:50     ` Alon Bar-Lev
2016-07-18  8:38       ` Stefan Roese
2016-07-18 12:13         ` Daniel Schwierzeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOazyz250xgUDKbLYs0EGn_5zQ4Te8wVvSd8wVYy7wi8qs+OBA@mail.gmail.com \
    --to=alon.barlev@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.