@@ -1485,6 +1485,13 @@ static void denali_multidev_fixup(struct denali_nand_info *denali)
*/
denali->devnum = ioread32(denali->flash_reg + DEVICES_CONNECTED);
+ /*
+ * On some SoCs, DEVICES_CONNECTED is not auto-detected. For those SoCs
+ * DEVICES_CONNECT is left to 0. Set 1 if it is the case.
+ */
+ if (denali->devnum == 0)
+ denali->devnum = 1;
+
devnum_shift = fls(denali->devnum) - 1;
if (denali->devnum != BIT(devnum_shift)) {
@@ -1492,9 +1499,10 @@ static void denali_multidev_fixup(struct denali_nand_info *denali)
"DEVICE_CONNECTED=%d is not power of 2. Some devices will not be used.\n",
denali->devnum);
denali->devnum = BIT(devnum_shift);
- iowrite32(denali->devnum, denali->flash_reg + DEVICES_CONNECTED);
}
+ iowrite32(denali->devnum, denali->flash_reg + DEVICES_CONNECTED);
+
mtd->size <<= devnum_shift;
mtd->erasesize <<= devnum_shift;
mtd->writesize <<= devnum_shift;
Currently, the driver expects DEVICE_CONNECTED is automatically set by the hardware, but this feature is disabled in some cases. In such cases, it is the software's responsibility to set up the DEVICES_CONNECTED register. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> --- drivers/mtd/nand/denali.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) -- 2.7.4