From patchwork Thu Jan 23 10:31:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 23596 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f72.google.com (mail-oa0-f72.google.com [209.85.219.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 039C0218BD for ; Thu, 23 Jan 2014 10:32:47 +0000 (UTC) Received: by mail-oa0-f72.google.com with SMTP id i4sf6432137oah.11 for ; Thu, 23 Jan 2014 02:32:47 -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=bcr6tvqAkEVA580Z1Y3zEq/XCfILvjqRiKJanm7hEuA=; b=iSm0SdJYrMpQYyZ44XmqzmElsHSMHs1kYEESX63oD6ri3OXbyi+JbWHlWar7P31Ue2 ssS4PQ6bxkHLPiceIMYlq1sUWIJ2VEmg4w5qpwVh0urvSA8rgdUbBFw6lsxeyVnse+XI kiWZohcUrUfIxWxmK5hotKlgKZ2FsngVv9XJMbmaYbuDI1JzU0wLoQqmQfeFSRawl6Jj KAt8D1HBwG+FcFU/E43lqd6W7SYiFzA02xjjKfFxPZqlnBuAEKAM7766loTTd5O0X32w gL5B6t2jXO23ZpyEZOUTQyN9M6cl7+EFQdPaUaJSbBvgTHXUaMOxJxrnPmJGc6SDL+oh ha5w== X-Gm-Message-State: ALoCoQnBSPmHAe4OFtM1SseYBtO0LrsVPmm4pwxb82B+gkoa7AGD3sO7u7v0rePza4H9PkYxHqm+ X-Received: by 10.42.107.67 with SMTP id c3mr2521182icp.0.1390473167134; Thu, 23 Jan 2014 02:32:47 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.29.102 with SMTP id a93ls252584qga.33.gmail; Thu, 23 Jan 2014 02:32:47 -0800 (PST) X-Received: by 10.221.20.199 with SMTP id qp7mr4137077vcb.24.1390473167032; Thu, 23 Jan 2014 02:32:47 -0800 (PST) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id n10si6427774vcf.78.2014.01.23.02.32.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Jan 2014 02:32:46 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.177 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.177; Received: by mail-ve0-f177.google.com with SMTP id jz11so973321veb.36 for ; Thu, 23 Jan 2014 02:32:45 -0800 (PST) X-Received: by 10.58.219.1 with SMTP id pk1mr29887vec.49.1390473165762; Thu, 23 Jan 2014 02:32:45 -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 u4csp15985vcz; Thu, 23 Jan 2014 02:32:45 -0800 (PST) X-Received: by 10.180.7.227 with SMTP id m3mr7075514wia.59.1390473164905; Thu, 23 Jan 2014 02:32:44 -0800 (PST) Received: from mail-we0-f169.google.com (mail-we0-f169.google.com [74.125.82.169]) by mx.google.com with ESMTPS id e19si8781295wjz.71.2014.01.23.02.32.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Jan 2014 02:32:44 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.169 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.169; Received: by mail-we0-f169.google.com with SMTP id u57so956000wes.14 for ; Thu, 23 Jan 2014 02:32:44 -0800 (PST) X-Received: by 10.181.12.76 with SMTP id eo12mr7240431wid.19.1390473164490; Thu, 23 Jan 2014 02:32:44 -0800 (PST) Received: from localhost.localdomain ([80.76.198.141]) by mx.google.com with ESMTPSA id ay6sm21257831wjb.23.2014.01.23.02.32.42 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Jan 2014 02:32:43 -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 25/37] mtd: st_spi_fsm: Prepare default sequences for read/write/erase Date: Thu, 23 Jan 2014 10:31:13 +0000 Message-Id: <1390473085-24626-26-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.177 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 chips require a predefined set of FSM message sequences for read, write and erase operations. This patch provides a way to set them up, which it will do so if a chip specific initialisation routine isn't been provided. Signed-off-by: Lee Jones --- drivers/mtd/devices/st_spi_fsm.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index 28d8ac0..a5b9d67 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -838,6 +838,38 @@ static int stfsm_search_prepare_rw_seq(struct stfsm *fsm, return 0; } +/* Prepare a READ/WRITE/ERASE 'default' sequences */ +static int stfsm_prepare_rwe_seqs_default(struct stfsm *fsm) +{ + uint32_t flags = fsm->info->flags; + int ret; + + /* Configure 'READ' sequence */ + ret = stfsm_search_prepare_rw_seq(fsm, &stfsm_seq_read, + default_read_configs); + if (ret) { + dev_err(fsm->dev, + "failed to prep READ sequence with flags [0x%08x]\n", + flags); + return ret; + } + + /* Configure 'WRITE' sequence */ + ret = stfsm_search_prepare_rw_seq(fsm, &stfsm_seq_write, + default_write_configs); + if (ret) { + dev_err(fsm->dev, + "failed to prep WRITE sequence with flags [0x%08x]\n", + flags); + return ret; + } + + /* Configure 'ERASE_SECTOR' sequence */ + stfsm_prepare_erasesec_seq(fsm, &stfsm_seq_erase_sector); + + return 0; +} + static int stfsm_n25q_config(struct stfsm *fsm) { uint32_t flags = fsm->info->flags; @@ -1153,6 +1185,10 @@ static int stfsm_probe(struct platform_device *pdev) ret = info->config(fsm); if (ret) return ret; + } else { + ret = stfsm_prepare_rwe_seqs_default(fsm); + if (ret) + return ret; } platform_set_drvdata(pdev, fsm);