aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/rtsx_pcr.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd/rtsx_pcr.c')
-rw-r--r--drivers/mfd/rtsx_pcr.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c
index dd186c4103c1..e06d6b0d55f6 100644
--- a/drivers/mfd/rtsx_pcr.c
+++ b/drivers/mfd/rtsx_pcr.c
@@ -73,6 +73,9 @@ void rtsx_pci_start_run(struct rtsx_pcr *pcr)
73 pcr->state = PDEV_STAT_RUN; 73 pcr->state = PDEV_STAT_RUN;
74 if (pcr->ops->enable_auto_blink) 74 if (pcr->ops->enable_auto_blink)
75 pcr->ops->enable_auto_blink(pcr); 75 pcr->ops->enable_auto_blink(pcr);
76
77 if (pcr->aspm_en)
78 rtsx_pci_write_config_byte(pcr, LCTLR, 0);
76 } 79 }
77 80
78 mod_delayed_work(system_wq, &pcr->idle_work, msecs_to_jiffies(200)); 81 mod_delayed_work(system_wq, &pcr->idle_work, msecs_to_jiffies(200));
@@ -717,7 +720,7 @@ int rtsx_pci_card_exclusive_check(struct rtsx_pcr *pcr, int card)
717 [RTSX_MS_CARD] = MS_EXIST 720 [RTSX_MS_CARD] = MS_EXIST
718 }; 721 };
719 722
720 if (!pcr->ms_pmos) { 723 if (!(pcr->flags & PCR_MS_PMOS)) {
721 /* When using single PMOS, accessing card is not permitted 724 /* When using single PMOS, accessing card is not permitted
722 * if the existing card is not the designated one. 725 * if the existing card is not the designated one.
723 */ 726 */
@@ -918,6 +921,9 @@ static void rtsx_pci_idle_work(struct work_struct *work)
918 if (pcr->ops->turn_off_led) 921 if (pcr->ops->turn_off_led)
919 pcr->ops->turn_off_led(pcr); 922 pcr->ops->turn_off_led(pcr);
920 923
924 if (pcr->aspm_en)
925 rtsx_pci_write_config_byte(pcr, LCTLR, pcr->aspm_en);
926
921 mutex_unlock(&pcr->pcr_mutex); 927 mutex_unlock(&pcr->pcr_mutex);
922} 928}
923 929
@@ -956,8 +962,8 @@ static int rtsx_pci_init_hw(struct rtsx_pcr *pcr)
956 /* Reset delink mode */ 962 /* Reset delink mode */
957 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CHANGE_LINK_STATE, 0x0A, 0); 963 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CHANGE_LINK_STATE, 0x0A, 0);
958 /* Card driving select */ 964 /* Card driving select */
959 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SD30_DRIVE_SEL, 965 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_DRIVE_SEL,
960 0x07, DRIVER_TYPE_D); 966 0xFF, pcr->card_drive_sel);
961 /* Enable SSC Clock */ 967 /* Enable SSC Clock */
962 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SSC_CTL1, 968 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SSC_CTL1,
963 0xFF, SSC_8X_EN | SSC_SEL_4M); 969 0xFF, SSC_8X_EN | SSC_SEL_4M);
@@ -989,6 +995,8 @@ static int rtsx_pci_init_hw(struct rtsx_pcr *pcr)
989 if (err < 0) 995 if (err < 0)
990 return err; 996 return err;
991 997
998 rtsx_pci_write_config_byte(pcr, LCTLR, 0);
999
992 /* Enable clk_request_n to enable clock power management */ 1000 /* Enable clk_request_n to enable clock power management */
993 rtsx_pci_write_config_byte(pcr, 0x81, 1); 1001 rtsx_pci_write_config_byte(pcr, 0x81, 1);
994 /* Enter L1 when host tx idle */ 1002 /* Enter L1 when host tx idle */
@@ -1053,6 +1061,18 @@ static int rtsx_pci_init_chip(struct rtsx_pcr *pcr)
1053 if (!pcr->slots) 1061 if (!pcr->slots)
1054 return -ENOMEM; 1062 return -ENOMEM;
1055 1063
1064 if (pcr->ops->fetch_vendor_settings)
1065 pcr->ops->fetch_vendor_settings(pcr);
1066
1067 dev_dbg(&(pcr->pci->dev), "pcr->aspm_en = 0x%x\n", pcr->aspm_en);
1068 dev_dbg(&(pcr->pci->dev), "pcr->sd30_drive_sel_1v8 = 0x%x\n",
1069 pcr->sd30_drive_sel_1v8);
1070 dev_dbg(&(pcr->pci->dev), "pcr->sd30_drive_sel_3v3 = 0x%x\n",
1071 pcr->sd30_drive_sel_3v3);
1072 dev_dbg(&(pcr->pci->dev), "pcr->card_drive_sel = 0x%x\n",
1073 pcr->card_drive_sel);
1074 dev_dbg(&(pcr->pci->dev), "pcr->flags = 0x%x\n", pcr->flags);
1075
1056 pcr->state = PDEV_STAT_IDLE; 1076 pcr->state = PDEV_STAT_IDLE;
1057 err = rtsx_pci_init_hw(pcr); 1077 err = rtsx_pci_init_hw(pcr);
1058 if (err < 0) { 1078 if (err < 0) {