@@ -804,7 +804,7 @@ static int stm32_ospi_get_resources(struct platform_device *pdev)
804804 return ret ;
805805 }
806806
807- ospi -> rstc = devm_reset_control_array_get_exclusive (dev );
807+ ospi -> rstc = devm_reset_control_array_get_exclusive_released (dev );
808808 if (IS_ERR (ospi -> rstc ))
809809 return dev_err_probe (dev , PTR_ERR (ospi -> rstc ),
810810 "Can't get reset\n" );
@@ -936,12 +936,16 @@ static int stm32_ospi_probe(struct platform_device *pdev)
936936 if (ret < 0 )
937937 goto err_pm_enable ;
938938
939- if (ospi -> rstc ) {
940- reset_control_assert ( ospi -> rstc );
941- udelay ( 2 );
942- reset_control_deassert ( ospi -> rstc ) ;
939+ ret = reset_control_acquire (ospi -> rstc );
940+ if ( ret ) {
941+ dev_err_probe ( dev , ret , "Can not acquire reset %d\n" , ret );
942+ goto err_pm_resume ;
943943 }
944944
945+ reset_control_assert (ospi -> rstc );
946+ udelay (2 );
947+ reset_control_deassert (ospi -> rstc );
948+
945949 ret = spi_register_controller (ctrl );
946950 if (ret ) {
947951 /* Disable ospi */
@@ -987,6 +991,8 @@ static void stm32_ospi_remove(struct platform_device *pdev)
987991 if (ospi -> dma_chrx )
988992 dma_release_channel (ospi -> dma_chrx );
989993
994+ reset_control_release (ospi -> rstc );
995+
990996 pm_runtime_put_sync_suspend (ospi -> dev );
991997 pm_runtime_force_suspend (ospi -> dev );
992998}
@@ -997,6 +1003,8 @@ static int __maybe_unused stm32_ospi_suspend(struct device *dev)
9971003
9981004 pinctrl_pm_select_sleep_state (dev );
9991005
1006+ reset_control_release (ospi -> rstc );
1007+
10001008 return pm_runtime_force_suspend (ospi -> dev );
10011009}
10021010
@@ -1016,6 +1024,12 @@ static int __maybe_unused stm32_ospi_resume(struct device *dev)
10161024 if (ret < 0 )
10171025 return ret ;
10181026
1027+ ret = reset_control_acquire (ospi -> rstc );
1028+ if (ret ) {
1029+ dev_err (dev , "Can not acquire reset\n" );
1030+ return ret ;
1031+ }
1032+
10191033 writel_relaxed (ospi -> cr_reg , regs_base + OSPI_CR );
10201034 writel_relaxed (ospi -> dcr_reg , regs_base + OSPI_DCR1 );
10211035 pm_runtime_mark_last_busy (ospi -> dev );
0 commit comments