public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <mka@chromium.org>
To: Douglas Anderson <dianders@chromium.org>
Cc: Rob Herring <robh@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Stephen Boyd <swboyd@chromium.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	Rajendra Nayak <quic_rjendra@quicinc.com>,
	Alexandru M Stan <amstan@chromium.org>,
	Julius Werner <jwerner@chromium.org>,
	"Joseph S . Barrera III" <joebar@chromium.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/4] dt-bindings: Document how Chromebooks with depthcharge boot
Date: Fri, 13 May 2022 11:42:56 -0700	[thread overview]
Message-ID: <Yn6msARxCafgGj9E@google.com> (raw)
In-Reply-To: <20220513095722.v2.1.I71e42c6174f1cec17da3024c9f73ba373263b9b6@changeid>

On Fri, May 13, 2022 at 09:59:17AM -0700, Douglas Anderson wrote:
> This documents how many Chromebooks pick the device tree that will be
> passed to the OS and can help understand the revisions / skus listed
> as the top-level "compatible" in many Chromebooks.
> 
> Signed-off-by: Douglas Anderson <dianders@chromium.org>

Thanks!

a few nits below

> ---
> 
> Changes in v2:
> - ("Document how Chromebooks with depthcharge boot") new for v2.
> 
>  .../devicetree/chromebook-boot-flow.rst       | 63 +++++++++++++++++++
>  1 file changed, 63 insertions(+)
>  create mode 100644 Documentation/devicetree/chromebook-boot-flow.rst
> 
> diff --git a/Documentation/devicetree/chromebook-boot-flow.rst b/Documentation/devicetree/chromebook-boot-flow.rst
> new file mode 100644
> index 000000000000..84aeb0a17ee4
> --- /dev/null
> +++ b/Documentation/devicetree/chromebook-boot-flow.rst
> @@ -0,0 +1,63 @@
> +.. SPDX-License-Identifier: GPL-2.0
> +
> +======================================
> +Chromebook Boot Flow
> +======================================
> +
> +Most recent Chromebooks that use device tree boot using the opensource

s/using/are using/

> +depthcharge bootloader. Depthcharge expects the OS to be packaged as a "FIT
> +Image" which contains an OS image as well as a collection of device trees. It
> +is up to depthcharge to pick the right device tree from the FIT Image and
> +provide it to the OS.
> +
> +The scheme that depthcharge uses to pick the device tree takes into account
> +three variables:
> +- Board name, specified at compile time.
> +- Board revision number, read from GPIO strappings at boot time.
> +- SKU number, read from GPIO strappings at boot time.
> +
> +For recent Chromebooks, depthcharge creates a match list that looks like this:
> +- google,$(BOARD)-rev$(REV)-sku$(SKU)
> +- google,$(BOARD)-rev$(REV)
> +- google,$(BOARD)-sku$(SKU)
> +- google,$(BOARD)
> +
> +Note that some older Chromebooks may use a slightly different list that may

nit: first 'may' isn't really needed, since this is about 'some' Chromebooks
whose list 'may' differ in certain ways.

> +not include sku matching or may prioritize sku/rev differently.
> +
> +Note that for some boards there may be extra board-specific logic to inject
> +extra compatibles into the list, but this is uncommon.
> +
> +Depthcharge will look through all device trees in the FIT image trying to
> +find one that matches the most specific compatible. It will then look
> +through all device trees in the FIT image trying to find the one that
> +matches the _second most_ specific compatible, etc.
> +
> +When searching for a device tree, depthcharge doesn't care where the
> +compatible falls within a given device tree. As an example, if we're on
> +board "lazor", rev 4, sku 0 and we have two device trees:
> +- "google,lazor-rev5-sku0", "google,lazor-rev4-sku0", "qcom,sc7180"
> +- "google,lazor", "qcom,sc7180"
> +
> +Then depthcharge will pick the first device tree even though
> +"google,lazor-rev4-sku0" was the second compatible listed in that device tree.
> +This is because it is a more specific compatible than "google,lazor".
> +
> +It should be noted that depthcharge does not have any smarts to try to
> +match board or SKU revisions that are "close by". That is to say that
> +if depthcharge knows it's on "rev4" of a board but there is no "rev4"
> +device tree that depthcharge _won't_ look for a "rev3" device tree.

s/that/then/

> +
> +In general when any significant changes are made to a board the board
> +revision number is increased even if none of those changes need to
> +be reflected in the device tree. Thus it's fairly common to see device
> +trees with multiple revisions.
> +
> +It should be noted that, taking into account the above system that the
> +depthcharge has, the most flexibility is achieved if the device tree

s/the depthcharge/depthcharge/

> +supporting the newest revision(s) of a board omits the "-rev{REV}"
> +compatible strings. When this is done then if you get a new board
> +revision and try to run old software on it then we'll at pick the most
> +reasonable device tree. If it turns out that the new revision actually
> +has no device-tree visible changes then we'll not only pick the most
> +reasonable device tree, we'll pick the exact right one.
> \ No newline at end of file
> -- 
> 2.36.0.550.gb090851708-goog
> 

  parent reply	other threads:[~2022-05-13 18:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-13 16:59 [PATCH v2 1/4] dt-bindings: Document how Chromebooks with depthcharge boot Douglas Anderson
2022-05-13 16:59 ` [PATCH v2 2/4] dt-bindings: arm: qcom: Add sc7180 Chromebook board bindings Douglas Anderson
2022-05-13 19:25   ` Matthias Kaehlcke
2022-05-16  7:01   ` Krzysztof Kozlowski
2022-05-16 15:01     ` Doug Anderson
2022-05-16 15:06       ` Krzysztof Kozlowski
2022-05-13 16:59 ` [PATCH v2 3/4] dt-bindings: arm: qcom: Add / fix sc7280 " Douglas Anderson
2022-05-13 19:36   ` Matthias Kaehlcke
2022-05-16  7:02   ` Krzysztof Kozlowski
2022-05-13 16:59 ` [PATCH v2 4/4] dt-bindings: arm: qcom: Add more sc7180 Chromebook " Douglas Anderson
2022-05-13 20:37   ` Matthias Kaehlcke
2022-05-13 20:44     ` Doug Anderson
2022-05-16  7:05   ` Krzysztof Kozlowski
2022-05-16 15:16     ` Doug Anderson
2022-05-17  7:23       ` Krzysztof Kozlowski
2022-05-13 18:42 ` Matthias Kaehlcke [this message]
2022-05-16  6:57 ` [PATCH v2 1/4] dt-bindings: Document how Chromebooks with depthcharge boot Krzysztof Kozlowski
2022-05-16 15:06   ` Doug Anderson
2022-05-16 15:11     ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yn6msARxCafgGj9E@google.com \
    --to=mka@chromium.org \
    --cc=amstan@chromium.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dianders@chromium.org \
    --cc=joebar@chromium.org \
    --cc=jwerner@chromium.org \
    --cc=krzk+dt@kernel.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quic_rjendra@quicinc.com \
    --cc=robh+dt@kernel.org \
    --cc=robh@kernel.org \
    --cc=swboyd@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox