@@ -28,7 +28,6 @@ struct mmc_pwrseq_sd8787 {
28
28
struct mmc_pwrseq pwrseq ;
29
29
struct gpio_desc * reset_gpio ;
30
30
struct gpio_desc * pwrdn_gpio ;
31
- u32 reset_pwrdwn_delay_ms ;
32
31
};
33
32
34
33
#define to_pwrseq_sd8787 (p ) container_of(p, struct mmc_pwrseq_sd8787, pwrseq)
@@ -39,7 +38,7 @@ static void mmc_pwrseq_sd8787_pre_power_on(struct mmc_host *host)
39
38
40
39
gpiod_set_value_cansleep (pwrseq -> reset_gpio , 1 );
41
40
42
- msleep (pwrseq -> reset_pwrdwn_delay_ms );
41
+ msleep (300 );
43
42
gpiod_set_value_cansleep (pwrseq -> pwrdn_gpio , 1 );
44
43
}
45
44
@@ -51,17 +50,37 @@ static void mmc_pwrseq_sd8787_power_off(struct mmc_host *host)
51
50
gpiod_set_value_cansleep (pwrseq -> reset_gpio , 0 );
52
51
}
53
52
53
+ static void mmc_pwrseq_wilc1000_pre_power_on (struct mmc_host * host )
54
+ {
55
+ struct mmc_pwrseq_sd8787 * pwrseq = to_pwrseq_sd8787 (host -> pwrseq );
56
+
57
+ /* The pwrdn_gpio is really CHIP_EN, reset_gpio is RESETN */
58
+ gpiod_set_value_cansleep (pwrseq -> pwrdn_gpio , 1 );
59
+ msleep (5 );
60
+ gpiod_set_value_cansleep (pwrseq -> reset_gpio , 1 );
61
+ }
62
+
63
+ static void mmc_pwrseq_wilc1000_power_off (struct mmc_host * host )
64
+ {
65
+ struct mmc_pwrseq_sd8787 * pwrseq = to_pwrseq_sd8787 (host -> pwrseq );
66
+
67
+ gpiod_set_value_cansleep (pwrseq -> reset_gpio , 0 );
68
+ gpiod_set_value_cansleep (pwrseq -> pwrdn_gpio , 0 );
69
+ }
70
+
54
71
static const struct mmc_pwrseq_ops mmc_pwrseq_sd8787_ops = {
55
72
.pre_power_on = mmc_pwrseq_sd8787_pre_power_on ,
56
73
.power_off = mmc_pwrseq_sd8787_power_off ,
57
74
};
58
75
59
- static const u32 sd8787_delay_ms = 300 ;
60
- static const u32 wilc1000_delay_ms = 5 ;
76
+ static const struct mmc_pwrseq_ops mmc_pwrseq_wilc1000_ops = {
77
+ .pre_power_on = mmc_pwrseq_wilc1000_pre_power_on ,
78
+ .power_off = mmc_pwrseq_wilc1000_power_off ,
79
+ };
61
80
62
81
static const struct of_device_id mmc_pwrseq_sd8787_of_match [] = {
63
- { .compatible = "mmc-pwrseq-sd8787" , .data = & sd8787_delay_ms },
64
- { .compatible = "mmc-pwrseq-wilc1000" , .data = & wilc1000_delay_ms },
82
+ { .compatible = "mmc-pwrseq-sd8787" , .data = & mmc_pwrseq_sd8787_ops },
83
+ { .compatible = "mmc-pwrseq-wilc1000" , .data = & mmc_pwrseq_wilc1000_ops },
65
84
{/* sentinel */ },
66
85
};
67
86
MODULE_DEVICE_TABLE (of , mmc_pwrseq_sd8787_of_match );
@@ -77,7 +96,6 @@ static int mmc_pwrseq_sd8787_probe(struct platform_device *pdev)
77
96
return - ENOMEM ;
78
97
79
98
match = of_match_node (mmc_pwrseq_sd8787_of_match , pdev -> dev .of_node );
80
- pwrseq -> reset_pwrdwn_delay_ms = * (u32 * )match -> data ;
81
99
82
100
pwrseq -> pwrdn_gpio = devm_gpiod_get (dev , "powerdown" , GPIOD_OUT_LOW );
83
101
if (IS_ERR (pwrseq -> pwrdn_gpio ))
@@ -88,7 +106,7 @@ static int mmc_pwrseq_sd8787_probe(struct platform_device *pdev)
88
106
return PTR_ERR (pwrseq -> reset_gpio );
89
107
90
108
pwrseq -> pwrseq .dev = dev ;
91
- pwrseq -> pwrseq .ops = & mmc_pwrseq_sd8787_ops ;
109
+ pwrseq -> pwrseq .ops = match -> data ;
92
110
pwrseq -> pwrseq .owner = THIS_MODULE ;
93
111
platform_set_drvdata (pdev , pwrseq );
94
112
0 commit comments