-
Notifications
You must be signed in to change notification settings - Fork 27
board: Raspberry Pi
The official Raspberry Pi kernel has support for tinydrm now: PR2119
Device Tree overlays for rpi-display and pitft28 using the mi0283qt driver can be found here: https://github.com/notro/tinydrm/tree/master/rpi-overlays
Here's compiled versions from my previous 4.9 build: https://github.com/notro/rpi-firmware/tree/tinydrm49/overlays
Here's a receipe for building the out-of-tree drivers on the Raspberry Pi itself.
Install experimental rpi-4.14 kernel to match this repo:
$ sudo BRANCH=next rpi-update
$ sudo reboot
(skip BRANCH=next
when the official kernel release has moved from 4.9 to 4.14)
We use rpi-source to get the kernel headers for an rpi-update installed kernel:
$ sudo wget https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source -O /usr/bin/rpi-source && sudo chmod +x /usr/bin/rpi-source && /usr/bin/rpi-source -q --tag-update
$ rpi-source --skip-gcc
Clone tinydrm repo:
$ git clone https://github.com/notro/tinydrm
$ cd tinydrm/
$ make
$ sudo make install
# even though depmod is run by the previous command, for some reason this is necessary
$ sudo depmod
# Verify that the driver is in place
$ modinfo <drivername>
Example showing how to build and install one of the overlays:
$ sudo dtc -@ -I dts -O dtb -o /boot/overlays/mz61581.dtbo rpi-overlays/mz61581-overlay.dts
A driver consists of a driver.c
and an entry in Kbuild: obj-m += driver.o
It is possible to have the firmware bootloader apply Device Tree overlays on mainline DTB's with a small hack.
This will tell the dtc compiler to add symbols to the dtb:
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index d0381e9caf21..712c4698f645 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -1105,3 +1105,5 @@ dtb-$(CONFIG_ARCH_ASPEED) += aspeed-bmc-opp-palmetto.dtb \
aspeed-bmc-opp-romulus.dtb \
aspeed-ast2500-evb.dtb
endif
+
+DTC_FLAGS ?= -@ -H epapr
Maybe it's possible to do this instead: DTC_FLAGS="-@ -H epapr" ARCH=arm make dtbs
Downstream uses spi0 as label, whereas mainline uses spi. Add spi0 label to work with existing overlays. Also enable dma on the spi controller:
diff --git a/arch/arm/boot/dts/bcm283x.dtsi b/arch/arm/boot/dts/bcm283x.dtsi
index 013431e3d7c3..af4d63f92b79 100644
--- a/arch/arm/boot/dts/bcm283x.dtsi
+++ b/arch/arm/boot/dts/bcm283x.dtsi
@@ -405,7 +405,9 @@
status = "disabled";
};
- spi: spi@7e204000 {
+ spi0: spi: spi@7e204000 {
+ dmas = <&dma 6>, <&dma 7>;
+ dma-names = "tx", "rx";
compatible = "brcm,bcm2835-spi";
reg = <0x7e204000 0x1000>;
interrupts = <2 22>;
spi pinmux isn't setup by default on Pi3 as it's done on the others, so we need to do that:
diff --git a/arch/arm/boot/dts/bcm2837-rpi-3-b.dts b/arch/arm/boot/dts/bcm2837-rpi-3-b.dts
index a8844d033b3f..dce693faed6e 100644
--- a/arch/arm/boot/dts/bcm2837-rpi-3-b.dts
+++ b/arch/arm/boot/dts/bcm2837-rpi-3-b.dts
@@ -60,3 +60,8 @@
status = "okay";
bus-width = <4>;
};
+
+&spi {
+ pinctrl-names = "default";
+ pinctrl-0 = <&spi0_gpio7>;
+};
Show pinmux:
$ sudo cat /sys/kernel/debug/pinctrl/pinctrl-handles
Requested pin control handlers their pinmux maps:
device: 20204000.spi current state: default
state: default
type: MUX_GROUP controller pinctrl-bcm2835 group: gpio7 (7) function: alt0 (4)
type: MUX_GROUP controller pinctrl-bcm2835 group: gpio8 (8) function: alt0 (4)
type: MUX_GROUP controller pinctrl-bcm2835 group: gpio9 (9) function: alt0 (4)
type: MUX_GROUP controller pinctrl-bcm2835 group: gpio10 (10) function: alt0 (4)
type: MUX_GROUP controller pinctrl-bcm2835 group: gpio11 (11) function: alt0 (4)
I couldn't get this to work, but maybe someone else can.
This is the initramfs setup:
$ cat /etc/initramfs-tools/modules
spi-bcm2835
gpio_backlight
tinydrm
mipi-dbi
mi0283qt
# Create initramfs
$ sudo update-initramfs -c -k $(uname -r)
update-initramfs: Generating /boot/initrd.img-4.10.0-v7+
$ grep initramfs /boot/config.txt
initramfs initrd.img-4.10.0-v7+ followkernel
# if updating is needed
$ sudo update-initramfs -u
ln: failed to create hard link ‘/boot/initrd.img-4.10.0-v7+.dpkg-bak’ => ‘/boot/initrd.img-4.10.0-v7+’: Operation not permitted
update-initramfs: Generating /boot/initrd.img-4.10.0-v7+
Updating the kernel will break it: Update intramfs after kernel update
Some debugging info: https://github.com/notro/fbtft/wiki/Bootsplash#debugging