blob: 53317de1ef28cde6bc65f715397a2dd82d7a3bec [file] [log] [blame]
Varun Wadekar08438e22015-05-19 16:48:04 +05301/*
Varun Wadekara7a63e02018-02-13 20:22:19 -08002 * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
Varun Wadekar08438e22015-05-19 16:48:04 +05303 *
dp-arm82cb2c12017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Varun Wadekar08438e22015-05-19 16:48:04 +05305 */
6
Antonio Nino Diazc3cf06f2018-11-08 10:20:19 +00007#ifndef PMC_H
8#define PMC_H
Varun Wadekar08438e22015-05-19 16:48:04 +05309
Antonio Nino Diaz09d40e02018-12-14 00:18:21 +000010#include <lib/mmio.h>
11#include <lib/utils_def.h>
Varun Wadekara7a63e02018-02-13 20:22:19 -080012#include <stdbool.h>
Antonio Nino Diaz09d40e02018-12-14 00:18:21 +000013
Varun Wadekar08438e22015-05-19 16:48:04 +053014#include <tegra_def.h>
15
Anthony Zhou31d97dc2017-03-13 16:47:58 +080016#define PMC_CONFIG U(0x0)
17#define PMC_PWRGATE_STATUS U(0x38)
18#define PMC_PWRGATE_TOGGLE U(0x30)
19#define PMC_TOGGLE_START U(0x100)
20#define PMC_SCRATCH39 U(0x138)
21#define PMC_SECURE_DISABLE2 U(0x2c4)
22#define PMC_SECURE_DISABLE2_WRITE22_ON (U(1) << 28)
23#define PMC_SECURE_SCRATCH22 U(0x338)
24#define PMC_SECURE_DISABLE3 U(0x2d8)
25#define PMC_SECURE_DISABLE3_WRITE34_ON (U(1) << 20)
26#define PMC_SECURE_DISABLE3_WRITE35_ON (U(1) << 22)
27#define PMC_SECURE_SCRATCH34 U(0x368)
28#define PMC_SECURE_SCRATCH35 U(0x36c)
Varun Wadekar3ca3c272018-02-27 14:33:57 -080029#define PMC_SCRATCH201 U(0x844)
Varun Wadekar08438e22015-05-19 16:48:04 +053030
31static inline uint32_t tegra_pmc_read_32(uint32_t off)
32{
33 return mmio_read_32(TEGRA_PMC_BASE + off);
34}
35
36static inline void tegra_pmc_write_32(uint32_t off, uint32_t val)
37{
38 mmio_write_32(TEGRA_PMC_BASE + off, val);
39}
40
Anthony Zhou31d97dc2017-03-13 16:47:58 +080041void tegra_pmc_cpu_on(int32_t cpu);
Varun Wadekara7a63e02018-02-13 20:22:19 -080042void tegra_pmc_cpu_setup(uint64_t reset_addr);
43bool tegra_pmc_is_last_on_cpu(void);
44void tegra_pmc_lock_cpu_vectors(void);
Varun Wadekar08438e22015-05-19 16:48:04 +053045__dead2 void tegra_pmc_system_reset(void);
46
Antonio Nino Diazc3cf06f2018-11-08 10:20:19 +000047#endif /* PMC_H */