From patchwork Tue Feb 18 14:55:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 24880 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f72.google.com (mail-pb0-f72.google.com [209.85.160.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 45FD3202B2 for ; Tue, 18 Feb 2014 15:01:51 +0000 (UTC) Received: by mail-pb0-f72.google.com with SMTP id up15sf39250964pbc.7 for ; Tue, 18 Feb 2014 07:01:50 -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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=v6ayHBZl5nONnqq/EMJXbcltBHv7kA2yi1mlZvJsFSs=; b=gmVt+qvzjvSMNLdp2jsEQPVkhZGBJzUf1ocQrD8UKL1co8agU9P8TbymSuThMgHkDF KvYlM7As+EkWfXQUDoAJ0NKRLaQkeTH1B68bOShsu6J4mbOrpxdJbOIKlRTJg65pjGWk YRodFmhBkUcd+rypTZbbfed1rjZ6kKpwrLobM7gw5gZkVXgrh/bG+NIOEHT5HxV5bus7 8wLSIY/gFJcrOJWH4n1TFxw8l9PCt6H0qPZQzCDI1WySsMp7y/PRI3lYv6dBcAVuZnT6 zJNwS7JVODn+g2WaOWn7n2r961+9fgLc31dFduUwRJmVtBOBSnQSqZozjxoX4lPveHot 9Muw== X-Gm-Message-State: ALoCoQlbzgguv+BaN70cQfwzbvPBm1h5gpvGjuy4hsZwwPM+mGo5pW4k5B+vH/GOOnVp/KpA6UtM X-Received: by 10.69.16.98 with SMTP id fv2mr12959111pbd.7.1392735710335; Tue, 18 Feb 2014 07:01:50 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.42.14 with SMTP id b14ls1395699qga.47.gmail; Tue, 18 Feb 2014 07:01:50 -0800 (PST) X-Received: by 10.52.159.197 with SMTP id xe5mr129879vdb.89.1392735710207; Tue, 18 Feb 2014 07:01:50 -0800 (PST) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id eo4si5566258vdb.43.2014.02.18.07.01.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Feb 2014 07:01:50 -0800 (PST) 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 im17so13068453vcb.19 for ; Tue, 18 Feb 2014 07:01:50 -0800 (PST) X-Received: by 10.220.131.210 with SMTP id y18mr21814241vcs.12.1392735710084; Tue, 18 Feb 2014 07:01:50 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp222913vcz; Tue, 18 Feb 2014 07:01:49 -0800 (PST) X-Received: by 10.66.155.7 with SMTP id vs7mr33475323pab.42.1392735709161; Tue, 18 Feb 2014 07:01:49 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d4si18562660pao.302.2014.02.18.07.01.48; Tue, 18 Feb 2014 07:01:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932198AbaBRPBk (ORCPT + 27 others); Tue, 18 Feb 2014 10:01:40 -0500 Received: from mail-wg0-f53.google.com ([74.125.82.53]:54981 "EHLO mail-wg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932308AbaBRO5b (ORCPT ); Tue, 18 Feb 2014 09:57:31 -0500 Received: by mail-wg0-f53.google.com with SMTP id x12so3320771wgg.8 for ; Tue, 18 Feb 2014 06:57:30 -0800 (PST) X-Received: by 10.194.82.69 with SMTP id g5mr2234835wjy.85.1392735449950; Tue, 18 Feb 2014 06:57:29 -0800 (PST) Received: from localhost.localdomain ([80.76.198.141]) by mx.google.com with ESMTPSA id h13sm46039687wjr.22.2014.02.18.06.57.27 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Feb 2014 06:57:29 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: lee.jones@linaro.org, DCG_UPD_stlinux_kernel@list.st.com, dwmw2@infradead.org, linux-mtd@lists.infradead.org, computersforpeace@gmail.com, Angus.Clark@st.com Subject: [PATCH 24/35] mtd: st_spi_fsm: Prepare default sequences for read/write/erase Date: Tue, 18 Feb 2014 14:55:51 +0000 Message-Id: <1392735362-1245-25-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1392735362-1245-1-git-send-email-lee.jones@linaro.org> References: <1392735362-1245-1-git-send-email-lee.jones@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org 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. Acked-by Angus Clark 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 b8570e8..fe538bb 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -845,6 +845,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; @@ -1150,6 +1182,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);