I am trying to enable the PRU from userspace, just to run some butt
simple tests, with no luck so far. I wrote a really simple shell
script to do this (see it pasted below).
My thought is this, please correct me if you see anything wrong. I
need to do these things:
* Enable the PRUSS clock in CM_PER_PRUSS_CLKCTRL
* Enable power to the PRUSS in PM_PER_PWRSTCTRL
* Take the PRUSS out of reset in RM_PER_PWRRSTCTRL
I don't think I should have to mess with the PLL configuration
because, if I read the AM335x TRM correction, table 4-2 says that it
needs:
* an interface clock, which is CORE_CLKOUTM4, which must already be
running or the system wouldn't be
* a functional clock, which is also CORE_CLKOUTM4
* A uart clock, which is from PER_CLKOUTM2, which I don't care about
right now.
I'm trying to verify that it's there by just reading the REVID
register out of the PRUSS_CFG block, offset 0. The address of that is
PRUSS base + PRUSS_CFG offset + REVID offset = 0x43A00000 +
0x00026000 + 0x00000000
I'm getting bus errors, so I'm obviously missing something. My
assumption was that to be able to read REVID, I would need to have the
PRUSS enabled and the interface clocks up so I could talk to it
through the L4 interconnect. I also took the subsystem out of reset,
but I'm not 100% sure that's even necessary based on the source code
patches that supposedly get uio_pruss.ko up and running.
What am I missing?
(script below)
--Chris
#!/bin/sh
set -e
CM_PER=0x44E00000
CM_PER_PRUSS_CLKCTRL=$(( $CM_PER + 0xE0 ))
PRM_PER=0x44E00C00
RM_PER_PWRRSTCTRL=$(( $PRM_PER + 0x00 ))
PM_PER_PWRSTST=$(( $PRM_PER + 0x08 ))
PM_PER_PWRSTCTRL=$(( $PRM_PER + 0x0C ))
write32() {
printf '\tWRITING 0x%08x : 0x%08x\n' $1 $2
devmem2 $1 w $2 | grep -v mapped | grep -v opened
}
read32() {
printf '\tREADING 0x%08x\n' $1
devmem2 $1 w
}
echo
echo "Enabling PRU clock"
write32 ${CM_PER_PRUSS_CLKCTRL} 0x00000004
echo
echo "Enabling PRU power"
write32 ${PM_PER_PWRSTCTRL} 0x660000E3
echo
echo "Taking PRU out of reset"
write32 ${RM_PER_PWRRSTCTRL} 0x00000000
echo
echo "Trying to read some data"
# This should show the revision ID of the PRU
read32 0x4a326000