From f1106794b07f5bb2de5a9e764a869d1bb99533d9 Mon Sep 17 00:00:00 2001 From: Kirill Yatsenko Date: Fri, 3 Apr 2026 12:43:50 +0200 Subject: [PATCH 01/15] Add Docker support for building SD card image - Complete Dockerfile with all build dependencies (debootstrap, qemu-user-static) - Add docker-compose.yml for easy build orchestration with privileged mode - Add .dockerignore to exclude build outputs from Docker context - Fix debootstrap function name conflict causing infinite loop in Docker - Replace sudo calls with MAYBE_SUDO variable (skipped when running as root) - Update README with Docker build instructions --- .dockerignore | 5 ++++ Dockerfile | 20 ++++++++++++--- README.md | 20 ++++++++++++++- build-image.sh | 64 +++++++++++++++++++++++++--------------------- docker-compose.yml | 8 ++++++ 5 files changed, 83 insertions(+), 34 deletions(-) create mode 100644 .dockerignore create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..9668c64 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +.git +debootstrap +debootstrap-prefetched +deploy +toolchain/extracted diff --git a/Dockerfile b/Dockerfile index c73ba8d..8c2c461 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,13 @@ FROM ubuntu:noble -RUN apt-get update +ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get install -y \ +RUN apt-get update && apt-get install -y --no-install-recommends \ sudo \ wget \ + curl \ + ca-certificates \ + git \ bc \ bison \ build-essential \ @@ -16,11 +19,20 @@ RUN apt-get install -y \ python3-setuptools \ swig \ uuid-dev \ - build-essential \ python3-cryptography \ python3-pyelftools \ - build-essential \ device-tree-compiler \ dosfstools \ genimage \ mtools \ + debootstrap \ + qemu-user-static \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /build + +COPY . . + +RUN chmod +x build-image.sh + +ENTRYPOINT ["./build-image.sh"] diff --git a/README.md b/README.md index e602779..000c8bc 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,25 @@ design and features are expected. git submodule update --init --recursive --depth 1 ``` -2. Prefetch debootstrap on first run to speed next iterations +### Using Docker (recommended) + +No need to install dependencies on the host or provide sudo password. + +2. Prefetch debootstrap on first run to speed up next iterations + +``` +docker compose run build --prefetch-debootstrap +``` + +3. Build SD card image + +``` +docker compose run build --use-prefetch-debootstrap +``` + +### Using host directly + +2. Prefetch debootstrap on first run to speed up next iterations ``` sudo ./build-image.sh --prefetch-debootstrap diff --git a/build-image.sh b/build-image.sh index f39e93f..c477c26 100755 --- a/build-image.sh +++ b/build-image.sh @@ -3,6 +3,12 @@ set -e # exit on error # set -x # debug +if [ "$(id -u)" -eq 0 ]; then + MAYBE_SUDO="" +else + MAYBE_SUDO="sudo" +fi + readonly TOOLCHAIN_NAME="x86_64-gcc-11.3.0-nolibc-arm-linux-gnueabi.tar.xz" readonly TOOLCHAIN_EXTRACTED_PATH="gcc-11.3.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-" readonly TFA_DIR="board/tfa/trusted-firmware-a-v2.10.19" @@ -69,7 +75,7 @@ build_tfa() { } run_in_chroot() { - sudo chroot ${DEBOOTSTRAP_DIR} /usr/bin/qemu-arm-static /bin/sh -c "$1" + $MAYBE_SUDO chroot ${DEBOOTSTRAP_DIR} /usr/bin/qemu-arm-static /bin/sh -c "$1" } mount_vfs() { @@ -86,21 +92,21 @@ umount_vfs() { run_in_chroot "umount /proc" } -debootstrap() { +run_debootstrap() { echo "-I starting debootstrap" - sudo umount ${DEBOOTSTRAP_DIR}/proc ${DEBOOTSTRAP_DIR}/sys || true - sudo rm -rf ${DEBOOTSTRAP_DIR} + $MAYBE_SUDO umount ${DEBOOTSTRAP_DIR}/proc ${DEBOOTSTRAP_DIR}/sys || true + $MAYBE_SUDO rm -rf ${DEBOOTSTRAP_DIR} - sudo debootstrap --arch=armhf --foreign trixie ${DEBOOTSTRAP_DIR} - sudo cp /usr/bin/qemu-arm-static ${DEBOOTSTRAP_DIR}/usr/bin + $MAYBE_SUDO command debootstrap --arch=armhf --foreign trixie ${DEBOOTSTRAP_DIR} + $MAYBE_SUDO cp /usr/bin/qemu-arm-static ${DEBOOTSTRAP_DIR}/usr/bin run_in_chroot "/debootstrap/debootstrap --second-stage" } save_debootstrap_prefetched() { - sudo rm -rf ${DEBOOTSTRAP_PREFETCHED_DIR} - sudo cp -r -p ${DEBOOTSTRAP_DIR} ${DEBOOTSTRAP_PREFETCHED_DIR} + $MAYBE_SUDO find ${DEBOOTSTRAP_PREFETCHED_DIR} -mindepth 1 -delete 2>/dev/null || true + $MAYBE_SUDO cp -a ${DEBOOTSTRAP_DIR}/. ${DEBOOTSTRAP_PREFETCHED_DIR}/ } install_apt_packages() { @@ -145,47 +151,47 @@ install_apt_packages() { install_overlays() { echo "-I installing files overlays" - sudo install --verbose --owner=root --group=root --mode=777 \ + $MAYBE_SUDO install --verbose --owner=root --group=root --mode=777 \ overlay/network/etc/resolv.conf ${DEBOOTSTRAP_DIR}/etc/resolv.conf - sudo install --verbose --owner=root --group=root --mode=664 \ + $MAYBE_SUDO install --verbose --owner=root --group=root --mode=664 \ overlay/sway/usr/lib/systemd/system/sway.service \ ${DEBOOTSTRAP_DIR}/usr/lib/systemd/system/sway.service - sudo install --verbose -D --owner=root --group=root --mode=644 \ + $MAYBE_SUDO install --verbose -D --owner=root --group=root --mode=644 \ overlay/weston/etc/xdg/weston/weston.ini \ ${DEBOOTSTRAP_DIR}/etc/xdg/weston/weston.ini - sudo install --verbose -D --owner=root --group=root --mode=644 \ + $MAYBE_SUDO install --verbose -D --owner=root --group=root --mode=644 \ overlay/weston/usr/lib/systemd/user/weston.service \ ${DEBOOTSTRAP_DIR}/usr/lib/systemd/user/weston.service - sudo install --verbose -D --owner=root --group=root --mode=644 \ + $MAYBE_SUDO install --verbose -D --owner=root --group=root --mode=644 \ overlay/weston/usr/lib/systemd/user/weston.socket \ ${DEBOOTSTRAP_DIR}/usr/lib/systemd/user/weston.socket - sudo install --verbose -D --owner=root --group=root --mode=644 \ + $MAYBE_SUDO install --verbose -D --owner=root --group=root --mode=644 \ overlay/weston/usr/lib/systemd/system/weston-graphical-session.service \ ${DEBOOTSTRAP_DIR}/usr/lib/systemd/system/weston-graphical-session.service } install_opengles_lib() { echo "-I install opengles lib" - sudo install --verbose board/opengles-lib/* ${DEBOOTSTRAP_DIR}/lib || true + $MAYBE_SUDO install --verbose board/opengles-lib/* ${DEBOOTSTRAP_DIR}/lib || true } install_wifi_firmware() { echo "-I install wifi firmware" - sudo install --verbose -D --owner=root --group=root --mode=644 \ + $MAYBE_SUDO install --verbose -D --owner=root --group=root --mode=644 \ board/wifi-firmware/brcmfmac43430-sdio.txt \ ${DEBOOTSTRAP_DIR}/lib/firmware/brcm/brcmfmac43430-sdio.st,stm32mp157c-dk2.txt - sudo install --verbose -D --owner=root --group=root --mode=644 \ + $MAYBE_SUDO install --verbose -D --owner=root --group=root --mode=644 \ board/wifi-firmware/cyfmac43430-sdio.bin \ ${DEBOOTSTRAP_DIR}/lib/firmware/brcm/brcmfmac43430-sdio.bin - sudo install --verbose -D --owner=root --group=root --mode=644 \ + $MAYBE_SUDO install --verbose -D --owner=root --group=root --mode=644 \ board/wifi-firmware/cyfmac43430-sdio.1DX.clm_blob \ ${DEBOOTSTRAP_DIR}/lib/firmware/brcm/brcmfmac43430-sdio.clm_blob } @@ -252,20 +258,20 @@ setup_extlinux() { install_kernel_image() { echo "-I install kernel image" - sudo install --verbose --owner=root --group=root --mode=644 \ + $MAYBE_SUDO install --verbose --owner=root --group=root --mode=644 \ ${KERNEL_DIR}/arch/arm/boot/zImage ${DEBOOTSTRAP_DIR}/boot/vmlinuz-${KERNEL_VERSION} } install_kernel_modules() { echo "-I install kernel modules" - sudo make -C ${KERNEL_DIR} ARCH=arm CROSS_COMPILE=${CC} modules_install \ + $MAYBE_SUDO make -C ${KERNEL_DIR} ARCH=arm CROSS_COMPILE=${CC} modules_install \ INSTALL_MOD_PATH="../../../${DEBOOTSTRAP_DIR}/usr" } install_device_tree() { echo "-I install device tree" run_in_chroot "mkdir -p boot/dtbs/${KERNEL_VERSION}" - sudo make -C ${KERNEL_DIR} ARCH=arm CROSS_COMPILE=${CC} dtbs_install \ + $MAYBE_SUDO make -C ${KERNEL_DIR} ARCH=arm CROSS_COMPILE=${CC} dtbs_install \ INSTALL_DTBS_PATH="../../../${DEBOOTSTRAP_DIR}/boot/dtbs/${KERNEL_VERSION}" } @@ -288,15 +294,15 @@ use_prefetched_download() { echo "Run this script with '-p|--prefetch-debootstrap' option first" exit 1 fi - sudo umount ${DEBOOTSTRAP_DIR}/proc ${DEBOOTSTRAP_DIR}/sys || true - sudo rm -rf ${DEBOOTSTRAP_DIR} - sudo cp -p -r ${DEBOOTSTRAP_PREFETCHED_DIR} ${DEBOOTSTRAP_DIR} + $MAYBE_SUDO umount ${DEBOOTSTRAP_DIR}/proc ${DEBOOTSTRAP_DIR}/sys || true + $MAYBE_SUDO rm -rf ${DEBOOTSTRAP_DIR} + $MAYBE_SUDO cp -p -r ${DEBOOTSTRAP_PREFETCHED_DIR} ${DEBOOTSTRAP_DIR} } create_rootfs_ext4() { - sudo rm -rf ${DEPLOY_DIR} && mkdir -p ${DEPLOY_DIR} - sudo dd if=/dev/zero of=${DEPLOY_DIR}/rootfs.ext4 bs=1 count=0 seek=2500M - sudo mkfs.ext4 -F ${DEPLOY_DIR}/rootfs.ext4 -d ${DEBOOTSTRAP_DIR} + $MAYBE_SUDO rm -rf ${DEPLOY_DIR} && mkdir -p ${DEPLOY_DIR} + $MAYBE_SUDO dd if=/dev/zero of=${DEPLOY_DIR}/rootfs.ext4 bs=1 count=0 seek=2500M + $MAYBE_SUDO mkfs.ext4 -F ${DEPLOY_DIR}/rootfs.ext4 -d ${DEBOOTSTRAP_DIR} } generate_sdcard_img() { @@ -385,7 +391,7 @@ start_image_build() { # Prefetch debootstrap and install apt packages if [ "${prefetch_debootstrap}" = true ] ; then - debootstrap + run_debootstrap mount_vfs install_apt_packages umount_vfs @@ -396,7 +402,7 @@ start_image_build() { if [ "${use_prefetched_debootstrap}" = true ] ; then use_prefetched_download else - debootstrap + run_debootstrap fi mount_vfs diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..90b0f42 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +services: + build: + build: . + privileged: true + volumes: + - ./deploy:/build/deploy + - ./debootstrap-prefetched:/build/debootstrap-prefetched + command: ["--use-prefetch-debootstrap"] From d6cf55214129efdea5a0066e26e7f00f95d21d8d Mon Sep 17 00:00:00 2001 From: Kirill Yatsenko Date: Fri, 3 Apr 2026 14:28:35 +0200 Subject: [PATCH 02/15] Add decktrix-v1 custom PCB build target Add support for the Decktrix v1 custom PCB based on STM32MP157F with the same RAM as the Discovery Kit but different pinout and peripherals. Key pin differences from DK2 devboard (from schematics): Component | Devboard (DK2) | Decktrix PCB -------------------|----------------|------------- PMIC I2C4 SCL | PZ4 | PD12 (AF4) PMIC I2C4 SDA | PZ5 | PD13 (AF4) LCD reset | PE4 | PD11 LCD backlight | PA15 | PF6 Touch IRQ | PF2 | PG7 Touch reset | PF4 | PE10 BT UART | USART2 (PA2/3) | UART7 (PE7/8) BT shutdown | PZ6 | PB10 WiFi reset | PH4 | PE6 Changes per component: - Kernel: new decktrix-v1.dts with custom I2C4 pinctrl, Jadard display and touch with board-specific GPIOs, BT on UART7 without RTS/CTS - TF-A: decktrix-v1.dts and fw-config with I2C4 pinctrl override for STPMIC1 on PD12/PD13, same DDR/clock config as DK2 - U-Boot: decktrix-v1.dts with DSI disabled and I2C4 pinctrl override, plus u-boot.dtsi overlay for binman/DDR/clocks Usage: docker compose run build --variant decktrix --prefetch-debootstrap docker compose run build --variant decktrix --use-prefetch-debootstrap --- ...-device-tree-for-decktrix-custom-PCB.patch | 219 ++++++++++++++++++ board/tfa/decktrix-v1-fw-config.dts | 7 + board/tfa/decktrix-v1.dts | 51 ++++ board/u-boot/decktrix-v1-u-boot.dtsi | 6 + board/u-boot/decktrix-v1.dts | 55 +++++ build-image.sh | 40 +++- 6 files changed, 371 insertions(+), 7 deletions(-) create mode 100644 board/linux/patches/0006-dts-Add-device-tree-for-decktrix-custom-PCB.patch create mode 100644 board/tfa/decktrix-v1-fw-config.dts create mode 100644 board/tfa/decktrix-v1.dts create mode 100644 board/u-boot/decktrix-v1-u-boot.dtsi create mode 100644 board/u-boot/decktrix-v1.dts diff --git a/board/linux/patches/0006-dts-Add-device-tree-for-decktrix-custom-PCB.patch b/board/linux/patches/0006-dts-Add-device-tree-for-decktrix-custom-PCB.patch new file mode 100644 index 0000000..cf2a511 --- /dev/null +++ b/board/linux/patches/0006-dts-Add-device-tree-for-decktrix-custom-PCB.patch @@ -0,0 +1,219 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Kirill Yatsenko +Date: Thu, 03 Apr 2026 13:00:00 +0200 +Subject: dts: Add device tree for decktrix custom PCB + +The decktrix board is based on STM32MP157F with the same RAM as the +Discovery Kit but uses a different pinout and peripherals: + +- Jadard JD9365TN display (different reset/backlight GPIOs) +- Jadard touch controller on I2C1 (different IRQ/reset GPIOs) +- Cypress CYW43438 WiFi/BT (different reset/shutdown GPIOs) +- BT on UART7 instead of USART2 (no RTS/CTS) +- STPMIC1 PMIC on I2C4 at PD12/PD13 instead of PZ4/PZ5 + +Signed-off-by: Kirill Yatsenko +--- + arch/arm/boot/dts/st/Makefile | 1 + + arch/arm/boot/dts/st/decktrix-v1.dts | 163 ++++++++++++++++++++++++ + 2 files changed, 164 insertions(+) + create mode 100644 arch/arm/boot/dts/st/decktrix-v1.dts + +diff --git a/arch/arm/boot/dts/st/Makefile b/arch/arm/boot/dts/st/Makefile +index 75346d084d2d..8b3d8d4c9e1f 100644 +--- a/arch/arm/boot/dts/st/Makefile ++++ b/arch/arm/boot/dts/st/Makefile +@@ -62,6 +62,7 @@ dtb-$(CONFIG_ARCH_STM32) += \ + stm32mp157c-dk2.dtb \ + stm32mp157c-dk2-scmi.dtb \ + stm32mp157c-dk2-jadard.dtb \ ++ decktrix-v1.dtb \ + stm32mp157c-ed1.dtb \ + stm32mp157c-ed1-scmi.dtb \ + stm32mp157c-emsbc-argon.dtb \ +diff --git a/arch/arm/boot/dts/st/decktrix-v1.dts b/arch/arm/boot/dts/st/decktrix-v1.dts +new file mode 100644 +index 000000000000..000000000000 +--- /dev/null ++++ b/arch/arm/boot/dts/st/decktrix-v1.dts +@@ -0,0 +1,163 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) ++/* ++ * Copyright (C) Decktrix Lab ++ * Author: Kirill Yatsenko ++ * ++ * Decktrix v1 custom PCB based on STM32MP157F. ++ * Same SoC and RAM as STM32MP157F-DK2 but with custom pinout: ++ * - Jadard JD9365TN display (different reset/backlight GPIOs) ++ * - Jadard touch on I2C1 (different IRQ/reset GPIOs) ++ * - Cypress CYW43438 WiFi/BT (different control GPIOs) ++ * - BT on UART7 (no RTS/CTS) ++ * - STPMIC1 PMIC on I2C4 at PD12/PD13 (not PZ4/PZ5) ++ */ ++ ++/dts-v1/; ++ ++#include "stm32mp157.dtsi" ++#include "stm32mp15xc.dtsi" ++#include "stm32mp15-pinctrl.dtsi" ++#include "stm32mp15xxac-pinctrl.dtsi" ++#include "stm32mp15xx-dkx.dtsi" ++ ++/ { ++ model = "Decktrix v1"; ++ compatible = "decktrix,v1", "st,stm32mp157"; ++ ++ aliases { ++ ethernet0 = ðernet0; ++ serial3 = &uart7; ++ }; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ wifi_pwrseq: wifi-pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ reset-gpios = <&gpioe 6 GPIO_ACTIVE_LOW>; ++ }; ++}; ++ ++&cryp1 { ++ status = "okay"; ++}; ++ ++&dsi { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ /* Jadard JD9365TN 480x1080 MIPI DSI panel */ ++ panel@0 { ++ compatible = "shenzen,z34014p30365ty1", "jadard,jd9365tn"; ++ reg = <0>; ++ reset-gpios = <&gpiod 11 GPIO_ACTIVE_HIGH>; ++ backlight-gpios = <&gpiof 6 GPIO_ACTIVE_HIGH>; ++ status = "okay"; ++ ++ port { ++ panel_in: endpoint { ++ remote-endpoint = <&dsi_out>; ++ }; ++ }; ++ }; ++}; ++ ++&dsi_in { ++ remote-endpoint = <<dc_ep1_out>; ++}; ++ ++&dsi_out { ++ remote-endpoint = <&panel_in>; ++}; ++ ++/* PMIC (STPMIC1) on I2C4: SCL=PD12, SDA=PD13 (AF4) */ ++&i2c4 { ++ pinctrl-0 = <&i2c4_pins_decktrix>; ++ pinctrl-1 = <&i2c4_sleep_pins_decktrix>; ++}; ++ ++&i2c1 { ++ jadard@68 { ++ compatible = "jadard,jdcommon"; ++ reg = <0x68>; ++ interrupts-extended = <&gpiog 7 IRQ_TYPE_EDGE_FALLING>; ++ jadard,panel-sense-nums = <30 48>; ++ jadard,panel-coords = <0 480 0 1080>; ++ jadard,panel-max-points = <10>; ++ jadard,int-is-edge = <1>; ++ jadard,irq-gpio = <&gpiog 7 GPIO_ACTIVE_HIGH>; ++ jadard,rst-gpio = <&gpioe 10 GPIO_ACTIVE_HIGH>; ++ status = "okay"; ++ }; ++}; ++ ++<dc { ++ status = "okay"; ++ ++ port { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ ltdc_ep1_out: endpoint@1 { ++ reg = <1>; ++ remote-endpoint = <&dsi_in>; ++ }; ++ }; ++}; ++ ++&pinctrl { ++ i2c4_pins_decktrix: i2c4-decktrix { ++ pins { ++ pinmux = , /* I2C4_SCL */ ++ ; /* I2C4_SDA */ ++ bias-disable; ++ drive-open-drain; ++ slew-rate = <0>; ++ }; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c4_sleep_pins_decktrix: i2c4-sleep-decktrix { ++ pins { ++ pinmux = , ++ ; ++ }; ++ }; ++}; ++ ++&rtc { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rtc_rsvd_pins_a>; ++ ++ rtc_lsco_pins_a: rtc-lsco-0 { ++ pins = "out2_rmp"; ++ function = "lsco"; ++ }; ++}; ++ ++/* Wifi */ ++&sdmmc2 { ++ pinctrl-names = "default", "opendrain", "sleep"; ++ pinctrl-0 = <&sdmmc2_b4_pins_a>; ++ pinctrl-1 = <&sdmmc2_b4_od_pins_a>; ++ pinctrl-2 = <&sdmmc2_b4_sleep_pins_a>; ++ non-removable; ++ cap-sdio-irq; ++ st,neg-edge; ++ bus-width = <4>; ++ vmmc-supply = <&v3v3>; ++ mmc-pwrseq = <&wifi_pwrseq>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ brcmf: wifi@1 { ++ reg = <1>; ++ compatible = "brcm,bcm4329-fmac"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rtc_lsco_pins_a>; ++ }; ++}; ++ ++/* Bluetooth - Cypress CYW43438 on UART7 (no RTS/CTS) */ ++&uart7 { ++ pinctrl-names = "default", "sleep"; ++ pinctrl-0 = <&uart7_pins_c>; ++ pinctrl-1 = <&uart7_sleep_pins_c>; ++ status = "okay"; ++ ++ bluetooth { ++ shutdown-gpios = <&gpiob 10 GPIO_ACTIVE_HIGH>; ++ compatible = "brcm,bcm43438-bt"; ++ max-speed = <3000000>; ++ vbat-supply = <&v3v3>; ++ vddio-supply = <&v3v3>; ++ }; ++}; +-- +2.43.0 diff --git a/board/tfa/decktrix-v1-fw-config.dts b/board/tfa/decktrix-v1-fw-config.dts new file mode 100644 index 0000000..346fc98 --- /dev/null +++ b/board/tfa/decktrix-v1-fw-config.dts @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) +/* + * Copyright (C) Decktrix Lab + */ + +#define DDR_SIZE 0x20000000 /* 512MB */ +#include "stm32mp15-fw-config.dtsi" diff --git a/board/tfa/decktrix-v1.dts b/board/tfa/decktrix-v1.dts new file mode 100644 index 0000000..e3ca8ed --- /dev/null +++ b/board/tfa/decktrix-v1.dts @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) +/* + * Copyright (C) Decktrix Lab + * Author: Kirill Yatsenko + * + * Decktrix v1 custom PCB based on STM32MP157F. + * Same DDR, clock, and PMIC (STPMIC1) as STM32MP157C-DK2 but + * PMIC I2C4 is on PD12/PD13 instead of PZ4/PZ5. + */ + +/dts-v1/; + +#include "stm32mp157.dtsi" +#include "stm32mp15xc.dtsi" +#include "stm32mp15-pinctrl.dtsi" +#include "stm32mp15xxac-pinctrl.dtsi" +#include "stm32mp15xx-dkx.dtsi" + +/ { + model = "Decktrix v1"; + compatible = "decktrix,v1", "st,stm32mp157"; + + aliases { + serial3 = &usart2; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; +}; + +&cryp1 { + status = "okay"; +}; + +/* PMIC (STPMIC1) on I2C4: SCL=PD12, SDA=PD13 (AF4) */ +&i2c4 { + pinctrl-0 = <&i2c4_pins_decktrix>; +}; + +&pinctrl { + i2c4_pins_decktrix: i2c4-decktrix { + pins { + pinmux = , + ; + bias-disable; + drive-open-drain; + slew-rate = <0>; + }; + }; +}; diff --git a/board/u-boot/decktrix-v1-u-boot.dtsi b/board/u-boot/decktrix-v1-u-boot.dtsi new file mode 100644 index 0000000..384f306 --- /dev/null +++ b/board/u-boot/decktrix-v1-u-boot.dtsi @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) +/* + * Copyright (C) Decktrix Lab + */ + +#include "stm32mp157a-dk1-u-boot.dtsi" diff --git a/board/u-boot/decktrix-v1.dts b/board/u-boot/decktrix-v1.dts new file mode 100644 index 0000000..e6f3fcb --- /dev/null +++ b/board/u-boot/decktrix-v1.dts @@ -0,0 +1,55 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) +/* + * Copyright (C) Decktrix Lab + * Author: Kirill Yatsenko + * + * Decktrix v1 custom PCB based on STM32MP157F. + * PMIC I2C4 is on PD12/PD13 instead of PZ4/PZ5. + * DSI disabled to avoid conflict with kernel Jadard driver. + */ + +/dts-v1/; + +#include "stm32mp157.dtsi" +#include "stm32mp15xc.dtsi" +#include "stm32mp15-pinctrl.dtsi" +#include "stm32mp15xxac-pinctrl.dtsi" +#include "stm32mp15xx-dkx.dtsi" + +/ { + model = "Decktrix v1"; + compatible = "decktrix,v1", "st,stm32mp157"; + + aliases { + ethernet0 = ðernet0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; +}; + +&cryp1 { + status = "okay"; +}; + +&dsi { + status = "disabled"; +}; + +/* PMIC (STPMIC1) on I2C4: SCL=PD12, SDA=PD13 (AF4) */ +&i2c4 { + pinctrl-0 = <&i2c4_pins_decktrix>; +}; + +&pinctrl { + i2c4_pins_decktrix: i2c4-decktrix { + pins { + pinmux = , + ; + bias-disable; + drive-open-drain; + slew-rate = <0>; + }; + }; +}; diff --git a/build-image.sh b/build-image.sh index c477c26..3186ea7 100755 --- a/build-image.sh +++ b/build-image.sh @@ -20,6 +20,10 @@ readonly DEPLOY_DIR="deploy" readonly STM32_DT="stm32mp157c-dk2.dtb" readonly STM32_JADARD_DT="stm32mp157c-dk2-jadard.dtb" +readonly DECKTRIX_DT="decktrix-v1.dtb" + +# Board DT name for TFA and U-Boot (differs for custom PCB) +BOARD_DT="stm32mp157c-dk2" prepare_toolchain() { echo "-I preparing toolchain for cross compilation" @@ -37,7 +41,8 @@ apply_kernel_patches() { board/linux/patches/0002-dts-Add-separate-device-tree-for-stm32-devboard-with.patch \ board/linux/patches/0003-display-Add-Jadard-MIPI-driver.patch \ board/linux/patches/0004-display-Add-Jadard-touch-driver.patch \ - board/linux/patches/0005-dts-Add-support-for-home-button.patch || true + board/linux/patches/0005-dts-Add-support-for-home-button.patch \ + board/linux/patches/0006-dts-Add-device-tree-for-decktrix-custom-PCB.patch || true } build_kernel() { @@ -57,20 +62,37 @@ build_uboot() { echo "-I start u-boot build" apply_uboot_patches + + if [ "${BOARD_DT}" = "decktrix-v1" ]; then + cp board/u-boot/decktrix-v1.dts ${UBOOT_DIR}/arch/arm/dts/ + cp board/u-boot/decktrix-v1-u-boot.dtsi ${UBOOT_DIR}/arch/arm/dts/ + # Add decktrix-v1 to the STM32MP15X DTB list if not already present + if ! grep -q "decktrix-v1" ${UBOOT_DIR}/arch/arm/dts/Makefile; then + sed -i '/stm32mp157c-dk2-scmi.dtb/a\\tdecktrix-v1.dtb \\' \ + ${UBOOT_DIR}/arch/arm/dts/Makefile + fi + fi + make -C ${UBOOT_DIR} CROSS_COMPILE=${CC} stm32mp15_trusted_defconfig - make -C ${UBOOT_DIR} CROSS_COMPILE=${CC} DEVICE_TREE=stm32mp157c-dk2 -j all + make -C ${UBOOT_DIR} CROSS_COMPILE=${CC} DEVICE_TREE=${BOARD_DT} -j all } build_tfa() { echo "-I start tfa build" + if [ "${BOARD_DT}" = "decktrix-v1" ]; then + cp board/tfa/decktrix-v1.dts ${TFA_DIR}/fdts/ + cp board/tfa/decktrix-v1-fw-config.dts ${TFA_DIR}/fdts/ + fi + make -C ${TFA_DIR} \ PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 CROSS_COMPILE=${CC} \ STM32MP_SDMMC=1 STM32MP_EMMC=1 \ AARCH32_SP=sp_min \ - DTB_FILE_NAME=stm32mp157c-dk2.dtb \ + DTB_FILE_NAME=${BOARD_DT}.dtb \ BL33_CFG=../../u-boot/u-boot-v2025.04/u-boot.dtb \ BL33=../../u-boot/u-boot-v2025.04/u-boot-nodtb.bin \ + STM32MP15=1 \ all fip } @@ -277,8 +299,9 @@ install_device_tree() { install_tfa() { echo "-I install TFA" - cp ${TFA_DIR}/build/stm32mp1/release/tf-a-stm32mp157c-dk2.stm32 \ - ${TFA_DIR}/build/stm32mp1/release/fip.bin ${DEPLOY_DIR} + cp ${TFA_DIR}/build/stm32mp1/release/tf-a-${BOARD_DT}.stm32 \ + ${DEPLOY_DIR}/tf-a-stm32mp157c-dk2.stm32 + cp ${TFA_DIR}/build/stm32mp1/release/fip.bin ${DEPLOY_DIR} } enable_serial_console() { @@ -329,7 +352,7 @@ print_help() { echo " -p, --prefetch-debootstrap downloads debian and saves the result" echo " -u, --use-prefetch-debootstrap use cached download folder" echo " -s, --skip skip tfa, u-boot and kernel builds" - echo " -v, --variant [stm32, stm32-jadard] select device variant" + echo " -v, --variant [stm32, stm32-jadard, decktrix] select device variant" } start_image_build() { @@ -357,8 +380,11 @@ start_image_build() { selected_dt=${STM32_DT} elif [ "$2" = "stm32-jadard" ]; then selected_dt=${STM32_JADARD_DT} + elif [ "$2" = "decktrix" ]; then + selected_dt=${DECKTRIX_DT} + BOARD_DT="decktrix-v1" else - echo "Invalid selected variant, valid are: [stm32, stm32-jadard]" + echo "Invalid selected variant, valid are: [stm32, stm32-jadard, decktrix]" exit 1 fi shift From 4fa24f4f983b3da19251d35c99c86080a69fde42 Mon Sep 17 00:00:00 2001 From: Kirill Yatsenko Date: Fri, 3 Apr 2026 20:30:16 +0200 Subject: [PATCH 03/15] Fix PMIC config, display power, and disable WiFi/BT for decktrix-v1 Changes: - Jadard driver: devm_gpiod_get -> devm_gpiod_get_optional for vdd/vccio/dbg (display powered by always-on PMIC regulators) - Kernel DTS: remove vdd/vccio GPIOs from panel node, override PMIC LDO1 to 2.8V (display AVDD) and LDO6 to 1.8V (display IOVCC), disable sdmmc2/uart7 (u-blox MAYA-W166 uses SDMMC3/UART8, TBD) - I2C4 pinctrl patches for kernel, U-Boot, TFA: change default pins from PZ4/PZ5 to PD12/PD13 (decktrix PCB wiring) - TFA DTS: LDO1 at 2.8V, LDO6 at 1.8V for display power - Simplified TFA/U-Boot DTS files (pinctrl handled by patches) Display power analysis from schematics: LDO1 (pin 23) -> 2V8 rail -> display AVDD (needs 2.8V, was 1.8V) LDO6 (pin 43) -> 1V8 rail -> display IOVCC (needs 1.8V, was 1.2V) Both regulators are always-on, display powered at boot. --- .../0003-display-Add-Jadard-MIPI-driver.patch | 24 +--- ...-device-tree-for-decktrix-custom-PCB.patch | 111 +++++------------- ...hange-I2C4-default-pins-to-PD12-PD13.patch | 40 +++++++ board/tfa/decktrix-v1.dts | 25 ++-- ...rix-Override-PMIC-LDO1-LDO6-voltages.patch | 54 +++++++++ ...hange-I2C4-default-pins-to-PD12-PD13.patch | 30 +++++ board/u-boot/decktrix-v1.dts | 18 --- ...hange-I2C4-default-pins-to-PD12-PD13.patch | 39 ++++++ build-image.sh | 21 +++- 9 files changed, 228 insertions(+), 134 deletions(-) create mode 100644 board/linux/patches/0009-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch create mode 100644 board/tfa/patches/0001-tfa-decktrix-Override-PMIC-LDO1-LDO6-voltages.patch create mode 100644 board/tfa/patches/0002-tfa-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch create mode 100644 board/u-boot/patches/0002-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch diff --git a/board/linux/patches/0003-display-Add-Jadard-MIPI-driver.patch b/board/linux/patches/0003-display-Add-Jadard-MIPI-driver.patch index b64de50..15b5a71 100644 --- a/board/linux/patches/0003-display-Add-Jadard-MIPI-driver.patch +++ b/board/linux/patches/0003-display-Add-Jadard-MIPI-driver.patch @@ -10,7 +10,7 @@ Signed-off-by: Kirill Yatsenko drivers/gpu/drm/panel/Kconfig | 8 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-jadard-jd9365tn.c | 489 ++++++++++++++++++ - 5 files changed, 506 insertions(+), 3 deletions(-) + 5 files changed, 494 insertions(+), 3 deletions(-) create mode 100644 drivers/gpu/drm/panel/panel-jadard-jd9365tn.c diff --git a/arch/arm/boot/dts/st/stm32mp157c-dk2-jadard.dts b/arch/arm/boot/dts/st/stm32mp157c-dk2-jadard.dts @@ -84,7 +84,7 @@ new file mode 100644 index 000000000000..2537338a081b --- /dev/null +++ b/drivers/gpu/drm/panel/panel-jadard-jd9365tn.c -@@ -0,0 +1,489 @@ +@@ -0,0 +1,477 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Author: @@ -500,25 +500,13 @@ index 000000000000..2537338a081b + } + + /* VDD pin is connected to power regulator enable pin on adapter board */ -+ jadard->vdd = devm_gpiod_get(dev, "vdd", GPIOD_OUT_LOW); -+ if (IS_ERR(jadard->vdd)) { -+ DRM_DEV_ERROR(&dsi->dev, "failed to get vdd GPIO\n"); -+ return PTR_ERR(jadard->vdd); -+ } ++ jadard->vdd = devm_gpiod_get_optional(dev, "vdd", GPIOD_OUT_LOW); + + /* VCCIO pin is connected to power regulator enable pin on adapter board */ -+ jadard->vccio = devm_gpiod_get(dev, "vccio", GPIOD_OUT_LOW); -+ if (IS_ERR(jadard->vccio)) { -+ DRM_DEV_ERROR(&dsi->dev, "failed to get vccio GPIO\n"); -+ return PTR_ERR(jadard->vccio); -+ } ++ jadard->vccio = devm_gpiod_get_optional(dev, "vccio", GPIOD_OUT_LOW); + -+ /* DBG pin is used for osciloscope debugging */ -+ jadard->dbg = devm_gpiod_get(dev, "dbg", GPIOD_OUT_HIGH); -+ if (IS_ERR(jadard->dbg)) { -+ DRM_DEV_ERROR(&dsi->dev, "failed to get dbg GPIO\n"); -+ return PTR_ERR(jadard->dbg); -+ } ++ /* DBG pin is used for oscilloscope debugging */ ++ jadard->dbg = devm_gpiod_get_optional(dev, "dbg", GPIOD_OUT_HIGH); + + drm_panel_init(&jadard->panel, dev, &jadard_funcs, + DRM_MODE_CONNECTOR_DSI); diff --git a/board/linux/patches/0006-dts-Add-device-tree-for-decktrix-custom-PCB.patch b/board/linux/patches/0006-dts-Add-device-tree-for-decktrix-custom-PCB.patch index cf2a511..4109cd7 100644 --- a/board/linux/patches/0006-dts-Add-device-tree-for-decktrix-custom-PCB.patch +++ b/board/linux/patches/0006-dts-Add-device-tree-for-decktrix-custom-PCB.patch @@ -4,19 +4,21 @@ Date: Thu, 03 Apr 2026 13:00:00 +0200 Subject: dts: Add device tree for decktrix custom PCB The decktrix board is based on STM32MP157F with the same RAM as the -Discovery Kit but uses a different pinout and peripherals: +Discovery Kit but different pinout and peripherals: - Jadard JD9365TN display (different reset/backlight GPIOs) - Jadard touch controller on I2C1 (different IRQ/reset GPIOs) -- Cypress CYW43438 WiFi/BT (different reset/shutdown GPIOs) -- BT on UART7 instead of USART2 (no RTS/CTS) - STPMIC1 PMIC on I2C4 at PD12/PD13 instead of PZ4/PZ5 +- LDO1 at 2.8V for display AVDD (not 1.8V for audio) +- LDO6 at 1.8V for display IOVCC (not 1.2V for HDMI) +- Display powered by always-on PMIC regulators (no GPIO enable) +- WiFi/BT disabled (u-blox MAYA-W166 uses SDMMC3/UART8, TBD) Signed-off-by: Kirill Yatsenko --- arch/arm/boot/dts/st/Makefile | 1 + - arch/arm/boot/dts/st/decktrix-v1.dts | 163 ++++++++++++++++++++++++ - 2 files changed, 164 insertions(+) + arch/arm/boot/dts/st/decktrix-v1.dts | 118 ++++++++++++++++++++++++ + 2 files changed, 119 insertions(+) create mode 100644 arch/arm/boot/dts/st/decktrix-v1.dts diff --git a/arch/arm/boot/dts/st/Makefile b/arch/arm/boot/dts/st/Makefile @@ -36,7 +38,7 @@ new file mode 100644 index 000000000000..000000000000 --- /dev/null +++ b/arch/arm/boot/dts/st/decktrix-v1.dts -@@ -0,0 +1,163 @@ +@@ -0,0 +1,124 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) +/* + * Copyright (C) Decktrix Lab @@ -46,9 +48,10 @@ index 000000000000..000000000000 + * Same SoC and RAM as STM32MP157F-DK2 but with custom pinout: + * - Jadard JD9365TN display (different reset/backlight GPIOs) + * - Jadard touch on I2C1 (different IRQ/reset GPIOs) -+ * - Cypress CYW43438 WiFi/BT (different control GPIOs) -+ * - BT on UART7 (no RTS/CTS) + * - STPMIC1 PMIC on I2C4 at PD12/PD13 (not PZ4/PZ5) ++ * - LDO1 at 2.8V for display AVDD (not 1.8V for audio) ++ * - LDO6 at 1.8V for display IOVCC (not 1.2V for HDMI) ++ * - WiFi/BT disabled (u-blox MAYA-W166 uses SDMMC3/UART8, TBD) + */ + +/dts-v1/; @@ -65,17 +68,11 @@ index 000000000000..000000000000 + + aliases { + ethernet0 = ðernet0; -+ serial3 = &uart7; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; -+ -+ wifi_pwrseq: wifi-pwrseq { -+ compatible = "mmc-pwrseq-simple"; -+ reset-gpios = <&gpioe 6 GPIO_ACTIVE_LOW>; -+ }; +}; + +&cryp1 { @@ -111,10 +108,20 @@ index 000000000000..000000000000 + remote-endpoint = <&panel_in>; +}; + -+/* PMIC (STPMIC1) on I2C4: SCL=PD12, SDA=PD13 (AF4) */ -+&i2c4 { -+ pinctrl-0 = <&i2c4_pins_decktrix>; -+ pinctrl-1 = <&i2c4_sleep_pins_decktrix>; ++}; ++ ++/* PMIC LDO1: 2.8V for display AVDD (2V8 rail on decktrix PCB) */ ++&v1v8_audio { ++ regulator-name = "ldo1"; ++ regulator-min-microvolt = <2800000>; ++ regulator-max-microvolt = <2800000>; ++}; ++ ++/* PMIC LDO6: 1.8V for display IOVCC (1V8 rail on decktrix PCB) */ ++&v1v2_hdmi { ++ regulator-name = "ldo6"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; +}; + +&i2c1 { @@ -146,74 +153,14 @@ index 000000000000..000000000000 + }; +}; + -+&pinctrl { -+ i2c4_pins_decktrix: i2c4-decktrix { -+ pins { -+ pinmux = , /* I2C4_SCL */ -+ ; /* I2C4_SDA */ -+ bias-disable; -+ drive-open-drain; -+ slew-rate = <0>; -+ }; -+ }; -+ -+ /omit-if-no-ref/ -+ i2c4_sleep_pins_decktrix: i2c4-sleep-decktrix { -+ pins { -+ pinmux = , -+ ; -+ }; -+ }; -+}; -+ -+&rtc { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&rtc_rsvd_pins_a>; -+ -+ rtc_lsco_pins_a: rtc-lsco-0 { -+ pins = "out2_rmp"; -+ function = "lsco"; -+ }; -+}; -+ -+/* Wifi */ ++/* WiFi disabled - u-blox MAYA-W166 uses SDMMC3, driver TBD */ +&sdmmc2 { -+ pinctrl-names = "default", "opendrain", "sleep"; -+ pinctrl-0 = <&sdmmc2_b4_pins_a>; -+ pinctrl-1 = <&sdmmc2_b4_od_pins_a>; -+ pinctrl-2 = <&sdmmc2_b4_sleep_pins_a>; -+ non-removable; -+ cap-sdio-irq; -+ st,neg-edge; -+ bus-width = <4>; -+ vmmc-supply = <&v3v3>; -+ mmc-pwrseq = <&wifi_pwrseq>; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ brcmf: wifi@1 { -+ reg = <1>; -+ compatible = "brcm,bcm4329-fmac"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&rtc_lsco_pins_a>; -+ }; ++ status = "disabled"; +}; + -+/* Bluetooth - Cypress CYW43438 on UART7 (no RTS/CTS) */ ++/* BT disabled - u-blox MAYA-W166 uses UART8, driver TBD */ +&uart7 { -+ pinctrl-names = "default", "sleep"; -+ pinctrl-0 = <&uart7_pins_c>; -+ pinctrl-1 = <&uart7_sleep_pins_c>; -+ status = "okay"; -+ -+ bluetooth { -+ shutdown-gpios = <&gpiob 10 GPIO_ACTIVE_HIGH>; -+ compatible = "brcm,bcm43438-bt"; -+ max-speed = <3000000>; -+ vbat-supply = <&v3v3>; -+ vddio-supply = <&v3v3>; -+ }; ++ status = "disabled"; +}; -- 2.43.0 diff --git a/board/linux/patches/0009-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch b/board/linux/patches/0009-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch new file mode 100644 index 0000000..fa09a46 --- /dev/null +++ b/board/linux/patches/0009-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Kirill Yatsenko +Date: Thu, 03 Apr 2026 17:00:00 +0200 +Subject: dts: stm32mp15-pinctrl: Change I2C4 default pins to PD12/PD13 + +On the decktrix v1 custom PCB, the PMIC (STPMIC1) I2C4 bus uses +PD12 (SCL) and PD13 (SDA) instead of the default PZ4/PZ5. + +Signed-off-by: Kirill Yatsenko +--- + arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi b/arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi +index aaaaaaa..bbbbbbb 100644 +--- a/arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi ++++ b/arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi +@@ -3355,16 +3355,16 @@ i2c4_pins_a: i2c4-0 { + pins { +- pinmux = , /* I2C4_SCL */ +- ; /* I2C4_SDA */ ++ pinmux = , /* I2C4_SCL */ ++ ; /* I2C4_SDA */ + bias-disable; + drive-open-drain; + slew-rate = <0>; + }; + }; + + /omit-if-no-ref/ + i2c4_sleep_pins_a: i2c4-sleep-0 { + pins { +- pinmux = , /* I2C4_SCL */ +- ; /* I2C4_SDA */ ++ pinmux = , /* I2C4_SCL */ ++ ; /* I2C4_SDA */ + }; + }; +-- +2.43.0 diff --git a/board/tfa/decktrix-v1.dts b/board/tfa/decktrix-v1.dts index e3ca8ed..2d71913 100644 --- a/board/tfa/decktrix-v1.dts +++ b/board/tfa/decktrix-v1.dts @@ -5,7 +5,7 @@ * * Decktrix v1 custom PCB based on STM32MP157F. * Same DDR, clock, and PMIC (STPMIC1) as STM32MP157C-DK2 but - * PMIC I2C4 is on PD12/PD13 instead of PZ4/PZ5. + * LDO1 at 2.8V for display AVDD, LDO6 at 1.8V for display IOVCC. */ /dts-v1/; @@ -33,19 +33,16 @@ status = "okay"; }; -/* PMIC (STPMIC1) on I2C4: SCL=PD12, SDA=PD13 (AF4) */ -&i2c4 { - pinctrl-0 = <&i2c4_pins_decktrix>; +/* PMIC LDO1: 2.8V for display AVDD (2V8 rail on decktrix PCB) */ +&v1v8_audio { + regulator-name = "ldo1"; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; }; -&pinctrl { - i2c4_pins_decktrix: i2c4-decktrix { - pins { - pinmux = , - ; - bias-disable; - drive-open-drain; - slew-rate = <0>; - }; - }; +/* PMIC LDO6: 1.8V for display IOVCC (1V8 rail on decktrix PCB) */ +&v1v2_hdmi { + regulator-name = "ldo6"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; }; diff --git a/board/tfa/patches/0001-tfa-decktrix-Override-PMIC-LDO1-LDO6-voltages.patch b/board/tfa/patches/0001-tfa-decktrix-Override-PMIC-LDO1-LDO6-voltages.patch new file mode 100644 index 0000000..18ce805 --- /dev/null +++ b/board/tfa/patches/0001-tfa-decktrix-Override-PMIC-LDO1-LDO6-voltages.patch @@ -0,0 +1,54 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Kirill Yatsenko +Date: Thu, 03 Apr 2026 16:00:00 +0200 +Subject: stm32mp1: Support decktrix PMIC LDO1 at 2.8V and LDO6 at 1.8V + +On the decktrix v1 custom PCB, the PMIC LDO1 and LDO6 outputs are +connected to the display panel instead of audio/HDMI: + +- LDO1 (pin 23): 2.8V for display AVDD (was 1.8V for audio codec) +- LDO6 (pin 43): 1.8V for display IOVCC (was 1.2V for HDMI) + +This patch changes the shared stm32mp15xx-dkx.dtsi to use the correct +voltages. This is safe because: +- The devboard has no HDMI audio codec on LDO6 (unused at 1.2V anyway) +- LDO1 at 2.8V is within STPMIC1 spec (1.7-3.3V range) +- Both regulators are always-on in both configurations + +Signed-off-by: Kirill Yatsenko +--- + fdts/stm32mp15xx-dkx.dtsi | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/fdts/stm32mp15xx-dkx.dtsi b/fdts/stm32mp15xx-dkx.dtsi +index 1111111..2222222 100644 +--- a/fdts/stm32mp15xx-dkx.dtsi ++++ b/fdts/stm32mp15xx-dkx.dtsi +@@ -124,9 +124,9 @@ regulators { + }; + + v1v8_audio: ldo1 { +- regulator-name = "v1v8_audio"; +- regulator-min-microvolt = <1800000>; +- regulator-max-microvolt = <1800000>; ++ regulator-name = "ldo1"; ++ regulator-min-microvolt = <2800000>; ++ regulator-max-microvolt = <2800000>; + regulator-always-on; + }; + +@@ -161,9 +161,9 @@ regulators { + }; + + v1v2_hdmi: ldo6 { +- regulator-name = "v1v2_hdmi"; +- regulator-min-microvolt = <1200000>; +- regulator-max-microvolt = <1200000>; ++ regulator-name = "ldo6"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; + regulator-always-on; + }; + +-- +2.43.0 diff --git a/board/tfa/patches/0002-tfa-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch b/board/tfa/patches/0002-tfa-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch new file mode 100644 index 0000000..fd01bf1 --- /dev/null +++ b/board/tfa/patches/0002-tfa-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Kirill Yatsenko +Date: Thu, 03 Apr 2026 18:00:00 +0200 +Subject: stm32mp15-pinctrl: Change I2C4 default pins to PD12/PD13 + +On the decktrix v1 custom PCB, the PMIC (STPMIC1) I2C4 bus uses +PD12 (SCL) and PD13 (SDA) instead of the default PZ4/PZ5. + +Signed-off-by: Kirill Yatsenko +--- + fdts/stm32mp15-pinctrl.dtsi | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/fdts/stm32mp15-pinctrl.dtsi b/fdts/stm32mp15-pinctrl.dtsi +index aaaaaaa..bbbbbbb 100644 +--- a/fdts/stm32mp15-pinctrl.dtsi ++++ b/fdts/stm32mp15-pinctrl.dtsi +@@ -440,8 +440,8 @@ i2c4_pins_a: i2c4-0 { + pins { +- pinmux = , /* I2C4_SCL */ +- ; /* I2C4_SDA */ ++ pinmux = , /* I2C4_SCL */ ++ ; /* I2C4_SDA */ + bias-disable; + drive-open-drain; + slew-rate = <0>; + }; + }; +-- +2.43.0 diff --git a/board/u-boot/decktrix-v1.dts b/board/u-boot/decktrix-v1.dts index e6f3fcb..1cd2796 100644 --- a/board/u-boot/decktrix-v1.dts +++ b/board/u-boot/decktrix-v1.dts @@ -4,7 +4,6 @@ * Author: Kirill Yatsenko * * Decktrix v1 custom PCB based on STM32MP157F. - * PMIC I2C4 is on PD12/PD13 instead of PZ4/PZ5. * DSI disabled to avoid conflict with kernel Jadard driver. */ @@ -36,20 +35,3 @@ &dsi { status = "disabled"; }; - -/* PMIC (STPMIC1) on I2C4: SCL=PD12, SDA=PD13 (AF4) */ -&i2c4 { - pinctrl-0 = <&i2c4_pins_decktrix>; -}; - -&pinctrl { - i2c4_pins_decktrix: i2c4-decktrix { - pins { - pinmux = , - ; - bias-disable; - drive-open-drain; - slew-rate = <0>; - }; - }; -}; diff --git a/board/u-boot/patches/0002-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch b/board/u-boot/patches/0002-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch new file mode 100644 index 0000000..34dd1b0 --- /dev/null +++ b/board/u-boot/patches/0002-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Kirill Yatsenko +Date: Thu, 03 Apr 2026 19:00:00 +0200 +Subject: dts: stm32mp15-pinctrl: Change I2C4 default pins to PD12/PD13 + +On the decktrix v1 custom PCB, the PMIC (STPMIC1) I2C4 bus uses +PD12 (SCL) and PD13 (SDA) instead of the default PZ4/PZ5. + +Signed-off-by: Kirill Yatsenko +--- + arch/arm/dts/stm32mp15-pinctrl.dtsi | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/arm/dts/stm32mp15-pinctrl.dtsi b/arch/arm/dts/stm32mp15-pinctrl.dtsi +index aaaaaaa..bbbbbbb 100644 +--- a/arch/arm/dts/stm32mp15-pinctrl.dtsi ++++ b/arch/arm/dts/stm32mp15-pinctrl.dtsi +@@ -2738,16 +2738,16 @@ i2c4_pins_a: i2c4-0 { + pins { +- pinmux = , /* I2C4_SCL */ +- ; /* I2C4_SDA */ ++ pinmux = , /* I2C4_SCL */ ++ ; /* I2C4_SDA */ + bias-disable; + drive-open-drain; + slew-rate = <0>; + }; + }; + + i2c4_sleep_pins_a: i2c4-sleep-0 { + pins { +- pinmux = , /* I2C4_SCL */ +- ; /* I2C4_SDA */ ++ pinmux = , /* I2C4_SCL */ ++ ; /* I2C4_SDA */ + }; + }; +-- +2.43.0 diff --git a/build-image.sh b/build-image.sh index 3186ea7..f1503f8 100755 --- a/build-image.sh +++ b/build-image.sh @@ -42,7 +42,8 @@ apply_kernel_patches() { board/linux/patches/0003-display-Add-Jadard-MIPI-driver.patch \ board/linux/patches/0004-display-Add-Jadard-touch-driver.patch \ board/linux/patches/0005-dts-Add-support-for-home-button.patch \ - board/linux/patches/0006-dts-Add-device-tree-for-decktrix-custom-PCB.patch || true + board/linux/patches/0006-dts-Add-device-tree-for-decktrix-custom-PCB.patch \ + board/linux/patches/0009-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch || true } build_kernel() { @@ -54,8 +55,22 @@ build_kernel() { } apply_uboot_patches() { - git apply --reject --directory ${UBOOT_DIR} \ + echo "-I apply u-boot patches" + + git apply --check --directory ${UBOOT_DIR} \ board/u-boot/patches/0001-DT-disable-DSI-node.patch || true + + git apply --reject --directory ${UBOOT_DIR} \ + board/u-boot/patches/0001-DT-disable-DSI-node.patch \ + board/u-boot/patches/0002-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch || true +} + +apply_tfa_patches() { + echo "-I apply tfa patches" + + git apply --reject --directory ${TFA_DIR} \ + board/tfa/patches/0001-tfa-decktrix-Override-PMIC-LDO1-LDO6-voltages.patch \ + board/tfa/patches/0002-tfa-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch || true } build_uboot() { @@ -80,6 +95,8 @@ build_uboot() { build_tfa() { echo "-I start tfa build" + apply_tfa_patches + if [ "${BOARD_DT}" = "decktrix-v1" ]; then cp board/tfa/decktrix-v1.dts ${TFA_DIR}/fdts/ cp board/tfa/decktrix-v1-fw-config.dts ${TFA_DIR}/fdts/ From 4d03fca88fc9b0fed1bc2a7a6acdfa6cb0493d42 Mon Sep 17 00:00:00 2001 From: Kirill Yatsenko Date: Fri, 3 Apr 2026 20:54:33 +0200 Subject: [PATCH 04/15] Move LDO overrides from shared dtsi to board DTS files Instead of patching stm32mp15xx-dkx.dtsi to change LDO1/LDO6 voltages (which affects all boards), override them in the decktrix-v1.dts files. Cleaner separation - devboard config stays untouched. Also add pcb/ to .gitignore. --- .gitignore | 1 + ...-device-tree-for-decktrix-custom-PCB.patch | 4 +- board/tfa/decktrix-v1.dts | 3 +- ...rix-Override-PMIC-LDO1-LDO6-voltages.patch | 54 ------------------- ...ange-I2C4-default-pins-to-PD12-PD13.patch} | 0 build-image.sh | 3 +- 6 files changed, 4 insertions(+), 61 deletions(-) delete mode 100644 board/tfa/patches/0001-tfa-decktrix-Override-PMIC-LDO1-LDO6-voltages.patch rename board/tfa/patches/{0002-tfa-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch => 0001-tfa-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch} (100%) diff --git a/.gitignore b/.gitignore index 5178f5a..f77f657 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ toolchain/extracted *.tsv *.xml *.bak +pcb/ diff --git a/board/linux/patches/0006-dts-Add-device-tree-for-decktrix-custom-PCB.patch b/board/linux/patches/0006-dts-Add-device-tree-for-decktrix-custom-PCB.patch index 4109cd7..ad6f683 100644 --- a/board/linux/patches/0006-dts-Add-device-tree-for-decktrix-custom-PCB.patch +++ b/board/linux/patches/0006-dts-Add-device-tree-for-decktrix-custom-PCB.patch @@ -38,7 +38,7 @@ new file mode 100644 index 000000000000..000000000000 --- /dev/null +++ b/arch/arm/boot/dts/st/decktrix-v1.dts -@@ -0,0 +1,124 @@ +@@ -0,0 +1,122 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) +/* + * Copyright (C) Decktrix Lab @@ -108,8 +108,6 @@ index 000000000000..000000000000 + remote-endpoint = <&panel_in>; +}; + -+}; -+ +/* PMIC LDO1: 2.8V for display AVDD (2V8 rail on decktrix PCB) */ +&v1v8_audio { + regulator-name = "ldo1"; diff --git a/board/tfa/decktrix-v1.dts b/board/tfa/decktrix-v1.dts index 2d71913..3b4dfd1 100644 --- a/board/tfa/decktrix-v1.dts +++ b/board/tfa/decktrix-v1.dts @@ -4,8 +4,7 @@ * Author: Kirill Yatsenko * * Decktrix v1 custom PCB based on STM32MP157F. - * Same DDR, clock, and PMIC (STPMIC1) as STM32MP157C-DK2 but - * LDO1 at 2.8V for display AVDD, LDO6 at 1.8V for display IOVCC. + * I2C4 pinctrl configured via patch in stm32mp15-pinctrl.dtsi. */ /dts-v1/; diff --git a/board/tfa/patches/0001-tfa-decktrix-Override-PMIC-LDO1-LDO6-voltages.patch b/board/tfa/patches/0001-tfa-decktrix-Override-PMIC-LDO1-LDO6-voltages.patch deleted file mode 100644 index 18ce805..0000000 --- a/board/tfa/patches/0001-tfa-decktrix-Override-PMIC-LDO1-LDO6-voltages.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Kirill Yatsenko -Date: Thu, 03 Apr 2026 16:00:00 +0200 -Subject: stm32mp1: Support decktrix PMIC LDO1 at 2.8V and LDO6 at 1.8V - -On the decktrix v1 custom PCB, the PMIC LDO1 and LDO6 outputs are -connected to the display panel instead of audio/HDMI: - -- LDO1 (pin 23): 2.8V for display AVDD (was 1.8V for audio codec) -- LDO6 (pin 43): 1.8V for display IOVCC (was 1.2V for HDMI) - -This patch changes the shared stm32mp15xx-dkx.dtsi to use the correct -voltages. This is safe because: -- The devboard has no HDMI audio codec on LDO6 (unused at 1.2V anyway) -- LDO1 at 2.8V is within STPMIC1 spec (1.7-3.3V range) -- Both regulators are always-on in both configurations - -Signed-off-by: Kirill Yatsenko ---- - fdts/stm32mp15xx-dkx.dtsi | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/fdts/stm32mp15xx-dkx.dtsi b/fdts/stm32mp15xx-dkx.dtsi -index 1111111..2222222 100644 ---- a/fdts/stm32mp15xx-dkx.dtsi -+++ b/fdts/stm32mp15xx-dkx.dtsi -@@ -124,9 +124,9 @@ regulators { - }; - - v1v8_audio: ldo1 { -- regulator-name = "v1v8_audio"; -- regulator-min-microvolt = <1800000>; -- regulator-max-microvolt = <1800000>; -+ regulator-name = "ldo1"; -+ regulator-min-microvolt = <2800000>; -+ regulator-max-microvolt = <2800000>; - regulator-always-on; - }; - -@@ -161,9 +161,9 @@ regulators { - }; - - v1v2_hdmi: ldo6 { -- regulator-name = "v1v2_hdmi"; -- regulator-min-microvolt = <1200000>; -- regulator-max-microvolt = <1200000>; -+ regulator-name = "ldo6"; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; - regulator-always-on; - }; - --- -2.43.0 diff --git a/board/tfa/patches/0002-tfa-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch b/board/tfa/patches/0001-tfa-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch similarity index 100% rename from board/tfa/patches/0002-tfa-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch rename to board/tfa/patches/0001-tfa-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch diff --git a/build-image.sh b/build-image.sh index f1503f8..a2a4925 100755 --- a/build-image.sh +++ b/build-image.sh @@ -69,8 +69,7 @@ apply_tfa_patches() { echo "-I apply tfa patches" git apply --reject --directory ${TFA_DIR} \ - board/tfa/patches/0001-tfa-decktrix-Override-PMIC-LDO1-LDO6-voltages.patch \ - board/tfa/patches/0002-tfa-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch || true + board/tfa/patches/0001-tfa-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch || true } build_uboot() { From b9fc178fdb0fa435b773111492b1b21d82c73c58 Mon Sep 17 00:00:00 2001 From: Kirill Yatsenko Date: Fri, 3 Apr 2026 22:33:21 +0200 Subject: [PATCH 05/15] Fix pinctrl patches and add sdcard.img.gz compression Fix all three I2C4 pinctrl patches to match exact source indentation. Add gzip_sdcard_img() to compress sdcard.img after build. --- ...hange-I2C4-default-pins-to-PD12-PD13.patch | 11 +++++----- ...hange-I2C4-default-pins-to-PD12-PD13.patch | 5 +++-- ...hange-I2C4-default-pins-to-PD12-PD13.patch | 20 ++++++------------- build-image.sh | 7 +++++++ 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/board/linux/patches/0009-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch b/board/linux/patches/0009-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch index fa09a46..c82f8f4 100644 --- a/board/linux/patches/0009-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch +++ b/board/linux/patches/0009-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch @@ -15,7 +15,9 @@ diff --git a/arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi b/arch/arm/boot/dts/st/ index aaaaaaa..bbbbbbb 100644 --- a/arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi +++ b/arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi -@@ -3355,16 +3355,16 @@ i2c4_pins_a: i2c4-0 { +@@ -3356,8 +3356,8 @@ + /omit-if-no-ref/ + i2c4_pins_a: i2c4-0 { pins { - pinmux = , /* I2C4_SCL */ - ; /* I2C4_SDA */ @@ -24,9 +26,8 @@ index aaaaaaa..bbbbbbb 100644 bias-disable; drive-open-drain; slew-rate = <0>; - }; - }; - +@@ -3366,8 +3366,8 @@ + /omit-if-no-ref/ i2c4_sleep_pins_a: i2c4-sleep-0 { pins { @@ -36,5 +37,5 @@ index aaaaaaa..bbbbbbb 100644 + ; /* I2C4_SDA */ }; }; --- +-- 2.43.0 diff --git a/board/tfa/patches/0001-tfa-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch b/board/tfa/patches/0001-tfa-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch index fd01bf1..4522fd7 100644 --- a/board/tfa/patches/0001-tfa-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch +++ b/board/tfa/patches/0001-tfa-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch @@ -12,10 +12,12 @@ Signed-off-by: Kirill Yatsenko 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fdts/stm32mp15-pinctrl.dtsi b/fdts/stm32mp15-pinctrl.dtsi -index aaaaaaa..bbbbbbb 100644 +index 70d1db1..7040c33 100644 --- a/fdts/stm32mp15-pinctrl.dtsi +++ b/fdts/stm32mp15-pinctrl.dtsi @@ -440,8 +440,8 @@ i2c4_pins_a: i2c4-0 { + /omit-if-no-ref/ + i2c4_pins_a: i2c4-0 { pins { - pinmux = , /* I2C4_SCL */ - ; /* I2C4_SDA */ @@ -25,6 +27,5 @@ index aaaaaaa..bbbbbbb 100644 drive-open-drain; slew-rate = <0>; }; - }; -- 2.43.0 diff --git a/board/u-boot/patches/0002-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch b/board/u-boot/patches/0002-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch index 34dd1b0..2f00425 100644 --- a/board/u-boot/patches/0002-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch +++ b/board/u-boot/patches/0002-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch @@ -8,14 +8,16 @@ PD12 (SCL) and PD13 (SDA) instead of the default PZ4/PZ5. Signed-off-by: Kirill Yatsenko --- - arch/arm/dts/stm32mp15-pinctrl.dtsi | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) + arch/arm/dts/stm32mp15-pinctrl.dtsi | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/dts/stm32mp15-pinctrl.dtsi b/arch/arm/dts/stm32mp15-pinctrl.dtsi index aaaaaaa..bbbbbbb 100644 --- a/arch/arm/dts/stm32mp15-pinctrl.dtsi +++ b/arch/arm/dts/stm32mp15-pinctrl.dtsi -@@ -2738,16 +2738,16 @@ i2c4_pins_a: i2c4-0 { +@@ -2739,8 +2739,8 @@ + + i2c4_pins_a: i2c4-0 { pins { - pinmux = , /* I2C4_SCL */ - ; /* I2C4_SDA */ @@ -25,15 +27,5 @@ index aaaaaaa..bbbbbbb 100644 drive-open-drain; slew-rate = <0>; }; - }; - - i2c4_sleep_pins_a: i2c4-sleep-0 { - pins { -- pinmux = , /* I2C4_SCL */ -- ; /* I2C4_SDA */ -+ pinmux = , /* I2C4_SCL */ -+ ; /* I2C4_SDA */ - }; - }; --- +-- 2.43.0 diff --git a/build-image.sh b/build-image.sh index a2a4925..ebf935c 100755 --- a/build-image.sh +++ b/build-image.sh @@ -349,6 +349,12 @@ generate_sdcard_img() { genimage --inputpath deploy --outputpath deploy --config genimage.cfg } +gzip_sdcard_img() { + echo "-I compress sdcard image" + gzip -f deploy/sdcard.img + echo "-I compressed: deploy/sdcard.img.gz ($(du -h deploy/sdcard.img.gz | cut -f1))" +} + print_help() { echo "Usage: $0 [options]" echo "" @@ -482,6 +488,7 @@ start_image_build() { install_tfa generate_sdcard_img + gzip_sdcard_img } start_image_build "$@" From 44e2f94a442a203d8734d44a10efbdf8bd7f4e0a Mon Sep 17 00:00:00 2001 From: Kirill Yatsenko Date: Sun, 5 Apr 2026 08:59:01 +0200 Subject: [PATCH 06/15] Add opencode.json with Google Drive MCP config, update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f77f657..23cc6b2 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ toolchain/extracted *.xml *.bak pcb/ +opencode.json From 7e9aa5908356b484a9882c72f10c50a482f5de03 Mon Sep 17 00:00:00 2001 From: Kirill Yatsenko Date: Sun, 5 Apr 2026 09:32:28 +0200 Subject: [PATCH 07/15] Add Google Drive upload script and AGENTS.md - scripts/gdrive-upload.sh: upload file to shared Drive folder - scripts/gdrive-auth.sh: re-authenticate when refresh token expires - AGENTS.md: document upload workflow and token refresh steps --- AGENTS.md | 36 +++++++++++++++++ scripts/gdrive-auth.sh | 75 ++++++++++++++++++++++++++++++++++++ scripts/gdrive-upload.sh | 83 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 194 insertions(+) create mode 100644 AGENTS.md create mode 100755 scripts/gdrive-auth.sh create mode 100755 scripts/gdrive-upload.sh diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..b0b0cc4 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,36 @@ +# AGENTS.md + +## Google Drive Upload + +To upload a file to the shared Google Drive folder: + +```bash +./scripts/gdrive-upload.sh +``` + +This will: +1. Refresh the access token using the stored refresh token +2. Upload the file to the decktrix folder on Google Drive +3. Share it with "anyone with link" +4. Print the shareable URL + +Credentials are stored in `~/.config/opencode/gdrive-token.json`. + +### When the token expires (after 7 days) + +The refresh token expires after 7 days. When this happens: +1. `gdrive-upload.sh` will fail with "Failed to refresh access token" +2. Run `./scripts/gdrive-auth.sh` +3. It prints an OAuth URL - open it in a browser +4. Approve access in Google +5. Browser redirects to `http://localhost/?code=XXXXX...` +6. Copy the `code` value from the URL and paste it into the terminal +7. The script updates the token file automatically +8. Run `gdrive-upload.sh` again + +### Google Cloud project + +- Project: decktrix +- OAuth Client ID: `236838812265-94votd2clqtuoc10ang7lidqegrqlbdh.apps.googleusercontent.com` +- Folder: `1GEBlgEZuuIjffJXl2PR23m1ojAJ_IQYR` +- OAuth credentials stored in: `~/.config/opencode/gcp-oauth.json` diff --git a/scripts/gdrive-auth.sh b/scripts/gdrive-auth.sh new file mode 100755 index 0000000..6d641db --- /dev/null +++ b/scripts/gdrive-auth.sh @@ -0,0 +1,75 @@ +#!/usr/bin/env bash +# +# Re-authenticate with Google Drive when the refresh token expires. +# The refresh token lasts 7 days. When it expires, run this script. +# +# Usage: ./scripts/gdrive-auth.sh +# +# Steps: +# 1. Opens the OAuth URL in your browser +# 2. You approve access +# 3. Browser redirects to http://localhost/?code=... +# 4. Copy the code from the URL and paste it here +# 5. Token file is updated automatically +# + +set -e + +TOKEN_FILE="${HOME}/.config/opencode/gdrive-token.json" + +if [ ! -f "$TOKEN_FILE" ]; then + echo "Error: Token file not found: $TOKEN_FILE" + exit 1 +fi + +CLIENT_ID=$(python3 -c "import json; print(json.load(open('$TOKEN_FILE'))['client_id'])") +CLIENT_SECRET=$(python3 -c "import json; print(json.load(open('$TOKEN_FILE'))['client_secret'])") +REDIRECT_URI="http://localhost" + +AUTH_URL="https://accounts.google.com/o/oauth2/auth?client_id=${CLIENT_ID}&redirect_uri=${REDIRECT_URI}&response_type=code&scope=https://www.googleapis.com/auth/drive.file&access_type=offline&prompt=consent" + +echo "" +echo "Open this URL in your browser to authorize:" +echo "" +echo "$AUTH_URL" +echo "" +echo "After approving, you will be redirected to:" +echo " http://localhost/?code=XXXXX&scope=..." +echo "" +read -p "Paste the code from the URL: " AUTH_CODE + +if [ -z "$AUTH_CODE" ]; then + echo "Error: No code provided" + exit 1 +fi + +# Exchange code for tokens +TOKEN_RESPONSE=$(curl -s -X POST https://oauth2.googleapis.com/token \ + -d "code=$AUTH_CODE" \ + -d "client_id=$CLIENT_ID" \ + -d "client_secret=$CLIENT_SECRET" \ + -d "redirect_uri=$REDIRECT_URI" \ + -d "grant_type=authorization_code") + +NEW_ACCESS_TOKEN=$(echo "$TOKEN_RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin)['access_token'])" 2>/dev/null) +NEW_REFRESH_TOKEN=$(echo "$TOKEN_RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin)['refresh_token'])" 2>/dev/null) + +if [ -z "$NEW_REFRESH_TOKEN" ]; then + echo "Error: Failed to get new tokens" + echo "$TOKEN_RESPONSE" + exit 1 +fi + +# Update token file with new refresh token +python3 -c " +import json +with open('$TOKEN_FILE', 'r') as f: + data = json.load(f) +data['refresh_token'] = '$NEW_REFRESH_TOKEN' +with open('$TOKEN_FILE', 'w') as f: + json.dump(data, f, indent=2) +" + +echo "" +echo "Token updated successfully!" +echo "You can now use: ./scripts/gdrive-upload.sh " diff --git a/scripts/gdrive-upload.sh b/scripts/gdrive-upload.sh new file mode 100755 index 0000000..49dc0d2 --- /dev/null +++ b/scripts/gdrive-upload.sh @@ -0,0 +1,83 @@ +#!/usr/bin/env bash +# +# Upload a file to Google Drive (decktrix folder) and share it. +# +# Usage: ./scripts/gdrive-upload.sh +# +# Credentials stored in: ~/.config/opencode/gdrive-token.json +# If token expires, run: ./scripts/gdrive-auth.sh +# + +set -e + +TOKEN_FILE="${HOME}/.config/opencode/gdrive-token.json" + +if [ -z "$1" ]; then + echo "Usage: $0 " + exit 1 +fi + +FILE="$1" + +if [ ! -f "$FILE" ]; then + echo "Error: File not found: $FILE" + exit 1 +fi + +if [ ! -f "$TOKEN_FILE" ]; then + echo "Error: Token file not found: $TOKEN_FILE" + echo "Run: ./scripts/gdrive-auth.sh" + exit 1 +fi + +CLIENT_ID=$(python3 -c "import json; print(json.load(open('$TOKEN_FILE'))['client_id'])") +CLIENT_SECRET=$(python3 -c "import json; print(json.load(open('$TOKEN_FILE'))['client_secret'])") +REFRESH_TOKEN=$(python3 -c "import json; print(json.load(open('$TOKEN_FILE'))['refresh_token'])") +FOLDER_ID=$(python3 -c "import json; print(json.load(open('$TOKEN_FILE'))['folder_id'])") + +# Refresh access token +TOKEN_RESPONSE=$(curl -s -X POST https://oauth2.googleapis.com/token \ + -d "client_id=$CLIENT_ID" \ + -d "client_secret=$CLIENT_SECRET" \ + -d "refresh_token=$REFRESH_TOKEN" \ + -d "grant_type=refresh_token") + +ACCESS_TOKEN=$(echo "$TOKEN_RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin)['access_token'])" 2>/dev/null) + +if [ -z "$ACCESS_TOKEN" ]; then + echo "Error: Failed to refresh access token. Token may be expired." + echo "Run: ./scripts/gdrive-auth.sh" + exit 1 +fi + +FILENAME=$(basename "$FILE") +MIME_TYPE=$(file -b --mime-type "$FILE") + +echo "Uploading $FILENAME ($MIME_TYPE) to Google Drive..." + +# Upload file +UPLOAD_RESPONSE=$(curl -s -X POST \ + -H "Authorization: Bearer $ACCESS_TOKEN" \ + -F "metadata={\"name\": \"$FILENAME\", \"parents\": [\"$FOLDER_ID\"]};type=application/json" \ + -F "file=@$FILE;type=$MIME_TYPE" \ + "https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart&fields=id,name,webViewLink") + +FILE_ID=$(echo "$UPLOAD_RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])" 2>/dev/null) +WEB_LINK=$(echo "$UPLOAD_RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin)['webViewLink'])" 2>/dev/null) + +if [ -z "$FILE_ID" ]; then + echo "Error: Upload failed" + echo "$UPLOAD_RESPONSE" + exit 1 +fi + +# Share with anyone who has the link +curl -s -X POST \ + -H "Authorization: Bearer $ACCESS_TOKEN" \ + -H "Content-Type: application/json" \ + -d '{"role": "reader", "type": "anyone"}' \ + "https://www.googleapis.com/drive/v3/files/$FILE_ID/permissions" > /dev/null + +echo "" +echo "Uploaded: $FILENAME" +echo "Link: $WEB_LINK" From 5dc3e59551190b32a274b9b99f4b462a23726af5 Mon Sep 17 00:00:00 2001 From: Kirill Yatsenko Date: Sun, 5 Apr 2026 09:48:07 +0200 Subject: [PATCH 08/15] Add initial setup instructions for Google Drive in AGENTS.md --- .gitignore | 1 + AGENTS.md | 19 ++++++++++++++++++- scripts/gdrive-auth.sh | 4 +++- scripts/gdrive-upload.sh | 6 ++++-- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 23cc6b2..6087527 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ toolchain/extracted *.bak pcb/ opencode.json +.config/ diff --git a/AGENTS.md b/AGENTS.md index b0b0cc4..0998106 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -14,7 +14,24 @@ This will: 3. Share it with "anyone with link" 4. Print the shareable URL -Credentials are stored in `~/.config/opencode/gdrive-token.json`. +Credentials are stored in `.config/opencode/gdrive-token.json`. + +### Initial setup (first time) + +1. Go to [Google Cloud Console](https://console.cloud.google.com/) +2. Create project `decktrix` +3. Enable **Google Drive API** +4. Go to **APIs & Services → OAuth consent screen** +5. Set User type to **External**, add your email as **Test user** +6. Go to **APIs & Services → Credentials** +7. Create **OAuth 2.0 Client ID** (type: Desktop app) +8. Download the JSON, save as `~/.config/opencode/gcp-oauth.json` +9. Run `./scripts/gdrive-auth.sh` - it prints an OAuth URL +10. Open the URL, approve, paste the code back +11. The script creates `.config/opencode/gdrive-token.json` with your refresh token + +Note: If your Google Cloud app is not verified, you must add yourself +as a test user in **OAuth consent screen → Test users**. ### When the token expires (after 7 days) diff --git a/scripts/gdrive-auth.sh b/scripts/gdrive-auth.sh index 6d641db..96773c9 100755 --- a/scripts/gdrive-auth.sh +++ b/scripts/gdrive-auth.sh @@ -15,7 +15,9 @@ set -e -TOKEN_FILE="${HOME}/.config/opencode/gdrive-token.json" +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" +TOKEN_FILE="${PROJECT_ROOT}/.config/opencode/gdrive-token.json" if [ ! -f "$TOKEN_FILE" ]; then echo "Error: Token file not found: $TOKEN_FILE" diff --git a/scripts/gdrive-upload.sh b/scripts/gdrive-upload.sh index 49dc0d2..4b8ae90 100755 --- a/scripts/gdrive-upload.sh +++ b/scripts/gdrive-upload.sh @@ -4,13 +4,15 @@ # # Usage: ./scripts/gdrive-upload.sh # -# Credentials stored in: ~/.config/opencode/gdrive-token.json +# Credentials stored in: .config/opencode/gdrive-token.json # If token expires, run: ./scripts/gdrive-auth.sh # set -e -TOKEN_FILE="${HOME}/.config/opencode/gdrive-token.json" +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" +TOKEN_FILE="${PROJECT_ROOT}/.config/opencode/gdrive-token.json" if [ -z "$1" ]; then echo "Usage: $0 " From cebd7c8e9cf88dcfd4797921bd793e5f27c9c91c Mon Sep 17 00:00:00 2001 From: Kirill Yatsenko Date: Sun, 5 Apr 2026 09:52:32 +0200 Subject: [PATCH 09/15] Rewrite AGENTS.md with full project docs - Build instructions (Docker, variants, commands) - Decktrix v1 board differences table - Google Drive upload usage - Full Google Cloud Console setup steps (19 steps) - Token refresh instructions --- AGENTS.md | 110 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 80 insertions(+), 30 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 0998106..af9c085 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,53 +1,103 @@ # AGENTS.md -## Google Drive Upload +## Build SD card image -To upload a file to the shared Google Drive folder: +Uses Docker - no host dependencies needed. ```bash -./scripts/gdrive-upload.sh +# First run (prefetch debootstrap + build kernel/uboot/tfa) +docker compose run build --variant decktrix --prefetch-debootstrap + +# Subsequent builds (uses cached debootstrap) +docker compose run build --variant decktrix --use-prefetch-debootstrap ``` -This will: -1. Refresh the access token using the stored refresh token -2. Upload the file to the decktrix folder on Google Drive -3. Share it with "anyone with link" -4. Print the shareable URL +Output: `deploy/sdcard.img.gz` + +Variants: `stm32`, `stm32-jadard`, `decktrix` + +## Project structure + +- `Dockerfile` + `docker-compose.yml` - build environment +- `build-image.sh` - main build script +- `board/linux/patches/` - kernel patches (Jadard driver, DTS, pinctrl) +- `board/tfa/patches/` - TF-A patches (pinctrl) +- `board/u-boot/patches/` - U-Boot patches (DSI disable, pinctrl) +- `board/tfa/decktrix-v1.dts` - TF-A device tree (LDO overrides) +- `board/u-boot/decktrix-v1.dts` - U-Boot device tree +- `scripts/gdrive-upload.sh` - upload file to Google Drive +- `scripts/gdrive-auth.sh` - re-authenticate when token expires + +## Decktrix v1 board differences from DK2 + +| Component | Devboard (DK2) | Decktrix PCB | +|---|---|---| +| PMIC I2C4 SCL | PZ4 | PD12 (AF4) | +| PMIC I2C4 SDA | PZ5 | PD13 (AF4) | +| LDO1 | 1.8V (v1v8_audio) | 2.8V (display AVDD) | +| LDO6 | 1.2V (v1v2_hdmi) | 1.8V (display IOVCC) | +| LCD reset | PE4 | PD11 | +| LCD backlight | PA15 | PF6 (TPS61042 ctrl) | +| Touch IRQ | PF2 | PG7 | +| Touch reset | PF4 | PE10 | +| BT UART | USART2 (PA2/PA3) | UART8 (PE0/PE1) | +| BT shutdown | PZ6 | PB10 | +| WiFi reset | PH4 | PE6 | +| WiFi chip | BCM43430 | u-blox MAYA-W166 (NXP IW416) | +| Display power | GPIO vdd/vccio | Always-on PMIC rails | + +Display is powered by PMIC regulators (always-on): +- LDO1 (2.8V) -> display AVDD +- LDO6 (1.8V) -> display IOVCC +- No GPIO enable needed + +Jadard driver uses `devm_gpiod_get_optional()` for vdd/vccio/dbg GPIOs. -Credentials are stored in `.config/opencode/gdrive-token.json`. +## TODO -### Initial setup (first time) +- WiFi/BT: u-blox MAYA-W166 (NXP IW416) driver, SDMMC3, UART8 + +## Google Drive upload + +```bash +./scripts/gdrive-upload.sh +``` + +Credentials in `.config/opencode/gdrive-token.json` (not in git). + +### Initial setup (from scratch) 1. Go to [Google Cloud Console](https://console.cloud.google.com/) 2. Create project `decktrix` -3. Enable **Google Drive API** -4. Go to **APIs & Services → OAuth consent screen** -5. Set User type to **External**, add your email as **Test user** -6. Go to **APIs & Services → Credentials** -7. Create **OAuth 2.0 Client ID** (type: Desktop app) -8. Download the JSON, save as `~/.config/opencode/gcp-oauth.json` -9. Run `./scripts/gdrive-auth.sh` - it prints an OAuth URL -10. Open the URL, approve, paste the code back -11. The script creates `.config/opencode/gdrive-token.json` with your refresh token - -Note: If your Google Cloud app is not verified, you must add yourself -as a test user in **OAuth consent screen → Test users**. +3. Enable **Google Drive API** (APIs & Services -> Library) +4. Go to **APIs & Services -> OAuth consent screen** +5. Set User type to **External** +6. Add your email under **Test users** +7. Go to **APIs & Services -> Credentials** +8. Click **Create Credentials -> OAuth client ID** +9. Application type: **Desktop app**, name: `decktrix` +10. Click **Create** +11. Click **Download JSON** on the popup +12. Save as `~/.config/opencode/gcp-oauth.json` +13. Run `./scripts/gdrive-auth.sh` +14. It prints an OAuth URL - open in browser +15. Sign in with your Google account, approve access +16. Browser redirects to `http://localhost/?code=XXXXX...` +17. Copy the code from the URL (everything between `code=` and `&`) +18. Paste it into the terminal +19. Script creates `.config/opencode/gdrive-token.json` -### When the token expires (after 7 days) +### When token expires (after 7 days) The refresh token expires after 7 days. When this happens: 1. `gdrive-upload.sh` will fail with "Failed to refresh access token" 2. Run `./scripts/gdrive-auth.sh` -3. It prints an OAuth URL - open it in a browser -4. Approve access in Google -5. Browser redirects to `http://localhost/?code=XXXXX...` -6. Copy the `code` value from the URL and paste it into the terminal -7. The script updates the token file automatically -8. Run `gdrive-upload.sh` again +3. It prints an OAuth URL - open it, approve, paste the code +4. Token file is updated automatically +5. Run `gdrive-upload.sh` again ### Google Cloud project - Project: decktrix - OAuth Client ID: `236838812265-94votd2clqtuoc10ang7lidqegrqlbdh.apps.googleusercontent.com` - Folder: `1GEBlgEZuuIjffJXl2PR23m1ojAJ_IQYR` -- OAuth credentials stored in: `~/.config/opencode/gcp-oauth.json` From 87fbee8bee9104df237f2734360d722d6ee7be23 Mon Sep 17 00:00:00 2001 From: Kirill Yatsenko Date: Sun, 5 Apr 2026 09:57:13 +0200 Subject: [PATCH 10/15] Remove Google Cloud project section from AGENTS.md --- AGENTS.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index af9c085..9ffbc96 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -95,9 +95,3 @@ The refresh token expires after 7 days. When this happens: 3. It prints an OAuth URL - open it, approve, paste the code 4. Token file is updated automatically 5. Run `gdrive-upload.sh` again - -### Google Cloud project - -- Project: decktrix -- OAuth Client ID: `236838812265-94votd2clqtuoc10ang7lidqegrqlbdh.apps.googleusercontent.com` -- Folder: `1GEBlgEZuuIjffJXl2PR23m1ojAJ_IQYR` From 4c733db0328fc9d1ba1b70f16e9a410f0bbc02aa Mon Sep 17 00:00:00 2001 From: Kirill Yatsenko Date: Wed, 8 Apr 2026 21:26:35 +0200 Subject: [PATCH 11/15] fix: TF-A pinctrl and Docker improvements - Fix TF-A pinctrl patch: keep empty &pinctrl_z section - Update U-Boot/Linux pinctrl patches to match working board-share - Minimize Docker image: mount source dirs instead of COPY - Add build.sh wrapper script --- Dockerfile | 3 +- ...hange-I2C4-default-pins-to-PD12-PD13.patch | 67 +++++++++++++------ ...hange-I2C4-default-pins-to-PD12-PD13.patch | 27 ++++++-- ...hange-I2C4-default-pins-to-PD12-PD13.patch | 62 +++++++++++++---- build.sh | 5 ++ docker-compose.yml | 5 ++ 6 files changed, 129 insertions(+), 40 deletions(-) create mode 100755 build.sh diff --git a/Dockerfile b/Dockerfile index 8c2c461..451823b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,8 +31,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ WORKDIR /build -COPY . . - +COPY build-image.sh . RUN chmod +x build-image.sh ENTRYPOINT ["./build-image.sh"] diff --git a/board/linux/patches/0009-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch b/board/linux/patches/0009-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch index c82f8f4..173e965 100644 --- a/board/linux/patches/0009-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch +++ b/board/linux/patches/0009-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch @@ -1,41 +1,68 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Kirill Yatsenko Date: Thu, 03 Apr 2026 17:00:00 +0200 -Subject: dts: stm32mp15-pinctrl: Change I2C4 default pins to PD12/PD13 +Subject: dts: stm32mp15-pinctrl: Move I2C4 to PD12/PD13 On the decktrix v1 custom PCB, the PMIC (STPMIC1) I2C4 bus uses PD12 (SCL) and PD13 (SDA) instead of the default PZ4/PZ5. +Move the i2c4 pinctrl nodes to the top of the controller section. + Signed-off-by: Kirill Yatsenko --- - arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) + arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi | 36 ++++++++++++++------- + 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi b/arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi -index aaaaaaa..bbbbbbb 100644 +index 534a03da2..9abd1125a 100644 --- a/arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi +++ b/arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi -@@ -3356,8 +3356,8 @@ - /omit-if-no-ref/ - i2c4_pins_a: i2c4-0 { - pins { -- pinmux = , /* I2C4_SCL */ -- ; /* I2C4_SDA */ +@@ -25,6 +25,23 @@ pins { + }; + }; + ++ i2c4_pins_a: i2c4-0 { ++ pins { + pinmux = , /* I2C4_SCL */ + ; /* I2C4_SDA */ - bias-disable; - drive-open-drain; - slew-rate = <0>; -@@ -3366,8 +3366,8 @@ - - /omit-if-no-ref/ - i2c4_sleep_pins_a: i2c4-sleep-0 { - pins { -- pinmux = , /* I2C4_SCL */ -- ; /* I2C4_SDA */ ++ bias-disable; ++ drive-open-drain; ++ slew-rate = <0>; ++ }; ++ }; ++ ++ i2c4_sleep_pins_a: i2c4-sleep-0 { ++ pins { + pinmux = , /* I2C4_SCL */ + ; /* I2C4_SDA */ ++ }; ++ }; ++ + adc1_in6_pins_a: adc1-in6-0 { + pins { + pinmux = ; +@@ -2831,22 +2848,6 @@ pins { }; }; + +- i2c4_pins_a: i2c4-0 { +- pins { +- pinmux = , /* I2C4_SCL */ +- ; /* I2C4_SDA */ +- bias-disable; +- drive-open-drain; +- slew-rate = <0>; +- }; +- }; +- +- i2c4_sleep_pins_a: i2c4-sleep-0 { +- pins { +- pinmux = , /* I2C4_SCL */ +- ; /* I2C4_SDA */ +- }; +- }; + + i2c6_pins_a: i2c6-0 { + pins { -- 2.43.0 diff --git a/board/tfa/patches/0001-tfa-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch b/board/tfa/patches/0001-tfa-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch index 4522fd7..1807c12 100644 --- a/board/tfa/patches/0001-tfa-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch +++ b/board/tfa/patches/0001-tfa-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch @@ -1,21 +1,30 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Kirill Yatsenko Date: Thu, 03 Apr 2026 18:00:00 +0200 -Subject: stm32mp15-pinctrl: Change I2C4 default pins to PD12/PD13 +Subject: stm32mp15-pinctrl: Move I2C4 to pinctrl with PD12/PD13 On the decktrix v1 custom PCB, the PMIC (STPMIC1) I2C4 bus uses PD12 (SCL) and PD13 (SDA) instead of the default PZ4/PZ5. +PD12/PD13 belong to GPIO port D, so the pinctrl node must be under +&pinctrl (not &pinctrl_z which is only for port Z). + Signed-off-by: Kirill Yatsenko --- - fdts/stm32mp15-pinctrl.dtsi | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) + fdts/stm32mp15-pinctrl.dtsi | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fdts/stm32mp15-pinctrl.dtsi b/fdts/stm32mp15-pinctrl.dtsi -index 70d1db1..7040c33 100644 +index 70d1db140..22262587a 100644 --- a/fdts/stm32mp15-pinctrl.dtsi +++ b/fdts/stm32mp15-pinctrl.dtsi -@@ -440,8 +440,8 @@ i2c4_pins_a: i2c4-0 { +@@ -434,17 +434,18 @@ + ; /* OTG_FS_DP */ + }; + }; +-}; +- +-&pinctrl_z { /omit-if-no-ref/ i2c4_pins_a: i2c4-0 { pins { @@ -27,5 +36,11 @@ index 70d1db1..7040c33 100644 drive-open-drain; slew-rate = <0>; }; --- + }; ++ ++}; ++ ++&pinctrl_z { + }; +-- 2.43.0 diff --git a/board/u-boot/patches/0002-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch b/board/u-boot/patches/0002-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch index 2f00425..b3b9bca 100644 --- a/board/u-boot/patches/0002-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch +++ b/board/u-boot/patches/0002-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch @@ -1,31 +1,69 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Kirill Yatsenko Date: Thu, 03 Apr 2026 19:00:00 +0200 -Subject: dts: stm32mp15-pinctrl: Change I2C4 default pins to PD12/PD13 +Subject: dts: stm32mp15-pinctrl: Move I2C4 to PD12/PD13 On the decktrix v1 custom PCB, the PMIC (STPMIC1) I2C4 bus uses PD12 (SCL) and PD13 (SDA) instead of the default PZ4/PZ5. +Move the i2c4 pinctrl nodes to the top of the controller section +and add sleep pin configuration. + Signed-off-by: Kirill Yatsenko --- - arch/arm/dts/stm32mp15-pinctrl.dtsi | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) + arch/arm/dts/stm32mp15-pinctrl.dtsi | 36 +++++++++++++++++----------- + 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/arch/arm/dts/stm32mp15-pinctrl.dtsi b/arch/arm/dts/stm32mp15-pinctrl.dtsi -index aaaaaaa..bbbbbbb 100644 +index 534a03da21..9abd1125a9 100644 --- a/arch/arm/dts/stm32mp15-pinctrl.dtsi +++ b/arch/arm/dts/stm32mp15-pinctrl.dtsi -@@ -2739,8 +2739,8 @@ +@@ -25,6 +25,23 @@ + }; + }; - i2c4_pins_a: i2c4-0 { - pins { -- pinmux = , /* I2C4_SCL */ -- ; /* I2C4_SDA */ ++ i2c4_pins_a: i2c4-0 { ++ pins { + pinmux = , /* I2C4_SCL */ + ; /* I2C4_SDA */ - bias-disable; - drive-open-drain; - slew-rate = <0>; ++ bias-disable; ++ drive-open-drain; ++ slew-rate = <0>; ++ }; ++ }; ++ ++ i2c4_sleep_pins_a: i2c4-sleep-0 { ++ pins { ++ pinmux = , /* I2C4_SCL */ ++ ; /* I2C4_SDA */ ++ }; ++ }; ++ + adc1_in6_pins_a: adc1-in6-0 { + pins { + pinmux = ; +@@ -2831,22 +2848,6 @@ }; + }; + +- i2c4_pins_a: i2c4-0 { +- pins { +- pinmux = , /* I2C4_SCL */ +- ; /* I2C4_SDA */ +- bias-disable; +- drive-open-drain; +- slew-rate = <0>; +- }; +- }; +- +- i2c4_sleep_pins_a: i2c4-sleep-0 { +- pins { +- pinmux = , /* I2C4_SCL */ +- ; /* I2C4_SDA */ +- }; +- }; + + i2c6_pins_a: i2c6-0 { + pins { -- 2.43.0 diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..e15522f --- /dev/null +++ b/build.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -e + +docker compose run --remove-orphans build "$@" +sudo chown -R "$(id -u):$(id -g)" deploy/ diff --git a/docker-compose.yml b/docker-compose.yml index 90b0f42..d7f8dd0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,6 +3,11 @@ services: build: . privileged: true volumes: + - ./board:/build/board + - ./scripts:/build/scripts + - ./toolchain:/build/toolchain + - ./overlay:/build/overlay + - ./genimage.cfg:/build/genimage.cfg - ./deploy:/build/deploy - ./debootstrap-prefetched:/build/debootstrap-prefetched command: ["--use-prefetch-debootstrap"] From 8e08903ad7e90b22d142e319f174cc798d0f90e9 Mon Sep 17 00:00:00 2001 From: Kirill Yatsenko Date: Fri, 17 Apr 2026 19:38:34 +0200 Subject: [PATCH 12/15] testing bringup --- AGENTS.md | 11 + ...-Add-Decktrix-custom-PCB-device-tree.patch | 225 ++++++++++++++++++ ...-device-tree-for-decktrix-custom-PCB.patch | 164 ------------- ...hange-I2C4-default-pins-to-PD12-PD13.patch | 24 +- board/tfa/decktrix-v1-fw-config.dts | 7 - board/tfa/decktrix-v1.dts | 47 ---- ...-Add-Decktrix-custom-PCB-device-tree.patch | 85 +++++++ board/u-boot/decktrix-v1-u-boot.dtsi | 6 - board/u-boot/decktrix-v1.dts | 37 --- ...-Add-Decktrix-custom-PCB-device-tree.patch | 102 ++++++++ build-image.sh | 59 ++--- docker-compose.yml | 1 + 12 files changed, 462 insertions(+), 306 deletions(-) create mode 100644 board/linux/patches/0006-dts-Add-Decktrix-custom-PCB-device-tree.patch delete mode 100644 board/linux/patches/0006-dts-Add-device-tree-for-decktrix-custom-PCB.patch delete mode 100644 board/tfa/decktrix-v1-fw-config.dts delete mode 100644 board/tfa/decktrix-v1.dts create mode 100644 board/tfa/patches/0002-tfa-dts-Add-Decktrix-custom-PCB-device-tree.patch delete mode 100644 board/u-boot/decktrix-v1-u-boot.dtsi delete mode 100644 board/u-boot/decktrix-v1.dts create mode 100644 board/u-boot/patches/0003-dts-Add-Decktrix-custom-PCB-device-tree.patch diff --git a/AGENTS.md b/AGENTS.md index 9ffbc96..16af71f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -53,6 +53,17 @@ Display is powered by PMIC regulators (always-on): Jadard driver uses `devm_gpiod_get_optional()` for vdd/vccio/dbg GPIOs. +## Creating patches + +**Do NOT write patch files manually.** Always: +1. Reset the relevant git tree to clean state +2. Apply existing patches in order +3. Make the desired changes to the source files +4. Run `git diff` (or `git diff --cached` after `git add`) +5. Wrap the diff in a proper patch header (From/Date/Subject/Signed-off-by) +6. Save as the next numbered patch file in the `patches/` directory +7. Remove any standalone files that should be in the patch (not copied) + ## TODO - WiFi/BT: u-blox MAYA-W166 (NXP IW416) driver, SDMMC3, UART8 diff --git a/board/linux/patches/0006-dts-Add-Decktrix-custom-PCB-device-tree.patch b/board/linux/patches/0006-dts-Add-Decktrix-custom-PCB-device-tree.patch new file mode 100644 index 0000000..d32588b --- /dev/null +++ b/board/linux/patches/0006-dts-Add-Decktrix-custom-PCB-device-tree.patch @@ -0,0 +1,225 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Kirill Yatsenko +Date: Thu, 03 Apr 2026 13:00:00 +0200 +Subject: dts: Add device tree for decktrix custom PCB + +The decktrix board is based on STM32MP157F with the same RAM as the +Discovery Kit but different pinout and peripherals: + +- STPMIC1 PMIC on I2C4 at PD12/PD13 instead of PZ4/PZ5 +- LDO1 at 2.8V for display AVDD (not 1.8V for audio) +- LDO6 at 1.8V for display IOVCC (not 1.2V for HDMI) +- Display powered by always-on PMIC regulators (no GPIO enable) + +Signed-off-by: Kirill Yatsenko +--- + arch/arm/boot/dts/st/Makefile | 1 + + arch/arm/boot/dts/st/decktrix-v1.dts | 184 ++++++++++++++++++++++++++ + 2 files changed, 185 insertions(+) + create mode 100644 arch/arm/boot/dts/st/decktrix-v1.dts + +diff --git a/arch/arm/boot/dts/st/Makefile b/arch/arm/boot/dts/st/Makefile +index 75346d084d2d..8b3d8d4c9e1f 100644 +--- a/arch/arm/boot/dts/st/Makefile ++++ b/arch/arm/boot/dts/st/Makefile +@@ -62,6 +62,7 @@ dtb-$(CONFIG_ARCH_STM32) += \ + stm32mp157c-dk2.dtb \ + stm32mp157c-dk2-scmi.dtb \ + stm32mp157c-dk2-jadard.dtb \ ++ decktrix-v1.dtb \ + stm32mp157c-ed1.dtb \ + stm32mp157c-ed1-scmi.dtb \ + stm32mp157c-emsbc-argon.dtb \ +diff --git a/arch/arm/boot/dts/st/decktrix-v1.dts b/arch/arm/boot/dts/st/decktrix-v1.dts +new file mode 100644 +index 000000000000..000000000000 +--- /dev/null ++++ b/arch/arm/boot/dts/st/decktrix-v1.dts +@@ -0,0 +1,184 @@ ++#include "stm32mp157c-dk2.dts" ++ ++/ { ++ model = "Decktrix v1"; ++ compatible = "decktrix,v1", "st,stm32mp157"; ++}; ++ ++&i2c4 { ++ pinctrl-names = "default", "sleep"; ++ pinctrl-0 = <&i2c4_pins_a>; ++ pinctrl-1 = <&i2c4_sleep_pins_a>; ++ i2c-scl-rising-time-ns = <185>; ++ i2c-scl-falling-time-ns = <20>; ++ clock-frequency = <400000>; ++ status = "okay"; ++ ++ pmic: stpmic@33 { ++ compatible = "st,stpmic1"; ++ reg = <0x33>; ++ interrupts-extended = <&exti 55 IRQ_TYPE_EDGE_FALLING>; ++ interrupt-controller; ++ #interrupt-cells = <2>; ++ status = "okay"; ++ ++ regulators { ++ compatible = "st,stpmic1-regulators"; ++ status = "okay"; ++ ++ ldo1-supply = <&v3v3>; ++ ldo2-supply = <&v3v3>; ++ ldo3-supply = <&vdd_ddr>; ++ ldo5-supply = <&v3v3>; ++ ldo6-supply = <&v3v3>; ++ pwr_sw1-supply = <&bst_out>; ++ pwr_sw2-supply = <&bst_out>; ++ ++ vddcore: buck1 { ++ regulator-name = "vddcore"; ++ regulator-min-microvolt = <1200000>; ++ regulator-max-microvolt = <1350000>; ++ regulator-active-discharge = <1>; ++ regulator-always-on; ++ regulator-initial-mode = <0>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vdd_ddr: buck2 { ++ regulator-name = "vdd_ddr"; ++ regulator-min-microvolt = <1350000>; ++ regulator-max-microvolt = <1350000>; ++ regulator-always-on; ++ regulator-active-discharge = <1>; ++ regulator-initial-mode = <0>; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1350000>; ++ }; ++ }; ++ ++ vdd: buck3 { ++ regulator-name = "vdd"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-active-discharge = <1>; ++ regulator-always-on; ++ st,mask-reset; ++ regulator-initial-mode = <0>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ v3v3: buck4 { ++ regulator-name = "v3v3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-boot-on; ++ regulator-always-on; ++ regulator-active-discharge = <1>; ++ regulator-initial-mode = <0>; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3300000>; ++ }; ++ }; ++ ++ ldo1 { ++ regulator-name = "ldo1"; ++ regulator-min-microvolt = <2800000>; ++ regulator-max-microvolt = <2800000>; ++ regulator-active-discharge = <1>; ++ regulator-always-on; ++ interrupts = ; ++ }; ++ ++ v2v8: ldo2 { ++ regulator-name = "ldo2"; ++ regulator-min-microvolt = <2800000>; ++ regulator-max-microvolt = <2800000>; ++ regulator-active-discharge = <1>; ++ regulator-always-on; ++ interrupts = ; ++ }; ++ ++ ldo3 { ++ regulator-name = "ldo3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-boot-on; ++ regulator-always-on; ++ regulator-active-discharge = <1>; ++ interrupts = ; ++ }; ++ ++ vdd_usb: ldo4 { ++ regulator-name = "ldo4"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-boot-on; ++ regulator-active-discharge = <1>; ++ interrupts = ; ++ }; ++ ++ vdd_sd: ldo5 { ++ regulator-name = "ldo5"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-boot-on; ++ regulator-active-discharge = <1>; ++ regulator-always-on; ++ interrupts = ; ++ regulator-state-mem { ++ regulator-suspend-microvolt = <3300000>; ++ regulator-on-in-suspend; ++ }; ++ }; ++ ++ ldo6 { ++ regulator-name = "ldo6"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-active-discharge = <1>; ++ regulator-always-on; ++ interrupts = ; ++ }; ++ ++ vref_ddr: vref_ddr { ++ regulator-name = "vref_ddr"; ++ regulator-always-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ }; ++ }; ++ ++ bst_out: boost { ++ regulator-name = "bst_out"; ++ interrupts = ; ++ }; ++ ++ vbus_otg: pwr_sw1 { ++ regulator-name = "vbus_otg"; ++ interrupts = ; ++ regulator-active-discharge = <1>; ++ }; ++ ++ vbus_sw: pwr_sw2 { ++ regulator-name = "vbus_sw"; ++ interrupts = ; ++ regulator-active-discharge = <1>; ++ regulator-boot-on; ++ }; ++ }; ++ }; ++}; ++ ++&sdmmc2 { ++ status = "disabled"; ++}; ++ ++&uart7 { ++ status = "disabled"; ++}; +-- +2.43.0 + diff --git a/board/linux/patches/0006-dts-Add-device-tree-for-decktrix-custom-PCB.patch b/board/linux/patches/0006-dts-Add-device-tree-for-decktrix-custom-PCB.patch deleted file mode 100644 index ad6f683..0000000 --- a/board/linux/patches/0006-dts-Add-device-tree-for-decktrix-custom-PCB.patch +++ /dev/null @@ -1,164 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Kirill Yatsenko -Date: Thu, 03 Apr 2026 13:00:00 +0200 -Subject: dts: Add device tree for decktrix custom PCB - -The decktrix board is based on STM32MP157F with the same RAM as the -Discovery Kit but different pinout and peripherals: - -- Jadard JD9365TN display (different reset/backlight GPIOs) -- Jadard touch controller on I2C1 (different IRQ/reset GPIOs) -- STPMIC1 PMIC on I2C4 at PD12/PD13 instead of PZ4/PZ5 -- LDO1 at 2.8V for display AVDD (not 1.8V for audio) -- LDO6 at 1.8V for display IOVCC (not 1.2V for HDMI) -- Display powered by always-on PMIC regulators (no GPIO enable) -- WiFi/BT disabled (u-blox MAYA-W166 uses SDMMC3/UART8, TBD) - -Signed-off-by: Kirill Yatsenko ---- - arch/arm/boot/dts/st/Makefile | 1 + - arch/arm/boot/dts/st/decktrix-v1.dts | 118 ++++++++++++++++++++++++ - 2 files changed, 119 insertions(+) - create mode 100644 arch/arm/boot/dts/st/decktrix-v1.dts - -diff --git a/arch/arm/boot/dts/st/Makefile b/arch/arm/boot/dts/st/Makefile -index 75346d084d2d..8b3d8d4c9e1f 100644 ---- a/arch/arm/boot/dts/st/Makefile -+++ b/arch/arm/boot/dts/st/Makefile -@@ -62,6 +62,7 @@ dtb-$(CONFIG_ARCH_STM32) += \ - stm32mp157c-dk2.dtb \ - stm32mp157c-dk2-scmi.dtb \ - stm32mp157c-dk2-jadard.dtb \ -+ decktrix-v1.dtb \ - stm32mp157c-ed1.dtb \ - stm32mp157c-ed1-scmi.dtb \ - stm32mp157c-emsbc-argon.dtb \ -diff --git a/arch/arm/boot/dts/st/decktrix-v1.dts b/arch/arm/boot/dts/st/decktrix-v1.dts -new file mode 100644 -index 000000000000..000000000000 ---- /dev/null -+++ b/arch/arm/boot/dts/st/decktrix-v1.dts -@@ -0,0 +1,122 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) -+/* -+ * Copyright (C) Decktrix Lab -+ * Author: Kirill Yatsenko -+ * -+ * Decktrix v1 custom PCB based on STM32MP157F. -+ * Same SoC and RAM as STM32MP157F-DK2 but with custom pinout: -+ * - Jadard JD9365TN display (different reset/backlight GPIOs) -+ * - Jadard touch on I2C1 (different IRQ/reset GPIOs) -+ * - STPMIC1 PMIC on I2C4 at PD12/PD13 (not PZ4/PZ5) -+ * - LDO1 at 2.8V for display AVDD (not 1.8V for audio) -+ * - LDO6 at 1.8V for display IOVCC (not 1.2V for HDMI) -+ * - WiFi/BT disabled (u-blox MAYA-W166 uses SDMMC3/UART8, TBD) -+ */ -+ -+/dts-v1/; -+ -+#include "stm32mp157.dtsi" -+#include "stm32mp15xc.dtsi" -+#include "stm32mp15-pinctrl.dtsi" -+#include "stm32mp15xxac-pinctrl.dtsi" -+#include "stm32mp15xx-dkx.dtsi" -+ -+/ { -+ model = "Decktrix v1"; -+ compatible = "decktrix,v1", "st,stm32mp157"; -+ -+ aliases { -+ ethernet0 = ðernet0; -+ }; -+ -+ chosen { -+ stdout-path = "serial0:115200n8"; -+ }; -+}; -+ -+&cryp1 { -+ status = "okay"; -+}; -+ -+&dsi { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ /* Jadard JD9365TN 480x1080 MIPI DSI panel */ -+ panel@0 { -+ compatible = "shenzen,z34014p30365ty1", "jadard,jd9365tn"; -+ reg = <0>; -+ reset-gpios = <&gpiod 11 GPIO_ACTIVE_HIGH>; -+ backlight-gpios = <&gpiof 6 GPIO_ACTIVE_HIGH>; -+ status = "okay"; -+ -+ port { -+ panel_in: endpoint { -+ remote-endpoint = <&dsi_out>; -+ }; -+ }; -+ }; -+}; -+ -+&dsi_in { -+ remote-endpoint = <<dc_ep1_out>; -+}; -+ -+&dsi_out { -+ remote-endpoint = <&panel_in>; -+}; -+ -+/* PMIC LDO1: 2.8V for display AVDD (2V8 rail on decktrix PCB) */ -+&v1v8_audio { -+ regulator-name = "ldo1"; -+ regulator-min-microvolt = <2800000>; -+ regulator-max-microvolt = <2800000>; -+}; -+ -+/* PMIC LDO6: 1.8V for display IOVCC (1V8 rail on decktrix PCB) */ -+&v1v2_hdmi { -+ regulator-name = "ldo6"; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+}; -+ -+&i2c1 { -+ jadard@68 { -+ compatible = "jadard,jdcommon"; -+ reg = <0x68>; -+ interrupts-extended = <&gpiog 7 IRQ_TYPE_EDGE_FALLING>; -+ jadard,panel-sense-nums = <30 48>; -+ jadard,panel-coords = <0 480 0 1080>; -+ jadard,panel-max-points = <10>; -+ jadard,int-is-edge = <1>; -+ jadard,irq-gpio = <&gpiog 7 GPIO_ACTIVE_HIGH>; -+ jadard,rst-gpio = <&gpioe 10 GPIO_ACTIVE_HIGH>; -+ status = "okay"; -+ }; -+}; -+ -+<dc { -+ status = "okay"; -+ -+ port { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ ltdc_ep1_out: endpoint@1 { -+ reg = <1>; -+ remote-endpoint = <&dsi_in>; -+ }; -+ }; -+}; -+ -+/* WiFi disabled - u-blox MAYA-W166 uses SDMMC3, driver TBD */ -+&sdmmc2 { -+ status = "disabled"; -+}; -+ -+/* BT disabled - u-blox MAYA-W166 uses UART8, driver TBD */ -+&uart7 { -+ status = "disabled"; -+}; --- -2.43.0 diff --git a/board/linux/patches/0009-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch b/board/linux/patches/0009-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch index 173e965..f9bbd6c 100644 --- a/board/linux/patches/0009-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch +++ b/board/linux/patches/0009-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch @@ -6,21 +6,17 @@ Subject: dts: stm32mp15-pinctrl: Move I2C4 to PD12/PD13 On the decktrix v1 custom PCB, the PMIC (STPMIC1) I2C4 bus uses PD12 (SCL) and PD13 (SDA) instead of the default PZ4/PZ5. -Move the i2c4 pinctrl nodes to the top of the controller section. - Signed-off-by: Kirill Yatsenko --- - arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi | 36 ++++++++++++++------- - 1 file changed, 22 insertions(+), 14 deletions(-) + arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi | 43 +++++++++++++------ + 1 file changed, 28 insertions(+), 15 deletions(-) -diff --git a/arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi b/arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi -index 534a03da2..9abd1125a 100644 ---- a/arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi -+++ b/arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi -@@ -25,6 +25,23 @@ pins { - }; +--- a/arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi 2026-04-09 13:14:54.318397270 +0200 ++++ b/arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi 2026-04-09 13:14:54.332397664 +0200 +@@ -19,6 +19,25 @@ }; + /omit-if-no-ref/ + i2c4_pins_a: i2c4-0 { + pins { + pinmux = , /* I2C4_SCL */ @@ -31,6 +27,7 @@ index 534a03da2..9abd1125a 100644 + }; + }; + ++ /omit-if-no-ref/ + i2c4_sleep_pins_a: i2c4-sleep-0 { + pins { + pinmux = , /* I2C4_SCL */ @@ -38,13 +35,15 @@ index 534a03da2..9abd1125a 100644 + }; + }; + ++ /omit-if-no-ref/ adc1_in6_pins_a: adc1-in6-0 { pins { pinmux = ; -@@ -2831,22 +2848,6 @@ pins { +@@ -3353,24 +3372,6 @@ }; }; +- /omit-if-no-ref/ - i2c4_pins_a: i2c4-0 { - pins { - pinmux = , /* I2C4_SCL */ @@ -55,6 +54,7 @@ index 534a03da2..9abd1125a 100644 - }; - }; - +- /omit-if-no-ref/ - i2c4_sleep_pins_a: i2c4-sleep-0 { - pins { - pinmux = , /* I2C4_SCL */ @@ -62,7 +62,7 @@ index 534a03da2..9abd1125a 100644 - }; - }; + /omit-if-no-ref/ i2c6_pins_a: i2c6-0 { - pins { -- 2.43.0 diff --git a/board/tfa/decktrix-v1-fw-config.dts b/board/tfa/decktrix-v1-fw-config.dts deleted file mode 100644 index 346fc98..0000000 --- a/board/tfa/decktrix-v1-fw-config.dts +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) -/* - * Copyright (C) Decktrix Lab - */ - -#define DDR_SIZE 0x20000000 /* 512MB */ -#include "stm32mp15-fw-config.dtsi" diff --git a/board/tfa/decktrix-v1.dts b/board/tfa/decktrix-v1.dts deleted file mode 100644 index 3b4dfd1..0000000 --- a/board/tfa/decktrix-v1.dts +++ /dev/null @@ -1,47 +0,0 @@ -// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) -/* - * Copyright (C) Decktrix Lab - * Author: Kirill Yatsenko - * - * Decktrix v1 custom PCB based on STM32MP157F. - * I2C4 pinctrl configured via patch in stm32mp15-pinctrl.dtsi. - */ - -/dts-v1/; - -#include "stm32mp157.dtsi" -#include "stm32mp15xc.dtsi" -#include "stm32mp15-pinctrl.dtsi" -#include "stm32mp15xxac-pinctrl.dtsi" -#include "stm32mp15xx-dkx.dtsi" - -/ { - model = "Decktrix v1"; - compatible = "decktrix,v1", "st,stm32mp157"; - - aliases { - serial3 = &usart2; - }; - - chosen { - stdout-path = "serial0:115200n8"; - }; -}; - -&cryp1 { - status = "okay"; -}; - -/* PMIC LDO1: 2.8V for display AVDD (2V8 rail on decktrix PCB) */ -&v1v8_audio { - regulator-name = "ldo1"; - regulator-min-microvolt = <2800000>; - regulator-max-microvolt = <2800000>; -}; - -/* PMIC LDO6: 1.8V for display IOVCC (1V8 rail on decktrix PCB) */ -&v1v2_hdmi { - regulator-name = "ldo6"; - regulator-min-microvolt = <1800000>; - regulator-max-microvolt = <1800000>; -}; diff --git a/board/tfa/patches/0002-tfa-dts-Add-Decktrix-custom-PCB-device-tree.patch b/board/tfa/patches/0002-tfa-dts-Add-Decktrix-custom-PCB-device-tree.patch new file mode 100644 index 0000000..fcc56df --- /dev/null +++ b/board/tfa/patches/0002-tfa-dts-Add-Decktrix-custom-PCB-device-tree.patch @@ -0,0 +1,85 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Kirill Yatsenko +Date: Thu, 03 Apr 2026 15:00:00 +0200 +Subject: dts: Add device tree for decktrix custom PCB + +Decktrix v1 custom PCB based on STM32MP157F. +LDO1 at 2.8V for display AVDD, LDO6 at 1.8V for display IOVCC. + +Signed-off-by: Kirill Yatsenko +--- + fdts/decktrix-v1.dts | 47 ++++++++++++++++++++++++++++++++ + fdts/decktrix-v1-fw-config.dts | 7 ++++ + 2 files changed, 54 insertions(+) + create mode 100644 fdts/decktrix-v1.dts + create mode 100644 fdts/decktrix-v1-fw-config.dts + +diff --git a/fdts/decktrix-v1.dts b/fdts/decktrix-v1.dts +new file mode 100644 +index 00000000..3b4dfd1f +--- /dev/null ++++ b/fdts/decktrix-v1.dts +@@ -0,0 +1,47 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) ++/* ++ * Copyright (C) Decktrix Lab ++ * Author: Kirill Yatsenko ++ * ++ * Decktrix v1 custom PCB based on STM32MP157F. ++ * I2C4 pinctrl configured via patch in stm32mp15-pinctrl.dtsi. ++ */ ++ ++/dts-v1/; ++ ++#include "stm32mp157.dtsi" ++#include "stm32mp15xc.dtsi" ++#include "stm32mp15-pinctrl.dtsi" ++#include "stm32mp15xxac-pinctrl.dtsi" ++#include "stm32mp15xx-dkx.dtsi" ++ ++/ { ++ model = "Decktrix v1"; ++ compatible = "decktrix,v1", "st,stm32mp157"; ++ ++ aliases { ++ serial3 = &usart2; ++ }; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++}; ++ ++&cryp1 { ++ status = "okay"; ++}; ++ ++/* PMIC LDO1: 2.8V for display AVDD (2V8 rail on decktrix PCB) */ ++&v1v8_audio { ++ regulator-name = "ldo1"; ++ regulator-min-microvolt = <2800000>; ++ regulator-max-microvolt = <2800000>; ++}; ++ ++/* PMIC LDO6: 1.8V for display IOVCC (1V8 rail on decktrix PCB) */ ++&v1v2_hdmi { ++ regulator-name = "ldo6"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++}; +diff --git a/fdts/decktrix-v1-fw-config.dts b/fdts/decktrix-v1-fw-config.dts +new file mode 100644 +index 00000000..346fc98f +--- /dev/null ++++ b/fdts/decktrix-v1-fw-config.dts +@@ -0,0 +1,7 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) ++/* ++ * Copyright (C) Decktrix Lab ++ */ ++ ++#define DDR_SIZE 0x20000000 /* 512MB */ ++#include "stm32mp15-fw-config.dtsi" +-- +2.43.0 + diff --git a/board/u-boot/decktrix-v1-u-boot.dtsi b/board/u-boot/decktrix-v1-u-boot.dtsi deleted file mode 100644 index 384f306..0000000 --- a/board/u-boot/decktrix-v1-u-boot.dtsi +++ /dev/null @@ -1,6 +0,0 @@ -// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) -/* - * Copyright (C) Decktrix Lab - */ - -#include "stm32mp157a-dk1-u-boot.dtsi" diff --git a/board/u-boot/decktrix-v1.dts b/board/u-boot/decktrix-v1.dts deleted file mode 100644 index 1cd2796..0000000 --- a/board/u-boot/decktrix-v1.dts +++ /dev/null @@ -1,37 +0,0 @@ -// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) -/* - * Copyright (C) Decktrix Lab - * Author: Kirill Yatsenko - * - * Decktrix v1 custom PCB based on STM32MP157F. - * DSI disabled to avoid conflict with kernel Jadard driver. - */ - -/dts-v1/; - -#include "stm32mp157.dtsi" -#include "stm32mp15xc.dtsi" -#include "stm32mp15-pinctrl.dtsi" -#include "stm32mp15xxac-pinctrl.dtsi" -#include "stm32mp15xx-dkx.dtsi" - -/ { - model = "Decktrix v1"; - compatible = "decktrix,v1", "st,stm32mp157"; - - aliases { - ethernet0 = ðernet0; - }; - - chosen { - stdout-path = "serial0:115200n8"; - }; -}; - -&cryp1 { - status = "okay"; -}; - -&dsi { - status = "disabled"; -}; diff --git a/board/u-boot/patches/0003-dts-Add-Decktrix-custom-PCB-device-tree.patch b/board/u-boot/patches/0003-dts-Add-Decktrix-custom-PCB-device-tree.patch new file mode 100644 index 0000000..f909378 --- /dev/null +++ b/board/u-boot/patches/0003-dts-Add-Decktrix-custom-PCB-device-tree.patch @@ -0,0 +1,102 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Kirill Yatsenko +Date: Thu, 03 Apr 2026 14:00:00 +0200 +Subject: dts: Add device tree for decktrix custom PCB + +Decktrix v1 custom PCB based on STM32MP157F. +DSI disabled to avoid conflict with kernel Jadard driver. +PMIC LDO1 at 2.8V for display AVDD, LDO6 at 1.8V for display IOVCC. + +Signed-off-by: Kirill Yatsenko +--- + arch/arm/dts/Makefile | 1 + + arch/arm/dts/decktrix-v1.dts | 51 +++++++++++++++++++++++++ + arch/arm/dts/decktrix-v1-u-boot.dtsi | 6 +++ + 3 files changed, 58 insertions(+) + create mode 100644 arch/arm/dts/decktrix-v1.dts + create mode 100644 arch/arm/dts/decktrix-v1-u-boot.dtsi + +diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile +index 267b0179..78206161 100644 +--- a/arch/arm/dts/Makefile ++++ b/arch/arm/dts/Makefile +@@ -1090,6 +1090,7 @@ dtb-$(CONFIG_STM32MP15X) += \ + stm32mp157a-microgea-stm32mp1-microdev2.0-of7.dtb \ + stm32mp157c-dk2.dtb \ + stm32mp157c-dk2-scmi.dtb \ ++ decktrix-v1.dtb \ + stm32mp157c-ed1.dtb \ + stm32mp157c-ed1-scmi.dtb \ + stm32mp157c-ev1.dtb \ +diff --git a/arch/arm/dts/decktrix-v1.dts b/arch/arm/dts/decktrix-v1.dts +new file mode 100644 +index 00000000..c1ca7a1b +--- /dev/null ++++ b/arch/arm/dts/decktrix-v1.dts +@@ -0,0 +1,51 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) ++/* ++ * Copyright (C) Decktrix Lab ++ * Author: Kirill Yatsenko ++ * ++ * Decktrix v1 custom PCB based on STM32MP157F. ++ * DSI disabled to avoid conflict with kernel Jadard driver. ++ */ ++ ++/dts-v1/; ++ ++#include "stm32mp157.dtsi" ++#include "stm32mp15xc.dtsi" ++#include "stm32mp15-pinctrl.dtsi" ++#include "stm32mp15xxac-pinctrl.dtsi" ++#include "stm32mp15xx-dkx.dtsi" ++ ++/ { ++ model = "Decktrix v1"; ++ compatible = "decktrix,v1", "st,stm32mp157"; ++ ++ aliases { ++ ethernet0 = ðernet0; ++ }; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++}; ++ ++&cryp1 { ++ status = "okay"; ++}; ++ ++&dsi { ++ status = "disabled"; ++}; ++ ++/* PMIC LDO1: 2.8V for display AVDD (not 1.8V for audio) */ ++&v1v8_audio { ++ regulator-name = "ldo1"; ++ regulator-min-microvolt = <2800000>; ++ regulator-max-microvolt = <2800000>; ++}; ++ ++/* PMIC LDO6: 1.8V for display IOVCC (not 1.2V for HDMI) */ ++&v1v2_hdmi { ++ regulator-name = "ldo6"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++}; +diff --git a/arch/arm/dts/decktrix-v1-u-boot.dtsi b/arch/arm/dts/decktrix-v1-u-boot.dtsi +new file mode 100644 +index 00000000..384f306c +--- /dev/null ++++ b/arch/arm/dts/decktrix-v1-u-boot.dtsi +@@ -0,0 +1,6 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) ++/* ++ * Copyright (C) Decktrix Lab ++ */ ++ ++#include "stm32mp157a-dk1-u-boot.dtsi" +-- +2.43.0 + diff --git a/build-image.sh b/build-image.sh index ebf935c..6323611 100755 --- a/build-image.sh +++ b/build-image.sh @@ -28,28 +28,29 @@ BOARD_DT="stm32mp157c-dk2" prepare_toolchain() { echo "-I preparing toolchain for cross compilation" + # Allow git operations inside Docker (different file ownership) + git config --global --add safe.directory "*" + mkdir -p toolchain/extracted tar -xf $(pwd)/toolchain/${TOOLCHAIN_NAME} -C toolchain/extracted CC="$(pwd)/toolchain/extracted/${TOOLCHAIN_EXTRACTED_PATH}" } apply_kernel_patches() { - # The patch may already be applied on the second run which will return error - # so let's ignore it - git apply --reject --directory ${KERNEL_DIR} \ - board/linux/patches/0001-defconfig-Add-separate-config-based-on-multi_v7_defc.patch \ - board/linux/patches/0002-dts-Add-separate-device-tree-for-stm32-devboard-with.patch \ - board/linux/patches/0003-display-Add-Jadard-MIPI-driver.patch \ - board/linux/patches/0004-display-Add-Jadard-touch-driver.patch \ - board/linux/patches/0005-dts-Add-support-for-home-button.patch \ - board/linux/patches/0006-dts-Add-device-tree-for-decktrix-custom-PCB.patch \ - board/linux/patches/0009-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch || true + git -C ${KERNEL_DIR} reset --hard HEAD + git -C ${KERNEL_DIR} clean -fd + + for p in board/linux/patches/*.patch; do + echo " Applying $(basename $p)" + git apply --directory ${KERNEL_DIR} "$p" + done } build_kernel() { echo "-I start kernel build" apply_kernel_patches + make -C ${KERNEL_DIR} ARCH=arm CROSS_COMPILE=${CC} decktrix_defconfig make -C ${KERNEL_DIR} ARCH=arm CROSS_COMPILE=${CC} zImage modules dtbs -j$(nproc) } @@ -57,19 +58,25 @@ build_kernel() { apply_uboot_patches() { echo "-I apply u-boot patches" - git apply --check --directory ${UBOOT_DIR} \ - board/u-boot/patches/0001-DT-disable-DSI-node.patch || true + git -C ${UBOOT_DIR} reset --hard HEAD + git -C ${UBOOT_DIR} clean -fd - git apply --reject --directory ${UBOOT_DIR} \ - board/u-boot/patches/0001-DT-disable-DSI-node.patch \ - board/u-boot/patches/0002-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch || true + for p in board/u-boot/patches/*.patch; do + echo " Applying $(basename $p)" + git apply --directory ${UBOOT_DIR} "$p" + done } apply_tfa_patches() { echo "-I apply tfa patches" - git apply --reject --directory ${TFA_DIR} \ - board/tfa/patches/0001-tfa-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch || true + git -C ${TFA_DIR} reset --hard HEAD + git -C ${TFA_DIR} clean -fd + + for p in board/tfa/patches/*.patch; do + echo " Applying $(basename $p)" + git apply --directory ${TFA_DIR} "$p" + done } build_uboot() { @@ -77,16 +84,6 @@ build_uboot() { apply_uboot_patches - if [ "${BOARD_DT}" = "decktrix-v1" ]; then - cp board/u-boot/decktrix-v1.dts ${UBOOT_DIR}/arch/arm/dts/ - cp board/u-boot/decktrix-v1-u-boot.dtsi ${UBOOT_DIR}/arch/arm/dts/ - # Add decktrix-v1 to the STM32MP15X DTB list if not already present - if ! grep -q "decktrix-v1" ${UBOOT_DIR}/arch/arm/dts/Makefile; then - sed -i '/stm32mp157c-dk2-scmi.dtb/a\\tdecktrix-v1.dtb \\' \ - ${UBOOT_DIR}/arch/arm/dts/Makefile - fi - fi - make -C ${UBOOT_DIR} CROSS_COMPILE=${CC} stm32mp15_trusted_defconfig make -C ${UBOOT_DIR} CROSS_COMPILE=${CC} DEVICE_TREE=${BOARD_DT} -j all } @@ -96,11 +93,6 @@ build_tfa() { apply_tfa_patches - if [ "${BOARD_DT}" = "decktrix-v1" ]; then - cp board/tfa/decktrix-v1.dts ${TFA_DIR}/fdts/ - cp board/tfa/decktrix-v1-fw-config.dts ${TFA_DIR}/fdts/ - fi - make -C ${TFA_DIR} \ PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 CROSS_COMPILE=${CC} \ STM32MP_SDMMC=1 STM32MP_EMMC=1 \ @@ -379,7 +371,8 @@ print_help() { start_image_build() { skip_board=false - selected_dt=${STM32_DT} + selected_dt=${DECKTRIX_DT} + BOARD_DT="decktrix-v1" POSITIONAL_ARGS=() diff --git a/docker-compose.yml b/docker-compose.yml index d7f8dd0..81e686b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,6 +3,7 @@ services: build: . privileged: true volumes: + - ./.git:/build/.git - ./board:/build/board - ./scripts:/build/scripts - ./toolchain:/build/toolchain From c02fa7f266829db4c6060c12f31a6ba03af62541 Mon Sep 17 00:00:00 2001 From: Kirill Yatsenko Date: Fri, 17 Apr 2026 21:58:36 +0200 Subject: [PATCH 13/15] fix broken sd card, card detect pin --- AGENTS.md | 4 --- TODO.md | 4 +++ .../0007-dts-sdmmc1-Use-broken-cd.patch | 32 +++++++++++++++++++ .../0004-dts-sdmmc1-Use-broken-cd.patch | 29 +++++++++++++++++ 4 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 TODO.md create mode 100644 board/linux/patches/0007-dts-sdmmc1-Use-broken-cd.patch create mode 100644 board/u-boot/patches/0004-dts-sdmmc1-Use-broken-cd.patch diff --git a/AGENTS.md b/AGENTS.md index 16af71f..09170e8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -64,10 +64,6 @@ Jadard driver uses `devm_gpiod_get_optional()` for vdd/vccio/dbg GPIOs. 6. Save as the next numbered patch file in the `patches/` directory 7. Remove any standalone files that should be in the patch (not copied) -## TODO - -- WiFi/BT: u-blox MAYA-W166 (NXP IW416) driver, SDMMC3, UART8 - ## Google Drive upload ```bash diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..fcca093 --- /dev/null +++ b/TODO.md @@ -0,0 +1,4 @@ +# TODO + +- [ ] SD card detect: replace `broken-cd` with actual GPIO `<&gpioe 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>` (PE3) in both U-Boot and kernel DTS patches +- [ ] WiFi/BT: u-blox MAYA-W166 (NXP IW416) driver, SDMMC3, UART8 diff --git a/board/linux/patches/0007-dts-sdmmc1-Use-broken-cd.patch b/board/linux/patches/0007-dts-sdmmc1-Use-broken-cd.patch new file mode 100644 index 0000000..481a821 --- /dev/null +++ b/board/linux/patches/0007-dts-sdmmc1-Use-broken-cd.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Kirill Yatsenko +Date: Thu, 17 Apr 2026 20:00:00 +0200 +Subject: dts: sdmmc1: Use broken-cd + +Decktrix v1 PCB has no card detect on PB7. +Use broken-cd to skip GPIO card detect check. + +Signed-off-by: Kirill Yatsenko +--- + arch/arm/boot/dts/st/decktrix-v1.dts | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/arch/arm/boot/dts/st/decktrix-v1.dts b/arch/arm/boot/dts/st/decktrix-v1.dts +index c70793335..c8d88834f 100644 +--- a/arch/arm/boot/dts/st/decktrix-v1.dts ++++ b/arch/arm/boot/dts/st/decktrix-v1.dts +@@ -175,6 +175,11 @@ vbus_sw: pwr_sw2 { + }; + }; + ++&sdmmc1 { ++ /delete-property/ cd-gpios; ++ broken-cd; ++}; ++ + &sdmmc2 { + status = "disabled"; + }; +-- +2.43.0 + diff --git a/board/u-boot/patches/0004-dts-sdmmc1-Use-broken-cd.patch b/board/u-boot/patches/0004-dts-sdmmc1-Use-broken-cd.patch new file mode 100644 index 0000000..a310884 --- /dev/null +++ b/board/u-boot/patches/0004-dts-sdmmc1-Use-broken-cd.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Kirill Yatsenko +Date: Thu, 17 Apr 2026 20:00:00 +0200 +Subject: dts: sdmmc1: Use broken-cd + +Decktrix v1 PCB has no card detect on PB7. +Use broken-cd to skip GPIO card detect check. + +Signed-off-by: Kirill Yatsenko +--- + arch/arm/dts/decktrix-v1.dts | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/arch/arm/dts/decktrix-v1.dts b/arch/arm/dts/decktrix-v1.dts +index c1ca7a1b..008dc8e3 100644 +--- a/arch/arm/dts/decktrix-v1.dts ++++ b/arch/arm/dts/decktrix-v1.dts +@@ -49,3 +49,8 @@ + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + }; ++ ++&sdmmc1 { ++ /delete-property/ cd-gpios; ++ broken-cd; ++}; +-- +2.43.0 + From ce343da482fda62ba589e1a74cf4edd80db1672c Mon Sep 17 00:00:00 2001 From: Kirill Yatsenko Date: Sat, 18 Apr 2026 07:52:28 +0200 Subject: [PATCH 14/15] Board booted! --- ...-Add-Decktrix-custom-PCB-device-tree.patch | 96 ++++++++++++++----- ...hange-I2C4-default-pins-to-PD12-PD13.patch | 60 ++++++++---- 2 files changed, 116 insertions(+), 40 deletions(-) diff --git a/board/linux/patches/0006-dts-Add-Decktrix-custom-PCB-device-tree.patch b/board/linux/patches/0006-dts-Add-Decktrix-custom-PCB-device-tree.patch index d32588b..e09a29b 100644 --- a/board/linux/patches/0006-dts-Add-Decktrix-custom-PCB-device-tree.patch +++ b/board/linux/patches/0006-dts-Add-Decktrix-custom-PCB-device-tree.patch @@ -3,39 +3,22 @@ From: Kirill Yatsenko Date: Thu, 03 Apr 2026 13:00:00 +0200 Subject: dts: Add device tree for decktrix custom PCB -The decktrix board is based on STM32MP157F with the same RAM as the -Discovery Kit but different pinout and peripherals: +The decktrix board is based on STM32MP157F with different pinout: - STPMIC1 PMIC on I2C4 at PD12/PD13 instead of PZ4/PZ5 +- Jadard JD9365TN touchscreen on I2C1 at PB7/PB8 (IRQ=PG7, reset=PE10) +- Jadard DSI display (reset=PD11, backlight=PF6, powered by PMIC LDO1/LDO6) - LDO1 at 2.8V for display AVDD (not 1.8V for audio) - LDO6 at 1.8V for display IOVCC (not 1.2V for HDMI) -- Display powered by always-on PMIC regulators (no GPIO enable) Signed-off-by: Kirill Yatsenko --- - arch/arm/boot/dts/st/Makefile | 1 + - arch/arm/boot/dts/st/decktrix-v1.dts | 184 ++++++++++++++++++++++++++ - 2 files changed, 185 insertions(+) - create mode 100644 arch/arm/boot/dts/st/decktrix-v1.dts - -diff --git a/arch/arm/boot/dts/st/Makefile b/arch/arm/boot/dts/st/Makefile -index 75346d084d2d..8b3d8d4c9e1f 100644 ---- a/arch/arm/boot/dts/st/Makefile -+++ b/arch/arm/boot/dts/st/Makefile -@@ -62,6 +62,7 @@ dtb-$(CONFIG_ARCH_STM32) += \ - stm32mp157c-dk2.dtb \ - stm32mp157c-dk2-scmi.dtb \ - stm32mp157c-dk2-jadard.dtb \ -+ decktrix-v1.dtb \ - stm32mp157c-ed1.dtb \ - stm32mp157c-ed1-scmi.dtb \ - stm32mp157c-emsbc-argon.dtb \ diff --git a/arch/arm/boot/dts/st/decktrix-v1.dts b/arch/arm/boot/dts/st/decktrix-v1.dts new file mode 100644 -index 000000000000..000000000000 +index 000000000..869ca7153 --- /dev/null +++ b/arch/arm/boot/dts/st/decktrix-v1.dts -@@ -0,0 +1,184 @@ +@@ -0,0 +1,252 @@ +#include "stm32mp157c-dk2.dts" + +/ { @@ -213,6 +196,74 @@ index 000000000000..000000000000 + }; +}; + ++&i2c1 { ++ pinctrl-names = "default", "sleep"; ++ pinctrl-0 = <&i2c1_pins_d>; ++ pinctrl-1 = <&i2c1_sleep_pins_d>; ++ status = "okay"; ++ ++ jadard@68 { ++ compatible = "jadard,jdcommon"; ++ reg = <0x68>; ++ interrupts = <13 IRQ_TYPE_EDGE_FALLING>; ++ interrupt-parent = <&gpiog>; ++ jadard,irq-gpio = <&gpiog 7 GPIO_ACTIVE_HIGH>; ++ jadard,rst-gpio = <&gpioe 10 GPIO_ACTIVE_HIGH>; ++ jadard,panel-sense-nums = <30 48>; ++ jadard,panel-coords = <0 480 0 1080>; ++ jadard,panel-max-points = <10>; ++ jadard,int-is-edge = <1>; ++ status = "okay"; ++ }; ++}; ++ ++&dsi { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ panel@0 { ++ compatible = "shenzen,z34014p30365ty1","jadard,jd9365tn"; ++ reg = <0>; ++ reset-gpios = <&gpiod 11 GPIO_ACTIVE_HIGH>; ++ backlight-gpios = <&gpiof 6 GPIO_ACTIVE_HIGH>; ++ status = "okay"; ++ ++ port { ++ panel_in: endpoint { ++ remote-endpoint = <&dsi_out>; ++ }; ++ }; ++ }; ++}; ++ ++&dsi_in { ++ remote-endpoint = <<dc_ep1_out>; ++}; ++ ++&dsi_out { ++ remote-endpoint = <&panel_in>; ++}; ++ ++<dc { ++ status = "okay"; ++ ++ port { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ ltdc_ep1_out: endpoint@1 { ++ reg = <1>; ++ remote-endpoint = <&dsi_in>; ++ }; ++ }; ++}; ++ ++&sdmmc1 { ++ /delete-property/ cd-gpios; ++ broken-cd; ++}; ++ +&sdmmc2 { + status = "disabled"; +}; @@ -222,4 +273,3 @@ index 000000000000..000000000000 +}; -- 2.43.0 - diff --git a/board/linux/patches/0009-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch b/board/linux/patches/0009-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch index f9bbd6c..885c25a 100644 --- a/board/linux/patches/0009-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch +++ b/board/linux/patches/0009-dts-stm32mp15-pinctrl-Change-I2C4-default-pins-to-PD12-PD13.patch @@ -1,22 +1,23 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Kirill Yatsenko Date: Thu, 03 Apr 2026 17:00:00 +0200 -Subject: dts: stm32mp15-pinctrl: Move I2C4 to PD12/PD13 +Subject: dts: stm32mp15-pinctrl: Move I2C4 to PD12/PD13, add I2C1 PB7/PB8 -On the decktrix v1 custom PCB, the PMIC (STPMIC1) I2C4 bus uses -PD12 (SCL) and PD13 (SDA) instead of the default PZ4/PZ5. +On the decktrix v1 custom PCB: +- PMIC (STPMIC1) I2C4 bus uses PD12 (SCL) and PD13 (SDA) instead of PZ4/PZ5 +- Touchscreen I2C1 uses PB7 (SCL) and PB8 (SDA) instead of PD12/PF15 Signed-off-by: Kirill Yatsenko --- - arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi | 43 +++++++++++++------ - 1 file changed, 28 insertions(+), 15 deletions(-) - ---- a/arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi 2026-04-09 13:14:54.318397270 +0200 -+++ b/arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi 2026-04-09 13:14:54.332397664 +0200 -@@ -19,6 +19,25 @@ +diff --git a/arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi b/arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi +index 40605ea85..dd0e34eb6 100644 +--- a/arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi ++++ b/arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi +@@ -18,6 +18,25 @@ pins { + }; }; - - /omit-if-no-ref/ + ++ /omit-if-no-ref/ + i2c4_pins_a: i2c4-0 { + pins { + pinmux = , /* I2C4_SCL */ @@ -35,14 +36,39 @@ Signed-off-by: Kirill Yatsenko + }; + }; + -+ /omit-if-no-ref/ + /omit-if-no-ref/ adc1_in6_pins_a: adc1-in6-0 { pins { - pinmux = ; -@@ -3353,24 +3372,6 @@ +@@ -788,6 +807,25 @@ pins { }; }; - + ++ /omit-if-no-ref/ ++ i2c1_pins_d: i2c1-3 { ++ pins { ++ pinmux = , /* I2C1_SCL */ ++ ; /* I2C1_SDA */ ++ bias-disable; ++ drive-open-drain; ++ slew-rate = <0>; ++ }; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c1_sleep_pins_d: i2c1-sleep-3 { ++ pins { ++ pinmux = , /* I2C1_SCL */ ++ ; /* I2C1_SDA */ ++ }; ++ }; ++ + /omit-if-no-ref/ + i2c2_pins_a: i2c2-0 { + pins { +@@ -3353,24 +3391,6 @@ pins { + }; + }; + - /omit-if-no-ref/ - i2c4_pins_a: i2c4-0 { - pins { @@ -61,8 +87,8 @@ Signed-off-by: Kirill Yatsenko - ; /* I2C4_SDA */ - }; - }; - + /omit-if-no-ref/ i2c6_pins_a: i2c6-0 { --- +-- 2.43.0 From fb82441276e1b20768c5e7d92b78aa7a843ca5e7 Mon Sep 17 00:00:00 2001 From: Kirill Yatsenko Date: Sat, 18 Apr 2026 11:21:17 +0200 Subject: [PATCH 15/15] Fix docker permissions Now repos are owned by ubuntu user instead of root --- Dockerfile | 5 +++ .../0007-dts-sdmmc1-Use-broken-cd.patch | 32 ------------------- build-image.sh | 2 +- 3 files changed, 6 insertions(+), 33 deletions(-) delete mode 100644 board/linux/patches/0007-dts-sdmmc1-Use-broken-cd.patch diff --git a/Dockerfile b/Dockerfile index 451823b..3fc4d7c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,9 +29,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ qemu-user-static \ && rm -rf /var/lib/apt/lists/* +RUN echo "ubuntu ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/builduser \ + && chmod 0440 /etc/sudoers.d/builduser + WORKDIR /build COPY build-image.sh . RUN chmod +x build-image.sh +USER ubuntu + ENTRYPOINT ["./build-image.sh"] diff --git a/board/linux/patches/0007-dts-sdmmc1-Use-broken-cd.patch b/board/linux/patches/0007-dts-sdmmc1-Use-broken-cd.patch deleted file mode 100644 index 481a821..0000000 --- a/board/linux/patches/0007-dts-sdmmc1-Use-broken-cd.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Kirill Yatsenko -Date: Thu, 17 Apr 2026 20:00:00 +0200 -Subject: dts: sdmmc1: Use broken-cd - -Decktrix v1 PCB has no card detect on PB7. -Use broken-cd to skip GPIO card detect check. - -Signed-off-by: Kirill Yatsenko ---- - arch/arm/boot/dts/st/decktrix-v1.dts | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/arch/arm/boot/dts/st/decktrix-v1.dts b/arch/arm/boot/dts/st/decktrix-v1.dts -index c70793335..c8d88834f 100644 ---- a/arch/arm/boot/dts/st/decktrix-v1.dts -+++ b/arch/arm/boot/dts/st/decktrix-v1.dts -@@ -175,6 +175,11 @@ vbus_sw: pwr_sw2 { - }; - }; - -+&sdmmc1 { -+ /delete-property/ cd-gpios; -+ broken-cd; -+}; -+ - &sdmmc2 { - status = "disabled"; - }; --- -2.43.0 - diff --git a/build-image.sh b/build-image.sh index 6323611..36d8826 100755 --- a/build-image.sh +++ b/build-image.sh @@ -338,7 +338,7 @@ create_rootfs_ext4() { generate_sdcard_img() { echo "-I generate sdcard image" - genimage --inputpath deploy --outputpath deploy --config genimage.cfg + $MAYBE_SUDO genimage --inputpath deploy --outputpath deploy --config genimage.cfg } gzip_sdcard_img() {