From patchwork Wed Jan 8 13:47:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 22961 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f72.google.com (mail-yh0-f72.google.com [209.85.213.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 42D9D202E2 for ; Wed, 8 Jan 2014 13:49:05 +0000 (UTC) Received: by mail-yh0-f72.google.com with SMTP id z6sf2375400yhz.11 for ; Wed, 08 Jan 2014 05:49:04 -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=bcr6tvqAkEVA580Z1Y3zEq/XCfILvjqRiKJanm7hEuA=; b=gCz8GppjjaEVBRodl6D1YiI0K0NIIT8i7BiZ685dRjqnSTYxTAdo4EClTuVEl9ISJf N34oDWZy/xU38RR56OBDW5jnLEJLVzKWDkvD2Ytt2bYjMLD/VhcqzS33BHt4WIpmwlAj 3S4mL+HFIoAuJMHgSbzuPsl0wBweMMK7PZHHN30MuES6emefTSrwYdeh6xkZcpser7CC xLB3ECILIM4CiLu8V3EedFUjpPm5SxDJ4moNV5F/yuBOzA0mU8MiVfJhzrU0MkfDzCu6 NCzpnPwTEZUQyqJvXMQAMw9vakO+q2a2QxjSZ3jZWSZDF5J5Tl+eH6lpM5pu7Svldwx1 XzuQ== X-Gm-Message-State: ALoCoQk3U+7n/FXCzhM0fn6FHJB31rZF2PFyAiRXGjfnJJD2oGJms3+aWewpCGgddWKosSrIpzEj X-Received: by 10.236.52.7 with SMTP id d7mr1048384yhc.32.1389188944488; Wed, 08 Jan 2014 05:49:04 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.103.136 with SMTP id fw8ls560682qeb.20.gmail; Wed, 08 Jan 2014 05:49:04 -0800 (PST) X-Received: by 10.52.96.99 with SMTP id dr3mr2243336vdb.69.1389188944359; Wed, 08 Jan 2014 05:49:04 -0800 (PST) Received: from mail-vb0-f42.google.com (mail-vb0-f42.google.com [209.85.212.42]) by mx.google.com with ESMTPS id xb5si596054vdc.107.2014.01.08.05.49.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Jan 2014 05:49:04 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.42 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.42; Received: by mail-vb0-f42.google.com with SMTP id w5so1165351vbf.15 for ; Wed, 08 Jan 2014 05:49:04 -0800 (PST) X-Received: by 10.52.248.238 with SMTP id yp14mr2085170vdc.81.1389188944240; Wed, 08 Jan 2014 05:49:04 -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.59.13.131 with SMTP id ey3csp226636ved; Wed, 8 Jan 2014 05:49:03 -0800 (PST) X-Received: by 10.194.77.106 with SMTP id r10mr1758295wjw.91.1389188943279; Wed, 08 Jan 2014 05:49:03 -0800 (PST) Received: from mail-we0-f180.google.com (mail-we0-f180.google.com [74.125.82.180]) by mx.google.com with ESMTPS id co6si2587067wib.48.2014.01.08.05.49.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Jan 2014 05:49:03 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.180 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.180; Received: by mail-we0-f180.google.com with SMTP id t61so1440515wes.25 for ; Wed, 08 Jan 2014 05:49:02 -0800 (PST) X-Received: by 10.194.57.19 with SMTP id e19mr1465434wjq.93.1389188942847; Wed, 08 Jan 2014 05:49:02 -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 j9sm48125217wjx.18.2014.01.08.05.49.01 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Jan 2014 05:49:02 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: computersforpeace@gmail.com, angus.clark@st.com, Lee Jones Subject: [PATCH v4 25/37] mtd: st_spi_fsm: Prepare default sequences for read/write/erase Date: Wed, 8 Jan 2014 13:47:08 +0000 Message-Id: <1389188840-14306-26-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1389188840-14306-1-git-send-email-lee.jones@linaro.org> References: <1389188840-14306-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.42 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 28d8ac0..a5b9d67 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -838,6 +838,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; @@ -1153,6 +1185,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);