From nobody Sun Feb 8 11:02:29 2026 Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B12722371E for ; Fri, 20 Dec 2024 19:25:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734722724; cv=none; b=Hn4JjjuB5dLL0XZaboFvycWpKkkkN9H27bGr57f7Hf52KXDrtKSgul3xzZMBld07M01UCEFwqWVZ5u4owNfvxSMhMNzOV5KTp+4rv6PzYoZr5NYxo8SN6GGM6pkucBg9wB2f+0cBImv3gSk6SXZyv/hnOs0CRu6MC3zlXzhwZfY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734722724; c=relaxed/simple; bh=bFKftFHPYljcnx4vBCiemniJj/6au9bLCdd1QZtxopw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=saoC/0b8IBfTEL08QcXZvpKT2m/Ous1SgHiK8+SlmMIlqcQHAhU3kn+hJ5N+njohWmXBLqlDeZpdkyMsOlssLAo3wXOO3cXOjOdZ2PfN2Ec4x7Gs2872rVFkDKimHm+DdJYkGEIrJhOxmxVAzQF7QXiUhVkeJBztbrj8hs5kSHI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Ppu8lkw7; arc=none smtp.client-ip=209.85.218.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Ppu8lkw7" Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-aa67333f7d2so368725066b.0 for ; Fri, 20 Dec 2024 11:25:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734722721; x=1735327521; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=mYFutb0NWKnF0fNa2OYIjpA0YuFOIGmBiwPL2G+iLdM=; b=Ppu8lkw73ONgVJubVfKVFdo6UdzlxMehIWn04pmcy5TIKZazw+fh5/h0C0b9fNEn+0 CrSzyXqfp32rWcPDewsyPe39CKjMA7PgVjtn+GnWIA/BiLrTsODma08ql3Hw80qUKby+ qMXOdYRFuS1OUjxAcHIQBFCJjvhYqFAVr17fSBSwuCvJ2gdOrjGEc10F8jTj+s7/Aghn 4f5YcCm9tYC85uOM4URgxOSQmMhIqOURl7RiKvHUYWleJ0GGLIlSC6Mr/sInWw699fMD /F60yHiNAV7QfNlrIYYBR1jEs0/ZAnhyGO1qVWRocr95xyGeFnuJHzLwc68ACknRbmLx oqYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734722721; x=1735327521; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mYFutb0NWKnF0fNa2OYIjpA0YuFOIGmBiwPL2G+iLdM=; b=jIUohjXj+61ambW+4sp4mcrTdnC8J6m7v8htll+yYan2FS1xH1Zi3ySiJ5MK8UUttC pkQFnbI6bhvwU8HwQ8yARHxkD3b1gh5V2VaxMejobPy6S3otpVQ2fOqMi+R0muHK8Lem 1w0tvpi/eGw/eqbDYfacy+QkMkQZEy2X0/4Hieer/il6BTU87a89Tetr2cWQvvXYVnBl 6EGALXrigR1E5QzKaH+67RYEH7UL0cbpZK7Y8o/uleidjxPYvcg9U5BuP2ZAorgzmw3Y 8jD6x7GH6900MoGPiye43rlwxrzl5DN8HO6GiVdwj4UeutOa9HGk9N6Nq2PoHjzM3PMs swNQ== X-Forwarded-Encrypted: i=1; AJvYcCXB4/Ny5FwvdXSGB+SMxks2JOfuxunJKCqN33kcSzf5F2EZUt8b0qA/wHkJh66lVkpborLzFJbOJYuro90=@vger.kernel.org X-Gm-Message-State: AOJu0YyxKxpWbQ5yTxG0ZuJp3i2ihyy8lGotMwJv9Bths59QSm/8phP6 Al2RaBOXwHagZs3Ylb6SKVwnUtHwwF4Y1jT8mTFWM2mSZR4fv43RazR6wTqM8ls= X-Gm-Gg: ASbGnct6deXiCzW9/Fk2mLLo3hPSYibE0v6wgLaQO/wHvaZtOQTGQkKCxk8O92/qcbA TK8BmHFd7a1rLc0h6q7jz9BTZ5bburuci/vc05fMpLIKIyoEZ5b3W8ztbujq6y7JTj9voM/es1Y FHwQ1G4xnUc1348Vno0mgET38NxQMnP+/uERaB3ETacTWc9CU6z9E51FFLAVyVcNN7sWMijrncs mCGecXqHfn4awvkrYC6Q+LcCumx8Gk7TTIsk2mkHJgkth5t0sRNHkqqpBmqz2NrIHc= X-Google-Smtp-Source: AGHT+IH3htdiLf5KyJkH6L5LoCiDGH4ms05IDeue80g5zNXSRBlaGHLmKTFpbA+Z4PKjB5VWaCZqZg== X-Received: by 2002:a17:907:3e8d:b0:aa5:1a1c:d0a2 with SMTP id a640c23a62f3a-aac2d0478bemr355400066b.34.1734722720741; Fri, 20 Dec 2024 11:25:20 -0800 (PST) Received: from [192.168.1.140] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aac0f066112sm204152866b.179.2024.12.20.11.25.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2024 11:25:20 -0800 (PST) From: Linus Walleij Date: Fri, 20 Dec 2024 20:25:19 +0100 Subject: [PATCH v3] docs: dt: Make references and mention kernel abstractions Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241220-dt-docs-refresh-v3-1-999754568b87@linaro.org> X-B4-Tracking: v=1; b=H4sIAJ7EZWcC/3WOzQrCMBCEX6Xk7EqaGEFPvof0kJ9ts6BJ2ZRaK X130949fsN8zKyiIBMWcW9WwThToZwq6FMjfLRpQKBQWSiptDTSQJggZF+AsWcsEUxrMLjgXJC tqJazBcGxTT7u3pg/yG/rYTDQ07I3xqrScmw+u8qRypT5e1yY1Z7+X5sVtGCurtfm5o12l8eLk uV8zjyIbtu2H9nG89LRAAAA X-Change-ID: 20230505-dt-docs-refresh-515edbdbbd01 To: Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Grant Likely , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Linus Walleij X-Mailer: b4 0.14.2 This document is named "Linux and Devicetree" so I think we should write a bit more about how the device tree fits into the Linux kernel frameworks these days after we have created the fwnode and swnode. Signed-off-by: Linus Walleij --- These docs are old and outdated and need to be edited to reflect the current situation. --- Changes in v3: - Resend because v2 seems to be missed or ignored. - Link to v2: https://lore.kernel.org/r/20230505-dt-docs-refresh-v2-1-56bf3= 59c53b4@linaro.org --- ChangeLog v2->v3: - Rebase on v6.13-rc1 - Resend because this seems to keep being ignored. ChangeLog v1->v2: - Spelling mistakes - Resend because nothing happens --- Documentation/devicetree/usage-model.rst | 45 ++++++++++++++++++++++++++++= +--- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/usage-model.rst b/Documentation/devic= etree/usage-model.rst index 0717426856b229be1c52efc79b18dbc617d4c92f..32dca4ca4384502fe2065efe650= daf517435763c 100644 --- a/Documentation/devicetree/usage-model.rst +++ b/Documentation/devicetree/usage-model.rst @@ -75,7 +75,44 @@ out of mainline (nios) have some level of DT support. If you haven't already read the Device Tree Usage\ [1]_ page, then go read it now. It's okay, I'll wait.... =20 -2.1 High Level View +2.1 Linux Kernel Firmware Abstractions +-------------------------------------- + +The Linux kernel supports several different hardware description +frameworks and DT is just one of them. The closest sibling is the +:ref:`Documentation/firmware-guide/acpi/index.rst ACPI` +DSDT (Differentiated System Description Table). + +To make it possible to write a device driver that will adapt to DT +or other hardware description models, the kernel has grown some +abstractions, first and foremost the firmware node API, exposing +device properties. The firmware node "fwnode" internals can be found +in ```` while the device driver-facing API can be +found in ````. The idea is that if a driver is using +the firmware node API, it should be trivial to support DT and ACPI +DSDT alike in the same driver. + +The fwnode framework also makes it possible to modify and extend the +Linux in-kernel model with software-managed nodes "swnodes" to apply +quirks or manage registration of devices that cannot be handled any +other way. This API can also be found in ````. + +Further, when the DT core register devices these need to fold into the +Linux device driver model, which essentially means that some kind of +``struct device`` has to be created to match a corresponding +``struct device_driver``. This API can be explored in +detail in :ref:`Documentation/driver-api/driver-model/index.rst the driver= API documentation` +but what you need to know is that the Linux DT parser code will on its +own mostly spawn platform devices and AMBA devices on the platform +and AMBA bus respectively, and apart from that it will augment devices +spawn on other buses where applicable. + +Every Linux kernel subsystem that want to supply additional data to +detected devices using the device tree, or that want to provide +resources to other devices in the DT, will need to implement calls into +the DT abstractions. + +2.2 High Level View ------------------- The most important thing to understand is that the DT is simply a data structure that describes the hardware. There is nothing magical about @@ -97,7 +134,7 @@ Linux uses DT data for three major purposes: 2) runtime configuration, and 3) device population. =20 -2.2 Platform Identification +2.3 Platform Identification --------------------------- First and foremost, the kernel will use data in the DT to identify the specific machine. In a perfect world, the specific platform shouldn't @@ -180,7 +217,7 @@ However, this approach does not take into account the p= riority of the compatible list, and probably should be avoided for new architecture support. =20 -2.3 Runtime configuration +2.4 Runtime configuration ------------------------- In most cases, a DT will be the sole method of communicating data from firmware to the kernel, so also gets used to pass in runtime and @@ -217,7 +254,7 @@ On ARM, the function setup_machine_fdt() is responsible= for early scanning of the device tree after selecting the correct machine_desc that supports the board. =20 -2.4 Device population +2.5 Device population --------------------- After the board has been identified, and after the early configuration data has been parsed, then kernel initialization can proceed in the normal --- base-commit: 40384c840ea1944d7c5a392e8975ed088ecf0b37 change-id: 20230505-dt-docs-refresh-515edbdbbd01 Best regards, --=20 Linus Walleij