Skip to content

Commit

Permalink
copy bcm2711-rpi-4-b.dtb (with UART path) from kernel build
Browse files Browse the repository at this point in the history
  • Loading branch information
stapelberg committed Apr 4, 2020
1 parent a9cac0c commit 6412922
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 1 deletion.
72 changes: 72 additions & 0 deletions 0103-expose-UART0-ttyAMA0-on-GPIO-14-15-disable-UART1-tty.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
--- ./arch/arm/boot/dts/bcm2711-rpi-4-b.dts.O 2020-04-04 13:55:20.803705272 +0200
+++ ./arch/arm/boot/dts/bcm2711-rpi-4-b.dts 2020-04-04 14:00:57.649047011 +0200
@@ -10,7 +10,8 @@

chosen {
/* 8250 auxiliary UART instead of pl011 */
- stdout-path = "serial1:115200n8";
+ stdout-path = "";
+ bootargs = "earlyprintk console=tty1";
};

/* Will be filled by the bootloader */
@@ -37,6 +38,14 @@
};
};

+ aliases {
+ /* required for the firmware as per
+ * https://github.com/raspberrypi/firmware/issues/752#issuecomment-283331328
+ * */
+ uart0 = &uart0;
+ uart1 = &uart1;
+ };
+
wifi_pwrseq: wifi-pwrseq {
compatible = "mmc-pwrseq-simple";
reset-gpios = <&expgpio 1 GPIO_ACTIVE_LOW>;
@@ -57,6 +66,14 @@
};
};

+&gpio {
+ uart0_pins: uart0_pins {
+ brcm,pins = <14 15>;
+ brcm,function = <BCM2835_FSEL_ALT0>;
+ brcm,pulls = <0 2>;
+ };
+};
+
&firmware {
expgpio: gpio {
compatible = "raspberrypi,firmware-gpio";
@@ -117,25 +134,16 @@
};
};

-/* uart0 communicates with the BT module */
+/* uart0 is mapped to the pin header */
&uart0 {
pinctrl-names = "default";
- pinctrl-0 = <&uart0_ctsrts_gpio30 &uart0_gpio32>;
- uart-has-rtscts;
+ pinctrl-0 = <&uart0_pins>;
status = "okay";
-
- bluetooth {
- compatible = "brcm,bcm43438-bt";
- max-speed = <2000000>;
- shutdown-gpios = <&expgpio 0 GPIO_ACTIVE_HIGH>;
- };
};

-/* uart1 is mapped to the pin header */
+/* uart1 is disabled */
&uart1 {
- pinctrl-names = "default";
- pinctrl-0 = <&uart1_gpio14>;
- status = "okay";
+ status = "disabled";
};

&vchiq {
Binary file added bcm2711-rpi-4-b.dtb
Binary file not shown.
6 changes: 5 additions & 1 deletion cmd/gokr-build-kernel/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ func main() {

log.Printf("unpacking kernel source")
if err := exec.Command("tar", "xf", filepath.Base(latest)).Run(); err != nil {
log.Fatal("untar: %v", err)
log.Fatalf("untar: %v", err)
}

srcdir := strings.TrimSuffix(filepath.Base(latest), ".tar.xz")
Expand Down Expand Up @@ -1084,4 +1084,8 @@ func main() {
if err := copyFile("/tmp/buildresult/bcm2710-rpi-3-b-plus.dtb", "arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b-plus.dtb"); err != nil {
log.Fatal(err)
}

if err := copyFile("/tmp/buildresult/bcm2711-rpi-4-b.dtb", "arch/arm64/boot/dts/broadcom/bcm2711-rpi-4-b.dtb"); err != nil {
log.Fatal(err)
}
}
10 changes: 10 additions & 0 deletions cmd/gokr-rebuild-kernel/kernel.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ var patchFiles = []string{
// serial
"0101-expose-UART0-ttyAMA0-on-GPIO-14-15-disable-UART1-tty.patch",
"0102-expose-UART0-ttyAMA0-on-GPIO-14-15-disable-UART1-tty.patch",
"0103-expose-UART0-ttyAMA0-on-GPIO-14-15-disable-UART1-tty.patch",
}

func copyFile(dest, src string) error {
Expand Down Expand Up @@ -157,6 +158,10 @@ func main() {
if err != nil {
log.Fatal(err)
}
dtb4Path, err := find("bcm2711-rpi-4-b.dtb")
if err != nil {
log.Fatal(err)
}

// Copy all files into the temporary directory so that docker
// includes them in the build context.
Expand Down Expand Up @@ -242,4 +247,9 @@ func main() {
if err := copyFile(dtbPlusPath, filepath.Join(tmp, "bcm2710-rpi-3-b-plus.dtb")); err != nil {
log.Fatal(err)
}

if err := copyFile(dtb4Path, filepath.Join(tmp, "bcm2711-rpi-4-b.dtb")); err != nil {
log.Fatal(err)
}

}

0 comments on commit 6412922

Please sign in to comment.