From patchwork Fri Nov 29 12:19:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 21879 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f198.google.com (mail-vc0-f198.google.com [209.85.220.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 380BB23FC4 for ; Fri, 29 Nov 2013 12:20:17 +0000 (UTC) Received: by mail-vc0-f198.google.com with SMTP id ld13sf21176973vcb.5 for ; Fri, 29 Nov 2013 04:20: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=RR16PJwMjyoiDMD5BPWnMFVD2z+OKbpzRAJQvekUId8=; b=Q+Wollkcq/kCkVMlXJMOgEpMWxVsE+e9TfqlT/ZADoYiXiMGPuV51nbs511Rgx1t3M S7SQKxV6mWLAUWJoJ1yHT4AD7h+teY3KkecEjuzldGj88hzvBQAHkIDes/I8MbouHsLB HdvTp5Wgv0ca1rhkmz7t30FofbZaOj9+LQICmw+XI13KALa3jrJc3UinU83BpFrzrQtE uOKe2RfoJ7S5tWyXNKlHM6ZcD0g3OsVMberHP0MstZpRnBnFou+iFPT+DLI3gmwffMIL +53lA+WTZMpNfG+VgUDqExkmo60okK806FavxjaBdygqR2vpPSjxDLQwoPQGQlnm0oa4 dUjA== X-Gm-Message-State: ALoCoQmspE3QdhLw1z+gtsHrgb4F/5ozEgFl7OmFB3dJCv7Hzcyjur5UnIlfuBsu5YerXAw1LVBn X-Received: by 10.58.201.36 with SMTP id jx4mr669731vec.35.1385727617077; Fri, 29 Nov 2013 04:20:17 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.96.101 with SMTP id dr5ls3644204qeb.80.gmail; Fri, 29 Nov 2013 04:20:17 -0800 (PST) X-Received: by 10.220.132.194 with SMTP id c2mr168868vct.55.1385727617014; Fri, 29 Nov 2013 04:20:17 -0800 (PST) Received: from mail-vb0-f42.google.com (mail-vb0-f42.google.com [209.85.212.42]) by mx.google.com with ESMTPS id z9si24771383veh.146.2013.11.29.04.20.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Nov 2013 04:20:17 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.42 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.42; Received: by mail-vb0-f42.google.com with SMTP id w18so6802924vbj.29 for ; Fri, 29 Nov 2013 04:20:16 -0800 (PST) X-Received: by 10.58.75.164 with SMTP id d4mr221208vew.53.1385727616945; Fri, 29 Nov 2013 04:20: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.220.174.196 with SMTP id u4csp87439vcz; Fri, 29 Nov 2013 04:20:16 -0800 (PST) X-Received: by 10.236.220.40 with SMTP id n38mr1929566yhp.85.1385727616268; Fri, 29 Nov 2013 04:20:16 -0800 (PST) Received: from mail-yh0-f41.google.com (mail-yh0-f41.google.com [209.85.213.41]) by mx.google.com with ESMTPS id k26si36286698yha.254.2013.11.29.04.20.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Nov 2013 04:20:16 -0800 (PST) Received-SPF: neutral (google.com: 209.85.213.41 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.213.41; Received: by mail-yh0-f41.google.com with SMTP id f11so6679279yha.14 for ; Fri, 29 Nov 2013 04:20:16 -0800 (PST) X-Received: by 10.236.150.202 with SMTP id z50mr2039238yhj.49.1385727616099; Fri, 29 Nov 2013 04:20:16 -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 m29sm101911689yho.14.2013.11.29.04.20.14 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Nov 2013 04:20:15 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dwmw2@infradead.org Cc: linus.walleij@linaro.org, linux-mtd@lists.infradead.org, angus.clark@st.com, Lee Jones Subject: [PATCH v3 21/36] mtd: st_spi_fsm: Update the flash Volatile Configuration Register Date: Fri, 29 Nov 2013 12:19:10 +0000 Message-Id: <1385727565-25794-22-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1385727565-25794-1-git-send-email-lee.jones@linaro.org> References: <1385727565-25794-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.212.42 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 325fd7a..9449005 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -68,6 +68,23 @@ static struct stfsm_seq stfsm_seq_erase_sector = { 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), + .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 int stfsm_n25q_en_32bit_addr_seq(struct stfsm_seq *seq) { seq->seq_opc[0] = (SEQ_OPC_PADS_1 | SEQ_OPC_CYCLES(8) | @@ -189,6 +206,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 *