Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
1
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
35b1498
Documentation
arch
alpha
arm
boot
common
configs
include
kernel
lib
mach-at91
mach-bcmring
mach-clps711x
mach-cns3xxx
mach-davinci
mach-dove
mach-ebsa110
mach-ep93xx
mach-exynos
mach-footbridge
mach-gemini
mach-h720x
mach-highbank
mach-imx
mach-integrator
mach-iop13xx
mach-iop32x
mach-iop33x
mach-ixp2000
mach-ixp23xx
mach-ixp4xx
mach-kirkwood
mach-ks8695
mach-l7200
mach-lpc32xx
mach-mmp
mach-msm
mach-mv78xx0
mach-mxs
mach-netx
mach-nomadik
mach-omap1
mach-omap2
mach-orion5x
mach-picoxcell
mach-pnx4008
mach-prima2
mach-pxa
mach-realview
mach-rpc
mach-s3c2410
mach-s3c2412
mach-s3c2416
mach-s3c2440
mach-s3c2443
mach-s3c64xx
mach-s5p64x0
mach-s5pc100
mach-s5pv210
mach-sa1100
mach-shark
mach-shmobile
mach-spear3xx
mach-spear6xx
mach-tegra
include
Kconfig
Makefile
Makefile.boot
apbio.c
apbio.h
board-dt-tegra20.c
board-dt-tegra30.c
board-harmony-pcie.c
board-harmony-pinmux.c
board-harmony-power.c
board-harmony.c
board-harmony.h
board-paz00-pinmux.c
board-paz00.c
board-paz00.h
board-pinmux.c
board-pinmux.h
board-seaboard-pinmux.c
board-seaboard.c
board-seaboard.h
board-trimslice-pinmux.c
board-trimslice.c
board-trimslice.h
board.h
clock.c
clock.h
common.c
cpu-tegra.c
cpuidle.c
devices.c
devices.h
dma.c
flowctrl.h
fuse.c
fuse.h
gpio-names.h
headsmp.S
hotplug.c
io.c
irq.c
localtimer.c
pcie.c
pinmux-tegra20-tables.c
pinmux-tegra30-tables.c
pinmux.c
platsmp.c
pmc.c
pmc.h
powergate.c
sleep.S
tegra2_clocks.c
tegra2_emc.c
tegra2_emc.h
tegra30_clocks.c
timer.c
usb_phy.c
mach-u300
mach-ux500
mach-versatile
mach-vexpress
mach-vt8500
mach-w90x900
mach-zynq
mm
nwfpe
oprofile
plat-iop
plat-mxc
plat-nomadik
plat-omap
plat-orion
plat-pxa
plat-s3c24xx
plat-s5p
plat-samsung
plat-spear
plat-versatile
tools
vfp
Kconfig
Kconfig-nommu
Kconfig.debug
Makefile
avr32
blackfin
c6x
cris
frv
h8300
hexagon
ia64
m32r
m68k
microblaze
mips
mn10300
openrisc
parisc
powerpc
s390
score
sh
sparc
tile
um
unicore32
x86
xtensa
.gitignore
Kconfig
block
crypto
drivers
firmware
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
REPORTING-BUGS
Breadcrumbs
linux
/
arch
/
arm
/
mach-tegra
/
fuse.c
Copy path
Blame
Blame
Latest commit
History
History
129 lines (106 loc) · 3.15 KB
Breadcrumbs
linux
/
arch
/
arm
/
mach-tegra
/
fuse.c
Top
File metadata and controls
Code
Blame
129 lines (106 loc) · 3.15 KB
Raw
/* * arch/arm/mach-tegra/fuse.c * * Copyright (C) 2010 Google, Inc. * * Author: * Colin Cross <ccross@android.com> * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * 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. * */ #include <linux/kernel.h> #include <linux/io.h> #include <mach/iomap.h> #include "fuse.h" #include "apbio.h" #define FUSE_UID_LOW 0x108 #define FUSE_UID_HIGH 0x10c #define FUSE_SKU_INFO 0x110 #define FUSE_SPARE_BIT 0x200 int tegra_sku_id; int tegra_cpu_process_id; int tegra_core_process_id; static int tegra_chip_id; enum tegra_revision tegra_revision; /* The BCT to use at boot is specified by board straps that can be read * through a APB misc register and decoded. 2 bits, i.e. 4 possible BCTs. */ int tegra_bct_strapping; #define STRAP_OPT 0x008 #define GMI_AD0 (1 << 4) #define GMI_AD1 (1 << 5) #define RAM_ID_MASK (GMI_AD0 | GMI_AD1) #define RAM_CODE_SHIFT 4 static const char *tegra_revision_name[TEGRA_REVISION_MAX] = { [TEGRA_REVISION_UNKNOWN] = "unknown", [TEGRA_REVISION_A01] = "A01", [TEGRA_REVISION_A02] = "A02", [TEGRA_REVISION_A03] = "A03", [TEGRA_REVISION_A03p] = "A03 prime", [TEGRA_REVISION_A04] = "A04", }; static inline u32 tegra_fuse_readl(unsigned long offset) { return tegra_apb_readl(TEGRA_FUSE_BASE + offset); } static inline bool get_spare_fuse(int bit) { return tegra_fuse_readl(FUSE_SPARE_BIT + bit * 4); } static enum tegra_revision tegra_get_revision(u32 id) { u32 minor_rev = (id >> 16) & 0xf; switch (minor_rev) { case 1: return TEGRA_REVISION_A01; case 2: return TEGRA_REVISION_A02; case 3: if (tegra_chip_id == TEGRA20 && (get_spare_fuse(18) || get_spare_fuse(19))) return TEGRA_REVISION_A03p; else return TEGRA_REVISION_A03; case 4: return TEGRA_REVISION_A04; default: return TEGRA_REVISION_UNKNOWN; } } void tegra_init_fuse(void) { u32 id; u32 reg = readl(IO_TO_VIRT(TEGRA_CLK_RESET_BASE + 0x48)); reg |= 1 << 28; writel(reg, IO_TO_VIRT(TEGRA_CLK_RESET_BASE + 0x48)); reg = tegra_fuse_readl(FUSE_SKU_INFO); tegra_sku_id = reg & 0xFF; reg = tegra_fuse_readl(FUSE_SPARE_BIT); tegra_cpu_process_id = (reg >> 6) & 3; reg = tegra_fuse_readl(FUSE_SPARE_BIT); tegra_core_process_id = (reg >> 12) & 3; reg = tegra_apb_readl(TEGRA_APB_MISC_BASE + STRAP_OPT); tegra_bct_strapping = (reg & RAM_ID_MASK) >> RAM_CODE_SHIFT; id = readl_relaxed(IO_ADDRESS(TEGRA_APB_MISC_BASE) + 0x804); tegra_chip_id = (id >> 8) & 0xff; tegra_revision = tegra_get_revision(id); pr_info("Tegra Revision: %s SKU: %d CPU Process: %d Core Process: %d\n", tegra_revision_name[tegra_revision], tegra_sku_id, tegra_cpu_process_id, tegra_core_process_id); } unsigned long long tegra_chip_uid(void) { unsigned long long lo, hi; lo = tegra_fuse_readl(FUSE_UID_LOW); hi = tegra_fuse_readl(FUSE_UID_HIGH); return (hi << 32ull) | lo; }
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
You can’t perform that action at this time.