Skip to content

Instantly share code, notes, and snippets.

Avatar

Andre Przywara apritzel

  • Cambridge, UK
View GitHub Profile
@apritzel
apritzel / sunxi_clk.c
Created Jan 8, 2019
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
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 Apr 5, 2018
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 Jan 31, 2018
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"
View gist:a52a06a6e8db99b5904fd31dc0de1316
sunxi boot monitor v0.1
Allwinner A64 SoC detected.
Booted from FEL
128Mbit SPI flash detected.
(No SD card detection yet.)
(No eMMC detection yet).
Use "help" for a list of commands.
# help
help
@apritzel
apritzel / orangepi_pc2.bootlog.txt
Created Nov 11, 2016
Booting 4.9-rc2 on the Allwinner H5 based OrangePi PC 2 (via FEL)
View orangepi_pc2.bootlog.txt
U-Boot SPL 2016.11-rc3-00019-g5c2dad5-dirty (Nov 11 2016 - 01:27:06)
DRAM:DRAM BOOT DRIVE INFO: V0.6
the chip id is 0x1
the chip id is 0x1
the chip id is 0x1
the chip id is 0x1
the chip id is 0x1
DRAM CLK =672 MHZ
DRAM Type =3 (2:DDR2,3:DDR3,6:LPDDR2,7:LPDDR3)
DRAM zq value: 0x3b3bf9
@apritzel
apritzel / inject_dt.sh
Created Aug 4, 2016
Script to recreate a DT in U-Boot via the serial console
View inject_dt.sh
#!/bin/sh
send() {
read -d\# line
echo "$1"
}
# kick u-boot to tickle the prompt and get the state machine going
echo "printenv bootcmd"
read line
@apritzel
apritzel / sun50i-a64.dtsi
Created Aug 1, 2016
Allwinner A64 SCPI clock based DT
View sun50i-a64.dtsi
/*
* Copyright (C) 2016 ARM Ltd.
* based on the Allwinner H3 dtsi:
* Copyright (C) 2015 Jens Kuske <jenskuske@gmail.com>
*
* This file is dual-licensed: you can use it either under the terms
* of the GPL or the X11 license, at your option. Note that this dual
* licensing only applies to this file, and not this project as a
* whole.
*
@apritzel
apritzel / sun50i-a64.dtsi
Created Aug 1, 2016
Allwinner A64 SCPI clock based DT
View sun50i-a64.dtsi
/*
* Copyright (C) 2016 ARM Ltd.
* based on the Allwinner H3 dtsi:
* Copyright (C) 2015 Jens Kuske <jenskuske@gmail.com>
*
* This file is dual-licensed: you can use it either under the terms
* of the GPL or the X11 license, at your option. Note that this dual
* licensing only applies to this file, and not this project as a
* whole.
*
View 0001-net-sun8i-emac-fix-endianess-issues.patch
From fbf6111be9ee89afb1a0c47363693dbab96b7d50 Mon Sep 17 00:00:00 2001
From: Andre Przywara <andre.przywara@arm.com>
Date: Wed, 28 Jul 2016 21:52:51 +0100
Subject: [PATCH] net: sun8i-emac: fix endianness issues
The network MAC in recent Allwinner SoCs uses an internal DMA controller,
which gets its information from DMA descriptors in normal memory.
The device expects the values in there to be in little-endian format.
Since we use normal memory accesses to fill those DMA descriptors, we
must wrap write accesses to these descriptors with cpu_to_le32() calls
You can’t perform that action at this time.