From patchwork Fri Nov 22 16:22:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 21701 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f200.google.com (mail-ie0-f200.google.com [209.85.223.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3555823FDC for ; Fri, 22 Nov 2013 16:24:22 +0000 (UTC) Received: by mail-ie0-f200.google.com with SMTP id at1sf4431768iec.7 for ; Fri, 22 Nov 2013 08:24:21 -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=FTLNdTwozkrLtGhTZ+Vg85/k57RejN19LA4reG13CK4=; b=ggnI0HER29lJ3i1tEHLRmu/O1siJPDmKCm7AWzZd3L0L++0b110I4j2VbZ7wRtv1L+ Z7yI2cdDwrfsnpXsu9vD75pOp/Gvgw8NPgz3iDeBFtnqVX7sNkyh031TLThANQPffq37 oGVRbudZJ0qiKsoo2VxVobyP3FWra+PsjtsyvH0iSXDX0N0KvD19DORB4vfBNVp+Bf31 vig5eNM/SiYY7lKNpJ8h8538+TCKglYg+lYPrWwuuTT1QP7wH111cKT1ifGzt5t9Q0pl DKRi7FB6H2gD6mDShsO9kOAzgLobDndC9ftZiQMvZxg7Xl55mQ0cjDw8w9LWfKCeDh6Q QBBw== X-Gm-Message-State: ALoCoQlxLQqusSOjK14vFYhT37UrKnlNfdocAcI49bpihVLUhAvvlwZiDEu/uMT8MB6X4qIPvsva X-Received: by 10.182.241.129 with SMTP id wi1mr4238041obc.10.1385137461874; Fri, 22 Nov 2013 08:24:21 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.2.69 with SMTP id 5ls1040637qes.98.gmail; Fri, 22 Nov 2013 08:24:21 -0800 (PST) X-Received: by 10.52.103.35 with SMTP id ft3mr10274506vdb.5.1385137461776; Fri, 22 Nov 2013 08:24:21 -0800 (PST) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id ch11si12863416ved.139.2013.11.22.08.24.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 22 Nov 2013 08:24:21 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id if17so985836vcb.25 for ; Fri, 22 Nov 2013 08:24:21 -0800 (PST) X-Received: by 10.52.165.131 with SMTP id yy3mr10085487vdb.25.1385137461704; Fri, 22 Nov 2013 08:24:21 -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 u4csp51567vcz; Fri, 22 Nov 2013 08:24:21 -0800 (PST) X-Received: by 10.68.197.73 with SMTP id is9mr3605974pbc.75.1385137460948; Fri, 22 Nov 2013 08:24:20 -0800 (PST) Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com [209.85.220.42]) by mx.google.com with ESMTPS id bq8si20176756pab.116.2013.11.22.08.24.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 22 Nov 2013 08:24:20 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.42 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.220.42; Received: by mail-pa0-f42.google.com with SMTP id lj1so1526516pab.29 for ; Fri, 22 Nov 2013 08:24:20 -0800 (PST) X-Received: by 10.66.218.226 with SMTP id pj2mr13063278pac.62.1385137460288; Fri, 22 Nov 2013 08:24:20 -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 qz9sm52962938pbc.3.2013.11.22.08.24.17 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 22 Nov 2013 08:24:19 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dwmw2@infradead.org, linux-mtd@lists.infradead.org, angus.clark@st.com Cc: linus.walleij@linaro.org, Lee Jones Subject: [PATCH 21/23] mtd: st_spi_fsm: Update the flash Volatile Configuration Register Date: Fri, 22 Nov 2013 16:22:58 +0000 Message-Id: <1385137380-28968-22-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1385137380-28968-1-git-send-email-lee.jones@linaro.org> References: <1385137380-28968-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.220.180 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: , The FSM Serial Flash Controller is driven by issuing a standard set of register writes we call a message sequence. This patch supplies a method to prepare the message sequence responsible for updating a chip's VCR. Signed-off-by: Lee Jones --- drivers/mtd/devices/st_spi_fsm.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index b99b4c1..475bbd1 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -90,6 +90,23 @@ static int stfsm_n25q_prepare_en_32bit_addr_seq(struct stfsm_seq *seq) return 0; } +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), + .seq_opc[1] = (SEQ_OPC_PADS_1 | SEQ_OPC_CYCLES(8) | + SEQ_OPC_OPCODE(FLASH_CMD_WRVCR)), + .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 inline int stfsm_is_idle(struct stfsm *fsm) { return readl(fsm->base + SPI_FAST_SEQ_STA) & 0x10; @@ -147,6 +164,21 @@ static int stfsm_enter_32bit_addr(struct stfsm *fsm, int enter) return 0; } +static int stfsm_wrvcr(struct stfsm *fsm, uint8_t data) +{ + struct stfsm_seq *seq = &stfsm_seq_wrvcr; + + dev_dbg(fsm->dev, "writing VCR 0x%02x\n", data); + + seq->status = (STA_DATA_BYTE1(data) | STA_PADS_1 | STA_CSDEASSERT); + + stfsm_load_seq(fsm, seq); + + stfsm_wait_seq(fsm); + + return 0; +} + /* * SoC reset on 'boot-from-spi' systems *