[linux-vuplus-zero] support new LNB chip.
[vuplus_openvuplus_3.0] / meta-bsp / recipes-kernel / linux / linux-vuplus-3.13.5 / vuzero / linux_nand_bcm.patch
diff --git a/meta-bsp/recipes-kernel/linux/linux-vuplus-3.13.5/vuzero/linux_nand_bcm.patch b/meta-bsp/recipes-kernel/linux/linux-vuplus-3.13.5/vuzero/linux_nand_bcm.patch
new file mode 100644 (file)
index 0000000..0327f85
--- /dev/null
@@ -0,0 +1,58 @@
+diff --git a/drivers/mtd/nand/brcmstb_nand.c b/drivers/mtd/nand/brcmstb_nand.c
+index cd35193..9312b97 100644
+--- a/drivers/mtd/nand/brcmstb_nand.c
++++ b/drivers/mtd/nand/brcmstb_nand.c
+@@ -1260,6 +1260,37 @@ static void brcmstb_nand_print_cfg(char *buf, struct brcmstb_nand_cfg *cfg)
+               sprintf(buf, ", BCH-%u\n", cfg->ecc_level);
+ }
++/*
++ * Return true if the two configurations are basically identical. Note that we
++ * allow certain variations in spare area size.
++ */
++static bool brcmstb_nand_config_match(struct brcmstb_nand_cfg *orig,
++                struct brcmstb_nand_cfg *new)
++{
++        /* Negative matches */
++        if (orig->device_size != new->device_size)
++                return false;
++        if (orig->block_size != new->block_size)
++                return false;
++        if (orig->page_size != new->page_size)
++                return false;
++        if (orig->device_width != new->device_width)
++                return false;
++        if (orig->col_adr_bytes != new->col_adr_bytes)
++                return false;
++        if (orig->blk_adr_bytes != new->blk_adr_bytes)
++                return false;
++        if (orig->ful_adr_bytes != new->ful_adr_bytes)
++                return false;
++
++        /* Positive matches */
++        if (orig->spare_area_size == new->spare_area_size)
++                return true;
++        return orig->spare_area_size >= 27 &&
++               orig->spare_area_size <= new->spare_area_size;
++}
++
++
+ static int brcmstb_nand_setup_dev(struct brcmstb_nand_host *host)
+ {
+       struct mtd_info *mtd = &host->mtd;
+@@ -1303,14 +1334,7 @@ static int brcmstb_nand_setup_dev(struct brcmstb_nand_host *host)
+               mtd->oobsize = new_cfg.spare_area_size * (mtd->writesize >> FC_SHIFT);
+       }
+-      if (orig_cfg.device_size != new_cfg.device_size ||
+-                      orig_cfg.block_size != new_cfg.block_size ||
+-                      orig_cfg.page_size != new_cfg.page_size ||
+-                      orig_cfg.spare_area_size != new_cfg.spare_area_size ||
+-                      orig_cfg.device_width != new_cfg.device_width ||
+-                      orig_cfg.col_adr_bytes != new_cfg.col_adr_bytes ||
+-                      orig_cfg.blk_adr_bytes != new_cfg.blk_adr_bytes ||
+-                      orig_cfg.ful_adr_bytes != new_cfg.ful_adr_bytes) {
++      if (!brcmstb_nand_config_match(&orig_cfg, &new_cfg)) {
+ #if CONTROLLER_VER >= 50
+ #ifdef CONFIG_BCM7445A0
+               /* HW7445-750: 7445A0 NAND is broken for SECTOR_SIZE = 1024B */