From patchwork Wed Jan 8 13:47:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 22967 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f200.google.com (mail-pd0-f200.google.com [209.85.192.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 445B0202E2 for ; Wed, 8 Jan 2014 13:49:17 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id p10sf4251009pdj.7 for ; Wed, 08 Jan 2014 05:49:16 -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=DRAp6Y17GdxcJRIDqvjInx7Ta3eUIinLB1r4VUizrQBEfTViUMVaqPGqZXgtrDr2sZ ljsJh+nnz6RwyYtLxaZwtMB9rgxk/iBgp9jW7fgw1HlReHEjl4lS9q7yQSefidSDcPC7 QRbmWOBOfx0Kb0n8/8hGMf7Ol6BrAlqKKvZTl9jw7th7qyoZ3EYQZnHrtsqtsg67S4H1 iMSXy+OX3WmMswL2ab06sfVoVzn0Ty3NYSStyq0Mmj2ZsA0UXGSB36QIZoRZT1kX+wQ1 z8zbe6Wu4vxChWFYNmo/yGdzUAIsGKrFx+7aR5NCuh/eBA3zTtVWPd6oAg11kdy714w6 MKzA== X-Gm-Message-State: ALoCoQkn7DUSpLVbf2mpvfvJNdGTE4TMcxlYC1sqqgljfg5KC5sPfOfbbBV9jkeSslWouJXyXJ6e X-Received: by 10.67.14.70 with SMTP id fe6mr4438128pad.15.1389188956583; Wed, 08 Jan 2014 05:49:16 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.49.70 with SMTP id s6ls531007qen.34.gmail; Wed, 08 Jan 2014 05:49:16 -0800 (PST) X-Received: by 10.52.167.163 with SMTP id zp3mr2093073vdb.82.1389188956453; Wed, 08 Jan 2014 05:49:16 -0800 (PST) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by mx.google.com with ESMTPS id gx6si583645vdc.154.2014.01.08.05.49.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Jan 2014 05:49:16 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.170 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.170; Received: by mail-ve0-f170.google.com with SMTP id oy12so1271389veb.15 for ; Wed, 08 Jan 2014 05:49:16 -0800 (PST) X-Received: by 10.58.146.5 with SMTP id sy5mr3254832veb.43.1389188956306; Wed, 08 Jan 2014 05:49:16 -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.59.13.131 with SMTP id ey3csp226655ved; Wed, 8 Jan 2014 05:49:15 -0800 (PST) X-Received: by 10.180.12.115 with SMTP id x19mr21493899wib.49.1389188952902; Wed, 08 Jan 2014 05:49:12 -0800 (PST) Received: from mail-wg0-f53.google.com (mail-wg0-f53.google.com [74.125.82.53]) by mx.google.com with ESMTPS id v4si4871556wjz.106.2014.01.08.05.49.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Jan 2014 05:49:12 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.53 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.53; Received: by mail-wg0-f53.google.com with SMTP id k14so1482184wgh.32 for ; Wed, 08 Jan 2014 05:49:12 -0800 (PST) X-Received: by 10.180.212.98 with SMTP id nj2mr21579705wic.52.1389188952330; Wed, 08 Jan 2014 05:49:12 -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 j9sm48125217wjx.18.2014.01.08.05.49.10 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Jan 2014 05:49:11 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: computersforpeace@gmail.com, angus.clark@st.com, Lee Jones Subject: [PATCH v4 31/37] mtd: st_spi_fsm: Add the ability to read the FSM's status Date: Wed, 8 Jan 2014 13:47:14 +0000 Message-Id: <1389188840-14306-32-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1389188840-14306-1-git-send-email-lee.jones@linaro.org> References: <1389188840-14306-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.170 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;