hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
* Rockchip rk3399 DMC (Dynamic Memory Controller) device
 
Required properties:
- compatible:         Must be "rockchip,rk3399-dmc".
- devfreq-events:     Node to get DDR loading, Refer to
            Documentation/devicetree/bindings/devfreq/event/
            rockchip-dfi.txt
- clocks:         Phandles for clock specified in "clock-names" property
- clock-names :         The name of clock used by the DFI, must be
            "pclk_ddr_mon";
- operating-points-v2:     Refer to Documentation/devicetree/bindings/opp/opp.txt
            for details.
- center-supply:     DMC supply node.
- status:         Marks the node enabled/disabled.
 
Optional properties:
- interrupts:         The CPU interrupt number. The interrupt specifier
            format depends on the interrupt controller.
            It should be a DCF interrupt. When DDR DVFS finishes
            a DCF interrupt is triggered.
- rockchip,pmu:         Phandle to the syscon managing the "PMU general register
            files".
 
Following properties relate to DDR timing:
 
- rockchip,dram_speed_bin :      Value reference include/dt-bindings/clock/rk3399-ddr.h,
                 it selects the DDR3 cl-trp-trcd type. It must be
                 set according to "Speed Bin" in DDR3 datasheet,
                 DO NOT use a smaller "Speed Bin" than specified
                 for the DDR3 being used.
 
- rockchip,pd_idle :          Configure the PD_IDLE value. Defines the
                 power-down idle period in which memories are
                 placed into power-down mode if bus is idle
                 for PD_IDLE DFI clock cycles.
 
- rockchip,sr_idle :          Configure the SR_IDLE value. Defines the
                 self-refresh idle period in which memories are
                 placed into self-refresh mode if bus is idle
                 for SR_IDLE * 1024 DFI clock cycles (DFI
                 clocks freq is half of DRAM clock), default
                 value is "0".
 
- rockchip,sr_mc_gate_idle :      Defines the memory self-refresh and controller
                 clock gating idle period. Memories are placed
                 into self-refresh mode and memory controller
                 clock arg gating started if bus is idle for
                 sr_mc_gate_idle*1024 DFI clock cycles.
 
- rockchip,srpd_lite_idle :      Defines the self-refresh power down idle
                 period in which memories are placed into
                 self-refresh power down mode if bus is idle
                 for srpd_lite_idle * 1024 DFI clock cycles.
                 This parameter is for LPDDR4 only.
 
- rockchip,standby_idle :      Defines the standby idle period in which
                 memories are placed into self-refresh mode.
                 The controller, pi, PHY and DRAM clock will
                 be gated if bus is idle for standby_idle * DFI
                 clock cycles.
 
- rockchip,dram_dll_dis_freq :      Defines the DDR3 DLL bypass frequency in MHz.
                 When DDR frequency is less than DRAM_DLL_DISB_FREQ,
                 DDR3 DLL will be bypassed. Note: if DLL was bypassed,
                 the odt will also stop working.
 
- rockchip,phy_dll_dis_freq :      Defines the PHY dll bypass frequency in
                 MHz (Mega Hz). When DDR frequency is less than
                 DRAM_DLL_DISB_FREQ, PHY DLL will be bypassed.
                 Note: PHY DLL and PHY ODT are independent.
 
- rockchip,ddr3_odt_dis_freq :      When the DRAM type is DDR3, this parameter defines
                 the ODT disable frequency in MHz (Mega Hz).
                 when the DDR frequency is  less then ddr3_odt_dis_freq,
                 the ODT on the DRAM side and controller side are
                 both disabled.
 
- rockchip,ddr3_drv :          When the DRAM type is DDR3, this parameter defines
                 the DRAM side driver strength in ohms. Default
                 value is DDR3_DS_40ohm.
 
- rockchip,ddr3_odt :          When the DRAM type is DDR3, this parameter defines
                 the DRAM side ODT strength in ohms. Default value
                 is DDR3_ODT_120ohm.
 
- rockchip,phy_ddr3_ca_drv :      When the DRAM type is DDR3, this parameter defines
                 the phy side CA line (incluing command line,
                 address line and clock line) driver strength.
                 Default value is PHY_DRV_ODT_40.
 
- rockchip,phy_ddr3_dq_drv :      When the DRAM type is DDR3, this parameter defines
                 the PHY side DQ line (including DQS/DQ/DM line)
                 driver strength. Default value is PHY_DRV_ODT_40.
 
- rockchip,phy_ddr3_odt :       When the DRAM type is DDR3, this parameter defines
                 the PHY side ODT strength. Default value is
                 PHY_DRV_ODT_240.
 
- rockchip,lpddr3_odt_dis_freq : When the DRAM type is LPDDR3, this parameter defines
                 then ODT disable frequency in MHz (Mega Hz).
                 When DDR frequency is less then ddr3_odt_dis_freq,
                 the ODT on the DRAM side and controller side are
                 both disabled.
 
- rockchip,lpddr3_drv :          When the DRAM type is LPDDR3, this parameter defines
                 the DRAM side driver strength in ohms. Default
                 value is LP3_DS_34ohm.
 
- rockchip,lpddr3_odt :          When the DRAM type is LPDDR3, this parameter defines
                 the DRAM side ODT strength in ohms. Default value
                 is LP3_ODT_240ohm.
 
- rockchip,phy_lpddr3_ca_drv :      When the DRAM type is LPDDR3, this parameter defines
                 the PHY side CA line (including command line,
                 address line and clock line) driver strength.
                 Default value is PHY_DRV_ODT_40.
 
- rockchip,phy_lpddr3_dq_drv :      When the DRAM type is LPDDR3, this parameter defines
                 the PHY side DQ line (including DQS/DQ/DM line)
                 driver strength. Default value is
                 PHY_DRV_ODT_40.
 
- rockchip,phy_lpddr3_odt :       When dram type is LPDDR3, this parameter define
                 the phy side odt strength, default value is
                 PHY_DRV_ODT_240.
 
- rockchip,lpddr4_odt_dis_freq : When the DRAM type is LPDDR4, this parameter
                 defines the ODT disable frequency in
                 MHz (Mega Hz). When the DDR frequency is less then
                 ddr3_odt_dis_freq, the ODT on the DRAM side and
                 controller side are both disabled.
 
- rockchip,lpddr4_drv :          When the DRAM type is LPDDR4, this parameter defines
                 the DRAM side driver strength in ohms. Default
                 value is LP4_PDDS_60ohm.
 
- rockchip,lpddr4_dq_odt :       When the DRAM type is LPDDR4, this parameter defines
                 the DRAM side ODT on DQS/DQ line strength in ohms.
                 Default value is LP4_DQ_ODT_40ohm.
 
- rockchip,lpddr4_ca_odt :      When the DRAM type is LPDDR4, this parameter defines
                 the DRAM side ODT on CA line strength in ohms.
                 Default value is LP4_CA_ODT_40ohm.
 
- rockchip,phy_lpddr4_ca_drv :      When the DRAM type is LPDDR4, this parameter defines
                 the PHY side CA line (including command address
                 line) driver strength. Default value is
                 PHY_DRV_ODT_40.
 
- rockchip,phy_lpddr4_ck_cs_drv : When the DRAM type is LPDDR4, this parameter defines
                 the PHY side clock line and CS line driver
                 strength. Default value is PHY_DRV_ODT_80.
 
- rockchip,phy_lpddr4_dq_drv :      When the DRAM type is LPDDR4, this parameter defines
                 the PHY side DQ line (including DQS/DQ/DM line)
                 driver strength. Default value is PHY_DRV_ODT_80.
 
- rockchip,phy_lpddr4_odt :      When the DRAM type is LPDDR4, this parameter defines
                 the PHY side ODT strength. Default value is
                 PHY_DRV_ODT_60.
 
Example:
   dmc_opp_table: dmc_opp_table {
       compatible = "operating-points-v2";
 
       opp00 {
           opp-hz = /bits/ 64 <300000000>;
           opp-microvolt = <900000>;
       };
       opp01 {
           opp-hz = /bits/ 64 <666000000>;
           opp-microvolt = <900000>;
       };
   };
 
   dmc: dmc {
       compatible = "rockchip,rk3399-dmc";
       devfreq-events = <&dfi>;
       interrupts = <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>;
       clocks = <&cru SCLK_DDRCLK>;
       clock-names = "dmc_clk";
       operating-points-v2 = <&dmc_opp_table>;
       center-supply = <&ppvar_centerlogic>;
       upthreshold = <15>;
       downdifferential = <10>;
       rockchip,ddr3_speed_bin = <21>;
       rockchip,pd_idle = <0x40>;
       rockchip,sr_idle = <0x2>;
       rockchip,sr_mc_gate_idle = <0x3>;
       rockchip,srpd_lite_idle    = <0x4>;
       rockchip,standby_idle = <0x2000>;
       rockchip,dram_dll_dis_freq = <300>;
       rockchip,phy_dll_dis_freq = <125>;
       rockchip,auto_pd_dis_freq = <666>;
       rockchip,ddr3_odt_dis_freq = <333>;
       rockchip,ddr3_drv = <DDR3_DS_40ohm>;
       rockchip,ddr3_odt = <DDR3_ODT_120ohm>;
       rockchip,phy_ddr3_ca_drv = <PHY_DRV_ODT_40>;
       rockchip,phy_ddr3_dq_drv = <PHY_DRV_ODT_40>;
       rockchip,phy_ddr3_odt = <PHY_DRV_ODT_240>;
       rockchip,lpddr3_odt_dis_freq = <333>;
       rockchip,lpddr3_drv = <LP3_DS_34ohm>;
       rockchip,lpddr3_odt = <LP3_ODT_240ohm>;
       rockchip,phy_lpddr3_ca_drv = <PHY_DRV_ODT_40>;
       rockchip,phy_lpddr3_dq_drv = <PHY_DRV_ODT_40>;
       rockchip,phy_lpddr3_odt = <PHY_DRV_ODT_240>;
       rockchip,lpddr4_odt_dis_freq = <333>;
       rockchip,lpddr4_drv = <LP4_PDDS_60ohm>;
       rockchip,lpddr4_dq_odt = <LP4_DQ_ODT_40ohm>;
       rockchip,lpddr4_ca_odt = <LP4_CA_ODT_40ohm>;
       rockchip,phy_lpddr4_ca_drv = <PHY_DRV_ODT_40>;
       rockchip,phy_lpddr4_ck_cs_drv = <PHY_DRV_ODT_80>;
       rockchip,phy_lpddr4_dq_drv = <PHY_DRV_ODT_80>;
       rockchip,phy_lpddr4_odt = <PHY_DRV_ODT_60>;
   };