PRU phandle is changing

40 views
Skip to first unread message

kaigeis...@googlemail.com

unread,
Jul 9, 2019, 8:10:18 PM7/9/19
to BeagleBoard
I'm writing a kernel driver that needs to control the PRUs' state using rproc_boot(...)/rproc_shutdown(...) from linux/remoteproc.h. The functions take a `struct rproc *` as argument. I tried using `rproc_get_by_phandle(...)` to get the reference to the PRUs. The problem is that the phandles are actually different from one installation to the other. E.g. after flashing a fresh image, the PRU phandles could be 0xF4 and 0xF5. The next time, after flashing the image, the phandles are 0xF6 and 0xF7. They seem, however, to remain the same, if I don't flash a new image.

- Why are the phandles different between one image and the other?
- Is there a way to fix them, such that I reliable get pointers to the PRUs with `rproc_get_by_phandle()`?
- Is there another, better way to reliably get `struct rproc *`s to the PRUs?

Thanks,
Kai

Igor Jędrzejczak

unread,
Mar 26, 2020, 6:47:16 PM3/26/20
to BeagleBoard
Hi! I'm facing the same issue... Have you found a way to get pruss running from kernel module?

Best regards
Igor

Dimitar Dimitrov

unread,
Mar 27, 2020, 2:30:23 PM3/27/20
to BeagleBoard
Which kernel version are you using? Can you post your DTS changes?

Yes, it is expected phandle to have different value for different DTBs. See https://elinux.org/Device_Tree_Mysteries#Phandle 

Personally I found it much easier to use rpmsg, which sits on top of remoteproc. The mainline example is short and easy to follow: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/samples/rpmsg/rpmsg_client_sample.c 

Yes, RPMSG it's a bit heavy, but you do get a nice RPC. Also, any necessary DTS changes are part of recent beagleboard debian images. I've published my simple driver: https://github.com/dinuxbg/beaglemic/blob/master/driver/beaglemic.c

Regards,
Dimitar
Reply all
Reply to author
Forward
0 new messages