drivers: mspi_dw: Edit core disable to after PM init
There is a scenario where a Bus fault occurs as the
power management isn't initialised yet and the core
is attempted to be turned off via the ssienr register.
This commit edits this so the core register is written
to after the initialisation of the power management.
Signed-off-by: David Jewsbury <david.jewsbury@nordicsemi.no>
diff --git a/drivers/mspi/mspi_dw.c b/drivers/mspi/mspi_dw.c
index 49bab8d..02cfaad 100644
--- a/drivers/mspi/mspi_dw.c
+++ b/drivers/mspi/mspi_dw.c
@@ -1864,9 +1864,6 @@
}
}
- /* Make sure controller is disabled. */
- write_ssienr(dev, 0);
-
#if defined(CONFIG_PINCTRL)
if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) {
rc = pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_SLEEP);
@@ -1877,7 +1874,15 @@
}
#endif
- return pm_device_driver_init(dev, dev_pm_action_cb);
+ rc = pm_device_driver_init(dev, dev_pm_action_cb);
+ if (rc < 0) {
+ return rc;
+ }
+
+ /* Make sure controller is disabled. */
+ write_ssienr(dev, 0);
+
+ return 0;
}
static DEVICE_API(mspi, drv_api) = {