| 107 | [=#emmc-enhanced-user-area] |
| 108 | === eMMC Enhanced User Area and Pseudo SLC |
| 109 | The eMMC 4.4 standard introduced the concept of 'Enhanced User Area' in order to improve reliability, performance, and endurance. This allows a one-time configuration of the eMMC to configure all or some of the MLC NAND flash as Psuedo SLC (pSLC) where instead of 2 bits per cell it uses 1 bit per cell. This will reduce the available size of the eMMC as a trade-off for improved reliability, performance, and endurance. |
| 110 | |
| 111 | The specification for Enhanced User Area does not specify a particular implementation or require eMMC devices to even support Enhanced User Area. |
| 112 | |
| 113 | U-Boot has mmc commands that can be used to configure all or some of an eMMC as enhanced storage. |
| 114 | |
| 115 | Example: GW7301: |
| 116 | * Use 'mmc info' to see current configuration |
| 117 | {{{#!bash |
| 118 | u-boot=> mmc list |
| 119 | FSL_SDHC: 0 |
| 120 | FSL_SDHC: 1 |
| 121 | FSL_SDHC: 2 (eMMC) |
| 122 | u-boot=> mmc dev 2 |
| 123 | switch to partitions #0, OK |
| 124 | mmc2(part 0) is current device |
| 125 | u-boot=> mmc info |
| 126 | Device: FSL_SDHC |
| 127 | Manufacturer ID: 13 |
| 128 | OEM: 14e |
| 129 | Name: S0J58 |
| 130 | Bus Speed: 52000000 |
| 131 | Mode: MMC High Speed (52MHz) |
| 132 | Rd Block Len: 512 |
| 133 | MMC version 5.1 |
| 134 | High Capacity: Yes |
| 135 | Capacity: 59.3 GiB |
| 136 | Bus Width: 8-bit |
| 137 | Erase Group Size: 512 KiB |
| 138 | HC WP Group Size: 16 MiB |
| 139 | User Capacity: 59.3 GiB WRREL |
| 140 | Boot Capacity: 31.5 MiB ENH |
| 141 | RPMB Capacity: 4 MiB ENH |
| 142 | Boot area 0 is not write protected |
| 143 | Boot area 1 is not write protected |
| 144 | }}} |
| 145 | - The above shows that mmc device 2 is an eMMC with: |
| 146 | * 59.3 GiB capacity in the User hardware partition with write reliability turned on (WRREL). Write reliability is a configuration that affects what happens during an unexpected power-cut; when enabled write operations are atomic and this is typically desired over the higher performance available when this is disabled. |
| 147 | * 31.5 MiB capacity in the Boot hardware partition configured as enhanced user area (ENH) |
| 148 | * 4 MiB capacity in the RPMB hardware partition configured as enhanced user area (ENH) |
| 149 | * use 'mmc hwpartition' to see the current configuration: |
| 150 | {{{#!bash |
| 151 | u-boot=> mmc hwpartition |
| 152 | Partition configuration: |
| 153 | No enhanced user data area |
| 154 | No GP1 partition |
| 155 | No GP2 partition |
| 156 | No GP3 partition |
| 157 | No GP4 partition |
| 158 | }}} |
| 159 | * use 'mmc hwpartition user enh' to set enhanced storage with a starting block and a block count (512 byte blocks) which must be aligned with the 'HC WP group size' reported from the 'mmc info' command above. You can use the 'check' option to test the parameters before making it permanent. The 'mmc info' command does not show us the capacity in the number of 512 byte blocks but instead rounds it to GiB or MiB. You can boot to linux and look at /sys/class/block/mmcblk2/size to see the number of 512 byte blocks, which for this particular device is 124321792. |
| 160 | {{{#!bash |
| 161 | u-boot=> mmc hwpartition user enh 0 124321792 check |
| 162 | Partition configuration: |
| 163 | User Enhanced Start: 0 Bytes |
| 164 | User Enhanced Size: 59.3 GiB |
| 165 | No GP1 partition |
| 166 | No GP2 partition |
| 167 | No GP3 partition |
| 168 | No GP4 partition |
| 169 | Total enhanced size exceeds maximum (3794 > 1892) |
| 170 | Failed! |
| 171 | }}} |
| 172 | - This failed due to this eMMC only allowing up to 1892 HC WP Group's. The 'mmc info' command showed us that 'HC WP Group Size' is 16MiB so that means the maximum size we can set to enhanced user area is 1892 * 16MiB = 30272MiB. Devide that by 512bytes gives us 61997056 blocks. |
| 173 | * use 'mmc hwpartition user enh' again now that we know the max we can request. |
| 174 | {{{#!bash |
| 175 | u-boot=> mmc hwpartition user enh 0 61997056 wrrel on check |
| 176 | Partition configuration: |
| 177 | User Enhanced Start: 0 Bytes |
| 178 | User Enhanced Size: 29.6 GiB |
| 179 | User partition write reliability: on |
| 180 | No GP1 partition |
| 181 | No GP2 partition |
| 182 | No GP3 partition |
| 183 | No GP4 partition |
| 184 | }}} |
| 185 | * We see no errors now. Once you are satisfied with the offset, size, and capabilities you can add the 'complete' option: |
| 186 | {{{#!bash |
| 187 | u-boot=> mmc hwpartition user enh 0 61997056 wrrel on complete |
| 188 | Partition configuration: |
| 189 | User Enhanced Start: 0 Bytes |
| 190 | User Enhanced Size: 29.6 GiB |
| 191 | User partition write reliability: on |
| 192 | No GP1 partition |
| 193 | No GP2 partition |
| 194 | No GP3 partition |
| 195 | No GP4 partition |
| 196 | Partitioning successful, power-cycle to make effective |
| 197 | }}} |
| 198 | * After reprogramming eMMC (because we just re-configured the start of the user hardware partition where our boot firmware is) you see the results: |
| 199 | {{{#!bash |
| 200 | u-boot=> mmc dev 2 |
| 201 | switch to partitions #0, OK |
| 202 | mmc2(part 0) is current device |
| 203 | u-boot=> mmc info |
| 204 | Device: FSL_SDHC |
| 205 | Manufacturer ID: 13 |
| 206 | OEM: 14e |
| 207 | Name: S0J58 |
| 208 | Bus Speed: 52000000 |
| 209 | Mode: MMC High Speed (52MHz) |
| 210 | Rd Block Len: 512 |
| 211 | MMC version 5.1 |
| 212 | High Capacity: Yes |
| 213 | Capacity: 29.6 GiB |
| 214 | Bus Width: 8-bit |
| 215 | Erase Group Size: 512 KiB |
| 216 | HC WP Group Size: 16 MiB |
| 217 | User Capacity: 29.6 GiB ENH WRREL |
| 218 | User Enhanced Start: 0 Bytes |
| 219 | User Enhanced Size: 29.6 GiB |
| 220 | Boot Capacity: 31.5 MiB ENH |
| 221 | RPMB Capacity: 4 MiB ENH |
| 222 | Boot area 0 is not write protected |
| 223 | Boot area 1 is not write protected |
| 224 | }}} |
| 225 | * Note User hardware partition is now half the size it was before but now is enhanced user area (ENH) |
| 226 | |
| 227 | ** Important notes:** |
| 228 | - changing this is a one-time thing |
| 229 | - you only get one configuration of offset/size/mode |
| 230 | - if you change the configuration of your boot area you must re-program the eMMC via JTAG |
| 231 | |