From patchwork Fri Feb 25 17:23:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 546148 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AE39C4332F for ; Fri, 25 Feb 2022 17:24:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243642AbiBYRYk (ORCPT ); Fri, 25 Feb 2022 12:24:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242726AbiBYRYj (ORCPT ); Fri, 25 Feb 2022 12:24:39 -0500 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28B1E19E010; Fri, 25 Feb 2022 09:24:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645809847; x=1677345847; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=b4IkmrVZvoee7LpRtKfcAm9A5VhB3z+xAiMSzfCyhgg=; b=BpE/UQSmeqc8IhFJhvyDHDO1hDA6jl+LQCD6aZ4GGWC71kkou+Eqiry9 z6sOxG+HCVWeGQ2e2p6f2NBXA51D5IJBA9VDSwuBM9Bvza4gib+UbjQBZ 4pmddA5dJ4CWB9urT8wyocsqt6XEChsr1uF+gnLJOi/15BvNakrYHQVkW JNU1V17WgPSU6vUaI3u4/uZQ0694Vt2nhwabMTFuEWM8GYkBFUzHshPBW /ARd37un848tXiikUHDYetnoqIqhfWmTPuyBaGMotAOcVaH0pFj/Lu3J+ j5KnCT/T6xTtm/lBmpYihaDjp9JhU7PM2M2c7jmLpjjClpFecwVXUALWo A==; X-IronPort-AV: E=McAfee;i="6200,9189,10268"; a="315755869" X-IronPort-AV: E=Sophos;i="5.90,136,1643702400"; d="scan'208";a="315755869" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Feb 2022 09:24:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,136,1643702400"; d="scan'208";a="506757106" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 25 Feb 2022 09:24:04 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 55B163F9; Fri, 25 Feb 2022 19:24:21 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Mark Brown Subject: [PATCH v1 04/11] spi: pxa2xx-pci: Move port_id assignment to ->setup() Date: Fri, 25 Feb 2022 19:23:43 +0200 Message-Id: <20220225172350.69797-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220225172350.69797-1-andriy.shevchenko@linux.intel.com> References: <20220225172350.69797-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Instead of using conditional, move port_id to the corresponding ->setup() functions. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx-pci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c index 90b95e49a164..87629da3e544 100644 --- a/drivers/spi/spi-pxa2xx-pci.c +++ b/drivers/spi/spi-pxa2xx-pci.c @@ -29,7 +29,7 @@ enum { struct pxa_spi_info { enum pxa_ssp_type type; - int port_id; + unsigned int port_id; unsigned int num_chipselect; unsigned long max_clk_rate; @@ -116,6 +116,7 @@ static int lpss_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c) static int ce4100_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c) { + c->port_id = dev->devfn; c->num_chipselect = dev->devfn; c->max_clk_rate = 3686400; @@ -169,6 +170,7 @@ static int mrfld_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c) static int qrk_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c) { + c->port_id = dev->devfn; c->num_chipselect = 1; c->max_clk_rate = 50000000; @@ -178,7 +180,6 @@ static int qrk_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c) static struct pxa_spi_info spi_info_configs[] = { [PORT_CE4100] = { .type = PXA25x_SSP, - .port_id = -1, .setup = ce4100_spi_setup, }, [PORT_BYT] = { @@ -216,7 +217,6 @@ static struct pxa_spi_info spi_info_configs[] = { }, [PORT_QUARK_X1000] = { .type = QUARK_X1000_SSP, - .port_id = -1, .setup = qrk_spi_setup, }, [PORT_LPT0] = { @@ -271,8 +271,8 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev, ssp->dev = &dev->dev; ssp->phys_base = pci_resource_start(dev, 0); ssp->mmio_base = pcim_iomap_table(dev)[0]; - ssp->port_id = (c->port_id >= 0) ? c->port_id : dev->devfn; ssp->type = c->type; + ssp->port_id = c->port_id; pci_set_master(dev); From patchwork Fri Feb 25 17:23:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 546147 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF3CAC4321E for ; Fri, 25 Feb 2022 17:24:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243643AbiBYRYl (ORCPT ); Fri, 25 Feb 2022 12:24:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243566AbiBYRYj (ORCPT ); Fri, 25 Feb 2022 12:24:39 -0500 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6350C198EFE; Fri, 25 Feb 2022 09:24:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645809847; x=1677345847; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bvuz28srH0KtaXNEuCHq8ysOIlE/l6cGxL8C5KzYJbI=; b=S/70IP0KmiEc5E0UM68fUi+HwYSx6QsD7WCksi5KshrY0QLTj8G//LAH ASTJbGBVppQkxmufmqeOjzun77pjJAhwGxoo7z+EX65GXz7dH/cNLpMEe 6/ZqmlfyArLKDPk54g5uUXp5sSi6INhczZgeOWt4J+xwmk23CbzyPtS5Q L2QgrBbfPGYS748m5YKkUNjKWA7qrHAnS+CwD3rjkWoJArshe5TSGaGQg W0zYW7uUt6CX3nhOM0BYofLhRlB7lSsrdYWpFZ8hSOlnf1xqAyTjVOR2O xdeLFwycd7bJkZfSDHazfoUDfdd8wm/DRaiRXl9HLli4QH6jmyZMGt4p1 w==; X-IronPort-AV: E=McAfee;i="6200,9189,10268"; a="313259064" X-IronPort-AV: E=Sophos;i="5.90,136,1643702400"; d="scan'208";a="313259064" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Feb 2022 09:24:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,136,1643702400"; d="scan'208";a="544119483" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 25 Feb 2022 09:24:04 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 6CE6B50E; Fri, 25 Feb 2022 19:24:21 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Mark Brown Subject: [PATCH v1 06/11] spi: pxa2xx-pci: Move max_clk_rate assignment to ->setup() Date: Fri, 25 Feb 2022 19:23:45 +0200 Message-Id: <20220225172350.69797-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220225172350.69797-1-andriy.shevchenko@linux.intel.com> References: <20220225172350.69797-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Move max_clk_rate to the corresponding ->setup() function to unify with the rest. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx-pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c index c2cbb002784a..5ac1487c9b3f 100644 --- a/drivers/spi/spi-pxa2xx-pci.c +++ b/drivers/spi/spi-pxa2xx-pci.c @@ -153,6 +153,8 @@ static int mrfld_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c) return -ENODEV; } + c->max_clk_rate = 25000000; + dma_dev = pci_get_slot(dev->bus, PCI_DEVFN(21, 0)); ret = devm_add_action_or_reset(&dev->dev, lpss_dma_put_device, dma_dev); if (ret) @@ -213,7 +215,6 @@ static struct pxa_spi_info spi_info_configs[] = { }, [PORT_MRFLD] = { .type = MRFLD_SSP, - .max_clk_rate = 25000000, .setup = mrfld_spi_setup, }, [PORT_QUARK_X1000] = { From patchwork Fri Feb 25 17:23:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 546144 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3AD3C433EF for ; Fri, 25 Feb 2022 17:24:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237490AbiBYRYq (ORCPT ); Fri, 25 Feb 2022 12:24:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243654AbiBYRYn (ORCPT ); Fri, 25 Feb 2022 12:24:43 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24E361A9073; Fri, 25 Feb 2022 09:24:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645809851; x=1677345851; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BcahKzSV5jhjPPlKjgCu8591W/v1IEiY2tKgzmL6dpk=; b=Rp/Ds8oc3dPWYMhtKBqPMpDKmfq8rMtRjekoZyEOX5Og8pY9v1xrTrqj i98LUKQr2LA9qVkjqTOwkl4pQHJnfdj2o7Lkmw8KlcgqZCyoLtE/G/QBA yHL80hjZaB7WEQ0SVTNIhxsRBFKISGFibVv+51JU8QhB3VLE9Q78cR0UB xHQiFiZyprdtu3EmcOP1B4mGQx3QFQ/zacPHYKVvCY6528/f7lECb4j2P FM3Lgd6jYZC/88ZQ3gyS7EsZ4cbkfVtev2hAyN8/agzX83d3z90s09x+U HZh1fKEYwoDGbCmyuhRM/X63ktVbTMoVwCBgrUij74dkN7864JBJBvmmd Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10268"; a="252271014" X-IronPort-AV: E=Sophos;i="5.90,136,1643702400"; d="scan'208";a="252271014" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Feb 2022 09:24:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,136,1643702400"; d="scan'208";a="628910897" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 25 Feb 2022 09:24:07 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 780C264B; Fri, 25 Feb 2022 19:24:21 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Mark Brown Subject: [PATCH v1 07/11] spi: pxa2xx-pci: Replace enum with direct use of PCI IDs Date: Fri, 25 Feb 2022 19:23:46 +0200 Message-Id: <20220225172350.69797-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220225172350.69797-1-andriy.shevchenko@linux.intel.com> References: <20220225172350.69797-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Instead of creating an abstraction on top of PCI IDs, just use them directly. The corresponding enum can be dropped. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx-pci.c | 161 ++++++++++++++++++----------------- 1 file changed, 83 insertions(+), 78 deletions(-) diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c index 5ac1487c9b3f..a0f24e811e9f 100644 --- a/drivers/spi/spi-pxa2xx-pci.c +++ b/drivers/spi/spi-pxa2xx-pci.c @@ -15,17 +15,17 @@ #include #include -enum { - PORT_QUARK_X1000, - PORT_BYT, - PORT_MRFLD, - PORT_BSW0, - PORT_BSW1, - PORT_BSW2, - PORT_CE4100, - PORT_LPT0, - PORT_LPT1, -}; +#define PCI_DEVICE_ID_INTEL_QUARK_X1000 0x0935 +#define PCI_DEVICE_ID_INTEL_BYT 0x0f0e +#define PCI_DEVICE_ID_INTEL_MRFLD 0x1194 +#define PCI_DEVICE_ID_INTEL_BSW0 0x228e +#define PCI_DEVICE_ID_INTEL_BSW1 0x2290 +#define PCI_DEVICE_ID_INTEL_BSW2 0x22ac +#define PCI_DEVICE_ID_INTEL_CE4100 0x2e6a +#define PCI_DEVICE_ID_INTEL_LPT0_0 0x9c65 +#define PCI_DEVICE_ID_INTEL_LPT0_1 0x9c66 +#define PCI_DEVICE_ID_INTEL_LPT1_0 0x9ce5 +#define PCI_DEVICE_ID_INTEL_LPT1_1 0x9ce6 struct pxa_spi_info { enum pxa_ssp_type type; @@ -86,6 +86,49 @@ static int lpss_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c) struct pci_dev *dma_dev; int ret; + switch (dev->device) { + case PCI_DEVICE_ID_INTEL_BYT: + c->type = LPSS_BYT_SSP; + c->port_id = 0; + c->tx_param = &byt_tx_param; + c->rx_param = &byt_rx_param; + break; + case PCI_DEVICE_ID_INTEL_BSW0: + c->type = LPSS_BSW_SSP; + c->port_id = 0; + c->tx_param = &bsw0_tx_param; + c->rx_param = &bsw0_rx_param; + break; + case PCI_DEVICE_ID_INTEL_BSW1: + c->type = LPSS_BSW_SSP; + c->port_id = 1; + c->tx_param = &bsw1_tx_param; + c->rx_param = &bsw1_rx_param; + break; + case PCI_DEVICE_ID_INTEL_BSW2: + c->type = LPSS_BSW_SSP; + c->port_id = 2; + c->tx_param = &bsw2_tx_param; + c->rx_param = &bsw2_rx_param; + break; + case PCI_DEVICE_ID_INTEL_LPT0_0: + case PCI_DEVICE_ID_INTEL_LPT1_0: + c->type = LPSS_LPT_SSP; + c->port_id = 0; + c->tx_param = &lpt0_tx_param; + c->rx_param = &lpt0_rx_param; + break; + case PCI_DEVICE_ID_INTEL_LPT0_1: + case PCI_DEVICE_ID_INTEL_LPT1_1: + c->type = LPSS_LPT_SSP; + c->port_id = 1; + c->tx_param = &lpt1_tx_param; + c->rx_param = &lpt1_rx_param; + break; + default: + return -ENODEV; + } + c->num_chipselect = 1; c->max_clk_rate = 50000000; @@ -115,8 +158,13 @@ static int lpss_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c) return 0; } +static struct pxa_spi_info lpss_info_config = { + .setup = lpss_spi_setup, +}; + static int ce4100_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c) { + c->type = PXA25x_SSP; c->port_id = dev->devfn; c->num_chipselect = dev->devfn; c->max_clk_rate = 3686400; @@ -124,6 +172,10 @@ static int ce4100_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c) return 0; } +static struct pxa_spi_info ce4100_info_config = { + .setup = ce4100_spi_setup, +}; + static int mrfld_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c) { struct dw_dma_slave *tx, *rx; @@ -153,6 +205,7 @@ static int mrfld_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c) return -ENODEV; } + c->type = MRFLD_SSP; c->max_clk_rate = 25000000; dma_dev = pci_get_slot(dev->bus, PCI_DEVFN(21, 0)); @@ -171,8 +224,13 @@ static int mrfld_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c) return 0; } +static struct pxa_spi_info mrfld_info_config = { + .setup = mrfld_spi_setup, +}; + static int qrk_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c) { + c->type = QUARK_X1000_SSP; c->port_id = dev->devfn; c->num_chipselect = 1; c->max_clk_rate = 50000000; @@ -180,61 +238,8 @@ static int qrk_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c) return 0; } -static struct pxa_spi_info spi_info_configs[] = { - [PORT_CE4100] = { - .type = PXA25x_SSP, - .setup = ce4100_spi_setup, - }, - [PORT_BYT] = { - .type = LPSS_BYT_SSP, - .port_id = 0, - .setup = lpss_spi_setup, - .tx_param = &byt_tx_param, - .rx_param = &byt_rx_param, - }, - [PORT_BSW0] = { - .type = LPSS_BSW_SSP, - .port_id = 0, - .setup = lpss_spi_setup, - .tx_param = &bsw0_tx_param, - .rx_param = &bsw0_rx_param, - }, - [PORT_BSW1] = { - .type = LPSS_BSW_SSP, - .port_id = 1, - .setup = lpss_spi_setup, - .tx_param = &bsw1_tx_param, - .rx_param = &bsw1_rx_param, - }, - [PORT_BSW2] = { - .type = LPSS_BSW_SSP, - .port_id = 2, - .setup = lpss_spi_setup, - .tx_param = &bsw2_tx_param, - .rx_param = &bsw2_rx_param, - }, - [PORT_MRFLD] = { - .type = MRFLD_SSP, - .setup = mrfld_spi_setup, - }, - [PORT_QUARK_X1000] = { - .type = QUARK_X1000_SSP, - .setup = qrk_spi_setup, - }, - [PORT_LPT0] = { - .type = LPSS_LPT_SSP, - .port_id = 0, - .setup = lpss_spi_setup, - .tx_param = &lpt0_tx_param, - .rx_param = &lpt0_rx_param, - }, - [PORT_LPT1] = { - .type = LPSS_LPT_SSP, - .port_id = 1, - .setup = lpss_spi_setup, - .tx_param = &lpt1_tx_param, - .rx_param = &lpt1_rx_param, - }, +static struct pxa_spi_info qrk_info_config = { + .setup = qrk_spi_setup, }; static int pxa2xx_spi_pci_probe(struct pci_dev *dev, @@ -256,7 +261,7 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev, if (ret) return ret; - c = &spi_info_configs[ent->driver_data]; + c = (struct pxa_spi_info *)ent->driver_data; ret = c->setup(dev, c); if (ret) return ret; @@ -320,17 +325,17 @@ static void pxa2xx_spi_pci_remove(struct pci_dev *dev) } static const struct pci_device_id pxa2xx_spi_pci_devices[] = { - { PCI_VDEVICE(INTEL, 0x0935), PORT_QUARK_X1000 }, - { PCI_VDEVICE(INTEL, 0x0f0e), PORT_BYT }, - { PCI_VDEVICE(INTEL, 0x1194), PORT_MRFLD }, - { PCI_VDEVICE(INTEL, 0x228e), PORT_BSW0 }, - { PCI_VDEVICE(INTEL, 0x2290), PORT_BSW1 }, - { PCI_VDEVICE(INTEL, 0x22ac), PORT_BSW2 }, - { PCI_VDEVICE(INTEL, 0x2e6a), PORT_CE4100 }, - { PCI_VDEVICE(INTEL, 0x9c65), PORT_LPT0 }, - { PCI_VDEVICE(INTEL, 0x9c66), PORT_LPT1 }, - { PCI_VDEVICE(INTEL, 0x9ce5), PORT_LPT0 }, - { PCI_VDEVICE(INTEL, 0x9ce6), PORT_LPT1 }, + { PCI_DEVICE_DATA(INTEL, QUARK_X1000, &qrk_info_config) }, + { PCI_DEVICE_DATA(INTEL, BYT, &lpss_info_config) }, + { PCI_DEVICE_DATA(INTEL, MRFLD, &mrfld_info_config) }, + { PCI_DEVICE_DATA(INTEL, BSW0, &lpss_info_config) }, + { PCI_DEVICE_DATA(INTEL, BSW1, &lpss_info_config) }, + { PCI_DEVICE_DATA(INTEL, BSW2, &lpss_info_config) }, + { PCI_DEVICE_DATA(INTEL, CE4100, &ce4100_info_config) }, + { PCI_DEVICE_DATA(INTEL, LPT0_0, &lpss_info_config) }, + { PCI_DEVICE_DATA(INTEL, LPT0_1, &lpss_info_config) }, + { PCI_DEVICE_DATA(INTEL, LPT1_0, &lpss_info_config) }, + { PCI_DEVICE_DATA(INTEL, LPT1_1, &lpss_info_config) }, { } }; MODULE_DEVICE_TABLE(pci, pxa2xx_spi_pci_devices); From patchwork Fri Feb 25 17:23:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 546145 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47460C433FE for ; Fri, 25 Feb 2022 17:24:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243661AbiBYRYp (ORCPT ); Fri, 25 Feb 2022 12:24:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243651AbiBYRYm (ORCPT ); Fri, 25 Feb 2022 12:24:42 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 749C31A9066; Fri, 25 Feb 2022 09:24:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645809850; x=1677345850; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=06HzJRtf8GKOGCOPDdefguWvxa54PWV3K7sE7WnIl0M=; b=O3mglHx0zqTYrQtxDZ/u3+IRGyTn5zUuRxhOUWe6nS9Qyj6RAwSg+ijk 5v2LnNL6M9C9HOxTYqU1CAJykLWNCHDy5qwGvHZRBmOx+BJUnLxRo/dN+ Urjvlsk0JQT6TqdZ+A/Oe5XkMeD/Gx7Xc+pwanHvgHr+QvPdeD16M1Fbt 203u9BkN1blyvrP4bUWo0+fe6yhwFLphG3I9F3Bf5oBK78+8CRanwH9AB dMgbXoVZrMqB/CKKXila69OqT8AK0dHiTpV0LdRp5vQiesO+vMz4Tp09q VdAODG4175YvPQ18bmr2hqyU9eGC8j5HLtJcwrJW5Lfrw1ls2ZevhN43p A==; X-IronPort-AV: E=McAfee;i="6200,9189,10268"; a="252271011" X-IronPort-AV: E=Sophos;i="5.90,136,1643702400"; d="scan'208";a="252271011" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Feb 2022 09:24:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,136,1643702400"; d="scan'208";a="628910898" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 25 Feb 2022 09:24:07 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 83979763; Fri, 25 Feb 2022 19:24:21 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Mark Brown Subject: [PATCH v1 08/11] spi: pxa2xx-pci: Drop unneeded checks in lpss_spi_setup() Date: Fri, 25 Feb 2022 19:23:47 +0200 Message-Id: <20220225172350.69797-8-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220225172350.69797-1-andriy.shevchenko@linux.intel.com> References: <20220225172350.69797-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org All of the LPSS devices are using DMA and set the parameters up, hence no need to test for that. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx-pci.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c index a0f24e811e9f..c041a9288d0c 100644 --- a/drivers/spi/spi-pxa2xx-pci.c +++ b/drivers/spi/spi-pxa2xx-pci.c @@ -83,6 +83,7 @@ static void lpss_dma_put_device(void *dma_dev) static int lpss_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c) { + struct dw_dma_slave *tx, *rx; struct pci_dev *dma_dev; int ret; @@ -137,21 +138,15 @@ static int lpss_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c) if (ret) return ret; - if (c->tx_param) { - struct dw_dma_slave *slave = c->tx_param; - - slave->dma_dev = &dma_dev->dev; - slave->m_master = 0; - slave->p_master = 1; - } - - if (c->rx_param) { - struct dw_dma_slave *slave = c->rx_param; + tx = c->tx_param; + tx->dma_dev = &dma_dev->dev; + tx->m_master = 0; + tx->p_master = 1; - slave->dma_dev = &dma_dev->dev; - slave->m_master = 0; - slave->p_master = 1; - } + rx = c->rx_param; + rx->dma_dev = &dma_dev->dev; + rx->m_master = 0; + rx->p_master = 1; c->dma_filter = lpss_dma_filter; c->dma_burst_size = 1; From patchwork Fri Feb 25 17:23:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 546146 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66DD2C4332F for ; Fri, 25 Feb 2022 17:24:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243655AbiBYRYn (ORCPT ); Fri, 25 Feb 2022 12:24:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243650AbiBYRYm (ORCPT ); Fri, 25 Feb 2022 12:24:42 -0500 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D619F1A8CB9; Fri, 25 Feb 2022 09:24:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645809849; x=1677345849; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HPhdfzrSAl7OfPLUbSJxD2n3AF3pztaWdjWo8tOY16E=; b=RJKp4lWh6x4tweTP6+DxyZOA2Pfhxe1u+gs5NKIdXiOlGtAkRDEufG4s VNQgnaTFVuCjSlX7cxTd2EXXgy2Pba4uwmxiGbX2ingMTr0GE09uLfidF 9nxbrFilvX8y2awiU5hWfUeIAIfVOue1T/0r33KVP3b3E1m3eFvde6lg1 tpMfMRkm/VkxJSCKY2hS4tr2glt09FvfoBJAzowlAvIVOCng0MM9Fxwj1 XGIlB8I1/6DWg5nnsfr/4Ydh7nUTnW3ertthTo33CBESGWq+YQOZ3hxMI KZBpIqplN3qxqVkVZ4HKk+GrBUOizuEgSCyQjGWQ/jHDHAObeK/GY/Ia/ w==; X-IronPort-AV: E=McAfee;i="6200,9189,10268"; a="232513161" X-IronPort-AV: E=Sophos;i="5.90,136,1643702400"; d="scan'208";a="232513161" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Feb 2022 09:24:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,136,1643702400"; d="scan'208";a="549342167" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 25 Feb 2022 09:24:07 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 8F2E1772; Fri, 25 Feb 2022 19:24:21 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Mark Brown Subject: [PATCH v1 09/11] spi: pxa2xx-pci: Extract pxa2xx_spi_pci_clk_register() Date: Fri, 25 Feb 2022 19:23:48 +0200 Message-Id: <20220225172350.69797-9-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220225172350.69797-1-andriy.shevchenko@linux.intel.com> References: <20220225172350.69797-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Extract pxa2xx_spi_pci_clk_register() from ->probe() in order to reuse it later on for getting rid of max_clk_rate temporary storage. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx-pci.c | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c index c041a9288d0c..2dbe08034ad0 100644 --- a/drivers/spi/spi-pxa2xx-pci.c +++ b/drivers/spi/spi-pxa2xx-pci.c @@ -65,6 +65,24 @@ static struct dw_dma_slave lpt1_rx_param = { .src_id = 1 }; static struct dw_dma_slave lpt0_tx_param = { .dst_id = 2 }; static struct dw_dma_slave lpt0_rx_param = { .src_id = 3 }; +static void pxa2xx_spi_pci_clk_unregister(void *clk) +{ + clk_unregister(clk); +} + +static int pxa2xx_spi_pci_clk_register(struct pci_dev *dev, struct ssp_device *ssp, + unsigned long rate) +{ + char buf[40]; + + snprintf(buf, sizeof(buf), "pxa2xx-spi.%d", ssp->port_id); + ssp->clk = clk_register_fixed_rate(&dev->dev, buf, NULL, 0, rate); + if (IS_ERR(ssp->clk)) + return PTR_ERR(ssp->clk); + + return devm_add_action_or_reset(&dev->dev, pxa2xx_spi_pci_clk_unregister, ssp->clk); +} + static bool lpss_dma_filter(struct dma_chan *chan, void *param) { struct dw_dma_slave *dws = param; @@ -246,7 +264,6 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev, struct pxa2xx_spi_controller spi_pdata; struct ssp_device *ssp; struct pxa_spi_info *c; - char buf[40]; ret = pcim_enable_device(dev); if (ret) @@ -283,11 +300,9 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev, return ret; ssp->irq = pci_irq_vector(dev, 0); - snprintf(buf, sizeof(buf), "pxa2xx-spi.%d", ssp->port_id); - ssp->clk = clk_register_fixed_rate(&dev->dev, buf, NULL, 0, - c->max_clk_rate); - if (IS_ERR(ssp->clk)) - return PTR_ERR(ssp->clk); + ret = pxa2xx_spi_pci_clk_register(dev, ssp, c->max_clk_rate); + if (ret) + return ret; memset(&pi, 0, sizeof(pi)); pi.fwnode = dev_fwnode(&dev->dev); @@ -298,10 +313,8 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev, pi.size_data = sizeof(spi_pdata); pdev = platform_device_register_full(&pi); - if (IS_ERR(pdev)) { - clk_unregister(ssp->clk); + if (IS_ERR(pdev)) return PTR_ERR(pdev); - } pci_set_drvdata(dev, pdev); @@ -311,12 +324,8 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev, static void pxa2xx_spi_pci_remove(struct pci_dev *dev) { struct platform_device *pdev = pci_get_drvdata(dev); - struct pxa2xx_spi_controller *spi_pdata; - - spi_pdata = dev_get_platdata(&pdev->dev); platform_device_unregister(pdev); - clk_unregister(spi_pdata->ssp.clk); } static const struct pci_device_id pxa2xx_spi_pci_devices[] = {