From patchwork Thu Jan 23 10:31:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 23589 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f71.google.com (mail-pa0-f71.google.com [209.85.220.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BAC59218BD for ; Thu, 23 Jan 2014 10:32:28 +0000 (UTC) Received: by mail-pa0-f71.google.com with SMTP id kp14sf4046309pab.2 for ; Thu, 23 Jan 2014 02:32:28 -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=m/WAjDT5+1ianTqK3uyZMiYCc2QeqUVh9+m+3qzKjMA=; b=CGCLnR+/C+jAehcC18c+4Tx8LYYb7t1MlniEBv1OLx8V/SsQ5hmafU4Ldrs4/TjAkw NFA5RSoq2Ej5m+xVYXmXFyxFP84KLgK+lRQKeDkAhtx9MNPq0rrn8ncox7qgST3EYqHK uLtY2+r/PvygXhDKE1CeTWU65ARSkR4qHXylJT3gtXQVjQWKOwb6fKOo2W7y2lPOIE1F ca23Baaisl0dWPLJ2yM9TiZi8d7yPRlDNcClPu9eDxclrYwWHB5I3k6KMy0+8G1pUImE 0ohy7hphuuOgjwVp63uy5QV6EhV8bZvF99xapc9SwTLOG6OY7rtFAwVVH7QGz0ozK87t SLAw== X-Gm-Message-State: ALoCoQnG+eAAY/8Onr6JhGtCynskt1LcSAfXEAD/bTpL8jAt9A7COZcI1ZbMSNZtnXC2/+dJqUng X-Received: by 10.66.158.6 with SMTP id wq6mr2675829pab.39.1390473147994; Thu, 23 Jan 2014 02:32:27 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.103.118 with SMTP id x109ls295151qge.43.gmail; Thu, 23 Jan 2014 02:32:27 -0800 (PST) X-Received: by 10.221.34.211 with SMTP id st19mr4120368vcb.5.1390473147851; Thu, 23 Jan 2014 02:32:27 -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 eh16si6425642vcb.93.2014.01.23.02.32.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Jan 2014 02:32:27 -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 oy12so985320veb.37 for ; Thu, 23 Jan 2014 02:32:27 -0800 (PST) X-Received: by 10.221.54.65 with SMTP id vt1mr51319vcb.46.1390473147792; Thu, 23 Jan 2014 02:32:27 -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 u4csp15953vcz; Thu, 23 Jan 2014 02:32:27 -0800 (PST) X-Received: by 10.194.8.229 with SMTP id u5mr713631wja.80.1390473146824; Thu, 23 Jan 2014 02:32:26 -0800 (PST) Received: from mail-we0-f175.google.com (mail-we0-f175.google.com [74.125.82.175]) by mx.google.com with ESMTPS id t13si8778727wju.91.2014.01.23.02.32.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Jan 2014 02:32:26 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.175 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.175; Received: by mail-we0-f175.google.com with SMTP id p61so925728wes.6 for ; Thu, 23 Jan 2014 02:32:26 -0800 (PST) X-Received: by 10.194.174.197 with SMTP id bu5mr868616wjc.71.1390473146408; Thu, 23 Jan 2014 02:32:26 -0800 (PST) Received: from localhost.localdomain ([80.76.198.141]) by mx.google.com with ESMTPSA id ay6sm21257831wjb.23.2014.01.23.02.32.24 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Jan 2014 02:32:25 -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 18/37] mtd: st_spi_fsm: Prepare read/write sequences according to configuration Date: Thu, 23 Jan 2014 10:31:06 +0000 Message-Id: <1390473085-24626-19-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: , Firstly we search for our preference read/write configuration based on a given chip's capabilities. Then we actually set up the message sequence accordingly. Signed-off-by: Lee Jones --- drivers/mtd/devices/st_spi_fsm.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index 02718ae..fc23354 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -649,6 +649,23 @@ static void stfsm_prepare_rw_seq(struct stfsm *fsm, seq->seq[i++] = STFSM_INST_STOP; } +static int stfsm_search_prepare_rw_seq(struct stfsm *fsm, + struct stfsm_seq *seq, + struct seq_rw_config *cfgs) +{ + struct seq_rw_config *config; + + config = stfsm_search_seq_rw_configs(fsm, cfgs); + if (!config) { + dev_err(fsm->dev, "failed to find suitable config\n"); + return -EINVAL; + } + + stfsm_prepare_rw_seq(fsm, seq, config); + + return 0; +} + static void stfsm_read_jedec(struct stfsm *fsm, uint8_t *const jedec) { const struct stfsm_seq *seq = &stfsm_seq_read_jedec;