Lines Matching full:pcr
18 static u8 rts5261_get_ic_version(struct rtsx_pcr *pcr) in rts5261_get_ic_version() argument
22 rtsx_pci_read_register(pcr, DUMMY_REG_RESET_0, &val); in rts5261_get_ic_version()
26 static void rts5261_fill_driving(struct rtsx_pcr *pcr, u8 voltage) in rts5261_fill_driving() argument
44 drive_sel = pcr->sd30_drive_sel_3v3; in rts5261_fill_driving()
47 drive_sel = pcr->sd30_drive_sel_1v8; in rts5261_fill_driving()
50 rtsx_pci_write_register(pcr, SD30_CLK_DRIVE_SEL, in rts5261_fill_driving()
53 rtsx_pci_write_register(pcr, SD30_CMD_DRIVE_SEL, in rts5261_fill_driving()
56 rtsx_pci_write_register(pcr, SD30_DAT_DRIVE_SEL, in rts5261_fill_driving()
60 static void rts5261_force_power_down(struct rtsx_pcr *pcr, u8 pm_state, bool runtime) in rts5261_force_power_down() argument
63 rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 1, MASK_8_BIT_DEF, 0); in rts5261_force_power_down()
64 rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 2, MASK_8_BIT_DEF, 0); in rts5261_force_power_down()
65 rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 3, in rts5261_force_power_down()
69 rtsx_pci_write_register(pcr, pcr->reg_pm_ctrl3, in rts5261_force_power_down()
73 rtsx_pci_write_register(pcr, RTS5261_AUTOLOAD_CFG1, in rts5261_force_power_down()
75 rtsx_pci_write_register(pcr, pcr->reg_pm_ctrl3, 0x01, 0x00); in rts5261_force_power_down()
76 rtsx_pci_write_register(pcr, RTS5261_REG_PME_FORCE_CTL, in rts5261_force_power_down()
80 rtsx_pci_write_register(pcr, RTS5261_REG_PME_FORCE_CTL, in rts5261_force_power_down()
83 rtsx_pci_write_register(pcr, RTS5261_FW_CTL, in rts5261_force_power_down()
85 rtsx_pci_write_register(pcr, RTS5261_AUTOLOAD_CFG4, in rts5261_force_power_down()
90 rtsx_pci_write_register(pcr, RTS5261_REG_FPDCTL, in rts5261_force_power_down()
94 static int rts5261_enable_auto_blink(struct rtsx_pcr *pcr) in rts5261_enable_auto_blink() argument
96 return rtsx_pci_write_register(pcr, OLT_LED_CTL, in rts5261_enable_auto_blink()
100 static int rts5261_disable_auto_blink(struct rtsx_pcr *pcr) in rts5261_disable_auto_blink() argument
102 return rtsx_pci_write_register(pcr, OLT_LED_CTL, in rts5261_disable_auto_blink()
106 static int rts5261_turn_on_led(struct rtsx_pcr *pcr) in rts5261_turn_on_led() argument
108 return rtsx_pci_write_register(pcr, GPIO_CTL, in rts5261_turn_on_led()
112 static int rts5261_turn_off_led(struct rtsx_pcr *pcr) in rts5261_turn_off_led() argument
114 return rtsx_pci_write_register(pcr, GPIO_CTL, in rts5261_turn_off_led()
144 static int rts5261_sd_set_sample_push_timing_sd30(struct rtsx_pcr *pcr) in rts5261_sd_set_sample_push_timing_sd30() argument
146 rtsx_pci_write_register(pcr, SD_CFG1, SD_MODE_SELECT_MASK in rts5261_sd_set_sample_push_timing_sd30()
148 rtsx_pci_write_register(pcr, CLK_CTL, CLK_LOW_FREQ, CLK_LOW_FREQ); in rts5261_sd_set_sample_push_timing_sd30()
149 rtsx_pci_write_register(pcr, CARD_CLK_SOURCE, 0xFF, in rts5261_sd_set_sample_push_timing_sd30()
151 rtsx_pci_write_register(pcr, CLK_CTL, CLK_LOW_FREQ, 0); in rts5261_sd_set_sample_push_timing_sd30()
156 static int rts5261_card_power_on(struct rtsx_pcr *pcr, int card) in rts5261_card_power_on() argument
158 struct rtsx_cr_option *option = &pcr->option; in rts5261_card_power_on()
161 rtsx_pci_enable_ocp(pcr); in rts5261_card_power_on()
163 rtsx_pci_write_register(pcr, REG_CRC_DUMMY_0, in rts5261_card_power_on()
166 rtsx_pci_write_register(pcr, RTS5261_LDO1_CFG1, in rts5261_card_power_on()
168 rtsx_pci_write_register(pcr, RTS5261_LDO1233318_POW_CTL, in rts5261_card_power_on()
171 rtsx_pci_write_register(pcr, RTS5261_LDO1233318_POW_CTL, in rts5261_card_power_on()
176 rtsx_pci_write_register(pcr, CARD_OE, SD_OUTPUT_EN, SD_OUTPUT_EN); in rts5261_card_power_on()
179 rtsx_pci_write_register(pcr, SD_CFG1, 0xFF, in rts5261_card_power_on()
182 rtsx_pci_write_register(pcr, SD_SAMPLE_POINT_CTL, in rts5261_card_power_on()
184 rtsx_pci_write_register(pcr, SD_PUSH_POINT_CTL, 0xFF, 0); in rts5261_card_power_on()
185 rtsx_pci_write_register(pcr, CARD_STOP, SD_STOP | SD_CLR_ERR, in rts5261_card_power_on()
189 rtsx_pci_write_register(pcr, SD_CFG3, SD30_CLK_END_EN, 0); in rts5261_card_power_on()
190 rtsx_pci_write_register(pcr, REG_SD_STOP_SDCLK_CFG, in rts5261_card_power_on()
194 if (pcr->extra_caps & EXTRA_CAPS_SD_SDR50 || in rts5261_card_power_on()
195 pcr->extra_caps & EXTRA_CAPS_SD_SDR104) in rts5261_card_power_on()
196 rts5261_sd_set_sample_push_timing_sd30(pcr); in rts5261_card_power_on()
201 static int rts5261_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage) in rts5261_switch_output_voltage() argument
206 rtsx_pci_write_register(pcr, RTS5261_CARD_PWR_CTL, in rts5261_switch_output_voltage()
211 rtsx_pci_read_phy_register(pcr, PHY_TUNE, &val); in rts5261_switch_output_voltage()
213 err = rtsx_pci_write_phy_register(pcr, PHY_TUNE, val); in rts5261_switch_output_voltage()
217 rtsx_pci_write_register(pcr, RTS5261_DV3318_CFG, in rts5261_switch_output_voltage()
219 rtsx_pci_write_register(pcr, SD_PAD_CTL, in rts5261_switch_output_voltage()
223 rtsx_pci_read_phy_register(pcr, PHY_TUNE, &val); in rts5261_switch_output_voltage()
225 err = rtsx_pci_write_phy_register(pcr, PHY_TUNE, val); in rts5261_switch_output_voltage()
229 rtsx_pci_write_register(pcr, RTS5261_DV3318_CFG, in rts5261_switch_output_voltage()
231 rtsx_pci_write_register(pcr, SD_PAD_CTL, in rts5261_switch_output_voltage()
239 rts5261_fill_driving(pcr, voltage); in rts5261_switch_output_voltage()
244 static void rts5261_stop_cmd(struct rtsx_pcr *pcr) in rts5261_stop_cmd() argument
246 rtsx_pci_writel(pcr, RTSX_HCBCTLR, STOP_CMD); in rts5261_stop_cmd()
247 rtsx_pci_writel(pcr, RTSX_HDBCTLR, STOP_DMA); in rts5261_stop_cmd()
248 rtsx_pci_write_register(pcr, RTS5260_DMA_RST_CTL_0, in rts5261_stop_cmd()
251 rtsx_pci_write_register(pcr, RBCTL, RB_FLUSH, RB_FLUSH); in rts5261_stop_cmd()
254 static void rts5261_card_before_power_off(struct rtsx_pcr *pcr) in rts5261_card_before_power_off() argument
256 rts5261_stop_cmd(pcr); in rts5261_card_before_power_off()
257 rts5261_switch_output_voltage(pcr, OUTPUT_3V3); in rts5261_card_before_power_off()
261 static void rts5261_enable_ocp(struct rtsx_pcr *pcr) in rts5261_enable_ocp() argument
266 rtsx_pci_write_register(pcr, RTS5261_LDO1_CFG0, in rts5261_enable_ocp()
269 rtsx_pci_write_register(pcr, REG_OCPCTL, 0xFF, val); in rts5261_enable_ocp()
273 static void rts5261_disable_ocp(struct rtsx_pcr *pcr) in rts5261_disable_ocp() argument
278 rtsx_pci_write_register(pcr, REG_OCPCTL, mask, 0); in rts5261_disable_ocp()
279 rtsx_pci_write_register(pcr, RTS5261_LDO1_CFG0, in rts5261_disable_ocp()
284 static int rts5261_card_power_off(struct rtsx_pcr *pcr, int card) in rts5261_card_power_off() argument
288 rts5261_card_before_power_off(pcr); in rts5261_card_power_off()
289 err = rtsx_pci_write_register(pcr, RTS5261_LDO1233318_POW_CTL, in rts5261_card_power_off()
292 rtsx_pci_write_register(pcr, REG_CRC_DUMMY_0, in rts5261_card_power_off()
294 if (pcr->option.ocp_en) in rts5261_card_power_off()
295 rtsx_pci_disable_ocp(pcr); in rts5261_card_power_off()
300 static void rts5261_init_ocp(struct rtsx_pcr *pcr) in rts5261_init_ocp() argument
302 struct rtsx_cr_option *option = &pcr->option; in rts5261_init_ocp()
307 rtsx_pci_write_register(pcr, RTS5261_LDO1_CFG0, in rts5261_init_ocp()
311 rtsx_pci_write_register(pcr, RTS5261_LDO1_CFG0, in rts5261_init_ocp()
314 rtsx_pci_write_register(pcr, RTS5261_LDO1_CFG0, in rts5261_init_ocp()
319 val = pcr->hw_param.ocp_glitch; in rts5261_init_ocp()
320 rtsx_pci_write_register(pcr, REG_OCPGLITCH, mask, val); in rts5261_init_ocp()
322 rts5261_enable_ocp(pcr); in rts5261_init_ocp()
324 rtsx_pci_write_register(pcr, RTS5261_LDO1_CFG0, in rts5261_init_ocp()
329 static void rts5261_clear_ocpstat(struct rtsx_pcr *pcr) in rts5261_clear_ocpstat() argument
337 rtsx_pci_write_register(pcr, REG_OCPCTL, mask, val); in rts5261_clear_ocpstat()
340 rtsx_pci_write_register(pcr, REG_OCPCTL, mask, 0); in rts5261_clear_ocpstat()
344 static void rts5261_process_ocp(struct rtsx_pcr *pcr) in rts5261_process_ocp() argument
346 if (!pcr->option.ocp_en) in rts5261_process_ocp()
349 rtsx_pci_get_ocpstat(pcr, &pcr->ocp_stat); in rts5261_process_ocp()
351 if (pcr->ocp_stat & (SD_OC_NOW | SD_OC_EVER)) { in rts5261_process_ocp()
352 rts5261_clear_ocpstat(pcr); in rts5261_process_ocp()
353 rts5261_card_power_off(pcr, RTSX_SD_CARD); in rts5261_process_ocp()
354 rtsx_pci_write_register(pcr, CARD_OE, SD_OUTPUT_EN, 0); in rts5261_process_ocp()
355 pcr->ocp_stat = 0; in rts5261_process_ocp()
360 static void rts5261_init_from_hw(struct rtsx_pcr *pcr) in rts5261_init_from_hw() argument
362 struct pci_dev *pdev = pcr->pci; in rts5261_init_from_hw()
367 rtsx_pci_write_register(pcr, RTS5261_REG_PME_FORCE_CTL, in rts5261_init_from_hw()
371 rtsx_pci_write_register(pcr, RTS5261_EFUSE_ADDR, in rts5261_init_from_hw()
373 rtsx_pci_write_register(pcr, RTS5261_EFUSE_CTL, in rts5261_init_from_hw()
379 rtsx_pci_read_register(pcr, RTS5261_EFUSE_CTL, &tmp); in rts5261_init_from_hw()
383 rtsx_pci_read_register(pcr, RTS5261_EFUSE_READ_DATA, &tmp); in rts5261_init_from_hw()
385 pcr_dbg(pcr, "Load efuse valid: 0x%x\n", efuse_valid); in rts5261_init_from_hw()
388 pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG2, lval2); in rts5261_init_from_hw()
392 rtsx_pci_write_register(pcr, RTS5261_REG_PME_FORCE_CTL, in rts5261_init_from_hw()
394 pcr_dbg(pcr, "Disable efuse por!\n"); in rts5261_init_from_hw()
415 pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", setting_reg2, lval2); in rts5261_init_from_hw()
419 pcr->extra_caps |= EXTRA_CAPS_NO_MMC; in rts5261_init_from_hw()
420 pcr_dbg(pcr, "skip fetch vendor setting\n"); in rts5261_init_from_hw()
425 pcr->extra_caps |= EXTRA_CAPS_NO_MMC; in rts5261_init_from_hw()
427 pcr->rtd3_en = rts5261_reg_to_rtd3(lval2); in rts5261_init_from_hw()
430 pcr->flags |= PCR_REVERSE_SOCKET; in rts5261_init_from_hw()
433 pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", setting_reg1, lval1); in rts5261_init_from_hw()
435 pcr->aspm_en = rts5261_reg_to_aspm(lval1); in rts5261_init_from_hw()
436 pcr->sd30_drive_sel_1v8 = rts5261_reg_to_sd30_drive_sel_1v8(lval1); in rts5261_init_from_hw()
437 pcr->sd30_drive_sel_3v3 = rts5261_reg_to_sd30_drive_sel_3v3(lval1); in rts5261_init_from_hw()
441 rtsx_pci_write_register(pcr, 0xFF0C, 0xFF, (u8)(lval1 & 0xFF)); in rts5261_init_from_hw()
442 rtsx_pci_write_register(pcr, 0xFF0D, 0xFF, (u8)((lval1 >> 8) & 0xFF)); in rts5261_init_from_hw()
443 rtsx_pci_write_register(pcr, 0xFF0E, 0xFF, (u8)((lval1 >> 16) & 0xFF)); in rts5261_init_from_hw()
444 rtsx_pci_write_register(pcr, 0xFF0F, 0xFF, (u8)((lval1 >> 24) & 0xFF)); in rts5261_init_from_hw()
445 rtsx_pci_write_register(pcr, 0xFF10, 0xFF, (u8)(lval2 & 0xFF)); in rts5261_init_from_hw()
446 rtsx_pci_write_register(pcr, 0xFF11, 0xFF, (u8)((lval2 >> 8) & 0xFF)); in rts5261_init_from_hw()
447 rtsx_pci_write_register(pcr, 0xFF12, 0xFF, (u8)((lval2 >> 16) & 0xFF)); in rts5261_init_from_hw()
455 static void rts5261_init_from_cfg(struct rtsx_pcr *pcr) in rts5261_init_from_cfg() argument
457 struct rtsx_cr_option *option = &pcr->option; in rts5261_init_from_cfg()
461 rtsx_set_ltr_latency(pcr, option->ltr_active_latency); in rts5261_init_from_cfg()
465 static int rts5261_extra_init_hw(struct rtsx_pcr *pcr) in rts5261_extra_init_hw() argument
467 struct rtsx_cr_option *option = &pcr->option; in rts5261_extra_init_hw()
470 rtsx_pci_write_register(pcr, RTS5261_AUTOLOAD_CFG1, in rts5261_extra_init_hw()
473 rts5261_init_from_cfg(pcr); in rts5261_extra_init_hw()
474 rts5261_init_from_hw(pcr); in rts5261_extra_init_hw()
477 rtsx_pci_write_register(pcr, RTS5261_REG_PME_FORCE_CTL, in rts5261_extra_init_hw()
479 rtsx_pci_write_register(pcr, L1SUB_CONFIG1, in rts5261_extra_init_hw()
481 rtsx_pci_write_register(pcr, L1SUB_CONFIG3, 0xFF, 0); in rts5261_extra_init_hw()
483 if (is_version_higher_than(pcr, PID_5261, IC_VER_B)) { in rts5261_extra_init_hw()
484 val = rtsx_pci_readl(pcr, RTSX_DUM_REG); in rts5261_extra_init_hw()
485 rtsx_pci_writel(pcr, RTSX_DUM_REG, val | 0x1); in rts5261_extra_init_hw()
487 rtsx_pci_write_register(pcr, RTS5261_AUTOLOAD_CFG4, in rts5261_extra_init_hw()
491 rtsx_pci_write_register(pcr, RTS5261_AUTOLOAD_CFG4, in rts5261_extra_init_hw()
493 rtsx_pci_write_register(pcr, FUNC_FORCE_CTL, in rts5261_extra_init_hw()
496 rtsx_pci_write_register(pcr, PCLK_CTL, in rts5261_extra_init_hw()
499 rtsx_pci_write_register(pcr, PM_EVENT_DEBUG, PME_DEBUG_0, PME_DEBUG_0); in rts5261_extra_init_hw()
500 rtsx_pci_write_register(pcr, PM_CLK_FORCE_CTL, CLK_PM_EN, CLK_PM_EN); in rts5261_extra_init_hw()
503 rtsx_pci_write_register(pcr, OLT_LED_CTL, 0x0F, 0x02); in rts5261_extra_init_hw()
506 rts5261_fill_driving(pcr, OUTPUT_3V3); in rts5261_extra_init_hw()
508 if (pcr->flags & PCR_REVERSE_SOCKET) in rts5261_extra_init_hw()
509 rtsx_pci_write_register(pcr, PETXCFG, 0x30, 0x30); in rts5261_extra_init_hw()
511 rtsx_pci_write_register(pcr, PETXCFG, 0x30, 0x00); in rts5261_extra_init_hw()
518 rtsx_pci_write_register(pcr, PETXCFG, in rts5261_extra_init_hw()
521 rtsx_pci_write_register(pcr, PETXCFG, in rts5261_extra_init_hw()
524 rtsx_pci_write_register(pcr, PWD_SUSPEND_EN, 0xFF, 0xFB); in rts5261_extra_init_hw()
526 if (pcr->rtd3_en) { in rts5261_extra_init_hw()
527 rtsx_pci_write_register(pcr, pcr->reg_pm_ctrl3, 0x01, 0x01); in rts5261_extra_init_hw()
528 rtsx_pci_write_register(pcr, RTS5261_REG_PME_FORCE_CTL, in rts5261_extra_init_hw()
532 rtsx_pci_write_register(pcr, pcr->reg_pm_ctrl3, 0x01, 0x00); in rts5261_extra_init_hw()
533 rtsx_pci_write_register(pcr, RTS5261_REG_PME_FORCE_CTL, in rts5261_extra_init_hw()
536 rtsx_pci_write_register(pcr, pcr->reg_pm_ctrl3, D3_DELINK_MODE_EN, 0x00); in rts5261_extra_init_hw()
539 rtsx_pci_write_register(pcr, RTS5261_FW_CTL, in rts5261_extra_init_hw()
545 static void rts5261_enable_aspm(struct rtsx_pcr *pcr, bool enable) in rts5261_enable_aspm() argument
550 if (pcr->aspm_enabled == enable) in rts5261_enable_aspm()
553 val |= (pcr->aspm_en & 0x02); in rts5261_enable_aspm()
554 rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, mask, val); in rts5261_enable_aspm()
555 pcie_capability_clear_and_set_word(pcr->pci, PCI_EXP_LNKCTL, in rts5261_enable_aspm()
556 PCI_EXP_LNKCTL_ASPMC, pcr->aspm_en); in rts5261_enable_aspm()
557 pcr->aspm_enabled = enable; in rts5261_enable_aspm()
560 static void rts5261_disable_aspm(struct rtsx_pcr *pcr, bool enable) in rts5261_disable_aspm() argument
565 if (pcr->aspm_enabled == enable) in rts5261_disable_aspm()
568 pcie_capability_clear_and_set_word(pcr->pci, PCI_EXP_LNKCTL, in rts5261_disable_aspm()
570 rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, mask, val); in rts5261_disable_aspm()
571 rtsx_pci_write_register(pcr, SD_CFG1, SD_ASYNC_FIFO_NOT_RST, 0); in rts5261_disable_aspm()
573 pcr->aspm_enabled = enable; in rts5261_disable_aspm()
576 static void rts5261_set_aspm(struct rtsx_pcr *pcr, bool enable) in rts5261_set_aspm() argument
579 rts5261_enable_aspm(pcr, true); in rts5261_set_aspm()
581 rts5261_disable_aspm(pcr, false); in rts5261_set_aspm()
584 static void rts5261_set_l1off_cfg_sub_d0(struct rtsx_pcr *pcr, int active) in rts5261_set_l1off_cfg_sub_d0() argument
586 struct rtsx_cr_option *option = &pcr->option; in rts5261_set_l1off_cfg_sub_d0()
590 aspm_L1_1 = rtsx_check_dev_flag(pcr, ASPM_L1_1_EN); in rts5261_set_l1off_cfg_sub_d0()
591 aspm_L1_2 = rtsx_check_dev_flag(pcr, ASPM_L1_2_EN); in rts5261_set_l1off_cfg_sub_d0()
603 rtsx_set_l1off_sub(pcr, val); in rts5261_set_l1off_cfg_sub_d0()
631 int rts5261_pci_switch_clock(struct rtsx_pcr *pcr, unsigned int card_clock, in rts5261_pci_switch_clock() argument
646 if (is_version_higher_than(pcr, PID_5261, IC_VER_C)) { in rts5261_pci_switch_clock()
656 err = rtsx_pci_write_register(pcr, SD_CFG1, in rts5261_pci_switch_clock()
662 pcr_dbg(pcr, "Switch card clock to %dMHz\n", card_clock); in rts5261_pci_switch_clock()
667 pcr_dbg(pcr, "Internal SSC clock: %dMHz (cur_clock = %d)\n", in rts5261_pci_switch_clock()
668 clk, pcr->cur_clock); in rts5261_pci_switch_clock()
670 if (clk == pcr->cur_clock) in rts5261_pci_switch_clock()
673 if (pcr->ops->conv_clk_and_div_n) in rts5261_pci_switch_clock()
674 n = pcr->ops->conv_clk_and_div_n(clk, CLK_TO_DIV_N); in rts5261_pci_switch_clock()
686 if (pcr->ops->conv_clk_and_div_n) { in rts5261_pci_switch_clock()
687 int dbl_clk = pcr->ops->conv_clk_and_div_n(n, in rts5261_pci_switch_clock()
689 n = pcr->ops->conv_clk_and_div_n(dbl_clk, in rts5261_pci_switch_clock()
698 pcr_dbg(pcr, "n = %d, div = %d\n", n, div); in rts5261_pci_switch_clock()
724 pcr_dbg(pcr, "ssc_depth = %d\n", ssc_depth); in rts5261_pci_switch_clock()
726 rtsx_pci_init_cmd(pcr); in rts5261_pci_switch_clock()
727 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CLK_CTL, in rts5261_pci_switch_clock()
729 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CLK_DIV, in rts5261_pci_switch_clock()
731 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SSC_CTL1, SSC_RSTB, 0); in rts5261_pci_switch_clock()
732 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SSC_CTL2, in rts5261_pci_switch_clock()
734 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SSC_DIV_N_0, 0xFF, n); in rts5261_pci_switch_clock()
735 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SSC_CTL1, SSC_RSTB, SSC_RSTB); in rts5261_pci_switch_clock()
737 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SD_VPCLK0_CTL, in rts5261_pci_switch_clock()
739 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SD_VPCLK1_CTL, in rts5261_pci_switch_clock()
741 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SD_VPCLK0_CTL, in rts5261_pci_switch_clock()
743 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SD_VPCLK1_CTL, in rts5261_pci_switch_clock()
747 err = rtsx_pci_send_cmd(pcr, 2000); in rts5261_pci_switch_clock()
753 err = rtsx_pci_write_register(pcr, CLK_CTL, CLK_LOW_FREQ, 0); in rts5261_pci_switch_clock()
757 pcr->cur_clock = clk; in rts5261_pci_switch_clock()
762 void rts5261_init_params(struct rtsx_pcr *pcr) in rts5261_init_params() argument
764 struct rtsx_cr_option *option = &pcr->option; in rts5261_init_params()
765 struct rtsx_hw_param *hw_param = &pcr->hw_param; in rts5261_init_params()
768 pcr->extra_caps = EXTRA_CAPS_SD_SDR50 | EXTRA_CAPS_SD_SDR104; in rts5261_init_params()
769 rtsx_pci_read_register(pcr, RTS5261_FW_STATUS, &val); in rts5261_init_params()
771 pcr->extra_caps |= EXTRA_CAPS_SD_EXPRESS; in rts5261_init_params()
772 pcr->num_slots = 1; in rts5261_init_params()
773 pcr->ops = &rts5261_pcr_ops; in rts5261_init_params()
775 pcr->flags = 0; in rts5261_init_params()
776 pcr->card_drive_sel = RTSX_CARD_DRIVE_DEFAULT; in rts5261_init_params()
777 pcr->sd30_drive_sel_1v8 = 0x00; in rts5261_init_params()
778 pcr->sd30_drive_sel_3v3 = 0x00; in rts5261_init_params()
779 pcr->aspm_en = ASPM_L1_EN; in rts5261_init_params()
780 pcr->aspm_mode = ASPM_MODE_REG; in rts5261_init_params()
781 pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 27, 11); in rts5261_init_params()
782 pcr->rx_initial_phase = SET_CLOCK_PHASE(24, 6, 5); in rts5261_init_params()
784 pcr->ic_version = rts5261_get_ic_version(pcr); in rts5261_init_params()
785 pcr->sd_pull_ctl_enable_tbl = rts5261_sd_pull_ctl_enable_tbl; in rts5261_init_params()
786 pcr->sd_pull_ctl_disable_tbl = rts5261_sd_pull_ctl_disable_tbl; in rts5261_init_params()
788 pcr->reg_pm_ctrl3 = RTS5261_AUTOLOAD_CFG3; in rts5261_init_params()