From f8d3c754626e0ff3a0b8906fc0a22f9bda20c6a2 Mon Sep 17 00:00:00 2001 From: Andrii Panasiuk Date: Tue, 12 Sep 2023 17:21:37 +0300 Subject: [PATCH] Implement dt overlay for enabling built-in xhci controller --- raspberry-pi/4/xhci.nix | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 raspberry-pi/4/xhci.nix diff --git a/raspberry-pi/4/xhci.nix b/raspberry-pi/4/xhci.nix new file mode 100644 index 0000000..b5398f2 --- /dev/null +++ b/raspberry-pi/4/xhci.nix @@ -0,0 +1,40 @@ +{ + config, + lib, + ... +}: let + cfg = config.hardware.raspberry-pi."4".xhci; +in { + options.hardware = { + raspberry-pi."4".xhci = { + enable = lib.mkEnableOption '' + Enable builtin XHCI controller for USB with otg_mode=1 in config.txt + ''; + }; + }; + + config = lib.mkIf cfg.enable { + hardware.deviceTree = { + overlays = [ + { + name = "enable-xhci"; + dtsText = '' + /dts-v1/; + /plugin/; + + / { + compatible = "brcm,bcm2711"; + fragment@0 { + //target-path = "/scb/xhci@7e9c0000"; + target = <&xhci>; + __overlay__ { + status = "okay"; + }; + }; + }; + ''; + } + ]; + }; + }; +}