Hello all,
over last week I was able to put old pruss_uio way operable. In recent kernels, device trees structure is changed, uio support in kernel is disabled and the new ti-sysc way of handling stuff is not implemented properly or more precisely not present in official kernel. So for all those interested, here is the solution on how to set it up:
1) Links to useful stuff, which I used so far:
https://github.com/izaakschroeder/uio_pruss - basis for the uio and uio_pruss dkms kernel modules
https://github.com/rogerq/linux/commits/for-v5.1/pruss-2.0 - github with TI patches and implementations of new DT structure and ti-sysc support
https://mirrors.edge.kernel.org/pub/linux/kernel/v5.x/ - sources archives that arch PKGBuild uses, uio and uio_pruss module sources and module.lds file
https://github.com/archlinuxarm/PKGBUILDs/blob/master/core/linux-am33x/PKGBUILD - to match uio dkms module sources for my kernel
2) What is needed to prepare:
- Install dkms and linux kernel headers via pacman
- Create /usr/lib/modules/"version"-ARCH/build/arch/arm/kernel/module.lds file with contents as in your kernel sources or from here (https://elixir.bootlin.com/linux/v5.1.12/source/arch/arm/kernel/module.lds) so you do not need to search, this file is the same in all linux releases for a long time already.
- Download attached uio_pru.zip archive with uio and uio_pruss module sources for dkms and device tree overlay, extract them into any folder of your liking (on BBB)
- change directory into your folder
3) Prepare DT overlay:
- Compile overlay using $this->bbcode_second_pass_code('', 'dtc -O dtb -o pru_uio_cape-00A0.dtbo -b 0 -@ pru_uio_cape-00A0.dts') or use it as a basis to extend your own overlay, both fragments are necessary
- Copy compiled overlay to firmware using something like $this->bbcode_second_pass_code('', 'cp pru_uio_cape-00A0.dtbo /usr/lib/firmware/')
- Modify boot.txt to load proper overlay and afterwards apply using $this->bbcode_second_pass_code('', './mkscr')
- Reboot to apply DT modifications
4) Prepare modules:
- Enter the folder containing directories with those two uio modules and pruss overlay file again
- Add modules using $this->bbcode_second_pass_code('', 'dkms add uio') and $this->bbcode_second_pass_code('', 'dkms add uio_pruss')
- Install them with $this->bbcode_second_pass_code('', 'dkms install uio/5.1.15') and $this->bbcode_second_pass_code('', 'dkms install uio_pruss/5.1.15') respectively
- Modprobe them using $this->bbcode_second_pass_code('', 'modprobe uio') and $this->bbcode_second_pass_code('', 'modprobe uio_pruss')
- Now you should see uio devices under /dev/uio0-7
- Old prussdrv based programs should work again
5) Final thoughts:
- Most important thing is the reset control that is added in pru uio overlay, it is based on rogerq git modifications for ti-sysc, otherwise PRUSS module is not initialized/powered and you will see errors in dmesg while trying to use it, something like this:
$this->bbcode_second_pass_quote('', 'U')nhandled fault: external abort on non-linefetch (0x1018) at 0xaa983000
pgd = 4d36da66
[aa983000] *pgd=9a872831, *pte=4a304303, *ppte=4a304a33