From patchwork Fri Nov 29 12:19:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 295285 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from casper.infradead.org (unknown [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0C73B2C00BA for ; Fri, 29 Nov 2013 23:25:28 +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 1VmN8D-00047Q-BY; Fri, 29 Nov 2013 12:25:13 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VmN88-0007QP-MU; Fri, 29 Nov 2013 12:25:08 +0000 Received: from mail-yh0-f44.google.com ([209.85.213.44]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VmN3s-0006rT-Nm for linux-mtd@lists.infradead.org; Fri, 29 Nov 2013 12:20:48 +0000 Received: by mail-yh0-f44.google.com with SMTP id f64so6700985yha.3 for ; Fri, 29 Nov 2013 04:20:27 -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=G0lreMNQxr6kpdPdqgxs0qX93ojK8UF4O2l6L4XS3YY=; b=P1WxTl5V3YrL9Bl3FAAbSSA0URJM5BxPjwmhsAYxkny3L5QujNAEhVNLN5LWfDz0HK akDWeGXgJu6B+Da5Y0qgFLHuRhXUtfNirhdrVrVuX6J8eo0NJO7DFVtsrEkbYLZhHpoo u2rP45wCphqp2zWqigJCNWTe2nNnHm5mOV27Y/nJYttJrrAB2XqVKfyQ3A0kWP1R85Lx h126ioT5dswbO4VAqa4CCRj/YMhaH8MXWIcfBJtv0zs7cCzCsXxe2QCaiPQ5KOYq8cfO IBq2QQgPrF0WOq3HklvHPrKQEVw1RQXi29+jHb1iFozbSx93ZKx+8fwVbcfPh0U4Ky4R q5PQ== X-Gm-Message-State: ALoCoQmAzNAjw3x7hqyXc0WK2Hywc+ZvnTPg94iafGCfykv8hKgJjKAaWozQYWk3soOkwOwmivJa X-Received: by 10.236.199.81 with SMTP id w57mr831704yhn.139.1385727627603; Fri, 29 Nov 2013 04:20:27 -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.25 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Nov 2013 04:20:27 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dwmw2@infradead.org Subject: [PATCH v3 27/36] mtd: st_spi_fsm: Write to Flash via the FSM FIFO Date: Fri, 29 Nov 2013 12:19:16 +0000 Message-Id: <1385727565-25794-28-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131129_072044_888631_3F70F5B2 X-CRM114-Status: GOOD ( 10.44 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.213.44 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: angus.clark@st.com, linus.walleij@linaro.org, Lee Jones , linux-mtd@lists.infradead.org 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 When we write data to the FIFO the FSM Controller subsequently writes that data out to the Serial Flash chip. Signed-off-by: Lee Jones --- drivers/mtd/devices/st_spi_fsm.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index c76510e..c08805f 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -261,6 +261,20 @@ static void stfsm_read_fifo(struct stfsm *fsm, uint32_t *buf, } } +static int stfsm_write_fifo(struct stfsm *fsm, + const uint32_t *buf, const uint32_t size) +{ + uint32_t words = size >> 2; + + dev_dbg(fsm->dev, "writing %d bytes to FIFO\n", size); + + BUG_ON((((uint32_t)buf) & 0x3) || (size & 0x3)); + + writesl(fsm->base + SPI_FAST_SEQ_DATA_REG, buf, words); + + return size; +} + static int stfsm_enter_32bit_addr(struct stfsm *fsm, int enter) { struct stfsm_seq *seq = &stfsm_seq_en_32bit_addr;