1 diff --git a/drivers/mtd/nand/brcmstb_nand.c b/drivers/mtd/nand/brcmstb_nand.c
2 index cd35193..9312b97 100644
3 --- a/drivers/mtd/nand/brcmstb_nand.c
4 +++ b/drivers/mtd/nand/brcmstb_nand.c
5 @@ -1260,6 +1260,37 @@ static void brcmstb_nand_print_cfg(char *buf, struct brcmstb_nand_cfg *cfg)
6 sprintf(buf, ", BCH-%u\n", cfg->ecc_level);
10 + * Return true if the two configurations are basically identical. Note that we
11 + * allow certain variations in spare area size.
13 +static bool brcmstb_nand_config_match(struct brcmstb_nand_cfg *orig,
14 + struct brcmstb_nand_cfg *new)
16 + /* Negative matches */
17 + if (orig->device_size != new->device_size)
19 + if (orig->block_size != new->block_size)
21 + if (orig->page_size != new->page_size)
23 + if (orig->device_width != new->device_width)
25 + if (orig->col_adr_bytes != new->col_adr_bytes)
27 + if (orig->blk_adr_bytes != new->blk_adr_bytes)
29 + if (orig->ful_adr_bytes != new->ful_adr_bytes)
32 + /* Positive matches */
33 + if (orig->spare_area_size == new->spare_area_size)
35 + return orig->spare_area_size >= 27 &&
36 + orig->spare_area_size <= new->spare_area_size;
40 static int brcmstb_nand_setup_dev(struct brcmstb_nand_host *host)
42 struct mtd_info *mtd = &host->mtd;
43 @@ -1303,14 +1334,7 @@ static int brcmstb_nand_setup_dev(struct brcmstb_nand_host *host)
44 mtd->oobsize = new_cfg.spare_area_size * (mtd->writesize >> FC_SHIFT);
47 - if (orig_cfg.device_size != new_cfg.device_size ||
48 - orig_cfg.block_size != new_cfg.block_size ||
49 - orig_cfg.page_size != new_cfg.page_size ||
50 - orig_cfg.spare_area_size != new_cfg.spare_area_size ||
51 - orig_cfg.device_width != new_cfg.device_width ||
52 - orig_cfg.col_adr_bytes != new_cfg.col_adr_bytes ||
53 - orig_cfg.blk_adr_bytes != new_cfg.blk_adr_bytes ||
54 - orig_cfg.ful_adr_bytes != new_cfg.ful_adr_bytes) {
55 + if (!brcmstb_nand_config_match(&orig_cfg, &new_cfg)) {
56 #if CONTROLLER_VER >= 50
57 #ifdef CONFIG_BCM7445A0
58 /* HW7445-750: 7445A0 NAND is broken for SECTOR_SIZE = 1024B */