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: 23602 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f200.google.com (mail-ve0-f200.google.com [209.85.128.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 508BB218BD for ; Thu, 23 Jan 2014 10:33:04 +0000 (UTC) Received: by mail-ve0-f200.google.com with SMTP id c14sf2922756vea.3 for ; Thu, 23 Jan 2014 02:33:03 -0800 (PST) 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=l4cpmoJJn4J4ahWVXMZXBg5IkszZNttiows1oqsSxTg=; b=knBj6XnyG6IBK3aLXBpDHCPka1TTWDUUkNiCLqwpepmlnQZTmk8y0mZ2mwMJ7qur4D yvQQNZVRD+KqX5Ldw43MZAMbpAB150DT+naR/Ggd9+Tto0i9RpakaxaFEZi8LaiNWinp UHpHmBI+JErkghY+6vdga7UDrCy/lu1GH7nfVyzgdp46hTXPQlHD5L5GCRLAPp3bj5vv 9DaRAcxJU7LvY5k6LXIj1IINPwZtHyeyfeO0Im2G41k0uTDyLMLIzjs70+UIP4I1zr/H k6+reSPp+wOj80kpPC+QfEv67rXaRaqg/VLvGi89QdP2jpJfhwQ2OOygLXbMRykpB3C2 KPVA== X-Gm-Message-State: ALoCoQkZmKIU7eWQDvkW7QWagN1+s3DNTTmEnMnEz5Qvf0KUHpu8bSEJQlXx3L2xksoHXVJ3gi6V X-Received: by 10.58.39.202 with SMTP id r10mr2799171vek.12.1390473183487; Thu, 23 Jan 2014 02:33:03 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.89.145 with SMTP id v17ls292969qgd.82.gmail; Thu, 23 Jan 2014 02:33:03 -0800 (PST) X-Received: by 10.220.95.139 with SMTP id d11mr4089899vcn.21.1390473183352; Thu, 23 Jan 2014 02:33:03 -0800 (PST) Received: from mail-vb0-f45.google.com (mail-vb0-f45.google.com [209.85.212.45]) by mx.google.com with ESMTPS id uc1si6421583vcb.128.2014.01.23.02.33.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Jan 2014 02:33:03 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.45 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.45; Received: by mail-vb0-f45.google.com with SMTP id m10so921887vbh.4 for ; Thu, 23 Jan 2014 02:33:03 -0800 (PST) X-Received: by 10.220.110.210 with SMTP id o18mr49731vcp.49.1390473183288; Thu, 23 Jan 2014 02:33:03 -0800 (PST) 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.174.196 with SMTP id u4csp16015vcz; Thu, 23 Jan 2014 02:33:02 -0800 (PST) X-Received: by 10.194.93.67 with SMTP id cs3mr6235033wjb.26.1390473182477; Thu, 23 Jan 2014 02:33:02 -0800 (PST) Received: from mail-wi0-f170.google.com (mail-wi0-f170.google.com [209.85.212.170]) by mx.google.com with ESMTPS id fi6si8726740wib.39.2014.01.23.02.33.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Jan 2014 02:33:02 -0800 (PST) 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 ex4so438319wid.3 for ; Thu, 23 Jan 2014 02:33:02 -0800 (PST) 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 Cc: linus.walleij@linaro.org, dwmw2@infradead.org, linux-mtd@lists.infradead.org, computersforpeace@gmail.com, Angus.Clark@st.com, DCG_UPD_stlinux_kernel@list.st.com, olivier.clergeaud@st.com, Lee Jones 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-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.212.45 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: , 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;