From patchwork Wed Jan 8 13:47:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 22968 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f72.google.com (mail-qa0-f72.google.com [209.85.216.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 677E7202E2 for ; Wed, 8 Jan 2014 13:49:18 +0000 (UTC) Received: by mail-qa0-f72.google.com with SMTP id f11sf2878859qae.11 for ; Wed, 08 Jan 2014 05:49:17 -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=8Psm97Xt6juCnllkF0T3ngUjXOKGgT0g/3C4OZ0EZ2E=; b=bvouhYo+cKNmhnw+Lfjv1ULjTROu+y4NrRJqvKCmAISQn1iKETe0Ij1JEegxZUX3aT KkA0zAwylVo5Wdh2JUaiN5pLLd9gAfP2iDm2M4Bht6BCMrOWGIWFcN2ox4BCahVj7dNu W0uU9HfQWSil2CP49Qh/kwkwhqT/fJzEOizrabXYvB136BhOoMY6FLXSTH9C2BgxNSkg PZ2/HEsV63P/cB9pSxHrtUq7rHB8vpY4FNEqZAYPmBZw+HSzSigQs6BaPje/CCxBp05b W33DpGs4i5DY8VcUd9Ni4KXhbZROEXxFKHzkBoq3BxZ9JzzanglcZvZoJd50CfxRSswI oejA== X-Gm-Message-State: ALoCoQllyYhnyORobLBEJvJ5ffPZYlZJB/eQ94AXh/pLwJcIlzWYOtY0C1NPhfgwXJ8EfkGXtAnB X-Received: by 10.58.237.102 with SMTP id vb6mr52786128vec.31.1389188957622; Wed, 08 Jan 2014 05:49:17 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.4.105 with SMTP id j9ls585758qej.94.gmail; Wed, 08 Jan 2014 05:49:17 -0800 (PST) X-Received: by 10.58.24.196 with SMTP id w4mr3144746vef.48.1389188957542; Wed, 08 Jan 2014 05:49:17 -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 wl16si310450vec.94.2014.01.08.05.49.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Jan 2014 05:49:17 -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 jy13so1250371veb.41 for ; Wed, 08 Jan 2014 05:49:17 -0800 (PST) X-Received: by 10.52.53.101 with SMTP id a5mr2079238vdp.80.1389188957428; Wed, 08 Jan 2014 05:49:17 -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 ey3csp226656ved; Wed, 8 Jan 2014 05:49:16 -0800 (PST) X-Received: by 10.194.175.133 with SMTP id ca5mr78158520wjc.19.1389188954369; Wed, 08 Jan 2014 05:49:14 -0800 (PST) Received: from mail-wg0-f43.google.com (mail-wg0-f43.google.com [74.125.82.43]) by mx.google.com with ESMTPS id en10si710482wid.52.2014.01.08.05.49.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Jan 2014 05:49:14 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.43 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.43; Received: by mail-wg0-f43.google.com with SMTP id k14so1470083wgh.10 for ; Wed, 08 Jan 2014 05:49:14 -0800 (PST) X-Received: by 10.180.90.79 with SMTP id bu15mr1371620wib.33.1389188953923; Wed, 08 Jan 2014 05:49:13 -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.12 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Jan 2014 05:49:13 -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 32/37] mtd: st_spi_fsm: Add the ability to write to FSM's status register Date: Wed, 8 Jan 2014 13:47:15 +0000 Message-Id: <1389188840-14306-33-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.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 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 | 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 5f291dc..1b0fa67 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -586,6 +586,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), @@ -802,6 +819,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;