Skip to content

Instantly share code, notes, and snippets.

@fphammerle
Created September 6, 2020 10:23
Show Gist options
  • Save fphammerle/14ef54159f39b4e1a1e93c3ffa740009 to your computer and use it in GitHub Desktop.
Save fphammerle/14ef54159f39b4e1a1e93c3ffa740009 to your computer and use it in GitHub Desktop.
# https://forum.pine64.org/showthread.php?tid=1297&pid=15958#pid15958
$ fdtget --type x /boot/pine64/sun50i-a64-pine64-plus.dtb /soc@01c00000/eth@01c30000 reg
0 1c30000 0 10000 0 1c00000 0 30
# https://forum.pine64.org/showthread.php?tid=1297&pid=16138#pid16138
$ fdtget /boot/pine64/sun50i-a64-pine64-plus.dtb /aliases spi0
/soc@01c00000/spi@01c68000
$ fdtget /boot/pine64/sun50i-a64-pine64-plus.dtb /soc@01c00000/spi@01c68000 status
disabled
$ sudo fdtput --verbose --type s /boot/pine64/sun50i-a64-pine64-plus.dtb /soc@01c00000/spi@01c68000 status okay
Decoding value:
string: 'okay'
Value size 5
$ fdtget /boot/pine64/sun50i-a64-pine64-plus.dtb /soc@01c00000/spi@01c68000 status
okay
# http://synfare.com/599N105E/hwdocs/pine64/spidev.html
# https://github.com/longsleep/build-pine64-image/blob/eba2f3dc859091e54d976624e6f5043bdfc9bb73/blobs/pine64.dts#L2050
$ sudo fdtput --verbose --create /boot/pine64/sun50i-a64-pine64-plus.dtb /soc@01c00000/spi@01c68000/spidev@0
$ sudo fdtput --verbose --type s /boot/pine64/sun50i-a64-pine64-plus.dtb /soc@01c00000/spi@01c68000/spidev@0 compatible spidev
Decoding value:
string: 'spidev'
Value size 7
$ sudo fdtput --verbose --type i /boot/pine64/sun50i-a64-pine64-plus.dtb /soc@01c00000/spi@01c68000/spidev@0 reg 0
Decoding value:
int: 0
Value size 4
$ sudo fdtput --verbose --type x /boot/pine64/sun50i-a64-pine64-plus.dtb /soc@01c00000/spi@01c68000/spidev@0 spi-max-frequency 0x2faf080
Decoding value:
int: 50000000
Value size 4
$ dtc -q -I dtb -O dts /boot/pine64/sun50i-a64-pine64-plus.dtb | grep -A 21 'spi@01c68000 {'
spi@01c68000 {
#address-cells = < 0x01 >;
#size-cells = < 0x00 >;
compatible = "allwinner,sun50i-spi";
device_type = "spi0";
reg = < 0x00 0x1c68000 0x00 0x1000 >;
interrupts = < 0x00 0x41 0x04 >;
clocks = < 0x04 0x52 >;
clock-frequency = < 0x5f5e100 >;
pinctrl-names = "default\0sleep";
pinctrl-1 = < 0x55 >;
spi0_cs_number = < 0x01 >;
spi0_cs_bitmap = < 0x01 >;
status = "okay";
pinctrl-0 = < 0xa7 0xa8 >;
spidev@0 {
spi-max-frequency = < 0x2faf080 >;
reg = < 0x00 >;
compatible = "spidev";
};
};
$ sudo reboot
$ ls -la /dev/spidev0.0
crw------- 1 root root 153, 0 2020-09-06 10:36 /dev/spidev0.0
# https://github.com/longsleep/linux-pine64/issues/69
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment