• Home
  • Raw
  • Download

Lines Matching refs:pcr

30 static u8 rtl8411_get_ic_version(struct rtsx_pcr *pcr)  in rtl8411_get_ic_version()  argument
34 rtsx_pci_read_register(pcr, SYS_VER, &val); in rtl8411_get_ic_version()
38 static int rtl8411b_is_qfn48(struct rtsx_pcr *pcr) in rtl8411b_is_qfn48() argument
42 rtsx_pci_read_register(pcr, RTL8411B_PACKAGE_MODE, &val); in rtl8411b_is_qfn48()
50 static void rtl8411_fetch_vendor_settings(struct rtsx_pcr *pcr) in rtl8411_fetch_vendor_settings() argument
55 rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, &reg1); in rtl8411_fetch_vendor_settings()
56 pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg1); in rtl8411_fetch_vendor_settings()
61 pcr->aspm_en = rtsx_reg_to_aspm(reg1); in rtl8411_fetch_vendor_settings()
62 pcr->sd30_drive_sel_1v8 = in rtl8411_fetch_vendor_settings()
64 pcr->card_drive_sel &= 0x3F; in rtl8411_fetch_vendor_settings()
65 pcr->card_drive_sel |= rtsx_reg_to_card_drive_sel(reg1); in rtl8411_fetch_vendor_settings()
67 rtsx_pci_read_config_byte(pcr, PCR_SETTING_REG3, &reg3); in rtl8411_fetch_vendor_settings()
68 pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG3, reg3); in rtl8411_fetch_vendor_settings()
69 pcr->sd30_drive_sel_3v3 = rtl8411_reg_to_sd30_drive_sel_3v3(reg3); in rtl8411_fetch_vendor_settings()
72 static void rtl8411b_fetch_vendor_settings(struct rtsx_pcr *pcr) in rtl8411b_fetch_vendor_settings() argument
76 rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, &reg); in rtl8411b_fetch_vendor_settings()
77 pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg); in rtl8411b_fetch_vendor_settings()
82 pcr->aspm_en = rtsx_reg_to_aspm(reg); in rtl8411b_fetch_vendor_settings()
83 pcr->sd30_drive_sel_1v8 = in rtl8411b_fetch_vendor_settings()
85 pcr->sd30_drive_sel_3v3 = in rtl8411b_fetch_vendor_settings()
89 static void rtl8411_force_power_down(struct rtsx_pcr *pcr, u8 pm_state) in rtl8411_force_power_down() argument
91 rtsx_pci_write_register(pcr, FPDCTL, 0x07, 0x07); in rtl8411_force_power_down()
94 static int rtl8411_extra_init_hw(struct rtsx_pcr *pcr) in rtl8411_extra_init_hw() argument
96 rtsx_pci_init_cmd(pcr); in rtl8411_extra_init_hw()
98 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SD30_DRIVE_SEL, in rtl8411_extra_init_hw()
99 0xFF, pcr->sd30_drive_sel_3v3); in rtl8411_extra_init_hw()
100 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CD_PAD_CTL, in rtl8411_extra_init_hw()
103 return rtsx_pci_send_cmd(pcr, 100); in rtl8411_extra_init_hw()
106 static int rtl8411b_extra_init_hw(struct rtsx_pcr *pcr) in rtl8411b_extra_init_hw() argument
108 rtsx_pci_init_cmd(pcr); in rtl8411b_extra_init_hw()
110 if (rtl8411b_is_qfn48(pcr)) in rtl8411b_extra_init_hw()
111 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, in rtl8411b_extra_init_hw()
113 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SD30_DRIVE_SEL, in rtl8411b_extra_init_hw()
114 0xFF, pcr->sd30_drive_sel_3v3); in rtl8411b_extra_init_hw()
115 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CD_PAD_CTL, in rtl8411b_extra_init_hw()
117 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, FUNC_FORCE_CTL, in rtl8411b_extra_init_hw()
120 return rtsx_pci_send_cmd(pcr, 100); in rtl8411b_extra_init_hw()
123 static int rtl8411_turn_on_led(struct rtsx_pcr *pcr) in rtl8411_turn_on_led() argument
125 return rtsx_pci_write_register(pcr, CARD_GPIO, 0x01, 0x00); in rtl8411_turn_on_led()
128 static int rtl8411_turn_off_led(struct rtsx_pcr *pcr) in rtl8411_turn_off_led() argument
130 return rtsx_pci_write_register(pcr, CARD_GPIO, 0x01, 0x01); in rtl8411_turn_off_led()
133 static int rtl8411_enable_auto_blink(struct rtsx_pcr *pcr) in rtl8411_enable_auto_blink() argument
135 return rtsx_pci_write_register(pcr, CARD_AUTO_BLINK, 0xFF, 0x0D); in rtl8411_enable_auto_blink()
138 static int rtl8411_disable_auto_blink(struct rtsx_pcr *pcr) in rtl8411_disable_auto_blink() argument
140 return rtsx_pci_write_register(pcr, CARD_AUTO_BLINK, 0x08, 0x00); in rtl8411_disable_auto_blink()
143 static int rtl8411_card_power_on(struct rtsx_pcr *pcr, int card) in rtl8411_card_power_on() argument
147 rtsx_pci_init_cmd(pcr); in rtl8411_card_power_on()
148 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_PWR_CTL, in rtl8411_card_power_on()
150 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, LDO_CTL, in rtl8411_card_power_on()
152 err = rtsx_pci_send_cmd(pcr, 100); in rtl8411_card_power_on()
159 err = rtsx_pci_write_register(pcr, CARD_PWR_CTL, in rtl8411_card_power_on()
166 err = rtsx_pci_write_register(pcr, CARD_PWR_CTL, in rtl8411_card_power_on()
173 err = rtsx_pci_write_register(pcr, CARD_PWR_CTL, in rtl8411_card_power_on()
178 return rtsx_pci_write_register(pcr, LDO_CTL, BPP_LDO_POWB, BPP_LDO_ON); in rtl8411_card_power_on()
181 static int rtl8411_card_power_off(struct rtsx_pcr *pcr, int card) in rtl8411_card_power_off() argument
185 err = rtsx_pci_write_register(pcr, CARD_PWR_CTL, in rtl8411_card_power_off()
190 return rtsx_pci_write_register(pcr, LDO_CTL, in rtl8411_card_power_off()
194 static int rtl8411_do_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage, in rtl8411_do_switch_output_voltage() argument
202 err = rtsx_pci_write_register(pcr, in rtl8411_do_switch_output_voltage()
203 SD30_DRIVE_SEL, 0x07, pcr->sd30_drive_sel_3v3); in rtl8411_do_switch_output_voltage()
208 err = rtsx_pci_write_register(pcr, in rtl8411_do_switch_output_voltage()
209 SD30_DRIVE_SEL, 0x07, pcr->sd30_drive_sel_1v8); in rtl8411_do_switch_output_voltage()
217 return rtsx_pci_write_register(pcr, LDO_CTL, mask, val); in rtl8411_do_switch_output_voltage()
220 static int rtl8411_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage) in rtl8411_switch_output_voltage() argument
222 return rtl8411_do_switch_output_voltage(pcr, voltage, in rtl8411_switch_output_voltage()
226 static int rtl8402_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage) in rtl8402_switch_output_voltage() argument
228 return rtl8411_do_switch_output_voltage(pcr, voltage, in rtl8402_switch_output_voltage()
232 static unsigned int rtl8411_cd_deglitch(struct rtsx_pcr *pcr) in rtl8411_cd_deglitch() argument
236 card_exist = rtsx_pci_readl(pcr, RTSX_BIPR); in rtl8411_cd_deglitch()
240 rtsx_pci_write_register(pcr, CD_PAD_CTL, in rtl8411_cd_deglitch()
243 rtsx_pci_write_register(pcr, EFUSE_CONTENT, 0xe0, 0x00); in rtl8411_cd_deglitch()
248 rtsx_pci_write_register(pcr, CARD_PWR_CTL, in rtl8411_cd_deglitch()
252 card_exist = rtsx_pci_readl(pcr, RTSX_BIPR); in rtl8411_cd_deglitch()
260 rtsx_pci_write_register(pcr, CARD_PWR_CTL, in rtl8411_cd_deglitch()
263 pcr_dbg(pcr, "After CD deglitch, card_exist = 0x%x\n", in rtl8411_cd_deglitch()
269 rtsx_pci_write_register(pcr, EFUSE_CONTENT, 0xe0, 0x40); in rtl8411_cd_deglitch()
270 rtsx_pci_write_register(pcr, CD_PAD_CTL, in rtl8411_cd_deglitch()
274 rtsx_pci_write_register(pcr, EFUSE_CONTENT, 0xe0, 0x80); in rtl8411_cd_deglitch()
275 rtsx_pci_write_register(pcr, CD_PAD_CTL, in rtl8411_cd_deglitch()
472 static void rtl8411_init_common_params(struct rtsx_pcr *pcr) in rtl8411_init_common_params() argument
474 pcr->extra_caps = EXTRA_CAPS_SD_SDR50 | EXTRA_CAPS_SD_SDR104; in rtl8411_init_common_params()
475 pcr->num_slots = 2; in rtl8411_init_common_params()
476 pcr->flags = 0; in rtl8411_init_common_params()
477 pcr->card_drive_sel = RTL8411_CARD_DRIVE_DEFAULT; in rtl8411_init_common_params()
478 pcr->sd30_drive_sel_1v8 = DRIVER_TYPE_B; in rtl8411_init_common_params()
479 pcr->sd30_drive_sel_3v3 = DRIVER_TYPE_D; in rtl8411_init_common_params()
480 pcr->aspm_en = ASPM_L1_EN; in rtl8411_init_common_params()
481 pcr->tx_initial_phase = SET_CLOCK_PHASE(23, 7, 14); in rtl8411_init_common_params()
482 pcr->rx_initial_phase = SET_CLOCK_PHASE(4, 3, 10); in rtl8411_init_common_params()
483 pcr->ic_version = rtl8411_get_ic_version(pcr); in rtl8411_init_common_params()
486 void rtl8411_init_params(struct rtsx_pcr *pcr) in rtl8411_init_params() argument
488 rtl8411_init_common_params(pcr); in rtl8411_init_params()
489 pcr->ops = &rtl8411_pcr_ops; in rtl8411_init_params()
490 set_pull_ctrl_tables(pcr, rtl8411); in rtl8411_init_params()
493 void rtl8411b_init_params(struct rtsx_pcr *pcr) in rtl8411b_init_params() argument
495 rtl8411_init_common_params(pcr); in rtl8411b_init_params()
496 pcr->ops = &rtl8411b_pcr_ops; in rtl8411b_init_params()
497 if (rtl8411b_is_qfn48(pcr)) in rtl8411b_init_params()
498 set_pull_ctrl_tables(pcr, rtl8411b_qfn48); in rtl8411b_init_params()
500 set_pull_ctrl_tables(pcr, rtl8411b_qfn64); in rtl8411b_init_params()
503 void rtl8402_init_params(struct rtsx_pcr *pcr) in rtl8402_init_params() argument
505 rtl8411_init_common_params(pcr); in rtl8402_init_params()
506 pcr->ops = &rtl8402_pcr_ops; in rtl8402_init_params()
507 set_pull_ctrl_tables(pcr, rtl8411); in rtl8402_init_params()