Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
CTCaer
GitHub Repository: CTCaer/hekate
Path: blob/master/bdk/mem/minerva.h
1476 views
1
/*
2
* Copyright (c) 2019-2022 CTCaer
3
*
4
* This program is free software; you can redistribute it and/or modify it
5
* under the terms and conditions of the GNU General Public License,
6
* version 2, as published by the Free Software Foundation.
7
*
8
* This program is distributed in the hope it will be useful, but WITHOUT
9
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11
* more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15
*/
16
17
#ifndef _FE_MINERVA_H_
18
#define _FE_MINERVA_H_
19
20
#include "mtc_table.h"
21
#include <utils/types.h>
22
23
#define MTC_INIT_MAGIC 0x3043544D
24
#define MTC_NEW_MAGIC 0x5243544D
25
26
#define EMC_PERIODIC_TRAIN_MS 250
27
28
typedef struct
29
{
30
u32 rate_to;
31
u32 rate_from;
32
emc_table_t *mtc_table;
33
u32 table_entries;
34
emc_table_t *current_emc_table;
35
u32 train_mode;
36
u32 sdram_id;
37
u32 prev_temp;
38
bool emc_2X_clk_src_is_pllmb;
39
bool fsp_for_src_freq;
40
bool train_ram_patterns;
41
u32 init_done;
42
} mtc_config_t;
43
44
enum train_mode_t
45
{
46
OP_SWITCH = 0,
47
OP_TRAIN = 1,
48
OP_TRAIN_SWITCH = 2,
49
OP_PERIODIC_TRAIN = 3,
50
OP_TEMP_COMP = 4
51
};
52
53
typedef enum
54
{
55
FREQ_204 = 204000,
56
FREQ_408 = 408000,
57
FREQ_800 = 800000,
58
FREQ_1333 = 1331200,
59
FREQ_1600 = 1600000
60
} minerva_freq_t;
61
62
extern void (*minerva_cfg)(mtc_config_t *mtc_cfg, void *);
63
u32 minerva_init();
64
void minerva_change_freq(minerva_freq_t freq);
65
void minerva_sdmmc_la_program(void *table, bool t210b01);
66
void minerva_prep_boot_freq();
67
void minerva_prep_boot_l4t(u32 oc_freq, u32 opt_custom);
68
void minerva_periodic_training();
69
emc_table_t *minerva_get_mtc_table();
70
int minerva_get_mtc_table_entries();
71
72
#endif
73
74