@@ -693,6 +693,35 @@ static int sdhci_pci_o2_init_sd_express(struct mmc_host *mmc, struct mmc_ios *io
693
693
return 0 ;
694
694
}
695
695
696
+ static void sdhci_pci_o2_set_power (struct sdhci_host * host , unsigned char mode , unsigned short vdd )
697
+ {
698
+ struct sdhci_pci_chip * chip ;
699
+ struct sdhci_pci_slot * slot = sdhci_priv (host );
700
+ u32 scratch_32 = 0 ;
701
+ u8 scratch_8 = 0 ;
702
+
703
+ chip = slot -> chip ;
704
+
705
+ if (mode == MMC_POWER_OFF ) {
706
+ /* UnLock WP */
707
+ pci_read_config_byte (chip -> pdev , O2_SD_LOCK_WP , & scratch_8 );
708
+ scratch_8 &= 0x7f ;
709
+ pci_write_config_byte (chip -> pdev , O2_SD_LOCK_WP , scratch_8 );
710
+
711
+ /* Set PCR 0x354[16] to switch Clock Source back to OPE Clock */
712
+ pci_read_config_dword (chip -> pdev , O2_SD_OUTPUT_CLK_SOURCE_SWITCH , & scratch_32 );
713
+ scratch_32 &= ~(O2_SD_SEL_DLL );
714
+ pci_write_config_dword (chip -> pdev , O2_SD_OUTPUT_CLK_SOURCE_SWITCH , scratch_32 );
715
+
716
+ /* Lock WP */
717
+ pci_read_config_byte (chip -> pdev , O2_SD_LOCK_WP , & scratch_8 );
718
+ scratch_8 |= 0x80 ;
719
+ pci_write_config_byte (chip -> pdev , O2_SD_LOCK_WP , scratch_8 );
720
+ }
721
+
722
+ sdhci_set_power (host , mode , vdd );
723
+ }
724
+
696
725
static int sdhci_pci_o2_probe_slot (struct sdhci_pci_slot * slot )
697
726
{
698
727
struct sdhci_pci_chip * chip ;
@@ -1051,6 +1080,7 @@ static const struct sdhci_ops sdhci_pci_o2_ops = {
1051
1080
.set_bus_width = sdhci_set_bus_width ,
1052
1081
.reset = sdhci_reset ,
1053
1082
.set_uhs_signaling = sdhci_set_uhs_signaling ,
1083
+ .set_power = sdhci_pci_o2_set_power ,
1054
1084
};
1055
1085
1056
1086
const struct sdhci_pci_fixes sdhci_o2 = {
0 commit comments