spi: spi-zynqmp-gqspi: fix hang issue when suspend/resume
authorQuanyang Wang <quanyang.wang@windriver.com>
Fri, 16 Apr 2021 00:46:49 +0000 (08:46 +0800)
committerMark Brown <broonie@kernel.org>
Fri, 16 Apr 2021 12:44:12 +0000 (13:44 +0100)
commit799f923f0a66a9c99f0a3eaa078b306db7a8b33a
treed8bbecff1f9f723ca48693e7e58250f21ce776ac
parentc6bdae08012b2ca3e94f3a41ef4ca8cfe7c9ab6f
spi: spi-zynqmp-gqspi: fix hang issue when suspend/resume

After calling platform_set_drvdata(pdev, xqspi) in probe, the return
value of dev_get_drvdata(dev) is a pointer to struct zynqmp_qspi but
not struct spi_controller. A wrong structure type passing to the
functions spi_controller_suspend/resume will hang the system.

And we should check the return value of spi_controller_suspend, if
an error is returned, return it to PM subsystem to stop suspend.

Also, GQSPI_EN_MASK should be written to GQSPI_EN_OFST to enable
the spi controller in zynqmp_qspi_resume since it was disabled in
zynqmp_qspi_suspend before.

Fixes: 1c26372e5aa9 ("spi: spi-zynqmp-gqspi: Update driver to use spi-mem framework")
Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com>
Link: https://lore.kernel.org/r/20210416004652.2975446-3-quanyang.wang@windriver.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-zynqmp-gqspi.c