summaryrefslogtreecommitdiffstats
path: root/include/mach/imx/bbu.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/mach/imx/bbu.h')
-rw-r--r--include/mach/imx/bbu.h232
1 files changed, 232 insertions, 0 deletions
diff --git a/include/mach/imx/bbu.h b/include/mach/imx/bbu.h
new file mode 100644
index 0000000000..9a35b0074d
--- /dev/null
+++ b/include/mach/imx/bbu.h
@@ -0,0 +1,232 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef __MACH_IMX_BBU_H
+#define __MACH_IMX_BBU_H
+
+#include <bbu.h>
+#include <errno.h>
+
+struct imx_dcd_entry;
+struct imx_dcd_v2_entry;
+
+/*
+ * The ROM code reads images from a certain offset of the boot device
+ * (usually 0x400), whereas the update images start from offset 0x0.
+ * Set this flag to skip the offset on both the update image and the
+ * device so that the initial boot device portion is preserved. This
+ * is useful if a partition table or other data is in this area.
+ */
+#define IMX_BBU_FLAG_KEEP_HEAD BIT(16)
+
+/*
+ * Set this flag when the partition the update image is written to
+ * actually starts at the offset where the i.MX flash header is expected
+ * (usually 0x400). This means for the update code that it has to skip
+ * the first 0x400 bytes of the image.
+ */
+#define IMX_BBU_FLAG_PARTITION_STARTS_AT_HEADER (1 << 17)
+
+#define IMX_BBU_FLAG_ERASE BIT(30)
+
+/*
+ * The upper 16 bit of the flags passes to the below functions are reserved
+ * for i.MX specific flags
+ */
+#define IMX_BBU_FLAG_MASK 0xffff0000
+
+#ifdef CONFIG_BAREBOX_UPDATE
+
+int imx51_bbu_internal_mmc_register_handler(const char *name, const char *devicefile,
+ unsigned long flags);
+
+int imx51_bbu_internal_spi_i2c_register_handler(const char *name,
+ const char *devicefile, unsigned long flags);
+
+int imx53_bbu_internal_mmc_register_handler(const char *name, const char *devicefile,
+ unsigned long flags);
+
+int imx53_bbu_internal_spi_i2c_register_handler(const char *name, const char *devicefile,
+ unsigned long flags);
+
+int imx53_bbu_internal_nand_register_handler(const char *name,
+ unsigned long flags, int partition_size);
+
+int imx6_bbu_internal_mmc_register_handler(const char *name, const char *devicefile,
+ unsigned long flags);
+
+int imx6_bbu_internal_mmcboot_register_handler(const char *name, const char *devicefile,
+ unsigned long flags);
+
+int imx51_bbu_internal_mmcboot_register_handler(const char *name, const char *devicefile,
+ unsigned long flags);
+
+int vf610_bbu_internal_mmcboot_register_handler(const char *name, const char *devicefile,
+ unsigned long flags);
+
+int imx7_bbu_internal_mmcboot_register_handler(const char *name, const char *devicefile,
+ unsigned long flags);
+
+int imx6_bbu_internal_spi_i2c_register_handler(const char *name, const char *devicefile,
+ unsigned long flags);
+
+int vf610_bbu_internal_mmc_register_handler(const char *name, const char *devicefile,
+ unsigned long flags);
+
+int vf610_bbu_internal_spi_i2c_register_handler(const char *name, const char *devicefile,
+ unsigned long flags);
+
+int imx7_bbu_internal_spi_i2c_register_handler(const char *name, const char *devicefile,
+ unsigned long flags);
+
+int imx8m_bbu_internal_mmc_register_handler(const char *name, const char *devicefile,
+ unsigned long flags);
+int imx8m_bbu_internal_mmcboot_register_handler(const char *name, const char *devicefile,
+ unsigned long flags);
+
+int imx_bbu_external_nor_register_handler(const char *name, const char *devicefile,
+ unsigned long flags);
+
+int imx8m_bbu_internal_flexspi_nor_register_handler(const char *name,
+ const char *devicefile,
+ unsigned long flags);
+
+#else
+
+static inline int imx51_bbu_internal_mmc_register_handler(const char *name, const char *devicefile,
+ unsigned long flags)
+{
+ return -ENOSYS;
+}
+
+static inline int imx51_bbu_internal_spi_i2c_register_handler(const char *name,
+ const char *devicefile, unsigned long flags)
+{
+ return -ENOSYS;
+}
+
+static inline int imx53_bbu_internal_mmc_register_handler(const char *name, const char *devicefile,
+ unsigned long flags)
+{
+ return -ENOSYS;
+}
+
+static inline int imx53_bbu_internal_spi_i2c_register_handler(const char *name, const char *devicefile,
+ unsigned long flags)
+{
+ return -ENOSYS;
+}
+
+static inline int imx53_bbu_internal_nand_register_handler(const char *name,
+ unsigned long flags, int partition_size)
+{
+ return -ENOSYS;
+}
+
+static inline int imx6_bbu_internal_mmc_register_handler(const char *name, const char *devicefile,
+ unsigned long flags)
+{
+ return -ENOSYS;
+}
+
+static inline int imx6_bbu_internal_mmcboot_register_handler(const char *name,
+ const char *devicefile,
+ unsigned long flags)
+{
+ return -ENOSYS;
+}
+
+static inline int imx51_bbu_internal_mmcboot_register_handler(const char *name,
+ const char *devicefile,
+ unsigned long flags)
+{
+ return -ENOSYS;
+}
+
+
+static inline int vf610_bbu_internal_mmcboot_register_handler(const char *name,
+ const char *devicefile,
+ unsigned long flags)
+{
+ return -ENOSYS;
+}
+
+static inline int imx7_bbu_internal_mmcboot_register_handler(const char *name,
+ const char *devicefile,
+ unsigned long flags)
+{
+ return -ENOSYS;
+}
+
+static inline int imx6_bbu_internal_spi_i2c_register_handler(const char *name, const char *devicefile,
+ unsigned long flags)
+{
+ return -ENOSYS;
+}
+
+static inline int vf610_bbu_internal_mmc_register_handler(const char *name, const char *devicefile,
+ unsigned long flags)
+{
+ return -ENOSYS;
+}
+
+static inline int imx8m_bbu_internal_mmc_register_handler(const char *name, const char *devicefile,
+ unsigned long flags)
+{
+ return -ENOSYS;
+}
+
+static inline int imx8m_bbu_internal_mmcboot_register_handler(const char *name,
+ const char *devicefile,
+ unsigned long flags)
+{
+ return -ENOSYS;
+}
+
+static inline int imx_bbu_external_nor_register_handler(const char *name, const char *devicefile,
+ unsigned long flags)
+{
+ return -ENOSYS;
+}
+
+static inline int
+vf610_bbu_internal_spi_i2c_register_handler(const char *name, char *devicefile,
+ unsigned long flags)
+{
+ return -ENOSYS;
+}
+
+static inline int
+imx7_bbu_internal_spi_i2c_register_handler(const char *name, char *devicefile,
+ unsigned long flags)
+{
+ return -ENOSYS;
+}
+
+static inline int
+imx8m_bbu_internal_flexspi_nor_register_handler(const char *name, const char *devicefile,
+ unsigned long flags)
+{
+ return -ENOSYS;
+}
+
+#endif
+
+#if defined(CONFIG_BAREBOX_UPDATE_IMX_EXTERNAL_NAND)
+int imx_bbu_external_nand_register_handler(const char *name, const char *devicefile,
+ unsigned long flags);
+#else
+static inline int imx_bbu_external_nand_register_handler(const char *name, const char *devicefile,
+ unsigned long flags)
+{
+ return -ENOSYS;
+}
+#endif
+
+static inline int imx9_bbu_internal_mmcboot_register_handler(const char *name,
+ const char *devicefile,
+ unsigned long flags)
+{
+ return bbu_mmcboot_register_handler(name, devicefile, flags);
+}
+
+#endif /* __MACH_IMX_BBU_H */