diff options
-rw-r--r-- | drivers/mfd/rtl8411.c | 44 | ||||
-rw-r--r-- | drivers/mfd/rtsx_pcr.c | 5 | ||||
-rw-r--r-- | drivers/mfd/rtsx_pcr.h | 1 |
3 files changed, 46 insertions, 4 deletions
diff --git a/drivers/mfd/rtl8411.c b/drivers/mfd/rtl8411.c index 327c8894fd4a..ada38ad54e87 100644 --- a/drivers/mfd/rtl8411.c +++ b/drivers/mfd/rtl8411.c | |||
@@ -191,24 +191,25 @@ static int rtl8411_card_power_off(struct rtsx_pcr *pcr, int card) | |||
191 | BPP_LDO_POWB, BPP_LDO_SUSPEND); | 191 | BPP_LDO_POWB, BPP_LDO_SUSPEND); |
192 | } | 192 | } |
193 | 193 | ||
194 | static int rtl8411_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage) | 194 | static int rtl8411_do_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage, |
195 | int bpp_tuned18_shift, int bpp_asic_1v8) | ||
195 | { | 196 | { |
196 | u8 mask, val; | 197 | u8 mask, val; |
197 | int err; | 198 | int err; |
198 | 199 | ||
199 | mask = (BPP_REG_TUNED18 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_MASK; | 200 | mask = (BPP_REG_TUNED18 << bpp_tuned18_shift) | BPP_PAD_MASK; |
200 | if (voltage == OUTPUT_3V3) { | 201 | if (voltage == OUTPUT_3V3) { |
201 | err = rtsx_pci_write_register(pcr, | 202 | err = rtsx_pci_write_register(pcr, |
202 | SD30_DRIVE_SEL, 0x07, pcr->sd30_drive_sel_3v3); | 203 | SD30_DRIVE_SEL, 0x07, pcr->sd30_drive_sel_3v3); |
203 | if (err < 0) | 204 | if (err < 0) |
204 | return err; | 205 | return err; |
205 | val = (BPP_ASIC_3V3 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_3V3; | 206 | val = (BPP_ASIC_3V3 << bpp_tuned18_shift) | BPP_PAD_3V3; |
206 | } else if (voltage == OUTPUT_1V8) { | 207 | } else if (voltage == OUTPUT_1V8) { |
207 | err = rtsx_pci_write_register(pcr, | 208 | err = rtsx_pci_write_register(pcr, |
208 | SD30_DRIVE_SEL, 0x07, pcr->sd30_drive_sel_1v8); | 209 | SD30_DRIVE_SEL, 0x07, pcr->sd30_drive_sel_1v8); |
209 | if (err < 0) | 210 | if (err < 0) |
210 | return err; | 211 | return err; |
211 | val = (BPP_ASIC_1V8 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_1V8; | 212 | val = (bpp_asic_1v8 << bpp_tuned18_shift) | BPP_PAD_1V8; |
212 | } else { | 213 | } else { |
213 | return -EINVAL; | 214 | return -EINVAL; |
214 | } | 215 | } |
@@ -216,6 +217,18 @@ static int rtl8411_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage) | |||
216 | return rtsx_pci_write_register(pcr, LDO_CTL, mask, val); | 217 | return rtsx_pci_write_register(pcr, LDO_CTL, mask, val); |
217 | } | 218 | } |
218 | 219 | ||
220 | static int rtl8411_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage) | ||
221 | { | ||
222 | return rtl8411_do_switch_output_voltage(pcr, voltage, | ||
223 | BPP_TUNED18_SHIFT_8411, BPP_ASIC_1V8); | ||
224 | } | ||
225 | |||
226 | static int rtl8402_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage) | ||
227 | { | ||
228 | return rtl8411_do_switch_output_voltage(pcr, voltage, | ||
229 | BPP_TUNED18_SHIFT_8402, BPP_ASIC_2V0); | ||
230 | } | ||
231 | |||
219 | static unsigned int rtl8411_cd_deglitch(struct rtsx_pcr *pcr) | 232 | static unsigned int rtl8411_cd_deglitch(struct rtsx_pcr *pcr) |
220 | { | 233 | { |
221 | unsigned int card_exist; | 234 | unsigned int card_exist; |
@@ -295,6 +308,22 @@ static const struct pcr_ops rtl8411_pcr_ops = { | |||
295 | .force_power_down = rtl8411_force_power_down, | 308 | .force_power_down = rtl8411_force_power_down, |
296 | }; | 309 | }; |
297 | 310 | ||
311 | static const struct pcr_ops rtl8402_pcr_ops = { | ||
312 | .fetch_vendor_settings = rtl8411_fetch_vendor_settings, | ||
313 | .extra_init_hw = rtl8411_extra_init_hw, | ||
314 | .optimize_phy = NULL, | ||
315 | .turn_on_led = rtl8411_turn_on_led, | ||
316 | .turn_off_led = rtl8411_turn_off_led, | ||
317 | .enable_auto_blink = rtl8411_enable_auto_blink, | ||
318 | .disable_auto_blink = rtl8411_disable_auto_blink, | ||
319 | .card_power_on = rtl8411_card_power_on, | ||
320 | .card_power_off = rtl8411_card_power_off, | ||
321 | .switch_output_voltage = rtl8402_switch_output_voltage, | ||
322 | .cd_deglitch = rtl8411_cd_deglitch, | ||
323 | .conv_clk_and_div_n = rtl8411_conv_clk_and_div_n, | ||
324 | .force_power_down = rtl8411_force_power_down, | ||
325 | }; | ||
326 | |||
298 | static const struct pcr_ops rtl8411b_pcr_ops = { | 327 | static const struct pcr_ops rtl8411b_pcr_ops = { |
299 | .fetch_vendor_settings = rtl8411b_fetch_vendor_settings, | 328 | .fetch_vendor_settings = rtl8411b_fetch_vendor_settings, |
300 | .extra_init_hw = rtl8411b_extra_init_hw, | 329 | .extra_init_hw = rtl8411b_extra_init_hw, |
@@ -471,3 +500,10 @@ void rtl8411b_init_params(struct rtsx_pcr *pcr) | |||
471 | else | 500 | else |
472 | set_pull_ctrl_tables(pcr, rtl8411b_qfn64); | 501 | set_pull_ctrl_tables(pcr, rtl8411b_qfn64); |
473 | } | 502 | } |
503 | |||
504 | void rtl8402_init_params(struct rtsx_pcr *pcr) | ||
505 | { | ||
506 | rtl8411_init_common_params(pcr); | ||
507 | pcr->ops = &rtl8402_pcr_ops; | ||
508 | set_pull_ctrl_tables(pcr, rtl8411); | ||
509 | } | ||
diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c index 8ab8f1d595ea..767be4d44f15 100644 --- a/drivers/mfd/rtsx_pcr.c +++ b/drivers/mfd/rtsx_pcr.c | |||
@@ -57,6 +57,7 @@ static const struct pci_device_id rtsx_pci_ids[] = { | |||
57 | { PCI_DEVICE(0x10EC, 0x5227), PCI_CLASS_OTHERS << 16, 0xFF0000 }, | 57 | { PCI_DEVICE(0x10EC, 0x5227), PCI_CLASS_OTHERS << 16, 0xFF0000 }, |
58 | { PCI_DEVICE(0x10EC, 0x5249), PCI_CLASS_OTHERS << 16, 0xFF0000 }, | 58 | { PCI_DEVICE(0x10EC, 0x5249), PCI_CLASS_OTHERS << 16, 0xFF0000 }, |
59 | { PCI_DEVICE(0x10EC, 0x5287), PCI_CLASS_OTHERS << 16, 0xFF0000 }, | 59 | { PCI_DEVICE(0x10EC, 0x5287), PCI_CLASS_OTHERS << 16, 0xFF0000 }, |
60 | { PCI_DEVICE(0x10EC, 0x5286), PCI_CLASS_OTHERS << 16, 0xFF0000 }, | ||
60 | { 0, } | 61 | { 0, } |
61 | }; | 62 | }; |
62 | 63 | ||
@@ -1061,6 +1062,10 @@ static int rtsx_pci_init_chip(struct rtsx_pcr *pcr) | |||
1061 | case 0x5287: | 1062 | case 0x5287: |
1062 | rtl8411b_init_params(pcr); | 1063 | rtl8411b_init_params(pcr); |
1063 | break; | 1064 | break; |
1065 | |||
1066 | case 0x5286: | ||
1067 | rtl8402_init_params(pcr); | ||
1068 | break; | ||
1064 | } | 1069 | } |
1065 | 1070 | ||
1066 | dev_dbg(&(pcr->pci->dev), "PID: 0x%04x, IC version: 0x%02x\n", | 1071 | dev_dbg(&(pcr->pci->dev), "PID: 0x%04x, IC version: 0x%02x\n", |
diff --git a/drivers/mfd/rtsx_pcr.h b/drivers/mfd/rtsx_pcr.h index e9feadbfaf5c..07e4c2ebf05a 100644 --- a/drivers/mfd/rtsx_pcr.h +++ b/drivers/mfd/rtsx_pcr.h | |||
@@ -30,6 +30,7 @@ | |||
30 | void rts5209_init_params(struct rtsx_pcr *pcr); | 30 | void rts5209_init_params(struct rtsx_pcr *pcr); |
31 | void rts5229_init_params(struct rtsx_pcr *pcr); | 31 | void rts5229_init_params(struct rtsx_pcr *pcr); |
32 | void rtl8411_init_params(struct rtsx_pcr *pcr); | 32 | void rtl8411_init_params(struct rtsx_pcr *pcr); |
33 | void rtl8402_init_params(struct rtsx_pcr *pcr); | ||
33 | void rts5227_init_params(struct rtsx_pcr *pcr); | 34 | void rts5227_init_params(struct rtsx_pcr *pcr); |
34 | void rts5249_init_params(struct rtsx_pcr *pcr); | 35 | void rts5249_init_params(struct rtsx_pcr *pcr); |
35 | void rtl8411b_init_params(struct rtsx_pcr *pcr); | 36 | void rtl8411b_init_params(struct rtsx_pcr *pcr); |