]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mfd: rtsx: Implement driving adjustment to device-dependent callbacks
authorRoger Tseng <rogerable@realtek.com>
Mon, 4 Feb 2013 07:45:58 +0000 (15:45 +0800)
committerSamuel Ortiz <sameo@linux.intel.com>
Wed, 13 Feb 2013 23:22:59 +0000 (00:22 +0100)
Implement different ways of selecting driving capability(a necessary adjustment
along with voltage change). It was origionally in device-independent
mmc/host/rtsx_pci_sdmmc.c. Moving it here to support devices which may have a
different way of adjustment.

Signed-off-by: Roger Tseng <rogerable@realtek.com>
Reviewed-by: Wei WANG <wei_wang@realsil.com.cn>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/mfd/rtl8411.c
drivers/mfd/rts5209.c
drivers/mfd/rts5229.c

index 3d3b4addf81a9b73b480ae3874e2675e1678b52b..2a2d31687b72243de84451212ff52198f37ecc29 100644 (file)
@@ -115,14 +115,24 @@ static int rtl8411_card_power_off(struct rtsx_pcr *pcr, int card)
 static int rtl8411_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
 {
        u8 mask, val;
+       int err;
 
        mask = (BPP_REG_TUNED18 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_MASK;
-       if (voltage == OUTPUT_3V3)
+       if (voltage == OUTPUT_3V3) {
+               err = rtsx_pci_write_register(pcr,
+                               SD30_DRIVE_SEL, 0x07, DRIVER_TYPE_D);
+               if (err < 0)
+                       return err;
                val = (BPP_ASIC_3V3 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_3V3;
-       else if (voltage == OUTPUT_1V8)
+       } else if (voltage == OUTPUT_1V8) {
+               err = rtsx_pci_write_register(pcr,
+                               SD30_DRIVE_SEL, 0x07, DRIVER_TYPE_B);
+               if (err < 0)
+                       return err;
                val = (BPP_ASIC_1V8 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_1V8;
-       else
+       } else {
                return -EINVAL;
+       }
 
        return rtsx_pci_write_register(pcr, LDO_CTL, mask, val);
 }
index 98fe0f39463ed1596f1e0881f5d7352349da400d..ec78d9fb08791a9975a825411b6d7a8049f5d801 100644 (file)
@@ -149,10 +149,18 @@ static int rts5209_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
        int err;
 
        if (voltage == OUTPUT_3V3) {
+               err = rtsx_pci_write_register(pcr,
+                               SD30_DRIVE_SEL, 0x07, DRIVER_TYPE_D);
+               if (err < 0)
+                       return err;
                err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4FC0 | 0x24);
                if (err < 0)
                        return err;
        } else if (voltage == OUTPUT_1V8) {
+               err = rtsx_pci_write_register(pcr,
+                               SD30_DRIVE_SEL, 0x07, DRIVER_TYPE_B);
+               if (err < 0)
+                       return err;
                err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4C40 | 0x24);
                if (err < 0)
                        return err;
index 29d889cbb9c5183262897bc5e29818c536bb227d..58af4dbe358623d2c45385ee5a5e6f31cb04344e 100644 (file)
@@ -119,10 +119,18 @@ static int rts5229_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
        int err;
 
        if (voltage == OUTPUT_3V3) {
+               err = rtsx_pci_write_register(pcr,
+                               SD30_DRIVE_SEL, 0x07, DRIVER_TYPE_D);
+               if (err < 0)
+                       return err;
                err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4FC0 | 0x24);
                if (err < 0)
                        return err;
        } else if (voltage == OUTPUT_1V8) {
+               err = rtsx_pci_write_register(pcr,
+                               SD30_DRIVE_SEL, 0x07, DRIVER_TYPE_B);
+               if (err < 0)
+                       return err;
                err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4C40 | 0x24);
                if (err < 0)
                        return err;