summaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2014-12-20 11:41:25 +0800
committerHans de Goede <hdegoede@redhat.com>2015-01-14 14:56:36 +0100
commitb0c4ae1a5176632e17627f05ae54be1b1bea3082 (patch)
treef5b5353291b4779cb9084b8889e0f0f0c5b2abc3 /drivers/mmc
parent3f6242eb30ca768ba56d46c40a905ea25405d12d (diff)
downloadu-boot-imx-b0c4ae1a5176632e17627f05ae54be1b1bea3082.zip
u-boot-imx-b0c4ae1a5176632e17627f05ae54be1b1bea3082.tar.gz
u-boot-imx-b0c4ae1a5176632e17627f05ae54be1b1bea3082.tar.bz2
mmc: sunxi: Fix misuse of gpio_direction_input()
It does not make sense to make gpio_direction_input() return the gpio input status. The return value of gpio_direction_input() is inconsistent if CONFIG_DM_GPIO is defined. And we don't need to call gpio_direction_input() int sunxi_mmc_getcd(). Just init the gpio once in mmc_resource_init() is enough. Signed-off-by: Axel Lin <axel.lin@ingics.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/sunxi_mmc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
index 20d18d0..6234981 100644
--- a/drivers/mmc/sunxi_mmc.c
+++ b/drivers/mmc/sunxi_mmc.c
@@ -72,8 +72,11 @@ static int mmc_resource_init(int sdc_no)
mmchost->mmc_no = sdc_no;
cd_pin = sunxi_mmc_getcd_gpio(sdc_no);
- if (cd_pin != -1)
+ if (cd_pin != -1) {
ret = gpio_request(cd_pin, "mmc_cd");
+ if (!ret)
+ ret = gpio_direction_input(cd_pin);
+ }
return ret;
}
@@ -414,7 +417,7 @@ static int sunxi_mmc_getcd(struct mmc *mmc)
if (cd_pin == -1)
return 1;
- return !gpio_direction_input(cd_pin);
+ return !gpio_get_value(cd_pin);
}
static const struct mmc_ops sunxi_mmc_ops = {