User talk:Ctag

From linux-sunxi.org
Jump to navigation Jump to search

Orange Pi Zero2 SID

Tried collecting with a few methods: sunxi-fel, hexdump, devmem.

sunxi-fel

Booting the board without an SD card brings it to FEL mode. Then, with sunxi-fel v 1.4.2:

$ sudo sunxi-fel -v sid
Warning: no 'soc_sram_info' data for your SoC (id=1823)
SID registers for your SoC (id=0000) are unknown or inaccessible.

Which means the H616 isn't supported yet?

No, it is supported in the latest git version (v1.4.2-175-gfcb7865):

[berocs@bns-kharselim sunxi-tools]$ sudo ./sunxi-fel ver
AWUSBFEX soc=00001823(H616) 00000001 ver=0001 44 08 scratchpad=00007e00 00000000 00000000
[berocs@bns-kharselim sunxi-tools]$ sudo ./sunxi-fel sid
32c05000:fc004808:01454650:507e208f

The H616 user guide shows SID address as 0x0300 6000, and from the SID page the offset is 0x200, so trying again:

$ sudo sunxi-fel -v hex 0x03006200 0x20
03006200: 00 50 c0 32 08 48 00 fc 50 46 45 01 8f 20 7e 50  .P.2.H..PFE.. ~P
03006210: 00 00 00 00 18 11 24 5b 20 2b 22 bb 5d d7 75 18  ......$[ +".].u.

Success?

Armbian sunxi-sid0 driver

Booting with Armbian:

$ sudo hexdump -C /sys/bus/nvmem/devices/sunxi-sid0/nvmem 
00000000  00 50 c0 32 08 48 00 fc  50 46 45 01 8f 20 7e 50  |.P.2.H..PFE.. ~P|
00000010  00 00 00 00 18 11 24 5b  20 2b 22 bb 5d d7 75 18  |......$[ +".].u.|
00000020  65 65 64 61 66 62 13 00  7a ec 20 1e 05 05 62 02  |eedafb..z. ...b.|
00000030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000100

devmem

First, download 64 bit devmem from here: https://forum.armbian.com/topic/8988-allwinner-h5-sid/ And compile:

berocs@orangepizero2:~$ gcc devmem2-64.c -o devmem2-64
berocs@orangepizero2:~$ ls
a.out  devmem2-64  devmem2-64.c
berocs@orangepizero2:~$ ./devmem2-64 

Usage:	./devmem2-64 { address } [ type [ data ] ]
	address : memory address to act upon
	type    : access operation type : [b]yte, [h]alfword, [w]ord, [l]ong
	data    : data to be written

And then use with the commands from SID register guide, but with the H616 User Guide's address:

berocs@orangepizero2:~$ sudo ./devmem2-64 0x03006200 w
/dev/mem opened.
Memory mapped at address 0xffff924d2000.
Read at address  0x03006200 (0xffff924d2200): 0x32C05000
berocs@orangepizero2:~$ sudo ./devmem2-64 0x03006204 w
/dev/mem opened.
Memory mapped at address 0xffff9bbca000.
Read at address  0x03006204 (0xffff9bbca204): 0xFC004808
berocs@orangepizero2:~$ sudo ./devmem2-64 0x03006208 w
/dev/mem opened.
Memory mapped at address 0xffff8bb6a000.
Read at address  0x03006208 (0xffff8bb6a208): 0x01454650
berocs@orangepizero2:~$ sudo ./devmem2-64 0x0300620c w
/dev/mem opened.
Memory mapped at address 0xffff83bd0000.
Read at address  0x0300620C (0xffff83bd020c): 0x507E208F

They match!

Users on the irc channel helped me figure out that the endian-ness needed to be flipped to match the SID registers page.