From patchwork Thu Sep 18 17:08:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 4932921 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 731349F32F for ; Thu, 18 Sep 2014 17:09:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 56C80200DC for ; Thu, 18 Sep 2014 17:10:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 92EB7201EC for ; Thu, 18 Sep 2014 17:10:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932117AbaIRRKI (ORCPT ); Thu, 18 Sep 2014 13:10:08 -0400 Received: from mga02.intel.com ([134.134.136.20]:17947 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932273AbaIRRKG (ORCPT ); Thu, 18 Sep 2014 13:10:06 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 18 Sep 2014 10:09:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,548,1406617200"; d="scan'208";a="604930551" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.168]) by orsmga002.jf.intel.com with ESMTP; 18 Sep 2014 10:09:03 -0700 Received: from andy by smile with local (Exim 4.84) (envelope-from ) id 1XUfCY-0000lO-DZ; Thu, 18 Sep 2014 20:09:02 +0300 From: Andy Shevchenko To: Vinod Koul , Mark Brown , dmaengine@vger.kernel.org, linux-spi@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH 05/10] spi: dw: disable all interrupts first when pump message Date: Thu, 18 Sep 2014 20:08:55 +0300 Message-Id: <1411060140-2801-6-git-send-email-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1411060140-2801-1-git-send-email-andriy.shevchenko@linux.intel.com> References: <1411060140-2801-1-git-send-email-andriy.shevchenko@linux.intel.com> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Always disable all interrupts before pump message. Enable them only for PIO mode. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-dw.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index 0960cc7..d58edfe 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c @@ -342,6 +342,13 @@ static irqreturn_t dw_spi_irq(int irq, void *dev_id) return dws->transfer_handler(dws); } +static void dw_spi_disable_intr(struct dw_spi *dws) +{ + spi_enable_chip(dws, 0); + spi_mask_intr(dws, 0xff); + spi_enable_chip(dws, 1); +} + /* Must be called inside pump_transfers() */ static void poll_transfer(struct dw_spi *dws) { @@ -474,6 +481,9 @@ static void pump_transfers(unsigned long data) dws->transfer_handler = interrupt_transfer; } + /* Disable all interrupts first */ + dw_spi_disable_intr(dws); + /* * Reprogram registers only if * 1. chip select changes @@ -490,7 +500,6 @@ static void pump_transfers(unsigned long data) spi_chip_sel(dws, spi, 1); /* Set the interrupt mask, for poll mode just disable all int */ - spi_mask_intr(dws, 0xff); if (imask) spi_umask_intr(dws, imask); if (txint_level) @@ -611,9 +620,7 @@ static void dw_spi_cleanup(struct spi_device *spi) /* Restart the controller, disable all interrupts, clean rx fifo */ static void spi_hw_init(struct dw_spi *dws) { - spi_enable_chip(dws, 0); - spi_mask_intr(dws, 0xff); - spi_enable_chip(dws, 1); + dw_spi_disable_intr(dws); /* * Try to detect the FIFO depth if not set by interface driver,