5 #include <linux/kernel.h>
26 #define DEBUG_SDSLOT_VDD 1
33 for(n = 0; n < len; n++) {
41 static uint32_t sdcard_on_gpio_table[] = {
50 static uint32_t sdcard_off_gpio_table[] = {
59 static uint opt_disable_sdcard;
61 static int __init trout_disablesdcard_setup(
char *
str)
65 opt_disable_sdcard = cal;
69 __setup(
"board_trout.disable_sdcard=", trout_disablesdcard_setup);
71 static struct vreg *vreg_sdslot;
92 static unsigned int sdslot_vdd = 0xffffffff;
93 static unsigned int sdslot_vreg_enabled;
101 if (vdd == sdslot_vdd)
108 printk(
"%s: Disabling SD slot power\n", __func__);
110 config_gpio_table(sdcard_off_gpio_table,
113 sdslot_vreg_enabled = 0;
117 if (!sdslot_vreg_enabled) {
123 config_gpio_table(sdcard_on_gpio_table,
125 sdslot_vreg_enabled = 1;
128 for (i = 0; i <
ARRAY_SIZE(mmc_vdd_table); i++) {
129 if (mmc_vdd_table[i].
mask == (1 << vdd)) {
131 printk(
"%s: Setting level to %u\n",
132 __func__, mmc_vdd_table[i].
level);
135 mmc_vdd_table[i].
level);
138 "%s: Error setting vreg level (%d)\n",
149 static unsigned int trout_sdslot_status(
struct device *dev)
157 #define TROUT_MMC_VDD MMC_VDD_165_195 | MMC_VDD_20_21 | MMC_VDD_21_22 \
158 | MMC_VDD_22_23 | MMC_VDD_23_24 | MMC_VDD_24_25 \
159 | MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 \
160 | MMC_VDD_28_29 | MMC_VDD_29_30
164 .status = trout_sdslot_status,
165 .translate_vdd = trout_sdslot_switchvdd,
170 sdslot_vreg_enabled = 0;
173 if (IS_ERR(vreg_sdslot))
174 return PTR_ERR(vreg_sdslot);
178 if (!opt_disable_sdcard)