|
| 1 | +.. _K3-DDR-Driver: |
| 2 | +.. _ddr-driver: |
| 3 | + |
| 4 | +######### |
| 5 | +K3 DDR |
| 6 | +######### |
| 7 | + |
| 8 | +************ |
| 9 | +Introduction |
| 10 | +************ |
| 11 | + |
| 12 | +The K3 DDR driver provides management and monitoring capabilities for DDR memory |
| 13 | +subsystems on Texas Instruments K3 SoCs. |
| 14 | + |
| 15 | +The following is a list of supported K3 DDR driver features by device family: |
| 16 | + |
| 17 | +.. list-table:: K3 DDR Driver Feature Support |
| 18 | + :header-rows: 1 |
| 19 | + |
| 20 | + * - Device Family |
| 21 | + - Temperature Monitoring |
| 22 | + |
| 23 | + * - J721E / J7200 |
| 24 | + - Yes (only on J7200) |
| 25 | + |
| 26 | + * - AM62X / AM62AX / AM62PX |
| 27 | + - Yes |
| 28 | + |
| 29 | + * - AM64X |
| 30 | + - Yes |
| 31 | + |
| 32 | +********************************** |
| 33 | +Building and Enabling the Driver |
| 34 | +********************************** |
| 35 | + |
| 36 | +.. rubric:: Kernel Configuration |
| 37 | + |
| 38 | +The K3 DDR driver can be enabled in the kernel configuration: |
| 39 | + |
| 40 | +.. code-block:: kconfig |
| 41 | +
|
| 42 | + CONFIG_K3_DDR_TEMP=y |
| 43 | + CONFIG_HWMON=y |
| 44 | +
|
| 45 | +********************************** |
| 46 | +Device Tree Configuration Examples |
| 47 | +********************************** |
| 48 | + |
| 49 | +The K3 DDR driver requires proper device tree configuration with DDR controller |
| 50 | +and interrupt setup. The compatible string determines which DDR controller variant |
| 51 | +and features are supported: |
| 52 | + |
| 53 | +.. ifconfig:: CONFIG_part_variant in ('J721E', 'J7200') |
| 54 | + |
| 55 | + **J7 Family Device Tree Example:** |
| 56 | + |
| 57 | + .. code-block:: dts |
| 58 | +
|
| 59 | + ddrss0: ddr@4e00000 { |
| 60 | + compatible = "ti,j7-ddrss"; |
| 61 | + reg = <0x0 0x4e00000 0x0 0x1000>; |
| 62 | + interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>; |
| 63 | + status = "okay"; |
| 64 | +
|
| 65 | + ddr: ddr@4e01000 { |
| 66 | + reg = <0x0 0x4e01000 0x0 0x2000>; |
| 67 | + }; |
| 68 | + }; |
| 69 | +
|
| 70 | +.. ifconfig:: CONFIG_part_variant in ('AM62X', 'AM64X') |
| 71 | + |
| 72 | + **AM62X/AM64X Device Tree Example:** |
| 73 | + |
| 74 | + .. code-block:: dts |
| 75 | +
|
| 76 | + ddrss0: ddr@f300000 { |
| 77 | + compatible = "ti,am62-ddrss"; |
| 78 | + reg = <0x00 0xf300000 0x00 0x1000>; |
| 79 | + interrupts = <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>; |
| 80 | + status = "okay"; |
| 81 | +
|
| 82 | + ddr: ddr@f301000 { |
| 83 | + reg = <0x00 0xf301000 0x00 0x2000>; |
| 84 | + }; |
| 85 | + }; |
| 86 | +
|
| 87 | +.. ifconfig:: CONFIG_part_variant in ('AM62AX') |
| 88 | + |
| 89 | + **AM62AX Device Tree Example:** |
| 90 | + |
| 91 | + .. code-block:: dts |
| 92 | +
|
| 93 | + ddrss0: ddr@f300000 { |
| 94 | + compatible = "ti,am62a-ddrss"; |
| 95 | + reg = <0x00 0xf300000 0x00 0x1000>; |
| 96 | + interrupts = <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>; |
| 97 | + status = "okay"; |
| 98 | +
|
| 99 | + ddr: ddr@f301000 { |
| 100 | + reg = <0x00 0xf301000 0x00 0x2000>; |
| 101 | + }; |
| 102 | + }; |
| 103 | +
|
| 104 | +.. _ddr-temperature-monitoring-linux: |
| 105 | + |
| 106 | +************************************ |
| 107 | +Using the DDR Temperature Monitoring |
| 108 | +************************************ |
| 109 | + |
| 110 | +By default, the DDR subsystem keeps temperature polling turned off. For allowing |
| 111 | +the kernel driver to monitor temperature, the user must enable polling during |
| 112 | +DDR configuration and initialization at boot time. |
| 113 | + |
| 114 | +.. ifconfig:: CONFIG_part_variant in ('AM62X', 'AM62AX', 'AM62PX', 'AM64X', 'AM68A', 'AM68', 'AM69A', 'AM69', 'J722S') |
| 115 | + |
| 116 | + See :ref:`ddr-temperature-monitoring-uboot-am6x` in U-Boot documentation. |
| 117 | + |
| 118 | +.. ifconfig:: CONFIG_part_variant in ('J721E', 'J7200', 'J721S2', 'J784S4', 'J742S2') |
| 119 | + |
| 120 | + See :ref:`ddr-temperature-monitoring-uboot-j7` in U-Boot documentation. |
| 121 | + |
| 122 | +The K3 DDR driver creates a hwmon device that provides temperature status |
| 123 | +information through sysfs. The driver registers as ``k3_ddr`` in the hwmon |
| 124 | +subsystem for temperature monitoring functionality. |
| 125 | + |
| 126 | +The driver reports temperature status according to LPDDR4 specification: |
| 127 | + |
| 128 | ++-------+------------------------------------------+ |
| 129 | +| Value | Temperature Status | |
| 130 | ++=======+==========================================+ |
| 131 | +| 0 | Low temperature | |
| 132 | ++-------+------------------------------------------+ |
| 133 | +| 1 | 4x refresh interval | |
| 134 | ++-------+------------------------------------------+ |
| 135 | +| 2 | 2x refresh interval | |
| 136 | ++-------+------------------------------------------+ |
| 137 | +| 3 | 1x refresh interval (nominal) | |
| 138 | ++-------+------------------------------------------+ |
| 139 | +| 4 | 0.5x refresh interval | |
| 140 | ++-------+------------------------------------------+ |
| 141 | +| 5 | 0.25x refresh interval | |
| 142 | ++-------+------------------------------------------+ |
| 143 | +| 6 | 0.25x refresh interval with derating | |
| 144 | ++-------+------------------------------------------+ |
| 145 | +| 7 | High temperature | |
| 146 | ++-------+------------------------------------------+ |
| 147 | + |
| 148 | +The hwmon device should now show up in the filesystem. |
| 149 | + |
| 150 | +.. code-block:: console |
| 151 | +
|
| 152 | + root@evm:~# ls -l /sys/class/hwmon/ |
| 153 | + hwmon0 |
| 154 | +
|
| 155 | +Check the current DDR temperature status: |
| 156 | + |
| 157 | +.. code-block:: console |
| 158 | +
|
| 159 | + root@evm:~# cat /sys/class/hwmon/hwmon0/device/k3_ddr_temp_status |
| 160 | + 1x refresh interval |
0 commit comments