# switchroot's mainline kernel — reference material Vendored for reference, **not** built by this project. Provenance: - Source: `https://gitlab.com/switchroot/kernel/mainline-kernel` - Branch: `switch-dev` - Commit: `5dc55737d3f32324bc8946fa76c2d827947d090b` (resolved 2026-10-19) - Fetched: 2026-10-18 Pin that SHA. The files below are a **copy**, not a submodule, so they drift: re-resolve the branch tip and diff before assuming this reference still matches what switchroot ship. Their tree is also an older mainline than this project's 7.2, so even a correct pin does not make it drop-in. switchroot have already done mainline bring-up for the Nintendo Switch. Their tree contains `arch/arm64/boot/dts/nvidia/tegra210-nintendo-switch.dts` (2425 lines) and a `switch-patches/` series that is effectively a map of the whole job. Everything in this project that was written from scratch — the device tree, the USB gadget wiring, the display — has a counterpart there, and several of the things still open here are already solved in their patches. ## Files kept here | File | What it is | |---|---| | `tegra210-nintendo-switch.dts` | their Switch device tree — the reference for display, PCIe, USB, SD | | `0010-...-jdi-lpm062m326a.patch` | **the panel driver** — 612 lines, `drivers/gpu/drm/panel/panel-jdi-lpm062m326a.c` | | `0012-...-switch-panel.patch` | the display integration for that panel | | `0026-...-tegra_xudc-use-dma_alloc_coherent.patch` | a one-hunk fix to the XUDC driver, likely the cause of our USB stalls | ## The full patch list, as a map of the work ``` 0001 Tegra210 DFLL support 0002 sdmmc autocal 0003 CPUidle support for Tegra210 0004 Tegra XUSB gadget driver support 0005 Fixes for Tegra soctherm 0006 More soctherm functionality 0007 Tegra210 BPMP driver 0008 DisplayPort support for drm/tegra 0009 iio: light: bh1730fvc (ambient light sensor) 0010 drm: panel: driver for jdi-lpm062m326a <- the panel 0011 stmfts switch support (touchscreen) 0012 platform integration for switch panel <- display wiring 0013 of: thermal: allow enabling hwmon 0014 missing SKU IDs 0015 switch driver for PWM fan 0016 input: working Joy-Con rails driver 0017 missing SKU IDs 0018 gpio-tegra: mask IRQs on shutdown 0019 HID: switchcon: Nintendo Switch controller driver 0020 misc: rohm bm92txx driver (USB-PD) 0021 phy: tegra-xusb: ID override support 0022 usb: xhci-tegra: allow extcon to enable host mode 0023 input: touchscreen stmfts: sync mt events 0024 arm64: configs: Nintendo Switch defconfig 0025 Switch DTS 0026 usb: udc: tegra_xudc: use dma_alloc_coherent ``` ## What their tree says about our open items ### Display — solved there, and the panel is identified ```dts dsi@54300000 { status = "okay"; avdd-dsi-csi-supply = <&vdd_dsi_csi>; panel@0 { compatible = "jdi,lpm062m326a"; reg = <0>; reset-gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_HIGH>; vdd1-supply = <&pavdd>; vdd2-supply = <&navdd>; backlight = <&backlight>; }; }; ``` So the panel is a **JDI LPM062M326A**, reset is `PV2` and **active high**, and the supplies are `pavdd`/`navdd`. Their patch 0010 is the driver, 0012 the integration. This is exactly the piece we could not derive — the timings and the init sequence. ### PCIe / WiFi — both ports, and the lanes we were missing ```dts pci@1,0 { phys = <&{/padctl@7009f000/pads/pcie/lanes/pcie-1}>, <&{/padctl@7009f000/pads/pcie/lanes/pcie-2}>, <&{/padctl@7009f000/pads/pcie/lanes/pcie-3}>, <&{/padctl@7009f000/pads/pcie/lanes/pcie-4}>; phy-names = "pcie-0", "pcie-1", "pcie-2", "pcie-3"; status = "okay"; }; pci@2,0 { phys = <&{/padctl@7009f000/pads/pcie/lanes/pcie-0}>; phy-names = "pcie-0"; status = "okay"; }; ``` **Both ports are enabled**, and `pci@1,0` uses lanes `pcie-1` through `pcie-4`. Our tree enabled only `pci@2,0` on lane `pcie-0` and left the other lanes out — which is a plausible reason the endpoint never answered config cycles. ### USB device mode — a different, cleaner approach ```dts xudc@700d0000 { status = "okay"; phys = <&{/padctl@7009f000/pads/usb2/lanes/usb2-0}>; phy-names = "usb2"; extcon = <&bm92t 1>; }; ``` They signal VBUS and role through an **extcon from the bm92txx USB-PD driver** (patch 0020) rather than the padctl role switch we used. Note `phy-names = "usb2"` — their driver revision accepts that name, whereas current mainline wants `"usb2-0"` (see `device-tree/README.md`). ### USB throughput — patch 0026 is probably our answer ```diff --- a/drivers/usb/gadget/udc/tegra_xudc.c +++ b/drivers/usb/gadget/udc/tegra_xudc.c + dma_alloc_coherent(xudc->dev, XUDC_NR_EPS * ... ``` Our NCM link stalls and manages only ~550 KiB/s with erratic latency. A DMA allocation fix in the XUDC driver is a very plausible cause, and it is 25 lines. ## Important caveat Their tree is an **older mainline** than this project's 7.2, so bindings and driver internals have moved: `xudc@700d0000` vs `usb@700d0000`, `phy-names = "usb2"` vs `"usb2-0"`, no `usb-role-switch` requirement. Their device tree and patches are therefore a **reference to port from**, not something to drop in.