|
@@ -419,17 +419,12 @@ 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));
|
|
|
|
|
|
- if (revision < REVISION_5_1)
|
|
|
- denali->max_banks = 2 << (features & FEATURES__N_BANKS);
|
|
|
- else
|
|
|
- denali->max_banks = 1 << (features & FEATURES__N_BANKS);
|
|
|
+ denali->max_banks = 1 << (features & FEATURES__N_BANKS);
|
|
|
+
|
|
|
+ /* the encoding changed from rev 5.0 to 5.1 */
|
|
|
+ if (denali->revision < 0x0501)
|
|
|
+ denali->max_banks <<= 1;
|
|
|
}
|
|
|
|
|
|
static uint16_t denali_nand_timing_set(struct denali_nand_info *denali)
|
|
@@ -1319,6 +1314,14 @@ static void denali_cmdfunc(struct mtd_info *mtd, unsigned int cmd, int col,
|
|
|
/* Initialization code to bring the device up to a known good state */
|
|
|
static void denali_hw_init(struct denali_nand_info *denali)
|
|
|
{
|
|
|
+ /*
|
|
|
+ * The REVISION register may not be reliable. Platforms are allowed to
|
|
|
+ * override it.
|
|
|
+ */
|
|
|
+ if (!denali->revision)
|
|
|
+ denali->revision =
|
|
|
+ swab16(ioread32(denali->flash_reg + REVISION));
|
|
|
+
|
|
|
/*
|
|
|
* tell driver how many bit controller will skip before
|
|
|
* writing ECC code in OOB, this register may be already
|