refactor, extensive, still a work in progress

This commit is contained in:
Owen 2024-08-27 13:11:10 +02:00
parent 901d437201
commit fde53cf084
33 changed files with 93 additions and 2683 deletions

3
.gitignore vendored
View File

@ -1,5 +1,6 @@
# specific to this repo
device-tree/*/*.dts*
build-trees/*.dt*
build-trees/*/*.dt*
source/*
# Byte-compiled / optimized / DLL files

View File

@ -70,6 +70,8 @@ You can make it flash as wifi traffic is seen with:
`sudo sh -c "echo phy0rx > /sys/devices/platform/leds/leds/blue\:status/trigger"`
You can make this permanent by, as root, copying `tools/mqpro-status-led.service` to `/etc/systemd/system/`, running `systemctl daemon-reload` then `systemctl enable --now mqpro-status-led.service`.
## Using GPIO
Providing a full GPIO how-to is beyond the scope of this document, I use GPIOd to do this. But have also used direct pinctl control via the `/sys/class/gpio` tree.

View File

@ -4,6 +4,9 @@
## Ignore this: (until I properly update, some of this needs moving to source/README.md)
```console
# Install build-essentials (lots of packages, will take some time)
apt install build-essentials
# Enable source repos:
# As root edit the file: /etc/apt/sources.list.d/ubuntu.sources
# There should be two repo definitions, for both find the lines that say:
@ -12,13 +15,16 @@ Types: deb
Types: deb deb-src
# Save and exit editor.
# run
# As root, run
apt update
# you should see a load of new (source) repos being updated.
# - adding all these source repos slows apt down,
# not much that can be done about this on such a slow machine.
# Now we can install the linux sources
# This can be done as a normal user
# note that the command used here `apt source` will download the sources to the current working folder, not a fixed location.
cd source
apt source linux-riscv
# Go for a coffee.. ignore the 'git clone' suggestion.
@ -26,6 +32,8 @@ apt source linux-riscv
# directory.
# It will use ~1.6Gb of space.. so be prepared..
# If you re-run the command in this folder it will only update as needed, but is still somewhat slow since it verifies the existing downloads when updating.
```
# Rebuild dts tree for MQ pro..

View File

@ -4,21 +4,31 @@
dtc=/usr/bin/dtc
revision=`/usr/bin/uname -r`
trees=../precompiled-trees
echo "Compiling against headers for $revision"
if [ -d "$revision" ]; then
echo "Using existing build directory"
echo "Cleaning and Using existing build directory"
rm "$revision/*.dts $revision/*.dtsi $revision/*.dtb"
else
echo "Creating new build directory"
echo "Creating new build directory: $revision"
mkdir "$revision"
fi
echo "Copying custom dts sources to build root"
for dts in `ls -d $trees/*/*.dts`; do
echo "$dts"
cp $dts .
done
echo "Precompiling all includes and sources in build root into $revision build directory"
for file in `ls {*.dts,*.dtsi}`; do
echo "Processing $file to $revision/${file##*/}"
cpp -I/usr/src/linux-headers-$revision/include/ -nostdinc -undef -x assembler-with-cpp $file > $revision/${file##*/}
done
echo "Compiling all device tree sources in $revision build directory"
cd $revision
for file in `ls *.dts`; do
out=${file/.dts/.dtb}

View File

@ -0,0 +1 @@
../source/linux-riscv-6.8.0/arch/riscv/boot/dts/allwinner/sun20i-d1-nezha.dts

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
6.8.0-31-allwinner-nezha.gpio

View File

@ -1 +0,0 @@
6.8.0-31-common.gpio

View File

@ -1,33 +0,0 @@
```
MangoPI MQ Pro GPIO header (dtb name: MangoPi MQ Pro)
Gpio Header:
func des pin pin des func
3v3 1 --o o-- 2 5v
i2c0.sda (2502000.i2c:205) PG13 3 --o o-- 4 5v
i2c0.sck (2502000.i2c:204) PG12 5 --o o-- 6 gnd
free (39) PB7 7 --o o-- 8 PB8 uart0.tx (2500000.serial:40)
gnd 9 --o o-- 10 PB9 uart0.rx (2500000.serial:41)
free (117) PD21 11 --o o-- 12 PB5 i2c1.sda (2502400.i2c:37)
free (118) PD22 13 --o o-- 14 gnd
uart2.tx (2500800.serial:32) PB0 15 --o o-- 16 PB1 uart2.rx (2500800.serial:33)
3v3 17 --o o-- 18 PD14 uart3.cts (2500c00.serial:110)
free (108) PD12 19 --o o-- 20 gnd
uart3.rts (2500c00.serial:109) PD13 21 --o o-- 22 PC1 i2c2.sda (2502800.i2c:65)
uart3.rx (2500c00.serial:107) PD11 23 --o o-- 24 PD10 uart3.tx (2500c00.serial:106)
gnd 25 --o o-- 26 PD15 free (111)
i2c3.sda (2502c00.i2c:145) PE17 27 --o o-- 28 PE16 i2c3.sck (2502c00.i2c:144)
free (42) PB10 29 --o o-- 30 gnd
free (43) PB11 31 --o o-- 32 PC0 i2c2.sck (2502800.i2c:64)
free (44) PB12 33 --o o-- 34 gnd
free (38) PB6 35 --o o-- 36 PB2 uart4.tx (2501000.serial:34)
free (113) PD17 37 --o o-- 38 PB3 uart4.rx (2501000.serial:35)
gnd 39 --o o-- 40 PB4 i2c1.sck (2502400.i2c:36)
Other gpio outputs of interest:
-- PD18: Blue Status Led - gpio (2000000.pinctrl:114)
Notes:
- I2C pins 3,5,27 and 28 (PG13, PG12, PE17 and PE16) have 10K pullup resistors to 3v3
- The Status LED (PD18) is common with the LED_PWM pin on the DSI/LVDS output
```

View File

@ -1 +0,0 @@
6.8.0-31-mqpro-serial.gpio

View File

@ -0,0 +1,33 @@
```
MangoPI MQ Pro GPIO header (dtb name: MangoPi MQ Pro)
Gpio Header:
func des pin pin des func
3v3 1 --o o-- 2 5v
i2c0.sda (2502000.i2c:205) PG13 3 --o o-- 4 5v
i2c0.sck (2502000.i2c:204) PG12 5 --o o-- 6 gnd
free (39) PB7 7 --o o-- 8 PB8 uart0.tx (2500000.serial:40)
gnd 9 --o o-- 10 PB9 uart0.rx (2500000.serial:41)
free (117) PD21 11 --o o-- 12 PB5 i2c1.sda (2502400.i2c:37)
free (118) PD22 13 --o o-- 14 gnd
uart2.tx (2500800.serial:32) PB0 15 --o o-- 16 PB1 uart2.rx (2500800.serial:33)
3v3 17 --o o-- 18 PD14 uart3.cts (2500c00.serial:110)
free (108) PD12 19 --o o-- 20 gnd
uart3.rts (2500c00.serial:109) PD13 21 --o o-- 22 PC1 i2c2.sda (2502800.i2c:65)
uart3.rx (2500c00.serial:107) PD11 23 --o o-- 24 PD10 uart3.tx (2500c00.serial:106)
gnd 25 --o o-- 26 PD15 free (111)
i2c3.sda (2502c00.i2c:145) PE17 27 --o o-- 28 PE16 i2c3.sck (2502c00.i2c:144)
free (42) PB10 29 --o o-- 30 gnd
free (43) PB11 31 --o o-- 32 PC0 i2c2.sck (2502800.i2c:64)
free (44) PB12 33 --o o-- 34 gnd
free (38) PB6 35 --o o-- 36 PB2 uart4.tx (2501000.serial:34)
free (113) PD17 37 --o o-- 38 PB3 uart4.rx (2501000.serial:35)
gnd 39 --o o-- 40 PB4 i2c1.sck (2502400.i2c:36)
Other gpio outputs of interest:
-- PD18: Blue Status Led - gpio (2000000.pinctrl:114)
Notes:
- I2C pins 3,5,27 and 28 (PG13, PG12, PE17 and PE16) have 10K pullup resistors to 3v3
- The Status LED (PD18) is common with the LED_PWM pin on the DSI/LVDS output
```

View File

@ -1,33 +0,0 @@
```
MangoPI MQ Pro GPIO header (dtb name: MangoPi MQ Pro)
Gpio Header:
func des pin pin des func
3v3 1 --o o-- 2 5v
i2c0.sda (2502000.i2c:205) PG13 3 --o o-- 4 5v
i2c0.sck (2502000.i2c:204) PG12 5 --o o-- 6 gnd
free (39) PB7 7 --o o-- 8 PB8 uart0.tx (2500000.serial:40)
gnd 9 --o o-- 10 PB9 uart0.rx (2500000.serial:41)
free (117) PD21 11 --o o-- 12 PB5 uart5.rx (2501400.serial:37)
free (118) PD22 13 --o o-- 14 gnd
uart2.tx (2500800.serial:32) PB0 15 --o o-- 16 PB1 uart2.rx (2500800.serial:33)
3v3 17 --o o-- 18 PD14 spi1.hold (4026000.spi:110)
spi1.mosi (4026000.spi:108) PD12 19 --o o-- 20 gnd
spi1.miso (4026000.spi:109) PD13 21 --o o-- 22 PC1 i2c2.sda (2502800.i2c:65)
spi1.clk (4026000.spi:107) PD11 23 --o o-- 24 PD10 spi1.cs (4026000.spi:106)
gnd 25 --o o-- 26 PD15 spi1.wp (4026000.spi:111)
i2c3.sda (2502c00.i2c:145) PE17 27 --o o-- 28 PE16 i2c3.sck (2502c00.i2c:144)
free (42) PB10 29 --o o-- 30 gnd
free (43) PB11 31 --o o-- 32 PC0 i2c2.sck (2502800.i2c:64)
free (44) PB12 33 --o o-- 34 gnd
free (38) PB6 35 --o o-- 36 PB2 uart4.tx (2501000.serial:34)
free (113) PD17 37 --o o-- 38 PB3 uart4.rx (2501000.serial:35)
gnd 39 --o o-- 40 PB4 uart5.tx (2501400.serial:36)
Other gpio outputs of interest:
-- PD18: Blue Status Led - gpio (2000000.pinctrl:114)
Notes:
- I2C pins 3,5,27 and 28 (PG13, PG12, PE17 and PE16) have 10K pullup resistors to 3v3
- The Status LED (PD18) is common with the LED_PWM pin on the DSI/LVDS output
```

View File

@ -1 +0,0 @@
6.8.0-31-mqpro-spi.gpio

View File

@ -0,0 +1,33 @@
```
MangoPI MQ Pro GPIO header (dtb name: MangoPi MQ Pro)
Gpio Header:
func des pin pin des func
3v3 1 --o o-- 2 5v
i2c0.sda (2502000.i2c:205) PG13 3 --o o-- 4 5v
i2c0.sck (2502000.i2c:204) PG12 5 --o o-- 6 gnd
free (39) PB7 7 --o o-- 8 PB8 uart0.tx (2500000.serial:40)
gnd 9 --o o-- 10 PB9 uart0.rx (2500000.serial:41)
free (117) PD21 11 --o o-- 12 PB5 uart5.rx (2501400.serial:37)
free (118) PD22 13 --o o-- 14 gnd
uart2.tx (2500800.serial:32) PB0 15 --o o-- 16 PB1 uart2.rx (2500800.serial:33)
3v3 17 --o o-- 18 PD14 spi1.hold (4026000.spi:110)
spi1.mosi (4026000.spi:108) PD12 19 --o o-- 20 gnd
spi1.miso (4026000.spi:109) PD13 21 --o o-- 22 PC1 i2c2.sda (2502800.i2c:65)
spi1.clk (4026000.spi:107) PD11 23 --o o-- 24 PD10 spi1.cs (4026000.spi:106)
gnd 25 --o o-- 26 PD15 spi1.wp (4026000.spi:111)
i2c3.sda (2502c00.i2c:145) PE17 27 --o o-- 28 PE16 i2c3.sck (2502c00.i2c:144)
free (42) PB10 29 --o o-- 30 gnd
free (43) PB11 31 --o o-- 32 PC0 i2c2.sck (2502800.i2c:64)
free (44) PB12 33 --o o-- 34 gnd
free (38) PB6 35 --o o-- 36 PB2 uart4.tx (2501000.serial:34)
free (113) PD17 37 --o o-- 38 PB3 uart4.rx (2501000.serial:35)
gnd 39 --o o-- 40 PB4 uart5.tx (2501400.serial:36)
Other gpio outputs of interest:
-- PD18: Blue Status Led - gpio (2000000.pinctrl:114)
Notes:
- I2C pins 3,5,27 and 28 (PG13, PG12, PE17 and PE16) have 10K pullup resistors to 3v3
- The Status LED (PD18) is common with the LED_PWM pin on the DSI/LVDS output
```

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
6.8.0-31-mqpro-sunxi.gpio

View File

@ -1,2 +1 @@
# Download the sources here if desired
## Download the sources here, see [build-tree README](../build-tree/README.md).