From patchwork Thu Jan 23 10:31:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 23591 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f200.google.com (mail-pd0-f200.google.com [209.85.192.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 00663218BD for ; Thu, 23 Jan 2014 10:32:33 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id y10sf3673674pdj.7 for ; Thu, 23 Jan 2014 02:32:33 -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=fBxR1FdsctnsbcHUGhf4YluRzwq5yaB6KgmykjcA8bk=; b=ScgwdLFw9vSzHDPtTRxOq2KclGXn7kNzfUn6mKNiNcfRS+rzCdlZAhCJPKA5jmEZPJ BRp+vj8ijIZX4xpyXzYW0LlAhimOPCGNlTbnVkSg3JqSK1WXNob2xn2RaGdbMCZtobDz eCY4Onia4skcmXLCGKfrRVSvbbCb/aVPmI5dc0sh7ijM1Lwjusdvu2/zutcGuB/OPtRZ dFA9p9f4qppxkhGvcRAuz76/Z+wvBu4pO1UyDZ6pETm1Ji+BMrrN3W458UonxazipLSx 1h/LQqMKxgpwm6nr0hbAIJyxE33+Ik/lpyNntrsEjlBfu0CEzcYavFc+4pLEfoZn2N+m Fgww== X-Gm-Message-State: ALoCoQkzezYHwRQbPAruoQToZQNkn9kzn4AyuePbX42SX9kMvHVo+Q3QslHab53k2Km7IqpQZzpt X-Received: by 10.66.157.35 with SMTP id wj3mr2820545pab.11.1390473153288; Thu, 23 Jan 2014 02:32:33 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.131.202 with SMTP id oo10ls265213qeb.53.gmail; Thu, 23 Jan 2014 02:32:33 -0800 (PST) X-Received: by 10.220.99.7 with SMTP id s7mr4068487vcn.19.1390473153069; Thu, 23 Jan 2014 02:32:33 -0800 (PST) Received: from mail-ve0-f178.google.com (mail-ve0-f178.google.com [209.85.128.178]) by mx.google.com with ESMTPS id ru2si6423833vcb.104.2014.01.23.02.32.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Jan 2014 02:32:33 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.178 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.178; Received: by mail-ve0-f178.google.com with SMTP id oy12so985357veb.37 for ; Thu, 23 Jan 2014 02:32:33 -0800 (PST) X-Received: by 10.59.6.225 with SMTP id cx1mr31129ved.50.1390473153004; Thu, 23 Jan 2014 02:32:33 -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 u4csp15958vcz; Thu, 23 Jan 2014 02:32:32 -0800 (PST) X-Received: by 10.180.75.115 with SMTP id b19mr23667933wiw.19.1390473152058; Thu, 23 Jan 2014 02:32:32 -0800 (PST) Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by mx.google.com with ESMTPS id d15si8776639wjn.103.2014.01.23.02.32.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Jan 2014 02:32:32 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.177 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.212.177; Received: by mail-wi0-f177.google.com with SMTP id m19so1585953wiv.16 for ; Thu, 23 Jan 2014 02:32:31 -0800 (PST) X-Received: by 10.180.19.35 with SMTP id b3mr24034184wie.20.1390473151586; Thu, 23 Jan 2014 02:32:31 -0800 (PST) Received: from localhost.localdomain ([80.76.198.141]) by mx.google.com with ESMTPSA id ay6sm21257831wjb.23.2014.01.23.02.32.29 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Jan 2014 02:32:30 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: linus.walleij@linaro.org, dwmw2@infradead.org, linux-mtd@lists.infradead.org, computersforpeace@gmail.com, Angus.Clark@st.com, DCG_UPD_stlinux_kernel@list.st.com, olivier.clergeaud@st.com, Lee Jones Subject: [PATCH RESEND v4 20/37] mtd: st_spi_fsm: Provide a method to put the chip into 32bit addressing mode Date: Thu, 23 Jan 2014 10:31:08 +0000 Message-Id: <1390473085-24626-21-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1390473085-24626-1-git-send-email-lee.jones@linaro.org> References: <1390473085-24626-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.178 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 b21929b..e74513d 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -411,6 +411,8 @@ static struct flash_info flash_types[] = { { NULL, 0x000000, 0, 0, 0, 0, 0, NULL }, }; +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 | @@ -554,6 +556,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 *