Skip to content

Commit c5412ec

Browse files
Larisa Grigorebroonie
authored andcommitted
spi: spi-fsl-dspi: Reinitialize DSPI regs after resuming for S32G
After resuming, DSPI registers (MCR and SR) need to be reinitialized for S32G platforms. Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com> Signed-off-by: James Clark <james.clark@linaro.org> Link: https://patch.msgid.link/20250522-james-nxp-spi-v2-10-bea884630cfb@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 870d6fd commit c5412ec

1 file changed

Lines changed: 42 additions & 35 deletions

File tree

drivers/spi/spi-fsl-dspi.c

Lines changed: 42 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,41 +1284,6 @@ static const struct of_device_id fsl_dspi_dt_ids[] = {
12841284
};
12851285
MODULE_DEVICE_TABLE(of, fsl_dspi_dt_ids);
12861286

1287-
#ifdef CONFIG_PM_SLEEP
1288-
static int dspi_suspend(struct device *dev)
1289-
{
1290-
struct fsl_dspi *dspi = dev_get_drvdata(dev);
1291-
1292-
if (dspi->irq)
1293-
disable_irq(dspi->irq);
1294-
spi_controller_suspend(dspi->ctlr);
1295-
clk_disable_unprepare(dspi->clk);
1296-
1297-
pinctrl_pm_select_sleep_state(dev);
1298-
1299-
return 0;
1300-
}
1301-
1302-
static int dspi_resume(struct device *dev)
1303-
{
1304-
struct fsl_dspi *dspi = dev_get_drvdata(dev);
1305-
int ret;
1306-
1307-
pinctrl_pm_select_default_state(dev);
1308-
1309-
ret = clk_prepare_enable(dspi->clk);
1310-
if (ret)
1311-
return ret;
1312-
spi_controller_resume(dspi->ctlr);
1313-
if (dspi->irq)
1314-
enable_irq(dspi->irq);
1315-
1316-
return 0;
1317-
}
1318-
#endif /* CONFIG_PM_SLEEP */
1319-
1320-
static SIMPLE_DEV_PM_OPS(dspi_pm, dspi_suspend, dspi_resume);
1321-
13221287
static int dspi_init(struct fsl_dspi *dspi)
13231288
{
13241289
unsigned int mcr;
@@ -1354,6 +1319,48 @@ static int dspi_init(struct fsl_dspi *dspi)
13541319
return 0;
13551320
}
13561321

1322+
#ifdef CONFIG_PM_SLEEP
1323+
static int dspi_suspend(struct device *dev)
1324+
{
1325+
struct fsl_dspi *dspi = dev_get_drvdata(dev);
1326+
1327+
if (dspi->irq)
1328+
disable_irq(dspi->irq);
1329+
spi_controller_suspend(dspi->ctlr);
1330+
clk_disable_unprepare(dspi->clk);
1331+
1332+
pinctrl_pm_select_sleep_state(dev);
1333+
1334+
return 0;
1335+
}
1336+
1337+
static int dspi_resume(struct device *dev)
1338+
{
1339+
struct fsl_dspi *dspi = dev_get_drvdata(dev);
1340+
int ret;
1341+
1342+
pinctrl_pm_select_default_state(dev);
1343+
1344+
ret = clk_prepare_enable(dspi->clk);
1345+
if (ret)
1346+
return ret;
1347+
spi_controller_resume(dspi->ctlr);
1348+
1349+
ret = dspi_init(dspi);
1350+
if (ret) {
1351+
dev_err(dev, "failed to initialize dspi during resume\n");
1352+
return ret;
1353+
}
1354+
1355+
if (dspi->irq)
1356+
enable_irq(dspi->irq);
1357+
1358+
return 0;
1359+
}
1360+
#endif /* CONFIG_PM_SLEEP */
1361+
1362+
static SIMPLE_DEV_PM_OPS(dspi_pm, dspi_suspend, dspi_resume);
1363+
13571364
static int dspi_target_abort(struct spi_controller *host)
13581365
{
13591366
struct fsl_dspi *dspi = spi_controller_get_devdata(host);

0 commit comments

Comments
 (0)