[U-Boot] [PATCH 1/4] sf: Add extended address register writing support

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


Hi Thomas,

> -----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 1/4] sf: Add extended address register writing
> support
>
> Hello Jagan,
>
> >
> > diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
> > index 00aece9..232ccc0 100644
> > --- a/drivers/mtd/spi/spi_flash.c
> > +++ b/drivers/mtd/spi/spi_flash.c
> > @@ -269,6 +269,47 @@ int spi_flash_cmd_write_status(struct spi_flash
> *flash, u8 sr)
> >     return 0;
> >   }
> >
> > +int spi_flash_cmd_extaddr_write(struct spi_flash *flash, u8 ear) {
> > +   u8 cmd;
> > +   u8 idcode0;
> > +   int ret;
> > +
> > +   ret = spi_flash_cmd(flash->spi, CMD_READ_ID, &idcode0, 1);
> > +   if (ret) {
> > +           debug("SF: fail to read read id\n");
> > +           return ret;
> > +   }
> Instead of reading the id each time this function is executed, it should be
> decided during flash probing, if the feature is available and calling this
> functions should be done only then.

Means you wanted to store the idcode0 on to spi_flash structure during flash probe time,
So that based on idcode0 we can assign the command..is it?

>
> > +
> > +   if (idcode0 == 0x01)
> > +           cmd = CMD_EXT_BRWR;
> > +   else {
> > +           printf("SF: unable to support extaddr reg write"
> > +           " for %s flash\n", flash->name);
> This error will be hit every time for non-Spansion flashes, after you add the
> calls in patch 3/4 unconditionally!

The main reason for adding this print is currently I am adding support for winbond, spansion and
numonyx flashes, if any flash vendor other than these are using this support they should add the
respective command. so they may come to know from this print.

I didn't see any other flashes currently have < 16MB sizes in the drivers/mtd/spi/ other than these.
Was my thinking valid..?

Thanks,
Jagan.

>
> > +           return -1;
> > +   }
> > +
> > +   ret = spi_flash_cmd_write_enable(flash);
> > +   if (ret < 0) {
> > +           debug("SF: enabling write failed\n");
> > +           return ret;
> > +   }
> > +
> > +   ret = spi_flash_cmd_write(flash->spi, &cmd, 1, &ear, 1);
> > +   if (ret) {
> > +           debug("SF: fail to write ext addr register\n");
> > +           return ret;
> > +   }
> > +
> > +   ret = spi_flash_cmd_wait_ready(flash, SPI_FLASH_PROG_TIMEOUT);
> > +   if (ret < 0) {
> > +           debug("SF: write config register timed out\n");
> > +           return ret;
> > +   }
> > +
> > +   return 0;
> > +}
> > +
> >   /*
> >    * The following table holds all device probe functions
> >    *
> > diff --git a/drivers/mtd/spi/spi_flash_internal.h
> > b/drivers/mtd/spi/spi_flash_internal.h
> > index 141cfa8..dbceb81 100644
> > --- a/drivers/mtd/spi/spi_flash_internal.h
> > +++ b/drivers/mtd/spi/spi_flash_internal.h
> > @@ -28,6 +28,9 @@
> >   #define CMD_ERASE_64K                     0xd8
> >   #define CMD_ERASE_CHIP                    0xc7
> >
> > +/* Extended addr acess commands */
> > +#define CMD_EXT_BRWR                       0x17
> Please comment, that this is the Spansion-only code.
>
> > +
> >   /* Common status */
> >   #define STATUS_WIP                        0x01
> >
> > @@ -77,6 +80,9 @@ static inline int spi_flash_cmd_write_disable(struct
> spi_flash *flash)
> >   /* Program the status register. */
> >   int spi_flash_cmd_write_status(struct spi_flash *flash, u8 sr);
> >
> > +/* Program the extended address register */ int
> > +spi_flash_cmd_extaddr_write(struct spi_flash *flash, u8 ear);
> > +
> >   /*
> >    * Same as spi_flash_cmd_read() except it also claims/releases the SPI
> >    * bus. Used as common part of the ->read() operation.
> >
>
> Best Regards,
> Thomas



This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.




More information about the U-Boot mailing list