From 54987e6989ccce11f61f2f58d6a633f732eb6d59 Mon Sep 17 00:00:00 2001 From: Jamie Magee Date: Fri, 20 Nov 2026 13:47:33 -0800 Subject: [PATCH 1/4] raspberry-pi: remove generic PoE HAT documentation --- raspberry-pi/README.md | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/raspberry-pi/README.md b/raspberry-pi/README.md index b7b31903..50822d9b 100644 --- a/raspberry-pi/README.md +++ b/raspberry-pi/README.md @@ -190,28 +190,6 @@ The `cm4` filter matches CM4 only. Set `dwc2.dr_mode` to `host`, `peripheral`, or `otg` to override the overlay default. The overlay also accepts `g-rx-fifo-size` and `g-np-tx-fifo-size`. -#### PoE HATs - -The original [PoE HAT](https://www.raspberrypi.com/products/poe-hat/) and the [PoE+ HAT](https://www.raspberrypi.com/products/poe-plus-hat/) use the stock `rpi-poe` and `rpi-poe-plus` overlays. -Both HATs support the Pi 3B+ and Pi 4B. - -```nix -{ - hardware.raspberry-pi.configtxt.deviceTreeOverlays."board-type=0x11" = [ - { - rpi-poe = { - poe_fan_temp0 = 50000; - poe_fan_temp0_hyst = 2000; - }; - } - ]; -} -``` - -Use `board-type=0x0d` for the Pi 3B+ and `board-type=0x11` for the Pi 4B. -Replace `rpi-poe` with `rpi-poe-plus` for the PoE+ HAT. -All overlay parameters are optional. - To supply your own file, set `configtxt.file`. The module then ignores `settings` and `deviceTreeOverlays`. From 428be44435e0e5fc41f456e48061739932504e29 Mon Sep 17 00:00:00 2001 From: Jamie Magee Date: Fri, 20 Nov 2026 13:48:40 -0800 Subject: [PATCH 2/4] raspberry-pi: avoid USB setup and serial-console pins in overlay examples --- raspberry-pi/README.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/raspberry-pi/README.md b/raspberry-pi/README.md index 50822d9b..276d7a59 100644 --- a/raspberry-pi/README.md +++ b/raspberry-pi/README.md @@ -105,13 +105,18 @@ Filters nest the same way, and the leaf is an ordered list where each element na boot.loader.generic-extlinux-compatible.useGenerationDeviceTree = false; hardware.raspberry-pi.configtxt.deviceTreeOverlays.pi4 = [ - { dwc2.dr_mode = "host"; } { gpio-fan = { - gpiopin = 14; + gpiopin = 12; temp = 80000; }; } + { + gpio-led = { + gpio = 16; + label = "status"; + }; + } ]; } ``` @@ -121,13 +126,14 @@ This renders after `configtxt.settings` as: ```ini [all] [pi4] -dtoverlay=dwc2 -dtparam=dr_mode=host -dtoverlay= dtoverlay=gpio-fan -dtparam=gpiopin=14 +dtparam=gpiopin=12 dtparam=temp=80000 dtoverlay= +dtoverlay=gpio-led +dtparam=gpio=16 +dtparam=label=status +dtoverlay= ``` A separate option is necessary because `settings` groups values by key. From 5c1804b403e84c618e86315efa67aeb555ed07ae Mon Sep 17 00:00:00 2001 From: Jamie Magee Date: Fri, 20 Nov 2026 13:47:53 -0800 Subject: [PATCH 3/4] raspberry-pi: explain config.txt default overrides --- raspberry-pi/README.md | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/raspberry-pi/README.md b/raspberry-pi/README.md index 276d7a59..b19c07ec 100644 --- a/raspberry-pi/README.md +++ b/raspberry-pi/README.md @@ -155,6 +155,8 @@ Use `null` with `mkForce` to remove a parameter. The module concatenates lists from separate modules, but the order is not the order of definition. If one overlay must load before another, set the order with `mkBefore` or `mkAfter`. +For overlay names and hardware-specific parameters, use the [Raspberry Pi overlay reference](https://github.com/raspberrypi/linux/blob/rpi-6.18.y/arch/arm/boot/dts/overlays/README). + The Raspberry Pi firmware applies these overlays before U-Boot starts. Set `boot.loader.generic-extlinux-compatible.useGenerationDeviceTree = false` so U-Boot keeps that device tree instead of loading one from the NixOS generation. Enabling `hardware.raspberry-pi.firmware.uboot.enable` sets this automatically. @@ -163,23 +165,14 @@ The firmware partition must contain the generated `config.txt` and stock overlay SD image builds populate it automatically. On a running system, set `hardware.raspberry-pi.firmware.enable = true`. -#### DWC2 USB controller +To supply your own file, set `configtxt.file`. +The module then ignores `settings` and `deviceTreeOverlays`. -Use the stock `dwc2` overlay to enable the USB 2.0 controller on the Pi 4B USB-C connector: +#### Overriding board defaults -```nix -{ - hardware.raspberry-pi.configtxt.deviceTreeOverlays."board-type=0x11" = [ - { dwc2 = { }; } - ]; -} -``` - -`board-type=0x11` matches the Pi 4B. -The broader `pi4` filter also matches Pi 400, CM4, and CM4S. - -[Raspberry Pi OS sets `otg_mode=1` on CM4](https://github.com/RPi-Distro/pi-gen/blob/master/stage1/00-boot-files/files/config.txt#L39-L43), and [nixos-hardware sets the same default](./common/config-txt-defaults.nix). -Set it to `null` before loading DWC2: +The shared board defaults are defined in [`common/config-txt-defaults.nix`](./common/config-txt-defaults.nix) with `lib.mkDefault`. +Set a `hardware.raspberry-pi.configtxt.settings` value to `null` to omit that default from the generated `config.txt`. +For example, to remove the default `otg_mode` setting before loading `dwc2` on CM4, use: ```nix { @@ -192,13 +185,6 @@ Set it to `null` before loading DWC2: } ``` -The `cm4` filter matches CM4 only. -Set `dwc2.dr_mode` to `host`, `peripheral`, or `otg` to override the overlay default. -The overlay also accepts `g-rx-fifo-size` and `g-np-tx-fifo-size`. - -To supply your own file, set `configtxt.file`. -The module then ignores `settings` and `deviceTreeOverlays`. - ## Audio To enable the headphone jack on Raspberry Pi 2, 3, or 4: From 7e9d8b97c58eb8818d2a8d705d5eae36573370e6 Mon Sep 17 00:00:00 2001 From: Jamie Magee Date: Fri, 20 Nov 2026 13:48:55 -0800 Subject: [PATCH 4/4] raspberry-pi: warn before switching to firmware device trees --- raspberry-pi/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/raspberry-pi/README.md b/raspberry-pi/README.md index b19c07ec..238dfcda 100644 --- a/raspberry-pi/README.md +++ b/raspberry-pi/README.md @@ -97,6 +97,8 @@ Filters like `[EDID=...]`, `[gpio4=1]`, `[tryboot]` and `[bootvar0=42]` also dep ### Device tree overlays +Before switching to the firmware-provided device tree, migrate other `hardware.deviceTree.overlays` to `hardware.raspberry-pi.configtxt`. + Overlays go in `configtxt.deviceTreeOverlays`, not in a `dtoverlay` key under `settings`. Filters nest the same way, and the leaf is an ordered list where each element names one overlay and its parameters: