From 5cb1d71e3a7df35dab18af6e246d1b84f1fc6a77 Mon Sep 17 00:00:00 2001 From: snlavaise Date: Tue, 8 Sep 2026 14:01:42 -0300 Subject: [PATCH] device-motorola-rtwo: enrich device tree from Motorola downstream Cross-referenced the LineageOS 23.2 sources (android_device_motorola_rtwo, sm8550-common, sm8550-devicetrees) and the DTB dumped from the device: - Fix debug UART: it is GENI SE7 under qupv3_id_0 (@ac0000), not qupv3_id_1. - Add ramoops (0xae000000/0x60000) and a cont_splash reserved region (0xb8000000), both matching the stock reserved-memory map. - Add a simple-framebuffer at 0xb8000000 (1080x2400) so there is an early console on the panel; deviceinfo screen size corrected to 1080x2400. - Goodix GT9916 touchscreen on spi4 (SE4), reset TLMM24 / irq TLMM25, avdd = pm8550 L9B, vddio = pm8550 L10B (new rails L8B/L10B added). - gpio-keys: volume-up on pm8550 GPIO6; enable PMIC pwrkey + resin (volume-down). - SD card: real card-detect on pm8550 GPIO12, vqmmc = L8B. - modules-initfs: add goodix-berlin + eusb2 phy modules. Panel/DRM, GPU, modem, WiFi/BT (WCN7850), charger and camera are documented as TODO in the .dts. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01QF5HebjUsRaxbW4cBX6HJP --- device/testing/device-motorola-rtwo/APKBUILD | 4 +- .../testing/device-motorola-rtwo/deviceinfo | 22 +-- .../device-motorola-rtwo/modules-initfs | 26 +-- .../linux-postmarketos-qcom-sm8550/APKBUILD | 3 +- .../sm8550-motorola-rtwo.dts | 148 +++++++++++++++--- 5 files changed, 158 insertions(+), 45 deletions(-) diff --git a/device/testing/device-motorola-rtwo/APKBUILD b/device/testing/device-motorola-rtwo/APKBUILD index 37b96775d..f83a5a122 100644 --- a/device/testing/device-motorola-rtwo/APKBUILD +++ b/device/testing/device-motorola-rtwo/APKBUILD @@ -36,6 +36,6 @@ package() { } sha512sums=" -2dee03e8320880337767f0f6523c2f85ba24940a4499ea6f470a7e1655e7c6e69122018daa03ddbba34b5302dc5f40ae48a7bcabfb9aedcfab10b112227e3052 deviceinfo -977b5009bf750b3ff1419afc9ccb6a955f79c62f0bddd07af9f75a687a939eddda5c697b38a29ad8fea172693506dd353ce0b01bedd4dac72b105c060c343188 modules-initfs +32c5054a403dc98169061e7aae2bab06b014089f7563ab65515923b1b07ead8832476107f87ecbd94575c69c92ea91eef6db9effe788b0b71e893cfb62e8963b deviceinfo +c572e21cb0624b554a22a218b0c4faab9b6412654bed6bfef530f3068d076b21c573bd7f4b3ca65f510f8756f636a861191cce925ef49587db7d68d09558826c modules-initfs " diff --git a/device/testing/device-motorola-rtwo/deviceinfo b/device/testing/device-motorola-rtwo/deviceinfo index 36bb3d1be..b911cdca6 100644 --- a/device/testing/device-motorola-rtwo/deviceinfo +++ b/device/testing/device-motorola-rtwo/deviceinfo @@ -15,13 +15,15 @@ deviceinfo_arch="aarch64" deviceinfo_chassis="handset" deviceinfo_keyboard="false" deviceinfo_external_storage="true" -deviceinfo_screen_width="1220" -deviceinfo_screen_height="2712" +deviceinfo_screen_width="1080" +deviceinfo_screen_height="2400" deviceinfo_getty="ttyMSM0;115200" -# The panel is not described in the device tree yet, so there is no display -# output. Flip this to "false" once mdss_dsi0 + a panel node work. -deviceinfo_no_framebuffer="true" +# The DTS ships a simple-framebuffer pointing at the bootloader's continuous +# splash buffer, so there should be an early console on the panel. If the +# screen stays black, set this to "true" (and fix the framebuffer@ node). +# There is no DRM/mdss yet, so no mode setting / backlight control. +deviceinfo_no_framebuffer="false" # Bootloader related deviceinfo_flash_method="fastboot" @@ -35,8 +37,10 @@ deviceinfo_flash_sparse="true" # UFS storage deviceinfo_rootfs_image_sector_size="4096" -# A/B + dynamic (super) partitions. Fill in the 'super' block device once -# known (from the initramfs debug shell: +# A/B device (androidboot.slot_suffix=_a). UFS controller: 1d84000.ufshc. +# Dynamic "super" partition (group "mot_dp_group", ~9.94 GB) holds +# system/system_ext/product/vendor/vendor_dlkm/system_dlkm. Resolve the real +# node from the initramfs debug shell: # ls -l /dev/disk/by-partlabel/super -# ), then uncomment: -# deviceinfo_super_partitions="/dev/sda1 /dev/sda1" +# then uncomment (both fields = the super partition, A and B share it here): +# deviceinfo_super_partitions="/dev/disk/by-partlabel/super /dev/disk/by-partlabel/super" diff --git a/device/testing/device-motorola-rtwo/modules-initfs b/device/testing/device-motorola-rtwo/modules-initfs index 06555a36d..10009958e 100644 --- a/device/testing/device-motorola-rtwo/modules-initfs +++ b/device/testing/device-motorola-rtwo/modules-initfs @@ -1,12 +1,16 @@ # Modules to include in the initramfs (one name per line, '#' = comment). -# Needed for: USB networking + telnet debug-shell, and later FDE unlock -# (touchscreen + panel). -# -# Most of the SM8550 USB gadget path is built-in with the postmarketOS -# kernel config, so nothing is strictly required yet. Add modules here as -# the port progresses, e.g.: -# -# phy-qcom-eusb2-repeater -# phy-qcom-qmp-combo -# panel-- -# +# Needed for USB networking + telnet debug-shell now, and touchscreen-based +# FDE unlock later. + +# Touchscreen (Goodix GT9916 on SPI SE4) - for on-screen unlock +spi-geni-qcom +goodix-berlin-core +goodix-berlin-spi + +# USB gadget path (usually built-in, harmless if already so) +phy-qcom-eusb2-repeater +phy-qcom-snps-eusb2 + +# Panel / DRM are not wired up yet: +# panel driver for Novatek NT37705 (1080x2400 DSC cmd, reset TLMM133) +# msm (once &mdss / &mdss_dsi0 are enabled in the .dts) diff --git a/device/testing/linux-postmarketos-qcom-sm8550/APKBUILD b/device/testing/linux-postmarketos-qcom-sm8550/APKBUILD index bc858a920..5fa0b0cf6 100644 --- a/device/testing/linux-postmarketos-qcom-sm8550/APKBUILD +++ b/device/testing/linux-postmarketos-qcom-sm8550/APKBUILD @@ -104,5 +104,6 @@ package() { # The kernel tarball checksum is filled in by # 'pmbootstrap checksum linux-postmarketos-qcom-sm8550' (it downloads ~250 MB). sha512sums=" -ed1e3a57c30dff3f40026c2e318965fa7f62dfb0eef428ee0354341137bffde324f93cf5a500619e476e44ac616351ac9cafec6dc3ecefa69b68f24b9c94bbb2 sm8550-motorola-rtwo.dts +19f6d0ee8481e34b0b8c27f07f3023182cda9e2a3d67e40989b1f300b7e82d7ea606fb112599dd9399e0d5f973d43b289d8932a4b578b6ffe4168af05e19f795 linux-postmarketos-qcom-sm8550-22591bbc21da5cc0c6e37503b77bd2d852fe241c.tar.gz +ae0883f072ee106a8e5512240968312ea044d05151945924cd2f0db42a22d149fa0511511a2a3e2bba3d77b0c01e046ce3d5b9d01d6bdd148dd1c0edac85423a sm8550-motorola-rtwo.dts " diff --git a/device/testing/linux-postmarketos-qcom-sm8550/sm8550-motorola-rtwo.dts b/device/testing/linux-postmarketos-qcom-sm8550/sm8550-motorola-rtwo.dts index 0ce6fbd09..f09f2d1cd 100644 --- a/device/testing/linux-postmarketos-qcom-sm8550/sm8550-motorola-rtwo.dts +++ b/device/testing/linux-postmarketos-qcom-sm8550/sm8550-motorola-rtwo.dts @@ -1,24 +1,35 @@ // SPDX-License-Identifier: BSD-3-Clause /* - * Motorola Moto Edge 40 Pro / Razr 40 Ultra platform (codename "rtwo"), SM8550 + * Motorola Moto Edge 40 Pro (codename "rtwo"), SM8550 / Snapdragon 8 Gen 2 * - * WIP bring-up device tree for postmarketOS. This is NOT a finished port: - * - The regulator tree below is copied from sm8550-mtp.dts (the Qualcomm - * reference design). Verify every rail against Motorola's downstream - * (LineageOS: kernel/motorola/sm8550, arch/arm64/boot/dts/vendor/qcom/*rtwo*). - * - reserved-memory / memory@ is left to the bootloader. If the board hangs - * early, add the carveouts from the downstream DT (cont_splash, ramoops, - * adsp/cdsp/mpss/... regions). - * - Display panel, touchscreen, WiFi/BT, NFC, modem, charger/fuel-gauge, - * haptics and the GPU zap shader still need to be described. + * WIP mainline bring-up device tree for postmarketOS. * - * Goal of this file as-is: reach the postmarketOS initramfs debug shell over - * USB (and the UART if you have a cable), then iterate. + * Hardware facts gathered from the stock LineageOS 23.2 sources and the live + * DTB dumped from the device: + * - board-id / model "rtwo", XT2301-x, PVT, UFS (KIOXIA 256 GB) at 1d84000 + * - debug UART: GENI SE7 @ac0000/a9c000 -> mainline &uart7 (qupv3_id_0) + * - touchscreen: Goodix GT9916 on SPI SE4 (spi@a90000 -> &spi4), + * reset TLMM24, irq TLMM25, avdd = pm8550 L9B, iovdd = pm8550 L10B + * - keys: volume-up on pm8550 GPIO6, volume-down = PMIC resin, power = pwrkey + * - SD card: sdhc_2, CD on pm8550 GPIO12, vmmc L9B, vqmmc L8B + * - panel: CSOT/Tianma Novatek NT37705 / NT37701A, 1080x2400 DSC cmd-mode, + * reset TLMM133, vdd L11B (1.23-1.28 V), vci L13B (3.0 V), vddio 1.8 V + * - cont_splash framebuffer at 0xb8000000 + * - haptics: pm8550b (SoundWire), speakers: 2x WSA883x, WiFi/BT: WCN7850 "kiwi" + * + * Still TODO before this is a real port: DSI panel driver + &mdss, GPU zap + * shader, modem/remoteprocs, WiFi/BT (PCIe), charger (pmic-glink battmgr), + * NFC, fingerprint, camera (external wl2868c LDO on the i2c hub). + * + * Immediate goal: initramfs debug shell over USB (+ UART if wired), pstore + * console via ramoops, and ideally the bootloader framebuffer. */ /dts-v1/; #include +#include +#include #include #include "sm8550.dtsi" @@ -39,14 +50,58 @@ }; chosen { + #address-cells = <2>; + #size-cells = <2>; + ranges; + stdout-path = "serial0:115200n8"; /* - * TODO: a simple-framebuffer node pointing at the bootloader - * framebuffer would give an early console on the panel. The - * base address / geometry must come from the downstream DT or - * from 'fastboot oem' / the LK log. + * Bootloader continuous-splash framebuffer. Geometry is a best + * guess (1080x2400, 32bpp) from the stock cont_splash / + * disp_rdump region. If the display stays black or garbled, + * adjust format/stride or drop this node. */ + framebuffer0: framebuffer@b8000000 { + compatible = "simple-framebuffer"; + reg = <0x0 0xb8000000 0x0 (1080 * 2400 * 4)>; + width = <1080>; + height = <2400>; + stride = <(1080 * 4)>; + format = "a8r8g8b8"; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + + pinctrl-0 = <&vol_up_n>; + pinctrl-names = "default"; + + key-volume-up { + label = "Volume Up"; + gpios = <&pm8550_gpios 6 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <15>; + linux,can-disable; + wakeup-source; + }; + }; + + reserved-memory { + /* Bootloader crash/console log ring, kept across reboots */ + ramoops@ae000000 { + compatible = "ramoops"; + reg = <0x0 0xae000000 0x0 0x60000>; + console-size = <0x40000>; + record-size = <0x20000>; + no-map; + }; + + cont_splash_mem: cont-splash@b8000000 { + reg = <0x0 0xb8000000 0x0 0x2b00000>; + no-map; + }; }; vph_pwr: vph-pwr-regulator { @@ -61,7 +116,11 @@ }; &apps_rsc { - /* Copied from sm8550-mtp.dts - VERIFY against Motorola downstream */ + /* + * PM8550-family RPMh regulators. The rail *definitions* are the SM8550 + * reference-design values (from sm8550-mtp.dts); the consumer wiring + * (touch, SD, panel, UFS) is taken from the Motorola downstream DT. + */ regulators-0 { compatible = "qcom,pm8550-rpmh-regulators"; qcom,pmic-id = "b"; @@ -131,7 +190,7 @@ vreg_l8b_1p8: ldo8 { regulator-name = "vreg_l8b_1p8"; regulator-min-microvolt = <1800000>; - regulator-max-microvolt = <3008000>; + regulator-max-microvolt = <2960000>; regulator-initial-mode = ; }; @@ -142,6 +201,13 @@ regulator-initial-mode = ; }; + vreg_l10b_1p8: ldo10 { + regulator-name = "vreg_l10b_1p8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-initial-mode = ; + }; + vreg_l11b_1p2: ldo11 { regulator-name = "vreg_l11b_1p2"; regulator-min-microvolt = <1200000>; @@ -383,24 +449,62 @@ }; }; +&pm8550_gpios { + vol_up_n: volume-up-n-state { + pins = "gpio6"; + function = "normal"; + bias-pull-up; + input-enable; + power-source = <1>; + }; +}; + &pm8550b_eusb2_repeater { vdd18-supply = <&vreg_l15b_1p8>; vdd3-supply = <&vreg_l5b_3p1>; }; -/* GENI QUP wrapper that hosts the debug UART (uart7) */ -&qupv3_id_1 { +&pon_pwrkey { status = "okay"; }; +&pon_resin { + linux,code = ; + status = "okay"; +}; + +/* GENI QUP0 wrapper: hosts the debug UART (SE7) and the touch SPI (SE4) */ +&qupv3_id_0 { + status = "okay"; +}; + +&spi4 { + status = "okay"; + + touchscreen@0 { + compatible = "goodix,gt9916"; + reg = <0>; + spi-max-frequency = <15000000>; + + interrupt-parent = <&tlmm>; + interrupts = <25 IRQ_TYPE_LEVEL_LOW>; + reset-gpios = <&tlmm 24 GPIO_ACTIVE_LOW>; + + avdd-supply = <&vreg_l9b_2p9>; + vddio-supply = <&vreg_l10b_1p8>; + + touchscreen-size-x = <1080>; + touchscreen-size-y = <2400>; + }; +}; + &sdhc_2 { + cd-gpios = <&pm8550_gpios 12 GPIO_ACTIVE_LOW>; vmmc-supply = <&vreg_l9b_2p9>; vqmmc-supply = <&vreg_l8b_1p8>; bus-width = <4>; no-sdio; no-mmc; - /* TODO: card-detect gpio from downstream DT */ - broken-cd; status = "okay"; };