spi: pxa2xx: Skip SSP initialization if it's done elsewhere
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 27 Mar 2024 19:29:23 +0000 (21:29 +0200)
committerMark Brown <broonie@kernel.org>
Thu, 28 Mar 2024 20:34:50 +0000 (20:34 +0000)
If SSP has been enumerated elsewhere, skip its initialization
in pxa2xx_spi_init_pdata().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://msgid.link/r/20240327193138.2385910-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-pxa2xx.c

index e7072727c25c35c6a5c4688a9f8990865a0cab10..b01a18c89b6bceb6ccc54cef1d1d82027bcc3e4b 100644 (file)
@@ -1355,6 +1355,7 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev)
        struct device *dev = &pdev->dev;
        struct device *parent = dev->parent;
        enum pxa_ssp_type type = SSP_UNDEFINED;
+       struct ssp_device *ssp = NULL;
        const void *match;
        bool is_lpss_priv;
        int status;
@@ -1372,6 +1373,10 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev)
                        return ERR_PTR(status);
 
                type = (enum pxa_ssp_type)value;
+       } else {
+               ssp = pxa_ssp_request(pdev->id, pdev->name);
+               if (ssp)
+                       type = ssp->type;
        }
 
        /* Validate the SSP type correctness */
@@ -1394,6 +1399,10 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev)
        pdata->enable_dma = true;
        pdata->dma_burst_size = 1;
 
+       /* If SSP has been already enumerated, use it */
+       if (ssp)
+               return pdata;
+
        status = pxa2xx_spi_init_ssp(pdev, &pdata->ssp, type);
        if (status)
                return ERR_PTR(status);