imx: nand: Support flash based BBT
Signed-off-by: Timo Ketola <timo@exertus.fi> Acked-by: Scott Wood <scottwood@freescale.com>
This commit is contained in:
		
							parent
							
								
									eba1868be4
								
							
						
					
					
						commit
						a1028730b5
					
				|  | @ -1302,12 +1302,45 @@ static void mxc_setup_config1(void) | ||||||
| #define mxc_setup_config1() | #define mxc_setup_config1() | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | #ifdef CONFIG_SYS_NAND_USE_FLASH_BBT | ||||||
|  | 
 | ||||||
|  | static u8 bbt_pattern[] = {'B', 'b', 't', '0' }; | ||||||
|  | static u8 mirror_pattern[] = {'1', 't', 'b', 'B' }; | ||||||
|  | 
 | ||||||
|  | static struct nand_bbt_descr bbt_main_descr = { | ||||||
|  | 	.options = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE | NAND_BBT_WRITE | | ||||||
|  | 		   NAND_BBT_2BIT | NAND_BBT_VERSION | NAND_BBT_PERCHIP, | ||||||
|  | 	.offs =	0, | ||||||
|  | 	.len = 4, | ||||||
|  | 	.veroffs = 4, | ||||||
|  | 	.maxblocks = 4, | ||||||
|  | 	.pattern = bbt_pattern, | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | static struct nand_bbt_descr bbt_mirror_descr = { | ||||||
|  | 	.options = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE | NAND_BBT_WRITE | | ||||||
|  | 		   NAND_BBT_2BIT | NAND_BBT_VERSION | NAND_BBT_PERCHIP, | ||||||
|  | 	.offs =	0, | ||||||
|  | 	.len = 4, | ||||||
|  | 	.veroffs = 4, | ||||||
|  | 	.maxblocks = 4, | ||||||
|  | 	.pattern = mirror_pattern, | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| int board_nand_init(struct nand_chip *this) | int board_nand_init(struct nand_chip *this) | ||||||
| { | { | ||||||
| 	struct mtd_info *mtd; | 	struct mtd_info *mtd; | ||||||
| 	uint16_t tmp; | 	uint16_t tmp; | ||||||
| 	int err = 0; | 	int err = 0; | ||||||
| 
 | 
 | ||||||
|  | #ifdef CONFIG_SYS_NAND_USE_FLASH_BBT | ||||||
|  | 	this->options |= NAND_USE_FLASH_BBT; | ||||||
|  | 	this->bbt_td = &bbt_main_descr; | ||||||
|  | 	this->bbt_md = &bbt_mirror_descr; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| 	/* structures must be linked */ | 	/* structures must be linked */ | ||||||
| 	mtd = &host->mtd; | 	mtd = &host->mtd; | ||||||
| 	mtd->priv = this; | 	mtd->priv = this; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue