From patchwork Fri Nov 29 12:19:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 21876 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f70.google.com (mail-qa0-f70.google.com [209.85.216.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C686623FC4 for ; Fri, 29 Nov 2013 12:20:12 +0000 (UTC) Received: by mail-qa0-f70.google.com with SMTP id j5sf4145077qaq.9 for ; Fri, 29 Nov 2013 04:20: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=OSxeTsDF0NoUTbEuu88fUZt3Y4Jeu99ocEfyOAL+pL0=; b=Lh+y7Hktdyg78lVANyjr9o9oTsGXDarnfY8OI89d3ryTScMSYfwWeR9yRn0XmF5PqL SCEGu/XA9n8eXVXjg9HlrY41Vm+Qd4OAVXZQOFzcOm8CUrSc7proJOJVVYoyFdAAs0Pp MmCancFqJRCBi9pB35c8gUeLpoh4AhWYJ4Cq0tBJrGY2Blcun7fdn2Dym3n4XfTPOsJN xibF3/fZYDWVupYH0CkVJLPHCOrRXvU6k6VbUze5bZYL+xgqCQ2MrQpWkcCmdtRWJ5QZ u9GvGzTBvptS3cUFEIpilu7WYAaCBWrNbRKFh0diQ3gaRT54N9mu1YhHCWhY+lSXg1TL zuEg== X-Gm-Message-State: ALoCoQlaiPGYX/rObafIrsylaz6+9lXjUb+zK5jx7JKHD8t9d8oP3RfmBoxo+7xyzGJ9Dm1zf07T X-Received: by 10.236.163.67 with SMTP id z43mr22881264yhk.27.1385727612666; Fri, 29 Nov 2013 04:20:12 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.18.199 with SMTP id y7ls3784308qed.30.gmail; Fri, 29 Nov 2013 04:20:12 -0800 (PST) X-Received: by 10.221.47.193 with SMTP id ut1mr42086819vcb.8.1385727612558; Fri, 29 Nov 2013 04:20:12 -0800 (PST) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id gs7si24787920veb.91.2013.11.29.04.20.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Nov 2013 04:20:12 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.181 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.181; Received: by mail-ve0-f181.google.com with SMTP id oy12so6768897veb.26 for ; Fri, 29 Nov 2013 04:20:12 -0800 (PST) X-Received: by 10.52.103.35 with SMTP id ft3mr35804677vdb.5.1385727610985; Fri, 29 Nov 2013 04:20:10 -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 u4csp87429vcz; Fri, 29 Nov 2013 04:20:10 -0800 (PST) X-Received: by 10.236.52.165 with SMTP id e25mr525639yhc.180.1385727610613; Fri, 29 Nov 2013 04:20:10 -0800 (PST) Received: from mail-yh0-f43.google.com (mail-yh0-f43.google.com [209.85.213.43]) by mx.google.com with ESMTPS id w8si36346845yhd.133.2013.11.29.04.20.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Nov 2013 04:20:10 -0800 (PST) Received-SPF: neutral (google.com: 209.85.213.43 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.213.43; Received: by mail-yh0-f43.google.com with SMTP id a41so6176675yho.30 for ; Fri, 29 Nov 2013 04:20:10 -0800 (PST) X-Received: by 10.236.199.81 with SMTP id w57mr830674yhn.139.1385727610354; Fri, 29 Nov 2013 04:20:10 -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 m29sm101911689yho.14.2013.11.29.04.20.08 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Nov 2013 04:20:10 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dwmw2@infradead.org Cc: linus.walleij@linaro.org, linux-mtd@lists.infradead.org, angus.clark@st.com, Lee Jones Subject: [PATCH v3 18/36] mtd: st_spi_fsm: Prepare read/write sequences according to configuration Date: Fri, 29 Nov 2013 12:19:07 +0000 Message-Id: <1385727565-25794-19-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1385727565-25794-1-git-send-email-lee.jones@linaro.org> References: <1385727565-25794-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.181 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 7d690c7..14891ea 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -267,6 +267,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;