From patchwork Thu Oct 27 19:26:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9400263 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 CEA9F60588 for ; Thu, 27 Oct 2016 19:29:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD2722A396 for ; Thu, 27 Oct 2016 19:29:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A21242A398; Thu, 27 Oct 2016 19:29:48 +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.3 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 3FD5C2A396 for ; Thu, 27 Oct 2016 19:29:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753146AbcJ0T3s (ORCPT ); Thu, 27 Oct 2016 15:29:48 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:34314 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754000AbcJ0T3r (ORCPT ); Thu, 27 Oct 2016 15:29:47 -0400 Received: by mail-wm0-f67.google.com with SMTP id y138so4185806wme.1 for ; Thu, 27 Oct 2016 12:29:46 -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=Gzj0wixh2tyBCxXH5d1RENiBIjhxQX+9Sk2+3wfDqj4=; b=KfbSWL87AePL+u2WyOynHTeQCwdu3HnbSng+StSfxHFf111uuXGNJPPu87dnTgnCrD XkrA3cGhrn5VDRW8c3l5us6o35kmxopueVOJg7R/SzH6V/xpf9vZBJ7tPkNOINYIzTGX VmfUcwqBlBFh7ugbRlr+Ye2izQBKh9n+65u0kPi+Y5cnu/rce5qqhIfoIRNwhQitAvhp pUjgr+wXthFWsAZm318gB7ccAhlIaT98W8XWPAJLkYjLBMa3WFnO7kefAU/lz6G175WM K6bQpmPzQ3/JEGE6hmFuU0qIeQoQmxw2mQyOO0dtfnhFj/8t/mOaPrBdpH5mvd8rD3zn AX9g== 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=Gzj0wixh2tyBCxXH5d1RENiBIjhxQX+9Sk2+3wfDqj4=; b=NlMrNiEDTd2RKg/Msw10EJaTiB38F40Mvcf0b+nGvxdpbGoEa5qEDiG6x5Wlb27AYR RrSvHHVkrhW+A/Sdnw8IZe/dVk3TGDyYUnKhleKtLMhg/xeFWCJ5gFWdMjsOGGpuHky9 3n99AhHoF47bOAR+mFWTSrPrYCNZR7zdyviOLcOUrcvnoOxizOTGOpiqQmI0O0eW3Q1U n85B+hqixsLvlsTdvmIikxAdsZzByT49gYg18xUOO2iNt7fXi/Mw4E8kp0oVDBoBPWt6 iFTjPQUzFqDV14rq+r/akbgNEEHAc+cgUEZjzgydhml4k9IwuE1ONCGa0HMRY1ZFQrBv njYQ== X-Gm-Message-State: ABUngvfgsjqAasbCSBg8yjGObfRa4emKY6THI5VZjw3uLP6t7c3wU163tUjcYf7D1zmSxA== X-Received: by 10.28.45.69 with SMTP id t66mr334811wmt.46.1477596585683; Thu, 27 Oct 2016 12:29:45 -0700 (PDT) Received: from ?IPv6:2003:62:5f6e:ba00:49f8:f47b:2191:41c4? (p200300625F6EBA0049F8F47B219141C4.dip0.t-ipconnect.de. [2003:62:5f6e:ba00:49f8:f47b:2191:41c4]) by smtp.googlemail.com with ESMTPSA id b184sm4952688wma.0.2016.10.27.12.29.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Oct 2016 12:29:45 -0700 (PDT) From: Heiner Kallweit Subject: [PATCH v2 04/09] spi: fsl-espi: simplify and inline function fsl_espi_change_mode To: Mark Brown References: <5b98be38-17a2-79a2-14da-fb2bb6f8820f@gmail.com> Cc: "linux-spi@vger.kernel.org" Message-ID: Date: Thu, 27 Oct 2016 21:26:46 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <5b98be38-17a2-79a2-14da-fb2bb6f8820f@gmail.com> 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 The ESPI spec mentions no requirement to turn off the ESPI unit prior to changing the mode. Most likely the ESPI unit is only turned off to clear the FIFO's as before this patch series single bytes could remain in the TX FIFO after transfer end. Therefore remove disabling / re-enabling the ESPI unit. Signed-off-by: Heiner Kallweit --- v2: - rebased --- drivers/spi/spi-fsl-espi.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c index 5a7449f..d550685 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c @@ -223,26 +223,6 @@ static void fsl_espi_fill_tx_fifo(struct mpc8xxx_spi *mspi, u32 events) } } -static void fsl_espi_change_mode(struct spi_device *spi) -{ - struct mpc8xxx_spi *mspi = spi_master_get_devdata(spi->master); - struct spi_mpc8xxx_cs *cs = spi->controller_state; - u32 tmp; - unsigned long flags; - - /* Turn off IRQs locally to minimize time that SPI is disabled. */ - local_irq_save(flags); - - /* Turn off SPI unit prior changing mode */ - tmp = fsl_espi_read_reg(mspi, ESPI_SPMODE); - fsl_espi_write_reg(mspi, ESPI_SPMODE, tmp & ~SPMODE_ENABLE); - fsl_espi_write_reg(mspi, ESPI_SPMODEx(spi->chip_select), - cs->hw_mode); - fsl_espi_write_reg(mspi, ESPI_SPMODE, tmp); - - local_irq_restore(flags); -} - static void fsl_espi_setup_transfer(struct spi_device *spi, struct spi_transfer *t) { @@ -276,7 +256,8 @@ static void fsl_espi_setup_transfer(struct spi_device *spi, cs->hw_mode |= CSMODE_PM(pm); - fsl_espi_change_mode(spi); + fsl_espi_write_reg(mpc8xxx_spi, ESPI_SPMODEx(spi->chip_select), + cs->hw_mode); } static int fsl_espi_bufs(struct spi_device *spi, struct spi_transfer *t)