Skip to contentSkip to conversation

CFI driver

U-Boot-Users York Sun 3 participants 7 messages Oct 20, 2004 – Oct 27, 2004 3 messages not in the archive

lore
Share & tools
lore

York Sun

author
#0 lore raw

I am debugging flash driver for MPC8555CDS board. The driver is drivers/cfi_flash.c. I have two boards. One is rev 1.0, with AM29LV641D. The other is rev 1.1, with AM29LV641M.

The problem is polling DQ6 after programming. The current driver in U-boot 1.1.2 works well for AM29LV641M. As for AM29LV641D, the programming hangs after writing about 13KB. I track it down to "flash_is_busy()" function. When the problem occurs, the DQ6 keeps toggling. If I change the algorithm to polling DQ7, no problem occurs.

Shawn has a similar problem
http://lists.infradead.org/pipermail/linux-mtd/2004-March/009402.html.
Maybe we should use DQ7 rather than DQ6.

Another issue is the CFI driver might not work for all CFI compatible flash. For example, Micro MT28F640J3. Micro uses status register instead of DQ# polling. Somehow, we still need board specific driver.

Signature · 15 lines
Best regards,
 
York Sun, Ph.D
Metrowerks
Freescale Semiconductor Inc.
Phone: (512) 996-5252
Email: yorksun at freescale.com
 
This email, and any associated attachments have been classified as:
[x] Freescale Semiconductor General Business
[ ] Freescale Semiconductor Internal Use Only
[ ] Freescale Semiconductor Confidential Proprietary
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20041020/27a976b5/attachment.htm 
#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

York Sun writes:

...

York> Another issue is the CFI driver might not work for all CFI York> compatible flash. For example, Micro MT28F640J3. Micro uses York> status register instead of DQ# polling. Somehow, we still need York> board specific driver.

So what's the problem? The CFI driver supports both methods, polling for AMD-compatible chips and reading status register for Intel-compatible ones. It works well on original Intel 28F640J3. Maybe Micro is not recognised correctly as Intel-compatible? If it's the case, it's just a bug which is easily fixed. You don't need board specific driver for these flashes.

BTW, please, don't send HTML to the list.

Signature · 4 lines
========================================================================
 Yuli Barcohen       | Phone +972-9-765-1788 |  Software Project Leader
 yuli at arabellasw.com | Fax   +972-9-765-7494 | Arabella Software, Israel
========================================================================
#2 lore raw
In reply to York Sun
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

York Sun writes:

York> I am debugging flash driver for MPC8555CDS board. The driver York> is drivers/cfi_flash.c. I have two boards. One is rev 1.0, York> with AM29LV641D. The other is rev 1.1, with AM29LV641M.

York> The problem is polling DQ6 after programming. The current York> driver in U-boot 1.1.2 works well for AM29LV641M. As for York> AM29LV641D, the programming hangs after writing about 13KB. I York> track it down to "flash_is_busy()" function. When the problem York> occurs, the DQ6 keeps toggling. If I change the algorithm to York> polling DQ7, no problem occurs.

I'm working now with a board (Adder87x) having exactly the same flash (AM29LV641DL) and the driver works perfectly. I suspect that the problem is not in the chip but in specific configuration.

York> Shawn has a similar problem
York> http://lists.infradead.org/pipermail/linux-mtd/2004-March/009402.html.

Your board uses several chips in parallel to get wider bus. The same was on Shawn's board. In older versions of Linux CFI driver I found a bug in the polling algorithm when more than one chip is used. I just replaced the driver with a newer version and now it works OK. It sounds like similar (same?) bug in the U-Boot's CFI driver.

York> Maybe we should use DQ7 rather than DQ6.

IMHO, no. Polling DQ6 is the standard for AMD-compatible flashes.

...

Signature · 4 lines
========================================================================
 Yuli Barcohen       | Phone +972-9-765-1788 |  Software Project Leader
 yuli at arabellasw.com | Fax   +972-9-765-7494 | Arabella Software, Israel
========================================================================
author
#3 lore raw

Yuli,

Thanks for reply.

I am using a single chip. The problem doesn't appear EVERY programming. It happens after programming about 13KB.

I did this test. In function "flash_status_check ( )", within the while loop, I insert codes to read DQ7-DQ0. I got DQ6 toggling and DQ5=1. That means "exceeded timing limit". Without a reset the program will hang in this loop. By polling the DQ7 instead of DQ6, it went smoothly.

York

Quoted 31 lines · Yuli Barcohen
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

York Sun writes:

York> I am debugging flash driver for MPC8555CDS board. The driver York> is drivers/cfi_flash.c. I have two boards. One is rev 1.0, York> with AM29LV641D. The other is rev 1.1, with AM29LV641M.

York> The problem is polling DQ6 after programming. The current York> driver in U-boot 1.1.2 works well for AM29LV641M. As for York> AM29LV641D, the programming hangs after writing about 13KB. I York> track it down to "flash_is_busy()" function. When the problem York> occurs, the DQ6 keeps toggling. If I change the algorithm to York> polling DQ7, no problem occurs.

I'm working now with a board (Adder87x) having exactly the same flash (AM29LV641DL) and the driver works perfectly. I suspect that the problem is not in the chip but in specific configuration.

York> Shawn has a similar problem
York> http://lists.infradead.org/pipermail/linux-mtd/2004-March/009402.html.

Your board uses several chips in parallel to get wider bus. The same was on Shawn's board. In older versions of Linux CFI driver I found a bug in the polling algorithm when more than one chip is used. I just replaced the driver with a newer version and now it works OK. It sounds like similar (same?) bug in the U-Boot's CFI driver.

York> Maybe we should use DQ7 rather than DQ6.

IMHO, no. Polling DQ6 is the standard for AMD-compatible flashes.

...

author
#4 lore raw

Yuli,

I add the following test code and modified flash_status_check. I have no error for erasing. But I got "Time out" for programming after 13KB. This algorithm complies AMD standard, doesn't it?

Regards,

York

#define AMD_STATUS_TIMEOUT 0x20

static int flash_time_out (flash_info_t * info, flash_sect_t sect)

{
        int retval;
                                                                                                                 
        switch (info->vendor) {
        case CFI_CMDSET_AMD_STANDARD:
        case CFI_CMDSET_AMD_EXTENDED:
                retval = flash_isset (info, sect, 0,
AMD_STATUS_TIMEOUT);
                break;
        default:
                retval = 0;
        }
        debug ("flash_time_out: %d\n", retval);
        return retval;
}
static int flash_status_check (flash_info_t * info, flash_sect_t sector,
                               ulong tout, char *prompt)
{
        ulong start,now;
                                                                                                                 
        /* Wait for command completion */
        start = get_timer (0);
        while (flash_is_busy (info, sector)) {
                if (flash_time_out(info,sector)) {
                        if (flash_is_busy (info, sector)) {
                                flash_write_cmd (info, sector, 0,
info->cmd_reset);
                                printf("Time out\n");
                        }
                }
                if ((now=get_timer (start)) > info->erase_blk_tout *
CFG_HZ) {
                        printf ("Flash %s timeout at address %lx data
%lx\n",
                                prompt, info->start[sector],
                                flash_read_long (info, sector, 0));
                        flash_write_cmd (info, sector, 0,
info->cmd_reset);
                        return ERR_TIMOUT;
                }
        }
        return ERR_OK;
}
Quoted 58 lines · York Sun

Yuli,

Thanks for reply.

I am using a single chip. The problem doesn't appear EVERY programming. It happens after programming about 13KB.

I did this test. In function "flash_status_check ( )", within the while loop, I insert codes to read DQ7-DQ0. I got DQ6 toggling and DQ5=1. That means "exceeded timing limit". Without a reset the program will hang in this loop. By polling the DQ7 instead of DQ6, it went smoothly.

York

Quoted 26 lines · Yuli Barcohen
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

York Sun writes:

York> I am debugging flash driver for MPC8555CDS board. The driver York> is drivers/cfi_flash.c. I have two boards. One is rev 1.0, York> with AM29LV641D. The other is rev 1.1, with AM29LV641M.

York> The problem is polling DQ6 after programming. The current York> driver in U-boot 1.1.2 works well for AM29LV641M. As for York> AM29LV641D, the programming hangs after writing about 13KB. I York> track it down to "flash_is_busy()" function. When the problem York> occurs, the DQ6 keeps toggling. If I change the algorithm to York> polling DQ7, no problem occurs.

I'm working now with a board (Adder87x) having exactly the same flash (AM29LV641DL) and the driver works perfectly. I suspect that the problem is not in the chip but in specific configuration.

York> Shawn has a similar problem
York> http://lists.infradead.org/pipermail/linux-mtd/2004-March/009402.html.

Your board uses several chips in parallel to get wider bus. The same was on Shawn's board. In older versions of Linux CFI driver I found a bug in the polling algorithm when more than one chip is used. I just replaced the driver with a newer version and now it works OK. It sounds like similar (same?) bug in the U-Boot's CFI driver.

Quoted 5 lines

York> Maybe we should use DQ7 rather than DQ6.

IMHO, no. Polling DQ6 is the standard for AMD-compatible flashes.

...

-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

Signature · 15 lines
Best regards,
 
York Sun, Ph.D
Metrowerks
Freescale Semiconductor Inc.
Phone: (512) 996-5252
Email: yorksun at freescale.com
 
This email, and any associated attachments have been classified as:
[x] Freescale Semiconductor General Business
[ ] Freescale Semiconductor Internal Use Only
[ ] Freescale Semiconductor Confidential Proprietary
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20041020/31efa762/attachment.htm 

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#8 lore raw

Yuli,

I have confirm the problem on more boards.

Quoted 8 lines · Yuli Barcohen

York> Yes. I agree. I polled the DQ7 at the same address of being York> written. I know the AMD polling algorithm. Actually I have York> been using polling DQ7 for a long time. Hundreds of our boards York> were shipped with this algorithm. I am very sure the image has York> been programmed correctly.

So I assume that if you program kernel image you can then successfully boot it. Correct?

Yes.

Quoted 13 lines

York> I also found the flash_make_cmd has some defect. You cannot York> simply multiply the offset with the port width. That would York> generate error address if you are using 8-bit port York> width. Modification is needed for 32-bit chip width. I made York> modification. But I need some boards to verify.

There can be bugs for the very same reason: I haven't got enough boards to verify all possible configuration. In particular, I've got no board using 8-bit port width. I received recently a board with 32-bit flash (2x16) and the CFI driver worked unchanged. Maybe only 4x8 needed the modification...

Quoted 3 lines

I'd suggest trying this driver on a different board with the same flash if you've got one. This would rule out possible hardware issue. On my Adder, the driver works so I can't reproduce the problem in our lab.

I tried 4 more boards.
I confirm the problem on one board with the same two flash chips (AM29LV641DH). I also found two boards with mixed chips (one AM29LV641MH and AM29LV641DH). One of those board has problem on erasing, no problem on programming. The other board is fine.

The problem did show up on the board with two AM29LV641MH.

I have revised the driver to support port width from 8-bit to 64-bit, chip width from 8-bit to 32-bit. Also, I modified the driver to poll DQ6 at the same address where the date is being written to. And I add the polling DQ7, which is not enabled by default. With these modification, all my boards passed testing.

By the way, here is the feedback from AMD, "It is a good practice to use the exact address where data is being written to when using the "DQ6" method, even though in theory you don't have to."

If you want to confirm, I can generate a patch. Wolfgang?

Regards,

York

#9 lore raw
Quoted 2 lines · In message <[email protected]> you wrote:

If you want to confirm, I can generate a patch. Wolfgang?

Yes?

Best regards,

Wolfgang Denk

Signature · 4 lines
See us @ Embedded/Electronica Munich, Nov 09 - 12, Hall A.6 Booth 513
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Too many people are ready to carry the stool when the piano needs  to
be moved.