mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 00:22:00 +02:00
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>
This commit is contained in:
parent
870d6fda18
commit
c5412ec5f6
|
|
@ -1284,41 +1284,6 @@ static const struct of_device_id fsl_dspi_dt_ids[] = {
|
|||
};
|
||||
MODULE_DEVICE_TABLE(of, fsl_dspi_dt_ids);
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int dspi_suspend(struct device *dev)
|
||||
{
|
||||
struct fsl_dspi *dspi = dev_get_drvdata(dev);
|
||||
|
||||
if (dspi->irq)
|
||||
disable_irq(dspi->irq);
|
||||
spi_controller_suspend(dspi->ctlr);
|
||||
clk_disable_unprepare(dspi->clk);
|
||||
|
||||
pinctrl_pm_select_sleep_state(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dspi_resume(struct device *dev)
|
||||
{
|
||||
struct fsl_dspi *dspi = dev_get_drvdata(dev);
|
||||
int ret;
|
||||
|
||||
pinctrl_pm_select_default_state(dev);
|
||||
|
||||
ret = clk_prepare_enable(dspi->clk);
|
||||
if (ret)
|
||||
return ret;
|
||||
spi_controller_resume(dspi->ctlr);
|
||||
if (dspi->irq)
|
||||
enable_irq(dspi->irq);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_PM_SLEEP */
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(dspi_pm, dspi_suspend, dspi_resume);
|
||||
|
||||
static int dspi_init(struct fsl_dspi *dspi)
|
||||
{
|
||||
unsigned int mcr;
|
||||
|
|
@ -1354,6 +1319,48 @@ static int dspi_init(struct fsl_dspi *dspi)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int dspi_suspend(struct device *dev)
|
||||
{
|
||||
struct fsl_dspi *dspi = dev_get_drvdata(dev);
|
||||
|
||||
if (dspi->irq)
|
||||
disable_irq(dspi->irq);
|
||||
spi_controller_suspend(dspi->ctlr);
|
||||
clk_disable_unprepare(dspi->clk);
|
||||
|
||||
pinctrl_pm_select_sleep_state(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dspi_resume(struct device *dev)
|
||||
{
|
||||
struct fsl_dspi *dspi = dev_get_drvdata(dev);
|
||||
int ret;
|
||||
|
||||
pinctrl_pm_select_default_state(dev);
|
||||
|
||||
ret = clk_prepare_enable(dspi->clk);
|
||||
if (ret)
|
||||
return ret;
|
||||
spi_controller_resume(dspi->ctlr);
|
||||
|
||||
ret = dspi_init(dspi);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to initialize dspi during resume\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (dspi->irq)
|
||||
enable_irq(dspi->irq);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_PM_SLEEP */
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(dspi_pm, dspi_suspend, dspi_resume);
|
||||
|
||||
static int dspi_target_abort(struct spi_controller *host)
|
||||
{
|
||||
struct fsl_dspi *dspi = spi_controller_get_devdata(host);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user