From patchwork Thu Aug 25 04:49:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9298639 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 E609060757 for ; Thu, 25 Aug 2016 04:54:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D550A28EC0 for ; Thu, 25 Aug 2016 04:54:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA4EC291C6; Thu, 25 Aug 2016 04:54:47 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 68E3328EC0 for ; Thu, 25 Aug 2016 04:54:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756169AbcHYEyq (ORCPT ); Thu, 25 Aug 2016 00:54:46 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33189 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754559AbcHYEx3 (ORCPT ); Thu, 25 Aug 2016 00:53:29 -0400 Received: by mail-wm0-f66.google.com with SMTP id o80so5646895wme.0 for ; Wed, 24 Aug 2016 21:53:28 -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=4JknCUiDNdUZj/FFxBbh61VX4Wb+a5tYQIsWCRJafiU=; b=hVlC9hPv3w3o40VD79m8EQ5vFBFn0gziqoteOGqLl0UELYpiKwo0AGC3DB9unfmg7P 6B/T+8Jg2aJm2EFVbUztAwAPtWJlGQoKs1+HnDnVNpN4kN9ExZQk2CfCS8qIJrYq3dwz eGg80H7bXyts79jLp6WDTueYeiv+Hx03LcHi39l153dzw17xxXS0PETHa4cJZH5hXjHW 0A7OEGIgygftRNJYdhWDV05h4cdokeMlH9pOwnzNRLn49wVzm8qwUaBZ9k9KfKRWvaFn GBHY/FQLZ+dF/bV4b0C2pl9pr2yg9YxWye7CCfx1Y/hhw/jcXNojq8yCgPF3ntQA+9Om p1tg== 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=4JknCUiDNdUZj/FFxBbh61VX4Wb+a5tYQIsWCRJafiU=; b=d/qvcDDhSVCGgKZJRQ4cKCaPFEFn6rtqBDCEvOnfGWB6Yx/6wDyDP0zAo2aH0fbLes tHZl4jF7iQG8bVEK+d86cPGpD74zIrCEZ5TO6uQKDR8cS2Y+YMmIR8ViJQcnfQJPSSL/ GXGAc/n6VqmTzsFnR2VC9nMo+8HkeOZUuv+bqiEkHCBQSSCcLJRjp2j7ztAAmg0SLWKh aSVCWZAtZLpzzIdeA1rJBJoDq1hFVdWKEmXocccwEN3XVwuBkoSkGhJ6DIezPmG1m4Gf /1lxh/E+qPq0u/lq838dxaTQZOesgUQtiFvjmF2xKYjcWzBcGG0erIbxuN/+sbnVtdp6 kP6A== X-Gm-Message-State: AE9vXwP7xU7vthFVOcTaxOgZHdVFvJyhTuMS3j90uiAQIp1BvAq7hSJwd25RuvtktjyeOw== X-Received: by 10.28.238.88 with SMTP id m85mr5772873wmh.92.1472100808003; Wed, 24 Aug 2016 21:53:28 -0700 (PDT) Received: from ?IPv6:2003:62:5f43:9500:dd82:2805:e44f:720e? (p200300625F439500DD822805E44F720E.dip0.t-ipconnect.de. [2003:62:5f43:9500:dd82:2805:e44f:720e]) by smtp.googlemail.com with ESMTPSA id f10sm13089815wje.14.2016.08.24.21.53.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Aug 2016 21:53:27 -0700 (PDT) From: Heiner Kallweit Subject: [PATCH 16/23] spi: fsl-espi: merge fsl_espi_bufs and fsl_espi_cpu_bufs To: Mark Brown References: Cc: "linux-spi@vger.kernel.org" Message-ID: <178b274d-2785-5f64-0334-40526c13d7f9@gmail.com> Date: Thu, 25 Aug 2016 06:49:54 +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 --- 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 821ec3e..ee4e778 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c @@ -207,31 +207,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; @@ -247,7 +231,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);