[U-Boot] [PATCHv3] mtd: sf: Add CONFIG_SPI_N25Q256A_RESET for software-reset
Pavel Machek
pavel at denx.de
Fri May 15 11:55:45 CEST 2015
On Fri 2015-05-15 11:36:11, Marek Vasut wrote:
> On Friday, May 15, 2015 at 10:47:46 AM, Pavel Machek wrote:
> > > >> Seems like nothing much doing in micron side
> > > >>
> > > >> switch (JEDEC_MFR(info)) {
> > > >> case CFI_MFR_ST: /* Micron, actually */
> > > >>
> > > >> /* Some Micron need WREN command; all will accept it
> > > >> */ need_wren = true;
> > > >
> > > > Umm. Take a closer look.
> > > >
> > > > There's no break, so it continues below.
> > >
> > > Ohh.. So Linux works for you.. then is it?
> >
> > Well, yes, but this code patch is actually not tested in my case,
> > because u-boot already resets it for Linux.
> >
> > Anyway, is this what you'd like to see?
>
> Was my idea of checking in which mode the SPI NOR is first discarded ?
Yes, better just reset it.
> [...]
>
> > @@ -233,6 +234,30 @@ static int spi_flash_validate_params(struct spi_slave
> > *spi, u8 *idcode, flash->poll_cmd = CMD_FLAG_STATUS;
> > #endif
> >
> > + if (params->flags & MICRON_RESET) {
> > +#define CMD_RESET_ENABLE 0x66
> > +#define CMD_RESET_MEMORY 0x99
> > + int ret;
>
> The indent here seems funny.
>
> I think it'd be better to pull this reset procedure into a separate
> function.
Can do, but I need to know if this is what Jagan wanted, first.
Pavel
> > + /*
> > + * This is needed for the SoCFPGA booting from SPI NOR flash
> > + * e.g. (N25Q256A), as U-Boot SPL 2013-socfpga (only version
> > + * working on that board) sets 4-byte addressing mode.
> > + */
> > + ret = spi_flash_cmd(spi, CMD_RESET_ENABLE, NULL, 0);
> > + if (ret) {
> > + printf("SF: Failed issue enable reset command\n");
> > + return ret;
> > + }
> > +
> > + ret = spi_flash_cmd(spi, CMD_RESET_MEMORY, NULL, 0);
> > + if (ret) {
> > + printf("SF: Failed issue reset command\n");
> > + return ret;
> > + }
> > +
> > + printf("SF: Device software reset\n");
> > + }
>
> Otherwise I think it's OK.
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
More information about the U-Boot
mailing list