Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753468AbcKZSJS (ORCPT ); Sat, 26 Nov 2016 13:09:18 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:48006 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753149AbcKZSIP (ORCPT ); Sat, 26 Nov 2016 13:08:15 -0500 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com uAQI6Uf2018512 X-Nifty-SrcIP: [111.169.71.157] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org, Boris Brezillon , Marek Vasut , Brian Norris , Richard Weinberger , David Woodhouse , Cyrille Pitchen Subject: [PATCH 30/39] mtd: nand: denali: set DEVICES_CONNECTED 1 if not set Date: Sun, 27 Nov 2016 03:06:16 +0900 Message-Id: <1480183585-592-31-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1480183585-592-1-git-send-email-yamada.masahiro@socionext.com> References: <1480183585-592-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1483 Lines: 43 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 --- drivers/mtd/nand/denali.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c index 71bdf2a..4b2bbcb 100644 --- a/drivers/mtd/nand/denali.c +++ b/drivers/mtd/nand/denali.c @@ -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; -- 2.7.4