public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vincent Pelletier <plr.vincent@gmail.com>
To: Masahiro Yamada <masahiroy@kernel.org>,
	Michal Marek <michal.lkml@markovi.net>
Cc: Rob Herring <robh@kernel.org>,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Is there a reason not to use -@ to compile devicetrees ?
Date: Mon, 21 Dec 2020 14:47:07 +0000	[thread overview]
Message-ID: <20201221144707.4a409618@gmail.com> (raw)

Hello,

Distro: https://raspi.debian.net/ (sid)
Hardware: Raspberry Pi Zero W
Kernel version: 5.9.11 (linux-image-5.9.0-4-rpi)

To access a device connected to my pi, I need the spi0 bus, and would
like to not be doing GPIO bit-banging when there are perfectly good
spi modules capable of using the SPI alternative mode of these pins.

spi0 is declared in the vanilla devicetree for this device:
arch/arm/boot/dts/bcm2835-rpi-zero-w.dts ends up including
arch/arm/boot/dts/bcm283x.dtsi which contains:
                spi: spi@7e204000 {
                        compatible = "brcm,bcm2835-spi";
                        reg = <0x7e204000 0x200>;
                        interrupts = <2 22>;
                        clocks = <&clocks BCM2835_CLOCK_VPU>;
                        #address-cells = <1>;
                        #size-cells = <0>;
                        status = "disabled";
                };
To my new-to-devicetree eye, this looks like this is intended to be
overridden, at least with a
  status = "okay";
property (although a bit more is needed).
As I believe is the correct way, I wrote a devicetree overlay doing
this and a bit more in order to enable this bus and one of its device
(the one matching the chip-select monitored by the board I connected).

To confirm that I had no typo in my symbol names I ran fdtoverlay with
the packaged device tree binary, plus my overlay, but could not get it
to work, until I took a closer look at the packaged device tree and
realised it lacks a __symbols__ section.
So I pulled the source, added "-@" to the cmd_dtc rule in
scripts/Makefile.lib, built the dtb, tested fdtoverlay against it and
voila, it worked. I could then reboot with this devicetree, load my
overlay and use spi0 with no further change.

So now I wonder why this option is not enabled while there are these
sections which seem to not be usable without an overlay ?
And further, why it does not seem to be possible to enable with a
kernel config option ?

I must be missing something obvious, but I'm still failing to see it.

Regards,
-- 
Vincent Pelletier

             reply	other threads:[~2020-12-21 18:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-21 14:47 Vincent Pelletier [this message]
2021-01-05  0:47 ` Is there a reason not to use -@ to compile devicetrees ? Vincent Pelletier
2021-01-05  2:08 ` Rob Herring

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=20201221144707.4a409618@gmail.com \
    --to=plr.vincent@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=robh@kernel.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