From patchwork Thu May 30 15:09: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: 13680534 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 8698AC25B74 for ; Thu, 30 May 2024 15:12:04 +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=f7+5Srr8D47nRh1nELrA3VB1fjHJuQGqpkG85PngIgM=; b=VBswvmVKEZWKMX NQKim/jJvrJOGlPZBmeTmeZROHSrfpg4/Q3VHMaLLhc1Ej1S3fRhM/CVS88o3kI4caWj9PzTvoC3+ cJuSX91xY97jQ98HmLlokL80bsKqW3raiQ8DlgzCT/uPXxCzabDyjsHIGCGLeC1zwbWRDrJjvPSIY Aa//JTXXQkSkXzgtK08cnHfjLM4ETbof/V0Vs5YKzKgwOzOB0oV47Q9z4xbJtpIhVbfNFIwgtoZ6X YVsFb8kikeH2dqEjlnRMBDR4lbEDWJTRf3rkZVVf6hA22c0SP+n2mjOi4ViKdYobmZAWXUuFZaooi kgmU+tyBf3ydEUIJOGww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sChRW-00000007f0u-29kw; Thu, 30 May 2024 15:11:50 +0000 Received: from mgamail.intel.com ([198.175.65.10]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sChRB-00000007emk-0dUQ for linux-arm-kernel@lists.infradead.org; Thu, 30 May 2024 15:11:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717081889; x=1748617889; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xuQ6DZkTEDRxFoGQhloOJPIufIaUVMudZOmQbEL7V4Q=; b=QKtfBXqi8Gd5zl+ONzw/eUZoRpm7dDc4NKrUfYHXYREVUiRv5DomPw2M 8rrS38QCa4vOz0KF+pXyygf1uG1cV/iU0fT3TPzcytmRcahZy1UreLOIF 6gUiflCdxtoRBaXuy6yHHX5yMw6IyJI44gwSgYBfFmm3JmEmpi3FBkfwD X3TBexnzhyQfYbeUoQGlnESsE8Jzry0qxtqI5rd6DpnlTE7QnKy1WYa21 M0BCQFda4QPkSNxupslwHKhKbsc0vtDYGhiq96C71ScQRRfrYD3tcvfOU Qmpimy+8mH08AUI7TSrS1335bEtbzBpLLPWcN7bQsOoowWK7jDAl3pT+L w==; X-CSE-ConnectionGUID: CZtTQ1h8Si6bnxK+kUXxdg== X-CSE-MsgGUID: +jt0x/nuTh2CngpqTufzqQ== X-IronPort-AV: E=McAfee;i="6600,9927,11088"; a="31067928" X-IronPort-AV: E=Sophos;i="6.08,201,1712646000"; d="scan'208";a="31067928" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2024 08:11:22 -0700 X-CSE-ConnectionGUID: RHkbdXUlRvKwVAoxgpxB+g== X-CSE-MsgGUID: wsKMsGyIQ363d/2wS2JSeA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,201,1712646000"; d="scan'208";a="73329421" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa001.jf.intel.com with ESMTP; 30 May 2024 08:11:21 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 2C1252DC; Thu, 30 May 2024 18:11:19 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , Linus Walleij , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik Subject: [PATCH v2 02/11] spi: pxa2xx: Reorganize the SSP type retrieval Date: Thu, 30 May 2024 18:09:58 +0300 Message-ID: <20240530151117.1130792-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240530151117.1130792-1-andriy.shevchenko@linux.intel.com> References: <20240530151117.1130792-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-20240530_081129_369476_10119155 X-CRM114-Status: GOOD ( 15.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 The old Intel platforms, such as Intel Braswell, also provide the property of SSP type. Reorganize the pxa2xx_spi_init_pdata() to take that into account. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 820a3702447a..f4dc113768cd 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1331,19 +1331,21 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) struct pxa2xx_spi_controller *pdata; struct device *dev = &pdev->dev; struct device *parent = dev->parent; + const void *match = device_get_match_data(dev); enum pxa_ssp_type type = SSP_UNDEFINED; - struct ssp_device *ssp = NULL; - const void *match; + struct ssp_device *ssp; bool is_lpss_priv; u32 num_cs = 1; int status; - is_lpss_priv = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lpss_priv"); - - match = device_get_match_data(dev); - if (match) - type = (uintptr_t)match; - else if (is_lpss_priv) { + ssp = pxa2xx_spi_ssp_request(pdev); + if (IS_ERR(ssp)) + return ERR_CAST(ssp); + if (ssp) { + type = ssp->type; + } else if (match) { + type = (enum pxa_ssp_type)(uintptr_t)match; + } else { u32 value; status = device_property_read_u32(dev, "intel,spi-pxa2xx-type", &value); @@ -1351,12 +1353,6 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) return ERR_PTR(status); type = (enum pxa_ssp_type)value; - } else { - ssp = pxa2xx_spi_ssp_request(pdev); - if (IS_ERR(ssp)) - return ERR_CAST(ssp); - if (ssp) - type = ssp->type; } /* Validate the SSP type correctness */ @@ -1368,6 +1364,7 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) return ERR_PTR(-ENOMEM); /* Platforms with iDMA 64-bit */ + is_lpss_priv = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lpss_priv"); if (is_lpss_priv) { pdata->tx_param = parent; pdata->rx_param = parent;