Lines Matching refs:pcr

16 static u8 rts5209_get_ic_version(struct rtsx_pcr *pcr)  in rts5209_get_ic_version()  argument
20 val = rtsx_pci_readb(pcr, 0x1C); in rts5209_get_ic_version()
24 static void rts5209_fetch_vendor_settings(struct rtsx_pcr *pcr) in rts5209_fetch_vendor_settings() argument
26 struct pci_dev *pdev = pcr->pci; in rts5209_fetch_vendor_settings()
30 pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg); in rts5209_fetch_vendor_settings()
34 pcr->flags |= PCR_MS_PMOS; in rts5209_fetch_vendor_settings()
35 pcr->aspm_en = rts5209_reg_to_aspm(reg); in rts5209_fetch_vendor_settings()
39 pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG2, reg); in rts5209_fetch_vendor_settings()
42 pcr->sd30_drive_sel_1v8 = in rts5209_fetch_vendor_settings()
44 pcr->sd30_drive_sel_3v3 = in rts5209_fetch_vendor_settings()
46 pcr->card_drive_sel = rts5209_reg_to_card_drive_sel(reg); in rts5209_fetch_vendor_settings()
50 static void rts5209_force_power_down(struct rtsx_pcr *pcr, u8 pm_state, bool runtime) in rts5209_force_power_down() argument
52 rtsx_pci_write_register(pcr, FPDCTL, 0x07, 0x07); in rts5209_force_power_down()
55 static int rts5209_extra_init_hw(struct rtsx_pcr *pcr) in rts5209_extra_init_hw() argument
57 rtsx_pci_init_cmd(pcr); in rts5209_extra_init_hw()
60 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_GPIO, 0xFF, 0x03); in rts5209_extra_init_hw()
62 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, ASPM_FORCE_CTL, 0x3F, 0); in rts5209_extra_init_hw()
64 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, 0x08, 0x08); in rts5209_extra_init_hw()
66 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_GPIO_DIR, 0xFF, 0x03); in rts5209_extra_init_hw()
68 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SD30_DRIVE_SEL, in rts5209_extra_init_hw()
69 0xFF, pcr->sd30_drive_sel_3v3); in rts5209_extra_init_hw()
71 return rtsx_pci_send_cmd(pcr, 100); in rts5209_extra_init_hw()
74 static int rts5209_optimize_phy(struct rtsx_pcr *pcr) in rts5209_optimize_phy() argument
76 return rtsx_pci_write_phy_register(pcr, 0x00, 0xB966); in rts5209_optimize_phy()
79 static int rts5209_turn_on_led(struct rtsx_pcr *pcr) in rts5209_turn_on_led() argument
81 return rtsx_pci_write_register(pcr, CARD_GPIO, 0x01, 0x00); in rts5209_turn_on_led()
84 static int rts5209_turn_off_led(struct rtsx_pcr *pcr) in rts5209_turn_off_led() argument
86 return rtsx_pci_write_register(pcr, CARD_GPIO, 0x01, 0x01); in rts5209_turn_off_led()
89 static int rts5209_enable_auto_blink(struct rtsx_pcr *pcr) in rts5209_enable_auto_blink() argument
91 return rtsx_pci_write_register(pcr, CARD_AUTO_BLINK, 0xFF, 0x0D); in rts5209_enable_auto_blink()
94 static int rts5209_disable_auto_blink(struct rtsx_pcr *pcr) in rts5209_disable_auto_blink() argument
96 return rtsx_pci_write_register(pcr, CARD_AUTO_BLINK, 0x08, 0x00); in rts5209_disable_auto_blink()
99 static int rts5209_card_power_on(struct rtsx_pcr *pcr, int card) in rts5209_card_power_on() argument
108 if ((pcr->flags & PCR_MS_PMOS) && (card == RTSX_MS_CARD)) { in rts5209_card_power_on()
114 rtsx_pci_init_cmd(pcr); in rts5209_card_power_on()
115 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_PWR_CTL, in rts5209_card_power_on()
117 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PWR_GATE_CTRL, in rts5209_card_power_on()
119 err = rtsx_pci_send_cmd(pcr, 100); in rts5209_card_power_on()
126 rtsx_pci_init_cmd(pcr); in rts5209_card_power_on()
127 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_PWR_CTL, pwr_mask, pwr_on); in rts5209_card_power_on()
128 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PWR_GATE_CTRL, in rts5209_card_power_on()
130 return rtsx_pci_send_cmd(pcr, 100); in rts5209_card_power_on()
133 static int rts5209_card_power_off(struct rtsx_pcr *pcr, int card) in rts5209_card_power_off() argument
140 if ((pcr->flags & PCR_MS_PMOS) && (card == RTSX_MS_CARD)) { in rts5209_card_power_off()
145 rtsx_pci_init_cmd(pcr); in rts5209_card_power_off()
146 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_PWR_CTL, in rts5209_card_power_off()
148 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PWR_GATE_CTRL, in rts5209_card_power_off()
150 return rtsx_pci_send_cmd(pcr, 100); in rts5209_card_power_off()
153 static int rts5209_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage) in rts5209_switch_output_voltage() argument
158 err = rtsx_pci_write_register(pcr, in rts5209_switch_output_voltage()
159 SD30_DRIVE_SEL, 0x07, pcr->sd30_drive_sel_3v3); in rts5209_switch_output_voltage()
162 err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4FC0 | 0x24); in rts5209_switch_output_voltage()
166 err = rtsx_pci_write_register(pcr, in rts5209_switch_output_voltage()
167 SD30_DRIVE_SEL, 0x07, pcr->sd30_drive_sel_1v8); in rts5209_switch_output_voltage()
170 err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4C40 | 0x24); in rts5209_switch_output_voltage()
246 void rts5209_init_params(struct rtsx_pcr *pcr) in rts5209_init_params() argument
248 pcr->extra_caps = EXTRA_CAPS_SD_SDR50 | in rts5209_init_params()
250 pcr->num_slots = 2; in rts5209_init_params()
251 pcr->ops = &rts5209_pcr_ops; in rts5209_init_params()
253 pcr->flags = 0; in rts5209_init_params()
254 pcr->card_drive_sel = RTS5209_CARD_DRIVE_DEFAULT; in rts5209_init_params()
255 pcr->sd30_drive_sel_1v8 = DRIVER_TYPE_B; in rts5209_init_params()
256 pcr->sd30_drive_sel_3v3 = DRIVER_TYPE_D; in rts5209_init_params()
257 pcr->aspm_en = ASPM_L1_EN; in rts5209_init_params()
258 pcr->aspm_mode = ASPM_MODE_CFG; in rts5209_init_params()
259 pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 27, 16); in rts5209_init_params()
260 pcr->rx_initial_phase = SET_CLOCK_PHASE(24, 6, 5); in rts5209_init_params()
262 pcr->ic_version = rts5209_get_ic_version(pcr); in rts5209_init_params()
263 pcr->sd_pull_ctl_enable_tbl = rts5209_sd_pull_ctl_enable_tbl; in rts5209_init_params()
264 pcr->sd_pull_ctl_disable_tbl = rts5209_sd_pull_ctl_disable_tbl; in rts5209_init_params()
265 pcr->ms_pull_ctl_enable_tbl = rts5209_ms_pull_ctl_enable_tbl; in rts5209_init_params()
266 pcr->ms_pull_ctl_disable_tbl = rts5209_ms_pull_ctl_disable_tbl; in rts5209_init_params()