diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/include/debug/tegra.S | 34 | ||||
-rw-r--r-- | arch/arm/mach-tegra/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/mach-tegra/fuse.c | 41 | ||||
-rw-r--r-- | arch/arm/mach-tegra/iomap.h | 14 | ||||
-rw-r--r-- | arch/arm/mach-tegra/tegra.c | 4 |
5 files changed, 54 insertions, 40 deletions
diff --git a/arch/arm/include/debug/tegra.S b/arch/arm/include/debug/tegra.S index be6a720dd183..f98763f0bc17 100644 --- a/arch/arm/include/debug/tegra.S +++ b/arch/arm/include/debug/tegra.S | |||
@@ -46,10 +46,10 @@ | |||
46 | #define TEGRA_APB_MISC_GP_HIDREV (TEGRA_APB_MISC_BASE + 0x804) | 46 | #define TEGRA_APB_MISC_GP_HIDREV (TEGRA_APB_MISC_BASE + 0x804) |
47 | 47 | ||
48 | /* | 48 | /* |
49 | * Must be 1MB-aligned since a 1MB mapping is used early on. | 49 | * Must be section-aligned since a section mapping is used early on. |
50 | * Must not overlap with regions in mach-tegra/io.c:tegra_io_desc[]. | 50 | * Must not overlap with regions in mach-tegra/io.c:tegra_io_desc[]. |
51 | */ | 51 | */ |
52 | #define UART_VIRTUAL_BASE 0xfe100000 | 52 | #define UART_VIRTUAL_BASE 0xfe800000 |
53 | 53 | ||
54 | #define checkuart(rp, rv, lhu, bit, uart) \ | 54 | #define checkuart(rp, rv, lhu, bit, uart) \ |
55 | /* Load address of CLK_RST register */ \ | 55 | /* Load address of CLK_RST register */ \ |
@@ -156,28 +156,6 @@ | |||
156 | 92: and \rv, \rp, #0xffffff @ offset within 1MB section | 156 | 92: and \rv, \rp, #0xffffff @ offset within 1MB section |
157 | add \rv, \rv, #UART_VIRTUAL_BASE | 157 | add \rv, \rv, #UART_VIRTUAL_BASE |
158 | str \rv, [\tmp, #8] @ Store in tegra_uart_virt | 158 | str \rv, [\tmp, #8] @ Store in tegra_uart_virt |
159 | movw \rv, #TEGRA_APB_MISC_GP_HIDREV & 0xffff | ||
160 | movt \rv, #TEGRA_APB_MISC_GP_HIDREV >> 16 | ||
161 | ldr \rv, [\rv, #0] @ Load HIDREV | ||
162 | ubfx \rv, \rv, #8, #8 @ 15:8 are SoC version | ||
163 | cmp \rv, #0x20 @ Tegra20? | ||
164 | moveq \rv, #0x75 @ Tegra20 divisor | ||
165 | movne \rv, #0xdd @ Tegra30 divisor | ||
166 | str \rv, [\tmp, #12] @ Save divisor to scratch | ||
167 | /* uart[UART_LCR] = UART_LCR_WLEN8 | UART_LCR_DLAB; */ | ||
168 | mov \rv, #UART_LCR_WLEN8 | UART_LCR_DLAB | ||
169 | str \rv, [\rp, #UART_LCR << UART_SHIFT] | ||
170 | /* uart[UART_DLL] = div & 0xff; */ | ||
171 | ldr \rv, [\tmp, #12] | ||
172 | and \rv, \rv, #0xff | ||
173 | str \rv, [\rp, #UART_DLL << UART_SHIFT] | ||
174 | /* uart[UART_DLM] = div >> 8; */ | ||
175 | ldr \rv, [\tmp, #12] | ||
176 | lsr \rv, \rv, #8 | ||
177 | str \rv, [\rp, #UART_DLM << UART_SHIFT] | ||
178 | /* uart[UART_LCR] = UART_LCR_WLEN8; */ | ||
179 | mov \rv, #UART_LCR_WLEN8 | ||
180 | str \rv, [\rp, #UART_LCR << UART_SHIFT] | ||
181 | b 100f | 159 | b 100f |
182 | 160 | ||
183 | .align | 161 | .align |
@@ -205,8 +183,8 @@ | |||
205 | cmp \rx, #0 | 183 | cmp \rx, #0 |
206 | beq 1002f | 184 | beq 1002f |
207 | 1001: ldrb \rd, [\rx, #UART_LSR << UART_SHIFT] | 185 | 1001: ldrb \rd, [\rx, #UART_LSR << UART_SHIFT] |
208 | and \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE | 186 | and \rd, \rd, #UART_LSR_THRE |
209 | teq \rd, #UART_LSR_TEMT | UART_LSR_THRE | 187 | teq \rd, #UART_LSR_THRE |
210 | bne 1001b | 188 | bne 1001b |
211 | 1002: | 189 | 1002: |
212 | .endm | 190 | .endm |
@@ -225,7 +203,7 @@ | |||
225 | /* | 203 | /* |
226 | * Storage for the state maintained by the macros above. | 204 | * Storage for the state maintained by the macros above. |
227 | * | 205 | * |
228 | * In the kernel proper, this data is located in arch/arm/mach-tegra/common.c. | 206 | * In the kernel proper, this data is located in arch/arm/mach-tegra/tegra.c. |
229 | * That's because this header is included from multiple files, and we only | 207 | * That's because this header is included from multiple files, and we only |
230 | * want a single copy of the data. In particular, the UART probing code above | 208 | * want a single copy of the data. In particular, the UART probing code above |
231 | * assumes it's running using physical addresses. This is true when this file | 209 | * assumes it's running using physical addresses. This is true when this file |
@@ -247,6 +225,4 @@ tegra_uart_config: | |||
247 | .word 0 | 225 | .word 0 |
248 | /* Debug UART virtual address */ | 226 | /* Debug UART virtual address */ |
249 | .word 0 | 227 | .word 0 |
250 | /* Scratch space for debug macro */ | ||
251 | .word 0 | ||
252 | #endif | 228 | #endif |
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig index 15c09294effa..d1a12a496525 100644 --- a/arch/arm/mach-tegra/Kconfig +++ b/arch/arm/mach-tegra/Kconfig | |||
@@ -65,6 +65,7 @@ config ARCH_TEGRA_124_SOC | |||
65 | bool "Enable support for Tegra124 family" | 65 | bool "Enable support for Tegra124 family" |
66 | select ARM_L1_CACHE_SHIFT_6 | 66 | select ARM_L1_CACHE_SHIFT_6 |
67 | select HAVE_ARM_ARCH_TIMER | 67 | select HAVE_ARM_ARCH_TIMER |
68 | select PINCTRL_TEGRA124 | ||
68 | help | 69 | help |
69 | Support for NVIDIA Tegra T124 processor family, based on the | 70 | Support for NVIDIA Tegra T124 processor family, based on the |
70 | ARM CortexA15MP CPU | 71 | ARM CortexA15MP CPU |
diff --git a/arch/arm/mach-tegra/fuse.c b/arch/arm/mach-tegra/fuse.c index 3a9c1f1c219d..c9ac23b385be 100644 --- a/arch/arm/mach-tegra/fuse.c +++ b/arch/arm/mach-tegra/fuse.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/io.h> | 22 | #include <linux/io.h> |
23 | #include <linux/export.h> | 23 | #include <linux/export.h> |
24 | #include <linux/random.h> | 24 | #include <linux/random.h> |
25 | #include <linux/clk.h> | ||
25 | #include <linux/tegra-soc.h> | 26 | #include <linux/tegra-soc.h> |
26 | 27 | ||
27 | #include "fuse.h" | 28 | #include "fuse.h" |
@@ -54,6 +55,7 @@ int tegra_cpu_speedo_id; /* only exist in Tegra30 and later */ | |||
54 | int tegra_soc_speedo_id; | 55 | int tegra_soc_speedo_id; |
55 | enum tegra_revision tegra_revision; | 56 | enum tegra_revision tegra_revision; |
56 | 57 | ||
58 | static struct clk *fuse_clk; | ||
57 | static int tegra_fuse_spare_bit; | 59 | static int tegra_fuse_spare_bit; |
58 | static void (*tegra_init_speedo_data)(void); | 60 | static void (*tegra_init_speedo_data)(void); |
59 | 61 | ||
@@ -77,6 +79,22 @@ static const char *tegra_revision_name[TEGRA_REVISION_MAX] = { | |||
77 | [TEGRA_REVISION_A04] = "A04", | 79 | [TEGRA_REVISION_A04] = "A04", |
78 | }; | 80 | }; |
79 | 81 | ||
82 | static void tegra_fuse_enable_clk(void) | ||
83 | { | ||
84 | if (IS_ERR(fuse_clk)) | ||
85 | fuse_clk = clk_get_sys(NULL, "fuse"); | ||
86 | if (IS_ERR(fuse_clk)) | ||
87 | return; | ||
88 | clk_prepare_enable(fuse_clk); | ||
89 | } | ||
90 | |||
91 | static void tegra_fuse_disable_clk(void) | ||
92 | { | ||
93 | if (IS_ERR(fuse_clk)) | ||
94 | return; | ||
95 | clk_disable_unprepare(fuse_clk); | ||
96 | } | ||
97 | |||
80 | u32 tegra_fuse_readl(unsigned long offset) | 98 | u32 tegra_fuse_readl(unsigned long offset) |
81 | { | 99 | { |
82 | return tegra_apb_readl(TEGRA_FUSE_BASE + offset); | 100 | return tegra_apb_readl(TEGRA_FUSE_BASE + offset); |
@@ -84,7 +102,15 @@ u32 tegra_fuse_readl(unsigned long offset) | |||
84 | 102 | ||
85 | bool tegra_spare_fuse(int bit) | 103 | bool tegra_spare_fuse(int bit) |
86 | { | 104 | { |
87 | return tegra_fuse_readl(tegra_fuse_spare_bit + bit * 4); | 105 | bool ret; |
106 | |||
107 | tegra_fuse_enable_clk(); | ||
108 | |||
109 | ret = tegra_fuse_readl(tegra_fuse_spare_bit + bit * 4); | ||
110 | |||
111 | tegra_fuse_disable_clk(); | ||
112 | |||
113 | return ret; | ||
88 | } | 114 | } |
89 | 115 | ||
90 | static enum tegra_revision tegra_get_revision(u32 id) | 116 | static enum tegra_revision tegra_get_revision(u32 id) |
@@ -113,10 +139,14 @@ static void tegra_get_process_id(void) | |||
113 | { | 139 | { |
114 | u32 reg; | 140 | u32 reg; |
115 | 141 | ||
142 | tegra_fuse_enable_clk(); | ||
143 | |||
116 | reg = tegra_fuse_readl(tegra_fuse_spare_bit); | 144 | reg = tegra_fuse_readl(tegra_fuse_spare_bit); |
117 | tegra_cpu_process_id = (reg >> 6) & 3; | 145 | tegra_cpu_process_id = (reg >> 6) & 3; |
118 | reg = tegra_fuse_readl(tegra_fuse_spare_bit); | 146 | reg = tegra_fuse_readl(tegra_fuse_spare_bit); |
119 | tegra_core_process_id = (reg >> 12) & 3; | 147 | tegra_core_process_id = (reg >> 12) & 3; |
148 | |||
149 | tegra_fuse_disable_clk(); | ||
120 | } | 150 | } |
121 | 151 | ||
122 | u32 tegra_read_chipid(void) | 152 | u32 tegra_read_chipid(void) |
@@ -159,6 +189,15 @@ void __init tegra_init_fuse(void) | |||
159 | reg |= 1 << 28; | 189 | reg |= 1 << 28; |
160 | writel(reg, IO_ADDRESS(TEGRA_CLK_RESET_BASE + 0x48)); | 190 | writel(reg, IO_ADDRESS(TEGRA_CLK_RESET_BASE + 0x48)); |
161 | 191 | ||
192 | /* | ||
193 | * Enable FUSE clock. This needs to be hardcoded because the clock | ||
194 | * subsystem is not active during early boot. | ||
195 | */ | ||
196 | reg = readl(IO_ADDRESS(TEGRA_CLK_RESET_BASE + 0x14)); | ||
197 | reg |= 1 << 7; | ||
198 | writel(reg, IO_ADDRESS(TEGRA_CLK_RESET_BASE + 0x14)); | ||
199 | fuse_clk = ERR_PTR(-EINVAL); | ||
200 | |||
162 | reg = tegra_fuse_readl(FUSE_SKU_INFO); | 201 | reg = tegra_fuse_readl(FUSE_SKU_INFO); |
163 | randomness[0] = reg; | 202 | randomness[0] = reg; |
164 | tegra_sku_id = reg & 0xFF; | 203 | tegra_sku_id = reg & 0xFF; |
diff --git a/arch/arm/mach-tegra/iomap.h b/arch/arm/mach-tegra/iomap.h index 26b1c2ad0ceb..ee79808e93a3 100644 --- a/arch/arm/mach-tegra/iomap.h +++ b/arch/arm/mach-tegra/iomap.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #ifndef __MACH_TEGRA_IOMAP_H | 19 | #ifndef __MACH_TEGRA_IOMAP_H |
20 | #define __MACH_TEGRA_IOMAP_H | 20 | #define __MACH_TEGRA_IOMAP_H |
21 | 21 | ||
22 | #include <asm/pgtable.h> | ||
22 | #include <asm/sizes.h> | 23 | #include <asm/sizes.h> |
23 | 24 | ||
24 | #define TEGRA_IRAM_BASE 0x40000000 | 25 | #define TEGRA_IRAM_BASE 0x40000000 |
@@ -115,27 +116,26 @@ | |||
115 | * two 256MB io windows (that actually only use about 64KB | 116 | * two 256MB io windows (that actually only use about 64KB |
116 | * at the start of each). | 117 | * at the start of each). |
117 | * | 118 | * |
118 | * We will just map the first 1MB of each window (to minimize | 119 | * We will just map the first MMU section of each window (to minimize |
119 | * pt entries needed) and provide a macro to transform physical | 120 | * pt entries needed) and provide a macro to transform physical |
120 | * io addresses to an appropriate void __iomem *. | 121 | * io addresses to an appropriate void __iomem *. |
121 | * | ||
122 | */ | 122 | */ |
123 | 123 | ||
124 | #define IO_IRAM_PHYS 0x40000000 | 124 | #define IO_IRAM_PHYS 0x40000000 |
125 | #define IO_IRAM_VIRT IOMEM(0xFE400000) | 125 | #define IO_IRAM_VIRT IOMEM(0xFE400000) |
126 | #define IO_IRAM_SIZE SZ_256K | 126 | #define IO_IRAM_SIZE SZ_256K |
127 | 127 | ||
128 | #define IO_CPU_PHYS 0x50040000 | 128 | #define IO_CPU_PHYS 0x50040000 |
129 | #define IO_CPU_VIRT IOMEM(0xFE000000) | 129 | #define IO_CPU_VIRT IOMEM(0xFE440000) |
130 | #define IO_CPU_SIZE SZ_16K | 130 | #define IO_CPU_SIZE SZ_16K |
131 | 131 | ||
132 | #define IO_PPSB_PHYS 0x60000000 | 132 | #define IO_PPSB_PHYS 0x60000000 |
133 | #define IO_PPSB_VIRT IOMEM(0xFE200000) | 133 | #define IO_PPSB_VIRT IOMEM(0xFE200000) |
134 | #define IO_PPSB_SIZE SZ_1M | 134 | #define IO_PPSB_SIZE SECTION_SIZE |
135 | 135 | ||
136 | #define IO_APB_PHYS 0x70000000 | 136 | #define IO_APB_PHYS 0x70000000 |
137 | #define IO_APB_VIRT IOMEM(0xFE300000) | 137 | #define IO_APB_VIRT IOMEM(0xFE000000) |
138 | #define IO_APB_SIZE SZ_1M | 138 | #define IO_APB_SIZE SECTION_SIZE |
139 | 139 | ||
140 | #define IO_TO_VIRT_BETWEEN(p, st, sz) ((p) >= (st) && (p) < ((st) + (sz))) | 140 | #define IO_TO_VIRT_BETWEEN(p, st, sz) ((p) >= (st) && (p) < ((st) + (sz))) |
141 | #define IO_TO_VIRT_XLATE(p, pst, vst) (((p) - (pst) + (vst))) | 141 | #define IO_TO_VIRT_XLATE(p, pst, vst) (((p) - (pst) + (vst))) |
diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c index 73368176c6e8..ea14d380fc0c 100644 --- a/arch/arm/mach-tegra/tegra.c +++ b/arch/arm/mach-tegra/tegra.c | |||
@@ -60,15 +60,13 @@ | |||
60 | * kernel is loaded. The data is declared here rather than debug-macro.S so | 60 | * kernel is loaded. The data is declared here rather than debug-macro.S so |
61 | * that multiple inclusions of debug-macro.S point at the same data. | 61 | * that multiple inclusions of debug-macro.S point at the same data. |
62 | */ | 62 | */ |
63 | u32 tegra_uart_config[4] = { | 63 | u32 tegra_uart_config[3] = { |
64 | /* Debug UART initialization required */ | 64 | /* Debug UART initialization required */ |
65 | 1, | 65 | 1, |
66 | /* Debug UART physical address */ | 66 | /* Debug UART physical address */ |
67 | 0, | 67 | 0, |
68 | /* Debug UART virtual address */ | 68 | /* Debug UART virtual address */ |
69 | 0, | 69 | 0, |
70 | /* Scratch space for debug macro */ | ||
71 | 0, | ||
72 | }; | 70 | }; |
73 | 71 | ||
74 | static void __init tegra_init_cache(void) | 72 | static void __init tegra_init_cache(void) |