From patchwork Thu Jan 23 10:31:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 313512 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 00FC02C0092 for ; Thu, 23 Jan 2014 22:06:19 +1100 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W6I5J-0000x9-D0; Thu, 23 Jan 2014 11:04:36 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W6I4K-0004r7-98; Thu, 23 Jan 2014 11:03:32 +0000 Received: from bombadil.infradead.org ([2001:1868:205::9]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W6I2e-0004dX-Nf for linux-mtd@merlin.infradead.org; Thu, 23 Jan 2014 11:01:48 +0000 Received: from mail-wi0-f180.google.com ([209.85.212.180]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W6Has-0007yD-PT for linux-mtd@lists.infradead.org; Thu, 23 Jan 2014 10:33:07 +0000 Received: by mail-wi0-f180.google.com with SMTP id d13so1590580wiw.1 for ; Thu, 23 Jan 2014 02:32:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bcr6tvqAkEVA580Z1Y3zEq/XCfILvjqRiKJanm7hEuA=; b=DK1p5n5dzbVdnZejxqWO69jq6mYbuW9Ohej13qzlCW+CeiZAXZewJpL1mR2v5cs6Zq UDVNeSgbrWEJGplzbSgUnXCylioTHTdigwd4sDurnZghfkkH3zAB/fHxibNpp726AiWh GO783+oFHejWx8KzhFuK1o77+apy7TixH+28cF3vtO/+AdgjU0vDc1jhL64OLR84jOiO Mnh71CLv1WsZUF3egyULVhdMo/CNToMdwSDke8jQd1q0rPHHW0wWJn7VPmH+abd8nq3l 9khwPjo+4UEo3x62nRr6C+zsic9WW8e8Igwt7S6+dqrxmY8tCxES2QmS/rJQJKVsBJfg Befg== X-Gm-Message-State: ALoCoQk8NioaQvL3p7kz4pcZnxcJKnnsS6xqkKjHMrzYuu2/TovJlSV6hAFnur90q64ejQkHnHOJ X-Received: by 10.181.12.76 with SMTP id eo12mr7240431wid.19.1390473164490; Thu, 23 Jan 2014 02:32:44 -0800 (PST) Received: from localhost.localdomain ([80.76.198.141]) by mx.google.com with ESMTPSA id ay6sm21257831wjb.23.2014.01.23.02.32.42 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Jan 2014 02:32:43 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND v4 25/37] mtd: st_spi_fsm: Prepare default sequences for read/write/erase Date: Thu, 23 Jan 2014 10:31:13 +0000 Message-Id: <1390473085-24626-26-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1390473085-24626-1-git-send-email-lee.jones@linaro.org> References: <1390473085-24626-1-git-send-email-lee.jones@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140123_023306_981205_4712CFBF X-CRM114-Status: GOOD ( 10.90 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.180 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record Cc: olivier.clergeaud@st.com, Angus.Clark@st.com, Lee Jones , linus.walleij@linaro.org, linux-mtd@lists.infradead.org, computersforpeace@gmail.com, dwmw2@infradead.org, DCG_UPD_stlinux_kernel@list.st.com X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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);