From patchwork Tue Feb 18 14:55:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 24866 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f71.google.com (mail-pb0-f71.google.com [209.85.160.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EE277202B2 for ; Tue, 18 Feb 2014 14:58:28 +0000 (UTC) Received: by mail-pb0-f71.google.com with SMTP id jt11sf38877567pbb.2 for ; Tue, 18 Feb 2014 06:58:28 -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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=Z9cb1CpmN9z2c/KDr8v9JJCm60xlgFcYoB/1LyLJ4dI=; b=mxyjtcTiw2DAcSGqGaKgTRuiFl3aGJGE1u8OpOlqL/3aU4HEhfcJYN1bugbiBiMMKY qLy4HVJcYWRJ4wkbeSsVmQphZbsbojg7lBTQGrljz0UHwFYGwyxufIxepAuAb2yolWvn z+J736/5ITCZhTKFbcBfn6ZvjdZfi5+NqLcsQ5bOjqN0+3kOa3gM9hpI6ztVZUA4FBsN 6dWAZ6gnv6N93nOUn+DNw4+lz2w+VfpOQROp8aQV5mGes/udM7ZFBq/E9uEOTbweYPij s/toFXWvff+0IgneHd2Org+FzWlv/PLfPZ34Uu25VIPvh0ySRDok2o02ptBAmFyc5e2R yQRw== X-Gm-Message-State: ALoCoQls+sCii48Kc39wKtDE/OS4khGBFxC0P1ZkmJk2av8dVGBxCSq4Z8oNt8Nv6yyA/TMqVYMz X-Received: by 10.66.141.231 with SMTP id rr7mr4867102pab.47.1392735508065; Tue, 18 Feb 2014 06:58:28 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.42.14 with SMTP id b14ls1394504qga.47.gmail; Tue, 18 Feb 2014 06:58:27 -0800 (PST) X-Received: by 10.52.190.195 with SMTP id gs3mr242150vdc.67.1392735507823; Tue, 18 Feb 2014 06:58:27 -0800 (PST) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id rl1si5569705vcb.74.2014.02.18.06.58.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Feb 2014 06:58:27 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.177 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.177; Received: by mail-ve0-f177.google.com with SMTP id jz11so13442921veb.36 for ; Tue, 18 Feb 2014 06:58:27 -0800 (PST) X-Received: by 10.220.106.84 with SMTP id w20mr21563988vco.18.1392735507741; Tue, 18 Feb 2014 06:58:27 -0800 (PST) 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.174.196 with SMTP id u4csp222626vcz; Tue, 18 Feb 2014 06:58:27 -0800 (PST) X-Received: by 10.66.246.229 with SMTP id xz5mr33711269pac.119.1392735506294; Tue, 18 Feb 2014 06:58:26 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id zk9si18584091pac.231.2014.02.18.06.58.25; Tue, 18 Feb 2014 06:58:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932377AbaBRO5r (ORCPT + 27 others); Tue, 18 Feb 2014 09:57:47 -0500 Received: from mail-wi0-f169.google.com ([209.85.212.169]:57794 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932342AbaBRO5o (ORCPT ); Tue, 18 Feb 2014 09:57:44 -0500 Received: by mail-wi0-f169.google.com with SMTP id e4so3491777wiv.4 for ; Tue, 18 Feb 2014 06:57:43 -0800 (PST) X-Received: by 10.180.108.199 with SMTP id hm7mr18421589wib.1.1392735463531; Tue, 18 Feb 2014 06:57:43 -0800 (PST) Received: from localhost.localdomain ([80.76.198.141]) by mx.google.com with ESMTPSA id h13sm46039687wjr.22.2014.02.18.06.57.41 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Feb 2014 06:57:42 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: lee.jones@linaro.org, DCG_UPD_stlinux_kernel@list.st.com, dwmw2@infradead.org, linux-mtd@lists.infradead.org, computersforpeace@gmail.com, Angus.Clark@st.com Subject: [PATCH 29/35] mtd: st_spi_fsm: Add the ability to read the FSM's status Date: Tue, 18 Feb 2014 14:55:56 +0000 Message-Id: <1392735362-1245-30-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1392735362-1245-1-git-send-email-lee.jones@linaro.org> References: <1392735362-1245-1-git-send-email-lee.jones@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.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.177 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 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 a5e2c5a..5b2993d 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;