From patchwork Fri Nov 29 12:19:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 21883 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f197.google.com (mail-pd0-f197.google.com [209.85.192.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B219023FC4 for ; Fri, 29 Nov 2013 12:20:25 +0000 (UTC) Received: by mail-pd0-f197.google.com with SMTP id v10sf24338581pde.0 for ; Fri, 29 Nov 2013 04:20:25 -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=+8FaavFnCI0AU0v2e64qI4B6g+t2QzVkB5qX1HbT5X0=; b=Y4kNUnLsGYU9la4682Zgmjcp/Tk4PkYCaMYYrR+JAIiW83FtzukjtM9zT3bTsn4wvm 3dxSkW2gzkumR8EMyUYayyuQzZlJhH2sv4MwgFCX4MmbXJ0yI2BixhnZC2GwQNomg7DU fp1M24h0CtXPRAugWWd0UfSMGQgNHwn3i1i60lbyt4URmvkueaM+sCmojBSHnlLrw5E5 hbdFy2NPEDkiroqYUvJShhrZCwgiJcIVYgUL96TNQg2vI0a2R6KFgXRzj8rJ3q6dE1P4 XW65dFfOb4DAqHrXFKuFEAHgg0uR5olrtrhVfvuL3vNcR88S63f5AA0MnPnbAb1X/C4E oM+w== X-Gm-Message-State: ALoCoQmhV758m3MPczfzFNa9fLfq037JICeBcPghIVDQM6N4KDPCsWLymvo9lFgHMJuewvFPn0YP X-Received: by 10.66.20.100 with SMTP id m4mr16297890pae.36.1385727624971; Fri, 29 Nov 2013 04:20:24 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.104.9 with SMTP id ga9ls3599768qeb.38.gmail; Fri, 29 Nov 2013 04:20:24 -0800 (PST) X-Received: by 10.58.145.200 with SMTP id sw8mr38081veb.68.1385727624829; Fri, 29 Nov 2013 04:20:24 -0800 (PST) Received: from mail-ve0-f182.google.com (mail-ve0-f182.google.com [209.85.128.182]) by mx.google.com with ESMTPS id sw5si24798312veb.61.2013.11.29.04.20.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Nov 2013 04:20:24 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.182 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.182; Received: by mail-ve0-f182.google.com with SMTP id jy13so7037457veb.13 for ; Fri, 29 Nov 2013 04:20:24 -0800 (PST) X-Received: by 10.52.75.99 with SMTP id b3mr31234vdw.80.1385727624603; Fri, 29 Nov 2013 04:20:24 -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 u4csp87450vcz; Fri, 29 Nov 2013 04:20:24 -0800 (PST) X-Received: by 10.224.66.5 with SMTP id l5mr87857551qai.31.1385727624159; Fri, 29 Nov 2013 04:20:24 -0800 (PST) Received: from mail-yh0-f45.google.com (mail-yh0-f45.google.com [209.85.213.45]) by mx.google.com with ESMTPS id n4si10262615qac.32.2013.11.29.04.20.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Nov 2013 04:20:24 -0800 (PST) Received-SPF: neutral (google.com: 209.85.213.45 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.213.45; Received: by mail-yh0-f45.google.com with SMTP id v1so5648818yhn.18 for ; Fri, 29 Nov 2013 04:20:23 -0800 (PST) X-Received: by 10.236.91.201 with SMTP id h49mr1898464yhf.96.1385727623692; Fri, 29 Nov 2013 04:20:23 -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.21 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Nov 2013 04:20:23 -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 25/36] mtd: st_spi_fsm: Prepare default sequences for read/write/erase Date: Fri, 29 Nov 2013 12:19:14 +0000 Message-Id: <1385727565-25794-26-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.182 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: , Most chips require a predefined set of FSM message sequences for read, write and erase operations. This patch provides a way to set them up, which it will do so if a chip specific initialisation routine isn't been provided. Signed-off-by: Lee Jones --- drivers/mtd/devices/st_spi_fsm.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index 2369da1..ad277f1 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -441,6 +441,38 @@ static int stfsm_search_prepare_rw_seq(struct stfsm *fsm, return 0; } +/* Prepare a READ/WRITE/ERASE 'default' sequences */ +static int stfsm_prepare_rwe_seqs_default(struct stfsm *fsm) +{ + uint32_t flags = fsm->info->flags; + int ret; + + /* Configure 'READ' sequence */ + ret = stfsm_search_prepare_rw_seq(fsm, &stfsm_seq_read, + default_read_configs); + if (ret) { + dev_err(fsm->dev, + "failed to prep READ sequence with flags [0x%08x]\n", + flags); + return ret; + } + + /* Configure 'WRITE' sequence */ + ret = stfsm_search_prepare_rw_seq(fsm, &stfsm_seq_write, + default_write_configs); + if (ret) { + dev_err(fsm->dev, + "failed to prep WRITE sequence with flags [0x%08x]\n", + flags); + return ret; + } + + /* Configure 'ERASE_SECTOR' sequence */ + stfsm_prepare_erasesec_seq(fsm, &stfsm_seq_erase_sector); + + return 0; +} + static int stfsm_n25q_config(struct stfsm *fsm) { uint32_t flags = fsm->info->flags; @@ -756,6 +788,10 @@ static int stfsm_probe(struct platform_device *pdev) ret = info->config(fsm); if (ret) return ret; + } else { + ret = stfsm_prepare_rwe_seqs_default(fsm); + if (ret) + return ret; } platform_set_drvdata(pdev, fsm);