1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-15 19:23:01 +03:00

potter: coalesce seven DTBs into three for space saving

Moto Potter boot partition is only 16MB, which is tight. In the vendor
kernel it has seven hwrev variants with a dts file for each - but four
of them are identical to three of the others. We can make a
significant saving on image size by shipping one of each of the
differing dts files and adding the board-id values of the other
identical hwrevs to each.
This commit is contained in:
Daniel Barlow 2021-05-30 17:59:49 +01:00
parent 8bb3ff7610
commit b4f27af9ce
3 changed files with 193 additions and 5 deletions

View File

@ -3,6 +3,57 @@ include::_support/common.inc[]
== Device-specific notes
=== Hardware Revisions
This device has been through several hardware revisions: the kernel
describes P0A, P1A, P1B,P2A, P2A2, P2B, and P3A but that's not an
exhaustive list. Each of these revisions corresponds to a separate
hardware configuration description (device tree) in the vendor kernel,
but on examination it turns out that several are identical to each
other. These identical DTBs take significant space, so to shrink the
boot image to fit in the allotted 16MB partition we have merged the
duplicates.
hwrev board-id (mis)features
P0A <0x44 0x80a0> U D
P1A <0x44 0x81a0> U D
P1B <0x44 0x81b0> D
P2A <0x44 0x82a0> D
<0x45 0x82a0> D
P2A2 <0x45 0x82a2>
P2B <0x45 0x82b0>
P3A <0x46 0x83a0>
P3B <0x46 0x83b0>
By browsing the commit messages, we find
U = "Change usbid-gpio from 66 to 59" git sha 305e2610c598dc4e
D = "boost clock use pdm clock instead" git sha c42744ebf80da79a0
Thus,we can accommodate all revisions with three DTs:
- msm8953-potter-p0a-p1a.dtb (contains U and D fixes)
- msm8953-potter-p1b-p2a.dtb (contains D fix only)
- msm8953-potter-p2a2-plus.dtb (contains no fix)
==== What about P3B?
The vendor kernel does not include a device tree source with
appropriate board-id for hwrev P3B, but empirically (by consulting
`/proc/device-tree/board-id` on a device running Android) it looks like
the bootloader chooses the P3A DTB instead. As far as I understand it
this goes against the https://github.com/xiaolu/mkbootimg_tools/blob/master/dtbtool.txt[documented rules]
for choosing a device tree - https://android.googlesource.com/kernel/msm.git/+/android-msm-bullhead-3.10-n-preview-1/Documentation/devicetree/bindings/arm/msm/board-id.txt?autodive=0%2F%2F%2F%2F[according to
sources]
the platform subtype is the lowest 8 bits of the second element of the
board-id, and clearly 0xa0 != 0xb0, but it seems to do it anyway.
If you have a device with a hwrev *after* P3B, I'd love to hear from
you about how it behaves in this regard.
=== Firmware for Wi-Fi
This particular phone keeps the firmware files on a partition named

View File

@ -0,0 +1,141 @@
diff --git a/arch/arm/boot/dts/qcom/Makefile b/arch/arm/boot/dts/qcom/Makefile
index c5a2e99104ab..3f421a0d8cd7 100644
--- a/arch/arm/boot/dts/qcom/Makefile
+++ b/arch/arm/boot/dts/qcom/Makefile
@@ -336,13 +336,9 @@ dtb-$(CONFIG_ARCH_MSM8953) += msm8953-addison-p1.dtb \
endif
ifeq ($(CONFIG_POTTER_DTB),y)
-dtb-$(CONFIG_ARCH_MSM8953) += msm8953-potter-p0a.dtb \
- msm8953-potter-p1a.dtb \
- msm8953-potter-p1b.dtb \
- msm8953-potter-p2a.dtb \
- msm8953-potter-p2a2.dtb \
- msm8953-potter-p2b.dtb \
- msm8953-potter-p3a.dtb
+dtb-$(CONFIG_ARCH_MSM8953) += msm8953-potter-p0a-p1a.dtb \
+ msm8953-potter-p1b-p2a.dtb \
+ msm8953-potter-p2a2-plus.dtb
endif
ifeq ($(CONFIG_ALBUS_DTB),y)
diff --git a/arch/arm/boot/dts/qcom/msm8953-potter-p0a-p1a.dts b/arch/arm/boot/dts/qcom/msm8953-potter-p0a-p1a.dts
new file mode 100644
index 000000000000..c64507c09e0a
--- /dev/null
+++ b/arch/arm/boot/dts/qcom/msm8953-potter-p0a-p1a.dts
@@ -0,0 +1,52 @@
+/* Copyright (c) 2015, Motorola Mobility Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/dts-v1/;
+
+
+#include "msm8953-potter.dtsi"
+
+
+/ {
+ qcom,board-id = <0x44 0x80a0>,<0x44 0x81a0>;
+};
+
+&tlmm {
+ usb_id_int_active {
+ usb_id_active: default {
+ mux {
+ pins = "gpio66";
+ };
+ config {
+ pins = "gpio66";
+ };
+ };
+ };
+ usb_id_int_sleep {
+ usb_id_sleep: sleep {
+ mux {
+ pins = "gpio66";
+ };
+ config {
+ pins = "gpio66";
+ };
+ };
+ };
+};
+&usb3 {
+ qcom,usbid-gpio = <&tlmm 66 0>;
+};
+
+&pm8953_diangu_dig {
+ qcom,cdc-boost-pdm-clk;
+};
+
diff --git a/arch/arm/boot/dts/qcom/msm8953-potter-p1b-p2a.dts b/arch/arm/boot/dts/qcom/msm8953-potter-p1b-p2a.dts
new file mode 100644
index 000000000000..e6f645c52e38
--- /dev/null
+++ b/arch/arm/boot/dts/qcom/msm8953-potter-p1b-p2a.dts
@@ -0,0 +1,26 @@
+/* Copyright (c) 2015, Motorola Mobility Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/dts-v1/;
+
+
+#include "msm8953-potter.dtsi"
+
+
+/ {
+ qcom,board-id = <0x44 0x81b0>,<0x44 0x82a0>,<0x45 0x82a0>;
+};
+
+&pm8953_diangu_dig {
+ qcom,cdc-boost-pdm-clk;
+};
+
diff --git a/arch/arm/boot/dts/qcom/msm8953-potter-p2a2-plus.dts b/arch/arm/boot/dts/qcom/msm8953-potter-p2a2-plus.dts
new file mode 100644
index 000000000000..fc1569b3a2ea
--- /dev/null
+++ b/arch/arm/boot/dts/qcom/msm8953-potter-p2a2-plus.dts
@@ -0,0 +1,24 @@
+/* Copyright (c) 2015, Motorola Mobility Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/dts-v1/;
+
+
+#include "msm8953-potter.dtsi"
+
+
+/ {
+ qcom,board-id = <0x45 0x82a2>,<0x45 0x82b0>,<0x46 0x83a0>,<0x46 0x83b0> ;
+};
+
+
+

View File

@ -19,14 +19,10 @@ mobile-nixos.kernel-builder-gcc6 {
patches = [
./04_fix_camera_msm_isp.patch
# these two don't apply to boulzordev kernel, and I am
# hoping/assuming are not needed. Will dig into it before
# merge
# ./05_misc_msm_fixes.patch
# ./06_prima_gcc6.patch
./99_framebuffer.patch
./0001-Allow-building-WCD9335_CODEC-without-REGMAP_ALLOW_WR.patch
./0005-Allow-building-with-sound-disabled.patch
./0007-Coalesce-identical-device-trees.patch
];
enableRemovingWerror = true;