From: Chin Liang See <clsee@altera.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 1/6] nand: denali: add Denali NAND driver for SPL
Date: Mon, 15 Sep 2014 01:39:07 -0500 [thread overview]
Message-ID: <1410763147.2167.7.camel@clsee-VirtualBox.altera.com> (raw)
In-Reply-To: <20140912170601.2C92.AA925319@jp.panasonic.com>
Hi Masahiro,
On Fri, 2014-09-12 at 17:06 +0900, Masahiro Yamada wrote:
> > > +/* nand_init() - initialize data to make nand usable by SPL */
> > > +void nand_init(void)
> > > +{
> > > + /* access to main area */
> > > + writel(0, denali_flash_reg + TRANSFER_SPARE_REG);
> > > +
> > > + page_size = readl(denali_flash_reg + DEVICE_MAIN_AREA_SIZE);
> > > + oob_size = readl(denali_flash_reg + DEVICE_SPARE_AREA_SIZE);
> > > + pages_per_block = readl(denali_flash_reg + PAGES_PER_BLOCK);
> >
> >
> > I believe this will work for ONFI NAND devices only.
> > For non-ONFI, the value might not correct.
>
>
> I don't think so.
> It depends on the hardware; in my understanding
> Denali IP is capable of detecting MAIN_AREA_SIZE etc.
> for non-ONFI devices. At least this is working with non-ONFI devices
> on some Panasonic boards.
>
> If it does not work for Altera SoCs (and if you are planning to use
> this driver), these three registers should be set in advance
> in an earlier board init.
>
I recall one of my colleague was telling me that it doesn't work for one
of non ONFI part where it read incorrect page size. Nevertheless, we can
put comments so user which use this driver need to take note.
>
>
>
> > > +}
> > > +
> > > +int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst)
> > > +{
> > > + int block, page, column, readlen;
> > > + int ret;
> > > + int force_bad_block_check = 1;
> > > +
> > > + page = offs / page_size;
> > > + column = offs % page_size;
> > > +
> > > + block = page / pages_per_block;
> > > + page = page % pages_per_block;
> > > +
> > > + while (size) {
> >
> > I believe we need to error out when reading beyond last block.
>
>
> How do you know the number of blocks of non-ONFI devices?
> Scan nand_ids.c for SPL?
>
I believe we can have a macro for this. But rethinking back, we can skip
this check to make the SPL as simple as possible.
> >
>
> > > + if (force_bad_block_check || page == 0) {
> > > + ret = nand_block_isbad(block);
> > > + if (ret < 0)
> > > + return ret;
> > > +
> > > + if (ret) {
> > > + block++;
> > > + continue;
> > > + }
> > > + }
> > > +
> > > + force_bad_block_check = 0;
> >
> > I believe we still need to check the subsequent block whether is bad or
> > not too. This can be enable when cross the block boundary.
>
>
> I am afraid you are misunderstanding my code.
>
> This function does bad block checking for every block.
>
> Here,
>
> if (force_bad_block_check || page == 0) {
> ret = nand_block_isbad(block);
>
>
> "page == 0" means the beginning of each block.
>
>
Yup, you are right. I was confused with the variable.
>
>
>
> >
> >
> > Currently U-Boot has drivers/mtd/nand/nand_spl_simple.c which handling
> > the SPL NAND image load. Wonder this driver will be integrated into
> > nand_spl_simple.c once drivers/mtd/nand/denali.c is applied?
>
> I am not planning to do so because:
>
> [1] nand_spl_simple.c requires CONFIG_SYS_NAND_BLOCK_SIZE, CONFIG_SYS_NAND_PAGE_SIZE,
> CONFIG_SYS_NAND_PAGE_COUNT; we need to specify the device attributes at compilation,
> which the Denali IP is able to detect at run time.
> It is not acceptable for us because we need (want) the run time configuration.
>
> [2] nand_spl_simple.c is so generic that it cannot use the hardware acceleration of
> the Denali IP, that is, slower booting.
>
Yup, you identified the nand_spl_simple.c constrain. This is why I
patched this file at
http://rocketboards.org/gitweb/?p=u-boot-socfpga.git;a=commit;h=461a61b8f03d3b690de1f4ff007cd23fb80018a5. But I didn't send this patch out as I am waiting the NAND driver patch accepted.
Thanks
Chin Liang
>
> Best Regards
> Masahiro Yamada
>
next prev parent reply other threads:[~2014-09-15 6:39 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-05 5:50 [U-Boot] [PATCH v4 0/6] Add support for Panasonic UniPhier SoCs/boards Masahiro Yamada
2014-09-05 5:50 ` [U-Boot] [PATCH v4 1/6] nand: denali: add Denali NAND driver for SPL Masahiro Yamada
2014-09-12 7:09 ` Chin Liang See
2014-09-12 8:06 ` Masahiro Yamada
2014-09-15 6:39 ` Chin Liang See [this message]
2014-09-17 9:09 ` Masahiro Yamada
2014-09-17 12:10 ` Chin Liang See
2014-09-05 5:50 ` [U-Boot] [PATCH v4 2/6] serial: add UniPhier serial driver Masahiro Yamada
2014-09-05 10:35 ` Marek Vasut
2014-09-05 12:03 ` Masahiro Yamada
2014-09-05 12:59 ` Marek Vasut
2014-09-05 16:41 ` Simon Glass
2014-09-06 14:49 ` Masahiro YAMADA
2014-09-19 12:15 ` Masahiro Yamada
2014-09-19 16:30 ` Simon Glass
2014-09-20 7:18 ` Masahiro YAMADA
2014-09-22 6:35 ` Simon Glass
2014-09-05 5:50 ` [U-Boot] [PATCH v4 3/6] arm: uniphier: add UniPhier SoC support code Masahiro Yamada
2014-09-05 18:59 ` Simon Glass
2014-09-06 15:34 ` Masahiro YAMADA
2014-09-06 16:39 ` Simon Glass
2014-09-05 5:50 ` [U-Boot] [PATCH v4 4/6] arm: uniphier: add Kconfig and defconfig Masahiro Yamada
2014-09-05 5:50 ` [U-Boot] [PATCH v4 5/6] MAINTAINERS: add me as a maintainer of UniPhier platform Masahiro Yamada
2014-09-18 11:33 ` Albert ARIBAUD
2014-09-18 11:40 ` Michal Simek
2014-09-05 5:50 ` [U-Boot] [PATCH v4 6/6] git-mailrc: " Masahiro Yamada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1410763147.2167.7.camel@clsee-VirtualBox.altera.com \
--to=clsee@altera.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox