2019-06-30 01:49:33 +01:00
|
|
|
/*
|
2022-01-20 10:43:24 +00:00
|
|
|
* Copyright (c) 2019-2022 CTCaer
|
2019-06-30 01:49:33 +01:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _FE_MINERVA_H_
|
|
|
|
#define _FE_MINERVA_H_
|
|
|
|
|
|
|
|
#include "mtc_table.h"
|
2020-06-14 14:45:45 +01:00
|
|
|
#include <utils/types.h>
|
2019-06-30 01:49:33 +01:00
|
|
|
|
2019-12-04 19:56:45 +00:00
|
|
|
#define MTC_INIT_MAGIC 0x3043544D
|
|
|
|
#define MTC_NEW_MAGIC 0x5243544D
|
|
|
|
|
|
|
|
#define EMC_PERIODIC_TRAIN_MS 250
|
2019-06-30 01:49:33 +01:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2021-10-15 14:18:06 +01:00
|
|
|
u32 rate_to;
|
|
|
|
u32 rate_from;
|
2019-06-30 01:49:33 +01:00
|
|
|
emc_table_t *mtc_table;
|
|
|
|
u32 table_entries;
|
|
|
|
emc_table_t *current_emc_table;
|
|
|
|
u32 train_mode;
|
|
|
|
u32 sdram_id;
|
|
|
|
u32 prev_temp;
|
|
|
|
bool emc_2X_clk_src_is_pllmb;
|
|
|
|
bool fsp_for_src_freq;
|
|
|
|
bool train_ram_patterns;
|
2024-10-04 19:45:57 +01:00
|
|
|
u32 init_done;
|
2019-06-30 01:49:33 +01:00
|
|
|
} mtc_config_t;
|
|
|
|
|
|
|
|
enum train_mode_t
|
|
|
|
{
|
|
|
|
OP_SWITCH = 0,
|
|
|
|
OP_TRAIN = 1,
|
|
|
|
OP_TRAIN_SWITCH = 2,
|
|
|
|
OP_PERIODIC_TRAIN = 3,
|
|
|
|
OP_TEMP_COMP = 4
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
FREQ_204 = 204000,
|
2024-03-27 07:25:29 +00:00
|
|
|
FREQ_408 = 408000,
|
2019-06-30 01:49:33 +01:00
|
|
|
FREQ_800 = 800000,
|
2024-03-27 07:25:29 +00:00
|
|
|
FREQ_1333 = 1331200,
|
2019-06-30 01:49:33 +01:00
|
|
|
FREQ_1600 = 1600000
|
|
|
|
} minerva_freq_t;
|
|
|
|
|
2020-05-08 23:32:44 +01:00
|
|
|
extern void (*minerva_cfg)(mtc_config_t *mtc_cfg, void *);
|
2019-12-09 20:27:01 +00:00
|
|
|
u32 minerva_init();
|
2019-06-30 01:49:33 +01:00
|
|
|
void minerva_change_freq(minerva_freq_t freq);
|
2023-04-06 15:30:01 +01:00
|
|
|
void minerva_sdmmc_la_program(void *table, bool t210b01);
|
2021-04-09 17:28:04 +01:00
|
|
|
void minerva_prep_boot_freq();
|
2024-02-16 13:51:02 +00:00
|
|
|
void minerva_prep_boot_l4t(u32 oc_freq, u32 opt_custom);
|
2019-06-30 01:49:33 +01:00
|
|
|
void minerva_periodic_training();
|
2022-01-20 10:43:24 +00:00
|
|
|
emc_table_t *minerva_get_mtc_table();
|
2022-03-22 22:58:20 +00:00
|
|
|
int minerva_get_mtc_table_entries();
|
2019-06-30 01:49:33 +01:00
|
|
|
|
|
|
|
#endif
|