aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2019-02-20 23:29:39 +0100
committerLubomir Rintel <lkundrak@v3.sk>2019-04-19 07:28:33 +0200
commitd11fdbc908f46805f9d7ba5d28ca273468edef14 (patch)
tree909ff30c018bf4f2ef122ab7175ae831e94727c9
parent46459c295370b0a8ebb9914fbcf9a38431473dda (diff)
downloadopenfirmware-d11fdbc908f46805f9d7ba5d28ca273468edef14.tar.gz
mmp2/clk: add AUDIO clock management
Copied over from cpu/arm/mmp2/pmua.fth.
-rw-r--r--cpu/arm/mmp2/clk.fth65
1 files changed, 65 insertions, 0 deletions
diff --git a/cpu/arm/mmp2/clk.fth b/cpu/arm/mmp2/clk.fth
index 14784385..a2250e17 100644
--- a/cpu/arm/mmp2/clk.fth
+++ b/cpu/arm/mmp2/clk.fth
@@ -65,6 +65,71 @@ h# d401.5000 encode-int encode+ h# 1000 encode-int encode+
swap io!
;
+h# 10c constant audio-clk
+
+[ifdef] mmp3
+h# 164 constant audio-dsa
+h# 1e4 constant isld-dspa-ctrl
+h# 240 constant audio-sram-pwr
+[then]
+
+\ Discrepancies - ms vs us, double-enabling of AXI
+: dly d# 10 us ;
+
+: audio-island-on ( -- )
+[ifdef] mmp3
+ h# 200 audio-clk pmua-set dly \ Power switch on
+ h# 400 audio-clk pmua-set dly \ Power switch more on
+ 1 audio-sram-pwr pmua-set dly \ Audio SRAM on
+ 2 audio-sram-pwr pmua-set dly \ Audio SRAM more on
+ 4 audio-sram-pwr pmua-set dly \ Audio core on
+ 8 audio-sram-pwr pmua-set dly \ Audio core more on
+ h# 100 audio-clk pmua-set dly \ Disable isolation
+
+ 4 audio-clk pmua-set \ Start audio SRAM redundancy repair
+ begin audio-clk pmua@ 4 and 0= until \ And wait until done
+
+ \ Bring audio island out of reset
+ 1 audio-dsa pmua-set \ Unreset AXI
+ 4 audio-dsa pmua-set \ Unreset APB
+ 1 audio-dsa pmua-set \ Unreset AXI (redundant?)
+
+ \ Enable dummy clocks to the SRAMs
+ h# 10 isld-dspa-ctrl pmua-set d# 250 us h# 10 isld-dspa-ctrl pmua-clr
+
+ \ Enable the AXI/APB clocks to the Audio island prior to programming island registers
+ 2 audio-dsa pmua-set
+ 8 audio-dsa pmua-set
+[else]
+ h# 600 audio-clk pmua! dly \ Turn on power
+ h# 610 audio-clk pmua! dly \ Enable clock
+ h# 710 audio-clk pmua! dly \ Disable isolation
+ h# 712 audio-clk pmua! dly \ Release reset
+[then]
+;
+
+: audio-island-off ( -- )
+[ifdef] true
+[ifdef] mmp3
+ h# a audio-dsa pmua-clr \ Disable AXI and APB clocks
+ h# 5 audio-dsa pmua-clr \ Put AXI and APB clocks in reset
+ h# 100 audio-clk pmua-clr \ Enable isolation
+ h# c audio-sram-pwr pmua-clr \ Audio core off
+ h# 3 audio-sram-pwr pmua-clr \ Audio SRAM off
+ h# 600 audio-clk pmua-clr \ Power switch off
+[else]
+ h# 710 audio-clk pmua! \ Set peripheral reset
+ h# 610 audio-clk pmua! \ Enable isolation
+ h# 600 audio-clk pmua! \ Disable clock
+ h# 000 audio-clk pmua! \ Turn off power
+[then]
+[then]
+ 0 audio-clk pmua!
+;
+: audio-on/off ( on? -- )
+ if audio-island-on else audio-island-off then
+;
+
[ifdef] mmp3
: ccic0-isp-island-off ( -- )
h# 600 h# 1fc pmua! \ Isolation enabled