From patchwork Wed May 6 15:30:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11531445 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8384B17EF for ; Wed, 6 May 2020 15:30:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6A376215A4 for ; Wed, 6 May 2020 15:30:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729745AbgEFPab (ORCPT ); Wed, 6 May 2020 11:30:31 -0400 Received: from mga02.intel.com ([134.134.136.20]:43731 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729607AbgEFPaa (ORCPT ); Wed, 6 May 2020 11:30:30 -0400 IronPort-SDR: FyAMA9k9B9BtP1yJMi9XD4fI0QNGX+wwH7qGQjl0QG+3R8Z1eF1JI8lnFb8yrVaxOHustSH8k+ RPCjg48bFmlg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2020 08:30:30 -0700 IronPort-SDR: MhRQcrB/wzouOi7hCSPaCDqGUWulNx1bZ3lE6SAsaEkgYDtujYchZPwa7W/xzMwP3y943erx57 Z/eULiswFBBw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,359,1583222400"; d="scan'208";a="296217413" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 06 May 2020 08:30:27 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 425C5E1; Wed, 6 May 2020 18:30:25 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , linux-spi@vger.kernel.org Cc: Andy Shevchenko , Feng Tang Subject: [PATCH v1 1/8] spi: dw: Zero DMA Tx and Rx configurations on stack Date: Wed, 6 May 2020 18:30:18 +0300 Message-Id: <20200506153025.21441-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Some DMA controller drivers do not tolerate non-zero values in the DMA configuration structures. Zero them to avoid issues with such DMA controller drivers. Even despite above this is a good practice per se. Fixes: 7063c0d942a1 ("spi/dw_spi: add DMA support") Cc: Feng Tang Signed-off-by: Andy Shevchenko Acked-by: Feng Tang --- drivers/spi/spi-dw-mid.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/spi/spi-dw-mid.c b/drivers/spi/spi-dw-mid.c index 9cc010e9737e8..86d9f79267f05 100644 --- a/drivers/spi/spi-dw-mid.c +++ b/drivers/spi/spi-dw-mid.c @@ -147,6 +147,7 @@ static struct dma_async_tx_descriptor *dw_spi_dma_prepare_tx(struct dw_spi *dws, if (!xfer->tx_buf) return NULL; + memset(&txconf, 0, sizeof(txconf)); txconf.direction = DMA_MEM_TO_DEV; txconf.dst_addr = dws->dma_addr; txconf.dst_maxburst = 16; @@ -193,6 +194,7 @@ static struct dma_async_tx_descriptor *dw_spi_dma_prepare_rx(struct dw_spi *dws, if (!xfer->rx_buf) return NULL; + memset(&rxconf, 0, sizeof(rxconf)); rxconf.direction = DMA_DEV_TO_MEM; rxconf.src_addr = dws->dma_addr; rxconf.src_maxburst = 16; From patchwork Wed May 6 15:30:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11531443 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2FBD8913 for ; Wed, 6 May 2020 15:30:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 16F0E20575 for ; Wed, 6 May 2020 15:30:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729321AbgEFPa3 (ORCPT ); Wed, 6 May 2020 11:30:29 -0400 Received: from mga07.intel.com ([134.134.136.100]:14457 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729688AbgEFPa3 (ORCPT ); Wed, 6 May 2020 11:30:29 -0400 IronPort-SDR: 75KZZq6Dg/+KjhqBXPXz4B18k7GN/XuRNX0DuOeCxraw6jL0DfkHTtknndWM7GJA52kzwbmxY0 OonE73njfAgQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2020 08:30:28 -0700 IronPort-SDR: fx1A9VyNczBd2EMsxbTH5U7WaRAPtWlFmRidPzSwmC94DS4z4yj2iP8vh+pYcntpbd4NFRarFk 7PTUCWwW+NvQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,359,1583222400"; d="scan'208";a="284658192" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga004.fm.intel.com with ESMTP; 06 May 2020 08:30:27 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 51591D7; Wed, 6 May 2020 18:30:26 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , linux-spi@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v1 2/8] spi: dw: Remove unused variable in CR0 configuring hooks Date: Wed, 6 May 2020 18:30:19 +0300 Message-Id: <20200506153025.21441-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200506153025.21441-1-andriy.shevchenko@linux.intel.com> References: <20200506153025.21441-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org After enabling new IP support in the driver couple of variables were left unused compiler is not happy about: .../spi-dw.c: In function ‘dw_spi_update_cr0’: .../spi-dw.c:264:17: warning: unused variable ‘dws’ [-Wunused-variable] 264 | struct dw_spi *dws = spi_controller_get_devdata(master); | ^~~ .../spi-dw.c: In function ‘dw_spi_update_cr0_v1_01a’: .../spi-dw.c:285:17: warning: unused variable ‘dws’ [-Wunused-variable] 285 | struct dw_spi *dws = spi_controller_get_devdata(master); | ^~~ Drop them for good. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-dw.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index 240a61b66a066..6e56a64ccc557 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c @@ -261,7 +261,6 @@ static irqreturn_t dw_spi_irq(int irq, void *dev_id) u32 dw_spi_update_cr0(struct spi_controller *master, struct spi_device *spi, struct spi_transfer *transfer) { - struct dw_spi *dws = spi_controller_get_devdata(master); struct chip_data *chip = spi_get_ctldata(spi); u32 cr0; @@ -282,7 +281,6 @@ u32 dw_spi_update_cr0_v1_01a(struct spi_controller *master, struct spi_device *spi, struct spi_transfer *transfer) { - struct dw_spi *dws = spi_controller_get_devdata(master); struct chip_data *chip = spi_get_ctldata(spi); u32 cr0; From patchwork Wed May 6 15:30:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11531457 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DAEB01862 for ; Wed, 6 May 2020 15:30:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C469721841 for ; Wed, 6 May 2020 15:30:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729871AbgEFPad (ORCPT ); Wed, 6 May 2020 11:30:33 -0400 Received: from mga06.intel.com ([134.134.136.31]:59816 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729776AbgEFPad (ORCPT ); Wed, 6 May 2020 11:30:33 -0400 IronPort-SDR: stPsDCmSVnyFvaX5IgyZqqUe5hYBlJjKMjbIrBdEfr8HK56k47Blg8j0KXyw9LR1TVoODlKr8B C+5KGerodn6g== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2020 08:30:31 -0700 IronPort-SDR: vv8MJzdTIMzt1vgmKUSEyCXLDWpvQUr++RoJmvAs+IGSPQw7tThZcIDJjyTI3wM1hczKyQg9ug usjpOQonVe6A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,359,1583222400"; d="scan'208";a="434925810" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga005.jf.intel.com with ESMTP; 06 May 2020 08:30:27 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 56609109; Wed, 6 May 2020 18:30:26 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , linux-spi@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v1 3/8] spi: dw: Move interrupt.h to spi-dw.h who is user of it Date: Wed, 6 May 2020 18:30:20 +0300 Message-Id: <20200506153025.21441-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200506153025.21441-1-andriy.shevchenko@linux.intel.com> References: <20200506153025.21441-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org The actual user of interrupt.h is spi-dw.h and not bus drivers. Move header there. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-dw-mmio.c | 1 - drivers/spi/spi-dw-pci.c | 1 - drivers/spi/spi-dw.h | 1 + 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/spi/spi-dw-mmio.c b/drivers/spi/spi-dw-mmio.c index abd3bb5e52dba..fc3577b07a1ee 100644 --- a/drivers/spi/spi-dw-mmio.c +++ b/drivers/spi/spi-dw-mmio.c @@ -7,7 +7,6 @@ #include #include -#include #include #include #include diff --git a/drivers/spi/spi-dw-pci.c b/drivers/spi/spi-dw-pci.c index 12c131b5fb4ec..172a9f2996316 100644 --- a/drivers/spi/spi-dw-pci.c +++ b/drivers/spi/spi-dw-pci.c @@ -5,7 +5,6 @@ * Copyright (c) 2009, 2014 Intel Corporation. */ -#include #include #include #include diff --git a/drivers/spi/spi-dw.h b/drivers/spi/spi-dw.h index 8fe724279d158..aeed49b4a444a 100644 --- a/drivers/spi/spi-dw.h +++ b/drivers/spi/spi-dw.h @@ -2,6 +2,7 @@ #ifndef DW_SPI_HEADER_H #define DW_SPI_HEADER_H +#include #include #include From patchwork Wed May 6 15:30:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11531451 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E83F517EF for ; Wed, 6 May 2020 15:30:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D0E7920B1F for ; Wed, 6 May 2020 15:30:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729786AbgEFPac (ORCPT ); Wed, 6 May 2020 11:30:32 -0400 Received: from mga03.intel.com ([134.134.136.65]:9527 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729754AbgEFPac (ORCPT ); Wed, 6 May 2020 11:30:32 -0400 IronPort-SDR: GKBVvaLaG9/PW/eLubkm8w5BZw1WRYSrH+LTjmLik9LntKjdkbOOEY525D1+h6HqxVBN1cWh4C W053r39wUX6A== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2020 08:30:28 -0700 IronPort-SDR: gzlXxg5oD0UuZEcvZ6xGTwHUuUYtOfG8fWOxZ7KQv/5YwdMF7MHNFVa36uq1pk4gsSt6syCKcJ S5Jm7UBPIwSg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,359,1583222400"; d="scan'208";a="278263113" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 06 May 2020 08:30:27 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 64A4C1FD; Wed, 6 May 2020 18:30:26 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , linux-spi@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v1 4/8] spi: dw: Downgrade interrupt.h to irqreturn.h where appropriate Date: Wed, 6 May 2020 18:30:21 +0300 Message-Id: <20200506153025.21441-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200506153025.21441-1-andriy.shevchenko@linux.intel.com> References: <20200506153025.21441-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org spi-dw-mid.c along with spi-dw.h are direct users of irqreturn.h and nothing else is being used from interrupt.h. So, switch them to use the former instead of latter one. While here, move the header under #ifdef CONFIG_SPI_DW_MID_DMA in spi-dw-mid.c. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-dw-mid.c | 2 +- drivers/spi/spi-dw.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-dw-mid.c b/drivers/spi/spi-dw-mid.c index 86d9f79267f05..02defb68618d9 100644 --- a/drivers/spi/spi-dw-mid.c +++ b/drivers/spi/spi-dw-mid.c @@ -7,7 +7,6 @@ #include #include -#include #include #include #include @@ -15,6 +14,7 @@ #include "spi-dw.h" #ifdef CONFIG_SPI_DW_MID_DMA +#include #include #include diff --git a/drivers/spi/spi-dw.h b/drivers/spi/spi-dw.h index aeed49b4a444a..5e1e78210d8d4 100644 --- a/drivers/spi/spi-dw.h +++ b/drivers/spi/spi-dw.h @@ -2,7 +2,7 @@ #ifndef DW_SPI_HEADER_H #define DW_SPI_HEADER_H -#include +#include #include #include From patchwork Wed May 6 15:30:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11531455 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3AC99913 for ; Wed, 6 May 2020 15:30:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2309120A8B for ; Wed, 6 May 2020 15:30:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729668AbgEFPae (ORCPT ); Wed, 6 May 2020 11:30:34 -0400 Received: from mga06.intel.com ([134.134.136.31]:59816 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729815AbgEFPae (ORCPT ); Wed, 6 May 2020 11:30:34 -0400 IronPort-SDR: V5n5P5dsP7zJyJM6xZMF+IvjnOgOYr0WC+/i6cahikEr8M/OCqQXQMmRnWBE5aA2wmAAnVuSyA ddcqBRkdTDeA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2020 08:30:30 -0700 IronPort-SDR: etQFNgSDv+Cf8eELm2ZaNWKv97FSIBVhFayYdJZMzOhLaaGmsjG0yK8zBCowf9J+4EvLJ/+4aS 4HiBaZezItaw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,359,1583222400"; d="scan'208";a="248950921" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga007.jf.intel.com with ESMTP; 06 May 2020 08:30:27 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 69861167; Wed, 6 May 2020 18:30:26 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , linux-spi@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v1 5/8] spi: dw: Move few headers under #ifdef CONFIG_SPI_DW_MID_DMA Date: Wed, 6 May 2020 18:30:22 +0300 Message-Id: <20200506153025.21441-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200506153025.21441-1-andriy.shevchenko@linux.intel.com> References: <20200506153025.21441-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org There is no user of few headers without CONFIG_SPI_DW_MID_DMA being set. Move them under condition. While at it, remove unused slab.h there. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-dw-mid.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-dw-mid.c b/drivers/spi/spi-dw-mid.c index 02defb68618d9..64523e68490d7 100644 --- a/drivers/spi/spi-dw-mid.c +++ b/drivers/spi/spi-dw-mid.c @@ -5,15 +5,14 @@ * Copyright (c) 2009, 2014 Intel Corporation. */ -#include -#include -#include #include #include #include "spi-dw.h" #ifdef CONFIG_SPI_DW_MID_DMA +#include +#include #include #include #include From patchwork Wed May 6 15:30:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11531449 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 45E8A913 for ; Wed, 6 May 2020 15:30:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3784D215A4 for ; Wed, 6 May 2020 15:30:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729689AbgEFPac (ORCPT ); Wed, 6 May 2020 11:30:32 -0400 Received: from mga03.intel.com ([134.134.136.65]:9527 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729668AbgEFPab (ORCPT ); Wed, 6 May 2020 11:30:31 -0400 IronPort-SDR: 1oDv/lzNBdqCrzKhbppXbO34hYdPupXvKGR8O7uiQ8Ua249V80YDb1tOq/cBuALuLwj8n6GBd0 CdtiMWuJ9rOA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2020 08:30:30 -0700 IronPort-SDR: rnJA6flkWUD0UeEYr/RyFqWF3hkjWGMkBLwXQYF1DC6JsP/dRwuxxKbxj0FhTRj1HZowjg5d8+ fhqUshUEvK/g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,359,1583222400"; d="scan'208";a="278263127" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 06 May 2020 08:30:29 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 77A833BA; Wed, 6 May 2020 18:30:26 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , linux-spi@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v1 6/8] spi: dw: Add 'mfld' suffix to Intel Medfield related routines Date: Wed, 6 May 2020 18:30:23 +0300 Message-Id: <20200506153025.21441-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200506153025.21441-1-andriy.shevchenko@linux.intel.com> References: <20200506153025.21441-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org In order to prepare driver for the extension to support newer hardware, add 'mfld' suffix to some related functions. While here, move DMA parameters assignment under existing #ifdef CONFIG_SPI_DW_MID_DMA. There is no functional change intended. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-dw-mid.c | 24 ++++++++++++++---------- drivers/spi/spi-dw-pci.c | 4 ++-- drivers/spi/spi-dw.h | 3 ++- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/drivers/spi/spi-dw-mid.c b/drivers/spi/spi-dw-mid.c index 64523e68490d7..13b548915c8f0 100644 --- a/drivers/spi/spi-dw-mid.c +++ b/drivers/spi/spi-dw-mid.c @@ -34,7 +34,7 @@ static bool mid_spi_dma_chan_filter(struct dma_chan *chan, void *param) return true; } -static int mid_spi_dma_init(struct dw_spi *dws) +static int mid_spi_dma_init_mfld(struct dw_spi *dws) { struct pci_dev *dma_dev; struct dw_dma_slave *tx = dws->dma_tx; @@ -276,14 +276,23 @@ static void mid_spi_dma_stop(struct dw_spi *dws) } } -static const struct dw_spi_dma_ops mid_dma_ops = { - .dma_init = mid_spi_dma_init, +static const struct dw_spi_dma_ops mfld_dma_ops = { + .dma_init = mid_spi_dma_init_mfld, .dma_exit = mid_spi_dma_exit, .dma_setup = mid_spi_dma_setup, .can_dma = mid_spi_can_dma, .dma_transfer = mid_spi_dma_transfer, .dma_stop = mid_spi_dma_stop, }; + +static void dw_spi_mid_setup_dma_mfld(struct dw_spi *dws) +{ + dws->dma_tx = &mid_dma_tx; + dws->dma_rx = &mid_dma_rx; + dws->dma_ops = &mfld_dma_ops; +} +#else /* CONFIG_SPI_DW_MID_DMA */ +static inline void dw_spi_mid_setup_dma_mfld(struct dw_spi *dws) {} #endif /* Some specific info for SPI0 controller on Intel MID */ @@ -297,7 +306,7 @@ static const struct dw_spi_dma_ops mid_dma_ops = { #define CLK_SPI_CDIV_MASK 0x00000e00 #define CLK_SPI_DISABLE_OFFSET 8 -int dw_spi_mid_init(struct dw_spi *dws) +int dw_spi_mid_init_mfld(struct dw_spi *dws) { void __iomem *clk_reg; u32 clk_cdiv; @@ -314,14 +323,9 @@ int dw_spi_mid_init(struct dw_spi *dws) iounmap(clk_reg); -#ifdef CONFIG_SPI_DW_MID_DMA - dws->dma_tx = &mid_dma_tx; - dws->dma_rx = &mid_dma_rx; - dws->dma_ops = &mid_dma_ops; -#endif - /* Register hook to configure CTRLR0 */ dws->update_cr0 = dw_spi_update_cr0; + dw_spi_mid_setup_dma_mfld(dws); return 0; } diff --git a/drivers/spi/spi-dw-pci.c b/drivers/spi/spi-dw-pci.c index 172a9f2996316..dd59df5122ee7 100644 --- a/drivers/spi/spi-dw-pci.c +++ b/drivers/spi/spi-dw-pci.c @@ -23,13 +23,13 @@ struct spi_pci_desc { }; static struct spi_pci_desc spi_pci_mid_desc_1 = { - .setup = dw_spi_mid_init, + .setup = dw_spi_mid_init_mfld, .num_cs = 5, .bus_num = 0, }; static struct spi_pci_desc spi_pci_mid_desc_2 = { - .setup = dw_spi_mid_init, + .setup = dw_spi_mid_init_mfld, .num_cs = 2, .bus_num = 1, }; diff --git a/drivers/spi/spi-dw.h b/drivers/spi/spi-dw.h index 5e1e78210d8d4..b7e3f0ebba44f 100644 --- a/drivers/spi/spi-dw.h +++ b/drivers/spi/spi-dw.h @@ -260,5 +260,6 @@ extern u32 dw_spi_update_cr0_v1_01a(struct spi_controller *master, struct spi_transfer *transfer); /* platform related setup */ -extern int dw_spi_mid_init(struct dw_spi *dws); /* Intel MID platforms */ +extern int dw_spi_mid_init_mfld(struct dw_spi *dws); + #endif /* DW_SPI_HEADER_H */ From patchwork Wed May 6 15:30:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11531453 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 509441862 for ; Wed, 6 May 2020 15:30:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 38D0121841 for ; Wed, 6 May 2020 15:30:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729754AbgEFPad (ORCPT ); Wed, 6 May 2020 11:30:33 -0400 Received: from mga18.intel.com ([134.134.136.126]:57483 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729607AbgEFPac (ORCPT ); Wed, 6 May 2020 11:30:32 -0400 IronPort-SDR: /4/xD4HZXS98WW8yixebGw4ek0q7CQzhfDfJkGGpRZUknMIXtliUCpffZUPcXA+tO27A/27vl0 2r8O1nYuSkUQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2020 08:30:30 -0700 IronPort-SDR: MD93rtE4rKmLv72QZ+MGBkY7e0jrccyIio4PCQ1MTRFy3ELv/a+4fdEqJettdbINuIyzjm9Scz fCLInfNP1CfA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,359,1583222400"; d="scan'208";a="339041776" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga001.jf.intel.com with ESMTP; 06 May 2020 08:30:29 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 7CDEB348; Wed, 6 May 2020 18:30:26 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , linux-spi@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v1 7/8] spi: dw: Propagate struct device pointer to ->dma_init() callback Date: Wed, 6 May 2020 18:30:24 +0300 Message-Id: <20200506153025.21441-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200506153025.21441-1-andriy.shevchenko@linux.intel.com> References: <20200506153025.21441-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org In some cases, one of which is coming soon, we would like to have a struct device pointer to request DMA channel. For this purpose propagate it to ->dma_init() callback in DMA ops. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-dw-mid.c | 2 +- drivers/spi/spi-dw.c | 2 +- drivers/spi/spi-dw.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-dw-mid.c b/drivers/spi/spi-dw-mid.c index 13b548915c8f0..d73aa4ae644d5 100644 --- a/drivers/spi/spi-dw-mid.c +++ b/drivers/spi/spi-dw-mid.c @@ -34,7 +34,7 @@ static bool mid_spi_dma_chan_filter(struct dma_chan *chan, void *param) return true; } -static int mid_spi_dma_init_mfld(struct dw_spi *dws) +static int mid_spi_dma_init_mfld(struct device *dev, struct dw_spi *dws) { struct pci_dev *dma_dev; struct dw_dma_slave *tx = dws->dma_tx; diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index 6e56a64ccc557..b9f651e9ca028 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c @@ -506,7 +506,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) spi_hw_init(dev, dws); if (dws->dma_ops && dws->dma_ops->dma_init) { - ret = dws->dma_ops->dma_init(dws); + ret = dws->dma_ops->dma_init(dev, dws); if (ret) { dev_warn(dev, "DMA init failed\n"); dws->dma_inited = 0; diff --git a/drivers/spi/spi-dw.h b/drivers/spi/spi-dw.h index b7e3f0ebba44f..642f0be642e56 100644 --- a/drivers/spi/spi-dw.h +++ b/drivers/spi/spi-dw.h @@ -100,7 +100,7 @@ enum dw_ssi_type { struct dw_spi; struct dw_spi_dma_ops { - int (*dma_init)(struct dw_spi *dws); + int (*dma_init)(struct device *dev, struct dw_spi *dws); void (*dma_exit)(struct dw_spi *dws); int (*dma_setup)(struct dw_spi *dws, struct spi_transfer *xfer); bool (*can_dma)(struct spi_controller *master, struct spi_device *spi, From patchwork Wed May 6 15:30:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11531447 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1E03F1862 for ; Wed, 6 May 2020 15:30:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 10688215A4 for ; Wed, 6 May 2020 15:30:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729774AbgEFPab (ORCPT ); Wed, 6 May 2020 11:30:31 -0400 Received: from mga02.intel.com ([134.134.136.20]:43731 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729689AbgEFPab (ORCPT ); Wed, 6 May 2020 11:30:31 -0400 IronPort-SDR: Z12sUx3Ub3QGM285ugPJw3AvTvRxPT5C/ERQd2y5YIHZgT64/KyjyIOYMGjFh2Jy89+6TGX90A 7Gpt/tV/OA3A== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2020 08:30:30 -0700 IronPort-SDR: dbDjZ5tdBvMH84rh2DcT7ue04oB2zKwuBv75B40t0VNq/KS+Jw2F+ueUGn/RuMawiXvRS5DBJy ym+0vs0K73qQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,359,1583222400"; d="scan'208";a="296217417" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 06 May 2020 08:30:29 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 8CC67869; Wed, 6 May 2020 18:30:26 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , linux-spi@vger.kernel.org Cc: Jarkko Nikula , Andy Shevchenko Subject: [PATCH v1 8/8] spi: dw: Add Elkhart Lake PSE DMA support Date: Wed, 6 May 2020 18:30:25 +0300 Message-Id: <20200506153025.21441-8-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200506153025.21441-1-andriy.shevchenko@linux.intel.com> References: <20200506153025.21441-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org From: Jarkko Nikula Elkhart Lake PSE SPI is capable to utilize PSE DMA engine which is described in ACPI. With help of acpi-dma module the support becomes a generic one. Thus, add Elkhart Lake PSE DMA support and generic DMA hooks in SPI DesignWare driver. Signed-off-by: Jarkko Nikula Signed-off-by: Andy Shevchenko --- drivers/spi/spi-dw-mid.c | 44 ++++++++++++++++++++++++++++++++++++++++ drivers/spi/spi-dw-pci.c | 1 + drivers/spi/spi-dw.h | 1 + 3 files changed, 46 insertions(+) diff --git a/drivers/spi/spi-dw-mid.c b/drivers/spi/spi-dw-mid.c index d73aa4ae644d5..f3c85f92ef12c 100644 --- a/drivers/spi/spi-dw-mid.c +++ b/drivers/spi/spi-dw-mid.c @@ -75,6 +75,24 @@ static int mid_spi_dma_init_mfld(struct device *dev, struct dw_spi *dws) return -EBUSY; } +static int mid_spi_dma_init_generic(struct device *dev, struct dw_spi *dws) +{ + dws->rxchan = dma_request_slave_channel(dev, "rx"); + if (!dws->rxchan) + return -ENODEV; + dws->master->dma_rx = dws->rxchan; + + dws->txchan = dma_request_slave_channel(dev, "tx"); + if (!dws->txchan) { + dma_release_channel(dws->rxchan); + return -ENODEV; + } + dws->master->dma_tx = dws->txchan; + + dws->dma_inited = 1; + return 0; +} + static void mid_spi_dma_exit(struct dw_spi *dws) { if (!dws->dma_inited) @@ -291,8 +309,25 @@ static void dw_spi_mid_setup_dma_mfld(struct dw_spi *dws) dws->dma_rx = &mid_dma_rx; dws->dma_ops = &mfld_dma_ops; } + +static const struct dw_spi_dma_ops generic_dma_ops = { + .dma_init = mid_spi_dma_init_generic, + .dma_exit = mid_spi_dma_exit, + .dma_setup = mid_spi_dma_setup, + .can_dma = mid_spi_can_dma, + .dma_transfer = mid_spi_dma_transfer, + .dma_stop = mid_spi_dma_stop, +}; + +static void dw_spi_mid_setup_dma_generic(struct dw_spi *dws) +{ + dws->dma_tx = &mid_dma_tx; + dws->dma_rx = &mid_dma_rx; + dws->dma_ops = &generic_dma_ops; +} #else /* CONFIG_SPI_DW_MID_DMA */ static inline void dw_spi_mid_setup_dma_mfld(struct dw_spi *dws) {} +static inline void dw_spi_mid_setup_dma_generic(struct dw_spi *dws) {} #endif /* Some specific info for SPI0 controller on Intel MID */ @@ -329,3 +364,12 @@ int dw_spi_mid_init_mfld(struct dw_spi *dws) dw_spi_mid_setup_dma_mfld(dws); return 0; } + +int dw_spi_mid_init_generic(struct dw_spi *dws) +{ + /* Register hook to configure CTRLR0 */ + dws->update_cr0 = dw_spi_update_cr0; + + dw_spi_mid_setup_dma_generic(dws); + return 0; +} diff --git a/drivers/spi/spi-dw-pci.c b/drivers/spi/spi-dw-pci.c index dd59df5122ee7..dde54a918b5d2 100644 --- a/drivers/spi/spi-dw-pci.c +++ b/drivers/spi/spi-dw-pci.c @@ -35,6 +35,7 @@ static struct spi_pci_desc spi_pci_mid_desc_2 = { }; static struct spi_pci_desc spi_pci_ehl_desc = { + .setup = dw_spi_mid_init_generic, .num_cs = 2, .bus_num = -1, .max_freq = 100000000, diff --git a/drivers/spi/spi-dw.h b/drivers/spi/spi-dw.h index 642f0be642e56..490cff260a3eb 100644 --- a/drivers/spi/spi-dw.h +++ b/drivers/spi/spi-dw.h @@ -261,5 +261,6 @@ extern u32 dw_spi_update_cr0_v1_01a(struct spi_controller *master, /* platform related setup */ extern int dw_spi_mid_init_mfld(struct dw_spi *dws); +extern int dw_spi_mid_init_generic(struct dw_spi *dws); #endif /* DW_SPI_HEADER_H */