From patchwork Fri Nov 29 12:19:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 21878 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f199.google.com (mail-vc0-f199.google.com [209.85.220.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7265623FC4 for ; Fri, 29 Nov 2013 12:20:15 +0000 (UTC) Received: by mail-vc0-f199.google.com with SMTP id ht17sf21198150vcb.6 for ; Fri, 29 Nov 2013 04:20:15 -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=toAGQ5hvKV1gbyfHw/ayrKtO+OpnzJp+OqXQNs8on7Q=; b=OepimZDhtAwcCCQbzmu2rVo8gSMAv9+3zzW73db7MhsDvPV6iEdXtZV+FDH5u5FWra qcf6l9ODUR8+VFIoVsF1Jmo+vftymbnx7D4VdfJMLwGj4m5hpFbZ/yov+zCiWIy4sFlx urSHasAevrDLmZaOiOPLbj6S2LdNMW/jRrVD3DM3opa7KD6ydWiKDQGppC0dAnhzLWgY Az1qSSwBxNOnPkFng/2eRmsbae6pp1Bg/z+z7Nbf4ZfAp+aqBPqlFgjbl/5KEG3Zu8NW +CaG6TFwbaKaRQcABBAns/XKTw7UHCegyk0d3rup72j69cFeGgvo0D9w9r0nhFXB6/Kv lveg== X-Gm-Message-State: ALoCoQn7Kw+C3BP5ggFOUFBQ7J06MLT77u2q/s87Ay9M0/zFBdVx2NerlRGuSGZo5xLdVabQT1dM X-Received: by 10.236.96.138 with SMTP id r10mr23283367yhf.12.1385727615233; Fri, 29 Nov 2013 04:20:15 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.16.35 with SMTP id c3ls256492qed.83.gmail; Fri, 29 Nov 2013 04:20:15 -0800 (PST) X-Received: by 10.58.54.69 with SMTP id h5mr1853500vep.25.1385727615154; Fri, 29 Nov 2013 04:20:15 -0800 (PST) Received: from mail-vb0-f41.google.com (mail-vb0-f41.google.com [209.85.212.41]) by mx.google.com with ESMTPS id mh9si24806601vec.26.2013.11.29.04.20.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Nov 2013 04:20:15 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.41 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.41; Received: by mail-vb0-f41.google.com with SMTP id w5so6653531vbf.14 for ; Fri, 29 Nov 2013 04:20:15 -0800 (PST) X-Received: by 10.52.75.99 with SMTP id b3mr30967vdw.80.1385727615087; Fri, 29 Nov 2013 04:20:15 -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 u4csp87437vcz; Fri, 29 Nov 2013 04:20:14 -0800 (PST) X-Received: by 10.236.76.138 with SMTP id b10mr708103yhe.152.1385727614584; Fri, 29 Nov 2013 04:20:14 -0800 (PST) Received: from mail-yh0-f48.google.com (mail-yh0-f48.google.com [209.85.213.48]) by mx.google.com with ESMTPS id h37si36463408yhq.98.2013.11.29.04.20.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Nov 2013 04:20:14 -0800 (PST) Received-SPF: neutral (google.com: 209.85.213.48 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.213.48; Received: by mail-yh0-f48.google.com with SMTP id f73so6618273yha.7 for ; Fri, 29 Nov 2013 04:20:14 -0800 (PST) X-Received: by 10.236.35.71 with SMTP id t47mr1946615yha.72.1385727614194; Fri, 29 Nov 2013 04:20:14 -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.12 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Nov 2013 04:20:13 -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 20/36] mtd: st_spi_fsm: Provide a method to put the chip into 32bit addressing mode Date: Fri, 29 Nov 2013 12:19:09 +0000 Message-Id: <1385727565-25794-21-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.41 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: , Most Serial Flash chips support 24bit addressing as a default but more recent incarnations can support 32bit. Based on information provided though platform specific data and capabilities we can determine whether or not our current chip can. This patch provides a means to setup the FSM message sequence to put the chip into 32bit mode. Signed-off-by: Lee Jones --- drivers/mtd/devices/st_spi_fsm.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index 4edd3f2..325fd7a 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -28,6 +28,8 @@ #include "st_spi_fsm.h" #include "serial_flash_cmds.h" +static struct stfsm_seq stfsm_seq_en_32bit_addr;/* Dynamically populated */ + static struct stfsm_seq stfsm_seq_read_jedec = { .data_size = TRANSFER_SIZE(8), .seq_opc[0] = (SEQ_OPC_PADS_1 | @@ -170,6 +172,23 @@ static void stfsm_read_fifo(struct stfsm *fsm, uint32_t *buf, } } +static int stfsm_enter_32bit_addr(struct stfsm *fsm, int enter) +{ + struct stfsm_seq *seq = &stfsm_seq_en_32bit_addr; + uint32_t cmd = enter ? FLASH_CMD_EN4B_ADDR : FLASH_CMD_EX4B_ADDR; + + seq->seq_opc[0] = (SEQ_OPC_PADS_1 | + SEQ_OPC_CYCLES(8) | + SEQ_OPC_OPCODE(cmd) | + SEQ_OPC_CSDEASSERT); + + stfsm_load_seq(fsm, seq); + + stfsm_wait_seq(fsm); + + return 0; +} + /* * SoC reset on 'boot-from-spi' systems *