[U-Boot] [PATCH 3/4] sf: Add extended address access support

Jagannadha Sutradharudu Teki jagannadha.sutradharudu-teki at xilinx.com
Wed Feb 27 18:48:55 CET 2013



> -----Original Message-----
> From: Langer Thomas (LQDE RD ST PON SW)
> [mailto:thomas.langer at lantiq.com]
> Sent: 24 February 2013 21:21
> To: Jagannadha Sutradharudu Teki; u-boot at lists.denx.de
> Cc: Michal at theia.denx.de; Jagannadha Sutradharudu Teki
> Subject: AW: [U-Boot] [PATCH 3/4] sf: Add extended address access support
>
> Hello Jagan,
>
> Am 23.02.2013 12:39, schrieb Jagannadha Sutradharudu Teki:
> > This patch provides support to access an extended addressing in 3-byte
> > address mode.
> >
> > The current implementation in spi_flash supports 3-byte address mode
> > due to this up to 16MB amount of flash is able to access for those
> > flashes which has an actual size of > 16MB.
> >
> > extended/bank address register contains an information to access the
> > 4th byte addressing hence the flashes which has > 16MB can be accessible.
> >
> > Signed-off-by: Jagannadha Sutradharudu Teki <jaganna at xilinx.com>
> > ---
> >   drivers/mtd/spi/spi_flash.c          |   81
> ++++++++++++++++++++++++++++++++++
> >   drivers/mtd/spi/spi_flash_internal.h |    8 +++
> >   2 files changed, 89 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
> > index c168c1c..16e5f59 100644
> > --- a/drivers/mtd/spi/spi_flash.c
> > +++ b/drivers/mtd/spi/spi_flash.c
> > @@ -23,6 +23,30 @@ static void spi_flash_addr(u32 addr, u8 *cmd)
> >     cmd[3] = addr >> 0;
> >   }
> >
> > +static int spi_flash_check_extaddr_access(struct spi_flash *flash,
> > +u32 *offset) {
> > +   int ret;
> > +
> > +   if (*offset >= 0x1000000) {
> > +           ret = spi_flash_extaddr_access(flash,
> STATUS_EXTADDR_ENABLE);
> Restricting this to a single bit here would give the next size limit at 32M.
> Please make it future-prov as much as possible: Why not directly use the
> upper byte of the offset as parameter?

I didn't get you clearly, can you please elaborate.

>
> > +           if (ret) {
> > +                   debug("SF: fail to %s ext addr bit\n",
> > +                           STATUS_EXTADDR_ENABLE ? "set" : "reset");
> > +                   return ret;
> > +           }
> > +           *offset -= 0x1000000;
> Are you sure that manipulating the value of the caller has no side-effect?
> Is it even necessary, if the callers only do 3-byte-addressing and probably
> ignore the upper byte?

May be you are not getting my exact code context.



More information about the U-Boot mailing list