Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
CTCaer
GitHub Repository: CTCaer/hekate
Path: blob/master/bdk/mem/minerva.h
3694 views
1
/*
2
* Copyright (c) 2019-2025 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
#define MTC_IRB_MAGIC 0x4943544D
26
27
#define EMC_PERIODIC_TRAIN_MS 250
28
29
typedef struct
30
{
31
u32 rate_to;
32
u32 rate_from;
33
emc_table_t *mtc_table;
34
u32 table_entries;
35
emc_table_t *current_emc_table;
36
u32 train_mode;
37
u32 sdram_id;
38
u32 prev_temp;
39
bool emc_2X_clk_src_is_pllmb;
40
bool fsp_for_src_freq;
41
bool train_ram_patterns;
42
u32 init_done;
43
} mtc_config_t;
44
45
typedef struct
46
{
47
mtc_config_t mtc_cfg;
48
emc_table_t mtc_table[11]; // 10 + 1.
49
} minerva_str_t;
50
51
enum train_mode_t
52
{
53
OP_SWITCH = 0,
54
OP_TRAIN = 1,
55
OP_TRAIN_SWITCH = 2,
56
OP_PERIODIC_TRAIN = 3,
57
OP_TEMP_COMP = 4
58
};
59
60
typedef enum
61
{
62
FREQ_204 = 204000,
63
FREQ_408 = 408000,
64
FREQ_666 = 665600,
65
FREQ_800 = 800000,
66
FREQ_1066 = 1065600,
67
FREQ_1333 = 1331200,
68
FREQ_1600 = 1600000,
69
70
FREQ_MIN = FREQ_204,
71
FREQ_MAX = FREQ_1600
72
} minerva_freq_t;
73
74
extern void (*minerva_cfg)(mtc_config_t *mtc_cfg, void *);
75
int minerva_init(minerva_str_t *mtc_str);
76
void minerva_deinit();
77
void minerva_change_freq(minerva_freq_t freq);
78
void minerva_sdmmc_la_program(void *table, bool t210b01);
79
void minerva_prep_boot_hos();
80
void minerva_prep_boot_l4t(u32 oc_freq, u32 opt_custom, bool prg_sdmmc_la);
81
void minerva_periodic_training();
82
emc_table_t *minerva_get_mtc_table();
83
int minerva_get_mtc_table_entries();
84
85
#endif
86
87