mbox series

[0/2] spi-cadence-quadspi: Introduce runtime_pm support

Message ID 20230818103750.516309-1-d-gole@ti.com
Headers show
Series spi-cadence-quadspi: Introduce runtime_pm support | expand

Message

Dhruva Gole Aug. 18, 2023, 10:37 a.m. UTC
Abstract
********

This series aims to add runtime_pm [0] functionality to the cadence-qspi
driver/IP. Prior to this, the driver had system suspend resume support
which comes into picture only during system wide low power states like
deep sleep / Suspend-to-RAM.

Now, with runtime_pm support we can finally allow this driver/controller
to be clock gated/ suspended when it's not in active use. This helps the
overall system to reduce it's power consumption without needing to resort
to system wide low power modes.

As it turns out, the system suspend resume functionality that existed so
far can be re-used as is even for runtime suspend resume, hence the
actual implementations of those calls need not change.

Testing
*******

This series has been tested by me on a SK-AM625 [1] EVM by Texas Instruments.

I did a basic test to check if IP suspended by trying to access it's
registers while suspended (got core dump) and then to check resume I
read back data from it. Also used k3conf, a TI tool to check on the
device status in K3 Family of SOCs.

I highly encourage other platforms and users of this driver to test
these changes as it affects all those who use runtime_pm.
For this, I have uploaded these changes on my github branch [2] which
can be cloned and readily used.
For referring to how I tested, please refer to my logs [3]

Runtime PM usage
****************

The auto-suspend delay can be tweaked from the userspace using the
following sysfs entry:

root@am62xx-evm:~# cat /sys/bus/platform/devices/fc40000.spi/power/autosuspend_delay_ms
2000

Other useful information can be obtained from the same folder,

root@am62xx-evm:~# cat /sys/bus/platform/devices/fc40000.spi/power/runtime_*

To disable runtime auto-suspend for this driver one can set autosuspend_delay_ms to -1

Note to maintainers
*******************

* Patch 1/2 should probably go via Nishant's / Vignesh's tree
* Patch 2/2 (RFT) can go via Mark's tree

Reference/Links
***************

[0] https://docs.kernel.org/power/runtime_pm.html
[1] https://www.ti.com/tool/SK-AM62
[2] https://github.com/DhruvaG2000/v-linux/tree/ospi_runtime_pm
[3] https://gist.github.com/DhruvaG2000/6aeeb2196caf8fbbe518c89037cb7548

Dhruva Gole (2):
  arm64: dts: ti: k3-am62-main: PM fixes in the fss node
  spi: spi-cadence-quadspi: add runtime pm support

 arch/arm64/boot/dts/ti/k3-am62-main.dtsi |  3 +-
 drivers/spi/spi-cadence-quadspi.c        | 38 ++++++++++++++++++------
 2 files changed, 31 insertions(+), 10 deletions(-)


base-commit: 47762f08697484cf0c2f2904b8c52375ed26c8cb