Commit 1a1864cd authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Mark Brown

spi: pxa2xx: Respect Intel SSP type given by a property

Allow to set the Intel SSP type by reading the property.
Only apply this to the known MFD enumerated LPSS devices.

The check is done by the looking for the specifically
named IO memory resource provided by upper layer. This
won't be an issue in the future because we strictly
prioritize the order in which we are looking for the SSP
type in the code.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20221021190018.63646-3-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 88a94721
...@@ -1462,9 +1462,12 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) ...@@ -1462,9 +1462,12 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev)
const struct pci_device_id *pcidev_id = NULL; const struct pci_device_id *pcidev_id = NULL;
enum pxa_ssp_type type = SSP_UNDEFINED; enum pxa_ssp_type type = SSP_UNDEFINED;
const void *match; const void *match;
bool is_lpss_priv;
int status; int status;
u64 uid; u64 uid;
is_lpss_priv = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lpss_priv");
if (pcidev) if (pcidev)
pcidev_id = pci_match_id(pxa2xx_spi_pci_compound_match, pcidev); pcidev_id = pci_match_id(pxa2xx_spi_pci_compound_match, pcidev);
...@@ -1473,6 +1476,15 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) ...@@ -1473,6 +1476,15 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev)
type = (enum pxa_ssp_type)match; type = (enum pxa_ssp_type)match;
else if (pcidev_id) else if (pcidev_id)
type = (enum pxa_ssp_type)pcidev_id->driver_data; type = (enum pxa_ssp_type)pcidev_id->driver_data;
else if (is_lpss_priv) {
u32 value;
status = device_property_read_u32(dev, "intel,spi-pxa2xx-type", &value);
if (status)
return ERR_PTR(status);
type = (enum pxa_ssp_type)value;
}
/* Validate the SSP type correctness */ /* Validate the SSP type correctness */
if (!(type > SSP_UNDEFINED && type < SSP_MAX)) if (!(type > SSP_UNDEFINED && type < SSP_MAX))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment