From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ivan Khoronzhuk Date: Wed, 25 Jun 2014 18:42:26 +0300 Subject: [U-Boot] [U-boot] [Patch v2 3/3] k2hk: change default nand ecc layout In-Reply-To: <1403652315.2435.51.camel@snotra.buserror.net> References: <1403306929-1241-1-git-send-email-ivan.khoronzhuk@ti.com> <1403306929-1241-4-git-send-email-ivan.khoronzhuk@ti.com> <1403307619.12851.209.camel@snotra.buserror.net> <53A8473A.907@ti.com> <1403652315.2435.51.camel@snotra.buserror.net> Message-ID: <53AAEDE2.3040406@ti.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 >>>> --- >>>> 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 >>>> #include >>>> #include >>>> +#include >>>> >>>> #include >>>> #include >>>> @@ -19,6 +20,7 @@ >>>> #include >>>> #include >>>> #include >>>> +#include >>>> >>>> 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 > >>> Is it really OK to start with the wrong ECC layout and switch later? >> It can be used to boot from nand. > That doesn't answer my question. Seems It can be started with default ecc layout. So I'm going to remove subj patch. > >>> Are you depending on lazy scanning of the BBT? >> No, define CONFIG_SYS_NAND_USE_FLASH_BBT > My point is, if the scanning of the BBT happens before you set the > layout, it will be read using the wrong ECC layout. > >>> For that matter, you also seem to be assuming that markbad will never be >>> called when the ECC is set to something other than what the BBT uses. >>> >>> -Scott >>> >>> >> I suppose that only ECC layout is different. > "only"? That's a big deal. > > -Scott > > 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. Thanks. -- Regards, Ivan Khoronzhuk