From patchwork Fri Nov 29 12:19:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 295299 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from casper.infradead.org (unknown [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C16F32C00BA for ; Fri, 29 Nov 2013 23:36:12 +1100 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VmNIj-0000sQ-Lb; Fri, 29 Nov 2013 12:36:05 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VmNIh-00081C-St; Fri, 29 Nov 2013 12:36:03 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VmNIg-0007zK-88 for linux-mtd@merlin.infradead.org; Fri, 29 Nov 2013 12:36:02 +0000 Received: from mail-yh0-f51.google.com ([209.85.213.51]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VmN4A-0000yP-2F for linux-mtd@lists.infradead.org; Fri, 29 Nov 2013 12:21:03 +0000 Received: by mail-yh0-f51.google.com with SMTP id c41so5102388yho.24 for ; Fri, 29 Nov 2013 04:20:35 -0800 (PST) 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=zFN9e+FiZ/+677AqnyCkS4SzwuMwm++KpJJGXm+GBWE=; b=ClsbybAkcasNDXpT3u2cbv+ffPwzxAp+OhxLKLJiJFom/Qxs0BKqhUb02Yp0TSQTEv NDhSYQEVVE9bLVJbb4z9TKNhJhT0PIp6zKXchsjj/CqDSlcp6drimWaOO8LEhzcPXjj/ Ec7hGLdS/8u8QMOnMZ+thnwrLyYXaQAmtI3tfUpzl/zrMz5w+Dys/a+PJbk8ySXIdbAZ jktAKniKUKRpueKxT+8NWeU5wwiAR0i6JcrkmEM4ckMcnBtKX6KfjP1z3CvlIwm4z6lf GWkna6AAH73B6UOr5Mr11vfTifzzZxYusCyTovru4CiFW40RGgRUmlvpkT+X8YOiUUZ8 /f7w== X-Gm-Message-State: ALoCoQn4VTarC7B2u//eRgF9N/wQQMsWvz5uhqO1Qu2oKXKmO1x3yDiMSIyOFfWR3EqGV0k+LPse X-Received: by 10.236.45.102 with SMTP id o66mr43608635yhb.13.1385727635680; Fri, 29 Nov 2013 04:20:35 -0800 (PST) Received: from localhost.localdomain (cpc15-aztw25-2-0-cust493.aztw.cable.virginm.net. [92.233.57.238]) by mx.google.com with ESMTPSA id m29sm101911689yho.14.2013.11.29.04.20.33 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Nov 2013 04:20:35 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dwmw2@infradead.org Subject: [PATCH v3 31/36] mtd: st_spi_fsm: Add the ability to read the FSM's status Date: Fri, 29 Nov 2013 12:19:20 +0000 Message-Id: <1385727565-25794-32-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1385727565-25794-1-git-send-email-lee.jones@linaro.org> References: <1385727565-25794-1-git-send-email-lee.jones@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131129_122102_602742_CBADF85A X-CRM114-Status: UNSURE ( 9.20 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on casper.infradead.org summary: Content analysis details: (-2.6 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.213.51 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: angus.clark@st.com, linus.walleij@linaro.org, Lee Jones , linux-mtd@lists.infradead.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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 ecb001d..1d6bd94 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -365,6 +365,30 @@ static uint8_t stfsm_wait_busy(struct stfsm *fsm) return -EIO; } +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;