From patchwork Thu Mar 20 09:20:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 26650 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f198.google.com (mail-ie0-f198.google.com [209.85.223.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6C2DF202E0 for ; Thu, 20 Mar 2014 09:21:58 +0000 (UTC) Received: by mail-ie0-f198.google.com with SMTP id to1sf2123405ieb.5 for ; Thu, 20 Mar 2014 02:21:57 -0700 (PDT) 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=NA3hqdpKiiX0NxcjuZIzvGnXCGwuF8txQMZBsTZIWR8=; b=krDKh6DdMemsGRJSBJbY8u+mxxVyU4d2zXKAZPmw9MoDbEHBPKP0OmSTgKpcOr6TQK S781ZQRpnB2SrzWI9CeFGx2hqCVqsk8OBAH4HMtLA3JotlM38aHQXMC+wRAC7q7COAUq h8bHBYN1uo6t8EL3NWucgALBkKT6QLHAODbRP2rN97sLwUNl+geT8Ip4EHYw6k5P9d4F fuCvk1w+0ltVBPREBTfzOMH2b67MTvbzAayF8asC6bMHcUTh1kBSvWC8m/g00pq01/P7 I0JLHSQDxDwuDGLjHwbaJseOYavgPxQWef2z0s9TModrnACeriLZvRg+ooSVnDn9nTcz /DuA== X-Gm-Message-State: ALoCoQnCPi61WzXK7oNdjOG7JZUIGDVcGGv+xxAf+Vyc0UPGMk9YN6ehvKl55WPhDZYZYqoi3p1r X-Received: by 10.182.186.105 with SMTP id fj9mr15081265obc.5.1395307317904; Thu, 20 Mar 2014 02:21:57 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.22.75 with SMTP id 69ls163722qgm.94.gmail; Thu, 20 Mar 2014 02:21:57 -0700 (PDT) X-Received: by 10.220.250.203 with SMTP id mp11mr5435276vcb.2.1395307317809; Thu, 20 Mar 2014 02:21:57 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id xv15si290546veb.152.2014.03.20.02.21.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Mar 2014 02:21:57 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id ld13so594128vcb.19 for ; Thu, 20 Mar 2014 02:21:57 -0700 (PDT) X-Received: by 10.221.74.65 with SMTP id yv1mr3514311vcb.31.1395307317725; Thu, 20 Mar 2014 02:21:57 -0700 (PDT) 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.78.9 with SMTP id i9csp372539vck; Thu, 20 Mar 2014 02:21:57 -0700 (PDT) X-Received: by 10.180.219.66 with SMTP id pm2mr1733652wic.60.1395307315210; Thu, 20 Mar 2014 02:21:55 -0700 (PDT) Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com [209.85.212.169]) by mx.google.com with ESMTPS id x3si836369wje.119.2014.03.20.02.21.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Mar 2014 02:21:55 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.169 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.212.169; Received: by mail-wi0-f169.google.com with SMTP id hm4so5791776wib.0 for ; Thu, 20 Mar 2014 02:21:54 -0700 (PDT) X-Received: by 10.194.242.4 with SMTP id wm4mr385275wjc.88.1395307314613; Thu, 20 Mar 2014 02:21:54 -0700 (PDT) Received: from lee--X1.home (host109-148-116-196.range109-148.btcentralplus.com. [109.148.116.196]) by mx.google.com with ESMTPSA id di9sm4735120wid.6.2014.03.20.02.21.52 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Mar 2014 02:21:53 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, computersforpeace@gmail.com Cc: linux-mtd@lists.infradead.org, dwmw2@infradead.org, Angus.Clark@st.com, Lee Jones Subject: [PATCH v6 17/36] mtd: st_spi_fsm: Prepare read/write sequences according to configuration Date: Thu, 20 Mar 2014 09:20:49 +0000 Message-Id: <1395307268-12721-18-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1395307268-12721-1-git-send-email-lee.jones@linaro.org> References: <1395307268-12721-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.220.174 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. 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 9d1edf0..3e13d57 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;