From patchwork Fri May 17 19:47:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13667354 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 38C86C25B78 for ; Fri, 17 May 2024 19:54:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZU6xW3QinwNBme7/voWMCbv+9Z0tEDEJdBB5CaI4EjQ=; b=kOAK+v6LwMYcAh khcY3MJ1SXENgO72SNE9Ze/Sbs6iNQ5sHMN2+w+zpWM6roN6OL80MxtmzTXS7nmiT+QvVBb/fu16m aAwVIJMMt6KjUvIyDGedwf2XwgyZ/pc5dpPOQ9mGKPe28vxx5cc8e6qIY00QgNmviFknxNXNB0uTC BlWzs2LusYUAnWDTMXV7tBUfR9Q5dziy9dy98N314TeoES5SLzDrLz6CGIFhoH0UNWr/S0Yq8cdg+ oCUUbHX5k4Wrusyxif8CInM0kCTkksKHr/0q7J4EAxm0E7EI8HuIWCibCapSS3D8RL7yNqr81LMtL yUzYBJ6vJIupqkPYdybQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s83eV-00000008ryn-3ICm; Fri, 17 May 2024 19:54:03 +0000 Received: from mgamail.intel.com ([198.175.65.18]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s83eN-00000008rrK-3K4O for linux-arm-kernel@lists.infradead.org; Fri, 17 May 2024 19:53:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715975636; x=1747511636; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jyYGQlzaUy8BwNeOWGIhenb9cBWqNz5Bb5cNI/enzAQ=; b=JDWaYD7PaV4OsYKCuRne9VqR12P5rr52R7VKMhrgQgsXSYtI+RIV6OGq 9Q5+0IaaBtbTqk3V/U0hBBCz9QRBl5KURYcK57liIbPU5UCP9soFTaLWn QOVTiv34TpF9eooIecMkP9XVIkO8d1zRyN7+kytss6VLhP9+G7+L44+vs s97SzjorLujFc2vee9tH0Y6hhWMkWoBInzG8ui+bbzR/Z9TBBjBJFiUHR dhYgbjv2qitGcYvPP+Ay0V5QjvzeC6fGCMDHrMZZg0n85NdiKjVijYnDR dlpfNQlSOh7g37RH+l2jPHUnn7Yfuac4RnFqzw/bJRWNP+v20WQ6Wkdbt w==; X-CSE-ConnectionGUID: KfZ7T1KUTu2ksc/jZ/ZJZA== X-CSE-MsgGUID: mG53RPMkRpiKkBoqYzFGXQ== X-IronPort-AV: E=McAfee;i="6600,9927,11075"; a="12348647" X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="12348647" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2024 12:53:49 -0700 X-CSE-ConnectionGUID: a2vzALrrSBuLGdm6o6BN0Q== X-CSE-MsgGUID: fu+sBTnTR22Wj8TvwYEG/A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="31915005" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 17 May 2024 12:53:46 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 1FC47118; Fri, 17 May 2024 22:53:45 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , Linus Walleij , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik Subject: [PATCH v1 01/10] spi: pxa2xx: Reorganize the SSP type retrieval Date: Fri, 17 May 2024 22:47:35 +0300 Message-ID: <20240517195344.813032-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240517195344.813032-1-andriy.shevchenko@linux.intel.com> References: <20240517195344.813032-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_125355_892434_F8F12DBC X-CRM114-Status: GOOD ( 13.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The old Intel platforms, such as Intel Braswell, also provide the property of SSP type. Reorganize the pxa2xx_spi_init_pdata() to take that into account. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index efe76d0c21bb..877fb6d01cd1 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1310,19 +1310,20 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) struct pxa2xx_spi_controller *pdata; struct device *dev = &pdev->dev; struct device *parent = dev->parent; + const void *match = device_get_match_data(dev); enum pxa_ssp_type type = SSP_UNDEFINED; struct ssp_device *ssp = NULL; - const void *match; bool is_lpss_priv; u32 num_cs = 1; int status; - is_lpss_priv = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lpss_priv"); - - match = device_get_match_data(dev); - if (match) - type = (uintptr_t)match; - else if (is_lpss_priv) { + ssp = pxa_ssp_request(pdev->id, pdev->name); + if (ssp) { + type = ssp->type; + pxa_ssp_free(ssp); + } else if (match) { + type = (enum pxa_ssp_type)(uintptr_t)match; + } else { u32 value; status = device_property_read_u32(dev, "intel,spi-pxa2xx-type", &value); @@ -1330,12 +1331,6 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) return ERR_PTR(status); type = (enum pxa_ssp_type)value; - } else { - ssp = pxa_ssp_request(pdev->id, pdev->name); - if (ssp) { - type = ssp->type; - pxa_ssp_free(ssp); - } } /* Validate the SSP type correctness */ @@ -1347,6 +1342,7 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) return ERR_PTR(-ENOMEM); /* Platforms with iDMA 64-bit */ + is_lpss_priv = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lpss_priv"); if (is_lpss_priv) { pdata->tx_param = parent; pdata->rx_param = parent; From patchwork Fri May 17 19:47:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13667357 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EBAC2C25B7B for ; Fri, 17 May 2024 19:54:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mhFpLp2hzA6+MgxhKoeS70332i/E1nrV+fRUNTh1bnk=; b=gaBWuySW+tWBXn KPIZDCi1hBi22B9wmUVJDKri4fvD5GLXivpKPelbFaImzWzhECZsCLrVgjvoFUX31L9FIQ89tmZTB ChtwYIYoF3qvX779//ghUaLEr6t1G7wnTlI70slJqr6L9l3xexHxq/Uqjse34RY2BntjheIqwV9eP Eovf99kpmv2uVT5zGa1S2Lo+WDwvcTkuoWkcFs5qPBNanF+3mvCTt/yoOkG3teO5oKEeiN1D/VupE KmWh1k2UcwkDCIkp9gSOqZLSKQECC+iun7U1Tqa5XKGVT+woDMa6PJxeSBWGz4OxhxT5aD+RQAu9O 2xipwO8cyscHOn9EtbdA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s83eX-00000008rze-0Srg; Fri, 17 May 2024 19:54:05 +0000 Received: from mgamail.intel.com ([198.175.65.18]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s83eN-00000008rrf-3Kkq for linux-arm-kernel@lists.infradead.org; Fri, 17 May 2024 19:53:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715975636; x=1747511636; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=W/bNA4S9nX43IbueQuZhsG1Td45DsiMHiPAvcVuKhwM=; b=Qyqy1eVm6RBqQCkwpiMUNCJCi1FM9q2xIdyl09Znp+SPlDQD3Kpvsj4o VcEEV2bwfkoTAi9aOIc05ZloXi1M9mLYop9o09mn7gBgUoigdI5xfQ8Or h/Hak9b/tRbMLvcvfRDsW17poXZwabfXVsTRobD781iYcXRFwI2WiYphC gnNkL0elnPFxk2PC3BFBZDBR7bHgFj+gdwDYHIVb19pex99H5LxRG4pdU 2mbtZqK0OO2CrHD0KVNuKW9tsx61qivuDqfRc+7QYc1fIrffRxB/9e2mW /Z7Ylba8QxBNQxCC4ICqeW34Scf/ksdxuMpM8dvM8TyKaQ2cypd1mrNIU A==; X-CSE-ConnectionGUID: SCaXHXI9TbmaT6YlAZPJOA== X-CSE-MsgGUID: PHHZ21BLR4aAwf6DciqZww== X-IronPort-AV: E=McAfee;i="6600,9927,11075"; a="12348653" X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="12348653" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2024 12:53:49 -0700 X-CSE-ConnectionGUID: X5j2mwAORaSWH/dU5mJkTA== X-CSE-MsgGUID: YbHcHS0jSwufIy8LJM+1HA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="31915006" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 17 May 2024 12:53:46 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 2C135412; Fri, 17 May 2024 22:53:45 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , Linus Walleij , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik Subject: [PATCH v1 02/10] spi: pxa2xx: Remove no more needed driver data Date: Fri, 17 May 2024 22:47:36 +0300 Message-ID: <20240517195344.813032-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240517195344.813032-1-andriy.shevchenko@linux.intel.com> References: <20240517195344.813032-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_125355_906199_44D01CB6 X-CRM114-Status: GOOD ( 11.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Since the ACPI enumerated devices provide a property with SSP type, there is no more necessity to bear the copy of them in the ID table. Drop the driver data in ACPI ID table. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 877fb6d01cd1..dee5513936ec 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1703,12 +1703,12 @@ static const struct dev_pm_ops pxa2xx_spi_pm_ops = { }; static const struct acpi_device_id pxa2xx_spi_acpi_match[] = { - { "80860F0E", LPSS_BYT_SSP }, - { "8086228E", LPSS_BSW_SSP }, - { "INT33C0", LPSS_LPT_SSP }, - { "INT33C1", LPSS_LPT_SSP }, - { "INT3430", LPSS_LPT_SSP }, - { "INT3431", LPSS_LPT_SSP }, + { "80860F0E" }, + { "8086228E" }, + { "INT33C0" }, + { "INT33C1" }, + { "INT3430" }, + { "INT3431" }, {} }; MODULE_DEVICE_TABLE(acpi, pxa2xx_spi_acpi_match); From patchwork Fri May 17 19:47:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13667351 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ED517C25B78 for ; Fri, 17 May 2024 19:54:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZL193Uee4cuoR6OZtV7QAWVJ78AMZH3aLzoyOgtKVug=; b=dIMgTECWgbtHfP E4wzlsTpHvRvyOt61Wt+LfQN3I4hAT4cxyFEc/Mshakk4Lnh3iTGyh4n6CB+PWiwhe3MhJI5kHKLr xGvaxUD7Wnx+HucjWBwGegWqsX3agwKPb+2Mf0klcUER0bbzWVbAEalN4vueV4sH5VvrYEdboXLkd YVKNiJtlZpwPjI3Na0yFFnG/vwpic/nlvEllO0BoUpIyQlFf4MF+QaHqiYMpfx2W2HgAbQGhg1VSS i2tQP5XP7hiAHdOMbyA2xGw2CSeQbf4ZNh5psg09Ya+AEasY375lCNxd6EgbTirzrCfcxKkqsYQns t+Rr+eRclgBIbbVRii4g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s83eR-00000008rw0-3kNt; Fri, 17 May 2024 19:53:59 +0000 Received: from mgamail.intel.com ([192.198.163.12]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s83eJ-00000008rri-2dxV for linux-arm-kernel@lists.infradead.org; Fri, 17 May 2024 19:53:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715975631; x=1747511631; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0gIMmyJJTI2Ipz0HBjg4zm0dtXuKg8fOksHpUFhIUT8=; b=jHu3h7TLyhWBUfXpfW5kJGN5MkCseYa87EvdSpJ1hntPLmndchZYF4LL AdSg2CkoCGHgyjMN/hrM/nX979ST1xS4B5RplM2rPLJz6NHzMw4JEbgO+ DKcHL9Bic5Yov8oUhcNOy6P7/PiHMqQgAVICuFgXNckE82qznFoFXX+0u 1ZnJAGLMMQWR1wG3Bn0f0dkcS97UZya2T3a7kt5HnHPkUafM7jw/FFlQj tl5qmTynUjmxjRd8NJD6/1fxoyKzmn1iLohVNCtOVRTDamob1ILeuxLnX 2bur1ZU6ZUimnzokTlcJ/wUc3qM3IETjkGOPVAhXWfftaOgBjgvcnMajE A==; X-CSE-ConnectionGUID: HUFjjs+vStKivlRu0SKuFw== X-CSE-MsgGUID: dHx2r8hSS1aab9m//r18Yg== X-IronPort-AV: E=McAfee;i="6600,9927,11075"; a="16004901" X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="16004901" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2024 12:53:48 -0700 X-CSE-ConnectionGUID: pbsSzbLrRxSzszoL9NFkNg== X-CSE-MsgGUID: zYbAUfGpSa6EtnedYR+6CQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="36313502" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa005.fm.intel.com with ESMTP; 17 May 2024 12:53:46 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 3856B44E; Fri, 17 May 2024 22:53:45 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , Linus Walleij , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik Subject: [PATCH v1 03/10] spi: pxa2xx: Remove hard coded number of chip select pins Date: Fri, 17 May 2024 22:47:37 +0300 Message-ID: <20240517195344.813032-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240517195344.813032-1-andriy.shevchenko@linux.intel.com> References: <20240517195344.813032-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_125351_699547_1D8A7F7A X-CRM114-Status: GOOD ( 12.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Remove hard coded number of chip select pins for Intel Braswell. This comes via property. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index dee5513936ec..e7087228505e 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -99,7 +99,6 @@ struct lpss_config { /* Chip select control */ unsigned cs_sel_shift; unsigned cs_sel_mask; - unsigned cs_num; /* Quirks */ unsigned cs_clk_stays_gated : 1; }; @@ -137,7 +136,6 @@ static const struct lpss_config lpss_platforms[] = { .tx_threshold_hi = 224, .cs_sel_shift = 2, .cs_sel_mask = 1 << 2, - .cs_num = 2, }, { /* LPSS_SPT_SSP */ .offset = 0x200, @@ -1574,8 +1572,6 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) tmp &= LPSS_CAPS_CS_EN_MASK; tmp >>= LPSS_CAPS_CS_EN_SHIFT; platform_info->num_chipselect = ffz(tmp); - } else if (config->cs_num) { - platform_info->num_chipselect = config->cs_num; } } controller->num_chipselect = platform_info->num_chipselect; From patchwork Fri May 17 19:47:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13667352 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 73FE4C04FFE for ; Fri, 17 May 2024 19:54:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YBEQGHsMCTInwUI+fi0N+uvBwuY2EoWigotKGsYTTdU=; b=fHE2sZdmIYEfRB jb60PbOTZUlVCyZSGnPm39i9GfWQmH1+SsZYdPdNrVZpSM/mhBrxKG84SGDrkpfWXWlkSqHv9elfT Y+iStqt8WcMlSMfApCF68FBIjXb7xxHdpY3SkeTstw1jyvqXnCkYtGzGdPTKcbioGQ7bmJIO+UTMY s3bfRRfMaFRoMSNvGaEW/CKtKnfNLe0hZzshhEqkxvyUv62yHpiAd8NP9pZ8HVSZTbdOPLE0aFPDw Vo/IkQ3JwervcGWpUX4Ru/x1MccbV7xYh4dhV0RomX9WRkiB+440v1iFXc2AANqVnA/q1vfapnWjS I7KAsX6pQ0G+QID8yXzw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s83eS-00000008rwg-3KjZ; Fri, 17 May 2024 19:54:00 +0000 Received: from mgamail.intel.com ([192.198.163.12]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s83eK-00000008rrJ-0Z7K for linux-arm-kernel@lists.infradead.org; Fri, 17 May 2024 19:53:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715975632; x=1747511632; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BSnLfbcsr/85SV1zF6LHyE/lUsFxpD7yZqhfm3fFi44=; b=H7/yas5wtuVCV7YqulKV/v9iTRQjdlNdnuMxrdbvuEVtii3WZXy/6dK0 sumAiBCQ8+OvnbB7SkHRAA/fhB4ir6xP1TazmDo5C0IFdFps0GzDJXwaZ GPcKAAE0ZvD1bKnna2Fe+JuqYjOy/VCTs1su17RWTRqhSMAcdQF/ZsCmX 3YqtijN7dDZQ4ulhQplOnXJhb6HLC44ltfcCqgUlk4g025wheftT9RDeN I5SU3Lsa8lUMUdks0nVTLb0pT4/jm/zTVqggHDmoYi+SKxMte/88tl6DC P1ZGm6NafBtSqA/5Rw83SYE7lwh09joqNIWB+NXt9SWyDlRgEUYu7hiSK w==; X-CSE-ConnectionGUID: aaURGnhKR96zDl7eXganPQ== X-CSE-MsgGUID: hYDbeyqSRBG4TNUYqWaslQ== X-IronPort-AV: E=McAfee;i="6600,9927,11075"; a="16004907" X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="16004907" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2024 12:53:48 -0700 X-CSE-ConnectionGUID: pduLhhlYTfCkrnhRFpgZRw== X-CSE-MsgGUID: XHQJUAJIReinYs/nbLnjZA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="36313503" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa005.fm.intel.com with ESMTP; 17 May 2024 12:53:46 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 44DC14A3; Fri, 17 May 2024 22:53:45 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , Linus Walleij , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik Subject: [PATCH v1 04/10] spi: pxa2xx: Utilise temporary variable for struct device Date: Fri, 17 May 2024 22:47:38 +0300 Message-ID: <20240517195344.813032-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240517195344.813032-1-andriy.shevchenko@linux.intel.com> References: <20240517195344.813032-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_125352_209322_A4BA4B89 X-CRM114-Status: GOOD ( 12.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org We have a temporary variable to keep a pointer to struct device. Utilise it where it makes sense. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index e7087228505e..56ff296925b7 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1586,13 +1586,13 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) } } - pm_runtime_set_autosuspend_delay(&pdev->dev, 50); - pm_runtime_use_autosuspend(&pdev->dev); - pm_runtime_set_active(&pdev->dev); - pm_runtime_enable(&pdev->dev); + pm_runtime_set_autosuspend_delay(dev, 50); + pm_runtime_use_autosuspend(dev); + pm_runtime_set_active(dev); + pm_runtime_enable(dev); /* Register with the SPI framework */ - platform_set_drvdata(pdev, drv_data); + dev_set_drvdata(dev, drv_data); status = spi_register_controller(controller); if (status) { dev_err_probe(dev, status, "problem registering SPI controller\n"); @@ -1602,7 +1602,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) return status; out_error_pm_runtime_enabled: - pm_runtime_disable(&pdev->dev); + pm_runtime_disable(dev); out_error_clock_enabled: clk_disable_unprepare(ssp->clk); @@ -1618,10 +1618,11 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) static void pxa2xx_spi_remove(struct platform_device *pdev) { - struct driver_data *drv_data = platform_get_drvdata(pdev); + struct device *dev = &pdev->dev; + struct driver_data *drv_data = dev_get_drvdata(dev); struct ssp_device *ssp = drv_data->ssp; - pm_runtime_get_sync(&pdev->dev); + pm_runtime_get_sync(dev); spi_unregister_controller(drv_data->controller); @@ -1633,8 +1634,8 @@ static void pxa2xx_spi_remove(struct platform_device *pdev) if (drv_data->controller_info->enable_dma) pxa2xx_spi_dma_release(drv_data); - pm_runtime_put_noidle(&pdev->dev); - pm_runtime_disable(&pdev->dev); + pm_runtime_put_noidle(dev); + pm_runtime_disable(dev); /* Release IRQ */ free_irq(ssp->irq, drv_data); From patchwork Fri May 17 19:47:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13667355 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3A225C25B7C for ; Fri, 17 May 2024 19:54:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=t75c0BtBPFBFoxp70JI/st0h57C5OU7wO9jlzNWALMA=; b=qpC8NzGsDAI4l2 5h2N+1J7RHoc/86IugW/LBbXIS6ZNbTqW/W39ouMNBTseXCsf4kDwZUHSB3mFUxEraE9PAOglAq/e 9IMSWAWrSkOIFvtywv9B3LYQF5QoDfZdvHPp3njTTJinFiqThc6NH6VBb4P+weiQdmKA7AQlAczYV HZfbHgYSnxeYk7GlAJmWgV8mMcimj/KBpMpk5jgz4SDRk3hX2tJa8eKy2KK1xFbe/4D5p6Al5sk+6 uasRC0/4DIcRK3IQgeaz9VWvdJU81lOgPjW9drYXzq4eILY20wOpJt5xwHWJs8PungeisJARjQjx7 YNedbrr8rcWXXKLb4R1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s83eY-00000008s0P-1DAK; Fri, 17 May 2024 19:54:06 +0000 Received: from mgamail.intel.com ([198.175.65.18]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s83eP-00000008rrK-182d for linux-arm-kernel@lists.infradead.org; Fri, 17 May 2024 19:53:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715975637; x=1747511637; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6yxGDk7ROsAHdlN45SFSGOkUAPyIsLceEo5pzjgzRq0=; b=R7vw/9E1IcS6OlTE968zui6HdFQ7G4T7/kIWDys9OKPGwJsKJr/DpPaA Lbg5yOfU14aJ4Am5eWzbRTIudBUzeeKoA8/w3Ej0Qu0cHR3Q6iWkG2gs/ Msf2NMZoU9lDb6A/uvtrFZqL8EGXfb/6SMpmg8pPH1Bto6WuvRyxsSj/U tFckLCR09yLC4oJs+0hhV8q4iZBvcBp0Icwv1Ly2a0EuGZVo86FutVu1z kGl3+S8jpTHMfr0LntOZo06iRMOZHkL53Ialv/UhNlmXpQFbk4D+VWtGO xicY0eNVeHfmbpw7BjPLPPF80kf7QnA02XoucWyx4OeFc1/UWm0vZd+Ec A==; X-CSE-ConnectionGUID: xwYtoSn8TvifXoP0+R09SQ== X-CSE-MsgGUID: lRsy158cSkCKFLOD6bFWMw== X-IronPort-AV: E=McAfee;i="6600,9927,11075"; a="12348664" X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="12348664" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2024 12:53:51 -0700 X-CSE-ConnectionGUID: yG+fqxbaS3eJAIHu8L2Vjg== X-CSE-MsgGUID: cYaIy8bnRoWTHwLpCa8toQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="31915014" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 17 May 2024 12:53:49 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 50F664B1; Fri, 17 May 2024 22:53:45 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , Linus Walleij , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik Subject: [PATCH v1 05/10] spi: pxa2xx: Print DMA burst size only when DMA is enabled Date: Fri, 17 May 2024 22:47:39 +0300 Message-ID: <20240517195344.813032-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240517195344.813032-1-andriy.shevchenko@linux.intel.com> References: <20240517195344.813032-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_125357_485130_0DE1AA47 X-CRM114-Status: GOOD ( 11.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Print DMA burst size only when DMA is enabled to avoid making a false impression that DMA is enabled when it may be not. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 56ff296925b7..6bbeb1d09ed9 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1412,7 +1412,6 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) if (IS_ERR(platform_info)) return dev_err_probe(dev, PTR_ERR(platform_info), "missing platform data\n"); } - dev_dbg(dev, "DMA burst size set to %u\n", platform_info->dma_burst_size); ssp = pxa_ssp_request(pdev->id, pdev->name); if (!ssp) @@ -1496,6 +1495,8 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) controller->max_dma_len = MAX_DMA_LEN; controller->max_transfer_size = pxa2xx_spi_max_dma_transfer_size; + + dev_dbg(dev, "DMA burst size set to %u\n", platform_info->dma_burst_size); } } From patchwork Fri May 17 19:47:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13667358 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4EF7AC04FFE for ; Fri, 17 May 2024 19:54:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HNcAQ2+xQ6KiCYyLBhJHYT5ACj5pWhr/01ko1eIl9uQ=; b=AiDkDx5aPJhVWd WuDS+gkT2/DA2jd7e43Mj4F60GkPwiyp9amT7JFS3ig5EKwPT9Ay9gwr7iaezEuYD1wkCG+YVFDdI TLeU4Rog5YTrhV2gfgdngLRbqqZmtklJ9FbCRfOfMSTGtRmeY0/GTkNuRRen/YW4BcyvEqPwhpK39 8I7ZGV9OMKDIGW8HUcc1jKlpfjdM/Lid3ncm6hbPOpdnU9JkZP/noMaanWaZ07aWq2CVF1rMXpyC6 C0cq4otoWhr9QGbGZ8FAgmgO+YwkxJqHS9Ikt2MUcrNxbjPEQdMcMi9oO/755YBdmWV4KV0eXvzGc ynJdA+w2TlKCN4DRO05g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s83ea-00000008s1v-1y4R; Fri, 17 May 2024 19:54:08 +0000 Received: from mgamail.intel.com ([198.175.65.18]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s83eP-00000008rrf-19p9 for linux-arm-kernel@lists.infradead.org; Fri, 17 May 2024 19:53:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715975637; x=1747511637; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HBWQ6IuxWBHRAQ4QfisCUK6oqXawkSugTUNHrkfwhz4=; b=IOwrQM+8exnePlZADAjzQ1CdbtxHppH+oKUUQfc/flMh3bifSU+X20lE uTA97g96ywMb8oeb402hS/odrv9u5hCDJUhhE28QCJDcOVKquR2TlmRD2 gs2tgwbxbBeiMa4WPthLXNDCV4uDlFGg1Rq00yRiAY7IGY4JADLeVT79r qia86lGrvQoILdpQxD81osjoufAkZ74iLT5VvNqSHcMMifQMlW441Hqbc /GtzaBLfsTzqKsmZLxVlClGodDVht2oZQntVvlh6SOcI38kjZ6oviuNGk s1mx2ibJlrP38Hd8kRLc/q3fw4zJP1xN20WntImUwWKXBqaDjynnd/dyP g==; X-CSE-ConnectionGUID: qraDWjloT1mPER+xQdms3A== X-CSE-MsgGUID: LikJ5suiTbmV1GX5xcKjyg== X-IronPort-AV: E=McAfee;i="6600,9927,11075"; a="12348670" X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="12348670" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2024 12:53:52 -0700 X-CSE-ConnectionGUID: MMr9Eq2ETEidSEtteES/3Q== X-CSE-MsgGUID: 6mSVDHLuRYSdn73/LP21pQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="31915015" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 17 May 2024 12:53:49 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 5945253A; Fri, 17 May 2024 22:53:45 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , Linus Walleij , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik Subject: [PATCH v1 06/10] spi: pxa2xx: Remove duplicate check Date: Fri, 17 May 2024 22:47:40 +0300 Message-ID: <20240517195344.813032-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240517195344.813032-1-andriy.shevchenko@linux.intel.com> References: <20240517195344.813032-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_125357_489622_2BA9E869 X-CRM114-Status: UNSURE ( 9.68 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The mmio_base can't be NULL at this point. It's either checked in both pxa_ssp_probe() and pxa2xx_spi_init_ssp() or correctly provided by PCI core. Hence, remove duplicate check which is a dead code. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 6bbeb1d09ed9..cd28b798b53b 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1417,9 +1417,6 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) if (!ssp) ssp = &platform_info->ssp; - if (!ssp->mmio_base) - return dev_err_probe(dev, -ENODEV, "failed to get SSP\n"); - if (platform_info->is_target) controller = devm_spi_alloc_target(dev, sizeof(*drv_data)); else From patchwork Fri May 17 19:47:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13667359 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4A917C04FFE for ; Fri, 17 May 2024 19:54:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VRbBMB9NTg2ac6rZxhEJFeU5WNCoJ+Xn3Skk8hA+TDU=; b=JJe0mWGQCvTzvw +SvSPa2m2mRd9WOsGCZzRWyeCK/9RR2PTpAcL2vABBuxMKH/KK+oII2hH51AE0ma9girA6n53DJJp DEtAdWjTGHrmmbNDAZeMl10QcSa8D2zfduzqX4TUoJBqaMqjJcen+zeGROM8fjBORhc2QBAu3PYjB UrHiizVxdRJIQz2f0p+C9MKp4RU75+0efUsWN0rDk4o06jw5nIC1eSe/43OlgChSJQB4g8v+rbPVZ mK5FCxN2DMY1J0AyPl0+71NNEFdL+rMD63XoChF5vLrsAzD9OdQaz8ozs4OGWpzBCrvuyWjDY58Gq epNqJcfyBvIJcNJshFrA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s83ee-00000008s54-0Ygf; Fri, 17 May 2024 19:54:12 +0000 Received: from mgamail.intel.com ([198.175.65.18]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s83eP-00000008ruS-231B for linux-arm-kernel@lists.infradead.org; Fri, 17 May 2024 19:53:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715975638; x=1747511638; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=y0fN4jjiP8CI1asO2p9oSxaF0MzR6arWo4rn+6QIULI=; b=i714iwvFGrU0DJx+UEGeZyKlkIOSM1xCMY37oyRBUKLXWBrzt83gq2Lw MrZEUrfyb7SAfege3HH4sSAUqBAV+FjZABpjbNB+9ONO4BkHaFTeSW2w8 wQCIWBPu/8Givlr6G3d2UtHkH3x92tcrrv45+dGSHcGUwKaWjpSmAPMRB y4WttJMk+u/HX8idK/bfFQwYt99tK/pdauw3kiKOxGa73STR6OLZ4DHmr TyeiTJ0RMWN5amza5OwqK0gml+hYkOzSd/Jlf8jpRnsggx2CYEPE7e7Yg v4ip9dH+a45lDieypB0cT4TDtx+3RG87cAeY/IlkrxSv1isvg6xKzSqWo Q==; X-CSE-ConnectionGUID: 8UB1cqvhT4+7W2p57Jt1Eg== X-CSE-MsgGUID: 8qf3+Z/7SpyxqvVWU1HjcA== X-IronPort-AV: E=McAfee;i="6600,9927,11075"; a="12348677" X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="12348677" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2024 12:53:52 -0700 X-CSE-ConnectionGUID: cp0OGmhWSwOiPsy7hw7/TA== X-CSE-MsgGUID: 44wEwEV0SbmoZyp3eCNvrw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="31915017" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 17 May 2024 12:53:49 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 665A455A; Fri, 17 May 2024 22:53:45 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , Linus Walleij , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik Subject: [PATCH v1 07/10] spi: pxa2xx: Remove superflous check for Intel Atom SoCs Date: Fri, 17 May 2024 22:47:41 +0300 Message-ID: <20240517195344.813032-8-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240517195344.813032-1-andriy.shevchenko@linux.intel.com> References: <20240517195344.813032-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_125357_654036_94F033F7 X-CRM114-Status: GOOD ( 14.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org pxa2xx_spi_fw_translate_cs() checks for the ACPI companion device presence along with the SSP type. But the SSP type is uniquely determines the case. Hence remove the superflous check. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index cd28b798b53b..3ea4b9821a8e 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1371,23 +1371,19 @@ static int pxa2xx_spi_fw_translate_cs(struct spi_controller *controller, { struct driver_data *drv_data = spi_controller_get_devdata(controller); - if (has_acpi_companion(drv_data->ssp->dev)) { - switch (drv_data->ssp_type) { - /* - * For Atoms the ACPI DeviceSelection used by the Windows - * driver starts from 1 instead of 0 so translate it here - * to match what Linux expects. - */ - case LPSS_BYT_SSP: - case LPSS_BSW_SSP: - return cs - 1; + switch (drv_data->ssp_type) { + /* + * For some of Intel Atoms the ACPI DeviceSelection used by the Windows + * driver starts from 1 instead of 0 so translate it here to match what + * Linux expects. + */ + case LPSS_BYT_SSP: + case LPSS_BSW_SSP: + return cs - 1; - default: - break; - } + default: + return cs; } - - return cs; } static size_t pxa2xx_spi_max_dma_transfer_size(struct spi_device *spi) From patchwork Fri May 17 19:47:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13667356 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 71153C04FFE for ; Fri, 17 May 2024 19:54:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=O3zIhnoJV6rejd3meA/pz+akZ37r7mo2BsDvSexazVQ=; b=zKU780kYSKnL85 tvxjx4jPJwlwsvgtWIb9QpQnCT7gTNOpE7fZZSaoGxxFbHrkcLzaRUaQdemxDv1DqeC6EwallM2Ou wXp/66u7KrzjOL/ijjY9T53x5ZMOrU7+raYrLkmM1JfiMI3bOPesEjBc2mm90prR/wNo4Jd+hqZkk vz4EEc6IT8Gw4LI3EoK1ERS1pLg0Iw0u+bkq/PMX6vmj3vH/YOf1HYSmzIlyEo/xPUBR7qHKlCSg2 arUls76qHuAXx6jx9i3xwLMhkqOIm9qlPG8ghoZgV7btWJMROQQC+fmogFTk13NYZk4jXG03vH6G8 FxHA4RCniYgznWR69S8g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s83eU-00000008ry9-2nEx; Fri, 17 May 2024 19:54:02 +0000 Received: from mgamail.intel.com ([192.198.163.12]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s83eK-00000008rri-3oGm for linux-arm-kernel@lists.infradead.org; Fri, 17 May 2024 19:53:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715975632; x=1747511632; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=y1UPm7DX7C60ENAe+k+9dpW4n3R67mPRIBKTRmhcBrk=; b=I77hG0QmaMJxkxCyc+h8xqoTkLsOCh5lyNB1ylLL1hQM+l5RO2PFdm0q LVWXnWxFFHu5/DJ+06iz3eBfR80EqE+5X80tQ2x3NX24JheytbSPOE6A3 D8Z58V0FsIWFnAwME65EtPYYfciqDhz92vxVtjvtI+QM7lJG3B+qfY92j DjJLn7RXpMVdSt/S8XP9WdTnuL7tVDFWA7E8Im4YMb0tY3tO33xKeH2QJ whVb69Nfxd0vvr425mRBXGaF8CzUB8NRS6YitWLoMe96/vFvZ86NG/1PR iMtF1zT6XFJW90zErbSZRVJmqZVRYyRguBOiIHafEote0/u0yBfz6bZC0 g==; X-CSE-ConnectionGUID: c4aDoi+mQDWPK76wkvxmrg== X-CSE-MsgGUID: 98562JsFSFqJCLp8BgMtDA== X-IronPort-AV: E=McAfee;i="6600,9927,11075"; a="16004919" X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="16004919" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2024 12:53:51 -0700 X-CSE-ConnectionGUID: Wft6TsYRRoSZHbMsnWL+HA== X-CSE-MsgGUID: fzXitw+FQg2Sx5qys0iupA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="36313506" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa005.fm.intel.com with ESMTP; 17 May 2024 12:53:49 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 727D45C5; Fri, 17 May 2024 22:53:45 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , Linus Walleij , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik Subject: [PATCH v1 08/10] spi: pxa2xx: Extract pxa2xx_spi_platform_*() callbacks Date: Fri, 17 May 2024 22:47:42 +0300 Message-ID: <20240517195344.813032-9-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240517195344.813032-1-andriy.shevchenko@linux.intel.com> References: <20240517195344.813032-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_125352_998880_CCE15956 X-CRM114-Status: GOOD ( 17.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In preparation of the extracting platform driver from spi-pxa2xx.c split the probe and remove functions so we have bus independent and platform device ones. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx.c | 63 +++++++++++++++++++++++++++------------- 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 3ea4b9821a8e..f53827d61a21 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1391,28 +1391,16 @@ static size_t pxa2xx_spi_max_dma_transfer_size(struct spi_device *spi) return MAX_DMA_LEN; } -static int pxa2xx_spi_probe(struct platform_device *pdev) +static int pxa2xx_spi_probe(struct device *dev, struct ssp_device *ssp) { - struct device *dev = &pdev->dev; struct pxa2xx_spi_controller *platform_info; struct spi_controller *controller; struct driver_data *drv_data; - struct ssp_device *ssp; const struct lpss_config *config; int status; u32 tmp; platform_info = dev_get_platdata(dev); - if (!platform_info) { - platform_info = pxa2xx_spi_init_pdata(pdev); - if (IS_ERR(platform_info)) - return dev_err_probe(dev, PTR_ERR(platform_info), "missing platform data\n"); - } - - ssp = pxa_ssp_request(pdev->id, pdev->name); - if (!ssp) - ssp = &platform_info->ssp; - if (platform_info->is_target) controller = devm_spi_alloc_target(dev, sizeof(*drv_data)); else @@ -1610,9 +1598,8 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) return status; } -static void pxa2xx_spi_remove(struct platform_device *pdev) +static void pxa2xx_spi_remove(struct device *dev) { - struct device *dev = &pdev->dev; struct driver_data *drv_data = dev_get_drvdata(dev); struct ssp_device *ssp = drv_data->ssp; @@ -1633,9 +1620,6 @@ static void pxa2xx_spi_remove(struct platform_device *pdev) /* Release IRQ */ free_irq(ssp->irq, drv_data); - - /* Release SSP */ - pxa_ssp_free(ssp); } static int pxa2xx_spi_suspend(struct device *dev) @@ -1693,6 +1677,45 @@ static const struct dev_pm_ops pxa2xx_spi_pm_ops = { RUNTIME_PM_OPS(pxa2xx_spi_runtime_suspend, pxa2xx_spi_runtime_resume, NULL) }; +static int pxa2xx_spi_platform_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct pxa2xx_spi_controller *platform_info; + struct ssp_device *ssp; + int status; + + platform_info = dev_get_platdata(dev); + if (!platform_info) { + platform_info = pxa2xx_spi_init_pdata(pdev); + if (IS_ERR(platform_info)) + return dev_err_probe(dev, PTR_ERR(platform_info), "missing platform data\n"); + + dev->platform_data = platform_info; + + } + + ssp = pxa_ssp_request(pdev->id, pdev->name); + if (!ssp) + ssp = &platform_info->ssp; + + status = pxa2xx_spi_probe(dev, ssp); + if (status) + pxa_ssp_free(ssp); + + return status; +} + +static void pxa2xx_spi_platform_remove(struct platform_device *pdev) +{ + struct driver_data *drv_data = platform_get_drvdata(pdev); + struct ssp_device *ssp = drv_data->ssp; + + pxa2xx_spi_remove(&pdev->dev); + + /* Release SSP */ + pxa_ssp_free(ssp); +} + static const struct acpi_device_id pxa2xx_spi_acpi_match[] = { { "80860F0E" }, { "8086228E" }, @@ -1717,8 +1740,8 @@ static struct platform_driver driver = { .acpi_match_table = pxa2xx_spi_acpi_match, .of_match_table = pxa2xx_spi_of_match, }, - .probe = pxa2xx_spi_probe, - .remove_new = pxa2xx_spi_remove, + .probe = pxa2xx_spi_platform_probe, + .remove_new = pxa2xx_spi_platform_remove, }; static int __init pxa2xx_spi_init(void) From patchwork Fri May 17 19:47:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13667353 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 69616C25B7A for ; Fri, 17 May 2024 19:54:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0iubimWaq0UIlu+MQeui2+DvjuBaWM+0yci49Qz+AHc=; b=TXXFzJMbobVqqH 6JMVvG8QemC2phboUEej0BEOpgqlXaIpZQrR1Sx2qaX6YBvLr1JvvympUSIFkVpsuCEkr/qD1kwKI +4aGNnXAujQ8Nx5DnWEAwpqDxFFAO/buCQsYP5dMbTzR7Vafn+/+5jR6iRtdiXL7ItUKkc9Qltrae ukeqvefN2ZHXUZ2cH7y3OnbbrWPNXhigFyfo5EiJEikRqVr3sIjM+BFAUaziwnY48/ZN4x4uMjNG0 gg26imymatuYrwGiGDw6hqTPgm49sHRgzkSEu32VZSXXedXuZ0KoetDH4DFTxiuryYEvgAh/lM9Tq 6wYGiZH5juuRthSeAuPw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s83eT-00000008rx9-31wN; Fri, 17 May 2024 19:54:01 +0000 Received: from mgamail.intel.com ([192.198.163.12]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s83eK-00000008rsK-4BMA for linux-arm-kernel@lists.infradead.org; Fri, 17 May 2024 19:53:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715975633; x=1747511633; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HNU9fmPNNCkMcg44f6U3/tHhFOGZf0QqaDGS0apE+gQ=; b=WYheGB8mZu9xBxpR4PqJyZ5zZBxeLnyrDmgScmKhR5V6UUWJjmPPr42c IuxqeqpOUEcTY64jnj/DgUkuDStbO8jXOKqsCcCngZThhEeoD5vsTZFS6 SYhGMplAjt+oqpNT4/qzKgPPOvJpUAkk5y3wtB3TuMbpCGxpvANjEkwp/ WDqZdcyHmjEKQDglkm7HYKknBH1AU+69sWTdcIVfXXHhLlpru/hQiOqMk UUgTu8sQERfdmaKJybhgRnHRJAhphEuwpdO8/67wiTyavhurvIq4w5aBB 1wtAm67GedRn2uWskRNUc/0+iSob8Lg9Y6htnyfm2p7V0z3VjSoFy4bVs w==; X-CSE-ConnectionGUID: +OhVRZpzSMS6wAvZP8gxtg== X-CSE-MsgGUID: E/mDQCvVR9itSsz2RmanNg== X-IronPort-AV: E=McAfee;i="6600,9927,11075"; a="16004926" X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="16004926" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2024 12:53:52 -0700 X-CSE-ConnectionGUID: sRAtJcAERLuEDtiw9FiucQ== X-CSE-MsgGUID: R7Q99IfeRZCxs53+lFl4qQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="36313507" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa005.fm.intel.com with ESMTP; 17 May 2024 12:53:49 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 7B2495D3; Fri, 17 May 2024 22:53:45 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , Linus Walleij , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik Subject: [PATCH v1 09/10] spi: pxa2xx: Move platform driver to a separate file Date: Fri, 17 May 2024 22:47:43 +0300 Message-ID: <20240517195344.813032-10-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240517195344.813032-1-andriy.shevchenko@linux.intel.com> References: <20240517195344.813032-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_125353_141952_5C8548F1 X-CRM114-Status: GOOD ( 27.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The spi-pxa2xx.c is bloated with a platform driver code while pretending to provide a core functionality. Make it real core library by splitting out the platform driver to a separate file. Signed-off-by: Andy Shevchenko --- drivers/spi/Makefile | 3 +- drivers/spi/spi-pxa2xx-platform.c | 201 +++++++++++++++++++++++++++++ drivers/spi/spi-pxa2xx.c | 203 ++---------------------------- drivers/spi/spi-pxa2xx.h | 6 + 4 files changed, 217 insertions(+), 196 deletions(-) create mode 100644 drivers/spi/spi-pxa2xx-platform.c diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile index e694254dec04..bcfb6efd88e0 100644 --- a/drivers/spi/Makefile +++ b/drivers/spi/Makefile @@ -107,7 +107,8 @@ obj-$(CONFIG_SPI_PIC32) += spi-pic32.o obj-$(CONFIG_SPI_PIC32_SQI) += spi-pic32-sqi.o obj-$(CONFIG_SPI_PL022) += spi-pl022.o obj-$(CONFIG_SPI_PPC4xx) += spi-ppc4xx.o -spi-pxa2xx-platform-objs := spi-pxa2xx.o spi-pxa2xx-dma.o +obj-$(CONFIG_SPI_PXA2XX) += spi-pxa2xx-core.o +spi-pxa2xx-core-y := spi-pxa2xx.o spi-pxa2xx-dma.o obj-$(CONFIG_SPI_PXA2XX) += spi-pxa2xx-platform.o obj-$(CONFIG_SPI_PXA2XX_PCI) += spi-pxa2xx-pci.o obj-$(CONFIG_SPI_QCOM_GENI) += spi-geni-qcom.o diff --git a/drivers/spi/spi-pxa2xx-platform.c b/drivers/spi/spi-pxa2xx-platform.c new file mode 100644 index 000000000000..081ab31bb49d --- /dev/null +++ b/drivers/spi/spi-pxa2xx-platform.c @@ -0,0 +1,201 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "spi-pxa2xx.h" + +static int +pxa2xx_spi_init_ssp(struct platform_device *pdev, struct ssp_device *ssp, enum pxa_ssp_type type) +{ + struct device *dev = &pdev->dev; + struct resource *res; + int status; + u64 uid; + + ssp->mmio_base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); + if (IS_ERR(ssp->mmio_base)) + return PTR_ERR(ssp->mmio_base); + + ssp->phys_base = res->start; + + ssp->clk = devm_clk_get(dev, NULL); + if (IS_ERR(ssp->clk)) + return PTR_ERR(ssp->clk); + + ssp->irq = platform_get_irq(pdev, 0); + if (ssp->irq < 0) + return ssp->irq; + + ssp->type = type; + ssp->dev = dev; + + status = acpi_dev_uid_to_integer(ACPI_COMPANION(dev), &uid); + if (status) + ssp->port_id = -1; + else + ssp->port_id = uid; + + return 0; +} + +static bool pxa2xx_spi_idma_filter(struct dma_chan *chan, void *param) +{ + return param == chan->device->dev; +} + +static struct pxa2xx_spi_controller * +pxa2xx_spi_init_pdata(struct platform_device *pdev) +{ + struct pxa2xx_spi_controller *pdata; + struct device *dev = &pdev->dev; + struct device *parent = dev->parent; + const void *match = device_get_match_data(dev); + enum pxa_ssp_type type = SSP_UNDEFINED; + struct ssp_device *ssp = NULL; + bool is_lpss_priv; + u32 num_cs = 1; + int status; + + ssp = pxa_ssp_request(pdev->id, pdev->name); + if (ssp) { + type = ssp->type; + pxa_ssp_free(ssp); + } else if (match) { + type = (enum pxa_ssp_type)(uintptr_t)match; + } else { + u32 value; + + status = device_property_read_u32(dev, "intel,spi-pxa2xx-type", &value); + if (status) + return ERR_PTR(status); + + type = (enum pxa_ssp_type)value; + } + + /* Validate the SSP type correctness */ + if (!(type > SSP_UNDEFINED && type < SSP_MAX)) + return ERR_PTR(-EINVAL); + + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return ERR_PTR(-ENOMEM); + + /* Platforms with iDMA 64-bit */ + is_lpss_priv = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lpss_priv"); + if (is_lpss_priv) { + pdata->tx_param = parent; + pdata->rx_param = parent; + pdata->dma_filter = pxa2xx_spi_idma_filter; + } + + /* Read number of chip select pins, if provided */ + device_property_read_u32(dev, "num-cs", &num_cs); + + pdata->num_chipselect = num_cs; + pdata->is_target = device_property_read_bool(dev, "spi-slave"); + pdata->enable_dma = true; + pdata->dma_burst_size = 1; + + /* If SSP has been already enumerated, use it */ + if (ssp) + return pdata; + + status = pxa2xx_spi_init_ssp(pdev, &pdata->ssp, type); + if (status) + return ERR_PTR(status); + + return pdata; +} + +static int pxa2xx_spi_platform_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct pxa2xx_spi_controller *platform_info; + struct ssp_device *ssp; + int status; + + platform_info = dev_get_platdata(dev); + if (!platform_info) { + platform_info = pxa2xx_spi_init_pdata(pdev); + if (IS_ERR(platform_info)) + return dev_err_probe(dev, PTR_ERR(platform_info), "missing platform data\n"); + + dev->platform_data = platform_info; + + } + + ssp = pxa_ssp_request(pdev->id, pdev->name); + if (!ssp) + ssp = &platform_info->ssp; + + status = pxa2xx_spi_probe(dev, ssp); + if (status) + pxa_ssp_free(ssp); + + return status; +} + +static void pxa2xx_spi_platform_remove(struct platform_device *pdev) +{ + struct driver_data *drv_data = platform_get_drvdata(pdev); + struct ssp_device *ssp = drv_data->ssp; + + pxa2xx_spi_remove(&pdev->dev); + + /* Release SSP */ + pxa_ssp_free(ssp); +} + +static const struct acpi_device_id pxa2xx_spi_acpi_match[] = { + { "80860F0E" }, + { "8086228E" }, + { "INT33C0" }, + { "INT33C1" }, + { "INT3430" }, + { "INT3431" }, + {} +}; +MODULE_DEVICE_TABLE(acpi, pxa2xx_spi_acpi_match); + +static const struct of_device_id pxa2xx_spi_of_match[] = { + { .compatible = "marvell,mmp2-ssp", .data = (void *)MMP2_SSP }, + {} +}; +MODULE_DEVICE_TABLE(of, pxa2xx_spi_of_match); + +static struct platform_driver driver = { + .driver = { + .name = "pxa2xx-spi", + .pm = pm_ptr(&pxa2xx_spi_pm_ops), + .acpi_match_table = pxa2xx_spi_acpi_match, + .of_match_table = pxa2xx_spi_of_match, + }, + .probe = pxa2xx_spi_platform_probe, + .remove_new = pxa2xx_spi_platform_remove, +}; + +static int __init pxa2xx_spi_init(void) +{ + return platform_driver_register(&driver); +} +subsys_initcall(pxa2xx_spi_init); + +static void __exit pxa2xx_spi_exit(void) +{ + platform_driver_unregister(&driver); +} +module_exit(pxa2xx_spi_exit); + +MODULE_AUTHOR("Stephen Street"); +MODULE_DESCRIPTION("PXA2xx SSP SPI Controller platform driver"); +MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(SPI_PXA2xx); +MODULE_ALIAS("platform:pxa2xx-spi"); +MODULE_SOFTDEP("pre: dw_dmac"); diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index f53827d61a21..046869ea5fb7 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -4,7 +4,6 @@ * Copyright (C) 2013, 2021 Intel Corporation */ -#include #include #include #include @@ -14,15 +13,12 @@ #include #include #include -#include #include #include #include #include #include -#include #include -#include #include #include #include @@ -32,11 +28,6 @@ #include "spi-pxa2xx.h" -MODULE_AUTHOR("Stephen Street"); -MODULE_DESCRIPTION("PXA2xx SSP SPI Controller"); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:pxa2xx-spi"); - #define TIMOUT_DFLT 1000 /* @@ -1263,109 +1254,6 @@ static void cleanup(struct spi_device *spi) kfree(chip); } -static bool pxa2xx_spi_idma_filter(struct dma_chan *chan, void *param) -{ - return param == chan->device->dev; -} - -static int -pxa2xx_spi_init_ssp(struct platform_device *pdev, struct ssp_device *ssp, enum pxa_ssp_type type) -{ - struct device *dev = &pdev->dev; - struct resource *res; - int status; - u64 uid; - - ssp->mmio_base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); - if (IS_ERR(ssp->mmio_base)) - return PTR_ERR(ssp->mmio_base); - - ssp->phys_base = res->start; - - ssp->clk = devm_clk_get(dev, NULL); - if (IS_ERR(ssp->clk)) - return PTR_ERR(ssp->clk); - - ssp->irq = platform_get_irq(pdev, 0); - if (ssp->irq < 0) - return ssp->irq; - - ssp->type = type; - ssp->dev = dev; - - status = acpi_dev_uid_to_integer(ACPI_COMPANION(dev), &uid); - if (status) - ssp->port_id = -1; - else - ssp->port_id = uid; - - return 0; -} - -static struct pxa2xx_spi_controller * -pxa2xx_spi_init_pdata(struct platform_device *pdev) -{ - struct pxa2xx_spi_controller *pdata; - struct device *dev = &pdev->dev; - struct device *parent = dev->parent; - const void *match = device_get_match_data(dev); - enum pxa_ssp_type type = SSP_UNDEFINED; - struct ssp_device *ssp = NULL; - bool is_lpss_priv; - u32 num_cs = 1; - int status; - - ssp = pxa_ssp_request(pdev->id, pdev->name); - if (ssp) { - type = ssp->type; - pxa_ssp_free(ssp); - } else if (match) { - type = (enum pxa_ssp_type)(uintptr_t)match; - } else { - u32 value; - - status = device_property_read_u32(dev, "intel,spi-pxa2xx-type", &value); - if (status) - return ERR_PTR(status); - - type = (enum pxa_ssp_type)value; - } - - /* Validate the SSP type correctness */ - if (!(type > SSP_UNDEFINED && type < SSP_MAX)) - return ERR_PTR(-EINVAL); - - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) - return ERR_PTR(-ENOMEM); - - /* Platforms with iDMA 64-bit */ - is_lpss_priv = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lpss_priv"); - if (is_lpss_priv) { - pdata->tx_param = parent; - pdata->rx_param = parent; - pdata->dma_filter = pxa2xx_spi_idma_filter; - } - - /* Read number of chip select pins, if provided */ - device_property_read_u32(dev, "num-cs", &num_cs); - - pdata->num_chipselect = num_cs; - pdata->is_target = device_property_read_bool(dev, "spi-slave"); - pdata->enable_dma = true; - pdata->dma_burst_size = 1; - - /* If SSP has been already enumerated, use it */ - if (ssp) - return pdata; - - status = pxa2xx_spi_init_ssp(pdev, &pdata->ssp, type); - if (status) - return ERR_PTR(status); - - return pdata; -} - static int pxa2xx_spi_fw_translate_cs(struct spi_controller *controller, unsigned int cs) { @@ -1391,7 +1279,7 @@ static size_t pxa2xx_spi_max_dma_transfer_size(struct spi_device *spi) return MAX_DMA_LEN; } -static int pxa2xx_spi_probe(struct device *dev, struct ssp_device *ssp) +int pxa2xx_spi_probe(struct device *dev, struct ssp_device *ssp) { struct pxa2xx_spi_controller *platform_info; struct spi_controller *controller; @@ -1597,8 +1485,9 @@ static int pxa2xx_spi_probe(struct device *dev, struct ssp_device *ssp) pxa_ssp_free(ssp); return status; } +EXPORT_SYMBOL_NS_GPL(pxa2xx_spi_probe, SPI_PXA2xx); -static void pxa2xx_spi_remove(struct device *dev) +void pxa2xx_spi_remove(struct device *dev) { struct driver_data *drv_data = dev_get_drvdata(dev); struct ssp_device *ssp = drv_data->ssp; @@ -1621,6 +1510,7 @@ static void pxa2xx_spi_remove(struct device *dev) /* Release IRQ */ free_irq(ssp->irq, drv_data); } +EXPORT_SYMBOL_NS_GPL(pxa2xx_spi_remove, SPI_PXA2xx); static int pxa2xx_spi_suspend(struct device *dev) { @@ -1672,88 +1562,11 @@ static int pxa2xx_spi_runtime_resume(struct device *dev) return clk_prepare_enable(drv_data->ssp->clk); } -static const struct dev_pm_ops pxa2xx_spi_pm_ops = { +EXPORT_NS_GPL_DEV_PM_OPS(pxa2xx_spi_pm_ops, SPI_PXA2xx) = { SYSTEM_SLEEP_PM_OPS(pxa2xx_spi_suspend, pxa2xx_spi_resume) RUNTIME_PM_OPS(pxa2xx_spi_runtime_suspend, pxa2xx_spi_runtime_resume, NULL) }; -static int pxa2xx_spi_platform_probe(struct platform_device *pdev) -{ - struct device *dev = &pdev->dev; - struct pxa2xx_spi_controller *platform_info; - struct ssp_device *ssp; - int status; - - platform_info = dev_get_platdata(dev); - if (!platform_info) { - platform_info = pxa2xx_spi_init_pdata(pdev); - if (IS_ERR(platform_info)) - return dev_err_probe(dev, PTR_ERR(platform_info), "missing platform data\n"); - - dev->platform_data = platform_info; - - } - - ssp = pxa_ssp_request(pdev->id, pdev->name); - if (!ssp) - ssp = &platform_info->ssp; - - status = pxa2xx_spi_probe(dev, ssp); - if (status) - pxa_ssp_free(ssp); - - return status; -} - -static void pxa2xx_spi_platform_remove(struct platform_device *pdev) -{ - struct driver_data *drv_data = platform_get_drvdata(pdev); - struct ssp_device *ssp = drv_data->ssp; - - pxa2xx_spi_remove(&pdev->dev); - - /* Release SSP */ - pxa_ssp_free(ssp); -} - -static const struct acpi_device_id pxa2xx_spi_acpi_match[] = { - { "80860F0E" }, - { "8086228E" }, - { "INT33C0" }, - { "INT33C1" }, - { "INT3430" }, - { "INT3431" }, - {} -}; -MODULE_DEVICE_TABLE(acpi, pxa2xx_spi_acpi_match); - -static const struct of_device_id pxa2xx_spi_of_match[] = { - { .compatible = "marvell,mmp2-ssp", .data = (void *)MMP2_SSP }, - {} -}; -MODULE_DEVICE_TABLE(of, pxa2xx_spi_of_match); - -static struct platform_driver driver = { - .driver = { - .name = "pxa2xx-spi", - .pm = pm_ptr(&pxa2xx_spi_pm_ops), - .acpi_match_table = pxa2xx_spi_acpi_match, - .of_match_table = pxa2xx_spi_of_match, - }, - .probe = pxa2xx_spi_platform_probe, - .remove_new = pxa2xx_spi_platform_remove, -}; - -static int __init pxa2xx_spi_init(void) -{ - return platform_driver_register(&driver); -} -subsys_initcall(pxa2xx_spi_init); - -static void __exit pxa2xx_spi_exit(void) -{ - platform_driver_unregister(&driver); -} -module_exit(pxa2xx_spi_exit); - -MODULE_SOFTDEP("pre: dw_dmac"); +MODULE_AUTHOR("Stephen Street"); +MODULE_DESCRIPTION("PXA2xx SSP SPI Controller core driver"); +MODULE_LICENSE("GPL"); diff --git a/drivers/spi/spi-pxa2xx.h b/drivers/spi/spi-pxa2xx.h index 93e1e471e1c6..a470d3d634d3 100644 --- a/drivers/spi/spi-pxa2xx.h +++ b/drivers/spi/spi-pxa2xx.h @@ -14,6 +14,7 @@ #include +struct device; struct gpio_desc; /* @@ -131,4 +132,9 @@ extern void pxa2xx_spi_dma_stop(struct driver_data *drv_data); extern int pxa2xx_spi_dma_setup(struct driver_data *drv_data); extern void pxa2xx_spi_dma_release(struct driver_data *drv_data); +int pxa2xx_spi_probe(struct device *dev, struct ssp_device *ssp); +void pxa2xx_spi_remove(struct device *dev); + +extern const struct dev_pm_ops pxa2xx_spi_pm_ops; + #endif /* SPI_PXA2XX_H */ From patchwork Fri May 17 19:47:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13667360 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F0951C25B78 for ; Fri, 17 May 2024 19:55:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KJGA2fymK30JVeT67Q//JR8DBJ/yraE/Pf3LqFDdIiI=; b=zzRb7ryMfdz2/k p1VV2ZuCGFruVh6AdsPumwsKmZr/v8qfxqPLxz+QPQ8rD6jaRjUVN91poPAhAhZIcAEA7yo2G2MRR vZOUAgcAjkJNulQ7R2QJixIXEKE8rqQt5pvg4737cCkfPOzodDAOpKrFpAOEJuBuuwfGQkVjxla+X J272lGVtc7YUuZaMpr2pLEHzIZyTr2kF2s+qylTnfh6XdlOCVs27UxEFJzVP0PS+FNUcMi2msL/tf eWe7SLdLFZ5m9QtSbVN1FC0zt5RsH7wM+Y70YFPehbgrzsH1cLjPS+Dtgb8GxZrDrdh/DmrmGlHdD fbuN9EzsbNtkHrIBXKtg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s83fe-00000008sjb-2jBY; Fri, 17 May 2024 19:55:14 +0000 Received: from mgamail.intel.com ([198.175.65.18]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s83eQ-00000008rrK-3Ub2 for linux-arm-kernel@lists.infradead.org; Fri, 17 May 2024 19:54:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715975639; x=1747511639; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7g0FrtRJTKHe6RD7B4mm9xOD9+Ic1TmeKGG546OwPqo=; b=NKl7LO/mmCXIpg39+JwUSjO2bsJyzPPoNZZ52Vfjc+aazwm+5D6Xo2RS 0TCLWPANCPD/45BAImzua30xZqPb33y9aYcUhfSFHxQhZI2YvRMJHz7Ul GTZnvK7FgrecFDFpU7Z5kPOG8JMHlsg6WlXo0aqNzyaZaleTPwZYJmULM hgVgWtxNxZNm4M94kiyfS6jUGNeXFC3vjXdtAoVXFAHzotssUqdt6ZyNb s7STVgeRrzKOPINp5SUBNDXvNXZGMDJZEAnN7LVj65JCoxDn90H2PFAYF oa/KKdMzoxhi8BZAYfnOTNAsFscGxGkKpoAdOsQj5tjNRWM3/kdvXDcjK w==; X-CSE-ConnectionGUID: Re3xFYLsTWOBe+oZeJTuug== X-CSE-MsgGUID: GHIlmcygSsSsWI2YWFpQeQ== X-IronPort-AV: E=McAfee;i="6600,9927,11075"; a="12348684" X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="12348684" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2024 12:53:52 -0700 X-CSE-ConnectionGUID: PSNZlpLGT0GsLptac8sf7w== X-CSE-MsgGUID: 6JKeLPUWTwmH9hdkS/K0yw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="31915018" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 17 May 2024 12:53:49 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 831C4656; Fri, 17 May 2024 22:53:45 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , Linus Walleij , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik Subject: [PATCH v1 10/10] spi: pxa2xx: Convert PCI driver to use spi-pxa2xx code directly Date: Fri, 17 May 2024 22:47:44 +0300 Message-ID: <20240517195344.813032-11-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240517195344.813032-1-andriy.shevchenko@linux.intel.com> References: <20240517195344.813032-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_125358_933638_DC91EF37 X-CRM114-Status: GOOD ( 15.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org PCI driver has an additional device layer for enumeration. Remove that layer and use spi-pxa2xx code directly. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx-pci.c | 39 ++++++++++++------------------------ 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c index 6d2efdb0e95f..616d032f1a89 100644 --- a/drivers/spi/spi-pxa2xx-pci.c +++ b/drivers/spi/spi-pxa2xx-pci.c @@ -10,8 +10,7 @@ #include #include #include -#include -#include +#include #include #include #include @@ -265,10 +264,8 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) { const struct pxa_spi_info *info; - struct platform_device_info pi; int ret; - struct platform_device *pdev; - struct pxa2xx_spi_controller spi_pdata; + struct pxa2xx_spi_controller *pdata; struct ssp_device *ssp; ret = pcim_enable_device(dev); @@ -279,15 +276,17 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev, if (ret) return ret; - memset(&spi_pdata, 0, sizeof(spi_pdata)); + pdata = devm_kzalloc(&dev->dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return -ENOMEM; - ssp = &spi_pdata.ssp; + ssp = &pdata->ssp; ssp->dev = &dev->dev; ssp->phys_base = pci_resource_start(dev, 0); ssp->mmio_base = pcim_iomap_table(dev)[0]; info = (struct pxa_spi_info *)ent->driver_data; - ret = info->setup(dev, &spi_pdata); + ret = info->setup(dev, pdata); if (ret) return ret; @@ -298,28 +297,12 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev, return ret; ssp->irq = pci_irq_vector(dev, 0); - memset(&pi, 0, sizeof(pi)); - pi.fwnode = dev_fwnode(&dev->dev); - pi.parent = &dev->dev; - pi.name = "pxa2xx-spi"; - pi.id = ssp->port_id; - pi.data = &spi_pdata; - pi.size_data = sizeof(spi_pdata); - - pdev = platform_device_register_full(&pi); - if (IS_ERR(pdev)) - return PTR_ERR(pdev); - - pci_set_drvdata(dev, pdev); - - return 0; + return pxa2xx_spi_probe(&dev->dev, ssp); } static void pxa2xx_spi_pci_remove(struct pci_dev *dev) { - struct platform_device *pdev = pci_get_drvdata(dev); - - platform_device_unregister(pdev); + pxa2xx_spi_remove(&dev->dev); } static const struct pci_device_id pxa2xx_spi_pci_devices[] = { @@ -341,6 +324,9 @@ MODULE_DEVICE_TABLE(pci, pxa2xx_spi_pci_devices); static struct pci_driver pxa2xx_spi_pci_driver = { .name = "pxa2xx_spi_pci", .id_table = pxa2xx_spi_pci_devices, + .driver = { + .pm = pm_ptr(&pxa2xx_spi_pm_ops), + }, .probe = pxa2xx_spi_pci_probe, .remove = pxa2xx_spi_pci_remove, }; @@ -349,4 +335,5 @@ module_pci_driver(pxa2xx_spi_pci_driver); MODULE_DESCRIPTION("CE4100/LPSS PCI-SPI glue code for PXA's driver"); MODULE_LICENSE("GPL v2"); +MODULE_IMPORT_NS(SPI_PXA2xx); MODULE_AUTHOR("Sebastian Andrzej Siewior ");