summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx/include/mach/bbu.h
blob: 7df9d668bb1ddf4671f653efcf60afbdd32426fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#ifndef __MACH_BBU_H
#define __MACH_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)

/*
 * 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, char *devicefile,
		unsigned long flags);

int imx51_bbu_internal_spi_i2c_register_handler(const char *name,
		char *devicefile, unsigned long flags);

int imx53_bbu_internal_mmc_register_handler(const char *name, char *devicefile,
		unsigned long flags);

int imx53_bbu_internal_spi_i2c_register_handler(const char *name, 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, char *devicefile,
		unsigned long flags);

int imx6_bbu_internal_mmcboot_register_handler(const char *name, char *devicefile,
		unsigned long flags);

int imx6_bbu_internal_spi_i2c_register_handler(const char *name, char *devicefile,
		unsigned long flags);

int vf610_bbu_internal_mmc_register_handler(const char *name, char *devicefile,
		unsigned long flags);

int imx_bbu_external_nor_register_handler(const char *name, char *devicefile,
		unsigned long flags);

#else

static inline int imx51_bbu_internal_mmc_register_handler(const char *name, char *devicefile,
		unsigned long flags)
{
	return -ENOSYS;
}

static inline int imx51_bbu_internal_spi_i2c_register_handler(const char *name,
		char *devicefile, unsigned long flags)
{
	return -ENOSYS;
}

static inline int imx53_bbu_internal_mmc_register_handler(const char *name, char *devicefile,
		unsigned long flags)
{
	return -ENOSYS;
}

static inline int imx53_bbu_internal_spi_i2c_register_handler(const char *name, 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, char *devicefile,
		unsigned long flags)
{
	return -ENOSYS;
}

static inline int imx6_bbu_internal_mmcboot_register_handler(const char *name,
							     char *devicefile,
							     unsigned long flags)
{
	return -ENOSYS;
}

static inline int imx6_bbu_internal_spi_i2c_register_handler(const char *name, char *devicefile,
		unsigned long flags)
{
	return -ENOSYS;
}

int vf610_bbu_internal_mmc_register_handler(const char *name, char *devicefile,
					    unsigned long flags)
{
	return -ENOSYS;
}

static inline int imx_bbu_external_nor_register_handler(const char *name, 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, char *devicefile,
		unsigned long flags);
#else
static inline int imx_bbu_external_nand_register_handler(const char *name, char *devicefile,
		unsigned long flags)
{
	return -ENOSYS;
}
#endif

#endif