From patchwork Wed Nov 4 16:13:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 540016 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2387014110D for ; Thu, 5 Nov 2015 03:20:57 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=vanguardiasur_com_ar.20150623.gappssmtp.com header.i=@vanguardiasur_com_ar.20150623.gappssmtp.com header.b=N02TIFsz; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zu0lp-0001FS-Ml; Wed, 04 Nov 2015 16:18:45 +0000 Received: from mail-qk0-x22c.google.com ([2607:f8b0:400d:c09::22c]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zu0le-00017U-Py for linux-mtd@lists.infradead.org; Wed, 04 Nov 2015 16:18:37 +0000 Received: by qkcn129 with SMTP id n129so22060866qkc.1 for ; Wed, 04 Nov 2015 08:18:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vanguardiasur_com_ar.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3dRNtvncVa8Ns6aMXwkVLjrHRnzIS0DnmqxlDG9oXbk=; b=N02TIFszTywPcO43dSt6fcnR7YUj1C2hkgjN8vJI1UkscdD5CsXEWCq8plx1NvtML4 JV5NgDtr027sbVgWVjg5C6q+4VwKm8FGYly+JQC1TdwpBA5w1G7L5Nrvgk9rH/UJnAl/ 6jkPSxi5kGNGE5h4j9vQq9NXTiQ6uSsqvLIRRbOrGGp8y7r14crpMA4fHoKyjxNZ0XWi FQUfCjMM4GJ/+m2e0D0tCD1tq0V0tkv7itr886E0cLV1514kigI01+FqhTyB6NVtyuTm RkimeWmTKrmJ1J9aIHLSdYrXsiweR1ca7Y+C2H2ABA1i3+dWofdIgAr5NJrR97Jvp80R wi2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3dRNtvncVa8Ns6aMXwkVLjrHRnzIS0DnmqxlDG9oXbk=; b=KorpLxXNYHo8dUFnppJ7wlcTCHdhDjZIyntDIVm237qBecKcNXmu359KAUTcgy9OvG m+EIipXKY48hTk0sNxIM7ToK8C1oAhxF9qXWSo+NL/b44cO+ymI4SOUnHSJ+AcFFfqc2 5yMpQ5qOXkvdBxY5nnPD1t08LQgZ0K9vpv88WY+k4RB6/GPcuFNNr38LXUIU9MR2QYDP evI5EWWQZhLKTWj1mnZayv0Y2U/G6p+IyMsGt66agg50ns5cSUnjNVz/svvX8pynSo7B OPL9ukQxxySf5Dp/pmpzgkBca1pR0mNnRCeyasJgULVtzOyia0OaG7bT8wbWvfYRL3tE hIcg== X-Gm-Message-State: ALoCoQkomKS40R71Ya7G+tyNPtMM0I1DAuilE+VLJDdt2qzsYQBOJ1ekFQatMezroBMN7/WLjdfi X-Received: by 10.55.33.40 with SMTP id h40mr2308474qkh.77.1446653892607; Wed, 04 Nov 2015 08:18:12 -0800 (PST) Received: from localhost.localdomain ([190.2.108.156]) by smtp.gmail.com with ESMTPSA id p9sm490890qhp.38.2015.11.04.08.18.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Nov 2015 08:18:11 -0800 (PST) From: Ezequiel Garcia To: Subject: [PATCH 4/6] mtd: pxa3xx_nand: Remove redundant NAND sensing Date: Wed, 4 Nov 2015 13:13:44 -0300 Message-Id: <1446653626-14802-5-git-send-email-ezequiel@vanguardiasur.com.ar> X-Mailer: git-send-email 2.5.2 In-Reply-To: <1446653626-14802-1-git-send-email-ezequiel@vanguardiasur.com.ar> References: <1446653626-14802-1-git-send-email-ezequiel@vanguardiasur.com.ar> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151104_081835_170308_07D55C18 X-CRM114-Status: GOOD ( 16.22 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:400d:c09:0:0:0:22c listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Antoine Tenart , Brian Norris , Robert Jarzmik , Ezequiel Garcia MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Currently, the driver is trying to detect the presence of a chip by issuing a RESET command before nand_scan_ident. This seems completely redundant, and is also a layering violation as nand_scan_ident is in charge of device detection. This commit removes the RESET command use, and moves the initial timing configuration to pxa3xx_nand_config_ident. Signed-off-by: Ezequiel Garcia --- drivers/mtd/nand/pxa3xx_nand.c | 41 ++++++++--------------------------------- 1 file changed, 8 insertions(+), 33 deletions(-) diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c index fd8658a9281e..89c02f7057fd 100644 --- a/drivers/mtd/nand/pxa3xx_nand.c +++ b/drivers/mtd/nand/pxa3xx_nand.c @@ -1389,8 +1389,10 @@ static int pxa3xx_nand_waitfunc(struct mtd_info *mtd, struct nand_chip *this) static int pxa3xx_nand_config_ident(struct pxa3xx_nand_info *info) { + struct pxa3xx_nand_host *host = info->host[info->cs]; struct platform_device *pdev = info->pdev; struct pxa3xx_nand_platform_data *pdata = dev_get_platdata(&pdev->dev); + const struct nand_sdr_timings *timings; /* Configure default flash values */ info->chunk_size = PAGE_CHUNK_SIZE; @@ -1399,6 +1401,12 @@ static int pxa3xx_nand_config_ident(struct pxa3xx_nand_info *info) info->reg_ndcr |= NDCR_RD_ID_CNT(READ_ID_BYTES); info->reg_ndcr |= NDCR_SPARE_EN; + /* use the common timing to make a try */ + timings = onfi_async_timing_mode_to_sdr_timings(0); + if (IS_ERR(timings)) + return PTR_ERR(timings); + + pxa3xx_nand_set_sdr_timing(host, timings); return 0; } @@ -1491,32 +1499,6 @@ static void pxa3xx_nand_free_buff(struct pxa3xx_nand_info *info) kfree(info->data_buff); } -static int pxa3xx_nand_sensing(struct pxa3xx_nand_host *host) -{ - struct pxa3xx_nand_info *info = host->info_data; - struct mtd_info *mtd; - struct nand_chip *chip; - const struct nand_sdr_timings *timings; - int ret; - - mtd = info->host[info->cs]->mtd; - chip = mtd->priv; - - /* use the common timing to make a try */ - timings = onfi_async_timing_mode_to_sdr_timings(0); - if (IS_ERR(timings)) - return PTR_ERR(timings); - - pxa3xx_nand_set_sdr_timing(host, timings); - - chip->cmdfunc(mtd, NAND_CMD_RESET, 0, 0); - ret = chip->waitfunc(mtd, chip); - if (ret & NAND_STATUS_FAIL) - return -ENODEV; - - return 0; -} - static int pxa_ecc_init(struct pxa3xx_nand_info *info, struct nand_ecc_ctrl *ecc, int strength, int ecc_stepsize, int page_size) @@ -1602,13 +1584,6 @@ static int pxa3xx_nand_scan(struct mtd_info *mtd) ret = pxa3xx_nand_config_ident(info); if (ret) return ret; - ret = pxa3xx_nand_sensing(host); - if (ret) { - dev_info(&info->pdev->dev, - "There is no chip on cs %d!\n", - info->cs); - return ret; - } } if (info->reg_ndcr & NDCR_DWIDTH_M)