Skip to content
Michael Zimmermann edited this page Jan 26, 2017 · 3 revisions

DeviceTree

V1

qcom,msm-id = <x y z>;

LGE device trees have a fourth field for the LGE revision number.

V2

qcom,msm-id = <x z>;
qcom,board-id = <y y'>;

Oppo devices have two additional fields in the board-id

V3

qcom,msm-id = <x z>;
qcom,board-id = <y y'>;
qcom,pmic-id = <pmic1 pmic2 pmic3 pmic4>;

Values

x = Platform ID (platform_id)

  • Bits 0-15 = Unique MSM chipset ID
  • Bits 16-23 = Optional foundry ID. If the boot loader does not find a device tree that exactly matches the foundry-id with the hardware, it chooses the device tree with foundry-id = 0.
  • Bits 24-31 = Reserved

z = ID for SoC revision (hardware revision / SOC rev / soc_rev).

y = ID for SBC (hardware variants / variant_id), etc.

  • Bits 0-7 = Platform hardware CDP/MTP (hw_platform)
  • Bits 8-15 = Platform minor version
  • Bits 16-23 = Platform major version
  • Bits 24-31 = Subtype (platform_subtype / board_hw_subtype)

y' = ID for platform subtype (platform_subtype) (assumed zero if absent)

if 0, Subtype of y will be used

  • Bits 0-7 = subtype
  • Bits 8-10 = DDR detection
  • Bits 11-12 = Panel detection
  • Bits 13-15 = Reserved bits
  • Bits 16-19 = Boot device
  • Bits 20-31 = reserved bits

pmic1-4 = pmic_target / board.pmic_info[i].pmic_target

  • Bits 0-7 = PMIC_MODEL
  • Bits 8-15 = Minor version
  • Bits 16-23 = Major version
  • Bits 24-31 = Unused

Board Data (SMEM)

LK generic board struct

  • platform = msm_id
  • foundry_id = foundry_id (>=v9)
  • chip_serial = chip_serial (v10)
  • platform_version = msm_version
  • platform_hw = hw_platform
  • platform_subtype = platform_subtype
  • target(variant_id) = (hw_platform&0xff,platform_version&0xff,(platform_version>>16)&0xff,platform_subtype&0xff) (>=v8)
  • baseband = custom assignment in target
  • pmic_info(pmic_type,pmic_version,pmic_target)[] = (pmic_type,pmic_version|v7),(pmic_type,pmic_version,from pmic_version and pmic_type|>=v8)
  • platform_hlos_subtype = (board_get_ddr_subtype() << 8) | (platform_get_boot_dev() << 16) | (platform_detect_panel() << 11)

Board C API

  • uint32_t board_platform_id(void); = board.platform
  • uint32_t board_target_id(void); = board.target
  • uint32_t board_baseband(void); = board.baseband
  • uint32_t board_hardware_id(void); = board.platform_hw
  • uint32_t board_soc_version(void); = board.platform_version
  • uint32_t board_hardware_subtype(void); = board.platform_subtype
  • uint32_t board_get_ddr_subtype(void); = SUBTYPE_512MB || 0
  • uint32_t board_hlos_subtype(void); = board.platform_hlos_subtype
  • uint32_t board_chip_serial(void); = board.chip_serial
  • uint32_t board_foundry_id(void); = board.foundry_id
  • uint8_t board_pmic_info(struct board_pmic_data *, uint8_t num_ent); = board.pmic_info[i]
  • uint32_t board_pmic_target(uint8_t num_ent); = board.pmic_info[num_ent].pmic_target

Matching devicetree against board data

STEP1: exact matches - only these will be considered for step 2

  • dt->platform_id->msm_id == board_platform_id()->msm_id
  • dt->variant_id->hw_platform == board_hardware_id()
  • dt->board_hw_subtype->subtype == board_hardware_subtype()
  • dt->board_hw_subtype->DDR == target_get_hlos_subtype()->DDR
  • dt->soc_rev <= board_soc_version()
  • dt->variant_id->major,minor <= board_target_id()->major,minor
  • dt->pmic_rev[i]->major,minor <= board_pmic_target(i)->major,minor

STEP2: best match - the best matching entry will be used

if a exact match for a type can't be found it matches against 0.

  • DTB_FOUNDRY: platform_id->platform_id == board_foundry_id()
  • DTB_PMIC_MODEL: pmic_rev->PMIC_MODEL == board_pmic_target(i)->PMIC_MODEL
  • DTB_PANEL_TYPE: board_hw_subtype->panel == target_get_hlos_subtype()->panel
  • DTB_BOOT_DEVICE: board_hw_subtype->bootdev == target_get_hlos_subtype()->bootdev

if a exact match for a type can't be found, the biggest one with <=exact-value is used

  • DTB_SOC: soc_rev == board_soc_version()
  • DTB_MAJOR_MINOR: variant_id->major,minor == board_target_id()->major,minor
  • DTB_PMIC*: pmic_rev[i]->major,minor == board_pmic_target(i)->major,minor

Clone this wiki locally