blob: c376440f38784a3f5612a54d8e389be0f3459154 [file] [log] [blame]
Varun Wadekarb316e242015-05-19 16:48:04 +05301/*
Varun Wadekar952a5552018-02-13 20:22:19 -08002 * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
Varun Wadekarb316e242015-05-19 16:48:04 +05303 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Varun Wadekarb316e242015-05-19 16:48:04 +05305 */
6
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +00007#ifndef PMC_H
8#define PMC_H
Varun Wadekarb316e242015-05-19 16:48:04 +05309
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000010#include <lib/mmio.h>
11#include <lib/utils_def.h>
Varun Wadekar952a5552018-02-13 20:22:19 -080012#include <stdbool.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000013
Varun Wadekarb316e242015-05-19 16:48:04 +053014#include <tegra_def.h>
15
Anthony Zhouc33c1e32017-03-13 16:47:58 +080016#define PMC_CONFIG U(0x0)
kalyani chidambarama1ad9b72018-03-06 16:36:57 -080017#define PMC_DPD_ENABLE_0 U(0x24)
Anthony Zhouc33c1e32017-03-13 16:47:58 +080018#define PMC_PWRGATE_STATUS U(0x38)
19#define PMC_PWRGATE_TOGGLE U(0x30)
kalyani chidambarama1ad9b72018-03-06 16:36:57 -080020#define PMC_SECURE_SCRATCH0 U(0xb0)
21#define PMC_SECURE_SCRATCH5 U(0xc4)
22#define PMC_CRYPTO_OP_0 U(0xf4)
Anthony Zhouc33c1e32017-03-13 16:47:58 +080023#define PMC_TOGGLE_START U(0x100)
24#define PMC_SCRATCH39 U(0x138)
kalyani chidambarama1ad9b72018-03-06 16:36:57 -080025#define PMC_SECURE_SCRATCH6 U(0x224)
26#define PMC_SECURE_SCRATCH7 U(0x228)
Anthony Zhouc33c1e32017-03-13 16:47:58 +080027#define PMC_SECURE_DISABLE2 U(0x2c4)
28#define PMC_SECURE_DISABLE2_WRITE22_ON (U(1) << 28)
kalyani chidambarama1ad9b72018-03-06 16:36:57 -080029#define PMC_SECURE_SCRATCH8 U(0x300)
30#define PMC_SECURE_SCRATCH79 U(0x41c)
31#define PMC_FUSE_CONTROL_0 U(0x450)
Anthony Zhouc33c1e32017-03-13 16:47:58 +080032#define PMC_SECURE_SCRATCH22 U(0x338)
33#define PMC_SECURE_DISABLE3 U(0x2d8)
34#define PMC_SECURE_DISABLE3_WRITE34_ON (U(1) << 20)
35#define PMC_SECURE_DISABLE3_WRITE35_ON (U(1) << 22)
36#define PMC_SECURE_SCRATCH34 U(0x368)
37#define PMC_SECURE_SCRATCH35 U(0x36c)
kalyani chidambarama1ad9b72018-03-06 16:36:57 -080038#define PMC_SECURE_SCRATCH80 U(0xa98)
39#define PMC_SECURE_SCRATCH119 U(0xb34)
Varun Wadekarf07d6de2018-02-27 14:33:57 -080040#define PMC_SCRATCH201 U(0x844)
Varun Wadekarb316e242015-05-19 16:48:04 +053041
42static inline uint32_t tegra_pmc_read_32(uint32_t off)
43{
44 return mmio_read_32(TEGRA_PMC_BASE + off);
45}
46
47static inline void tegra_pmc_write_32(uint32_t off, uint32_t val)
48{
49 mmio_write_32(TEGRA_PMC_BASE + off, val);
50}
51
Varun Wadekar952a5552018-02-13 20:22:19 -080052void tegra_pmc_cpu_on(int32_t cpu);
Varun Wadekarb316e242015-05-19 16:48:04 +053053void tegra_pmc_cpu_setup(uint64_t reset_addr);
Varun Wadekar952a5552018-02-13 20:22:19 -080054bool tegra_pmc_is_last_on_cpu(void);
Varun Wadekarb316e242015-05-19 16:48:04 +053055void tegra_pmc_lock_cpu_vectors(void);
Varun Wadekarb316e242015-05-19 16:48:04 +053056__dead2 void tegra_pmc_system_reset(void);
57
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +000058#endif /* PMC_H */