aboutsummaryrefslogtreecommitdiff
path: root/drivers/mmc/sunxi_mmc.c
diff options
context:
space:
mode:
authorTom Rini2015-07-25 09:04:18 -0400
committerTom Rini2015-07-25 09:04:18 -0400
commit26473945ad6667183296e7edee2a65edf31bb6f7 (patch)
treeceb27f9307dbc86e20a5a9eb392c786e2fee5025 /drivers/mmc/sunxi_mmc.c
parent6f4e050639241218987541f4729172e4e0e2ff31 (diff)
parent7f7409ba6ab937b73f16bac8d83e215db86ace3d (diff)
Merge branch 'master' of http://git.denx.de/u-boot-sunxi
Diffstat (limited to 'drivers/mmc/sunxi_mmc.c')
-rw-r--r--drivers/mmc/sunxi_mmc.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
index e7ab828a8f1..f9b9493c892 100644
--- a/drivers/mmc/sunxi_mmc.c
+++ b/drivers/mmc/sunxi_mmc.c
@@ -433,6 +433,23 @@ static int sunxi_mmc_getcd(struct mmc *mmc)
return !gpio_get_value(cd_pin);
}
+int sunxi_mmc_has_egon_boot_signature(struct mmc *mmc)
+{
+ char *buf = malloc(512);
+ int valid_signature = 0;
+
+ if (buf == NULL)
+ panic("Failed to allocate memory\n");
+
+ if (mmc_getcd(mmc) && mmc_init(mmc) == 0 &&
+ mmc->block_dev.block_read(mmc->block_dev.dev, 16, 1, buf) == 1 &&
+ strncmp(&buf[4], "eGON.BT0", 8) == 0)
+ valid_signature = 1;
+
+ free(buf);
+ return valid_signature;
+}
+
static const struct mmc_ops sunxi_mmc_ops = {
.send_cmd = sunxi_mmc_send_cmd,
.set_ios = sunxi_mmc_set_ios,