From patchwork Wed Jan 8 13:47:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 22954 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gg0-f197.google.com (mail-gg0-f197.google.com [209.85.161.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 645FE202E2 for ; Wed, 8 Jan 2014 13:48:54 +0000 (UTC) Received: by mail-gg0-f197.google.com with SMTP id e5sf2007201ggh.0 for ; Wed, 08 Jan 2014 05:48:53 -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=DgMS63MCzSdNyw5sKOwMl7AF/PVIndhZt/csI0KXWRGy6WAAaGiYue7ZnumysFCmuj OPQbeyHAROPX0//Sq+DlApGqnRvFG+b3sVGrZdBfADI+OvS06u1hU5Y4nmnZBgMxm+6k SCIz40pLe8DQHEX2lVWBTViBZH56+uDCMht3wyRT0xmjv8A38n59tw4+I0tFmKqT2Wq8 ZgJ4riSx/etJdRJRpCaKOzLccEmDGwSrCYsDEmoCB46fvzYew6cjcQt9dp1WTQ/LGtyO RRMxDZUVjBhPdgX5+9rVryAPHXOLrXJcR6o5M7v98cegbQDeHYylG0unDMNIEAXHW0Tb VwfQ== X-Gm-Message-State: ALoCoQnx4eP/yEYAs4giZ1q0Ytsgv8AYn7mUQgBHxMJGIC0dp+MVURU0P19RA0t0TFZ1hru1U8t1 X-Received: by 10.58.253.229 with SMTP id ad5mr9305821ved.30.1389188933589; Wed, 08 Jan 2014 05:48:53 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.12.11 with SMTP id u11ls557009qeb.25.gmail; Wed, 08 Jan 2014 05:48:53 -0800 (PST) X-Received: by 10.58.100.244 with SMTP id fb20mr79010739veb.6.1389188933474; Wed, 08 Jan 2014 05:48:53 -0800 (PST) Received: from mail-vb0-f47.google.com (mail-vb0-f47.google.com [209.85.212.47]) by mx.google.com with ESMTPS id tc7si598092vdc.100.2014.01.08.05.48.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Jan 2014 05:48:53 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.47 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.47; Received: by mail-vb0-f47.google.com with SMTP id m10so1147967vbh.20 for ; Wed, 08 Jan 2014 05:48:53 -0800 (PST) X-Received: by 10.52.248.238 with SMTP id yp14mr2084152vdc.81.1389188933367; Wed, 08 Jan 2014 05:48:53 -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.59.13.131 with SMTP id ey3csp226623ved; Wed, 8 Jan 2014 05:48:52 -0800 (PST) X-Received: by 10.180.92.233 with SMTP id cp9mr21356930wib.21.1389188932380; Wed, 08 Jan 2014 05:48:52 -0800 (PST) Received: from mail-we0-f178.google.com (mail-we0-f178.google.com [74.125.82.178]) by mx.google.com with ESMTPS id j11si2582001wiw.64.2014.01.08.05.48.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Jan 2014 05:48:52 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.178 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.178; Received: by mail-we0-f178.google.com with SMTP id t60so1465818wes.9 for ; Wed, 08 Jan 2014 05:48:52 -0800 (PST) X-Received: by 10.180.38.8 with SMTP id c8mr21696457wik.48.1389188931868; Wed, 08 Jan 2014 05:48:51 -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 j9sm48125217wjx.18.2014.01.08.05.48.50 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Jan 2014 05:48:51 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: computersforpeace@gmail.com, angus.clark@st.com, Lee Jones Subject: [PATCH v4 18/37] mtd: st_spi_fsm: Prepare read/write sequences according to configuration Date: Wed, 8 Jan 2014 13:47:01 +0000 Message-Id: <1389188840-14306-19-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1389188840-14306-1-git-send-email-lee.jones@linaro.org> References: <1389188840-14306-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.47 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;