18c2ecf20Sopenharmony_ciEmbedded Memory Controller
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ciProperties:
48c2ecf20Sopenharmony_ci- name : Should be emc
58c2ecf20Sopenharmony_ci- #address-cells : Should be 1
68c2ecf20Sopenharmony_ci- #size-cells : Should be 0
78c2ecf20Sopenharmony_ci- compatible : Should contain "nvidia,tegra20-emc".
88c2ecf20Sopenharmony_ci- reg : Offset and length of the register set for the device
98c2ecf20Sopenharmony_ci- nvidia,use-ram-code : If present, the sub-nodes will be addressed
108c2ecf20Sopenharmony_ci  and chosen using the ramcode board selector. If omitted, only one
118c2ecf20Sopenharmony_ci  set of tables can be present and said tables will be used
128c2ecf20Sopenharmony_ci  irrespective of ram-code configuration.
138c2ecf20Sopenharmony_ci- interrupts : Should contain EMC General interrupt.
148c2ecf20Sopenharmony_ci- clocks : Should contain EMC clock.
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ciChild device nodes describe the memory settings for different configurations and clock rates.
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ciExample:
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci	memory-controller@7000f400 {
218c2ecf20Sopenharmony_ci		#address-cells = < 1 >;
228c2ecf20Sopenharmony_ci		#size-cells = < 0 >;
238c2ecf20Sopenharmony_ci		compatible = "nvidia,tegra20-emc";
248c2ecf20Sopenharmony_ci		reg = <0x7000f4000 0x200>;
258c2ecf20Sopenharmony_ci		interrupts = <0 78 0x04>;
268c2ecf20Sopenharmony_ci		clocks = <&tegra_car TEGRA20_CLK_EMC>;
278c2ecf20Sopenharmony_ci	}
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ciEmbedded Memory Controller ram-code table
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ciIf the emc node has the nvidia,use-ram-code property present, then the
338c2ecf20Sopenharmony_cinext level of nodes below the emc table are used to specify which settings
348c2ecf20Sopenharmony_ciapply for which ram-code settings.
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ciIf the emc node lacks the nvidia,use-ram-code property, this level is omitted
378c2ecf20Sopenharmony_ciand the tables are stored directly under the emc node (see below).
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ciProperties:
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci- name : Should be emc-tables
428c2ecf20Sopenharmony_ci- nvidia,ram-code : the binary representation of the ram-code board strappings
438c2ecf20Sopenharmony_ci  for which this node (and children) are valid.
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ciEmbedded Memory Controller configuration table
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ciThis is a table containing the EMC register settings for the various
508c2ecf20Sopenharmony_cioperating speeds of the memory controller. They are always located as
518c2ecf20Sopenharmony_cisubnodes of the emc controller node.
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ciThere are two ways of specifying which tables to use:
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci* The simplest is if there is just one set of tables in the device tree,
568c2ecf20Sopenharmony_ci  and they will always be used (based on which frequency is used).
578c2ecf20Sopenharmony_ci  This is the preferred method, especially when firmware can fill in
588c2ecf20Sopenharmony_ci  this information based on the specific system information and just
598c2ecf20Sopenharmony_ci  pass it on to the kernel.
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci* The slightly more complex one is when more than one memory configuration
628c2ecf20Sopenharmony_ci  might exist on the system.  The Tegra20 platform handles this during
638c2ecf20Sopenharmony_ci  early boot by selecting one out of possible 4 memory settings based
648c2ecf20Sopenharmony_ci  on a 2-pin "ram code" bootstrap setting on the board. The values of
658c2ecf20Sopenharmony_ci  these strappings can be read through a register in the SoC, and thus
668c2ecf20Sopenharmony_ci  used to select which tables to use.
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ciProperties:
698c2ecf20Sopenharmony_ci- name : Should be emc-table
708c2ecf20Sopenharmony_ci- compatible : Should contain "nvidia,tegra20-emc-table".
718c2ecf20Sopenharmony_ci- reg : either an opaque enumerator to tell different tables apart, or
728c2ecf20Sopenharmony_ci  the valid frequency for which the table should be used (in kHz).
738c2ecf20Sopenharmony_ci- clock-frequency : the clock frequency for the EMC at which this
748c2ecf20Sopenharmony_ci  table should be used (in kHz).
758c2ecf20Sopenharmony_ci- nvidia,emc-registers : a 46 word array of EMC registers to be programmed
768c2ecf20Sopenharmony_ci  for operation at the 'clock-frequency' setting.
778c2ecf20Sopenharmony_ci  The order and contents of the registers are:
788c2ecf20Sopenharmony_ci    RC, RFC, RAS, RP, R2W, W2R, R2P, W2P, RD_RCD, WR_RCD, RRD, REXT,
798c2ecf20Sopenharmony_ci    WDV, QUSE, QRST, QSAFE, RDV, REFRESH, BURST_REFRESH_NUM, PDEX2WR,
808c2ecf20Sopenharmony_ci    PDEX2RD, PCHG2PDEN, ACT2PDEN, AR2PDEN, RW2PDEN, TXSR, TCKE, TFAW,
818c2ecf20Sopenharmony_ci    TRPAB, TCLKSTABLE, TCLKSTOP, TREFBW, QUSE_EXTRA, FBIO_CFG6, ODT_WRITE,
828c2ecf20Sopenharmony_ci    ODT_READ, FBIO_CFG5, CFG_DIG_DLL, DLL_XFORM_DQS, DLL_XFORM_QUSE,
838c2ecf20Sopenharmony_ci    ZCAL_REF_CNT, ZCAL_WAIT_CNT, AUTO_CAL_INTERVAL, CFG_CLKTRIM_0,
848c2ecf20Sopenharmony_ci    CFG_CLKTRIM_1, CFG_CLKTRIM_2
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci		emc-table@166000 {
878c2ecf20Sopenharmony_ci			reg = <166000>;
888c2ecf20Sopenharmony_ci			compatible = "nvidia,tegra20-emc-table";
898c2ecf20Sopenharmony_ci			clock-frequency = < 166000 >;
908c2ecf20Sopenharmony_ci			nvidia,emc-registers = < 0 0 0 0 0 0 0 0 0 0 0 0 0 0
918c2ecf20Sopenharmony_ci						 0 0 0 0 0 0 0 0 0 0 0 0 0 0
928c2ecf20Sopenharmony_ci						 0 0 0 0 0 0 0 0 0 0 0 0 0 0
938c2ecf20Sopenharmony_ci						 0 0 0 0 >;
948c2ecf20Sopenharmony_ci		};
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci		emc-table@333000 {
978c2ecf20Sopenharmony_ci			reg = <333000>;
988c2ecf20Sopenharmony_ci			compatible = "nvidia,tegra20-emc-table";
998c2ecf20Sopenharmony_ci			clock-frequency = < 333000 >;
1008c2ecf20Sopenharmony_ci			nvidia,emc-registers = < 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1018c2ecf20Sopenharmony_ci						 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1028c2ecf20Sopenharmony_ci						 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1038c2ecf20Sopenharmony_ci						 0 0 0 0 >;
1048c2ecf20Sopenharmony_ci		};
105