On Mon, 2013-09-30 at 23:52 +0530, Pekon Gupta wrote: > From: Matthieu CASTET <matthieu.cas...@parrot.com> > > This patch is modified version from following linux patch > http://lists.infradead.org/pipermail/linux-mtd/2012-November/044803.html > So retaining the authorship to Matthieu CASTET <matthieu.cas...@parrot.com> > > *Modifications from original patch* > (1) use CONFIG_SYS_NAND_ONFI_DETECTION instead of (chip->options & > NAND_BUSWIDTH_AUTO) > (2) allow re-assigning of callbacks in nand_set_defaults() depending on > bus-width > > *Original patch message* > The driver call nand_scan_ident in 8 bit mode, then > readid or onfi detection are done (and detect bus width). > The driver should update its bus width before calling nand_scan_tail. > > This work because readid and onfi are read work 8 byte mode. > > Note that nand_scan_ident send command (NAND_CMD_RESET, NAND_CMD_READID, > NAND_CMD_PARAM), address and read data > The ONFI specificication is not very clear for x16 device if high byte of > address should be driven to 0, > but according to [1] it should be ok to not drive it during autodetection. > > [1] > 3.3.2. Target Initialization > > [...] > The Read ID and Read Parameter Page commands only use the lower 8-bits of the > data bus. > The host shall not issue commands that use a word data width on x16 devices > until the host > determines the device supports a 16-bit data bus width in the parameter page. > > Signed-off-by: Pekon Gupta <pe...@ti.com> > --- > drivers/mtd/nand/nand_base.c | 20 ++++++++++++++++---- > 1 file changed, 16 insertions(+), 4 deletions(-) > > diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c > index 9e05cef..4ef0edb 100644 > --- a/drivers/mtd/nand/nand_base.c > +++ b/drivers/mtd/nand/nand_base.c > @@ -2514,7 +2514,7 @@ static void nand_set_defaults(struct nand_chip *chip, > int busw) > > if (!chip->select_chip) > chip->select_chip = nand_select_chip; > - if (!chip->read_byte) > + if ((!chip->read_byte) || (chip->read_byte == nand_read_byte)) > chip->read_byte = busw ? nand_read_byte16 : nand_read_byte;
Unnecessary parens (and doesn't match equivalent Linux code). This change corresponds to Linux commit 68e8078072e802e77134664f11d2ffbfbd2f8fbe. -Scott _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot