File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -722,20 +722,21 @@ static int sdhc_spi_set_io(const struct device *dev, struct sdhc_io *ios)
722722 }
723723 if (data -> power_mode != ios -> power_mode ) {
724724 if (ios -> power_mode == SDHC_POWER_ON ) {
725+ if (cfg -> pwr_gpio .port ) {
726+ if (gpio_pin_set_dt (& cfg -> pwr_gpio , 1 )) {
727+ return - EIO ;
728+ }
729+
730+ LOG_INF ("Powered up" );
731+ }
732+
725733 /* Send 74 clock cycles to start card */
726734 if (sdhc_spi_init_card (dev ) != 0 ) {
727735 LOG_ERR ("Card SCLK init sequence failed" );
728736 return - EIO ;
729737 }
730- }
731- if (cfg -> pwr_gpio .port ) {
732- /* If power control GPIO is defined, toggle SD power */
733- if (ios -> power_mode == SDHC_POWER_ON ) {
734- if (gpio_pin_set_dt (& cfg -> pwr_gpio , 1 )) {
735- return - EIO ;
736- }
737- LOG_INF ("Powered up" );
738- } else {
738+ } else {
739+ if (cfg -> pwr_gpio .port ) {
739740 if (gpio_pin_set_dt (& cfg -> pwr_gpio , 0 )) {
740741 return - EIO ;
741742 }
You can’t perform that action at this time.
0 commit comments