diff mbox series

[v1,2/6] spi: pxa2xx: Respect Intel SSP type given by a property

Message ID 20221017171243.57078-2-andriy.shevchenko@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [v1,1/6] spi: pxa2xx: Simplify with devm_platform_get_and_ioremap_resource() | expand

Commit Message

Andy Shevchenko Oct. 17, 2022, 5:12 p.m. UTC
Allow to set the Intel SSP type by reading the property.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/spi/spi-pxa2xx.c   | 6 ++++++
 include/linux/pxa2xx_ssp.h | 1 +
 2 files changed, 7 insertions(+)

Comments

Mark Brown Oct. 17, 2022, 5:17 p.m. UTC | #1
On Mon, Oct 17, 2022 at 08:12:39PM +0300, Andy Shevchenko wrote:

> Allow to set the Intel SSP type by reading the property.

> +	/* Always try to read property */
> +	device_property_read_u32(&pdev->dev, "intel,spi-pxa2xx-type", &value);
> +

What is the advantage of pushing this into firmware?
Andy Shevchenko Oct. 17, 2022, 5:34 p.m. UTC | #2
On Mon, Oct 17, 2022 at 06:17:36PM +0100, Mark Brown wrote:
> On Mon, Oct 17, 2022 at 08:12:39PM +0300, Andy Shevchenko wrote:
> 
> > Allow to set the Intel SSP type by reading the property.
> 
> > +	/* Always try to read property */
> > +	device_property_read_u32(&pdev->dev, "intel,spi-pxa2xx-type", &value);
> 
> What is the advantage of pushing this into firmware?

To distinguish better what the controller generation is there.
diff mbox series

Patch

diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index 03ed6d4a14cd..857732a54ca7 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -1460,6 +1460,7 @@  pxa2xx_spi_init_pdata(struct platform_device *pdev)
 	struct resource *res;
 	struct pci_dev *pcidev = dev_is_pci(parent) ? to_pci_dev(parent) : NULL;
 	const struct pci_device_id *pcidev_id = NULL;
+	u32 value = SSP_UNDEFINED;
 	enum pxa_ssp_type type;
 	const void *match;
 	int status;
@@ -1468,9 +1469,14 @@  pxa2xx_spi_init_pdata(struct platform_device *pdev)
 	if (pcidev)
 		pcidev_id = pci_match_id(pxa2xx_spi_pci_compound_match, pcidev);
 
+	/* Always try to read property */
+	device_property_read_u32(&pdev->dev, "intel,spi-pxa2xx-type", &value);
+
 	match = device_get_match_data(&pdev->dev);
 	if (match)
 		type = (enum pxa_ssp_type)match;
+	else if (value > SSP_UNDEFINED && value < SSP_MAX)
+		type = (enum pxa_ssp_type)value;
 	else if (pcidev_id)
 		type = (enum pxa_ssp_type)pcidev_id->driver_data;
 	else
diff --git a/include/linux/pxa2xx_ssp.h b/include/linux/pxa2xx_ssp.h
index a3fec2de512f..cd1973e6ac4b 100644
--- a/include/linux/pxa2xx_ssp.h
+++ b/include/linux/pxa2xx_ssp.h
@@ -229,6 +229,7 @@  enum pxa_ssp_type {
 	LPSS_SPT_SSP,
 	LPSS_BXT_SSP,
 	LPSS_CNL_SSP,
+	SSP_MAX
 };
 
 struct ssp_device {