summaryrefslogtreecommitdiff
path: root/soc/mediatek/mt8192/README.md
blob: 77786fbcb9968914a1e219da101e48322d9ebdf5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# Firmware list
- drame.elf
- dpm.dm
- dpm.pm
- spm_firmware.bin
- sspm.bin
- mcupm.bin

--------------------------------------------------------------------------------
# `dram.elf` Introduction

`dram.elf` is one ELF format file which is used for calibration.
The dram.elf is loaded at the first time bootup, it will do DRAM
full calibration, and save calibration parameters to NAND (or EMMC)
for faster bootup after the frist bootup.

## Who uses it
   - coreboot loads `dram.elf` at the first time bootup if no DRAM parameters exist.

## How to load `dram.elf`
   - coreboot locates `dram.elf` file, and locates the entry point "_start",
     then it passes DRAM struct "param", and call _start(&param) to execute `dram.elf`
     flow.

## Parameters
```
    struct dramc_param {
        struct dramc_param_header header; // see below
        void (*do_putc)(unsigned char c);
        struct dramc_data dramc_datas;    // see below
    };
```
   Below shows the internal structure of dramc_param:
```
    struct dramc_param_header {
        u16 version;    /* DRAMC_PARAM_HEADER_VERSION, update in the coreboot */
        u16 size;       /* size of whole dramc_param, update in the coreboot */
        u16 status;     /* DRAMC_PARAM_STATUS_CODES, update in the dram blob */
        u16 flags;      /* DRAMC_PARAM_FLAGS, update in the dram blob */
    };

    struct dramc_data {
        struct ddr_base_info ddr_info;
        struct sdram_params freq_params[DRAM_DFS_SHU_MAX];
    };

    struct ddr_base_info {
        u16 config_dvfs;		/* DRAMC_PARAM_DVFS_FLAG */
        u16 ddr_type;			/* DRAMC_PARAM_DDR_TYPE */
        u16 ddr_geometry;		/* DRAMC_PARAM_GEOMETRY_TYPE */
        u16 voltage_type;		/* DRAM_PARAM_VOLTAGE_TYPE */
        u32 support_ranks;
        u64 rank_size[RANK_MAX];
        struct emi_mdl emi_config;
        dram_cbt_mode cbt_mode[RANK_MAX];
    };

    struct sdram_params {
        u32 rank_num;
        u16 num_dlycell_perT;
        u16 delay_cell_timex100;

    /* duty */
    s8 duty_clk_delay[CHANNEL_MAX][RANK_MAX];
    s8 duty_dqs_delay[CHANNEL_MAX][DQS_NUMBER_LP4];
    s8 duty_wck_delay[CHANNEL_MAX][DQS_NUMBER_LP4];
        .......
        .......
    };
```

## The output of `dram.elf`
   - `dram.elf` will set the suitable dramc settings, also save the DRAM parameters
     to NOR/NAND (or EMMC) on the specified section: "RW_MRC_CACHE".

## Return Values
   - 0   : means successful.
   - < 0 : means failed.

## Version
  - $ strings dram.elf | grep "firmware version"
    MediaTek DRAM firmware version: 1.6.3

--------------------------------------------------------------------------------
# DPM Introduction

DPM is hardware module which is used for DRAM Power Management, which
is used for DRAM low power.
For example: self refresh, disable PLL/DLL when not in used.

DPM includes two parts of images: data part (`dpm.dm`) and program part (`dpm.pm`).
They are loaded into DPM SRAM when system inits.

## Who uses it
   - coreboot will load dpm at ramstage. It will copy `dpm.dm` & `dpm.pm` to DPM SRAM.

## How to load DPM
   - Use CBFS to load `dpm.dm` and `dpm.pm`.
   - No need to pass other parameters to DPM.

## Return Values
   - 0  : means successful;
   - -1 : means failed;

## Version
  - No version yet.

--------------------------------------------------------------------------------
# SPM Introduction

SPM is able to turn off more power such as DRAM self-refresh mode and 26M clock off
when system is in suspend. Also, SPM helps support Vcore DVFS feature.

## Who uses it
   - Linux kernel system suspend and Vcore DVFS.

## How to load `spm_fimware.bin`
   - Use CBFS to load "spm_fimware.bin" to DRAM and SPM DMA loads it from dram to SPM SRAM.

## Return Values
   SPM driver in coreboot checks if pmem_words/dmem_words are 16-byte aligned in `spm_fimware.bin`
   - yes : SPM DMA can load `spm_fimware.bin` to SPM SRAM correctly.
   - no  : assert(0)

## Version
   Search "spmfw (version" will show log like below
   - spmfw (version pcm_suspend_v1.43_no_GPU_WAYEN)

--------------------------------------------------------------------------------
# SSPM Introduction

SSPM is "Secure System Power Manager" that provides power control in secure domain.
SSPM provides power related features, e.g. CPU DVFS, thermal control, to offload
application processor for security reason.

SSPM firmware is loaded into SSPM SRAM at system initialization.

## Who uses it
   - coreboot will load sspm.bin to SSPM SRAM at ramstage.

## How to load `sspm.bin`
   - Use CBFS to load `sspm.bin`.
   - No need to pass other parameters to SSPM.

## Return Value
  - No return value.

## Version
  - $ strings sspm.bin | grep version
    MediaTek SSPM firmware: version 1.0.0

--------------------------------------------------------------------------------
# MCUPM Introduction

MCUPM is a hardware module which is used for MCUSYS Power Management,
for example: core/cluster on/off. MCUPM firmware (`mcupm.bin`) is loaded into
MCUPM SRAM at system initialization.

## Who uses it
   - coreboot will load MCUPM at ramstage. It will copy mcupm.bin to MCUPM SRAM.

## How to load `mcupm.bin`
   - Use CBFS to load `mcupm.bin`, then set normal boot flag and release software reset pin of MCUPM.

## Return Values
  - No return value.

## Version
  - $ strings mcupm.bin | grep MCUPM
    MediaTek MCUPM firmware: version 1.00.06