From: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [U-boot] [Patch v2 3/3] k2hk: change default nand ecc layout
Date: Wed, 25 Jun 2014 20:37:13 +0300 [thread overview]
Message-ID: <53AB08C9.2050103@ti.com> (raw)
In-Reply-To: <1403716546.2435.70.camel@snotra.buserror.net>
On 06/25/2014 08:15 PM, Scott Wood wrote:
> On Wed, 2014-06-25 at 18:42 +0300, Ivan Khoronzhuk wrote:
>> On 06/25/2014 02:25 AM, Scott Wood wrote:
>>> On Mon, 2014-06-23 at 18:26 +0300, Ivan Khoronzhuk wrote:
>>>> On 06/21/2014 02:40 AM, Scott Wood wrote:
>>>>> On Sat, 2014-06-21 at 02:28 +0300, Ivan Khoronzhuk wrote:
>>>>>> For keystyone k2hk board the default nand layout is different
>>>>>> from davinci. So swich ecc layout at init in board file.
>>>>>>
>>>>>> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
>>>>>> ---
>>>>>> board/ti/k2hk_evm/board.c | 11 +++++++++++
>>>>>> 1 file changed, 11 insertions(+)
>>>>>>
>>>>>> diff --git a/board/ti/k2hk_evm/board.c b/board/ti/k2hk_evm/board.c
>>>>>> index ef90f9d..baa6ab7 100644
>>>>>> --- a/board/ti/k2hk_evm/board.c
>>>>>> +++ b/board/ti/k2hk_evm/board.c
>>>>>> @@ -11,6 +11,7 @@
>>>>>> #include <exports.h>
>>>>>> #include <fdt_support.h>
>>>>>> #include <libfdt.h>
>>>>>> +#include <nand.h>
>>>>>>
>>>>>> #include <asm/arch/hardware.h>
>>>>>> #include <asm/arch/clock.h>
>>>>>> @@ -19,6 +20,7 @@
>>>>>> #include <asm/arch/emac_defs.h>
>>>>>> #include <asm/arch/psc_defs.h>
>>>>>> #include <asm/ti-common/ti-aemif.h>
>>>>>> +#include <asm/ti-common/davinci_nand.h>
>>>>>>
>>>>>> DECLARE_GLOBAL_DATA_PTR;
>>>>>>
>>>>>> @@ -147,6 +149,15 @@ int cpu_to_bus(u32 *ptr, u32 length)
>>>>>> return 0;
>>>>>> }
>>>>>>
>>>>>> +int board_nand_init(struct nand_chip *chip)
>>>>>> +{
>>>>>> + davinci_nand_init(chip);
>>>>>> + chip->ecc.layout =
>>>>>> + board_nand_get_ecclayout(NAND_KEYSTONE_RBL_4BIT_LAYOUT);
>>>>>> +
>>>>>> + return 0;
>>>>>> +}
>>>>> Shouldn't you be calling board_nand_set_ecclayout()? How will oobavail
>>>>> get set?
>>>> There is no reason to set oobavail here, I suppose that's done while int
>>>> nand_scan_tail().
>>> But nand_scan_tail() has already run at this point. oobavail would be
>>> set based on the wrong layout.
>> Where did you get.. I've checked it again. It was called after
>> board_nand_init().
>>
>> nand_init_chip
>> -> board_nand_init
>> -> nand_scan
>> -> nand_scan_tail
> Never mind, I was thinking of the flow when using
> CONFIG_SYS_NAND_SELF_INIT.
>
> Still, it's probably not great to introduce a mechanism that is
> incompatible with transitioning to self-init.
>
>> If I correctly understand you, what if while we are writing data a new
>> bad block is found?
>> Then we try to update BBT wich was written using a different layout....
>>
>> Well probably I should rewrite BBT when layout is switched..
>> Will see if it can be done correctly.
> Could you clarify the use case here? Are you changing the layout at
> runtime so that different portions of the chip use different ECC schemes
> (e.g. because booting requires something different)?
Exactly. It has partitions with different ecc layouts.
ROM bootloader uses own ecclayout ...(and it doesn't touch BBT).
> If so, then you
> don't want to rewrite the BBT based on this, and a better approach than
> a command line switcher would be to be able to define different layouts
> for different offset ranges.
>
> If this is meant to be a permanent change that affects the entire chip,
> then the entire chip (not just the BBT, but excluding factory bad block
> markers) needs to be wiped when you change, and you should be recording
> the default in the environment (e.g. hwconfig) rather than switching
> with a command line option.
>
> -Scott
>
Thanks Scott,
I'm thinking how to split chip for using different ecc layouts.
If it be OK, I'll remove commands in question.
--
Regards,
Ivan Khoronzhuk
prev parent reply other threads:[~2014-06-25 17:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-20 23:28 [U-Boot] [U-boot] [Patch v2 0/3] keystone: nand: add additional nand ecclayout Ivan Khoronzhuk
2014-06-20 23:28 ` [U-Boot] [U-boot] [Patch v2 1/3] mtd: nand: davinci: allow to change ecclayout by ecclayout command Ivan Khoronzhuk
2014-06-20 23:28 ` [U-Boot] [U-boot] [Patch v2 2/3] common: cmd_nand: add nand " Ivan Khoronzhuk
2014-06-20 23:28 ` [U-Boot] [U-boot] [Patch v2 3/3] k2hk: change default nand ecc layout Ivan Khoronzhuk
2014-06-20 23:40 ` Scott Wood
2014-06-23 15:26 ` Ivan Khoronzhuk
2014-06-24 23:25 ` Scott Wood
2014-06-25 15:42 ` Ivan Khoronzhuk
2014-06-25 17:15 ` Scott Wood
2014-06-25 17:37 ` Ivan Khoronzhuk [this message]
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=53AB08C9.2050103@ti.com \
--to=ivan.khoronzhuk@ti.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