[U-Boot-Users] Re: about flash_port_width

okisoftxman okisoftxman at hotmail.com
Tue Mar 4 02:00:54 CET 2003


Hello Denk,
        I understand your meanings,Thank you.
        I don't know much hardware,so I still have some problem to ask.
1.If a board using two flash chips(the code just like
"/board/lwmon/flash.c") ,Is the flash address seriate in one flash chip?I
read the code(/board/lwmon/flash.c) and think it isn't seriate in one
chip.Maybe the first address is in one chip,sceond address is in another
chip,the third is in one chip again.....the flash address is by turns in two
chips??

2about MBX board's flash.I look at MBX860 board (8M flash 16 DRAM)that has 4
flash chips in the back of the board.Some U-BOOT codes (
"/board/mbx8xx/flash.c" )list:

int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
{
    ulong cp, wp, data;
    int i, l, rc;
    wp = (addr & ~3); /* get lower word aligned address */
    /*
     * handle unaligned start bytes
     */
 .........................................................
    /*
    * handle word aligned part
    */
    ...............................................................
    /*
     * handle unaligned tail bytes
     */
..............................................................
}

/*-----------------------------------------------------------------------
 * Write a word to Flash, returns:
 * 0 - OK
 * 1 - write timeout
 * 2 - Flash not erased
 */
static int write_word (flash_info_t *info, ulong dest, ulong data)
{
............................................................................
    /* Disable interrupts which might cause a timeout here */
    flag = disable_interrupts();

    addr[0x0555] = 0xAAAAAAAA;
    addr[0x02AA] = 0x55555555;
    addr[0x0555] = 0xA0A0A0A0;

    *((vu_long *)dest) = data;
.......................................................
}

                A.As I see,the base program operation is word
program(16bits),if the board has 2 flash chips,I can understand that it
write a word to each chip.But now  the MBX860 board has 4 flash chips,the
operation is byte program here,isn't it??(but the above say "write a word to
flash")
                B.In function'write_buff',I have some unclear.What's meaning
of  "handle unaligned start bytes" "handle word aligned part" "handle
unaligned tail bytes
"?And what are their function?

Best Regards!:=)



----- Original Message -----
From: "Wolfgang Denk" <wd at denx.de>
To: "okisoftxman" <okisoftxman at hotmail.com>
Cc: <u-boot-users at lists.sourceforge.net>
Sent: Monday, March 03, 2003 5:07 PM
Subject: Re: about flash_port_width


> Hello,
>
> in message <OE46FvpV02m6DKdu3cg000034a7 at hotmail.com> you wrote:
> >
> >         I read the example "board/lwmon/flash.c" for a configuration  of
a
> > 32 bit wide flash bank using 28F640J3A chips.
> ...
> >    But I find a another example for 28F640J3A chips
"/board/nx823/flash.c",I
> > think there is one flash chips .Something like this:
> > #define FLASH_PORT_WIDTH  ulong
> > #define FLASH_PORT_WIDTHV  vu_long
> > #define FPW  FLASH_PORT_WIDTH
> > #define FPWV FLASH_PORT_WIDTHV
> >
> > "   case (FPW)INTEL_ID_28F640J3A:
> >       info->flash_id += FLASH_28F640J3A;
> >       info->sector_count = 64;
> >       info->size = 0x00800000;
> >       break;            /* => 8 MB     */  "
> >
> > static int write_data (flash_info_t *info, ulong dest, FPW data)
> > {
> > ..............................................
> >  *addr = (FPW)0x00400040;  /* write setup */
> >  *addr = data;
> > ...............................................
> >  return (0);
> > }
> >
> > Since there is one chip,I think it must perform 16bit data
operations.But
> > the variable "data" type is ulong(I think it is 32bits),it seems that it
> > still performs 32bit operation.Why???
>
> I think this board uses 2 chips in 16  bit  configuration,  too.  The
> setting  of  "info->size"  is probably wrong. I cannot check, since I
> don't know the hardware.
>
> The MAINTAINERS file lists the NX823 board as orphaned,  which  means
> that nobody actively maintains this port - it may be buggy. There are
> several poor ports in the code, but I can only fix those where I have
> access  to the documentation and to the hardware and probably someone
> who pays for the time.
>
>
> I know that the LWMON configuration is working fine,  so  you  better
> use this one as a model ;-)
>
>
> Best regards,
>
> Wolfgang Denk
>
> --
> Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
> Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
> It's a small world, but I wouldn't want to paint it.
>




More information about the U-Boot mailing list