Skip to content

Instantly share code, notes, and snippets.

View apritzel's full-sized avatar

Andre Przywara apritzel

View GitHub Profile
@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!)
View sun8i-r16-x6100.dts
/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
View u_boot_h6_32_v5.patch
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
View u-boot_aa32.patch
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
View sun50i-h6-eachlink-h6-mini.dts
@apritzel
apritzel / uboot_sunxi_edid_debug.patch
Created February 18, 2021 10:20
U-Boot sunxi display debug hack to list EDID reported modes
View uboot_sunxi_edid_debug.patch
diff --git a/drivers/video/sunxi/sunxi_display.c b/drivers/video/sunxi/sunxi_display.c
index 61498d1642f..25e5f58b467 100644
--- a/drivers/video/sunxi/sunxi_display.c
+++ b/drivers/video/sunxi/sunxi_display.c
@@ -292,7 +292,11 @@ static int sunxi_hdmi_edid_get_mode(struct sunxi_display *sunxi_display,
for (i = 0; i < 4; i++, t++) {
r = video_edid_dtd_to_ctfb_res_modes(t, mode);
if (r == 0)
- break;
+ printf("mode %d: %dx%d@%dHz; pixel clock: %d KHz\n",
@apritzel
apritzel / r40_dram_dual_rank.diff
Created February 10, 2021 14:12
R40 dual rank hack
View r40_dram_dual_rank.diff
diff --git a/arch/arm/mach-sunxi/dram_sunxi_dw.c b/arch/arm/mach-sunxi/dram_sunxi_dw.c
index d0600011ffa..5dcafa21bc9 100644
--- a/arch/arm/mach-sunxi/dram_sunxi_dw.c
+++ b/arch/arm/mach-sunxi/dram_sunxi_dw.c
@@ -388,8 +388,9 @@ static void mctl_set_cr(uint16_t socid, struct dram_para *para)
{
struct sunxi_mctl_com_reg * const mctl_com =
(struct sunxi_mctl_com_reg *)SUNXI_DRAM_COM_BASE;
+ u32 cr_val;
@apritzel
apritzel / sunxi_clk.c
Created January 8, 2019 11:35
recursive implemenation of U-Boot clock driver for Allwinner SoCs
View sunxi_clk.c
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2018 Amarula Solutions.
* Author: Jagan Teki <jagan@amarulasolutions.com>
*/
#include <common.h>
#include <clk-uclass.h>
#include <dm.h>
#include <errno.h>
@apritzel
apritzel / a64_arch_timer.log
Created May 26, 2018 00:04
Allwinner A64 arch timer monotonicity test
View a64_arch_timer.log
##############################
# test output mainline kernel
##############################
$ ./test_timer
TAP version 13
# number of cores: 4
ok 1 same timer frequency on all cores
# timer frequency is 24000000 Hz (24 MHz)
# time1: eb447fff, time2: eb444000, diff: -16383
# time1: eb44efff, time2: eb44e800, diff: -2047
@apritzel
apritzel / sunxi-add-SPL-FEL-button.patch
Created April 5, 2018 09:06
check configurable GPIO button in SPL and go to FEL mode if low
View sunxi-add-SPL-FEL-button.patch
From 48be8001e507a0bd431b4f8186a95d11ddc6ee36 Mon Sep 17 00:00:00 2001
From: Andre Przywara <andre.przywara@arm.com>
Date: Wed, 23 Nov 2016 00:35:01 +0000
Subject: [PATCH] sunxi: add SPL FEL button
Some of the newer Allwinner boards that come with SPI flash soldered
are missing an easy way to trigger the USB-OTG FEL boot mode.
On most boards without eMMC FEL mode is entered when there is no SD card
found, boards with eMMC typically feature a hardware FEL button.
Now some boards like newer boards from OrangePi have no eMMC, but have a SPI
@apritzel
apritzel / check_xen_coding_style.sh
Created January 31, 2018 12:24
very simple Xen coding style checker (to catch Linux copy&paste artefacts)
View check_xen_coding_style.sh
#!/bin/sh
grep -n '^ *'$'\t' "$1" && echo "^^^ tabs"
grep -n 'if(' "$1" && echo "^^^ no space after if"
grep -n 'if ([^ ]' "$1" && echo "^^^ no space after if ("
grep -n 'while(' "$1" && echo "^^^ no space after while"
grep -n 'while ([^ ]' "$1" && echo "^^^ no space after while ("
grep -n 'for(' "$1" && echo "^^^ no space after for"
grep -n 'for ([^ ]' "$1" && echo "^^^ no space after for ("
grep -n '[ ]*[^ ].*{$' "$1" && echo "^^^ opening bracket at the end of line"