Re: Using a custom device tree file
- To: debian-arm@lists.debian.org
- Subject: Re: Using a custom device tree file
- From: Rainer Dorsch <ml@bokomoko.de>
- Date: Mon, 09 Jul 2018 15:32:28 +0200
- Message-id: <[🔎] 2442455.iK0HbhmVo5@b370>
- In-reply-to: <87h8prs7i5.fsf@aikidev.net>
- References: <1900778.P4kgAQTrCJ@blackbox> <7919432.WymCRlijks@blackbox> <87h8prs7i5.fsf@aikidev.net>
Hi Vagrant,
I want to use a modified dts file for a Hummingboard, I do enable spidev for
the spi interfaces:
What I did so far is I created a new file:
rd@master:/mnt/disk/scratch/rd$ diff -u ./debian/kernel/linux-source-4.14/
arch/arm/boot/dts/imx6q-hummingboard.dts ./debian/kernel/linux-source-4.14/
arch/arm/boot/dts/imx6q-hummingboard-spi.dts
--- ./debian/kernel/linux-source-4.14/arch/arm/boot/dts/imx6q-hummingboard.dts
2018-01-10 09:31:23.000000000 +0100
+++ ./debian/kernel/linux-source-4.14/arch/arm/boot/dts/imx6q-hummingboard-
spi.dts 2018-02-18 21:29:20.870755691 +0100
@@ -45,7 +45,7 @@
#include "imx6qdl-hummingboard.dtsi"
/ {
- model = "SolidRun HummingBoard Dual/Quad";
+ model = "SolidRun HummingBoard Dual/Quad spidev enabled";
compatible = "solidrun,hummingboard/q", "fsl,imx6q";
};
@@ -56,3 +56,36 @@
fsl,transmit-atten-16ths = <9>;
fsl,receive-eq-mdB = <3000>;
};
+
+&ecspi2 {
+ fsl,spi-num-chipselects = <2>;
+ cs-gpios = <&gpio2 26 1>, <&gpio2 27 1>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_hummingboard_spi>;
+ status = "okay";
+ spidev@0x00 {
+ compatible = "spidev";
+ spi-max-frequency = <5000000>;
+ reg = <0>;
+ };
+ spidev@0x01 {
+ compatible = "spidev";
+ spi-max-frequency = <5000000>;
+ reg = <1>;
+ };
+};
+
+
+&iomuxc {
+ hummingboard {
+ pinctrl_hummingboard_spi: hummingboard_spi {
+ fsl,pins = <
+ MX6QDL_PAD_EIM_OE__ECSPI2_MISO 0x100b1
+ MX6QDL_PAD_EIM_CS1__ECSPI2_MOSI 0x100b1
+ MX6QDL_PAD_EIM_CS0__ECSPI2_SCLK 0x100b1
+ MX6QDL_PAD_EIM_RW__GPIO2_IO26 0x80000000
+ MX6QDL_PAD_EIM_LBA__GPIO2_IO27 0x80000000
+ >;
+ };
+ };
+};
rd@master:/mnt/disk/scratch/rd$
and build a new dtb and copied it to
# cp arch/arm/boot/dts/imx6dl-hummingboard-spi.dtb /boot/dtbs/4.14.0-3-armmp/
and copied it to imx6q-hummingboard.dtb (i.e. overwrote the old supplied dtb
after making a copy of it).
Introducing a new model name was probably not a good idea, since it breaks the
upgrade, so I try to go back to the unmodified model name. Then after each
kernel upgrade I need to go through the manual procedure of rebuilding a new
modified dtb file.... do you see a better way to keep spidev enabled?
Thanks
Rainer
On Donnerstag, 8. März 2018 02:04:02 CEST Vagrant Cascadian wrote:
> On 2018-02-19, Rainer Dorsch wrote:
> > Am Samstag, 17. Februar 2018, 16:22:06 CET schrieb Vagrant Cascadian:
> >> > Can anybody tell, if it is possible to configure from u-boot shell to
> >> > loada
> >> > custom device treefile?
> >>
> >> To manually change it for a one-off boot:
> >> # disable the built-in setting of fdtfile
> >> setenv findfdt
> >> # manually set fdtfile
> >> setenv fdtfile /path/to/your/custom.dtb
> >
> > Where is findfdt defined?
>
> In the built-in u-boot environment on some boards. Typically with u-boot
> variants that can support multiple similar boards; a single mx6cuboxi
> u-boot binary supports several cubox-i and hummingboard variants.
>
> It's typically run from bootcmd, so "printenv bootcmd" from the u-boot
> prompt might show something like "run findfdt ; run distro_bootcmd".
>
> >>From looking into the bootscr fdtfile needs only the filename:
> > if test -n "${fdtfile}"; then
> >
> > setenv fdtpath dtbs/${fk_kvers}/${fdtfile}
> >
> > else
> >
> > setenv fdtpath dtb-${fk_kvers}
> >
> > fi
> >
> > Correct?
>
> Ah, yes, full path wouldn't work in this case- you'd have to have it in
> one of the above locations the boot scripts look for.
>
>
> live well,
> vagrant
--
Rainer Dorsch
http://bokomoko.de/
Reply to: