summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/include/mach/tegra_odm_fuses.h
blob: 4ab8433dbbffb7feccfc286aac10cf178b78689d (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
/*
 * arch/arm/mach-tegra/include/mach/tegra_odm_fuses.h
 *
 * Copyright (c) 2011, NVIDIA Corporation.
 *
 * 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 is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

#ifndef __MACH_TEGRA_ODM_FUSES_H
#define __MACH_TEGRA_ODM_FUSES_H

#define SBK_DEVKEY_STATUS_SZ	sizeof(u32)

/*
 * fuse io parameters: params with sizes less than a byte are
 * explicitly mentioned
 */
enum fuse_io_param {
	DEVKEY,
	JTAG_DIS, /* 1 bit long */
	/*
	 * Programming the odm production fuse at the same
	 * time as the sbk or dev_key is not allowed as it is not possible to
	 * verify that the sbk or dev_key were programmed correctly.
	 */
	ODM_PROD_MODE, /* 1 bit long */
	SEC_BOOT_DEV_CFG,
	SEC_BOOT_DEV_SEL, /* 3 bits long */
	SBK,
	SW_RSVD, /* 4 bits long */
	IGNORE_DEV_SEL_STRAPS, /* 1 bit long */
	ODM_RSVD,
	SBK_DEVKEY_STATUS,
	_PARAMS_U32 = 0x7FFFFFFF
};

#define MAX_PARAMS SBK_DEVKEY_STATUS

/* the order of the members is pre-decided. please do not change */
struct fuse_data {
	u32 devkey;
	u32 jtag_dis;
	u32 odm_prod_mode;
	u32 bootdev_cfg;
	u32 bootdev_sel;
	u32 sbk[4];
	u32 sw_rsvd;
	u32 ignore_devsel_straps;
	u32 odm_rsvd[8];
};

/* secondary boot device options */
enum {
	SECBOOTDEV_SDMMC,
	SECBOOTDEV_NOR,
	SECBOOTDEV_SPI,
	SECBOOTDEV_NAND,
	SECBOOTDEV_LBANAND,
	SECBOOTDEV_MUXONENAND,
	_SECBOOTDEV_MAX,
	_SECBOOTDEV_U32 = 0x7FFFFFFF
};

/*
 * read the fuse settings
 * @param: io_param_type - param type enum
 * @param: size - read size in bytes
 */
int tegra_fuse_read(enum fuse_io_param io_param_type, u32 *data, int size);

#define FLAGS_DEVKEY			BIT(DEVKEY)
#define FLAGS_JTAG_DIS			BIT(JTAG_DIS)
#define FLAGS_SBK_DEVKEY_STATUS		BIT(SBK_DEVKEY_STATUS)
#define FLAGS_ODM_PROD_MODE		BIT(ODM_PROD_MODE)
#define FLAGS_SEC_BOOT_DEV_CFG		BIT(SEC_BOOT_DEV_CFG)
#define FLAGS_SEC_BOOT_DEV_SEL		BIT(SEC_BOOT_DEV_SEL)
#define FLAGS_SBK			BIT(SBK)
#define FLAGS_SW_RSVD			BIT(SW_RSVD)
#define FLAGS_IGNORE_DEV_SEL_STRAPS	BIT(IGNORE_DEV_SEL_STRAPS)
#define FLAGS_ODMRSVD			BIT(ODM_RSVD)

/*
 * Prior to invoking this routine, the caller is responsible for supplying
 * valid fuse programming voltage.
 *
 * @param: pgm_data - entire data to be programmed
 * @flags: program flags (e.g. FLAGS_DEVKEY)
 */
int tegra_fuse_program(struct fuse_data *pgm_data, u32 flags);

/* Disables the fuse programming until the next system reset */
void tegra_fuse_program_disable(void);

extern int (*tegra_fuse_regulator_en)(int);
#endif