[U-Boot-Users] Re: Write buffer programming for AMD flash chips

Alex BASTOS alebas at televes.com
Fri Apr 29 09:55:19 CEST 2005

Hi Thomas,

> I had a look at your patch and I believe that it does almost the same than
> mine. From a point of readability and extendability I would prefer it,
> whereas my patch would save some memory.

So on, IMHO memory saving may be preferable in this case.
However, maybe someone else in the list (Wolfgang?) has
anything to say.

If this is the way we decide to go, I can apply your patch and
make changes for 8 bit support.

> A missing part in your patch is checking whether data to be written are
> aligned with the flash chips write buffer. This is done with the following
> hunk for the write_buff function:
>  	buffered_size = (info->portwidth / info->chipwidth);
>  	buffered_size *= info->buffer_size;
>  	while (cnt >= info->portwidth) {
> -		i = buffered_size > cnt ? cnt : buffered_size;
> +		/* write buffer until next buffered_size aligned boundary */
> +		i = buffered_size - (wp % buffered_size);
> +		if (i>cnt)
> +			i = cnt;
>  		if ((rc = flash_write_cfibuffer (info, wp, src, i)) != ERR_OK)
>  			return rc;
>  		i -= (i % info->portwidth);
> In our case, the lack of this code lead to errors when writing the
> environment to flash. The reason is that environment writing is done in 3
> steps and this results in not buffer-aligned write cycles. The code above
> calculates the correct buffer size (i) depending on the first address (wp) to
> be written

OK. I will change this.

Best Regards,


More information about the U-Boot mailing list