Message ID | 20200129155557.32191-1-yamada.masahiro@socionext.com |
---|---|
State | Accepted |
Commit | 21d4a3ca549b5b1b8243c845b15f91142bfa3528 |
Headers | show |
Series | [v2,1/4] mtd: rawnand: denali_dt: insert udelay() after reset deassert | expand |
On Thu, Jan 30, 2020 at 12:57 AM Masahiro Yamada <yamada.masahiro at socionext.com> wrote: > > When the reset signal is de-asserted, the HW-controlled bootstrap > starts running unless it is disabled in the SoC integration. > It issues some commands to detect a NAND chip, and sets up registers > automatically. Until this process finishes, software should avoid > any register access. > > Without this delay function, some of UniPhier boards hangs up while > executing nand_scan_ident(). (denali_read_byte() is blocked) > > Signed-off-by: Masahiro Yamada <yamada.masahiro at socionext.com> > --- Applied to u-boot-uniphier. > > Changes in v2: None > > drivers/mtd/nand/raw/denali_dt.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/mtd/nand/raw/denali_dt.c b/drivers/mtd/nand/raw/denali_dt.c > index 91d0f20aae..1afc61f876 100644 > --- a/drivers/mtd/nand/raw/denali_dt.c > +++ b/drivers/mtd/nand/raw/denali_dt.c > @@ -136,11 +136,19 @@ static int denali_dt_probe(struct udevice *dev) > } > > ret = reset_get_bulk(dev, &resets); > - if (ret) > + if (ret) { > dev_warn(dev, "Can't get reset: %d\n", ret); > - else > + } else { > reset_deassert_bulk(&resets); > > + /* > + * When the reset is deasserted, the initialization sequence is > + * kicked (bootstrap process). The driver must wait until it is > + * finished. Otherwise, it will result in unpredictable behavior. > + */ > + udelay(200); > + } > + > return denali_init(denali); > } > > -- > 2.17.1 >
diff --git a/drivers/mtd/nand/raw/denali_dt.c b/drivers/mtd/nand/raw/denali_dt.c index 91d0f20aae..1afc61f876 100644 --- a/drivers/mtd/nand/raw/denali_dt.c +++ b/drivers/mtd/nand/raw/denali_dt.c @@ -136,11 +136,19 @@ static int denali_dt_probe(struct udevice *dev) } ret = reset_get_bulk(dev, &resets); - if (ret) + if (ret) { dev_warn(dev, "Can't get reset: %d\n", ret); - else + } else { reset_deassert_bulk(&resets); + /* + * When the reset is deasserted, the initialization sequence is + * kicked (bootstrap process). The driver must wait until it is + * finished. Otherwise, it will result in unpredictable behavior. + */ + udelay(200); + } + return denali_init(denali); }
When the reset signal is de-asserted, the HW-controlled bootstrap starts running unless it is disabled in the SoC integration. It issues some commands to detect a NAND chip, and sets up registers automatically. Until this process finishes, software should avoid any register access. Without this delay function, some of UniPhier boards hangs up while executing nand_scan_ident(). (denali_read_byte() is blocked) Signed-off-by: Masahiro Yamada <yamada.masahiro at socionext.com> --- Changes in v2: None drivers/mtd/nand/raw/denali_dt.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)