From patchwork Tue Feb 18 14:55:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 24889 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f198.google.com (mail-qc0-f198.google.com [209.85.216.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 78E04202B2 for ; Tue, 18 Feb 2014 15:07:08 +0000 (UTC) Received: by mail-qc0-f198.google.com with SMTP id c9sf32063800qcz.9 for ; Tue, 18 Feb 2014 07:07:08 -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=IW3B0gqS7MWxpNZ99oPOhBHBpD/IMw0jiGMDq9Vfnxo=; b=MGofURiZ0FWftbUmCZ9VL8BC1BbHWq2kUxqPTk119q5h+RLCiRqMF7h/rod4QJPRCS xnOs5Y0zMFSb7kdqgT0gWh9wv3ijYWxLKFPGHIxzcA//vugQN16hmHC+d3VBr4jdiBmY MwMZY3HTyjP6krR3rv86OdLgqgwat2InTmrdWUWLHZBnmjJ4lLyJMUMp5y5e7qMi87Dr BXCDbdjul9JOFDv3QA1zPRcWNyriUy4ekI/r00yQjlX82WUN9wKzoqd2kTRP9ljD/TLI uat1hMUqqJm7CINHGMlTyt6XS64P273IGY3Qp2lTDMK7sS635DSxEE28UqlwAnTYpbNB Nvpg== X-Gm-Message-State: ALoCoQndn4lYE1hFSqVhngCvtu2UGmEC7OQgJJ38wJXCQ6tZTJ+HmMzmJFdCzj/bRT0DmjFTCL2K X-Received: by 10.236.109.97 with SMTP id r61mr11392947yhg.24.1392736028201; Tue, 18 Feb 2014 07:07:08 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.93.199 with SMTP id d65ls1356117qge.12.gmail; Tue, 18 Feb 2014 07:07:08 -0800 (PST) X-Received: by 10.220.95.139 with SMTP id d11mr17311760vcn.21.1392736028122; Tue, 18 Feb 2014 07:07:08 -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 a8si5567778vej.131.2014.02.18.07.07.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Feb 2014 07:07:08 -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 jy13so13430861veb.41 for ; Tue, 18 Feb 2014 07:07:08 -0800 (PST) X-Received: by 10.52.184.161 with SMTP id ev1mr146873vdc.84.1392736028024; Tue, 18 Feb 2014 07:07:08 -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 u4csp223371vcz; Tue, 18 Feb 2014 07:07:07 -0800 (PST) X-Received: by 10.68.92.98 with SMTP id cl2mr33567966pbb.81.1392736026801; Tue, 18 Feb 2014 07:07:06 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pp3si17648711pbb.19.2014.02.18.07.07.05; Tue, 18 Feb 2014 07:07:05 -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 S1756532AbaBRPG4 (ORCPT + 27 others); Tue, 18 Feb 2014 10:06:56 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:52205 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755434AbaBRO4n (ORCPT ); Tue, 18 Feb 2014 09:56:43 -0500 Received: by mail-wi0-f172.google.com with SMTP id e4so3573302wiv.17 for ; Tue, 18 Feb 2014 06:56:41 -0800 (PST) X-Received: by 10.181.13.82 with SMTP id ew18mr18554841wid.22.1392735400897; Tue, 18 Feb 2014 06:56:40 -0800 (PST) Received: from localhost.localdomain ([80.76.198.141]) by mx.google.com with ESMTPSA id h13sm46039687wjr.22.2014.02.18.06.56.38 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Feb 2014 06:56:40 -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 05/35] mtd: st_spi_fsm: Supply a method to read from the FSM's FIFO Date: Tue, 18 Feb 2014 14:55:32 +0000 Message-Id: <1392735362-1245-6-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.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 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: , When invoked the driver will attempt to read any available data from the FSM's data register. Any data collected from this FIFO would have originated from the flash chip. Acked-by Angus Clark Signed-off-by: Lee Jones --- drivers/mtd/devices/st_spi_fsm.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index ac6b782..dba5f10 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -281,6 +281,32 @@ static void stfsm_wait_seq(struct stfsm *fsm) dev_err(fsm->dev, "timeout on sequence completion\n"); } +static void stfsm_read_fifo(struct stfsm *fsm, uint32_t *buf, + const uint32_t size) +{ + uint32_t remaining = size >> 2; + uint32_t avail; + uint32_t words; + + dev_dbg(fsm->dev, "Reading %d bytes from FIFO\n", size); + + BUG_ON((((uint32_t)buf) & 0x3) || (size & 0x3)); + + while (remaining) { + for (;;) { + avail = stfsm_fifo_available(fsm); + if (avail) + break; + udelay(1); + } + words = min(avail, remaining); + remaining -= words; + + readsl(fsm->base + SPI_FAST_SEQ_DATA_REG, buf, words); + buf += words; + } +} + static int stfsm_set_mode(struct stfsm *fsm, uint32_t mode) { int ret, timeout = 10;