From patchwork Tue Feb 18 14:55:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 24885 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f197.google.com (mail-yk0-f197.google.com [209.85.160.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E686C202B2 for ; Tue, 18 Feb 2014 15:03:11 +0000 (UTC) Received: by mail-yk0-f197.google.com with SMTP id 142sf60142781ykq.0 for ; Tue, 18 Feb 2014 07:03:11 -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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=u0ngz/kgdBWvM9fPY5bOPFhGLnxgtn64Z3nDy057Yw0=; b=Slft+b56evDq+TzcX/CotP2c6IyBhMnWE5eLJzy366rpIMl/nfjL83Pa7nWUfd96Tv AS5bGfuN1fP2SUMUd2FYGC74ITjuFgf31oT0JSIpUtXgnf5qbakPFfcSNjZMUvBuTGq6 MkI+0IeIofLIA842FWn8e8AWqXvanGRGa/38MUbw7Fm/EP7QF5zMg7CkZf/4jkFhjSvl zJO5iK3WDyuXo1FexOMZpeVM9pmfZw1KF+hJQbC6KBcWqKYKjaFknIBJMqFTNsyVY/BY ORv30W+A7mi0e/We+1r81sovWOuHTiTNIBoLUuuvd8+woy33O4HR407Sltyu+/Lrq1Ca 6CPQ== X-Gm-Message-State: ALoCoQm5G5nqMnAkY1nVbZAeNmrsD6a2FmMTt6zr2cbvmFL8I2K37t1XHeJL+m+DDWQi6GXJU1gy X-Received: by 10.236.96.138 with SMTP id r10mr10518509yhf.12.1392735791025; Tue, 18 Feb 2014 07:03:11 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.108.73 with SMTP id i67ls1359281qgf.3.gmail; Tue, 18 Feb 2014 07:03:10 -0800 (PST) X-Received: by 10.220.161.132 with SMTP id r4mr9494114vcx.29.1392735790958; Tue, 18 Feb 2014 07:03:10 -0800 (PST) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by mx.google.com with ESMTPS id dc20si5572812vec.118.2014.02.18.07.03.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Feb 2014 07:03:10 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.170 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.170; Received: by mail-ve0-f170.google.com with SMTP id cz12so13912969veb.1 for ; Tue, 18 Feb 2014 07:03:10 -0800 (PST) X-Received: by 10.221.29.137 with SMTP id ry9mr21600228vcb.6.1392735790757; Tue, 18 Feb 2014 07:03:10 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp223021vcz; Tue, 18 Feb 2014 07:03:10 -0800 (PST) X-Received: by 10.68.230.137 with SMTP id sy9mr33401219pbc.126.1392735789674; Tue, 18 Feb 2014 07:03:09 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x3si18590831pbk.353.2014.02.18.07.03.08; Tue, 18 Feb 2014 07:03:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932276AbaBRO5X (ORCPT + 27 others); Tue, 18 Feb 2014 09:57:23 -0500 Received: from mail-we0-f171.google.com ([74.125.82.171]:55811 "EHLO mail-we0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932204AbaBRO5N (ORCPT ); Tue, 18 Feb 2014 09:57:13 -0500 Received: by mail-we0-f171.google.com with SMTP id u56so11813763wes.16 for ; Tue, 18 Feb 2014 06:57:12 -0800 (PST) X-Received: by 10.180.7.130 with SMTP id j2mr18399499wia.25.1392735432449; Tue, 18 Feb 2014 06:57:12 -0800 (PST) Received: from localhost.localdomain ([80.76.198.141]) by mx.google.com with ESMTPSA id h13sm46039687wjr.22.2014.02.18.06.57.10 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Feb 2014 06:57:11 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: lee.jones@linaro.org, DCG_UPD_stlinux_kernel@list.st.com, dwmw2@infradead.org, linux-mtd@lists.infradead.org, computersforpeace@gmail.com, Angus.Clark@st.com Subject: [PATCH 17/35] mtd: st_spi_fsm: Prepare read/write sequences according to configuration Date: Tue, 18 Feb 2014 14:55:44 +0000 Message-Id: <1392735362-1245-18-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1392735362-1245-1-git-send-email-lee.jones@linaro.org> References: <1392735362-1245-1-git-send-email-lee.jones@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.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.170 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 Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org 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. Acked-by Angus Clark 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 94b0cb4..3f5603c 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -618,6 +618,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;