mohitmishra786/low-level-dev-skills

device-tree

Device tree skill for Linux hardware description.

소스 보기
원본 Skill 문서

원본 저장소의 제목, 예시, 코드, 표, 링크, 이미지를 유지해 표시합니다.

Device Tree (Devicetree)

Purpose

Guide agents through Linux device tree source (DTS): syntax, bindings, phandles, overlays, and how the kernel OF (Open Firmware) layer parses hardware description into platform_device instances.

When to Use

  • Platform driver not probing — DT mismatch
  • Adding a new board .dts or fragment overlay
  • Understanding compatible, reg, interrupts, clocks properties
  • Cross-checking hardware with skills/kernel-dev/platform-device-model

Workflow

1. DTS structure

dts
/dts-v1/;
#include "soc.dtsi"

/ {
    model = "My Board";
    compatible = "vendor,my-board", "vendor,soc-family";

    soc {
        uart0: serial@40011000 {
            compatible = "vendor,uart";
            reg = <0x40011000 0x400>;
            interrupts = <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>;
            clocks = <&clk_uart0>;
            status = "okay";
        };
    };
};

2. Key properties

PropertyMeaning
compatibleDriver match string (most specific first)
regMMIO address + length ( #address-cells, #size-cells )
interruptsIRQ specifier (interrupt parent defines cells)
clocks / clock-namesphandle to clock provider
status"disabled" skips probe

3. Phandles

dts
clk_uart0: clock-uart {
    compatible = "vendor,clk";
    #clock-cells = <0>;
};

serial@... {
    clocks = <&clk_uart0>;  /* phandle reference */
};

4. Kernel parsing

OF core reads DTB at boot
├── of_platform_populate() creates platform_devices
└── driver `.of_match_table` matches `compatible`
c
static const struct of_device_id my_of_match[] = {
    { .compatible = "vendor,uart" },
    { }
};
MODULE_DEVICE_TABLE(of, my_of_match);

5. Compile and inspect

bash
dtc -I dts -O dtb -o board.dtb board.dts
dtc -I fs -O dts /proc/device-tree 2>/dev/null | less
ls /sys/firmware/devicetree/base/

Bindings live at devicetree.org — always cite binding name in commits.

6. Overlays (configfs)

bash
# Runtime overlay apply (when CONFIG_OF_OVERLAY)
mkdir -p /config/device-tree/overlays/my-overlay
cat my-overlay.dtbo > /config/device-tree/overlays/my-overlay/dtbo

7. Agent usage

/device-tree Write DTS fragment for I2C sensor on i2c1 with interrupt on GPIO5

Common Problems

SymptomCauseFix
Driver not boundcompatible typoMatch driver's of_match_table
Wrong MMIO#address-cells mismatchFollow SoC .dtsi
IRQ not firingWrong interrupt parent/cellsCopy from working board DTS
Probe defer loopClock/regulator missing-EPROBE_DEFER supplier in DT
Overlay failsSymbol unresolved__fixups__ / label exports

Related Skills

  • skills/kernel-dev/platform-device-model — probe and sysfs
  • skills/kernel/device-drivers — devm_of_iomap
  • skills/baremetal/datasheet-and-refmanual-reading — HW to DT mapping
  • skills/embedded/zephyr — Zephyr devicetree (different tooling)
  • skills/kernel-dev/bus-drivers-i2c-spi — bus node children
같은 저장소의 Skills

더 많은 Skills

모든 Skills
mohitmishra786
커뮤니티

static-analysis

Static analysis skill for C/C++ codebases. Use when hardening code quality, triaging noisy builds, running clang-tidy, cppcheck, or scan-build, interpreting check categories, suppressing false positives, or integrating static analysis into CI. Activates on queries about clang-tidy checks, cppcheck, scan-build, compilecommands.json, code hardening, or static analysis warnings.

설치 수
1
GitHub Stars
263
업데이트
6월 27일
mohitmishra786
커뮤니티

assembly-x86

x86-64 assembly skill for reading, writing, and debugging assembly code. Use when reading GCC/Clang assembly output, writing inline asm in C/C++, understanding the System V AMD64 ABI calling convention, or debugging register and stack state. Activates on queries about x86-64 assembly, AT&T vs Intel syntax, inline asm, calling conventions, SIMD intrinsics, or reading disassembly output from objdump or GDB.

설치 수
1
GitHub Stars
258
업데이트
6월 27일
mohitmishra786
커뮤니티

cpp-modules

C++20 modules skill for modern C++ projects. Use when working with named modules, module partitions, header units, CMake MODULESOURCES, Clang -fmodules-ts, BMI caching issues, or migrating from headers to modules. Activates on queries about C++20 modules, import statements, module interface units, header units, or BMI files.

설치 수
1
GitHub Stars
258
업데이트
6월 27일
mohitmishra786
커뮤니티

gcc

GCC compiler skill for C/C++ projects. Use when selecting optimization levels, warning flags, debug builds, LTO, sanitizer instrumentation, or diagnosing compilation errors with GCC. Covers flag selection for debug vs release, ABI concerns, preprocessor macros, profile-guided optimization, and integration with build systems. Activates on queries about gcc flags, compilation errors, performance tuning, warning suppression, or cross-standard compilation.

설치 수
1
GitHub Stars
258
업데이트
6월 27일