From patchwork Thu Jan 23 10:31:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 313605 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B5DAE2C009C for ; Thu, 23 Jan 2014 23:59:33 +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 1W6HeW-0008Ce-QP; Thu, 23 Jan 2014 10:36:53 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W6HeJ-0003Wv-0q; Thu, 23 Jan 2014 10:36:39 +0000 Received: from mail-we0-f172.google.com ([74.125.82.172]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W6Hb9-0003As-Af for linux-mtd@lists.infradead.org; Thu, 23 Jan 2014 10:33:25 +0000 Received: by mail-we0-f172.google.com with SMTP id q58so954820wes.3 for ; Thu, 23 Jan 2014 02:33:01 -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=l4cpmoJJn4J4ahWVXMZXBg5IkszZNttiows1oqsSxTg=; b=GZHB8FimHXe2ERDId3dDG6TF0dd7L0GH+5GyefLGmkggDNIJkqVQ94Kjj9aMqx3Lwv x4pyUwe+hnr/Y2efB8PHm+cOgmfx0n8E3kjrnT61qOXoTbOscHI1h1k6lve9eSq8hDkz jawwyaJVEQvq2b8c/OtkkqjbVdvOwtrMQekKiPaRmDVvHdg24b0j0pK3gP9EAedtkfWR PsC6FbtAPbLXwdm5GWI8V4NPvo9ueW1yzzZIk21UOoSZgQ1A8ChrMUoizO6zQ6Flo987 HqUe7kHnvbiei+6+pA9uCgqbEpfMG9NEGWSuEOwkn3v3uNz0GE4DIKrcr1obP/tTyZ/e 8yEQ== X-Gm-Message-State: ALoCoQlzv+ttmvZ52S3erqOyUYhEI3nJdPOImOUR+llzelzJCDkWWHTJVUUyJLZHSdEbzrMuNHye X-Received: by 10.180.36.101 with SMTP id p5mr24117058wij.15.1390473181847; Thu, 23 Jan 2014 02:33:01 -0800 (PST) Received: from localhost.localdomain ([80.76.198.141]) by mx.google.com with ESMTPSA id ay6sm21257831wjb.23.2014.01.23.02.32.59 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Jan 2014 02:33:00 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND v4 31/37] mtd: st_spi_fsm: Add the ability to read the FSM's status Date: Thu, 23 Jan 2014 10:31:19 +0000 Message-Id: <1390473085-24626-32-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1390473085-24626-1-git-send-email-lee.jones@linaro.org> References: <1390473085-24626-1-git-send-email-lee.jones@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140123_053323_511300_BF24EF23 X-CRM114-Status: UNSURE ( 9.85 ) X-CRM114-Notice: Please train this message. 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 [74.125.82.172 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: olivier.clergeaud@st.com, Angus.Clark@st.com, Lee Jones , linus.walleij@linaro.org, linux-mtd@lists.infradead.org, computersforpeace@gmail.com, dwmw2@infradead.org, DCG_UPD_stlinux_kernel@list.st.com 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 eac23df..5f291dc 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -778,6 +778,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;