aboutsummaryrefslogtreecommitdiff
path: root/include/linux/mmc/ffu.h
blob: 386b167d1fa48bbe6118a3a16f27171e30f13118 (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
/*
 *
 *  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_MID_OP 305
#define MMC_FFU_PNM_OP 306

#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);
#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)
{
    return -ENOSYS;
}

#endif
#endif /* FFU_H_ */