From patchwork Tue Mar 26 18:07:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 783042 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D795580C1F; Tue, 26 Mar 2024 18:10:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711476642; cv=none; b=hT5+cmfYiW1sbNp/qDGfPwf97+S7qLT9AcHcmtPVtZodBta2NmdSex9azOx1q8TRMn3ZRN2CkBbPwndt5qijOfpeggBxWhbR7XK6mkuL9ZbZ84dG+yqYQOTC9DU6AceDgKnkxTmfqINoR2NkG/IIfuYUkJGjfu8MC8XOb1PUfNM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711476642; c=relaxed/simple; bh=bYPfMHs5lY0w8l6frpxhtmlny9EfNHrvPYL21MRIbXo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AMMKrO8Ed+m8RIAwigQiVRXtV7uovJAt4np52KTiqh0w4UN5ykMsPrkIimXoZCk0vf9XuNBCefoAueJzREfNeRki5HVR+6qO7hBmK9JFCb+4FevZDHzsE1EqcKA16IUVYwM4cYXKDxolM1RSk98ca83cTtbey6NrA8x1aXHOcZo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=VocGc7kT; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="VocGc7kT" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711476641; x=1743012641; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bYPfMHs5lY0w8l6frpxhtmlny9EfNHrvPYL21MRIbXo=; b=VocGc7kTTj/iKYa5CYu6t/Nnu4/boVlz5cYmUd2NGUuGgCdaMcHrI1UN Lp1hvlydpoc4YxesGZIqLgkeVSItIw/hx8KPr0hxL2UvmDQq3dy4yUH+4 eJCmaiwhnPhnK+TFWhmP/RsQWR0A7Ee4dDJEPa/BQHk7hytGTm3gzq3ve vs+fLsNsWSJUDo2hTqffs8oz84800JX02DQSTcImHiZ/aBjvKcV+VkynI VgzgpRL0x5H9c2VGzZhU9Jw94JK40Sbkds+A8RbrVg/iSSOQGx0jtTlLZ RLgz8/1qE48F+bs7W40CiC+KqRVmznEPxVs1uouX8bxxtnJnp7cufyo3Y A==; X-CSE-ConnectionGUID: dTOrASGyQYyOh4Uxrf+dKA== X-CSE-MsgGUID: wxzcGi2TTLynS2Y2NgLofQ== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="10325668" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="10325668" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 11:10:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="937072937" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="937072937" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 26 Mar 2024 11:10:35 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id D096F161; Tue, 26 Mar 2024 20:10:34 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Mark Brown , 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 v1 01/10] spi: pxa2xx: Drop ACPI_PTR() and of_match_ptr() Date: Tue, 26 Mar 2024 20:07:51 +0200 Message-ID: <20240326181027.1418989-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240326181027.1418989-1-andriy.shevchenko@linux.intel.com> References: <20240326181027.1418989-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Drop rather useless use of ACPI_PTR() and of_match_ptr(). It also removes the necessity to be dependent on ACPI and of.h inclusion. Signed-off-by: Andy Shevchenko --- drivers/spi/Kconfig | 2 +- drivers/spi/spi-pxa2xx.c | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index bc7021da2fe9..7cf86b034083 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 || PCI || COMPILE_TEST select PXA_SSP if ARCH_PXA || ARCH_MMP help This enables using a PXA2xx or Sodaville SSP port as a SPI master diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 6c2a14418972..2c39d3ff498e 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -1730,7 +1729,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 }, @@ -1741,9 +1739,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 }, {} }; @@ -1753,8 +1750,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 Tue Mar 26 18:07:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 784751 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D3DA21344; Tue, 26 Mar 2024 18:10:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711476640; cv=none; b=Rl2bAlYGIOEa4jQvhTJomlmRa2NlxY35Ux5TdbVcVosaQzozjDeY+twgTifqqPJwwIUbbX+fVbRNF9lS18z12Is7roYsOveSxV8BMPhOoVlipLf3SF5WFXchbmcNblbWZmfHfkVOoJWXH6FK+LlKHRrn8WukSc49kCB4cryar/k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711476640; c=relaxed/simple; bh=X27htwA7sCrDGlSqisjWeGimBkuhSBHYDfK89zkUYkM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SAiJe/QW3z0tHOaRxRaPQ3/NOLh09cfcLJzm+UReRHKJNasAPwFsevTZULJMGfDzK+k/y4OSJLyB0JtdPO6XPvHNSwK/i6MwB3cYA5h84jiTo7r8r3mCMVNqEVmdTIWMsjU3UxZ7QYLpInWoWoL0kjtFKL8nsbR9UFmtucXIOds= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Q8nKDkgq; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Q8nKDkgq" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711476639; x=1743012639; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=X27htwA7sCrDGlSqisjWeGimBkuhSBHYDfK89zkUYkM=; b=Q8nKDkgq9eCrrcGVZNJSQqO6LH/kaBMunai/jXQa7pDmHqx46aLhJHcN QHx+iTd65fpj9Ix+mgjUY3kUOW2mH+4O4GHE71iLd7wSbM41vXMFgfkFr psTrQA4uhRlaX5qc3KpRajvcyWFa9s7bHTUstiD9pb7JMaU+1cuJoTFsZ wi0Gne33Ay+ufrmXTQJHyfiIYyt6fK8jS1K7/69MpPhD7qG2L2NiJ6AY5 zG4G13R91W2p0pthLQnRECZyh4z7IL5VVv4xz0rJ+/NszbX3CLEucRWHc wrMP9Zred31KSFm0Lg2AAYQpzWm1azm7tODMzl+wRsOgMI7mPZrelncLi A==; X-CSE-ConnectionGUID: F1Mm8bO5SZKziOdbIB+yJw== X-CSE-MsgGUID: QN+NZjlxSRuhAoXA/wQwNA== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="10325661" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="10325661" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 11:10:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="937072936" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="937072936" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 26 Mar 2024 11:10:35 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id DA566524; Tue, 26 Mar 2024 20:10:34 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Mark Brown , 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 v1 02/10] spi: pxa2xx: Keep PXA*_SSP types together Date: Tue, 26 Mar 2024 20:07:52 +0200 Message-ID: <20240326181027.1418989-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240326181027.1418989-1-andriy.shevchenko@linux.intel.com> References: <20240326181027.1418989-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Keep the PXA*_SSP types together in enum pxa_ssp_type for better maintenance. Signed-off-by: Andy Shevchenko --- include/linux/pxa2xx_ssp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/pxa2xx_ssp.h b/include/linux/pxa2xx_ssp.h index cd1973e6ac4b..844a2743ca94 100644 --- a/include/linux/pxa2xx_ssp.h +++ b/include/linux/pxa2xx_ssp.h @@ -217,9 +217,9 @@ enum pxa_ssp_type { PXA27x_SSP, PXA3xx_SSP, PXA168_SSP, - MMP2_SSP, PXA910_SSP, CE4100_SSP, + MMP2_SSP, MRFLD_SSP, QUARK_X1000_SSP, /* Keep LPSS types sorted with lpss_platforms[] */ From patchwork Tue Mar 26 18:07:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 784750 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5AA4C8527A; Tue, 26 Mar 2024 18:10:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711476643; cv=none; b=OI4K9oHpotP1FHtYswi78IxnEeW9s3IRkDAqsXvYTNMsjGqgibBaOstZvGbRD3ereG3ZS5J2puMRZX0xZU9ej9vT7IZIPAfNKiubsf/re9PQSinLGpWBqVkMyEsz36xXOBA6wHPVNW7w80y8u7kGoDaGgDDY6FhWpx9gaVE/Ce8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711476643; c=relaxed/simple; bh=Oh3MUbUj1XxFveo7rtHk0ivojd56U90Z0wqM4ju1lRM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t4YOzmjpwI+6amm+32dR/vL9QTb8U3wfNtZGQXqmm7l9sr7C9IiHT2OnawnEvkrMlZDAzy25yCMVx44fo/HfWPWiVD1LqYF68uIFenhXy1eMj9WTcDs8z47eCoA/K2say/RRmu1hRUq1uGbeyxl0RJddLb3bsHyGaDGNe6MhJL4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=dUIQxt75; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="dUIQxt75" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711476641; x=1743012641; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Oh3MUbUj1XxFveo7rtHk0ivojd56U90Z0wqM4ju1lRM=; b=dUIQxt75uZSrD5IDlFZagD1OUOuoGcj7x2zv2WvCfk+Cdjh/pexUZ/6y oQsUKaQaNaKSHHlXhmRICuQOZJSTBsxOhoyC7Zp1HHsQc0w83WP6u8Nen T8gZ//D4QSVHZyJT4TS0ztYhuNgxXE/t+SUIRJzA4YV5cbq3mFKWLXw9S nS9UX8Btoe688TaUN4xWeP7mkAQYJw2vRAa4layQocNL0IQ8d7PLyBh6B uBWBxLqlnhltg2Q1Oh71HLWkFPC+UrSGUUJi2vws3sOLaxX/40lBca3tq ISgBfDd1IMG6DFo2WNern3nttTcy4/NAKCgB2OxzsR01GPwjQrGI2TAgW g==; X-CSE-ConnectionGUID: UNYDaGnBRSGpMTj8mNcifQ== X-CSE-MsgGUID: J56FEiQqTUCFRjiICENRcw== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="10325675" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="10325675" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 11:10:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="937072938" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="937072938" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 26 Mar 2024 11:10:35 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id E35AA2CA; Tue, 26 Mar 2024 20:10:34 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Mark Brown , 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 v1 03/10] spi: pxa2xx: Switch to use dev_err_probe() Date: Tue, 26 Mar 2024 20:07:53 +0200 Message-ID: <20240326181027.1418989-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240326181027.1418989-1-andriy.shevchenko@linux.intel.com> References: <20240326181027.1418989-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Switch to use dev_err_probe() to simplify the error path and unify a message template. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 2c39d3ff498e..75d208087748 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1434,20 +1434,16 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) platform_info = dev_get_platdata(dev); if (!platform_info) { platform_info = pxa2xx_spi_init_pdata(pdev); - if (IS_ERR(platform_info)) { - dev_err(&pdev->dev, "missing platform data\n"); - return PTR_ERR(platform_info); - } + 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 (!ssp->mmio_base) { - dev_err(&pdev->dev, "failed to get SSP\n"); - return -ENODEV; - } + 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)); @@ -1455,8 +1451,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) controller = devm_spi_alloc_host(dev, sizeof(*drv_data)); if (!controller) { - dev_err(&pdev->dev, "cannot alloc spi_controller\n"); - status = -ENOMEM; + status = dev_err_probe(dev, -ENOMEM, "cannot alloc spi_controller\n"); goto out_error_controller_alloc; } drv_data = spi_controller_get_devdata(controller); @@ -1510,7 +1505,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) status = request_irq(ssp->irq, ssp_int, IRQF_SHARED, dev_name(dev), drv_data); if (status < 0) { - dev_err(&pdev->dev, "cannot get IRQ %d\n", ssp->irq); + dev_err_probe(dev, status, "cannot get IRQ %d\n", ssp->irq); goto out_error_controller_alloc; } @@ -1626,7 +1621,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) platform_set_drvdata(pdev, drv_data); status = spi_register_controller(controller); if (status) { - dev_err(&pdev->dev, "problem registering SPI controller\n"); + dev_err_probe(dev, status, "problem registering SPI controller\n"); goto out_error_pm_runtime_enabled; } From patchwork Tue Mar 26 18:07:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 784749 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B41A68664C; Tue, 26 Mar 2024 18:10:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711476644; cv=none; b=oOIO87Vxa4Bu/jzJnj0JTOzadhMGYji/m/0gujzz5Kt6l6e3JjC22Gt7ktYtVMim+/nmbUjk8YOAtAQMwfF94iNIMaP5lomXrWo+tp3SeIztv/O8QqpxlYtBgeGC2pwBnDURJFJXzmQE+M/6N6xowFubBIIcaueBjqn+Yl8Pen0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711476644; c=relaxed/simple; bh=/NCY6D6sJSA8qtx+EX1W99OV2q8Lk5IqUKEVfKBSw0Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F22aaFFYA/dPQhRgMzetAf/AsVAqzOCkkyD4k/LqqgFoI2U8KSEjAOb8+9i/PWlj60wOdS2UNBNs2w79RF2blEmSkTqVBp90npzflMHjkL0H29w+vKtd2IzLwMux9mhQSeAZf8XBfMT10u3aSBROU/8ehucx1J2w3eq+yJ2L95k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=VNm5xQkK; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="VNm5xQkK" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711476643; x=1743012643; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/NCY6D6sJSA8qtx+EX1W99OV2q8Lk5IqUKEVfKBSw0Q=; b=VNm5xQkK4YS/xSFfqr6DLvxqq2JixVs52DOLS8cWAGRHgtLeal0QwfJL s9Syg5m0rWGIFjcLPa0VvZvjatQdshqSgDdNJtRpkVHRscjalO4OrJhth NvUesRCtQVNGq4VY1ZeBbbrEZ9xNCY7PPPun18k/InrTNqkiD8WA2Gay/ cJlWyG6i3j48qWQE0vLahTsDAS5Y83Q2WSsMSjZso+fMr0HdFn3Pjl379 Fsx2X2ZARTi7W0vDPxJaJmdWe7Ynm4A8d29bAIII/5KgZNq7N/uCq7lan +fBTmGKzoWVnbB87xHe/e3Y4ii6IdcKccYekIo+AtjLb3cw+AoOreu/58 Q==; X-CSE-ConnectionGUID: vwvQ+QUaSvibO7eEhUnUzQ== X-CSE-MsgGUID: 0+f84V86Qeu7uIkjSsXnCw== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="10325690" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="10325690" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 11:10:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="937072939" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="937072939" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 26 Mar 2024 11:10:35 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 015F2643; Tue, 26 Mar 2024 20:10:34 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Mark Brown , 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 v1 04/10] spi: pxa2xx: Extract pxa2xx_spi_init_ssp() helper Date: Tue, 26 Mar 2024 20:07:54 +0200 Message-ID: <20240326181027.1418989-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240326181027.1418989-1-andriy.shevchenko@linux.intel.com> References: <20240326181027.1418989-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 Tue Mar 26 18:07:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 783039 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7BE1D127B62; Tue, 26 Mar 2024 18:10:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711476646; cv=none; b=gjhy3Yt84QMorKyPNGKHir4IEkLuGc2vHeNmEED2wxW/rf55fmvf95LoQMYxEC7GiHDEMUd0JF1pOqjoKOJzSvc2Nlj35utQ4v8d3FlkC8b9JhTkK+beciqC1SWAz7+wuSKEk9Gf6t/ncHzsf+9/Rq/QxMQ2ttP4QqWfjcb8dfQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711476646; c=relaxed/simple; bh=jFzgo5+g95yyxQjjsoDzp1sVeyMA6hDbVV6LnWCwoqk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rtDSRLfPA3Icb3obzbT23D/O4NIdVliQixzYV9T8m81Bc+lcRFQY4K8iZQjE1oEbNV2YAghyYijmPvi2XvWKkdjKIdDIRtFSC24kol2JAUU5Xymru8GCJK/qa5b/Lvblz3piVqG0pyoq9h8O6MkM7xipXakNcSidJt8+RHKm1zc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=A8MSF9Gm; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="A8MSF9Gm" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711476644; x=1743012644; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jFzgo5+g95yyxQjjsoDzp1sVeyMA6hDbVV6LnWCwoqk=; b=A8MSF9Gmh+O2wxKU9oIkk7xkCM6P+NHi7t+ASDX/NFRoMd5J+vhJPI7Z Oi1k2x93oLo9fteD4324WgTILnB9Z/vIxUlH3YUibvW7pgQVTIN4p4W1K aTuhpADE+Npk7kL+g4T5X9Esnpx7gErpOiOmcYtekqXM2K8sk6eYYyckr YYUDCwlGAAoygbxpSUNx9CnOlvD4s39ax45vtfPE1ZB767L+SK5IV2iPo E40ye4nzjHP4ibayE4hdEs2y6edngMBk7w67Z+iZ/3EAswt3SMYbVdxh4 hIEWDJaFdDXidZlJXnINTw9EpWmnJfF/iRgPuD1nJLn1/dR4reDT9YM8o w==; X-CSE-ConnectionGUID: SOArLPDxQUGhCQKv9q+beA== X-CSE-MsgGUID: wGznvPy+T/GMGP1X+g/Idw== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="10325719" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="10325719" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 11:10:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="937072941" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="937072941" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 26 Mar 2024 11:10:38 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 0FFB16AF; Tue, 26 Mar 2024 20:10:35 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Mark Brown , 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 v1 05/10] spi: pxa2xx: Skip SSP initialization if it's done elsewhere Date: Tue, 26 Mar 2024 20:07:55 +0200 Message-ID: <20240326181027.1418989-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240326181027.1418989-1-andriy.shevchenko@linux.intel.com> References: <20240326181027.1418989-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 Tue Mar 26 18:07:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 783040 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3CE20126F14; Tue, 26 Mar 2024 18:10:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711476644; cv=none; b=hh01NlbAE7uZ2NJ5HqdiVzdImnWiuVnBNl7COimYaStSagPkr3PfrAHX6ypkQL6XPb2IQjxGTGrxEDgDTd9Et1c7xezvTeLWSXTlVe3KLbSs9mWCuwfMitdNhr9gXa/beVx5I8/IZyqw2i+RVN0OlsF6zeOnZpVghqx/+v5FKDE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711476644; c=relaxed/simple; bh=lzLjtivrQxAS+WqTg89dinGS46hcsyGbp0QSkCiy2Ns=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OQnagieqQ0ZVZmOVcSFDixd4VWHE7+0PflLkTSee0Mg7IAiWflo8apyiHxh0/ii8MAo8j7Pszq1sIM06Yr1mXwZQgtjqxK4J9NfKH9qJO3CiAHS4Rq1lXzTHjaJZXIz+mbmn6U7vXXc29HGe3McTADhrGnUuQiP6lu0hQ4I2ESc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=WhOsABV4; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="WhOsABV4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711476643; x=1743012643; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lzLjtivrQxAS+WqTg89dinGS46hcsyGbp0QSkCiy2Ns=; b=WhOsABV4zCqcgt58LYvl0Mt6DKVzQobLScubNdyWiJ0NkKboIrAY/WY/ tJ8LPufZ7jfXyR275V9aOJMzC2oLzGIZ3hObZTMc976KIaOGH5DANzO2b soX6S9rbvaMxb/n19sI+VOyD9jZA+Vx61iskn7umu6EzHWJiISCaEOdzg X7BlO9A6se4CDozSAZJsRFyKxTGGRHqfL/XHhx7v6tGEKqsUUKfaWkyqu uApysZ4N3EwMWoiB0zi6mjKlmEc4SoHhtLWRz3eXqqIq2SDjTYOfiDYKB J+NVwWDN9rfp5Y5Q5KhlwJ6/kGHG/cBEulq6l6JqjMrTosWtnMtvjuljE g==; X-CSE-ConnectionGUID: 6kDXFBCGRBWat5aZGPX0YA== X-CSE-MsgGUID: +z+l5Fv9Tj6/EXkImhO0nw== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="10325699" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="10325699" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 11:10:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="937072940" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="937072940" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 26 Mar 2024 11:10:38 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 1A1D25A8; Tue, 26 Mar 2024 20:10:35 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Mark Brown , 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 v1 06/10] spi: pxa2xx: Allow number of chip select pins to be read from property Date: Tue, 26 Mar 2024 20:07:56 +0200 Message-ID: <20240326181027.1418989-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240326181027.1418989-1-andriy.shevchenko@linux.intel.com> References: <20240326181027.1418989-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 Tue Mar 26 18:07:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 784748 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4823A127B47; Tue, 26 Mar 2024 18:10:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711476645; cv=none; b=eS5mb16/nbwYFCx4Up8yKD9GSpV4P8tIx0H/WBY6JruGMqn8IadjFQDYcuie1qs9S3pMfE0oKPrNCv4wgeJjHdgNP7f9C+VHqFbvDwjKSMWWCXOBMFZ50tLjs+0fE/XK0W7qWsfWwIxDVpDfXISRv1EgSR5WcV9QeIvn4ijQiXE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711476645; c=relaxed/simple; bh=OHu0e1fzfnbbh01dHJSe36zf7TwpFULLxcAa0gHl81c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NOtwd9KJQD8MYH6WA5HGrvd2jdVqwbDCxylj0IC8Rytvja/IVk7+7m0EGqaHdV/+4rPVyipDV12wfnk0O8h99t6Ohu3/zbhi2eg9iHoDUqXi+u6cY3np1zTEcUvF644BY8XVdQDYbYuAxmzwbx+3DrPtBhujCuY2bH68LbdVmO4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=As2Lq/oM; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="As2Lq/oM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711476644; x=1743012644; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OHu0e1fzfnbbh01dHJSe36zf7TwpFULLxcAa0gHl81c=; b=As2Lq/oMhSkiu8Tu5PeLxbR1h0Z/xZjRs+w76emK5jKmaUmWtB9/qmGQ uZ8WaIKUqqobQlB0r1jrfcYpGYWKX4g3P/ALMcgZIdewfTZMDlSXm/ipI g5lQ9s+y+WKTyNXiiTCskDps7pZ3DT0nOgAkfwrKK+Onq5kAm8T/OpdUR q3mADE15eTsDdfOHagYNhwW0amyNMCaGv/i320GBSQQPOYudfCa0EflbR 7ly+Pk7ulnWwDkmUZvk0mRP4K7lUYWfTUx245ohiofl3owA4mozgyiVZi x2yTMdWipGox31wjHfVgpp5oMOKH2dlOwi5ygOd2sgj8Ns2f6dFAJr8vD g==; X-CSE-ConnectionGUID: Mlw5AjbAQDat/tewN6/u1w== X-CSE-MsgGUID: 6P8Vzni/RT2yq3G2AVU80A== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="10325711" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="10325711" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 11:10:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="937072942" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="937072942" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 26 Mar 2024 11:10:38 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 2A608E2E; Tue, 26 Mar 2024 20:10:35 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Mark Brown , 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 v1 07/10] spi: pxa2xx: Provide num-cs for Sharp PDAs via device properties Date: Tue, 26 Mar 2024 20:07:57 +0200 Message-ID: <20240326181027.1418989-8-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240326181027.1418989-1-andriy.shevchenko@linux.intel.com> References: <20240326181027.1418989-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Since driver can parse num-cs device property, replace platform data with this new approach. 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 Tue Mar 26 18:07:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 784746 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 465E613CC4A; Tue, 26 Mar 2024 18:10:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711476648; cv=none; b=tqsOBgo6r3dP1ei3HXKI4plVW3/HL9fEInY1nXdq/82RMm2vna3/ye3NqwL4tJU4/TYeFKbZ1mfj9DkvPC4y8j6ZDPlRMadXfNVhmopZGbLr1OwOSULpEIgnWIXdW1sYf5le4kg1x3SUJJ9MEexZz8M6LawXArgNTiUfCvKBvcw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711476648; c=relaxed/simple; bh=y3OFV8ojkqypOZZ1eY8yTN0O6AaepbldILI9QHFUGRI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a/4oWDrvbRnGgegb0kiivrWHxDRRjg1NVoxCNtEqkUiaGggyet4hOQr4IiRzr6U00U1TCf73ahBRrzLoNfGjL/aCpzfGapKNVd/1Vi0dmsMjy+9tGeDaqfzs0Fll3vJk5qUbGmMd0Zq5wkSLBT1+O6zbgflUkVaiJKqCe4ICojE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=PjUe2jSY; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="PjUe2jSY" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711476646; x=1743012646; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=y3OFV8ojkqypOZZ1eY8yTN0O6AaepbldILI9QHFUGRI=; b=PjUe2jSYSRkeah+XZE4iL6B9YK8fKX2NBOSV1vZy3uWnGC4qk7sxeB9n HhQZtZj4nnJ/CuGQjazTzJdLnCCtsAQ0EjrZ0+z/0KgJkdg+ugnsdHvoX HwvuoZna0BQhnA8p9p+ImBxPBTJndBgeAZMDRJGWfSbor0l4iYr2f3k1U Gmc5WHwmKdpihkLO4rQRavnJBjlUV4Z3q6XxrjqQ7n7gyPt1+3nefYX+2 j8iKW/MaagXbFTN+kmYdKLCYVLmRudpGhvzi/Z1hGMPhANABLWXnhy0gJ 1xfsg0OXc+cAa7e7cn3jgM2ruo2u0HR+uN0UZmbhcDlycYTaRIXjYaAb9 Q==; X-CSE-ConnectionGUID: XGp6xilJRSu/1HfJGBsI4Q== X-CSE-MsgGUID: q5JPCNn5QDOP8/a5LD9QKQ== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="10325741" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="10325741" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 11:10:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="937072943" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="937072943" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 26 Mar 2024 11:10:38 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 3A02FE3C; Tue, 26 Mar 2024 20:10:35 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Mark Brown , 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 v1 08/10] spi: pxa2xx: Move contents of linux/spi/pxa2xx_spi.h to a local one Date: Tue, 26 Mar 2024 20:07:58 +0200 Message-ID: <20240326181027.1418989-9-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240326181027.1418989-1-andriy.shevchenko@linux.intel.com> References: <20240326181027.1418989-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 Tue Mar 26 18:07:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 783038 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ECCEC13CA94; Tue, 26 Mar 2024 18:10:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711476647; cv=none; b=MQf//dsXlXVm5XbuAnCh9V+dRxHLHVz5IvFqofxFZgmn/qJjYEVV0i3lQfyeyJhOt/aYpBtBBbAjBmvRvB6V5UcKOWbyKwa+p3y+Otypmf9aaITX532fChwUZojYdGIi1zU9srg0zeM6xBtir5mgW9TkjYvUr2Pxz/saNTbxyts= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711476647; c=relaxed/simple; bh=/ASqtHuuxDXQIQnXsBHIw9PMUpUHvkzD6fY9hVpWJwA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ck+4R1gZLHqZkx8DjX09U1R+gY2dLdVftws8kOZcdZW2BROorVaLzj8mA7R5TT7QzqJdYkgVL/II/zDtKml2t8TMn8D0RtcIMAoEa0wbak3GdjeLT9nTLm42Nl8hXjUHL8bOCETO59dVsn/wFd35R9vo7AWSoWR1bsMl96PqoEs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Ir7eOxn4; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Ir7eOxn4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711476646; x=1743012646; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/ASqtHuuxDXQIQnXsBHIw9PMUpUHvkzD6fY9hVpWJwA=; b=Ir7eOxn4V74baUujYJp0QujgRJRIYuSA5bSBR+HK55+Nlqa7zAxA8Idh Xr04VEhDAa2AOnhp5bckl5atxtC9clLskA7fnhrEAcBqR4ft+u89aDzaT sUmae6EOfHm9oaQ7F72KjD7CiUUf/oUaNsNj1XN1XVHO5mUctlrktVycq aOe/0cBVjktUXJUHVbGMcbd7nOYAPgfp8GvGfjTQ26MixwJK1qliERv2N IH4deMPuY3ysQhMdsQEzNfGFtORC2D/GYDaZ1sbxZv3I3CUAPD1nGHfzD 159dpDFuqaMNNGhgBfVIkm89SV9HkNIfldzCAStPdlTmMC1E5tJEX4c/x A==; X-CSE-ConnectionGUID: atNfeAI4Q7WT1xlbuNUb+Q== X-CSE-MsgGUID: cynR5i00RGucrLT8ZK0pMQ== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="10325727" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="10325727" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 11:10:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="937072945" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="937072945" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 26 Mar 2024 11:10:39 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 44935815; Tue, 26 Mar 2024 20:10:35 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Mark Brown , 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 v1 09/10] spi: pxa2xx: Remove outdated documentation Date: Tue, 26 Mar 2024 20:07:59 +0200 Message-ID: <20240326181027.1418989-10-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240326181027.1418989-1-andriy.shevchenko@linux.intel.com> References: <20240326181027.1418989-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 ----------------------------------- 1 file changed, 208 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. From patchwork Tue Mar 26 18:08:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 784747 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6AB9129A99; Tue, 26 Mar 2024 18:10:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711476646; cv=none; b=Kg49Q2Icl+YVuYqcUfnVHhvueeyoUn74XsNkKjnZdEkAciBTQeoslyskXywpuRm3XodW7md7k3n3viaZ8qbQD91fmUH7KHA3rOlEVAsuDgqdLGQ/k+4vV18NYDFiEYgMnyMSavVWffs01zL9m0pIkQAcfilbQiTqDBLgW1EOoys= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711476646; c=relaxed/simple; bh=j5gvoDGybQmWLbfFLzUmE6T0bPJCKLuCLg7N7OevHog=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bDxuDaiMNQrXJUk1IL8fGcBzfQBus6zBNvG0xXQ3p6/OF7zIU2JnkUrI68d4CsZNdo1zhHeERkuW4YxevxjrUeQc2DAp3DKxbMJd4puWxW3OgGbpW5CNtddA4KCR3o7/HMa6KfIDT6TZ50E+D3cTMLbU5qu3OChTbFm0afgHi4E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=V81tnPsn; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="V81tnPsn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711476645; x=1743012645; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=j5gvoDGybQmWLbfFLzUmE6T0bPJCKLuCLg7N7OevHog=; b=V81tnPsnWsBYKM5V6stk5ohMtCsKSmk/ze72ZMGZxkSd64xFiLFIuFe4 Awa/eQh1lEriIo/TuG5meuKmGprsRaSxdhvlqLuWECg4w5TdUveDmCbmI 84KHxmUGCBMXfts3bxn6uIRdfUjkZ5Z5Q++1dpPHyHGOhB1fgBeNwGzPf dNDYkdyHlUfknPAuYF9yDGGCrZ2droBQ7r4rXnYnPp4V0ng74rTNRp6FE ZWT5Bf+L3S49fIAZRgAdwiKSYzTlvueJc8YJy/2R0Iz9sIP4XxcbpJxRY LrKLjFeXjffyE0TMz4So0yiqNjzFLswtGfJl1WfTxXHwuN5V7iaz6n0B2 g==; X-CSE-ConnectionGUID: rvZaIYPPRp2SbnpFsnBjBQ== X-CSE-MsgGUID: TFJ+b62nQgeOOLQKd8rPHg== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="10325726" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="10325726" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 11:10:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="937072944" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="937072944" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 26 Mar 2024 11:10:39 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 49E4EF06; Tue, 26 Mar 2024 20:10:35 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Mark Brown , 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 v1 10/10] spi: pxa2xx: Don't use "proxy" headers Date: Tue, 26 Mar 2024 20:08:00 +0200 Message-ID: <20240326181027.1418989-11-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240326181027.1418989-1-andriy.shevchenko@linux.intel.com> References: <20240326181027.1418989-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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