1

spi: pxa2xx: Reorganize the SSP type retrieval

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>
Link: https://msgid.link/r/20240530151117.1130792-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Andy Shevchenko 2024-05-30 18:09:58 +03:00 committed by Mark Brown
parent a2fca8f2e2
commit 8aa5062e26
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -1331,19 +1331,21 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev)
struct pxa2xx_spi_controller *pdata; struct pxa2xx_spi_controller *pdata;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct device *parent = dev->parent; struct device *parent = dev->parent;
const void *match = device_get_match_data(dev);
enum pxa_ssp_type type = SSP_UNDEFINED; enum pxa_ssp_type type = SSP_UNDEFINED;
struct ssp_device *ssp = NULL; struct ssp_device *ssp;
const void *match;
bool is_lpss_priv; bool is_lpss_priv;
u32 num_cs = 1; u32 num_cs = 1;
int status; int status;
is_lpss_priv = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lpss_priv"); ssp = pxa2xx_spi_ssp_request(pdev);
if (IS_ERR(ssp))
match = device_get_match_data(dev); return ERR_CAST(ssp);
if (match) if (ssp) {
type = (uintptr_t)match; type = ssp->type;
else if (is_lpss_priv) { } else if (match) {
type = (enum pxa_ssp_type)(uintptr_t)match;
} else {
u32 value; u32 value;
status = device_property_read_u32(dev, "intel,spi-pxa2xx-type", &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); return ERR_PTR(status);
type = (enum pxa_ssp_type)value; 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 */ /* Validate the SSP type correctness */
@ -1368,6 +1364,7 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
/* Platforms with iDMA 64-bit */ /* Platforms with iDMA 64-bit */
is_lpss_priv = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lpss_priv");
if (is_lpss_priv) { if (is_lpss_priv) {
pdata->tx_param = parent; pdata->tx_param = parent;
pdata->rx_param = parent; pdata->rx_param = parent;