Skip to content

Instantly share code, notes, and snippets.

View apritzel's full-sized avatar

Andre Przywara apritzel

View GitHub Profile
--- boot0_dump.txt 2024-10-28 01:24:13.359531938 +0000
+++ mainline_dump.txt 2024-10-28 01:24:47.493533236 +0000
@@ -1,3 +1,7 @@
+
+U-Boot SPL 2024.10-01148-gfb3331564c68-dirty (Oct 27 2024 - 10:48:49 +0000)
+DRAM:cols = 10, rows = 16, banks = 3, bankgrps = 0, ranks = 0, full_width = 1
+DRAM simple test FAIL----- address 0000000040000000 = 19070976
04820000: c1080020 00000001 00000001 00000001
04820010: 00000030 00001626 00000000 00000000
04820020: 00000000 00800000 00000001 00000001
@apritzel
apritzel / clk_sunxi-ng_h616_cpu_notifier.patch
Created October 24, 2024 00:44
H616 CPU clock notifier patch, to reparent CPU to PLL_PERI0 during DVFS frequency change
commit 5791b78a20997f5bae3e8c5fbdd444dc6a692ae9
Author: Andre Przywara <andre.przywara@arm.com>
Date: Thu Oct 24 01:25:45 2024 +0100
clk: sunxi-ng: h616: Reparent CPU clock during frequency changes
The H616 user manual recommends to re-parent the CPU clock during
frequency changes of the PLL, and recommends PLL_PERI0(1X), which runs
at 600 MHz.
@apritzel
apritzel / find_dtbs.c
Created May 30, 2024 23:58
find_dtbs: scan a binary file for devicetree binary magic bytes, and allow extracting the DTBs
// SPDX-License-Identifier: GPL-2.0-only
// Copyright (C) 2018-2024 Andre Przywara <osp@apritzel.eu>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include <getopt.h>
#include <arpa/inet.h> // for htonl
@apritzel
apritzel / u-boot_h616_high_boot.patch
Created May 2, 2024 10:17
U-Boot H616 SPL at 256KB MMC offset booting support
commit 5e9a281c9f9b50f22fdba619ca3a0f8788224ef3
Author: Andre Przywara <andre.przywara@arm.com>
Date: Thu Mar 28 16:18:12 2024 +0000
UNTESTED! H616 high location boot support
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
index 0140b07d32a..046e9fbfc67 100644
@apritzel
apritzel / d1_pwm_refactor_for_h616.patch
Created April 29, 2024 15:52
Allwinner D1 PWM driver refactoring patch to accommodate H616 PWM IP
Author: Andre Przywara <andre.przywara@arm.com>
Date: Wed Sep 6 21:04:05 2023 +0100
pwm: sun20i: Refactor channel enablement
When enabling or disabling a PWM channel, we also ungate and gate the
respective clock at the same time.
Factor this out into a separate function, to simplify extending the
driver to other SoCs, where the clock gate is located in a different
@apritzel
apritzel / rg35xx_plus_dt_update.patch
Created March 6, 2024 01:09
Updated DT sketch for Anbernic RG35xx Plus, partly commented
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-plus.dts b/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-plus.dts
index e2674af0c4661..dc25bfe09fac2 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-plus.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-plus.dts
@@ -8,6 +8,7 @@
#include "sun50i-h616.dtsi"
#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/linux-event-codes.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
@apritzel
apritzel / sun50i-h700-anbernic-rg35xx-plus.dts
Created March 5, 2024 11:51
Anbernic RG35XX-Plus minimal DT
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
* Copyright (C) 2024 Arm Ltd.
*/
/dts-v1/;
#include "sun50i-h616.dtsi"
#include <dt-bindings/gpio/gpio.h>
@apritzel
apritzel / sun8i-r16-x6100.dts
Last active June 28, 2022 22:40
Mainline devicetree for the XIEGU Tech X6100 HF+6m Transceiver, for Linux >=5.13 (mind the r_intc binding change!)
/dts-v1/;
#include "sun8i-a33.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
/ {
model = "XIEGU Tech X6100 HF+6m Transceiver";
compatible = "xiegu,x6100", "allwinner,sun8i-r16";
@apritzel
apritzel / u_boot_h6_32_v5.patch
Created April 21, 2022 00:53
hackish U-Boot Allwinner H6 in ARMv7/32-bit patch, as a base for the Allwinner V5 port
commit 17efad455c2cb482f9f950cf6559f713379ce1f1
Author: Andre Przywara <andre.przywara@arm.com>
Date: Thu Apr 21 01:20:49 2022 +0100
naive H6 32-bit support (use lindenis_v5_defconfig)
diff --git a/arch/arm/include/asm/arch-sunxi/clock_sun50i_h6.h b/arch/arm/include/asm/arch-sunxi/clock_sun50i_h6.h
index 37df4410eaa..d821eafa85e 100644
--- a/arch/arm/include/asm/arch-sunxi/clock_sun50i_h6.h
+++ b/arch/arm/include/asm/arch-sunxi/clock_sun50i_h6.h
@apritzel
apritzel / u-boot_aa32.patch
Created January 3, 2022 15:45
U-Boot hack to boot AArch32 kernels from AArch64 EL2 U-Boot
diff --git a/arch/arm/include/asm/macro.h b/arch/arm/include/asm/macro.h
index ec0171e0e6c..430a9f0298a 100644
--- a/arch/arm/include/asm/macro.h
+++ b/arch/arm/include/asm/macro.h
@@ -325,6 +325,8 @@ lr .req x30
eret
1:
+ ldr \tmp, =0x00c00878
+ msr sctlr_el1, \tmp