# Bootloader/UEFI device tree

The device tree specifies the UFS host configuration parameters such as number of gears, number of lanes, rate value, timeout values, etc.

##  UFS 

The device tree is located at `<workspace_root_path>\boot_images\boot\Settings\Soc\Kodiak\Core\Storage\UFS\ufs.dtsi`.

The UFS device tree node in UEFI is described below.

| Device tree node/key | Subnode | Device tree value | Notes |
| --- | --- | --- | --- |
| `init_speed_params` | `EnableHighSpeed` | 1 | Enables HS mode |
| `init_speed_params` | `NumGears` | 4 | Max gear to be used. |
| `init_speed_params` | `NumLanes` | 2 | Number of lanes used in UFS |
| `init_speed_params` | `Rate` | 2 | Values are:<br><br><ul class="simple"><br><li><p>1 = Rate A</p></li><br><li><p>2 = Rate B</p></li><br></ul> |
| `perf_speed_params` | `EnableHighSpeed` | 1 | To enable HS mode while in perf mode |
| `perf_speed_params` | `NumGears` | 4 | Max gear to be used in perf mode. |
| `perf_speed_params` | `NumLanes` | 2 | Number of lanes used in UFS in perf mode |
| `perf_speed_params` | `Rate` | 2 | Series in perf mode<br>- 1 = Rate A<br>- 2 = Rate B |
| `timeout_values` | `fDeviceInitTimeoutUs` | 2500000 | Timeout (µs) during device init |
| `timeout_values` | `UTRDPollTimeoutUs` | 30000000 | Timeout (µs) for UTRD |
| `BatteryThresholdMv` |  | 3600 | Battery threshold (in milli volts) to move to Gear1 |
| `LinkStartupRetryCount` |  | 5 | Retry count for Link startup |
| `FUA_Value` |  | 1 | Forced unit access |
| `EnableLogging` |  | 0 | Enables DT serial debug logging in loader<br>- 1 - Enable<br>- 0 - Disable |
| `RefClock` |  | 19200000 | UFS controller reference clock 19.2MHz |
| `MphyInitTable` |  |  | MphyInit table |
| `MphyInitEndTable` |  |  | MphyInitEnd table |
| `MphyLaneInitTable` |  |  | Mphy 2 Lane Init table |
|  |  |  |  |
|  |  |  |  |
|  |  |  |  |

Any change in the `.dtsi` should be compiled into `xbl_config.elf` and the image reflashed on to the device.

Note

`MphyInitTable`, `MphyInitEndTable`, and `MphyLaneInitTable` are used for UFS phy initialization and these values are tuned by Qualcomm. For debugging/tuning any phy-level issue, these values should be changed with guidance from the Qualcomm team.

Note

The default values are for UFS 3.1 part. For UFS 2.x part, `NumGears` value should be 3. Other parameters need not be changed for UFS 2.x part.

##  SD card 

This device tree is available in `<workspace_root_path>\boot_images\boot\Settings\Soc\Kodiak\Core\Storage\SDCC\sdcc.dtsi`.
This specifies the SD card parameters such as drive strength, maximum speed mode, HSR settings, etc.

The SD card device tree node in UEFI is described below.

| Device tree node/key | Device tree value | Notes |
| --- | --- | --- |
| `DriveStrength` | 0x1FE4 | `DriveStrength` as recommended, sets SDC CLK, CMD, and data drive strengths to 7, 4, 4, respectively. |
| `MaxSpeedMode` | `SDCC_SDR104_MODE` | Defines maximum speed mode. Should be `SDCC_SDR104_MODE` for SD card. |

Last Published: Oct 02, 2024

[Previous Topic
Power management states](https://docs.qualcomm.com/bundle/publicresource/80-70015-6/topics/power-management-states.md) [Next Topic
Linux kernel device tree](https://docs.qualcomm.com/bundle/publicresource/80-70015-6/topics/linux-device-tree.md)

Source: [https://docs.qualcomm.com/doc/80-70015-6/topic/bootloader-uefi-device-tree.html](https://docs.qualcomm.com/doc/80-70015-6/topic/bootloader-uefi-device-tree.html)