From patchwork Fri Nov 22 16:22:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 21700 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f70.google.com (mail-vb0-f70.google.com [209.85.212.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 57BA323FDC for ; Fri, 22 Nov 2013 16:24:19 +0000 (UTC) Received: by mail-vb0-f70.google.com with SMTP id x8sf2651363vbf.1 for ; Fri, 22 Nov 2013 08:24:19 -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=D4bchnpku95GhDGLZwJ6QHinQAe+LEo80dL0bxvs/+E=; b=if+7A5krUHmOBX2ldF5R4748aYzd/i6/foOc80DEqT3WmdWH+qj6DA9pm3IiAl5f24 Rc16GcKCYPBBxOkMKKW47kLx+0py1g6/H5CqcnxrrVEnR5pwNpJ7Ca+0gnFSXxeiqVX+ ALLJlIeAZl1XrbSTImzaHu7XhJzbEOawtOTTFKSA86KI3gX70hhQrDu5+MhgFAffmBH8 jFpRTqK82XfKiE7N/YdV0TG8ADLtdn1Vy8VsfVddI/qx5EB6PoJQZN2ZJR4S8/FIUgHl D2A11j+6MqbzoXu2+deJF72PGrWbIhdm/4Wr/tUIKDeJzQDC+JXXI0HQy/Sf4pVCafEd pIjw== X-Gm-Message-State: ALoCoQn0OjOBkPWeSPWYlvDtpBQQRzqrUYsEsRhT8O7gMCQTLE4K5+QRGiNdTGcdsrPoaCY6BGoP X-Received: by 10.236.118.194 with SMTP id l42mr6764885yhh.2.1385137459098; Fri, 22 Nov 2013 08:24:19 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.82.226 with SMTP id l2ls1078493qey.33.gmail; Fri, 22 Nov 2013 08:24:19 -0800 (PST) X-Received: by 10.220.186.202 with SMTP id ct10mr12295790vcb.14.1385137459005; Fri, 22 Nov 2013 08:24:19 -0800 (PST) Received: from mail-vb0-f44.google.com (mail-vb0-f44.google.com [209.85.212.44]) by mx.google.com with ESMTPS id oy1si12862621veb.143.2013.11.22.08.24.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 22 Nov 2013 08:24:19 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.44 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.44; Received: by mail-vb0-f44.google.com with SMTP id w20so1031237vbb.3 for ; Fri, 22 Nov 2013 08:24:18 -0800 (PST) X-Received: by 10.52.243.138 with SMTP id wy10mr10254440vdc.2.1385137458927; Fri, 22 Nov 2013 08:24:18 -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 u4csp51564vcz; Fri, 22 Nov 2013 08:24:18 -0800 (PST) X-Received: by 10.66.26.204 with SMTP id n12mr12628459pag.159.1385137457841; Fri, 22 Nov 2013 08:24:17 -0800 (PST) Received: from mail-pa0-f43.google.com (mail-pa0-f43.google.com [209.85.220.43]) by mx.google.com with ESMTPS id do3si14513494pbc.292.2013.11.22.08.24.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 22 Nov 2013 08:24:17 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.43 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.220.43; Received: by mail-pa0-f43.google.com with SMTP id bj1so1508014pad.30 for ; Fri, 22 Nov 2013 08:24:17 -0800 (PST) X-Received: by 10.68.89.162 with SMTP id bp2mr3610075pbb.151.1385137457451; Fri, 22 Nov 2013 08:24:17 -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.14 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 22 Nov 2013 08:24:16 -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 20/23] mtd: st_spi_fsm: Provide a method to put the chip into 32bit addressing mode Date: Fri, 22 Nov 2013 16:22:57 +0000 Message-Id: <1385137380-28968-21-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.212.44 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 9a66c99..b99b4c1 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 | @@ -128,6 +130,23 @@ static void stfsm_wait_seq(struct stfsm *fsm) dev_err(fsm->dev, "timeout on sequence completion\n"); } +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 *