summaryrefslogtreecommitdiff
path: root/drivers/mtd/nand/denali.c
diff options
context:
space:
mode:
authorGraham Moore <grmoore@opensource.altera.com>2015-07-21 17:39:31 +0300
committerBrian Norris <computersforpeace@gmail.com>2015-09-29 21:44:59 +0300
commit271707b1d817f5104e02b2bd1bab43f0c8759418 (patch)
tree39cee6aba8d527a6ad9ff3751acaa729a855bcdd /drivers/mtd/nand/denali.c
parent9c07d094bbfe3d09e4c3e01a81cd1399bd23b268 (diff)
downloadlinux-271707b1d817f5104e02b2bd1bab43f0c8759418.tar.xz
mtd: nand: denali: max_banks calculation changed in revision 5.1
Read Denali hardware revision number and use it to calculate max_banks, The encoding of max_banks changed in Denali revision 5.1. Signed-off-by: Graham Moore <grmoore@opensource.altera.com> [Brian: parentheses around macro arg] Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd/nand/denali.c')
-rw-r--r--drivers/mtd/nand/denali.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c
index 7b6186ffe3ac..43c0771c587c 100644
--- a/drivers/mtd/nand/denali.c
+++ b/drivers/mtd/nand/denali.c
@@ -458,8 +458,17 @@ static void find_valid_banks(struct denali_nand_info *denali)
static void detect_max_banks(struct denali_nand_info *denali)
{
uint32_t features = ioread32(denali->flash_reg + FEATURES);
+ /*
+ * Read the revision register, so we can calculate the max_banks
+ * properly: the encoding changed from rev 5.0 to 5.1
+ */
+ u32 revision = MAKE_COMPARABLE_REVISION(
+ ioread32(denali->flash_reg + REVISION));
- denali->max_banks = 2 << (features & FEATURES__N_BANKS);
+ if (revision < REVISION_5_1)
+ denali->max_banks = 2 << (features & FEATURES__N_BANKS);
+ else
+ denali->max_banks = 1 << (features & FEATURES__N_BANKS);
}
static void detect_partition_feature(struct denali_nand_info *denali)