From patchwork Fri Nov 22 16:22:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 21698 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f197.google.com (mail-vc0-f197.google.com [209.85.220.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2227423FDC for ; Fri, 22 Nov 2013 16:24:13 +0000 (UTC) Received: by mail-vc0-f197.google.com with SMTP id id10sf2641169vcb.4 for ; Fri, 22 Nov 2013 08:24:12 -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=yDDA0xyMZ0FyWE6IsN00VamzaveIEDsVAggkerqCla8=; b=P7AHV/GmjZufdLOqOydEuoLLnmnaSQ2TaJroai0ungALQCc69hDBH9OYOcBVLW6oWw d/5AaZbB4I1qcxn+Q+WH9eW2bXn1TChaBc8Hgf2tujPaCdAhmksVetNUoMQx7Y9MOcEV UDAgoR6H24SZ/ZlCYSm+6YYO4sEWoIWw6z/olG7EAL/D5dPAbdtltiNx6CcqYuD0dlnx 3JL4wU4eudWan3CLLVZKH23MfXsUs2AaP2Lq9w4jKddbuCevzTzBxoJt1XBvjgFnaoYQ AjepE9YoqeGBSZsKfuHrP9IO6tp+5EQE5V7VPcN+Sg9E5ZsOdGSoUWQKFj+64VntbSYv 1Nbg== X-Gm-Message-State: ALoCoQku//C0csnDvgdIoLdfWM1uKziFyLZUAXEmpo8EFfGfcfYVo1LaAkne1QozBn98VAlIu2s6 X-Received: by 10.236.32.74 with SMTP id n50mr6466624yha.13.1385137452933; Fri, 22 Nov 2013 08:24:12 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.62.199 with SMTP id a7ls1008210qes.87.gmail; Fri, 22 Nov 2013 08:24:12 -0800 (PST) X-Received: by 10.58.46.171 with SMTP id w11mr12189273vem.5.1385137452824; Fri, 22 Nov 2013 08:24:12 -0800 (PST) Received: from mail-vb0-f48.google.com (mail-vb0-f48.google.com [209.85.212.48]) by mx.google.com with ESMTPS id tw10si12881472vec.82.2013.11.22.08.24.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 22 Nov 2013 08:24:12 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.48 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.48; Received: by mail-vb0-f48.google.com with SMTP id x16so1009842vbf.35 for ; Fri, 22 Nov 2013 08:24:12 -0800 (PST) X-Received: by 10.58.207.76 with SMTP id lu12mr2006410vec.30.1385137452731; Fri, 22 Nov 2013 08:24:12 -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 u4csp51550vcz; Fri, 22 Nov 2013 08:24:12 -0800 (PST) X-Received: by 10.66.139.166 with SMTP id qz6mr13142416pab.88.1385137451983; Fri, 22 Nov 2013 08:24:11 -0800 (PST) Received: from mail-pd0-f172.google.com (mail-pd0-f172.google.com [209.85.192.172]) by mx.google.com with ESMTPS id vs7si20178845pbc.145.2013.11.22.08.24.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 22 Nov 2013 08:24:11 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.172 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.192.172; Received: by mail-pd0-f172.google.com with SMTP id g10so1450137pdj.31 for ; Fri, 22 Nov 2013 08:24:11 -0800 (PST) X-Received: by 10.68.131.70 with SMTP id ok6mr3603473pbb.126.1385137451609; Fri, 22 Nov 2013 08:24:11 -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.08 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 22 Nov 2013 08:24:11 -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 18/23] mtd: st_spi_fsm: Prepare read/write sequences according to configuration Date: Fri, 22 Nov 2013 16:22:55 +0000 Message-Id: <1385137380-28968-19-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.48 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 a56fb98..85abf9a 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -225,6 +225,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_fifo(struct stfsm *fsm, uint32_t *buf, const uint32_t size) {