aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-tegra/Makefile1
-rw-r--r--arch/arm/mach-tegra/common.c2
-rw-r--r--arch/arm/mach-tegra/fuse.c84
-rw-r--r--arch/arm/mach-tegra/fuse.h24
4 files changed, 111 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
index 87d065e65113..620347525272 100644
--- a/arch/arm/mach-tegra/Makefile
+++ b/arch/arm/mach-tegra/Makefile
@@ -5,6 +5,7 @@ obj-y += clock.o
5obj-y += timer.o 5obj-y += timer.o
6obj-y += gpio.o 6obj-y += gpio.o
7obj-y += pinmux.o 7obj-y += pinmux.o
8obj-y += fuse.o
8obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += clock.o 9obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += clock.o
9obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_clocks.o 10obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_clocks.o
10obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += pinmux-t2-tables.o 11obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += pinmux-t2-tables.o
diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c
index 039a514b61ef..9aedaf77013c 100644
--- a/arch/arm/mach-tegra/common.c
+++ b/arch/arm/mach-tegra/common.c
@@ -26,6 +26,7 @@
26 26
27#include "board.h" 27#include "board.h"
28#include "clock.h" 28#include "clock.h"
29#include "fuse.h"
29 30
30static __initdata struct tegra_clk_init_table common_clk_init_table[] = { 31static __initdata struct tegra_clk_init_table common_clk_init_table[] = {
31 /* name parent rate enabled */ 32 /* name parent rate enabled */
@@ -55,6 +56,7 @@ void __init tegra_init_cache(void)
55 56
56void __init tegra_common_init(void) 57void __init tegra_common_init(void)
57{ 58{
59 tegra_init_fuse();
58 tegra_init_clock(); 60 tegra_init_clock();
59 tegra_clk_init_from_table(common_clk_init_table); 61 tegra_clk_init_from_table(common_clk_init_table);
60 tegra_init_cache(); 62 tegra_init_cache();
diff --git a/arch/arm/mach-tegra/fuse.c b/arch/arm/mach-tegra/fuse.c
new file mode 100644
index 000000000000..1fa26d9a1a68
--- /dev/null
+++ b/arch/arm/mach-tegra/fuse.c
@@ -0,0 +1,84 @@
1/*
2 * arch/arm/mach-tegra/fuse.c
3 *
4 * Copyright (C) 2010 Google, Inc.
5 *
6 * Author:
7 * Colin Cross <ccross@android.com>
8 *
9 * This software is licensed under the terms of the GNU General Public
10 * License version 2, as published by the Free Software Foundation, and
11 * may be copied, distributed, and modified under those terms.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 */
19
20#include <linux/kernel.h>
21#include <linux/io.h>
22
23#include <mach/iomap.h>
24
25#include "fuse.h"
26
27#define FUSE_UID_LOW 0x108
28#define FUSE_UID_HIGH 0x10c
29#define FUSE_SKU_INFO 0x110
30#define FUSE_SPARE_BIT 0x200
31
32static inline u32 fuse_readl(unsigned long offset)
33{
34 return readl(IO_TO_VIRT(TEGRA_FUSE_BASE + offset));
35}
36
37static inline void fuse_writel(u32 value, unsigned long offset)
38{
39 writel(value, IO_TO_VIRT(TEGRA_FUSE_BASE + offset));
40}
41
42void tegra_init_fuse(void)
43{
44 u32 reg = readl(IO_TO_VIRT(TEGRA_CLK_RESET_BASE + 0x48));
45 reg |= 1 << 28;
46 writel(reg, IO_TO_VIRT(TEGRA_CLK_RESET_BASE + 0x48));
47
48 pr_info("Tegra SKU: %d CPU Process: %d Core Process: %d\n",
49 tegra_sku_id(), tegra_cpu_process_id(),
50 tegra_core_process_id());
51}
52
53unsigned long long tegra_chip_uid(void)
54{
55 unsigned long long lo, hi;
56
57 lo = fuse_readl(FUSE_UID_LOW);
58 hi = fuse_readl(FUSE_UID_HIGH);
59 return (hi << 32ull) | lo;
60}
61
62int tegra_sku_id(void)
63{
64 int sku_id;
65 u32 reg = fuse_readl(FUSE_SKU_INFO);
66 sku_id = reg & 0xFF;
67 return sku_id;
68}
69
70int tegra_cpu_process_id(void)
71{
72 int cpu_process_id;
73 u32 reg = fuse_readl(FUSE_SPARE_BIT);
74 cpu_process_id = (reg >> 6) & 3;
75 return cpu_process_id;
76}
77
78int tegra_core_process_id(void)
79{
80 int core_process_id;
81 u32 reg = fuse_readl(FUSE_SPARE_BIT);
82 core_process_id = (reg >> 12) & 3;
83 return core_process_id;
84}
diff --git a/arch/arm/mach-tegra/fuse.h b/arch/arm/mach-tegra/fuse.h
new file mode 100644
index 000000000000..584b2e27dbda
--- /dev/null
+++ b/arch/arm/mach-tegra/fuse.h
@@ -0,0 +1,24 @@
1/*
2 * arch/arm/mach-tegra/fuse.c
3 *
4 * Copyright (C) 2010 Google, Inc.
5 *
6 * Author:
7 * Colin Cross <ccross@android.com>
8 *
9 * This software is licensed under the terms of the GNU General Public
10 * License version 2, as published by the Free Software Foundation, and
11 * may be copied, distributed, and modified under those terms.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 */
19
20unsigned long long tegra_chip_uid(void);
21int tegra_sku_id(void);
22int tegra_cpu_process_id(void);
23int tegra_core_process_id(void);
24void tegra_init_fuse(void);