From patchwork Thu Mar 20 09:21:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 26662 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f198.google.com (mail-ve0-f198.google.com [209.85.128.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8C654202E0 for ; Thu, 20 Mar 2014 09:22:20 +0000 (UTC) Received: by mail-ve0-f198.google.com with SMTP id oz11sf1461011veb.1 for ; Thu, 20 Mar 2014 02:22:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=/q50Imctf1GzGFBOj9FP6TpcXHu0DAkHphQVke63e9I=; b=htQ0soqBnnZo75k9ddtNzpZFlJ4KZ0/vP8V6jPxDs4sqKaabzaoaEi6O8BF+657B3D WvNg0zoFJdy3s32QCnp/c5/TweGma0KuIvousnH3oyWF9LtSwUwjyuelEESgkM5A2FQY u/myRwt3NF32A0CSv1krGqFat3qkdF2E1encu1VikArOY8QfOmjutg5eJ1GK9Jxj3Xbs qTTuCU5t24GJOtJ/JbxmcZsWWrH+rAg0oHnAeSAwzUPalO+yew/Xp2JSiKtL4Mz/Wu7N DIPVLd0G38kdo8zV6daFp3iQsNXHFPqQCln/1KW/bKt/ywipqb5uMhiwZo/AiqmCyYcx A0iQ== X-Gm-Message-State: ALoCoQkefZ2s1+wOAJ3V5K1v9ZXSkjv8+SBhGZ3lcaGaJibsqI6gfUMakYMPDuJsSKMij8e76e9K X-Received: by 10.58.91.11 with SMTP id ca11mr6855322veb.20.1395307340335; Thu, 20 Mar 2014 02:22:20 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.37.225 with SMTP id r88ls168671qgr.2.gmail; Thu, 20 Mar 2014 02:22:20 -0700 (PDT) X-Received: by 10.58.150.68 with SMTP id ug4mr42761veb.50.1395307340196; Thu, 20 Mar 2014 02:22:20 -0700 (PDT) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id u1si296588vek.83.2014.03.20.02.22.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Mar 2014 02:22:20 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.173; Received: by mail-ve0-f173.google.com with SMTP id oy12so597048veb.18 for ; Thu, 20 Mar 2014 02:22:20 -0700 (PDT) X-Received: by 10.58.134.101 with SMTP id pj5mr3266351veb.38.1395307340110; Thu, 20 Mar 2014 02:22:20 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.78.9 with SMTP id i9csp372573vck; Thu, 20 Mar 2014 02:22:19 -0700 (PDT) X-Received: by 10.180.98.165 with SMTP id ej5mr22655659wib.33.1395307339296; Thu, 20 Mar 2014 02:22:19 -0700 (PDT) Received: from mail-wi0-f170.google.com (mail-wi0-f170.google.com [209.85.212.170]) by mx.google.com with ESMTPS id i7si1119255wiz.74.2014.03.20.02.22.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Mar 2014 02:22:19 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.170 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.212.170; Received: by mail-wi0-f170.google.com with SMTP id bs8so4804544wib.5 for ; Thu, 20 Mar 2014 02:22:18 -0700 (PDT) X-Received: by 10.194.157.41 with SMTP id wj9mr33338602wjb.34.1395307338734; Thu, 20 Mar 2014 02:22:18 -0700 (PDT) Received: from lee--X1.home (host109-148-116-196.range109-148.btcentralplus.com. [109.148.116.196]) by mx.google.com with ESMTPSA id di9sm4735120wid.6.2014.03.20.02.22.16 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Mar 2014 02:22:17 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, computersforpeace@gmail.com Cc: linux-mtd@lists.infradead.org, dwmw2@infradead.org, Angus.Clark@st.com, Lee Jones Subject: [PATCH v6 29/36] mtd: st_spi_fsm: Add the ability to read the FSM's status Date: Thu, 20 Mar 2014 09:21:01 +0000 Message-Id: <1395307268-12721-30-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1395307268-12721-1-git-send-email-lee.jones@linaro.org> References: <1395307268-12721-1-git-send-email-lee.jones@linaro.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.128.173 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 Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Acked-by Angus Clark Signed-off-by: Lee Jones --- drivers/mtd/devices/st_spi_fsm.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index 34aac3f..5e315e3 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -793,6 +793,30 @@ static uint8_t stfsm_wait_busy(struct stfsm *fsm) return FLASH_STATUS_TIMEOUT; } +static int stfsm_read_status(struct stfsm *fsm, uint8_t cmd, + uint8_t *status) +{ + struct stfsm_seq *seq = &stfsm_seq_read_status_fifo; + uint32_t tmp; + + dev_dbg(fsm->dev, "reading STA[%s]\n", + (cmd == FLASH_CMD_RDSR) ? "1" : "2"); + + seq->seq_opc[0] = (SEQ_OPC_PADS_1 | + SEQ_OPC_CYCLES(8) | + SEQ_OPC_OPCODE(cmd)), + + stfsm_load_seq(fsm, seq); + + stfsm_read_fifo(fsm, &tmp, 4); + + *status = (uint8_t)(tmp >> 24); + + stfsm_wait_seq(fsm); + + return 0; +} + static int stfsm_wrvcr(struct stfsm *fsm, uint8_t data) { struct stfsm_seq *seq = &stfsm_seq_wrvcr;