aboutsummaryrefslogtreecommitdiff
path: root/include/linux/mmc/ffu.h
diff options
context:
space:
mode:
authorMeizu OpenSource <patchwork@meizu.com>2016-08-15 10:19:42 +0800
committerMeizu OpenSource <patchwork@meizu.com>2016-08-15 10:19:42 +0800
commitd2e1446d81725c351dc73a03b397ce043fb18452 (patch)
tree4dbc616b7f92aea39cd697a9084205ddb805e344 /include/linux/mmc/ffu.h
first commit
Diffstat (limited to 'include/linux/mmc/ffu.h')
-rw-r--r--include/linux/mmc/ffu.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/include/linux/mmc/ffu.h b/include/linux/mmc/ffu.h
new file mode 100644
index 000000000..b18289078
--- /dev/null
+++ b/include/linux/mmc/ffu.h
@@ -0,0 +1,64 @@
+/*
+ *
+ * ffu.h
+ *
+ * Copyright (c) 2013 SanDisk Corp.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program was created by SanDisk Corp
+ * The ffu.h file is obtained under the GPL v2.0 license that is
+ * available via http://www.gnu.org/licenses/,
+ * or http://www.opensource.org/licenses/gpl-2.0.php
+*/
+
+#if !defined(_FFU_H_)
+#define _FFU_H_
+
+#include <linux/mmc/card.h>
+
+#define CARD_BLOCK_SIZE 512
+
+/*
+ * eMMC5.0 Field Firmware Update (FFU) opcodes
+*/
+#define MMC_FFU_DOWNLOAD_OP 302
+#define MMC_FFU_INSTALL_OP 303
+
+#define MMC_FFU_MODE_SET 0x1
+#define MMC_FFU_MODE_NORMAL 0x0
+#define MMC_FFU_INSTALL_SET 0x1
+
+#ifdef CONFIG_MMC_FFU
+#define MMC_FFU_ENABLE 0x0
+#define MMC_FFU_CONFIG 0x1
+#define MMC_FFU_SUPPORTED_MODES 0x1
+#define MMC_FFU_FEATURES 0x1
+
+#define FFU_ENABLED(ffu_enable) (ffu_enable & MMC_FFU_CONFIG)
+#define FFU_SUPPORTED_MODE(ffu_sup_mode) \
+ (ffu_sup_mode && MMC_FFU_SUPPORTED_MODES)
+#define FFU_CONFIG(ffu_config) (ffu_config & MMC_FFU_CONFIG)
+#define FFU_FEATURES(ffu_fetures) (ffu_fetures & MMC_FFU_FEATURES)
+
+int mmc_ffu_download(struct mmc_card *card, struct mmc_command *cmd,
+ u8 *data, int buf_bytes);
+int mmc_ffu_install(struct mmc_card *card, u8 *ext_csd);
+
+#else
+static inline int mmc_ffu_download(struct mmc_card *card,
+ struct mmc_command *cmd, u8 *data, int buf_bytes)
+{
+ return -ENOSYS;
+}
+static inline int mmc_ffu_install(struct mmc_card *card, u8 *ext_csd)
+{
+ return -ENOSYS;
+}
+
+#endif
+#endif /* FFU_H_ */
+