diff options
author | Micky Ching <micky_ching@realsil.com.cn> | 2015-02-25 00:50:15 -0500 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2015-03-03 11:41:21 -0500 |
commit | 41bc2334737a32d3062a318dde5964590d0e24c9 (patch) | |
tree | 0167072cdea6c37af14527ce4fc19a4b6f298ea2 | |
parent | 663c425f2c8d87a433629f09c5afd0af7e7e550c (diff) |
mfd: rtsx: Add support for rts525A
Add support for new chip rts525A.
Signed-off-by: Micky Ching <micky_ching@realsil.com.cn>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
-rw-r--r-- | drivers/mfd/rts5249.c | 103 | ||||
-rw-r--r-- | drivers/mfd/rtsx_pcr.c | 13 | ||||
-rw-r--r-- | drivers/mfd/rtsx_pcr.h | 1 | ||||
-rw-r--r-- | include/linux/mfd/rtsx_pci.h | 15 |
4 files changed, 129 insertions, 3 deletions
diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c index 32be803b5327..d1ff32f742ba 100644 --- a/drivers/mfd/rts5249.c +++ b/drivers/mfd/rts5249.c | |||
@@ -487,3 +487,106 @@ void rts524a_init_params(struct rtsx_pcr *pcr) | |||
487 | pcr->ops = &rts524a_pcr_ops; | 487 | pcr->ops = &rts524a_pcr_ops; |
488 | } | 488 | } |
489 | 489 | ||
490 | static int rts525a_card_power_on(struct rtsx_pcr *pcr, int card) | ||
491 | { | ||
492 | rtsx_pci_write_register(pcr, LDO_VCC_CFG1, | ||
493 | LDO_VCC_TUNE_MASK, LDO_VCC_3V3); | ||
494 | return rtsx_base_card_power_on(pcr, card); | ||
495 | } | ||
496 | |||
497 | static int rts525a_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage) | ||
498 | { | ||
499 | switch (voltage) { | ||
500 | case OUTPUT_3V3: | ||
501 | rtsx_pci_write_register(pcr, LDO_CONFIG2, | ||
502 | LDO_D3318_MASK, LDO_D3318_33V); | ||
503 | rtsx_pci_write_register(pcr, SD_PAD_CTL, SD_IO_USING_1V8, 0); | ||
504 | break; | ||
505 | case OUTPUT_1V8: | ||
506 | rtsx_pci_write_register(pcr, LDO_CONFIG2, | ||
507 | LDO_D3318_MASK, LDO_D3318_18V); | ||
508 | rtsx_pci_write_register(pcr, SD_PAD_CTL, SD_IO_USING_1V8, | ||
509 | SD_IO_USING_1V8); | ||
510 | break; | ||
511 | default: | ||
512 | return -EINVAL; | ||
513 | } | ||
514 | |||
515 | rtsx_pci_init_cmd(pcr); | ||
516 | rts5249_fill_driving(pcr, voltage); | ||
517 | return rtsx_pci_send_cmd(pcr, 100); | ||
518 | } | ||
519 | |||
520 | static int rts525a_optimize_phy(struct rtsx_pcr *pcr) | ||
521 | { | ||
522 | int err; | ||
523 | |||
524 | err = rtsx_pci_write_register(pcr, RTS524A_PM_CTRL3, | ||
525 | D3_DELINK_MODE_EN, 0x00); | ||
526 | if (err < 0) | ||
527 | return err; | ||
528 | |||
529 | rtsx_pci_write_phy_register(pcr, _PHY_FLD0, | ||
530 | _PHY_FLD0_CLK_REQ_20C | _PHY_FLD0_RX_IDLE_EN | | ||
531 | _PHY_FLD0_BIT_ERR_RSTN | _PHY_FLD0_BER_COUNT | | ||
532 | _PHY_FLD0_BER_TIMER | _PHY_FLD0_CHECK_EN); | ||
533 | |||
534 | rtsx_pci_write_phy_register(pcr, _PHY_ANA03, | ||
535 | _PHY_ANA03_TIMER_MAX | _PHY_ANA03_OOBS_DEB_EN | | ||
536 | _PHY_CMU_DEBUG_EN); | ||
537 | |||
538 | if (is_version(pcr, 0x525A, IC_VER_A)) | ||
539 | rtsx_pci_write_phy_register(pcr, _PHY_REV0, | ||
540 | _PHY_REV0_FILTER_OUT | _PHY_REV0_CDR_BYPASS_PFD | | ||
541 | _PHY_REV0_CDR_RX_IDLE_BYPASS); | ||
542 | |||
543 | return 0; | ||
544 | } | ||
545 | |||
546 | static int rts525a_extra_init_hw(struct rtsx_pcr *pcr) | ||
547 | { | ||
548 | rts5249_extra_init_hw(pcr); | ||
549 | |||
550 | rtsx_pci_write_register(pcr, PCLK_CTL, PCLK_MODE_SEL, PCLK_MODE_SEL); | ||
551 | if (is_version(pcr, 0x525A, IC_VER_A)) { | ||
552 | rtsx_pci_write_register(pcr, L1SUB_CONFIG2, | ||
553 | L1SUB_AUTO_CFG, L1SUB_AUTO_CFG); | ||
554 | rtsx_pci_write_register(pcr, RREF_CFG, | ||
555 | RREF_VBGSEL_MASK, RREF_VBGSEL_1V25); | ||
556 | rtsx_pci_write_register(pcr, LDO_VIO_CFG, | ||
557 | LDO_VIO_TUNE_MASK, LDO_VIO_1V7); | ||
558 | rtsx_pci_write_register(pcr, LDO_DV12S_CFG, | ||
559 | LDO_D12_TUNE_MASK, LDO_D12_TUNE_DF); | ||
560 | rtsx_pci_write_register(pcr, LDO_AV12S_CFG, | ||
561 | LDO_AV12S_TUNE_MASK, LDO_AV12S_TUNE_DF); | ||
562 | rtsx_pci_write_register(pcr, LDO_VCC_CFG0, | ||
563 | LDO_VCC_LMTVTH_MASK, LDO_VCC_LMTVTH_2A); | ||
564 | rtsx_pci_write_register(pcr, OOBS_CONFIG, | ||
565 | OOBS_AUTOK_DIS | OOBS_VAL_MASK, 0x89); | ||
566 | } | ||
567 | |||
568 | return 0; | ||
569 | } | ||
570 | |||
571 | static const struct pcr_ops rts525a_pcr_ops = { | ||
572 | .fetch_vendor_settings = rtsx_base_fetch_vendor_settings, | ||
573 | .extra_init_hw = rts525a_extra_init_hw, | ||
574 | .optimize_phy = rts525a_optimize_phy, | ||
575 | .turn_on_led = rtsx_base_turn_on_led, | ||
576 | .turn_off_led = rtsx_base_turn_off_led, | ||
577 | .enable_auto_blink = rtsx_base_enable_auto_blink, | ||
578 | .disable_auto_blink = rtsx_base_disable_auto_blink, | ||
579 | .card_power_on = rts525a_card_power_on, | ||
580 | .card_power_off = rtsx_base_card_power_off, | ||
581 | .switch_output_voltage = rts525a_switch_output_voltage, | ||
582 | .force_power_down = rtsx_base_force_power_down, | ||
583 | }; | ||
584 | |||
585 | void rts525a_init_params(struct rtsx_pcr *pcr) | ||
586 | { | ||
587 | rts5249_init_params(pcr); | ||
588 | |||
589 | pcr->reg_pm_ctrl3 = RTS524A_PM_CTRL3; | ||
590 | pcr->ops = &rts525a_pcr_ops; | ||
591 | } | ||
592 | |||
diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c index e6d97adcc825..433cb41cf556 100644 --- a/drivers/mfd/rtsx_pcr.c +++ b/drivers/mfd/rtsx_pcr.c | |||
@@ -59,6 +59,7 @@ static const struct pci_device_id rtsx_pci_ids[] = { | |||
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 | { PCI_DEVICE(0x10EC, 0x5286), PCI_CLASS_OTHERS << 16, 0xFF0000 }, |
61 | { PCI_DEVICE(0x10EC, 0x524A), PCI_CLASS_OTHERS << 16, 0xFF0000 }, | 61 | { PCI_DEVICE(0x10EC, 0x524A), PCI_CLASS_OTHERS << 16, 0xFF0000 }, |
62 | { PCI_DEVICE(0x10EC, 0x525A), PCI_CLASS_OTHERS << 16, 0xFF0000 }, | ||
62 | { 0, } | 63 | { 0, } |
63 | }; | 64 | }; |
64 | 65 | ||
@@ -1114,6 +1115,10 @@ static int rtsx_pci_init_chip(struct rtsx_pcr *pcr) | |||
1114 | rts524a_init_params(pcr); | 1115 | rts524a_init_params(pcr); |
1115 | break; | 1116 | break; |
1116 | 1117 | ||
1118 | case 0x525A: | ||
1119 | rts525a_init_params(pcr); | ||
1120 | break; | ||
1121 | |||
1117 | case 0x5287: | 1122 | case 0x5287: |
1118 | rtl8411b_init_params(pcr); | 1123 | rtl8411b_init_params(pcr); |
1119 | break; | 1124 | break; |
@@ -1159,7 +1164,7 @@ static int rtsx_pci_probe(struct pci_dev *pcidev, | |||
1159 | struct rtsx_pcr *pcr; | 1164 | struct rtsx_pcr *pcr; |
1160 | struct pcr_handle *handle; | 1165 | struct pcr_handle *handle; |
1161 | u32 base, len; | 1166 | u32 base, len; |
1162 | int ret, i; | 1167 | int ret, i, bar = 0; |
1163 | 1168 | ||
1164 | dev_dbg(&(pcidev->dev), | 1169 | dev_dbg(&(pcidev->dev), |
1165 | ": Realtek PCI-E Card Reader found at %s [%04x:%04x] (rev %x)\n", | 1170 | ": Realtek PCI-E Card Reader found at %s [%04x:%04x] (rev %x)\n", |
@@ -1204,8 +1209,10 @@ static int rtsx_pci_probe(struct pci_dev *pcidev, | |||
1204 | pcr->pci = pcidev; | 1209 | pcr->pci = pcidev; |
1205 | dev_set_drvdata(&pcidev->dev, handle); | 1210 | dev_set_drvdata(&pcidev->dev, handle); |
1206 | 1211 | ||
1207 | len = pci_resource_len(pcidev, 0); | 1212 | if (CHK_PCI_PID(pcr, 0x525A)) |
1208 | base = pci_resource_start(pcidev, 0); | 1213 | bar = 1; |
1214 | len = pci_resource_len(pcidev, bar); | ||
1215 | base = pci_resource_start(pcidev, bar); | ||
1209 | pcr->remap_addr = ioremap_nocache(base, len); | 1216 | pcr->remap_addr = ioremap_nocache(base, len); |
1210 | if (!pcr->remap_addr) { | 1217 | if (!pcr->remap_addr) { |
1211 | ret = -ENOMEM; | 1218 | ret = -ENOMEM; |
diff --git a/drivers/mfd/rtsx_pcr.h b/drivers/mfd/rtsx_pcr.h index e7daf6f54b83..ce48842570d7 100644 --- a/drivers/mfd/rtsx_pcr.h +++ b/drivers/mfd/rtsx_pcr.h | |||
@@ -40,6 +40,7 @@ void rtl8402_init_params(struct rtsx_pcr *pcr); | |||
40 | void rts5227_init_params(struct rtsx_pcr *pcr); | 40 | void rts5227_init_params(struct rtsx_pcr *pcr); |
41 | void rts5249_init_params(struct rtsx_pcr *pcr); | 41 | void rts5249_init_params(struct rtsx_pcr *pcr); |
42 | void rts524a_init_params(struct rtsx_pcr *pcr); | 42 | void rts524a_init_params(struct rtsx_pcr *pcr); |
43 | void rts525a_init_params(struct rtsx_pcr *pcr); | ||
43 | void rtl8411b_init_params(struct rtsx_pcr *pcr); | 44 | void rtl8411b_init_params(struct rtsx_pcr *pcr); |
44 | 45 | ||
45 | static inline u8 map_sd_drive(int idx) | 46 | static inline u8 map_sd_drive(int idx) |
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h index 754a18d4203a..ff843e7ca23d 100644 --- a/include/linux/mfd/rtsx_pci.h +++ b/include/linux/mfd/rtsx_pci.h | |||
@@ -727,6 +727,10 @@ | |||
727 | #define PHY_SSCCR3 0x03 | 727 | #define PHY_SSCCR3 0x03 |
728 | #define PHY_SSCCR3_STEP_IN 0x2740 | 728 | #define PHY_SSCCR3_STEP_IN 0x2740 |
729 | #define PHY_SSCCR3_CHECK_DELAY 0x0008 | 729 | #define PHY_SSCCR3_CHECK_DELAY 0x0008 |
730 | #define _PHY_ANA03 0x03 | ||
731 | #define _PHY_ANA03_TIMER_MAX 0x2700 | ||
732 | #define _PHY_ANA03_OOBS_DEB_EN 0x0040 | ||
733 | #define _PHY_CMU_DEBUG_EN 0x0008 | ||
730 | 734 | ||
731 | #define PHY_RTCR 0x04 | 735 | #define PHY_RTCR 0x04 |
732 | #define PHY_RDR 0x05 | 736 | #define PHY_RDR 0x05 |
@@ -785,6 +789,10 @@ | |||
785 | #define PHY_REV_STOP_CLKRD 0x0020 | 789 | #define PHY_REV_STOP_CLKRD 0x0020 |
786 | #define PHY_REV_RX_PWST 0x0008 | 790 | #define PHY_REV_RX_PWST 0x0008 |
787 | #define PHY_REV_STOP_CLKWR 0x0004 | 791 | #define PHY_REV_STOP_CLKWR 0x0004 |
792 | #define _PHY_REV0 0x19 | ||
793 | #define _PHY_REV0_FILTER_OUT 0x3800 | ||
794 | #define _PHY_REV0_CDR_BYPASS_PFD 0x0100 | ||
795 | #define _PHY_REV0_CDR_RX_IDLE_BYPASS 0x0002 | ||
788 | 796 | ||
789 | #define PHY_FLD0 0x1A | 797 | #define PHY_FLD0 0x1A |
790 | #define PHY_ANA1A 0x1A | 798 | #define PHY_ANA1A 0x1A |
@@ -800,6 +808,13 @@ | |||
800 | #define PHY_FLD3_RXDELINK 0x0004 | 808 | #define PHY_FLD3_RXDELINK 0x0004 |
801 | #define PHY_ANA1D 0x1D | 809 | #define PHY_ANA1D 0x1D |
802 | #define PHY_ANA1D_DEBUG_ADDR 0x0004 | 810 | #define PHY_ANA1D_DEBUG_ADDR 0x0004 |
811 | #define _PHY_FLD0 0x1D | ||
812 | #define _PHY_FLD0_CLK_REQ_20C 0x8000 | ||
813 | #define _PHY_FLD0_RX_IDLE_EN 0x1000 | ||
814 | #define _PHY_FLD0_BIT_ERR_RSTN 0x0800 | ||
815 | #define _PHY_FLD0_BER_COUNT 0x01E0 | ||
816 | #define _PHY_FLD0_BER_TIMER 0x001E | ||
817 | #define _PHY_FLD0_CHECK_EN 0x0001 | ||
803 | 818 | ||
804 | #define PHY_FLD4 0x1E | 819 | #define PHY_FLD4 0x1E |
805 | #define PHY_FLD4_FLDEN_SEL 0x4000 | 820 | #define PHY_FLD4_FLDEN_SEL 0x4000 |