aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-tegra
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-01-23 21:40:49 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-23 21:40:49 -0500
commitdfd10e7ae60c6c1b24b5d601744b4fd1ecab2f31 (patch)
tree59fc5ee5877a4dcb4bd56d2e0d0272089496dba1 /arch/arm/mach-tegra
parentf2c73464d7b399cf4e0c601c1c7d7b079080fa52 (diff)
parent6373bb71875b3f9f73f375952f92e68140b75657 (diff)
Merge tag 'soc-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC platform changes from Olof Johansson: "New core SoC-specific changes. New platforms: * Introduction of a vendor, Hisilicon, and one of their SoCs with some random numerical product name. * Introduction of EFM32, embedded platform from Silicon Labs (ARMv7m, i.e. !MMU). * Marvell Berlin series of SoCs, which include the one in Chromecast. * MOXA platform support, ARM9-based platform used mostly in industrial products * Support for Freescale's i.MX50 SoC. Other work: * Renesas work for new platforms and drivers, and conversion over to more multiplatform-friendly device registration schemes. * SMP support for Allwinner sunxi platforms. * ... plus a bunch of other stuff across various platforms" * tag 'soc-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (201 commits) ARM: tegra: fix tegra_powergate_sequence_power_up() inline ARM: msm_defconfig: Update for multi-platform ARM: msm: Move MSM's DT based hardware to multi-platform support ARM: msm: Only build timer.c if required ARM: msm: Only build clock.c on proc_comm based platforms ARM: ux500: Enable system suspend with WFI support ARM: ux500: turn on PRINTK_TIME in u8500_defconfig ARM: shmobile: r8a7790: Fix I2C controller names ARM: msm: Simplify ARCH_MSM_DT config ARM: msm: Add support for MSM8974 SoC ARM: sunxi: select ARM_PSCI MAINTAINERS: Update Allwinner sunXi maintainer files ARM: sunxi: Select RESET_CONTROLLER ARM: imx: improve the comment of CCM lpm SW workaround ARM: imx: improve status check of clock gate ARM: imx: add necessary interface for pfd ARM: imx_v6_v7_defconfig: Select CONFIG_REGULATOR_PFUZE100 ARM: imx_v6_v7_defconfig: Select MX35 and MX50 device tree support ARM: imx: Add cpu frequency scaling support ARM i.MX35: Add devicetree support. ...
Diffstat (limited to 'arch/arm/mach-tegra')
-rw-r--r--arch/arm/mach-tegra/Kconfig1
-rw-r--r--arch/arm/mach-tegra/fuse.c41
-rw-r--r--arch/arm/mach-tegra/iomap.h14
-rw-r--r--arch/arm/mach-tegra/powergate.c195
-rw-r--r--arch/arm/mach-tegra/tegra.c4
5 files changed, 241 insertions, 14 deletions
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 */
54int tegra_soc_speedo_id; 55int tegra_soc_speedo_id;
55enum tegra_revision tegra_revision; 56enum tegra_revision tegra_revision;
56 57
58static struct clk *fuse_clk;
57static int tegra_fuse_spare_bit; 59static int tegra_fuse_spare_bit;
58static void (*tegra_init_speedo_data)(void); 60static 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
82static 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
91static void tegra_fuse_disable_clk(void)
92{
93 if (IS_ERR(fuse_clk))
94 return;
95 clk_disable_unprepare(fuse_clk);
96}
97
80u32 tegra_fuse_readl(unsigned long offset) 98u32 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
85bool tegra_spare_fuse(int bit) 103bool 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
90static enum tegra_revision tegra_get_revision(u32 id) 116static 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
122u32 tegra_read_chipid(void) 152u32 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/powergate.c b/arch/arm/mach-tegra/powergate.c
index f6f5b54ff95e..3d0c537d9b94 100644
--- a/arch/arm/mach-tegra/powergate.c
+++ b/arch/arm/mach-tegra/powergate.c
@@ -34,6 +34,10 @@
34#include "fuse.h" 34#include "fuse.h"
35#include "iomap.h" 35#include "iomap.h"
36 36
37#define DPD_SAMPLE 0x020
38#define DPD_SAMPLE_ENABLE (1 << 0)
39#define DPD_SAMPLE_DISABLE (0 << 0)
40
37#define PWRGATE_TOGGLE 0x30 41#define PWRGATE_TOGGLE 0x30
38#define PWRGATE_TOGGLE_START (1 << 8) 42#define PWRGATE_TOGGLE_START (1 << 8)
39 43
@@ -41,6 +45,19 @@
41 45
42#define PWRGATE_STATUS 0x38 46#define PWRGATE_STATUS 0x38
43 47
48#define IO_DPD_REQ 0x1b8
49#define IO_DPD_REQ_CODE_IDLE (0 << 30)
50#define IO_DPD_REQ_CODE_OFF (1 << 30)
51#define IO_DPD_REQ_CODE_ON (2 << 30)
52#define IO_DPD_REQ_CODE_MASK (3 << 30)
53
54#define IO_DPD_STATUS 0x1bc
55#define IO_DPD2_REQ 0x1c0
56#define IO_DPD2_STATUS 0x1c4
57#define SEL_DPD_TIM 0x1c8
58
59#define GPU_RG_CNTRL 0x2d4
60
44static int tegra_num_powerdomains; 61static int tegra_num_powerdomains;
45static int tegra_num_cpu_domains; 62static int tegra_num_cpu_domains;
46static const u8 *tegra_cpu_domains; 63static const u8 *tegra_cpu_domains;
@@ -59,6 +76,13 @@ static const u8 tegra114_cpu_domains[] = {
59 TEGRA_POWERGATE_CPU3, 76 TEGRA_POWERGATE_CPU3,
60}; 77};
61 78
79static const u8 tegra124_cpu_domains[] = {
80 TEGRA_POWERGATE_CPU0,
81 TEGRA_POWERGATE_CPU1,
82 TEGRA_POWERGATE_CPU2,
83 TEGRA_POWERGATE_CPU3,
84};
85
62static DEFINE_SPINLOCK(tegra_powergate_lock); 86static DEFINE_SPINLOCK(tegra_powergate_lock);
63 87
64static void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE); 88static void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE);
@@ -109,6 +133,7 @@ int tegra_powergate_power_off(int id)
109 133
110 return tegra_powergate_set(id, false); 134 return tegra_powergate_set(id, false);
111} 135}
136EXPORT_SYMBOL(tegra_powergate_power_off);
112 137
113int tegra_powergate_is_powered(int id) 138int tegra_powergate_is_powered(int id)
114{ 139{
@@ -129,12 +154,23 @@ int tegra_powergate_remove_clamping(int id)
129 return -EINVAL; 154 return -EINVAL;
130 155
131 /* 156 /*
157 * The Tegra124 GPU has a separate register (with different semantics)
158 * to remove clamps.
159 */
160 if (tegra_chip_id == TEGRA124) {
161 if (id == TEGRA_POWERGATE_3D) {
162 pmc_write(0, GPU_RG_CNTRL);
163 return 0;
164 }
165 }
166
167 /*
132 * Tegra 2 has a bug where PCIE and VDE clamping masks are 168 * Tegra 2 has a bug where PCIE and VDE clamping masks are
133 * swapped relatively to the partition ids 169 * swapped relatively to the partition ids
134 */ 170 */
135 if (id == TEGRA_POWERGATE_VDEC) 171 if (id == TEGRA_POWERGATE_VDEC)
136 mask = (1 << TEGRA_POWERGATE_PCIE); 172 mask = (1 << TEGRA_POWERGATE_PCIE);
137 else if (id == TEGRA_POWERGATE_PCIE) 173 else if (id == TEGRA_POWERGATE_PCIE)
138 mask = (1 << TEGRA_POWERGATE_VDEC); 174 mask = (1 << TEGRA_POWERGATE_VDEC);
139 else 175 else
140 mask = (1 << id); 176 mask = (1 << id);
@@ -143,6 +179,7 @@ int tegra_powergate_remove_clamping(int id)
143 179
144 return 0; 180 return 0;
145} 181}
182EXPORT_SYMBOL(tegra_powergate_remove_clamping);
146 183
147/* Must be called with clk disabled, and returns with clk enabled */ 184/* Must be called with clk disabled, and returns with clk enabled */
148int tegra_powergate_sequence_power_up(int id, struct clk *clk, 185int tegra_powergate_sequence_power_up(int id, struct clk *clk,
@@ -204,6 +241,11 @@ int __init tegra_powergate_init(void)
204 tegra_num_cpu_domains = 4; 241 tegra_num_cpu_domains = 4;
205 tegra_cpu_domains = tegra114_cpu_domains; 242 tegra_cpu_domains = tegra114_cpu_domains;
206 break; 243 break;
244 case TEGRA124:
245 tegra_num_powerdomains = 25;
246 tegra_num_cpu_domains = 4;
247 tegra_cpu_domains = tegra124_cpu_domains;
248 break;
207 default: 249 default:
208 /* Unknown Tegra variant. Disable powergating */ 250 /* Unknown Tegra variant. Disable powergating */
209 tegra_num_powerdomains = 0; 251 tegra_num_powerdomains = 0;
@@ -245,12 +287,36 @@ static const char * const powergate_name_t30[] = {
245}; 287};
246 288
247static const char * const powergate_name_t114[] = { 289static const char * const powergate_name_t114[] = {
248 [TEGRA_POWERGATE_CPU] = "cpu0", 290 [TEGRA_POWERGATE_CPU] = "crail",
291 [TEGRA_POWERGATE_3D] = "3d",
292 [TEGRA_POWERGATE_VENC] = "venc",
293 [TEGRA_POWERGATE_VDEC] = "vdec",
294 [TEGRA_POWERGATE_MPE] = "mpe",
295 [TEGRA_POWERGATE_HEG] = "heg",
296 [TEGRA_POWERGATE_CPU1] = "cpu1",
297 [TEGRA_POWERGATE_CPU2] = "cpu2",
298 [TEGRA_POWERGATE_CPU3] = "cpu3",
299 [TEGRA_POWERGATE_CELP] = "celp",
300 [TEGRA_POWERGATE_CPU0] = "cpu0",
301 [TEGRA_POWERGATE_C0NC] = "c0nc",
302 [TEGRA_POWERGATE_C1NC] = "c1nc",
303 [TEGRA_POWERGATE_DIS] = "dis",
304 [TEGRA_POWERGATE_DISB] = "disb",
305 [TEGRA_POWERGATE_XUSBA] = "xusba",
306 [TEGRA_POWERGATE_XUSBB] = "xusbb",
307 [TEGRA_POWERGATE_XUSBC] = "xusbc",
308};
309
310static const char * const powergate_name_t124[] = {
311 [TEGRA_POWERGATE_CPU] = "crail",
249 [TEGRA_POWERGATE_3D] = "3d", 312 [TEGRA_POWERGATE_3D] = "3d",
250 [TEGRA_POWERGATE_VENC] = "venc", 313 [TEGRA_POWERGATE_VENC] = "venc",
314 [TEGRA_POWERGATE_PCIE] = "pcie",
251 [TEGRA_POWERGATE_VDEC] = "vdec", 315 [TEGRA_POWERGATE_VDEC] = "vdec",
316 [TEGRA_POWERGATE_L2] = "l2",
252 [TEGRA_POWERGATE_MPE] = "mpe", 317 [TEGRA_POWERGATE_MPE] = "mpe",
253 [TEGRA_POWERGATE_HEG] = "heg", 318 [TEGRA_POWERGATE_HEG] = "heg",
319 [TEGRA_POWERGATE_SATA] = "sata",
254 [TEGRA_POWERGATE_CPU1] = "cpu1", 320 [TEGRA_POWERGATE_CPU1] = "cpu1",
255 [TEGRA_POWERGATE_CPU2] = "cpu2", 321 [TEGRA_POWERGATE_CPU2] = "cpu2",
256 [TEGRA_POWERGATE_CPU3] = "cpu3", 322 [TEGRA_POWERGATE_CPU3] = "cpu3",
@@ -258,11 +324,14 @@ static const char * const powergate_name_t114[] = {
258 [TEGRA_POWERGATE_CPU0] = "cpu0", 324 [TEGRA_POWERGATE_CPU0] = "cpu0",
259 [TEGRA_POWERGATE_C0NC] = "c0nc", 325 [TEGRA_POWERGATE_C0NC] = "c0nc",
260 [TEGRA_POWERGATE_C1NC] = "c1nc", 326 [TEGRA_POWERGATE_C1NC] = "c1nc",
327 [TEGRA_POWERGATE_SOR] = "sor",
261 [TEGRA_POWERGATE_DIS] = "dis", 328 [TEGRA_POWERGATE_DIS] = "dis",
262 [TEGRA_POWERGATE_DISB] = "disb", 329 [TEGRA_POWERGATE_DISB] = "disb",
263 [TEGRA_POWERGATE_XUSBA] = "xusba", 330 [TEGRA_POWERGATE_XUSBA] = "xusba",
264 [TEGRA_POWERGATE_XUSBB] = "xusbb", 331 [TEGRA_POWERGATE_XUSBB] = "xusbb",
265 [TEGRA_POWERGATE_XUSBC] = "xusbc", 332 [TEGRA_POWERGATE_XUSBC] = "xusbc",
333 [TEGRA_POWERGATE_VIC] = "vic",
334 [TEGRA_POWERGATE_IRAM] = "iram",
266}; 335};
267 336
268static int powergate_show(struct seq_file *s, void *data) 337static int powergate_show(struct seq_file *s, void *data)
@@ -309,6 +378,9 @@ int __init tegra_powergate_debugfs_init(void)
309 case TEGRA114: 378 case TEGRA114:
310 powergate_name = powergate_name_t114; 379 powergate_name = powergate_name_t114;
311 break; 380 break;
381 case TEGRA124:
382 powergate_name = powergate_name_t124;
383 break;
312 } 384 }
313 385
314 if (powergate_name) { 386 if (powergate_name) {
@@ -322,3 +394,120 @@ int __init tegra_powergate_debugfs_init(void)
322} 394}
323 395
324#endif 396#endif
397
398static int tegra_io_rail_prepare(int id, unsigned long *request,
399 unsigned long *status, unsigned int *bit)
400{
401 unsigned long rate, value;
402 struct clk *clk;
403
404 *bit = id % 32;
405
406 /*
407 * There are two sets of 30 bits to select IO rails, but bits 30 and
408 * 31 are control bits rather than IO rail selection bits.
409 */
410 if (id > 63 || *bit == 30 || *bit == 31)
411 return -EINVAL;
412
413 if (id < 32) {
414 *status = IO_DPD_STATUS;
415 *request = IO_DPD_REQ;
416 } else {
417 *status = IO_DPD2_STATUS;
418 *request = IO_DPD2_REQ;
419 }
420
421 clk = clk_get_sys(NULL, "pclk");
422 if (IS_ERR(clk))
423 return PTR_ERR(clk);
424
425 rate = clk_get_rate(clk);
426 clk_put(clk);
427
428 pmc_write(DPD_SAMPLE_ENABLE, DPD_SAMPLE);
429
430 /* must be at least 200 ns, in APB (PCLK) clock cycles */
431 value = DIV_ROUND_UP(1000000000, rate);
432 value = DIV_ROUND_UP(200, value);
433 pmc_write(value, SEL_DPD_TIM);
434
435 return 0;
436}
437
438static int tegra_io_rail_poll(unsigned long offset, unsigned long mask,
439 unsigned long val, unsigned long timeout)
440{
441 unsigned long value;
442
443 timeout = jiffies + msecs_to_jiffies(timeout);
444
445 while (time_after(timeout, jiffies)) {
446 value = pmc_read(offset);
447 if ((value & mask) == val)
448 return 0;
449
450 usleep_range(250, 1000);
451 }
452
453 return -ETIMEDOUT;
454}
455
456static void tegra_io_rail_unprepare(void)
457{
458 pmc_write(DPD_SAMPLE_DISABLE, DPD_SAMPLE);
459}
460
461int tegra_io_rail_power_on(int id)
462{
463 unsigned long request, status, value;
464 unsigned int bit, mask;
465 int err;
466
467 err = tegra_io_rail_prepare(id, &request, &status, &bit);
468 if (err < 0)
469 return err;
470
471 mask = 1 << bit;
472
473 value = pmc_read(request);
474 value |= mask;
475 value &= ~IO_DPD_REQ_CODE_MASK;
476 value |= IO_DPD_REQ_CODE_OFF;
477 pmc_write(value, request);
478
479 err = tegra_io_rail_poll(status, mask, 0, 250);
480 if (err < 0)
481 return err;
482
483 tegra_io_rail_unprepare();
484
485 return 0;
486}
487
488int tegra_io_rail_power_off(int id)
489{
490 unsigned long request, status, value;
491 unsigned int bit, mask;
492 int err;
493
494 err = tegra_io_rail_prepare(id, &request, &status, &bit);
495 if (err < 0)
496 return err;
497
498 mask = 1 << bit;
499
500 value = pmc_read(request);
501 value |= mask;
502 value &= ~IO_DPD_REQ_CODE_MASK;
503 value |= IO_DPD_REQ_CODE_ON;
504 pmc_write(value, request);
505
506 err = tegra_io_rail_poll(status, mask, mask, 250);
507 if (err < 0)
508 return err;
509
510 tegra_io_rail_unprepare();
511
512 return 0;
513}
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 */
63u32 tegra_uart_config[4] = { 63u32 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
74static void __init tegra_init_cache(void) 72static void __init tegra_init_cache(void)