From patchwork Tue Feb 18 14:55:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 24867 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f69.google.com (mail-pb0-f69.google.com [209.85.160.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6B65B20676 for ; Tue, 18 Feb 2014 14:58:29 +0000 (UTC) Received: by mail-pb0-f69.google.com with SMTP id md12sf39139892pbc.4 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=jyDEehR/L96NDXY+lY+Bj5f0rZyVXh/eCnvgPf1B99M=; b=Dr8sY66dmQLnQgxFTsqROmqTiHUIZ50hrJiyWSZ4a7OWR8wwiFR8Id5xofh0h2HjUp O5JX/DpZFAsdT4TSQVbRTUJ/SLcE6+KBOxRFsMhdKTJHozljKZdf9Vuss/YxqDqmS7s+ wdXTJuFv/9NOY9Ky6kE36Gpabmmi2InDZgt/b0qaF7ZjLmaaBDc0GBfBdSjYhBW64CSS BJS1fuBxSM+b5hxHAk+cvadbyqsB5GUsKTgBQwv6pveGbtxT0Kplg9sGFaTYKTWJRZWA JtSscI6fbUAraVL8STMWiAGPFPELfavDGmqgFI7pzgFD9t9Es9mMWTxOPxNF0Z1IkJCa 1viA== X-Gm-Message-State: ALoCoQmjmFCX6zERPe4np8w9k+8ISdseNft5TCqnyP039IBCdYZvuCNmsIbNqDRUqyLUaYJb3mab X-Received: by 10.68.201.7 with SMTP id jw7mr12972948pbc.8.1392735508716; Tue, 18 Feb 2014 06:58:28 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.90.80 with SMTP id w74ls1297760qgd.95.gmail; Tue, 18 Feb 2014 06:58:28 -0800 (PST) X-Received: by 10.52.181.199 with SMTP id dy7mr4850823vdc.43.1392735508583; Tue, 18 Feb 2014 06:58:28 -0800 (PST) Received: from mail-ve0-f182.google.com (mail-ve0-f182.google.com [209.85.128.182]) by mx.google.com with ESMTPS id sl9si5571076veb.97.2014.02.18.06.58.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Feb 2014 06:58:28 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.182 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.182; Received: by mail-ve0-f182.google.com with SMTP id jy13so13920960veb.27 for ; Tue, 18 Feb 2014 06:58:28 -0800 (PST) X-Received: by 10.220.192.71 with SMTP id dp7mr2457036vcb.45.1392735508488; Tue, 18 Feb 2014 06:58:28 -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 u4csp222627vcz; Tue, 18 Feb 2014 06:58:28 -0800 (PST) X-Received: by 10.66.138.40 with SMTP id qn8mr10573933pab.154.1392735507249; Tue, 18 Feb 2014 06:58:27 -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.26; Tue, 18 Feb 2014 06:58:26 -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 S932398AbaBRO5x (ORCPT + 27 others); Tue, 18 Feb 2014 09:57:53 -0500 Received: from mail-we0-f174.google.com ([74.125.82.174]:62744 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932379AbaBRO5s (ORCPT ); Tue, 18 Feb 2014 09:57:48 -0500 Received: by mail-we0-f174.google.com with SMTP id w61so6133188wes.33 for ; Tue, 18 Feb 2014 06:57:47 -0800 (PST) X-Received: by 10.180.79.73 with SMTP id h9mr18600193wix.3.1392735467136; Tue, 18 Feb 2014 06:57:47 -0800 (PST) Received: from localhost.localdomain ([80.76.198.141]) by mx.google.com with ESMTPSA id h13sm46039687wjr.22.2014.02.18.06.57.43 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Feb 2014 06:57:45 -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 30/35] mtd: st_spi_fsm: Add the ability to write to FSM's status register Date: Tue, 18 Feb 2014 14:55:57 +0000 Message-Id: <1392735362-1245-31-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.182 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 | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index 5b2993d..b32df09 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -588,6 +588,23 @@ static struct stfsm_seq stfsm_seq_erase_chip = { SEQ_CFG_STARTSEQ), }; +static struct stfsm_seq stfsm_seq_write_status = { + .seq_opc[0] = (SEQ_OPC_PADS_1 | SEQ_OPC_CYCLES(8) | + SEQ_OPC_OPCODE(FLASH_CMD_WREN) | SEQ_OPC_CSDEASSERT), + .seq_opc[1] = (SEQ_OPC_PADS_1 | SEQ_OPC_CYCLES(8) | + SEQ_OPC_OPCODE(FLASH_CMD_WRSR)), + .seq = { + STFSM_INST_CMD1, + STFSM_INST_CMD2, + STFSM_INST_STA_WR1, + STFSM_INST_STOP, + }, + .seq_cfg = (SEQ_CFG_PADS_1 | + SEQ_CFG_READNOTWRITE | + SEQ_CFG_CSDEASSERT | + SEQ_CFG_STARTSEQ), +}; + static struct stfsm_seq stfsm_seq_wrvcr = { .seq_opc[0] = (SEQ_OPC_PADS_1 | SEQ_OPC_CYCLES(8) | SEQ_OPC_OPCODE(FLASH_CMD_WREN) | SEQ_OPC_CSDEASSERT), @@ -817,6 +834,25 @@ static int stfsm_read_status(struct stfsm *fsm, uint8_t cmd, return 0; } +static int stfsm_write_status(struct stfsm *fsm, uint16_t status, + int sta_bytes) +{ + struct stfsm_seq *seq = &stfsm_seq_write_status; + + dev_dbg(fsm->dev, "writing STA[%s] 0x%04x\n", + (sta_bytes == 1) ? "1" : "1+2", status); + + seq->status = (uint32_t)status | STA_PADS_1 | STA_CSDEASSERT; + seq->seq[2] = (sta_bytes == 1) ? + STFSM_INST_STA_WR1 : STFSM_INST_STA_WR1_2; + + stfsm_load_seq(fsm, seq); + + stfsm_wait_seq(fsm); + + return 0; +}; + static int stfsm_wrvcr(struct stfsm *fsm, uint8_t data) { struct stfsm_seq *seq = &stfsm_seq_wrvcr;