9
9
*/
10
10
11
11
#include <linux/clk.h>
12
- #include <linux/delay.h>
13
12
#include <linux/mfd/syscon.h>
14
13
#include <linux/mmc/host.h>
15
14
#include <linux/mmc/dw_mmc.h>
@@ -77,18 +76,24 @@ static int dw_mci_hi6220_switch_voltage(struct mmc_host *mmc, struct mmc_ios *io
77
76
if (!priv || !priv -> reg )
78
77
return 0 ;
79
78
80
- min_uv = 1800000 ;
81
- max_uv = 1800000 ;
82
-
83
79
if (ios -> signal_voltage == MMC_SIGNAL_VOLTAGE_330 ) {
84
80
ret = regmap_update_bits (priv -> reg , AO_SCTRL_CTRL3 ,
85
81
AO_SCTRL_SEL18 , 0 );
86
- if (ret ) {
87
- dev_dbg (host -> dev , "switch voltage failed\n" );
88
- return ret ;
89
- }
90
82
min_uv = 3000000 ;
91
83
max_uv = 3000000 ;
84
+ } else if (ios -> signal_voltage == MMC_SIGNAL_VOLTAGE_180 ) {
85
+ ret = regmap_update_bits (priv -> reg , AO_SCTRL_CTRL3 ,
86
+ AO_SCTRL_SEL18 , AO_SCTRL_SEL18 );
87
+ min_uv = 1800000 ;
88
+ max_uv = 1800000 ;
89
+ } else {
90
+ dev_dbg (host -> dev , "voltage not supported\n" );
91
+ return - EINVAL ;
92
+ }
93
+
94
+ if (ret ) {
95
+ dev_dbg (host -> dev , "switch voltage failed\n" );
96
+ return ret ;
92
97
}
93
98
94
99
if (IS_ERR_OR_NULL (mmc -> supply .vqmmc ))
@@ -100,24 +105,15 @@ static int dw_mci_hi6220_switch_voltage(struct mmc_host *mmc, struct mmc_ios *io
100
105
ret , min_uv , max_uv );
101
106
return ret ;
102
107
}
103
-
104
- ret = regulator_enable (mmc -> supply .vqmmc );
105
- if (ret ) {
106
- dev_dbg (host -> dev , "Regulator enable error %d\n" , ret );
107
- return ret ;
108
- }
109
-
110
- usleep_range (5000 , 5500 );
111
-
112
108
return 0 ;
113
- }
109
+ }
114
110
115
111
static void dw_mci_hi6220_set_ios (struct dw_mci * host , struct mmc_ios * ios )
116
112
{
117
113
int ret ;
118
114
unsigned int clock ;
119
115
120
- clock = (ios -> clock <= 25000000 ) ? 25000000 : ios -> clock ;
116
+ clock = (ios -> clock <= 25000000 ) ? 25000000 : ios -> clock ;
121
117
122
118
ret = clk_set_rate (host -> biu_clk , clock );
123
119
if (ret )
@@ -134,7 +130,7 @@ static const struct dw_mci_drv_data hi6220_data = {
134
130
135
131
static const struct of_device_id dw_mci_k3_match [] = {
136
132
{ .compatible = "hisilicon,hi4511-dw-mshc" , .data = & k3_drv_data , },
137
- { .compatible = "hisilicon,hi6220-dw-mshc" , .data = & hi6220_data , },
133
+ { .compatible = "hisilicon,hi6220-dw-mshc" , .data = & hi6220_data , },
138
134
{},
139
135
};
140
136
MODULE_DEVICE_TABLE (of , dw_mci_k3_match );
0 commit comments