From cc123ebbef48ef5bb415f61ac266ef6467c1cf93 Mon Sep 17 00:00:00 2001 From: Federico Amedeo Izzo Date: Sat, 6 Nov 2021 22:28:00 +0100 Subject: [PATCH] pine64-pinephone: Add support for eMMC Vccq hardware mod (MR 2665) [ci:skip-build]: already built successfully in CI --- device/main/device-pine64-pinephone/APKBUILD | 37 +++++++++++++++++-- .../pinephone-vccq-mod.dts | 23 ++++++++++++ .../device-pine64-pinephone/uboot-script.cmd | 5 +++ .../device-pine64-pinephone/uboot-user.cmd | 9 +++++ main/linux-postmarketos-allwinner/APKBUILD | 5 ++- 5 files changed, 74 insertions(+), 5 deletions(-) create mode 100644 device/main/device-pine64-pinephone/pinephone-vccq-mod.dts create mode 100644 device/main/device-pine64-pinephone/uboot-user.cmd diff --git a/device/main/device-pine64-pinephone/APKBUILD b/device/main/device-pine64-pinephone/APKBUILD index f2a0bcac3..adfd0b242 100644 --- a/device/main/device-pine64-pinephone/APKBUILD +++ b/device/main/device-pine64-pinephone/APKBUILD @@ -6,7 +6,7 @@ # Co-Maintainer: Dylan Van Assche pkgname=device-pine64-pinephone pkgver=0.35 -pkgrel=2 +pkgrel=3 pkgdesc="PINE64 PinePhone" url="https://postmarketos.org" license="MIT" @@ -17,6 +17,7 @@ subpackages=" $pkgname-shelli $pkgname-plasma-mobile:plasma_mobile $pkgname-upower + $pkgname-vccq-mod:vccq_mod " depends=" alsa-ucm-conf @@ -32,7 +33,7 @@ depends=" u-boot-pinephone>=2021.01_git20201228-r2 u-boot-tools " -makedepends="devicepkg-dev" +makedepends="devicepkg-dev dtc" install="$pkgname.post-install $pkgname.post-upgrade $pkgname.pre-upgrade" source=" 00_alsa_pinephone_dshare.conf @@ -48,10 +49,12 @@ source=" modemmanager.conf setup-modem.sh uboot-script.cmd + uboot-user.cmd ucm/HiFi.conf ucm/PinePhone.conf ucm/VoiceCall.conf UPower.conf + pinephone-vccq-mod.dts pulse-pinephone.conf " # workaround to purge the -elogind subpackage that was previously @@ -70,6 +73,24 @@ build() { -n postmarketos \ -d "$srcdir"/uboot-script.cmd \ "$srcdir"/boot.scr + # Build user U-boot script for vccq-mod + mkimage \ + -A arm \ + -O linux \ + -T script \ + -C none \ + -a 0 \ + -e 0 \ + -n postmarketos-user \ + -d "$srcdir"/uboot-user.cmd \ + "$srcdir"/user.scr + # Build Device Tree Overlay for vccq-mod + dtc \ + -@ \ + -I dts \ + -O dtb \ + -o "$srcdir"/pinephone-vccq-mod.dtbo \ + "$srcdir"/pinephone-vccq-mod.dts } package() { @@ -151,6 +172,14 @@ shelli() { install -Dm644 "$srcdir"/00_alsa_pinephone_dshare.conf \ "$subpkgdir"/etc/alsa/conf.d/00_alsa_pinephone_dshare.conf } + +vccq_mod() { + pkgdesc="Install only if you have done the Vccq hardware mod https://postmarketos.org/pp-vccq-mod" + install -Dm644 "$srcdir"/user.scr \ + "$subpkgdir"/boot/user.scr + install -Dm644 "$srcdir"/pinephone-vccq-mod.dtbo \ + "$subpkgdir"/boot/pinephone-vccq-mod.dtbo +} sha512sums=" 5736444fd38ab4351d148ae96c479085f469bd1e51a692fb1827f8ac921a584389f7696985e1fba21c2deac88709910531f4ece282f45ff54e590c2b54b84ba3 00_alsa_pinephone_dshare.conf b53cc6f2531854cc9c1e4c334185a20551d64c8675ee8a8eaa03b99d80808fad421a0f6e99e5be212a974d88c85f461a71ba59ac59c29f298c82f211e3be1ef4 10-pinephone-proximity.rules @@ -164,10 +193,12 @@ ccbc83b84b5028bc2c8e526759004ce71b50b2675ecffee98f5676c70a3332197a231ff9d2fd4644 6bc22b369b2d9058b702ac7a7862abaefaf8179b43491868bdb008d181b59104f1ded89db1da51a810e1ccdc803a579b924a438674283a65afc3a9c4d2894caf kirigami-lowpower.sh c5006c38828eb519917d57756f7831c4552feffef2d4922a384073f6a551535f615ad397d784e313818e0b943e1f6212bcca0aff9ce37da60b29547b1631f24b modemmanager.conf 420ee1d7522d4d56c2909580fd6ba7580483ca5455b13eb6d22e700063ce0c1a5c6d2f5b161dfce0d777636fe9a712aa82f38a0585f2feabea3785b02bae7515 setup-modem.sh -e9d923b48dbb929d333c178181339a1369be34397df49298cff2aca9b1e4f7f6ddff8391424c378d2bbd7a495021abc3a06af011eb3240a06650195ab18469b2 uboot-script.cmd +c085a92af68fa3b1e1cd0c407a3782e66e7eeb3321a95ca3decedf46a68e012e272d1aac9aa690812529d6c35c558b198d94775fc6dfafc8b09eef0c56a50e28 uboot-script.cmd +f28902517bebe16f7ddbdbf9f4c52d5c97319e3b5ba7326ba96ed0e094d3d2a39c87061326893cdc34336bbfd56de084b2f217918ebba7ca6a080088cd0bd409 uboot-user.cmd f963898fa2ce66bc830e56feeec6ffc9888834e14cc1591d72908ef45ad82532bc3ef5fb32413e07b6722749c9d03e7cf92f06f1fcb859c38b9297cf58e5cedd HiFi.conf 4b0c51ab169aebe8177c5c43eba41afa90370098a5a54e710d17e97ec1651869a20cb5d780a6132028c864916609e3b4f4a13158835310d0441bdb4915872372 PinePhone.conf e093f71c37370927468de35a987150a3db3e1cc1c76c144bf58918a09c688c3da84303b5533241e691a6aa0758589e2a6498b1097974117782e909f0bbc6bf71 VoiceCall.conf ed0e03f7e1c0348c06be9a7922414469245604ce813bbf0c8910ef211cb993bbb0d0d4615c9c961d50712415f85d6b73e0cf02780ac784666aac56e4889341e4 UPower.conf +d66ecef1fa5481ff138fe4e12b194903ceacab9d0649e716049f32e56ec6d9be09b97e2ff769ebc5c9fbced542986b9214f47ed14511ad761d80a41b19e02df7 pinephone-vccq-mod.dts 9c472065b19141dd4c7555869b955de2e679b36e597f9fa3bdac18d0e9460986b0e2fffe1e04751301305f1b6474c1375803afb7d6212eeae91b4905d0bf8ff8 pulse-pinephone.conf " diff --git a/device/main/device-pine64-pinephone/pinephone-vccq-mod.dts b/device/main/device-pine64-pinephone/pinephone-vccq-mod.dts new file mode 100644 index 000000000..d5ac00f20 --- /dev/null +++ b/device/main/device-pine64-pinephone/pinephone-vccq-mod.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +// Copyright (C) 2021 Federico Amedeo Izzo + +// Switch eMMC Vccq from 3.3v regulator DCDC1 to 1.8v regulator ELDO1 +// And enable HS200 mode. +// This DT overlay should be applied only after modifying the Pinephone +// Board by moving R615 to R614. + +/dts-v1/; +/plugin/; +/ { + compatible = "pine64,pinephone"; +}; + +&mmc2 { + pinctrl-0 = <&mmc2_pins>, <&mmc2_ds_pin>; + vqmmc-supply = <®_eldo1>; + mmc-hs200-1_8v; +}; + +&pio { + vcc-pc-supply = <®_eldo1>; +}; diff --git a/device/main/device-pine64-pinephone/uboot-script.cmd b/device/main/device-pine64-pinephone/uboot-script.cmd index 57c4ef9e1..388451fcb 100644 --- a/device/main/device-pine64-pinephone/uboot-script.cmd +++ b/device/main/device-pine64-pinephone/uboot-script.cmd @@ -34,6 +34,11 @@ fdt mknode / memory fdt set /memory ram_freq ${ram_freq} fdt list /memory +echo Loading user script +setenv user_scriptaddr 0x50100000 +load mmc ${mmc_bootdev}:1 ${user_scriptaddr} user.scr +if test $? -eq 0; then source ${user_scriptaddr}; else echo No user script found; fi + echo Booting kernel gpio set 116 gpio clear 98 diff --git a/device/main/device-pine64-pinephone/uboot-user.cmd b/device/main/device-pine64-pinephone/uboot-user.cmd new file mode 100644 index 000000000..44df17752 --- /dev/null +++ b/device/main/device-pine64-pinephone/uboot-user.cmd @@ -0,0 +1,9 @@ +echo Entering user script: + +echo Loading DTB overlay +load mmc ${mmc_bootdev}:1 ${fdtoverlay_addr_r} pinephone-vccq-mod.dtbo + +echo Applying DTB overlay +fdt apply ${fdtoverlay_addr_r} + +echo Exiting user script: diff --git a/main/linux-postmarketos-allwinner/APKBUILD b/main/linux-postmarketos-allwinner/APKBUILD index aaad284ec..0db489b3b 100644 --- a/main/linux-postmarketos-allwinner/APKBUILD +++ b/main/linux-postmarketos-allwinner/APKBUILD @@ -7,7 +7,7 @@ _flavor=postmarketos-allwinner _config="config-$_flavor.$CARCH" pkgname=linux-$_flavor pkgver=5.14.6_git20210920 -pkgrel=2 +pkgrel=3 _tag="orange-pi-5.14-20210920-2006" pkgdesc="Kernel fork with Pine64 patches (megi's tree, slightly patched)" arch="aarch64 armv7" @@ -73,7 +73,8 @@ build() { unset LDFLAGS make ARCH="$_carch" CC="${CC:-gcc}" \ KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-$_flavor" \ - CFLAGS_MODULE=-fno-pic + CFLAGS_MODULE=-fno-pic \ + DTC_FLAGS="-@" } package() {