From patchwork Wed Mar 27 19:29:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13607419 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 A8092CD1283 for ; Wed, 27 Mar 2024 20:33:47 +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=EQrOw81m9o7eEMhlypTUFo/TdA8w6mThYHarXbC1oUc=; b=26XrhEgsX0UXX7 univJLI0/mpzTTIVbwap5vxRR/rbHHABEraoh34lGOGS0aREWzAB7nE2sIDtOSPO/qd3k2qXkJrId /lVLVXgQG0XCEKjZLRnO5OP9++A6ZOJKMOVWhqb5zU/E2mPNpMcjHyV+nXi+chMgZZ2uQyy3SpHwk fu07sEpIg/AktoD8hf3XHr/W7/w5HR+ySnXvaLkcFIB84eu3w75NJJ+gd8bx29QL6GMQsWarw3aX9 pbYKp1XljF1kaCtQihVu91WtzJQbAo3P096tjfBH+MscAcgGJ1w05f2h8jIBwescW7WMYwBdDmLGQ h/Ii1W/jld4sVDlBUDCA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpZxm-0000000B284-23RG; Wed, 27 Mar 2024 20:33:34 +0000 Received: from mgamail.intel.com ([192.198.163.8]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpZ02-0000000Ant0-2Jsi for linux-arm-kernel@lists.infradead.org; Wed, 27 Mar 2024 19:31:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711567909; x=1743103909; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=szcPeNpPGwcpTv/vYr7M/HOPTxqfODzCAhPTU5Lf2p8=; b=Z/fjIPQG9SAbst5qv93lkOoEhG9vHltfJY7slhW7IlkIc0bxlFEhaz+L afaD8QVt8/D15WsoybpM3OMvyUF8OgdgAsWM6XdDy/DEXYNsAYU6HeLv3 fjPMoD63oJlBvsk/kNF+oxGyTK8oXoEPUeUJVzCF8VhRk41hxonbOWfGK G/XSSWTvMH6YstfwkD+9XRmsMqWmcWZxHPG1eTYiMBlaWeoXzgnLpcx0t oV891Kcebr3ek0slet4p61ZfCpxorvuIHMy9t6V2pX87qE2ghkzu54tAI LDDklGHehDGQ9hJreFrK1gzUuurj2Fd6Ba5EljiGONJ60/tMlVxkWIvnf Q==; X-CSE-ConnectionGUID: nmCnnMRzTj2ugvp5CWkEog== X-CSE-MsgGUID: eLV1qazXQzGK2oGgsHnmwQ== X-IronPort-AV: E=McAfee;i="6600,9927,11026"; a="24187278" X-IronPort-AV: E=Sophos;i="6.07,159,1708416000"; d="scan'208";a="24187278" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2024 12:31:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11026"; a="937075022" X-IronPort-AV: E=Sophos;i="6.07,159,1708416000"; d="scan'208";a="937075022" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 27 Mar 2024 12:31:43 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 85059284; Wed, 27 Mar 2024 21:31:42 +0200 (EET) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Russell King Subject: [PATCH v2 1/9] spi: pxa2xx: Narrow the Kconfig option visibility Date: Wed, 27 Mar 2024 21:29:20 +0200 Message-ID: <20240327193138.2385910-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240327193138.2385910-1-andriy.shevchenko@linux.intel.com> References: <20240327193138.2385910-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-20240327_123150_641409_E1CF8FC2 X-CRM114-Status: GOOD ( 14.68 ) 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 PCI || ACPI dependency is the historical part of the x86 support. Narrow the Kconfig option visibility by limiting this dependency to x86. The drop of x86 for PCI case had happened in the commit 2b49ebda39d6 ("spi/pxa2xx: allow building on a 64-bit kernel"), while the ACPI was specifically added for Intel Lynx Point in the commit a3496855d9f1 ("spi/pxa2xx: add support for Lynxpoint SPI controllers"). Note that X86 covers both 32- and 64-bit variants. Suggested-by: Mark Brown Signed-off-by: Andy Shevchenko --- drivers/spi/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 26ba34a4100b..c1bb1895009c 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig @@ -817,7 +817,7 @@ config SPI_PPC4xx config SPI_PXA2XX tristate "PXA2xx SSP SPI master" - depends on ARCH_PXA || ARCH_MMP || PCI || ACPI || COMPILE_TEST + depends on ARCH_PXA || ARCH_MMP || (X86 && (PCI || ACPI)) || COMPILE_TEST select PXA_SSP if ARCH_PXA || ARCH_MMP help This enables using a PXA2xx or Sodaville SSP port as a SPI master From patchwork Wed Mar 27 19:29:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13607352 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 D67BEC54E67 for ; Wed, 27 Mar 2024 19:33:12 +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=Q6T8LLykyKtd5YOSu6pZ2SEw8M/6fN1f0su4QeQu5IY=; b=o4H4iNRR1hWm9v tCsRvbQtgAnylg1dZ25uLu9snYgx75Tew8/6cG3RRfHaqx9H+9FaUt86J5GV0kP8ninI6wDYAM/Vl qKvEHBJbfbw5qU5Y0jooTGwohBb3TYqUR2augWv2KIINUyxGPS3WBs/9QNNB6MHds3Q66i3i6PCPB cY/ke3tqrrcbjiCWGHbdoUcrf1qgcXBQsDDargE6Dx2qs6p4YO+VlklDwIPR15EjhHmMdM7xWXYpa vt3Z1M3bGpemkEDSxrs65DMz9el+gQ6p/pf4ESyCp2hLcSvt094QZGyf0B9Oij2M8biEAmf0uZoqI 0UzusPe98im5SkRJFfkw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpZ1B-0000000AoNk-3Yq6; Wed, 27 Mar 2024 19:33:01 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpZ0B-0000000Anx1-3LOl for linux-arm-kernel@bombadil.infradead.org; Wed, 27 Mar 2024 19:31:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=8EPDIc/QHS4XXGtiAfNHjPzn4OzvA+ixVgjZ9o3y0A8=; b=Iz/2+cMAC5CJaqHdCvVwVtW8mk byEoHER8GgBnbnjktfdW2l3OGxgLZJtYRDDG3Bt66YFAscQu5wd/dRkrOnIGyY9Ua+ztGQg6RtMxk gksIlM9SffTRpvRA8Ymnv3ZfpKFrU5CEx9O0pEH5fmu5qFKkRDPOnNBg5YCXDyUOF71I2up3WLrNg mT5flqpT9sziFASguNv+QSMwubjZ6nlBW9KIBvsxJNVOmViAIIffV8Elw0nEvG+4914Kak9tr6ljn g/leOhprp4sikuG5DVuRbHGwGT5f748XxKzP6iVOfFgWZUf5jC7hGIleHSLUt3Xn+wtgIV424kmTV UxRLP+tg==; Received: from mgamail.intel.com ([192.198.163.8]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpZ08-00000000VvU-1Mt4 for linux-arm-kernel@lists.infradead.org; Wed, 27 Mar 2024 19:31:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711567915; x=1743103915; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kgE+EkgRK0Q0USsISvasAwmIHSRztSfu+eyxHqW1wf8=; b=kkPfgXyabTzh/fls3Nzmguk1lIYWtSkTAi8eljgntlVumPbCho+O5+ie +wY2Ck+/eyoIokgjXIVoyI+7xmsDa0/c69mtKQMWlmoojqYrbKJ4I31K2 vXbard91XB15xQNb9sPqTAKOEQscrLZjzh5khETbFK3r60Avc0e5Kk4Us rhvK5+WAnwbU4f/9cV2JD+FYxoc186r61Tw99zs2rvJSIs3sH/BIvRWt5 1NN0A9Nssbs1SbfmZ9YlLPfm/Taz2AhOAzYoTrYQGhlrbgUDgByx77g2Y 1Mb7ssp7liqzSgmc4IOtzNwsuGw2XriLxj9d7OVaiM/MyTeIwTrONPwpN A==; X-CSE-ConnectionGUID: wtnb6q5ISDeON42OyaQVqw== X-CSE-MsgGUID: lKekpQRHQsGJqI3VZdjZ3g== X-IronPort-AV: E=McAfee;i="6600,9927,11026"; a="24187299" X-IronPort-AV: E=Sophos;i="6.07,159,1708416000"; d="scan'208";a="24187299" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2024 12:31:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11026"; a="937075026" X-IronPort-AV: E=Sophos;i="6.07,159,1708416000"; d="scan'208";a="937075026" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 27 Mar 2024 12:31:43 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 982124F6; Wed, 27 Mar 2024 21:31:42 +0200 (EET) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Russell King Subject: [PATCH v2 2/9] spi: pxa2xx: Drop ACPI_PTR() and of_match_ptr() Date: Wed, 27 Mar 2024 21:29:21 +0200 Message-ID: <20240327193138.2385910-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240327193138.2385910-1-andriy.shevchenko@linux.intel.com> References: <20240327193138.2385910-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-20240327_193156_890462_88BE2BA8 X-CRM114-Status: GOOD ( 15.01 ) 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 Drop rather useless use of ACPI_PTR() and of_match_ptr(). It also removes the necessity to be dependent of.h inclusion. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 1d43346b4436..75d208087748 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -1725,7 +1724,6 @@ static const struct dev_pm_ops pxa2xx_spi_pm_ops = { RUNTIME_PM_OPS(pxa2xx_spi_runtime_suspend, pxa2xx_spi_runtime_resume, NULL) }; -#ifdef CONFIG_ACPI static const struct acpi_device_id pxa2xx_spi_acpi_match[] = { { "80860F0E", LPSS_BYT_SSP }, { "8086228E", LPSS_BSW_SSP }, @@ -1736,9 +1734,8 @@ static const struct acpi_device_id pxa2xx_spi_acpi_match[] = { {} }; MODULE_DEVICE_TABLE(acpi, pxa2xx_spi_acpi_match); -#endif -static const struct of_device_id pxa2xx_spi_of_match[] __maybe_unused = { +static const struct of_device_id pxa2xx_spi_of_match[] = { { .compatible = "marvell,mmp2-ssp", .data = (void *)MMP2_SSP }, {} }; @@ -1748,8 +1745,8 @@ static struct platform_driver driver = { .driver = { .name = "pxa2xx-spi", .pm = pm_ptr(&pxa2xx_spi_pm_ops), - .acpi_match_table = ACPI_PTR(pxa2xx_spi_acpi_match), - .of_match_table = of_match_ptr(pxa2xx_spi_of_match), + .acpi_match_table = pxa2xx_spi_acpi_match, + .of_match_table = pxa2xx_spi_of_match, }, .probe = pxa2xx_spi_probe, .remove_new = pxa2xx_spi_remove, From patchwork Wed Mar 27 19:29:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13607417 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 694D3CD1283 for ; Wed, 27 Mar 2024 20:33:42 +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=pm5g+rJ/mY9kR6AnrdYmMkJCj1zScTJ/9nUoIHeUvh4=; b=OQLUeQMl65jS9Z mPfEbHxgeOLP/J0pbhdVCpVG8M3Ykui3moLk1Texpj40nXeLR6Nee8NG0P1TWTiIYm5vGfOLDvARk dCWpQOjjgA5dmycr4i363cQ+hIDsyMy0CfAM8vW4cPAYrJdpj35vE9ZOU9EfcB1Xc9uInR8TEYp/k JZSpWE+fJRDBj3ZE7XTZT8cO1CkA8bg/QlVd9riGr/Vcrll1QTiX2S1djwD3MV+Z1s5TbuekWRyZq Hbonm7mtlWuGovPICn4sxpCSuuzpRj4iE4Nc662d9BRI7RjeJglDx2+SxcQebMlAuK/pyhMdUVEfV gHXZ7mALSmruYKhX2m0A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpZxi-0000000B25L-36Sy; Wed, 27 Mar 2024 20:33:30 +0000 Received: from mgamail.intel.com ([192.198.163.8]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpZ00-0000000AnsF-03Sx for linux-arm-kernel@lists.infradead.org; Wed, 27 Mar 2024 19:31:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711567907; x=1743103907; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/NCY6D6sJSA8qtx+EX1W99OV2q8Lk5IqUKEVfKBSw0Q=; b=QFxRqLOFuqgKT47gok+WMxvKcaKadBlNoCxq5VZeKVDUW17pK/+woGsT PTOBd7rb4uS0wmXagB6ndaTOdrxnC8y5h9tyvEzTV7kv6JfH7xYTkZeEE fTQbmmiGokoi/JCqZii/TTyKrPyT8apf2keTz7/FmITI62kslb197slSJ tinvmbuxfqvmzet22BWH7x698buHrkbkRB6ChyFvZi27baYvdDbAc5F8y 5MGT/C8heqVuRMRUzLaD+JKi8DO6VY3/TDL1nomlF41ZrZsStYV8349Ug WayoQxeMYDLGaRuU1MUNihfw4lFwNhSYGcL9d/iFI99taijNIsBX3/9Q5 g==; X-CSE-ConnectionGUID: bf/Le2wBQxOQxwEWoy7lfQ== X-CSE-MsgGUID: 3mkYbBqSSMaUmEDzFrBbmA== X-IronPort-AV: E=McAfee;i="6600,9927,11026"; a="24187284" X-IronPort-AV: E=Sophos;i="6.07,159,1708416000"; d="scan'208";a="24187284" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2024 12:31:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11026"; a="937075025" X-IronPort-AV: E=Sophos;i="6.07,159,1708416000"; d="scan'208";a="937075025" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 27 Mar 2024 12:31:43 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id A15722F0; Wed, 27 Mar 2024 21:31:42 +0200 (EET) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Russell King Subject: [PATCH v2 3/9] spi: pxa2xx: Extract pxa2xx_spi_init_ssp() helper Date: Wed, 27 Mar 2024 21:29:22 +0200 Message-ID: <20240327193138.2385910-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240327193138.2385910-1-andriy.shevchenko@linux.intel.com> References: <20240327193138.2385910-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-20240327_123148_102027_F1E95FBD X-CRM114-Status: GOOD ( 16.94 ) 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 Refactor pxa2xx_spi_init_pdata() by extracting a new pxa2xx_spi_init_ssp() helper which makes code less twisted. It will be easier to continue refactoring for a new coming modification. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx.c | 66 +++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 28 deletions(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 75d208087748..e7072727c25c 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1314,19 +1314,50 @@ 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; - struct ssp_device *ssp; - struct resource *res; enum pxa_ssp_type type = SSP_UNDEFINED; const void *match; bool is_lpss_priv; int status; - u64 uid; is_lpss_priv = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lpss_priv"); @@ -1351,14 +1382,6 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) if (!pdata) return ERR_PTR(-ENOMEM); - ssp = &pdata->ssp; - - ssp->mmio_base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); - if (IS_ERR(ssp->mmio_base)) - return ERR_CAST(ssp->mmio_base); - - ssp->phys_base = res->start; - /* Platforms with iDMA 64-bit */ if (is_lpss_priv) { pdata->tx_param = parent; @@ -1366,28 +1389,15 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) pdata->dma_filter = pxa2xx_spi_idma_filter; } - ssp->clk = devm_clk_get(dev, NULL); - if (IS_ERR(ssp->clk)) - return ERR_CAST(ssp->clk); - - ssp->irq = platform_get_irq(pdev, 0); - if (ssp->irq < 0) - return ERR_PTR(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; - pdata->is_target = device_property_read_bool(dev, "spi-slave"); pdata->num_chipselect = 1; pdata->enable_dma = true; pdata->dma_burst_size = 1; + status = pxa2xx_spi_init_ssp(pdev, &pdata->ssp, type); + if (status) + return ERR_PTR(status); + return pdata; } From patchwork Wed Mar 27 19:29:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13607418 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 16573C54E67 for ; Wed, 27 Mar 2024 20:33:46 +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=Y4tNNOADDh1Nc+PFy+C6TOZQ8S4d4R6o8UCKnxi81w4=; b=SEMvQQ7ZDUgRa6 k16/h4AblzWrqauBPcWh/7X4/pbXvxl6qna8ALsgPsjJfghgUVS0DaG+t9q7KnVUkOPURMsdyxZsV YpZxkGyQD+KDtE3tIzhzpP4pz59i5z3WwvB63KpILj+aPLLOZJlJeoXOPlAG6mNNOYyEFGQ0iqHPh 8EsqiVZ+nRHi/v5VP0bO3WaWEGisRtzv1xN70GpRC/msFP6Cqvpw/urhTGMH/cqNF+Oe6zhJBdnvU cMCS+32bgUtsVmq5QpiRWX9LaTYCHYRnatPtIP/hCVNInV8s4YOBHgGaOQnWO6ENbnGgbk1RC1Wfg NYrQXOQ5tYrk5pKLD25Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpZxk-0000000B26S-11jc; Wed, 27 Mar 2024 20:33:32 +0000 Received: from mgamail.intel.com ([192.198.163.8]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpZ02-0000000AnsF-22jg for linux-arm-kernel@lists.infradead.org; Wed, 27 Mar 2024 19:31:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711567909; x=1743103909; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jFzgo5+g95yyxQjjsoDzp1sVeyMA6hDbVV6LnWCwoqk=; b=SF+XflXmuBkbet4ftEMXMWxInBSFXpIZ5EETV2+fO9H7iCCPD14lqAAT q4UDLdkINK7C3tsgL5zSMuJyFnvKyfLXJ8pSDMrn41jqcpPZW9wIDBQrh t0sVkQKghEpkEYGSWFbW5qifpR0EwKTs8a3bDcGaX+D31eDOAU+3fQycr s+DYyzZRIUi7wy1fi7cMGnNAheNSf5LBPmQ4EupiMF6P15ekxv07FmS4+ GpYTErGmbBarB8T2x9gXg11hZ8+6pIMmh646hieWtw8MOPrr5hTt2DeyV XiGoEXt+Gz5rVavLKa+9SYcSxlYsUIR7NVrlyO6Uha96o/m/0H5BJp59I w==; X-CSE-ConnectionGUID: UpnCm92EQmq0d4maehEkWQ== X-CSE-MsgGUID: fEZrK3HrQn2JXr9Ii87A9Q== X-IronPort-AV: E=McAfee;i="6600,9927,11026"; a="24187292" X-IronPort-AV: E=Sophos;i="6.07,159,1708416000"; d="scan'208";a="24187292" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2024 12:31:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11026"; a="937075024" X-IronPort-AV: E=Sophos;i="6.07,159,1708416000"; d="scan'208";a="937075024" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 27 Mar 2024 12:31:43 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id AB9E9524; Wed, 27 Mar 2024 21:31:42 +0200 (EET) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Russell King Subject: [PATCH v2 4/9] spi: pxa2xx: Skip SSP initialization if it's done elsewhere Date: Wed, 27 Mar 2024 21:29:23 +0200 Message-ID: <20240327193138.2385910-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240327193138.2385910-1-andriy.shevchenko@linux.intel.com> References: <20240327193138.2385910-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-20240327_123150_557679_0B3A9BC6 X-CRM114-Status: GOOD ( 13.91 ) 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 If SSP has been enumerated elsewhere, skip its initialization in pxa2xx_spi_init_pdata(). Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index e7072727c25c..b01a18c89b6b 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1355,6 +1355,7 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) struct device *dev = &pdev->dev; struct device *parent = dev->parent; enum pxa_ssp_type type = SSP_UNDEFINED; + struct ssp_device *ssp = NULL; const void *match; bool is_lpss_priv; int status; @@ -1372,6 +1373,10 @@ 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; } /* Validate the SSP type correctness */ @@ -1394,6 +1399,10 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) 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); From patchwork Wed Mar 27 19:29:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13607351 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 CC975C47DD9 for ; Wed, 27 Mar 2024 19:32: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=TnqONOxYBp8QiZSkoLreA+8YcYMt4V1w/9sg5yzKhy0=; b=OHbmnXOvg/DObp Ob3AElMCPxsRUcIroDr2Qt++BvjPBGe8gKA1EDZt5x5XFECjFu5eYjOG/9drhIyxWvK/1yBrKYSNH yobdb5uqxV6oDL06296TTzw8sTFPI3nKtH3qX1LtUHJ6CncYs/mtm9wEQ1CKMwPBn/rr/Sfkx3CA8 quXOZwlulLZugENt60MzbIrSW+hFrmoEq4L5QeUQHgqs1g7ismB0TTqJMqrF+Ajg4tlezWpWFDRSr +ZdMaBC/TR9QKSoU2f7zuWvcq550nsQkqmNamzoLwVXZQpyUCuxQ0MJcIvt10VXEYBLTE5ekeFeOW TCvKKyAo5WOrvU9LAlRg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpZ0C-0000000Anxg-3JDI; Wed, 27 Mar 2024 19:32:00 +0000 Received: from mgamail.intel.com ([192.198.163.8]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpZ04-0000000Ant0-2Bw6 for linux-arm-kernel@lists.infradead.org; Wed, 27 Mar 2024 19:31:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711567911; x=1743103911; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lzLjtivrQxAS+WqTg89dinGS46hcsyGbp0QSkCiy2Ns=; b=AyPdyXlTLnKPOBGSoGxkwyvuzYWgJIfpSLWkrNGI7X2ofbEl8yKDibdr PjHunm16pxB7AVQyVINvSwDQ2jGaRHbbEGkznJSBkNCtIZ17YRHytQut4 8eDMYwyK9hwOMRUDm8LGvIvFOUGgKkQ1huvGuL09U6gbr7hWr28PVCmav mOvpypQ6bUXFBnKkE8S8iTSeY7aBDSUf0LesCpAUGoetsm8tOOSWdlRBv aDFB+PZ6eMpnUXFpxDnKVuJFv8yAVyI6SS2g2ZGZDxGOrcBo1bVnodGt1 4vjQ2zv+UK0N06uYif27cEy7Ye7+1zJV+09dLcZNVRKw8wkwPxOVi0lYV g==; X-CSE-ConnectionGUID: +O5XeOiTRCyZTQKsnnP4Eg== X-CSE-MsgGUID: +i/NyDErQFixEt9uxpgs8g== X-IronPort-AV: E=McAfee;i="6600,9927,11026"; a="24187332" X-IronPort-AV: E=Sophos;i="6.07,159,1708416000"; d="scan'208";a="24187332" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2024 12:31:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11026"; a="937075028" X-IronPort-AV: E=Sophos;i="6.07,159,1708416000"; d="scan'208";a="937075028" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 27 Mar 2024 12:31:46 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id C04E2643; Wed, 27 Mar 2024 21:31:42 +0200 (EET) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Russell King Subject: [PATCH v2 5/9] spi: pxa2xx: Allow number of chip select pins to be read from property Date: Wed, 27 Mar 2024 21:29:24 +0200 Message-ID: <20240327193138.2385910-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240327193138.2385910-1-andriy.shevchenko@linux.intel.com> References: <20240327193138.2385910-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-20240327_123152_818829_40149B3D X-CRM114-Status: GOOD ( 13.36 ) 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 some cases the number of the chip select pins might come from the device property. Allow driver to use it. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index b01a18c89b6b..f4435c39d096 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1358,6 +1358,7 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) 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"); @@ -1394,8 +1395,11 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) 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->num_chipselect = 1; pdata->enable_dma = true; pdata->dma_burst_size = 1; From patchwork Wed Mar 27 19:29:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13607421 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 2E770C47DD9 for ; Wed, 27 Mar 2024 20:33:53 +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=a8KdNOCHSrr17O6Zih7GhnUSxOfZrkYtWAMiYbJSWhc=; b=ZEW8i0KKez/0WY e7ehWPMuWeBm0XgvjN9IX12ygsIE6tO7gDcIRGcinSpLmlSqWgmy/AXyCRlRMIol+hsOiqYIcUuNv BwPEMd7Lm4OihxlMcN+kf3J/H3TPxN7NM7UPoQcD36kUVmH8tymVfB8Y4u86G1Nh+3E45xT2JNidl zUPyxORyfL7ohQ2zYOD+dA4lKaDUHM8jTKByu/WMrU/3fVFmJBxGQSB1PZ6dtq5yseeQbkXAkMmzX GRD9Ap0zKtPu9pszZlJe69Ip6KRB/cpFnlGO4saCnxUfZB91qZS8z0pp2UksoJw1nUM6aGbhkh4tP hCh9EeHYhVO4lrU5Qh/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpZxr-0000000B2C9-2aNe; Wed, 27 Mar 2024 20:33:39 +0000 Received: from mgamail.intel.com ([192.198.163.8]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpZ06-0000000Ant0-0Y8z for linux-arm-kernel@lists.infradead.org; Wed, 27 Mar 2024 19:31:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711567913; x=1743103913; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=H2+f29cgQEQ3T7alzF7pBJizvVEK6UHSDOHh2UhgE0c=; b=cuj56AuFkpoYzgMnWF6s04XD6YhwK2Nakx9Q4xiQFZMEdPHIID7fwvnK 3nI++aE2NbFAtbRNStVxWuY2MCRcatBn13BL8SnwKQ/FRG0TOnA8uX8Xx 1K2+nyQTyXDbo3xH8rOwd1m8FZM5CIVCh2SxKVhs/P99HSa6NxSWXDZJX 731UTPHddzYdei+ln8T3EI7R+aLwJuHAZVAXL/3pdftoitD8LztIhvHaA PQcwun/kWXxNFpKRuE/Sylyc9VAMWhlAwqsU7J7OL1245BkfKZF8SZXbT wsPepIDez4PQFOuFCpqHKmKoq975Wk4L0f4B34FBuL+hkx5VYtuLpsuP7 A==; X-CSE-ConnectionGUID: h8qwViukQsazd0LBzon34g== X-CSE-MsgGUID: fKTzjtTqQEmsJF/gyJ0UqA== X-IronPort-AV: E=McAfee;i="6600,9927,11026"; a="24187326" X-IronPort-AV: E=Sophos;i="6.07,159,1708416000"; d="scan'208";a="24187326" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2024 12:31:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11026"; a="937075027" X-IronPort-AV: E=Sophos;i="6.07,159,1708416000"; d="scan'208";a="937075027" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 27 Mar 2024 12:31:46 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id C5F135A8; Wed, 27 Mar 2024 21:31:42 +0200 (EET) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Russell King Subject: [PATCH v2 6/9] spi: pxa2xx: Provide num-cs for Sharp PDAs via device properties Date: Wed, 27 Mar 2024 21:29:25 +0200 Message-ID: <20240327193138.2385910-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240327193138.2385910-1-andriy.shevchenko@linux.intel.com> References: <20240327193138.2385910-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-20240327_123154_273341_D8C24D0D X-CRM114-Status: GOOD ( 20.30 ) 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 driver can parse num-cs device property, replace platform data with this new approach. This pursues the following objectives: - getting rid of the public header that barely used outside of the SPI subsystem (more specifically the SPI PXA2xx drivers) - making a trampoline for the driver to support non-default number of the chip select pins in case the original code is going to be converted to Device Tree model It's not expected to have more users in board files except this one. Signed-off-by: Andy Shevchenko --- arch/arm/mach-pxa/spitz.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 318402ad685e..3c5f5a3cb480 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -18,10 +18,10 @@ #include #include #include +#include #include #include #include -#include #include #include #include @@ -569,10 +569,6 @@ static struct spi_board_info spitz_spi_devices[] = { }, }; -static struct pxa2xx_spi_controller spitz_spi_info = { - .num_chipselect = 3, -}; - static struct gpiod_lookup_table spitz_spi_gpio_table = { .dev_id = "spi2", .table = { @@ -583,10 +579,20 @@ static struct gpiod_lookup_table spitz_spi_gpio_table = { }, }; +static const struct property_entry spitz_spi_properties[] = { + PROPERTY_ENTRY_U32("num-cs", 3), + { } +}; + +static const struct software_node spitz_spi_node = { + .properties = spitz_spi_properties, +}; + static void __init spitz_spi_init(void) { struct platform_device *pd; int id = 2; + int err; if (machine_is_akita()) gpiod_add_lookup_table(&akita_lcdcon_gpio_table); @@ -601,8 +607,13 @@ static void __init spitz_spi_init(void) if (pd == NULL) { pr_err("pxa2xx-spi: failed to allocate device id %d\n", id); } else { - pd->dev.platform_data = &spitz_spi_info; - platform_device_add(pd); + err = device_add_software_node(&pd->dev, &spitz_spi_node); + if (err) { + platform_device_put(pd); + pr_err("pxa2xx-spi: failed to add software node\n"); + } else { + platform_device_add(pd); + } } spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); From patchwork Wed Mar 27 19:29:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13607420 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 0E12AC54E67 for ; Wed, 27 Mar 2024 20:33:52 +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=mJE/ZpVnMseIb2y6565MzhYIjlebZ3Th5kdXZ4SbvPQ=; b=SHsSaAwL03pgHg vLJtSMkUAMKU/Ic3pfkBAFqNgC/HedYgw+TNpJtfbeZ3mFu9Ktxz2QlUJk05AUcbo6+vNHOZnJScv QeQ/JZAP5oUn/k1aIoh2LVlKRq1NXyJxlvAPoQO/aNeat/MmbpRG3uizuisAz4W7SxytI41LfQ7lj FkqJCuIZUk8KZnYLFL75T1wpLVCaJk8zYrKsk2k5dyGmq/tZK2G+/80TP26fldZB/aFON9KErVN/U 7R6JH17qyeDsjVvrfyWAtnGHFgenw+57m2mUkrYl9xX6p8gQPZDgIg0+XUwTCKBLcJVPiT2sAvAXi Ma4MmkL40zull5HxIl8A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpZxp-0000000B2Av-3K2n; Wed, 27 Mar 2024 20:33:37 +0000 Received: from mgamail.intel.com ([192.198.163.8]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpZ06-0000000AnsF-0OGc for linux-arm-kernel@lists.infradead.org; Wed, 27 Mar 2024 19:31:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711567913; x=1743103913; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=y3OFV8ojkqypOZZ1eY8yTN0O6AaepbldILI9QHFUGRI=; b=X1K+kzgq7Tw+kaZTOp5tG0Qu6eKu9pEuaz6bQxUHwQ77uBlOYVvNLikc EJhPJvgV1NCYH4dIN44/T1+m43LCnThovKFvAZRKmyeXC+/PJHrdLFQJt mUiyMepbLAppEcui5j8CEPv6zce5Pusjk4MppvmyiUuyQTgwZNkjiavys 9R1CsCJIeszIPGOawMMxPo1L9rcrDktV/isF90HE0zlSCTWaXYMp+Ykhv U+ZvQgXliX2LBRaDSlOKJkKs0bH3yRUqa+nNx0zJrAicsoB3DOxkl5FaO ByfTnJiApNIbolZoPsfFGD5oN5nKJ7FVFjhvsi4d2dcTZGO+DdFCaaA+7 A==; X-CSE-ConnectionGUID: nQKGzXUDT96f45y3myPlYg== X-CSE-MsgGUID: HifX0gzVRMqROwb/Yeh0kg== X-IronPort-AV: E=McAfee;i="6600,9927,11026"; a="24187345" X-IronPort-AV: E=Sophos;i="6.07,159,1708416000"; d="scan'208";a="24187345" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2024 12:31:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11026"; a="937075029" X-IronPort-AV: E=Sophos;i="6.07,159,1708416000"; d="scan'208";a="937075029" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 27 Mar 2024 12:31:46 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id CFD966AF; Wed, 27 Mar 2024 21:31:42 +0200 (EET) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Russell King , Arnd Bergmann Subject: [PATCH v2 7/9] spi: pxa2xx: Move contents of linux/spi/pxa2xx_spi.h to a local one Date: Wed, 27 Mar 2024 21:29:26 +0200 Message-ID: <20240327193138.2385910-8-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240327193138.2385910-1-andriy.shevchenko@linux.intel.com> References: <20240327193138.2385910-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-20240327_123154_223835_B5627E24 X-CRM114-Status: GOOD ( 18.35 ) 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 There is no user of the linux/spi/pxa2xx_spi.h. Move its contents to the drivers/spi/spi-pxa2xx.h. Suggested-by: Arnd Bergmann Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx-dma.c | 1 - drivers/spi/spi-pxa2xx-pci.c | 4 +-- drivers/spi/spi-pxa2xx.c | 1 - drivers/spi/spi-pxa2xx.h | 36 ++++++++++++++++++++++++- include/linux/spi/pxa2xx_spi.h | 48 ---------------------------------- 5 files changed, 37 insertions(+), 53 deletions(-) delete mode 100644 include/linux/spi/pxa2xx_spi.h diff --git a/drivers/spi/spi-pxa2xx-dma.c b/drivers/spi/spi-pxa2xx-dma.c index be563f0dd03a..26416ced6505 100644 --- a/drivers/spi/spi-pxa2xx-dma.c +++ b/drivers/spi/spi-pxa2xx-dma.c @@ -12,7 +12,6 @@ #include #include -#include #include #include "spi-pxa2xx.h" diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c index 861b21c63504..e11a613bc340 100644 --- a/drivers/spi/spi-pxa2xx-pci.c +++ b/drivers/spi/spi-pxa2xx-pci.c @@ -10,11 +10,11 @@ #include #include -#include - #include #include +#include "spi-pxa2xx.h" + #define PCI_DEVICE_ID_INTEL_QUARK_X1000 0x0935 #define PCI_DEVICE_ID_INTEL_BYT 0x0f0e #define PCI_DEVICE_ID_INTEL_MRFLD 0x1194 diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index f4435c39d096..e22d9d29c7e9 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -24,7 +24,6 @@ #include #include -#include #include #include "spi-pxa2xx.h" diff --git a/drivers/spi/spi-pxa2xx.h b/drivers/spi/spi-pxa2xx.h index 45cdbbc71c4b..08296729ea80 100644 --- a/drivers/spi/spi-pxa2xx.h +++ b/drivers/spi/spi-pxa2xx.h @@ -7,6 +7,7 @@ #ifndef SPI_PXA2XX_H #define SPI_PXA2XX_H +#include #include #include #include @@ -15,7 +16,40 @@ #include struct gpio_desc; -struct pxa2xx_spi_controller; + +/* + * The platform data for SSP controller devices + * (resides in device.platform_data). + */ +struct pxa2xx_spi_controller { + u8 num_chipselect; + u8 enable_dma; + u8 dma_burst_size; + bool is_target; + + /* DMA engine specific config */ + dma_filter_fn dma_filter; + void *tx_param; + void *rx_param; + + /* For non-PXA arches */ + struct ssp_device ssp; +}; + +/* + * The controller specific data for SPI target devices + * (resides in spi_board_info.controller_data), + * copied to spi_device.platform_data ... mostly for + * DMA tuning. + */ +struct pxa2xx_spi_chip { + u8 tx_threshold; + u8 tx_hi_threshold; + u8 rx_threshold; + u8 dma_burst_size; + u32 timeout; +}; + struct spi_controller; struct spi_device; struct spi_transfer; diff --git a/include/linux/spi/pxa2xx_spi.h b/include/linux/spi/pxa2xx_spi.h deleted file mode 100644 index e5a4a045fb67..000000000000 --- a/include/linux/spi/pxa2xx_spi.h +++ /dev/null @@ -1,48 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Copyright (C) 2005 Stephen Street / StreetFire Sound Labs - */ -#ifndef __LINUX_SPI_PXA2XX_SPI_H -#define __LINUX_SPI_PXA2XX_SPI_H - -#include -#include - -#include - -struct dma_chan; - -/* - * The platform data for SSP controller devices - * (resides in device.platform_data). - */ -struct pxa2xx_spi_controller { - u8 num_chipselect; - u8 enable_dma; - u8 dma_burst_size; - bool is_target; - - /* DMA engine specific config */ - dma_filter_fn dma_filter; - void *tx_param; - void *rx_param; - - /* For non-PXA arches */ - struct ssp_device ssp; -}; - -/* - * The controller specific data for SPI target devices - * (resides in spi_board_info.controller_data), - * copied to spi_device.platform_data ... mostly for - * DMA tuning. - */ -struct pxa2xx_spi_chip { - u8 tx_threshold; - u8 tx_hi_threshold; - u8 rx_threshold; - u8 dma_burst_size; - u32 timeout; -}; - -#endif /* __LINUX_SPI_PXA2XX_SPI_H */ From patchwork Wed Mar 27 19:29:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13607530 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 56C94C54E67 for ; Wed, 27 Mar 2024 21:48:29 +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=NdfMWcrkryND51Od4bCEAOIkmnG1bryBx62En4XPGp8=; b=gqfs8yWaY+QYFt VNgUS6wWXb5VT7X62jvzVtGgBn7vhnwHk+wAHCPsyeyyajQGgFYFsHkLFt3w/CrLy0MXikZ2gBuZ0 /I6d6XLn7EW9n60BCbfiRryI4TkuRRUysD3EDWmTHWwFVz/bx0o76AVAQkTn+P3OA5bGokR3DixXj LCuXbXJ5wWXpmfmu8ZVSez1v5fxM7C19JbP+JAxhA7TXte3jnaFzGk6FWLKkg2w/gOaXe/UCnTIn1 J6kaR+96REksAj+X6hKRNQZI0GrWtaPj4MhaI6/p/hQ39ZaGq+UHpSHXxEs11WdF1j31HMwVAVwhJ z6MySF7foqpA+lLAzpmQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpb8G-0000000BHvj-2vQK; Wed, 27 Mar 2024 21:48:28 +0000 Received: from mgamail.intel.com ([192.198.163.8]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpZ07-0000000AnsF-20bB for linux-arm-kernel@lists.infradead.org; Wed, 27 Mar 2024 19:31:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711567914; x=1743103914; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/BHAdaF+s+CWPuV02pEylhhQSEZjjV8zTiRovVO1XXs=; b=hIjQmGZT2JvA6Xvpgjq+HMTUPrJWlru7YZbQFKEBnAdWRJ9t0Dojp6oX XH58JQ0Sd2yvj1Qi5FiJqBmL5QkLYeYbocb8UTNQ++VR/w64znEOk4cRO J9HbBbera9QHNTqRBi59PYZy1TYhJ9Z+mYqglZosPa7K0/Nvxj2gUxOde 9AXLuwe96UeJzphevg45OibqlYPINREfvMCmuDk1GwfZGbSauXwpvcxtl NwjtU55nFpmIIqvBKFTJ+4X2mmYlNv0UeaOhUoj2X7C9gdmscaTmycQvN 0n+jqUVJOmYUJbDlnXr6Ad28wWlYLZW2RiR0jkQRbM50KLAQtAmsFiI2j g==; X-CSE-ConnectionGUID: VfUnPJvCSIKhJ3aqN3PoPQ== X-CSE-MsgGUID: 04te7l/9Rxu2ZKNwrD6kPw== X-IronPort-AV: E=McAfee;i="6600,9927,11026"; a="24187339" X-IronPort-AV: E=Sophos;i="6.07,159,1708416000"; d="scan'208";a="24187339" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2024 12:31:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11026"; a="937075030" X-IronPort-AV: E=Sophos;i="6.07,159,1708416000"; d="scan'208";a="937075030" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 27 Mar 2024 12:31:46 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id DB2867C4; Wed, 27 Mar 2024 21:31:42 +0200 (EET) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Russell King Subject: [PATCH v2 8/9] spi: pxa2xx: Remove outdated documentation Date: Wed, 27 Mar 2024 21:29:27 +0200 Message-ID: <20240327193138.2385910-9-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240327193138.2385910-1-andriy.shevchenko@linux.intel.com> References: <20240327193138.2385910-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-20240327_123155_664644_AFD5C98B X-CRM114-Status: GOOD ( 35.60 ) 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 documentation is referring to the legacy enumeration of the SPI host controllers and target devices. It has nothing to do with the modern way, which is the only supported in kernel right now. Hence, remove outdated documentation file. Signed-off-by: Andy Shevchenko --- Documentation/spi/pxa2xx.rst | 208 ----------------------------------- drivers/spi/Kconfig | 3 +- 2 files changed, 1 insertion(+), 210 deletions(-) delete mode 100644 Documentation/spi/pxa2xx.rst diff --git a/Documentation/spi/pxa2xx.rst b/Documentation/spi/pxa2xx.rst deleted file mode 100644 index 33d2ad95901e..000000000000 --- a/Documentation/spi/pxa2xx.rst +++ /dev/null @@ -1,208 +0,0 @@ -============================== -PXA2xx SPI on SSP driver HOWTO -============================== - -This a mini HOWTO on the pxa2xx_spi driver. The driver turns a PXA2xx -synchronous serial port into an SPI host controller -(see Documentation/spi/spi-summary.rst). The driver has the following features - -- Support for any PXA2xx and compatible SSP. -- SSP PIO and SSP DMA data transfers. -- External and Internal (SSPFRM) chip selects. -- Per peripheral device (chip) configuration. -- Full suspend, freeze, resume support. - -The driver is built around a &struct spi_message FIFO serviced by kernel -thread. The kernel thread, spi_pump_messages(), drives message FIFO and -is responsible for queuing SPI transactions and setting up and launching -the DMA or interrupt driven transfers. - -Declaring PXA2xx host controllers ---------------------------------- -Typically, for a legacy platform, an SPI host controller is defined in the -arch/.../mach-*/board-*.c as a "platform device". The host controller configuration -is passed to the driver via a table found in include/linux/spi/pxa2xx_spi.h:: - - struct pxa2xx_spi_controller { - u8 num_chipselect; - u8 enable_dma; - ... - }; - -The "pxa2xx_spi_controller.num_chipselect" field is used to determine the number of -peripheral devices (chips) attached to this SPI host controller. - -The "pxa2xx_spi_controller.enable_dma" field informs the driver that SSP DMA should -be used. This caused the driver to acquire two DMA channels: Rx channel and -Tx channel. The Rx channel has a higher DMA service priority than the Tx channel. -See the "PXA2xx Developer Manual" section "DMA Controller". - -For the new platforms the description of the controller and peripheral devices -comes from Device Tree or ACPI. - -NSSP HOST SAMPLE ----------------- -Below is a sample configuration using the PXA255 NSSP for a legacy platform:: - - static struct resource pxa_spi_nssp_resources[] = { - [0] = { - .start = __PREG(SSCR0_P(2)), /* Start address of NSSP */ - .end = __PREG(SSCR0_P(2)) + 0x2c, /* Range of registers */ - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = IRQ_NSSP, /* NSSP IRQ */ - .end = IRQ_NSSP, - .flags = IORESOURCE_IRQ, - }, - }; - - static struct pxa2xx_spi_controller pxa_nssp_controller_info = { - .num_chipselect = 1, /* Matches the number of chips attached to NSSP */ - .enable_dma = 1, /* Enables NSSP DMA */ - }; - - static struct platform_device pxa_spi_nssp = { - .name = "pxa2xx-spi", /* MUST BE THIS VALUE, so device match driver */ - .id = 2, /* Bus number, MUST MATCH SSP number 1..n */ - .resource = pxa_spi_nssp_resources, - .num_resources = ARRAY_SIZE(pxa_spi_nssp_resources), - .dev = { - .platform_data = &pxa_nssp_controller_info, /* Passed to driver */ - }, - }; - - static struct platform_device *devices[] __initdata = { - &pxa_spi_nssp, - }; - - static void __init board_init(void) - { - (void)platform_add_device(devices, ARRAY_SIZE(devices)); - } - -Declaring peripheral devices ----------------------------- -Typically, for a legacy platform, each SPI peripheral device (chip) is defined in the -arch/.../mach-*/board-*.c using the "spi_board_info" structure found in -"linux/spi/spi.h". See "Documentation/spi/spi-summary.rst" for additional -information. - -Each peripheral device (chip) attached to the PXA2xx must provide specific chip configuration -information via the structure "pxa2xx_spi_chip" found in -"include/linux/spi/pxa2xx_spi.h". The PXA2xx host controller driver will use -the configuration whenever the driver communicates with the peripheral -device. All fields are optional. - -:: - - struct pxa2xx_spi_chip { - u8 tx_threshold; - u8 rx_threshold; - u8 dma_burst_size; - u32 timeout; - }; - -The "pxa2xx_spi_chip.tx_threshold" and "pxa2xx_spi_chip.rx_threshold" fields are -used to configure the SSP hardware FIFO. These fields are critical to the -performance of pxa2xx_spi driver and misconfiguration will result in rx -FIFO overruns (especially in PIO mode transfers). Good default values are:: - - .tx_threshold = 8, - .rx_threshold = 8, - -The range is 1 to 16 where zero indicates "use default". - -The "pxa2xx_spi_chip.dma_burst_size" field is used to configure PXA2xx DMA -engine and is related the "spi_device.bits_per_word" field. Read and understand -the PXA2xx "Developer Manual" sections on the DMA controller and SSP Controllers -to determine the correct value. An SSP configured for byte-wide transfers would -use a value of 8. The driver will determine a reasonable default if -dma_burst_size == 0. - -The "pxa2xx_spi_chip.timeout" fields is used to efficiently handle -trailing bytes in the SSP receiver FIFO. The correct value for this field is -dependent on the SPI bus speed ("spi_board_info.max_speed_hz") and the specific -peripheral device. Please note that the PXA2xx SSP 1 does not support trailing byte -timeouts and must busy-wait any trailing bytes. - -NOTE: the SPI driver cannot control the chip select if SSPFRM is used, so the -chipselect is dropped after each spi_transfer. Most devices need chip select -asserted around the complete message. Use SSPFRM as a GPIO (through a descriptor) -to accommodate these chips. - - -NSSP PERIPHERAL SAMPLE ----------------------- -For a legacy platform or in some other cases, the pxa2xx_spi_chip structure -is passed to the pxa2xx_spi driver in the "spi_board_info.controller_data" -field. Below is a sample configuration using the PXA255 NSSP. - -:: - - static struct pxa2xx_spi_chip cs8415a_chip_info = { - .tx_threshold = 8, /* SSP hardware FIFO threshold */ - .rx_threshold = 8, /* SSP hardware FIFO threshold */ - .dma_burst_size = 8, /* Byte wide transfers used so 8 byte bursts */ - .timeout = 235, /* See Intel documentation */ - }; - - static struct pxa2xx_spi_chip cs8405a_chip_info = { - .tx_threshold = 8, /* SSP hardware FIFO threshold */ - .rx_threshold = 8, /* SSP hardware FIFO threshold */ - .dma_burst_size = 8, /* Byte wide transfers used so 8 byte bursts */ - .timeout = 235, /* See Intel documentation */ - }; - - static struct spi_board_info streetracer_spi_board_info[] __initdata = { - { - .modalias = "cs8415a", /* Name of spi_driver for this device */ - .max_speed_hz = 3686400, /* Run SSP as fast a possible */ - .bus_num = 2, /* Framework bus number */ - .chip_select = 0, /* Framework chip select */ - .platform_data = NULL; /* No spi_driver specific config */ - .controller_data = &cs8415a_chip_info, /* Host controller config */ - .irq = STREETRACER_APCI_IRQ, /* Peripheral device interrupt */ - }, - { - .modalias = "cs8405a", /* Name of spi_driver for this device */ - .max_speed_hz = 3686400, /* Run SSP as fast a possible */ - .bus_num = 2, /* Framework bus number */ - .chip_select = 1, /* Framework chip select */ - .controller_data = &cs8405a_chip_info, /* Host controller config */ - .irq = STREETRACER_APCI_IRQ, /* Peripheral device interrupt */ - }, - }; - - static void __init streetracer_init(void) - { - spi_register_board_info(streetracer_spi_board_info, - ARRAY_SIZE(streetracer_spi_board_info)); - } - - -DMA and PIO I/O Support ------------------------ -The pxa2xx_spi driver supports both DMA and interrupt driven PIO message -transfers. The driver defaults to PIO mode and DMA transfers must be enabled -by setting the "enable_dma" flag in the "pxa2xx_spi_controller" structure. -For the newer platforms, that are known to support DMA, the driver will enable -it automatically and try it first with a possible fallback to PIO. The DMA -mode supports both coherent and stream based DMA mappings. - -The following logic is used to determine the type of I/O to be used on -a per "spi_transfer" basis:: - - if spi_message.len > 65536 then - print "rate limited" warning - use PIO transfers - - if enable_dma and the size is in the range [DMA burst size..65536] then - use streaming DMA mode - - otherwise - use PIO transfer - -THANKS TO ---------- -David Brownell and others for mentoring the development of this driver. diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index c1bb1895009c..11d7ac8aed4a 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig @@ -821,8 +821,7 @@ config SPI_PXA2XX select PXA_SSP if ARCH_PXA || ARCH_MMP help This enables using a PXA2xx or Sodaville SSP port as a SPI master - controller. The driver can be configured to use any SSP port and - additional documentation can be found a Documentation/spi/pxa2xx.rst. + controller. The driver can be configured to use any SSP port. config SPI_PXA2XX_PCI def_tristate SPI_PXA2XX && PCI && COMMON_CLK From patchwork Wed Mar 27 19:29:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13607531 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 DC22DC54E67 for ; Wed, 27 Mar 2024 21:48:37 +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=axeXGMdihn1ZlDBfTGTQjDwzBgoJ4ocQ9FY1p86SbBc=; b=rxzMi3W9PBLHUc iTwlRw1DvtiCie3IRt1Mpwk7JdZ41Dvbpls+B2moIhvlucrzcn+D3t8p3tvcgGxOihpVHLZLyWQGC 0+GYX86pKBMaE0a5ubcU/6Y1sT/L/ZxARG3XkMEwU2JynapkZW+C3wZ5e9cFhl1xF45LhJ2t+mTEs 3i4E9z8dndipFNZDHwXQl4iUePNEWdgqY3/4HlrKX1yFsI1vGJtq0pLigH5EmCBYx1xK3nwhDWGqg iGlmIKKKP2iUqyYQtvUNKA7AK5kHH/c/MmpWJExsWTrWxv5DihIXeXBihNOtzYz6KRjsblL5xc4MS NNDgp1C84qkSFM+dwTbw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpb8G-0000000BHvg-1kWx; Wed, 27 Mar 2024 21:48:28 +0000 Received: from mgamail.intel.com ([192.198.163.8]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpZ07-0000000Ant0-2C6I for linux-arm-kernel@lists.infradead.org; Wed, 27 Mar 2024 19:31:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711567914; x=1743103914; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=j5gvoDGybQmWLbfFLzUmE6T0bPJCKLuCLg7N7OevHog=; b=EDp0wSVEApYAZY2ttosJabuAsUOTK1Yl25qkCzPGXDVoQ8PzP8jrIg1A 39+WpUAjiCjCDBNadE3m0yn6sE/h5gARGYYL7BDSo7aSzLJaZMz/aqLLt nXIWIO3kxahCVCVfvT1/ZDnQyXeQYnXnzkRHe7EVjRKCXCmd5/wOnA2Ok +YpiUgCK1xb5drLlx9TvmOODRQ6PVO0tWNec5T2FJFFPuszr/cJn1DlW9 oZKv2uIW6oTIlmBtI9jNvxt+7sSop9p3+O17RfdISVyFseD3PD1k2IRb5 trTBqzEuo3DLGJpvJInCXXhd0007zxpxlEkSqgT7x7mZD1cNZ5rMZuLxw A==; X-CSE-ConnectionGUID: eIUzB1mWQH6xG4kAs5q2AQ== X-CSE-MsgGUID: 2ofv4n7+QlWDtMVUPtO5SQ== X-IronPort-AV: E=McAfee;i="6600,9927,11026"; a="24187354" X-IronPort-AV: E=Sophos;i="6.07,159,1708416000"; d="scan'208";a="24187354" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2024 12:31:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11026"; a="937075031" X-IronPort-AV: E=Sophos;i="6.07,159,1708416000"; d="scan'208";a="937075031" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 27 Mar 2024 12:31:46 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id EBC4A8D9; Wed, 27 Mar 2024 21:31:42 +0200 (EET) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Russell King Subject: [PATCH v2 9/9] spi: pxa2xx: Don't use "proxy" headers Date: Wed, 27 Mar 2024 21:29:28 +0200 Message-ID: <20240327193138.2385910-10-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240327193138.2385910-1-andriy.shevchenko@linux.intel.com> References: <20240327193138.2385910-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-20240327_123155_599949_485AA87E X-CRM114-Status: GOOD ( 12.04 ) 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 Update header inclusions to follow IWYU (Include What You Use) principle. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx-dma.c | 10 ++++++++-- drivers/spi/spi-pxa2xx-pci.c | 6 ++++++ drivers/spi/spi-pxa2xx.c | 10 +++++++--- drivers/spi/spi-pxa2xx.h | 3 +-- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi-pxa2xx-dma.c b/drivers/spi/spi-pxa2xx-dma.c index 26416ced6505..751cb0f77b62 100644 --- a/drivers/spi/spi-pxa2xx-dma.c +++ b/drivers/spi/spi-pxa2xx-dma.c @@ -6,16 +6,22 @@ * Author: Mika Westerberg */ -#include +#include +#include #include #include +#include +#include #include -#include +#include +#include #include #include "spi-pxa2xx.h" +struct device; + static void pxa2xx_spi_dma_transfer_complete(struct driver_data *drv_data, bool error) { diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c index e11a613bc340..6d2efdb0e95f 100644 --- a/drivers/spi/spi-pxa2xx-pci.c +++ b/drivers/spi/spi-pxa2xx-pci.c @@ -6,9 +6,15 @@ * Copyright (C) 2016, 2021 Intel Corporation */ #include +#include +#include #include #include #include +#include +#include +#include +#include #include #include diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index e22d9d29c7e9..86d0f1064a45 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -5,24 +5,28 @@ */ #include +#include #include +#include #include #include #include #include #include -#include #include #include #include +#include #include -#include -#include +#include +#include #include +#include #include #include #include #include +#include #include diff --git a/drivers/spi/spi-pxa2xx.h b/drivers/spi/spi-pxa2xx.h index 08296729ea80..f1097c96c50f 100644 --- a/drivers/spi/spi-pxa2xx.h +++ b/drivers/spi/spi-pxa2xx.h @@ -8,8 +8,7 @@ #define SPI_PXA2XX_H #include -#include -#include +#include #include #include