Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 1 | /* |
Varun Wadekar | 952a555 | 2018-02-13 20:22:19 -0800 | [diff] [blame] | 2 | * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved. |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 5 | */ |
| 6 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 7 | #ifndef PMC_H |
| 8 | #define PMC_H |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 9 | |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 10 | #include <lib/mmio.h> |
| 11 | #include <lib/utils_def.h> |
Varun Wadekar | 952a555 | 2018-02-13 20:22:19 -0800 | [diff] [blame] | 12 | #include <stdbool.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 13 | |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 14 | #include <tegra_def.h> |
| 15 | |
Anthony Zhou | c33c1e3 | 2017-03-13 16:47:58 +0800 | [diff] [blame] | 16 | #define PMC_CONFIG U(0x0) |
kalyani chidambaram | b3873aa | 2018-04-09 14:40:02 -0700 | [diff] [blame] | 17 | #define PMC_IO_DPD_SAMPLE U(0x20) |
kalyani chidambaram | a1ad9b7 | 2018-03-06 16:36:57 -0800 | [diff] [blame] | 18 | #define PMC_DPD_ENABLE_0 U(0x24) |
Anthony Zhou | c33c1e3 | 2017-03-13 16:47:58 +0800 | [diff] [blame] | 19 | #define PMC_PWRGATE_STATUS U(0x38) |
| 20 | #define PMC_PWRGATE_TOGGLE U(0x30) |
kalyani chidambaram | a1ad9b7 | 2018-03-06 16:36:57 -0800 | [diff] [blame] | 21 | #define PMC_SECURE_SCRATCH0 U(0xb0) |
| 22 | #define PMC_SECURE_SCRATCH5 U(0xc4) |
| 23 | #define PMC_CRYPTO_OP_0 U(0xf4) |
Anthony Zhou | c33c1e3 | 2017-03-13 16:47:58 +0800 | [diff] [blame] | 24 | #define PMC_TOGGLE_START U(0x100) |
| 25 | #define PMC_SCRATCH39 U(0x138) |
kalyani chidambaram | b3873aa | 2018-04-09 14:40:02 -0700 | [diff] [blame] | 26 | #define PMC_SCRATCH41 U(0x140) |
kalyani chidambaram | a1ad9b7 | 2018-03-06 16:36:57 -0800 | [diff] [blame] | 27 | #define PMC_SECURE_SCRATCH6 U(0x224) |
| 28 | #define PMC_SECURE_SCRATCH7 U(0x228) |
Anthony Zhou | c33c1e3 | 2017-03-13 16:47:58 +0800 | [diff] [blame] | 29 | #define PMC_SECURE_DISABLE2 U(0x2c4) |
| 30 | #define PMC_SECURE_DISABLE2_WRITE22_ON (U(1) << 28) |
kalyani chidambaram | a1ad9b7 | 2018-03-06 16:36:57 -0800 | [diff] [blame] | 31 | #define PMC_SECURE_SCRATCH8 U(0x300) |
| 32 | #define PMC_SECURE_SCRATCH79 U(0x41c) |
| 33 | #define PMC_FUSE_CONTROL_0 U(0x450) |
Anthony Zhou | c33c1e3 | 2017-03-13 16:47:58 +0800 | [diff] [blame] | 34 | #define PMC_SECURE_SCRATCH22 U(0x338) |
| 35 | #define PMC_SECURE_DISABLE3 U(0x2d8) |
| 36 | #define PMC_SECURE_DISABLE3_WRITE34_ON (U(1) << 20) |
| 37 | #define PMC_SECURE_DISABLE3_WRITE35_ON (U(1) << 22) |
| 38 | #define PMC_SECURE_SCRATCH34 U(0x368) |
| 39 | #define PMC_SECURE_SCRATCH35 U(0x36c) |
kalyani chidambaram | a1ad9b7 | 2018-03-06 16:36:57 -0800 | [diff] [blame] | 40 | #define PMC_SECURE_SCRATCH80 U(0xa98) |
| 41 | #define PMC_SECURE_SCRATCH119 U(0xb34) |
Varun Wadekar | f07d6de | 2018-02-27 14:33:57 -0800 | [diff] [blame] | 42 | #define PMC_SCRATCH201 U(0x844) |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 43 | |
| 44 | static inline uint32_t tegra_pmc_read_32(uint32_t off) |
| 45 | { |
| 46 | return mmio_read_32(TEGRA_PMC_BASE + off); |
| 47 | } |
| 48 | |
| 49 | static inline void tegra_pmc_write_32(uint32_t off, uint32_t val) |
| 50 | { |
| 51 | mmio_write_32(TEGRA_PMC_BASE + off, val); |
| 52 | } |
| 53 | |
Varun Wadekar | 952a555 | 2018-02-13 20:22:19 -0800 | [diff] [blame] | 54 | void tegra_pmc_cpu_on(int32_t cpu); |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 55 | void tegra_pmc_cpu_setup(uint64_t reset_addr); |
Varun Wadekar | 952a555 | 2018-02-13 20:22:19 -0800 | [diff] [blame] | 56 | bool tegra_pmc_is_last_on_cpu(void); |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 57 | void tegra_pmc_lock_cpu_vectors(void); |
kalyani chidambaram | b3873aa | 2018-04-09 14:40:02 -0700 | [diff] [blame] | 58 | void tegra_pmc_resume(void); |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 59 | __dead2 void tegra_pmc_system_reset(void); |
| 60 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 61 | #endif /* PMC_H */ |