From patchwork Wed Mar 26 16:39:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 27156 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f69.google.com (mail-oa0-f69.google.com [209.85.219.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1044A20369 for ; Wed, 26 Mar 2014 16:45:44 +0000 (UTC) Received: by mail-oa0-f69.google.com with SMTP id i7sf8322242oag.0 for ; Wed, 26 Mar 2014 09:45:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=C5H26JM67KV/QHSKFsbwbd/ZHSkRo0Fxt/u9hXv0Wng=; b=ZCtDGIaQeyIyZG1LYJRQvpWYBlkwurRYiXmmt/nnUhZGhOzme8zuk/JQfno0EpFb3W i0gxEuzSIkS6C7TIDk7kQswKwdbTg/eMmjOcioA5j9i7bg1V5xAg7EcDFDAndlFTdlky 5RltYgluWKGe0cTmN0XteHWRKgdknenbWj8AMObU1b/yWzkrZJNa9rB9PrxJ485R/pgg PZEqBBxgFD4n7jFw5zmX27ojxZWWX/CXaG5iJJveCt51WaKWa1hMIcGeY6uq7HhF9hmI WXnxaQmbZYRnFeoBoROgqsD1urSKU3mf8wprXuH1JlRzlds+aRhhYciQLEHWtdfP8wuO Ppdw== X-Gm-Message-State: ALoCoQn6KIFz36kMXR7xREU0uj+dHsouJPxFJQn8Y4pcyALORkpfNC6CAAQtCu+Wjy778v0lOpqD X-Received: by 10.42.53.135 with SMTP id n7mr29489467icg.11.1395852344630; Wed, 26 Mar 2014 09:45:44 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.21.213 with SMTP id 79ls707824qgl.35.gmail; Wed, 26 Mar 2014 09:45:44 -0700 (PDT) X-Received: by 10.58.196.145 with SMTP id im17mr286556vec.47.1395852344427; Wed, 26 Mar 2014 09:45:44 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id qw5si4584314vcb.156.2014.03.26.09.45.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Mar 2014 09:45:44 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id ld13so2727625vcb.33 for ; Wed, 26 Mar 2014 09:45:44 -0700 (PDT) X-Received: by 10.52.175.166 with SMTP id cb6mr51247442vdc.1.1395852344318; Wed, 26 Mar 2014 09:45:44 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp61524vck; Wed, 26 Mar 2014 09:45:43 -0700 (PDT) X-Received: by 10.180.100.169 with SMTP id ez9mr33524464wib.15.1395852343097; Wed, 26 Mar 2014 09:45:43 -0700 (PDT) Received: from casper.infradead.org (casper.infradead.org. [2001:770:15f::2]) by mx.google.com with ESMTPS id r2si1689031wiz.79.2014.03.26.09.45.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Mar 2014 09:45:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2001:770:15f::2 as permitted sender) client-ip=2001:770:15f::2; Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSqx9-0006Um-I0; Wed, 26 Mar 2014 16:45:23 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSqsH-0004c1-SF; Wed, 26 Mar 2014 16:40:21 +0000 Received: from mail-wi0-f182.google.com ([209.85.212.182]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSqs7-0004Y9-MW for linux-mtd@lists.infradead.org; Wed, 26 Mar 2014 16:40:19 +0000 Received: by mail-wi0-f182.google.com with SMTP id d1so2043909wiv.15 for ; Wed, 26 Mar 2014 09:39:55 -0700 (PDT) X-Received: by 10.180.8.130 with SMTP id r2mr33769597wia.14.1395851994976; Wed, 26 Mar 2014 09:39:54 -0700 (PDT) Received: from lee--X1.home (host109-148-113-193.range109-148.btcentralplus.com. [109.148.113.193]) by mx.google.com with ESMTPSA id gp10sm3913806wib.13.2014.03.26.09.39.53 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Mar 2014 09:39:54 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 03/15] mtd: st_spi_fsm: Update Macronix 'QE' configuration Date: Wed, 26 Mar 2014 16:39:17 +0000 Message-Id: <1395851969-13520-4-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1395851969-13520-1-git-send-email-lee.jones@linaro.org> References: <1395851969-13520-1-git-send-email-lee.jones@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140326_124011_871991_E2191DB0 X-CRM114-Status: GOOD ( 11.50 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.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 [209.85.212.182 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] Cc: linux-mtd@lists.infradead.org, computersforpeace@gmail.com, lee.jones@linaro.org, kernel@stlinux.com, angus.clark@st.com X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Angus Clark Update the configuration of the Macronix 'QE' bit, such that we only set or clear the bit if required. Signed-off-by: Angus Clark Signed-off-by: Lee Jones --- drivers/mtd/devices/st_spi_fsm.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index 31bbf28..fabba2c 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -1163,12 +1163,27 @@ static int stfsm_mx25_config(struct stfsm *fsm) CFG_ERASESEC_TOGGLE_32BIT_ADDR); } - /* For QUAD mode, set 'QE' STATUS bit */ + /* Check status of 'QE' bit */ + stfsm_read_status(fsm, FLASH_CMD_RDSR, &sta); data_pads = ((fsm->stfsm_seq_read.seq_cfg >> 16) & 0x3) + 1; if (data_pads == 4) { - stfsm_read_status(fsm, FLASH_CMD_RDSR, &sta); - sta |= MX25_STATUS_QE; - stfsm_write_status(fsm, sta, 1); + if (!(sta & MX25_STATUS_QE)) { + /* Set 'QE' */ + sta |= MX25_STATUS_QE; + + stfsm_write_status(fsm, sta, 1); + + stfsm_wait_busy(fsm); + } + } else { + if (sta & MX25_STATUS_QE) { + /* Clear 'QE' */ + sta &= ~MX25_STATUS_QE; + + stfsm_write_status(fsm, sta, 1); + + stfsm_wait_busy(fsm); + } } return 0;