diff mbox series

[6/6] bus: fsl-mc: add .shutdown() op for DPRC driver

Message ID 20220208145928.12468-7-laurentiu.tudor@nxp.com (mailing list archive)
State New, archived
Headers show
Series bus: fsl-mc: fixes and .shutdown() op for dprc driver | expand

Commit Message

Laurentiu Tudor Feb. 8, 2022, 2:59 p.m. UTC
From: Laurentiu Tudor <laurentiu.tudor@nxp.com>

In order for kexec scenarios to work, implement a .shutdown() op for
the DPRC driver.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
---
 drivers/bus/fsl-mc/dprc-driver.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
diff mbox series

Patch

diff --git a/drivers/bus/fsl-mc/dprc-driver.c b/drivers/bus/fsl-mc/dprc-driver.c
index 82bf3fe09273..405cd054c2ea 100644
--- a/drivers/bus/fsl-mc/dprc-driver.c
+++ b/drivers/bus/fsl-mc/dprc-driver.c
@@ -861,6 +861,30 @@  static int dprc_remove(struct fsl_mc_device *mc_dev)
 	return 0;
 }
 
+/**
+ * dprc_shutdown - callback invoked when a DPRC should be quiesced
+ *
+ * @mc_dev: Pointer to fsl-mc device representing the DPRC
+ *
+ * Closes the DPRC device in the MC.
+ * It tears down the interrupts that were configured for the DPRC device.
+ * It destroys the interrupt pool associated with this MC bus.
+ */
+static void dprc_shutdown(struct fsl_mc_device *mc_dev)
+{
+	struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_dev);
+
+	if (!is_fsl_mc_bus_dprc(mc_dev))
+		return;
+
+	if (!mc_bus->irq_resources)
+		return;
+
+	dprc_cleanup(mc_dev);
+
+	dev_info(&mc_dev->dev, "DPRC device shutdown");
+}
+
 static const struct fsl_mc_device_id match_id_table[] = {
 	{
 	 .vendor = FSL_MC_VENDOR_FREESCALE,
@@ -877,6 +901,7 @@  static struct fsl_mc_driver dprc_driver = {
 	.match_id_table = match_id_table,
 	.probe = dprc_probe,
 	.remove = dprc_remove,
+	.shutdown = dprc_shutdown,
 };
 
 int __init dprc_driver_init(void)