[U-Boot] [U-Boot PATCH v2 01/10] sf: allocate cache aligned buffers to copy from flash
Simon Glass
sjg at chromium.org
Thu Aug 13 19:53:43 CEST 2015
HI Jagan,
On 13 August 2015 at 11:39, Jagan Teki <jteki at openedev.com> wrote:
>
> Hi Simon,
>
> On 30 July 2015 at 11:04, Vignesh R <vigneshr at ti.com> wrote:
> > From: Ravi Babu <ravibabu at ti.com>
> >
> > Use memalign() with ARCH_DMA_MINALIGN to allocate read buffers.
> > This is required because, flash drivers may use DMA for read operations
> > and may have to invalidate the buffer before read.
> >
> > Signed-off-by: Ravi Babu <ravibabu at ti.com>
> > Signed-off-by: Vignesh R <vigneshr at ti.com>
> > ---
> > common/cmd_sf.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/common/cmd_sf.c b/common/cmd_sf.c
> > index 3746e0d9644f..ac7f5dfb8181 100644
> > --- a/common/cmd_sf.c
> > +++ b/common/cmd_sf.c
> > @@ -223,7 +223,7 @@ static int spi_flash_update(struct spi_flash *flash, u32 offset,
> >
> > if (end - buf >= 200)
> > scale = (end - buf) / 100;
> > - cmp_buf = malloc(flash->sector_size);
> > + cmp_buf = memalign(ARCH_DMA_MINALIGN, flash->sector_size);
>
> I always have a confusion like align macro is never used on code
> memalign_simple()
> Was it a typo missing or some thing?
I don't understand what you are saying, sorry.
>
>
> > if (cmp_buf) {
> > ulong last_update = get_timer(0);
> >
> > @@ -484,12 +484,12 @@ static int do_spi_flash_test(int argc, char * const argv[])
> > if (*argv[2] == 0 || *endp != 0)
> > return -1;
> >
> > - vbuf = malloc(len);
> > + vbuf = memalign(ARCH_DMA_MINALIGN, len);
> > if (!vbuf) {
> > printf("Cannot allocate memory (%lu bytes)\n", len);
> > return 1;
> > }
> > - buf = malloc(len);
> > + buf = memalign(ARCH_DMA_MINALIGN, len);
> > if (!buf) {
> > free(vbuf);
> > printf("Cannot allocate memory (%lu bytes)\n", len);
> > --
> > 2.5.0
> >
> > _______________________________________________
> > U-Boot mailing list
> > U-Boot at lists.denx.de
> > http://lists.denx.de/mailman/listinfo/u-boot
>
>
> thanks!
> --
> Jagan | openedev.
Regards,
Simon
More information about the U-Boot
mailing list