From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id aNQLCNsCm2D7EQAAgWs5BA (envelope-from ) for ; Wed, 12 May 2021 00:19:07 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id +HSyA9sCm2CxGgAAB5/wlQ (envelope-from ) for ; Tue, 11 May 2021 22:19:07 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 4B5631D2BE for ; Wed, 12 May 2021 00:19:06 +0200 (CEST) Received: from localhost ([::1]:53356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lgaiX-0001iB-1v for larch@yhetil.org; Tue, 11 May 2021 18:19:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57862) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgagY-0006mi-JP for guix-patches@gnu.org; Tue, 11 May 2021 18:17:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:54422) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lgagY-00045V-8s for guix-patches@gnu.org; Tue, 11 May 2021 18:17:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lgagY-0001jH-5X for guix-patches@gnu.org; Tue, 11 May 2021 18:17:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#48371] Add crust firmware for sunxi devices Resent-From: Vagrant Cascadian Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 11 May 2021 22:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 48371 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 48371@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16207713826596 (code B ref -1); Tue, 11 May 2021 22:17:01 +0000 Received: (at submit) by debbugs.gnu.org; 11 May 2021 22:16:22 +0000 Received: from localhost ([127.0.0.1]:37735 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lgaft-0001iJ-Pi for submit@debbugs.gnu.org; Tue, 11 May 2021 18:16:22 -0400 Received: from lists.gnu.org ([209.51.188.17]:47388) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lgafs-0001iA-41 for submit@debbugs.gnu.org; Tue, 11 May 2021 18:16:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgafk-00051g-JV for guix-patches@gnu.org; Tue, 11 May 2021 18:16:15 -0400 Received: from cascadia.aikidev.net ([173.255.214.101]:37720) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lgafd-0003Pa-J9 for guix-patches@gnu.org; Tue, 11 May 2021 18:16:08 -0400 Received: from localhost (97-120-1-76.ptld.qwest.net [97.120.1.76]) (Authenticated sender: vagrant@cascadia.debian.net) by cascadia.aikidev.net (Postfix) with ESMTPSA id 5EA101ACAA for ; Tue, 11 May 2021 15:15:58 -0700 (PDT) From: Vagrant Cascadian Date: Tue, 11 May 2021 15:15:31 -0700 Message-ID: <87o8dgrk70.fsf@yucca> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Received-SPF: none client-ip=173.255.214.101; envelope-from=vagrant@debian.org; helo=cascadia.aikidev.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1620771546; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:list-id:list-help:list-unsubscribe:list-subscribe: list-post; bh=nFiziPTyovhNWwTXTzK6oYwTuBqKjKol55zZwLiItEE=; b=j/lMuEuTSnT/MyrPmmBFleRDmHUwnwUnGlqrO2sQmYna/B8uAwUb7YiDlaxIG7BDx0tO4L UeK7bkRxlKUsv0ucgl3vguvebOrNhnM9okgBtABU2NQ5W2wbDofISNskbqx2NaNgLGVAEO kfjskPu8EuILo6+zbWfYFpnYDZOm1H/L06SQZc+Cf+CJPZZIu4GeRLvLNU3PufnmG22SCW f85tezwKcuP1EB8NaS0YQvw6ASV3rjukdZiJZozd6uew4yddmCE7YlfhNiXJ/geoJnQgkL 0AmPl7V3/IsOWAyI7/reZwKWINEh7MGwEU9JPssr01RFppyGlKydrVwTTIpMiQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1620771546; a=rsa-sha256; cv=none; b=uPJfnCF5T+2Fzz4ICROxqotyosjhlFP39of/QVXrBl4S1cAs5DBkRVxjzdVlpOM5euKSvc l/aSykyqlFSjlbuqOQ5dSTQG1ijs2dDAlxkoBFhsnwqXswNwD/UN8JSUVuEqpoJBkphVRG Bf3NXTwNRSzGNvAehZS/s9jY51g9aaGLRQNntfqhzI6dHp3Fv2S5+Psf+dg87KRIpDrbza 0FYyLQcx3wKsYHmOTIaMyuZO1m+YInZAGX9BbDcF+s2AsG0ZbYKytNF6ilQ0js2zTP6Tof UrH+QyDdj2bDEC2XDcd59mBn2YyABUgiMGX2U6TtyRtEzeUZDH/80zBNMPQMZg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -4.05 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 4B5631D2BE X-Spam-Score: -4.05 X-Migadu-Scanner: scn0.migadu.com X-TUID: LX2zdqmH23Fv --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain The attached patches add crust System Control Processor firmware for pinebook, pine64+ and pine64-lts. Crust manages various power management aspects for these platforms, notably suspend states. live well, vagrant --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-gnu-Add-crust-pinebook-and-crust-pine64-plus.patch Content-Transfer-Encoding: quoted-printable From=20f79a6bec79bd00ab3ecb0f874494df597bfa1990 Mon Sep 17 00:00:00 2001 From: Vagrant Cascadian Date: Tue, 11 May 2021 20:57:50 +0000 Subject: [PATCH 1/2] gnu: Add crust-pinebook and crust-pine64-plus. * gnu/packages/bootstrap.scm (glibc-dynamic-linker): Add or1k-elf. gnu/packages/firmware.scm (make-crust-package, crust-pinebook, crust-pine64-plus): New variables. =2D-- gnu/packages/bootstrap.scm | 1 + gnu/packages/firmware.scm | 71 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm index c598cedc0a..b23ac04586 100644 =2D-- a/gnu/packages/bootstrap.scm +++ b/gnu/packages/bootstrap.scm @@ -315,6 +315,7 @@ or false to signal an error." ((string=3D? system "i686-mingw") "no-ld.so") ((string=3D? system "x86_64-mingw") "no-ld.so") ((string=3D? system "vc4-elf") "no-ld.so") + ((string=3D? system "or1k-elf") "no-ld.so") =20 (else (error "dynamic linker name not known for this system" system)))) diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm index c9a68f5a93..a057cbe516 100644 =2D-- a/gnu/packages/firmware.scm +++ b/gnu/packages/firmware.scm @@ -559,3 +559,74 @@ such as: `(("cross32-gcc" ,(cross-gcc "arm-none-eabi")) ("cross32-binutils", (cross-binutils "arm-none-eabi")) ,@(package-native-inputs base)))))) + +(define (make-crust-package platform) + (package + (name (string-append "crust-" + (string-replace-substring (string-downcase platfo= rm) + "_" "-"))) + (version "0.3") + (source + (origin + (method git-fetch) + (uri (git-reference + ;; There are only GitHub generated release snapshots. + (url "https://github.com/crust-firmware/crust") + (commit (string-append "v" version)))) + (file-name (git-file-name "crust" version)) + (sha256 + (base32 + "1ncn2ncmkj1cjk68zrgr5yk7b9x1xxcrcmk9jf188svjgk0cq2m5")))) + (build-system gnu-build-system) + (arguments + `(#:phases + (modify-phases %standard-phases + (delete 'configure) + (add-before 'build 'defconfig + (lambda* (#:key outputs make-flags #:allow-other-keys) + (let ((config-name (string-append ,platform "_defconfig"))) + (apply invoke "make" `(,@make-flags ,config-name))))) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out")) + (bin (find-files "." "(scp.bin|\\.config)"))) + (for-each + (lambda (file) + (install-file file out)) + bin)) + #t))) + #:make-flags (list + "CROSS_COMPILE=3Dor1k-elf-" + "DEBUG=3D1" + "HOSTCC=3Dgcc" + "HOSTAR=3Dar" + "HOST_COMPILE=3Daarch64-linux-gnu-" + "LEX=3Dflex") + #:tests? #f)) ; no tests + ;; The firmware is cross-compiled using a "bare bones" compiler (no li= bc.) + ;; Use our own tool chain for that. + (native-inputs `(("cross-gcc" ,(cross-gcc "or1k-elf" #:xgcc gcc-9)) + ("cross-binutils" ,(cross-binutils "or1k-elf" binutil= s)) + ("bison" ,bison) + ("flex" ,flex))) + (home-page "https://github.com/crust-firmware/crust") + (synopsis "System control processor firmware for Allwinner sunxi board= s") + (description + "Crust improves battery life and thermal performance by implementing a +deep sleep state. During deep sleep, the CPU cores, the DRAM controller, = and +most onboard peripherals are powered down, reducing power consumption by 8= 0% +or more compared to an idle device. On boards without a PMIC, Crust is al= so +responsible for orderly power-off and power-on of the device. + +For this to work, Crust runs outside the main CPU and DRAM, on a dedicated +always-on microprocessor called a System Control Processor (SCP). Crust is +designed to run on a specific SCP implementation, Allwinner's AR100.") + ;; Most files are dual-licensed "BSD-3 OR GPL2", a few are GPL2 only. + (license (list license:bsd-3 + license:gpl2)))) + +(define-public crust-pinebook + (make-crust-package "pinebook")) + +(define-public crust-pine64-plus + (make-crust-package "pine64_plus")) =2D-=20 2.30.2 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0002-gnu-u-boot-Add-crust-firmware-to-pinebook-pine64_plu.patch Content-Transfer-Encoding: quoted-printable From=206939b8555f4d2ed57b4993c501686d5ccdf47703 Mon Sep 17 00:00:00 2001 From: Vagrant Cascadian Date: Tue, 11 May 2021 21:15:15 +0000 Subject: [PATCH 2/2] gnu: u-boot: Add crust firmware to pinebook, pine64_pl= us and pine64-lts. * gnu/packages/bootloaders.scm (make-u-boot-sunxi64-package): Take argument for System Control Processor (SCP) firmware. [native-inputs]: Add SCP firmware. (u-boot-pine64-plus, u-boot-pine64-lts, u-boot-pinebook): Pass appropriate crust firmware as the SCP firmware. =2D-- gnu/packages/bootloaders.scm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm index 56bef57cb7..6f1bb5b8c9 100644 =2D-- a/gnu/packages/bootloaders.scm +++ b/gnu/packages/bootloaders.scm @@ -737,7 +737,7 @@ it fits within common partitioning schemes.") (define-public u-boot-am335x-evm (make-u-boot-package "am335x_evm" "arm-linux-gnueabihf")) =20 =2D(define-public (make-u-boot-sunxi64-package board triplet) +(define-public (make-u-boot-sunxi64-package board triplet scpfirmware) (let ((base (make-u-boot-package board triplet))) (package (inherit base) @@ -752,6 +752,9 @@ it fits within common partitioning schemes.") (assoc-ref (or native-inputs inputs) "firmware") "/bl31.bin"))) (setenv "BL31" bl31) + (setenv "SCP" (string-append + (assoc-ref inputs "scpfirmware") + "/scp.bin")) ;; This is necessary when we're using the bundled dtc. ;(setenv "PATH" (string-append (getenv "PATH") ":" ; "scripts/dtc")) @@ -759,16 +762,20 @@ it fits within common partitioning schemes.") #t)))))) (native-inputs `(("firmware" ,arm-trusted-firmware-sun50i-a64) + ("scpfirmware" ,scpfirmware) ,@(package-native-inputs base)))))) =20 (define-public u-boot-pine64-plus =2D (make-u-boot-sunxi64-package "pine64_plus" "aarch64-linux-gnu")) + (make-u-boot-sunxi64-package "pine64_plus" "aarch64-linux-gnu" + crust-pine64-plus)) =20 (define-public u-boot-pine64-lts =2D (make-u-boot-sunxi64-package "pine64-lts" "aarch64-linux-gnu")) + (make-u-boot-sunxi64-package "pine64-lts" "aarch64-linux-gnu" + crust-pine64-plus)) =20 (define-public u-boot-pinebook =2D (let ((base (make-u-boot-sunxi64-package "pinebook" "aarch64-linux-gnu= "))) + (let ((base (make-u-boot-sunxi64-package "pinebook" "aarch64-linux-gnu" + crust-pinebook))) (package (inherit base) (arguments =2D-=20 2.30.2 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQRlgHNhO/zFx+LkXUXcUY/If5cWqgUCYJsCBAAKCRDcUY/If5cW qv9kAP9O9fSAmJQYxI/tfkmJSLsVVWvUGADX8zI9LLXOXYn6sQD9GHGLGjhvIaNu SYYDnEwSOa1Kg8ns0yCAEiK0zszEUwY= =yU9z -----END PGP SIGNATURE----- --==-=-=--