Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: davinci: request gpios using gpio descriptors

Request card detect and write protect gpios using the provided API
by mmc core.

If a gpio is provided for card detect, we don't need to poll.
So only use polling when a gpio is not provided.

Once all pdata users register the gpios using gpio descriptors,
we could remove the platform callbacks.

Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: David Lechner <david@lechnology.com>

authored by

ahaslam@baylibre.com and committed by
Ulf Hansson
6e628dad c8301e79

+12 -1
+12 -1
drivers/mmc/host/davinci_mmc.c
··· 1167 1167 struct platform_device *pdev = to_platform_device(mmc->parent); 1168 1168 struct davinci_mmc_config *pdata = pdev->dev.platform_data; 1169 1169 struct mmc_davinci_host *host; 1170 + int ret; 1170 1171 1171 1172 if (!pdata) 1172 1173 return -EINVAL; ··· 1185 1184 if (pdata && (pdata->wires == 8)) 1186 1185 mmc->caps |= (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA); 1187 1186 1188 - mmc->caps |= MMC_CAP_NEEDS_POLL; 1189 1187 mmc->f_min = 312500; 1190 1188 mmc->f_max = 25000000; 1191 1189 if (pdata && pdata->max_freq) 1192 1190 mmc->f_max = pdata->max_freq; 1193 1191 if (pdata && pdata->caps) 1194 1192 mmc->caps |= pdata->caps; 1193 + 1194 + /* Register a cd gpio, if there is not one, enable polling */ 1195 + ret = mmc_gpiod_request_cd(mmc, "cd", 0, false, 0, NULL); 1196 + if (ret == -EPROBE_DEFER) 1197 + return ret; 1198 + else if (ret) 1199 + mmc->caps |= MMC_CAP_NEEDS_POLL; 1200 + 1201 + ret = mmc_gpiod_request_ro(mmc, "wp", 0, false, 0, NULL); 1202 + if (ret == -EPROBE_DEFER) 1203 + return ret; 1195 1204 1196 1205 return 0; 1197 1206 }