From patchwork Fri Mar 30 14:30:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sekhar Nori X-Patchwork-Id: 10317805 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 242756063D for ; Fri, 30 Mar 2018 14:46:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10B0D2A597 for ; Fri, 30 Mar 2018 14:46:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 03DFE2A59B; Fri, 30 Mar 2018 14:46:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 799F12A597 for ; Fri, 30 Mar 2018 14:46:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=kb6bLuz8V2OOqEBIRdkdfY0SBwqrUycn9yUHzJHDQ9I=; b=fTWize/w38Fi/r 6UDiroJgvZ8ERkevL6DM5GsOVxvZcGss781ikaaJ/r9VXDb+v8L2ez2SgTghDqIdv60rWCVOUY7zD M0RIkjMLllm/RAo5SWU+ewJ83173wBRR66H2zPNndJSaJpzisNcdotgE2ocEhONP7kCtLWCeB55UX bhqruPC504AJx5YPsfWylh3IQ5AN4ZOKaFpBme3ZFGjeU9tlAxbIyTrh0YfPlbR7O5ySySl2ung7S udDgJIHmgVFY1w8LhPeYad38OahyPqZyIK3/thyUS3xLQcOx/b1FdAkgIakp0lxKsgObRYEHuI/xH n4PJKYyFrU1hB9hEpKnA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f1vIS-00080R-Ux; Fri, 30 Mar 2018 14:46:28 +0000 Received: from fllnx209.ext.ti.com ([198.47.19.16]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f1v5K-0006uz-T2; Fri, 30 Mar 2018 14:34:59 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id w2UEUtBB009411; Fri, 30 Mar 2018 09:30:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1522420255; bh=0ObDBsF0R8EyioL6mtnqU0UsedPXPXHiKgnKSTlj1Z8=; h=From:To:CC:Subject:Date; b=x7OOpeXFQFdnxI+fjLGlCCT48I7YRU0qt4b8VOv/KNvRdako1t5IGvLx2ScK7IXpH eEVz95gJhBsnhliC+wLQnL+97V5+naU0JXSB7/KPV95tFIafwbTl0du6JBvOyHvHny LR9FWDu1UNf00mSBPTq0r4c80+JodCrZb9B9222k= Received: from DFLE108.ent.ti.com (dfle108.ent.ti.com [10.64.6.29]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w2UEUt4w022782; Fri, 30 Mar 2018 09:30:55 -0500 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Fri, 30 Mar 2018 09:30:55 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Fri, 30 Mar 2018 09:30:55 -0500 Received: from psplinux063.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w2UEUpe4010931; Fri, 30 Mar 2018 09:30:52 -0500 From: Sekhar Nori To: Boris Brezillon Subject: [PATCH] mtd: nand: davinci: don't acquire and enable clock Date: Fri, 30 Mar 2018 20:00:51 +0530 Message-ID: <20180330143051.26423-1-nsekhar@ti.com> X-Mailer: git-send-email 2.16.2 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180330_073437_636723_F3805CC1 X-CRM114-Status: GOOD ( 21.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Lechner , Bartosz Golaszewski , Richard Weinberger , Sekhar Nori , linux-kernel@vger.kernel.org, Marek Vasut , linux-mtd@lists.infradead.org, Cyrille Pitchen , Brian Norris , David Woodhouse , Linux ARM Mailing List Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP NAND itself is an asynchronous interface, it does not have any clock input. DaVinci NAND driver acquires clock for AEMIF (asynchronous external memory interface) which is an on-chip IP to which NAND is connected. The same clock is also enabled in AEMIF driver (either present drivers/memory or from machine code for some older platforms). AEMIF timing must be initialized before NAND can be accessed. This ensures that AEMIF clock is enabled too. Remove the superfluous clock acquisition and enable in DaVinci NAND driver. Tested on K2L, K2HK, K2E, DA850 EVM, DA850 LCDK in device-tree boot and DM644x EVM in legacy boot. Signed-off-by: Sekhar Nori Tested-by: Bartosz Golaszewski --- Hi Boris, If/when this patch gets accepted, it will nice to put this on an immutable branch others can merge. There is potential cleanup in drivers/clock and in DaVinci machine code that will depend on this. Thanks, Sekhar drivers/mtd/nand/raw/davinci_nand.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/drivers/mtd/nand/raw/davinci_nand.c b/drivers/mtd/nand/raw/davinci_nand.c index 0f09518d980f..7255a0d94374 100644 --- a/drivers/mtd/nand/raw/davinci_nand.c +++ b/drivers/mtd/nand/raw/davinci_nand.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -55,7 +54,6 @@ struct davinci_nand_info { struct nand_chip chip; struct device *dev; - struct clk *clk; bool is_readmode; @@ -703,22 +701,6 @@ static int nand_davinci_probe(struct platform_device *pdev) /* Use board-specific ECC config */ info->chip.ecc.mode = pdata->ecc_mode; - ret = -EINVAL; - - info->clk = devm_clk_get(&pdev->dev, "aemif"); - if (IS_ERR(info->clk)) { - ret = PTR_ERR(info->clk); - dev_dbg(&pdev->dev, "unable to get AEMIF clock, err %d\n", ret); - return ret; - } - - ret = clk_prepare_enable(info->clk); - if (ret < 0) { - dev_dbg(&pdev->dev, "unable to enable AEMIF clock, err %d\n", - ret); - goto err_clk_enable; - } - spin_lock_irq(&davinci_nand_lock); /* put CSxNAND into NAND mode */ @@ -732,7 +714,7 @@ static int nand_davinci_probe(struct platform_device *pdev) ret = nand_scan_ident(mtd, pdata->mask_chipsel ? 2 : 1, NULL); if (ret < 0) { dev_dbg(&pdev->dev, "no NAND chip(s) found\n"); - goto err; + return ret; } switch (info->chip.ecc.mode) { @@ -838,9 +820,6 @@ static int nand_davinci_probe(struct platform_device *pdev) nand_cleanup(&info->chip); err: - clk_disable_unprepare(info->clk); - -err_clk_enable: spin_lock_irq(&davinci_nand_lock); if (info->chip.ecc.mode == NAND_ECC_HW_SYNDROME) ecc4_busy = false; @@ -859,8 +838,6 @@ static int nand_davinci_remove(struct platform_device *pdev) nand_release(nand_to_mtd(&info->chip)); - clk_disable_unprepare(info->clk); - return 0; }