[U-Boot-Users] [PATCH] Fix SPI read/write length issue
Aubrey Li
aubrey.adi at gmail.com
Fri Apr 20 18:24:08 CEST 2007
On 3/22/07, Aubrey Li <aubrey.adi at gmail.com> wrote:
> When the functions "eeprom_read" and "eeprom_write" works for the SPI
> flash, the data length is limited to I2C_RXTX_LEN. See the following
> piece of code.
> -----------------------------
> #if !defined(CFG_I2C_FRAM)
> maxlen = 0x100 - blk_off;
> if (maxlen > I2C_RXTX_LEN)
> maxlen = I2C_RXTX_LEN;
>
> if (len > maxlen)
> len = maxlen;
> #endif
> -----------------------------
>
> The following patch fixes this issue.
>
> From 2451cc87059acc456597a28f802ab3acb2d61ad4 Mon Sep 17 00:00:00 2001
> From: Aubrey Li <aubrey.adi at gmail.com>
> Date: Thu, 22 Mar 2007 17:26:27 +0800
> Subject: [PATCH] Fix spi read/write length issue
>
>
> Signed-off-by: Aubrey Li <aubrey.adi at gmail.com>
> ---
> common/cmd_eeprom.c | 7 +++++++
> 1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/common/cmd_eeprom.c b/common/cmd_eeprom.c
> index d15a412..71d9792 100644
> --- a/common/cmd_eeprom.c
> +++ b/common/cmd_eeprom.c
> @@ -177,10 +177,14 @@ int eeprom_read (unsigned dev_addr, unsi
> maxlen = 0x100 - blk_off;
> if (maxlen > I2C_RXTX_LEN)
> maxlen = I2C_RXTX_LEN;
> +
> +#ifndef CONFIG_SPI
> if (len > maxlen)
> len = maxlen;
> #endif
>
> +#endif
> +
> #ifdef CONFIG_SPI
> spi_read (addr, alen, buffer, len);
> #else
> @@ -273,10 +277,13 @@ int eeprom_write (unsigned dev_addr, uns
> if (maxlen > I2C_RXTX_LEN)
> maxlen = I2C_RXTX_LEN;
>
> +#ifndef CONFIG_SPI
> if (len > maxlen)
> len = maxlen;
> #endif
>
> +#endif
> +
> #ifdef CONFIG_SPI
> spi_write (addr, alen, buffer, len);
> #else
> --
> 1.4.4
>
> Best Regards,
> -Aubrey
>
Just want to know the status of this patch, thanks!
Best Regards,
-Aubrey
More information about the U-Boot
mailing list