From patchwork Sun Sep 4 08:01:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9312423 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5669D600CA for ; Sun, 4 Sep 2016 08:07:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 47EC6287DA for ; Sun, 4 Sep 2016 08:07:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3CE9728925; Sun, 4 Sep 2016 08:07:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.4 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0895287DA for ; Sun, 4 Sep 2016 08:07:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752569AbcIDIHr (ORCPT ); Sun, 4 Sep 2016 04:07:47 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:36511 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752259AbcIDIHj (ORCPT ); Sun, 4 Sep 2016 04:07:39 -0400 Received: by mail-wm0-f65.google.com with SMTP id l65so895815wmf.3 for ; Sun, 04 Sep 2016 01:07:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:subject:to:references:cc:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=m6aWCzyRYdYPItqNK0KdKp6BkzB1nBydObmfPqAvw50=; b=lybYWGspJ2IAsXSVaCkgUvigtYaGiMBu7FgU6UoSQ1j1zvwfg5jSvcAVVvdk3ktBNY /xXue6W2fVD1sHtWzEw6M3ddoeK55kTpP5KNHDYno6Nv1x+AZ87xn4uVVfaEUsF9MEdS a8XsLErzTRL4KGcKTZ7j3NTtq/+F/wQI8RvMVC/ofLoDTl4L8Ye7o17+wvfXP+3jmGHA mFLGLT9lNTHmzDpv/c4uikAIBxHFCTi3n8vE8wPEG1P6pkH+0UpmQiNvH3UZrFU5nkrf G9rYPx8jXK/G718OVsW6buwXFYYVMKYqFnp5aav7ZzJZLUyZJQT9oce5PqRqDzMdR3GB VPog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:subject:to:references:cc:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=m6aWCzyRYdYPItqNK0KdKp6BkzB1nBydObmfPqAvw50=; b=XjktaZyjBork6tIpV0TXA9hPAbKOiYVaYykBF/2uEGu01hFo3rPKKFvnr7zgQMH5sp zQUsHKCv+f2NLg5sVGxPPRl0XuAG/YK0n3j4vBuuv2i3AymJa+sskHxqJEV3QNGmKHgI ZCp4/Pu41EDc1q+AY8mQ1TmCfw/w22M5+nmVOWX5H3UUn3miUcsPEtsTJavbpUz3d53b eyMtIu8x8cRfVQd0Mj1Ua7vI7N5kSKeVt0qK9eCeMRFgWzIN1Po5sKIPBX91/VioBtpM nqcJtfpecn14cnTR8lx2dl4nPVGam7jCjgwjcF75VWcpzDT3t6gByviPlC5pAfZBSUWN l7ug== X-Gm-Message-State: AE9vXwO+PxzzARNz6MECvDq8QWlnKQy+LGONa1LrqaLWYbocdWprcD0GWKARpUy98L0wpQ== X-Received: by 10.28.54.5 with SMTP id d5mr6390625wma.91.1472976457686; Sun, 04 Sep 2016 01:07:37 -0700 (PDT) Received: from ?IPv6:2003:62:5f43:9500:c1f5:c528:a3d:f8c4? (p200300625F439500C1F5C5280A3DF8C4.dip0.t-ipconnect.de. [2003:62:5f43:9500:c1f5:c528:a3d:f8c4]) by smtp.googlemail.com with ESMTPSA id d8sm13033181wmi.0.2016.09.04.01.07.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Sep 2016 01:07:37 -0700 (PDT) From: Heiner Kallweit Subject: [PATCH v2 12/18] spi: fsl-espi: merge fsl_espi_bufs and fsl_espi_cpu_bufs To: Mark Brown References: Cc: "linux-spi@vger.kernel.org" Message-ID: <1d99bc20-4e4b-16d3-0b45-bb2d234c95b5@gmail.com> Date: Sun, 4 Sep 2016 10:01:31 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP fsl_espi_bufs and fsl_espi_cpu_bufs are very small that we can merge them. Signed-off-by: Heiner Kallweit --- v2: - rebased --- drivers/spi/spi-fsl-espi.c | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c index 8d6a570..190ca5c 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c @@ -206,31 +206,15 @@ static void fsl_espi_setup_transfer(struct spi_device *spi, fsl_espi_change_mode(spi); } -static void fsl_espi_cpu_bufs(struct mpc8xxx_spi *mspi, struct spi_transfer *t, - unsigned int len) -{ - u32 word; - struct fsl_espi_reg *reg_base = mspi->reg_base; - - mspi->count = len; - - /* enable rx ints */ - mpc8xxx_spi_write_reg(®_base->mask, SPIM_NE); - - /* transmit word */ - word = mspi->get_tx(mspi); - mpc8xxx_spi_write_reg(®_base->transmit, word); -} - static int fsl_espi_bufs(struct spi_device *spi, struct spi_transfer *t) { struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); struct fsl_espi_reg *reg_base = mpc8xxx_spi->reg_base; - unsigned int len = t->len; + u32 word; int ret; mpc8xxx_spi->len = t->len; - len = roundup(len, 4) / 4; + mpc8xxx_spi->count = roundup(t->len, 4) / 4; mpc8xxx_spi->tx = t->tx_buf; mpc8xxx_spi->rx = t->rx_buf; @@ -246,7 +230,12 @@ static int fsl_espi_bufs(struct spi_device *spi, struct spi_transfer *t) mpc8xxx_spi_write_reg(®_base->command, (SPCOM_CS(spi->chip_select) | SPCOM_TRANLEN(t->len - 1))); - fsl_espi_cpu_bufs(mpc8xxx_spi, t, len); + /* enable rx ints */ + mpc8xxx_spi_write_reg(®_base->mask, SPIM_NE); + + /* transmit word */ + word = mpc8xxx_spi->get_tx(mpc8xxx_spi); + mpc8xxx_spi_write_reg(®_base->transmit, word); /* Won't hang up forever, SPI bus sometimes got lost interrupts... */ ret = wait_for_completion_timeout(&mpc8xxx_spi->done, 2 * HZ);