From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Mark Brown <broonie@kernel.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Linus Walleij <linus.walleij@linaro.org>,
linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Cc: Daniel Mack <daniel@zonque.org>,
Haojian Zhuang <haojian.zhuang@gmail.com>,
Robert Jarzmik <robert.jarzmik@free.fr>
Subject: [PATCH v2 02/11] spi: pxa2xx: Reorganize the SSP type retrieval
Date: Thu, 30 May 2024 18:09:58 +0300 [thread overview]
Message-ID: <20240530151117.1130792-3-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20240530151117.1130792-1-andriy.shevchenko@linux.intel.com>
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 <andriy.shevchenko@linux.intel.com>
---
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;
--
2.43.0.rc1.1336.g36b5255a03ac
next prev parent reply other threads:[~2024-05-30 15:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-30 15:09 [PATCH v2 00/11] spi: pxa2xx: Get rid of an additional layer in PCI driver Andy Shevchenko
2024-05-30 15:09 ` [PATCH v2 01/11] spi: pxa2xx: Wrap pxa_ssp_request() to be device managed resource Andy Shevchenko
2024-05-30 15:09 ` Andy Shevchenko [this message]
2024-05-30 15:09 ` [PATCH v2 03/11] spi: pxa2xx: Remove no more needed driver data Andy Shevchenko
2024-05-30 15:10 ` [PATCH v2 04/11] spi: pxa2xx: Remove hard coded number of chip select pins Andy Shevchenko
2024-05-30 15:10 ` [PATCH v2 05/11] spi: pxa2xx: Utilise temporary variable for struct device Andy Shevchenko
2024-05-30 15:10 ` [PATCH v2 06/11] spi: pxa2xx: Print DMA burst size only when DMA is enabled Andy Shevchenko
2024-05-30 15:10 ` [PATCH v2 07/11] spi: pxa2xx: Remove duplicate check Andy Shevchenko
2024-05-30 15:10 ` [PATCH v2 08/11] spi: pxa2xx: Remove superflous check for Intel Atom SoCs Andy Shevchenko
2024-05-30 15:10 ` [PATCH v2 09/11] spi: pxa2xx: Extract pxa2xx_spi_platform_*() callbacks Andy Shevchenko
2024-05-30 15:10 ` [PATCH v2 10/11] spi: pxa2xx: Move platform driver to a separate file Andy Shevchenko
2024-05-30 15:10 ` [PATCH v2 11/11] spi: pxa2xx: Convert PCI driver to use spi-pxa2xx code directly Andy Shevchenko
2024-06-05 21:38 ` [PATCH v2 00/11] spi: pxa2xx: Get rid of an additional layer in PCI driver Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240530151117.1130792-3-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=broonie@kernel.org \
--cc=daniel@zonque.org \
--cc=haojian.zhuang@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=robert.jarzmik@free.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).