[openfirmware] [commit] r3117 - in cpu/arm: mmp2 mmp3 olpc olpc/1.75 olpc/3.0 olpc/cl4

repository service svn at openfirmware.info
Fri Aug 3 07:23:52 CEST 2012


Author: wmb
Date: Fri Aug  3 07:23:49 2012
New Revision: 3117
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3117

Log:
OLPC CL4 - Handle differences between MMP2 and MMP3 audio subsystems.

Modified:
   cpu/arm/mmp2/hwaddrs.fth
   cpu/arm/mmp2/initmmu.fth
   cpu/arm/mmp2/rootnode.fth
   cpu/arm/mmp2/soc-config.fth
   cpu/arm/mmp3/soc-config.fth
   cpu/arm/olpc/1.75/config.fth
   cpu/arm/olpc/3.0/config.fth
   cpu/arm/olpc/addrs.fth
   cpu/arm/olpc/build-fw.fth
   cpu/arm/olpc/cl4/config.fth
   cpu/arm/olpc/cl4/fw.bth
   cpu/arm/olpc/sound.fth

Modified: cpu/arm/mmp2/hwaddrs.fth
==============================================================================
--- cpu/arm/mmp2/hwaddrs.fth	Fri Aug  3 07:21:03 2012	(r3116)
+++ cpu/arm/mmp2/hwaddrs.fth	Fri Aug  3 07:23:49 2012	(r3117)
@@ -2,15 +2,11 @@
 h# d000.0000 constant memctrl-pa
 
 h# d100.0000 constant sram-pa        \ Base of SRAM
-h# 0030.0000 constant /sram          \ Size of SRAM
 
 h# d400.0000 constant apb-pa         \ Base of APB bus
 h# d420.0000 constant axi-pa         \ Base of AXI bus
 h# f000.0000 constant axi2-pa        \ Another AXI bus area
 
-h# e000.0000 constant audio-sram-pa  \ Base of Audio SRAM
-h# 0010.0000 constant /audio-sram    \ Size of Audio SRAM
-
 apb-pa constant io-pa                \ We use this as the base for most IO accesses
 h# 0030.0000 constant /io
 

Modified: cpu/arm/mmp2/initmmu.fth
==============================================================================
--- cpu/arm/mmp2/initmmu.fth	Fri Aug  3 07:21:03 2012	(r3116)
+++ cpu/arm/mmp2/initmmu.fth	Fri Aug  3 07:23:49 2012	(r3117)
@@ -344,10 +344,12 @@
    set r3,#0xc02                        \ No caching or write buffering
    bl  `map-sections-v=p`
 
+[ifdef] /audio-sram-map
    set r1,`audio-sram-pa #`             \ Address of Audio SRAM
-   set r2,`/audio-sram #`               \ Size of audio SRAM
+   set r2,`/audio-sram-map #`           \ Map size of audio SRAM
    set r3,#0xc02                        \ No caching or write buffering
    bl  `map-sections-v=p`
+[then]
 
    set r1,`io-pa #`                     \ Address of I/O
    set r2,`/io #`                       \ Size of I/O region
@@ -361,6 +363,13 @@
    set r4,`io2-va #`                    \ Virtual address
    bl  `map-sections`
 
+[ifdef] mmp3-audio-pa
+   set r1,`mmp3-audio-pa #`             \ Address of I/O
+   set r2,`/mmp3-audio #`               \ Size of I/O region
+   set r3,#0xc02                        \ No caching or write buffering
+   set r4,`mmp3-audio-va #`             \ Virtual address
+   bl  `map-sections`
+
    mov     pc, r10
 end-code
 

Modified: cpu/arm/mmp2/rootnode.fth
==============================================================================
--- cpu/arm/mmp2/rootnode.fth	Fri Aug  3 07:21:03 2012	(r3116)
+++ cpu/arm/mmp2/rootnode.fth	Fri Aug  3 07:23:49 2012	(r3117)
@@ -36,6 +36,13 @@
       io-pa -  io-va +         ( virt )
       exit
    then                        ( phys )
+[ifdef] mmp3-audio-pa
+   dup mmp3-audio-pa u>=  if   ( phys )
+      mmp3-audio-pa -          ( offset )
+      mmp3-audio-va +          ( virt )
+      exit
+   then
+[then]
    \ Fall through to return virt == phys
 ;
 : map-out  ( virtual size -- )

Modified: cpu/arm/mmp2/soc-config.fth
==============================================================================
--- cpu/arm/mmp2/soc-config.fth	Fri Aug  3 07:21:03 2012	(r3116)
+++ cpu/arm/mmp2/soc-config.fth	Fri Aug  3 07:23:49 2012	(r3117)
@@ -1,2 +1,8 @@
 create mmp2
 h# 10000 constant l2-#sets
+
+h# e000.0000 constant audio-sram-pa   \ Base of Audio SRAM
+h#    1.0000 constant /audio-sram     \ Size of Audio SRAM
+h# 0010.0000 constant /audio-sram-map \ Mapping size of Audio SRAM
+
+h# 0030.0000 constant /sram          \ Size of SRAM

Modified: cpu/arm/mmp3/soc-config.fth
==============================================================================
--- cpu/arm/mmp3/soc-config.fth	Fri Aug  3 07:21:03 2012	(r3116)
+++ cpu/arm/mmp3/soc-config.fth	Fri Aug  3 07:23:49 2012	(r3117)
@@ -1,2 +1,11 @@
 create mmp3
 h# 20000 constant l2-#sets
+
+h# c0f0.0000 constant mmp3-audio-pa
+h#   10.0000 constant /mmp3-audio
+
+h# d103.0000 constant audio-sram-pa  \ Base of Audio SRAM
+h#    1.0000 constant /audio-sram
+\ No need to map audio-sram separately; it fits in the SRAM area
+
+h# 0040.0000 constant /sram          \ Size of SRAM

Modified: cpu/arm/olpc/1.75/config.fth
==============================================================================
--- cpu/arm/olpc/1.75/config.fth	Fri Aug  3 07:21:03 2012	(r3116)
+++ cpu/arm/olpc/1.75/config.fth	Fri Aug  3 07:23:49 2012	(r3117)
@@ -7,6 +7,7 @@
 create has-sp-kbd
 create has-dcon
 
+fload ${BP}/cpu/arm/mmp2/soc-config.fth
 fload ${BP}/cpu/arm/mmp2/hwaddrs.fth
 fload ${BP}/cpu/arm/olpc/addrs.fth
 
@@ -35,6 +36,4 @@
 \ These constants are correct for XO-1.75 and XO-CL4; they might
 \ need to be changed for different hardware.  See setup-gpios-hack
 
-fload ${BP}/cpu/arm/mmp2/soc-config.fth
-
 fload ${BP}/cpu/arm/olpc/1.75/gpiopins.fth

Modified: cpu/arm/olpc/3.0/config.fth
==============================================================================
--- cpu/arm/olpc/3.0/config.fth	Fri Aug  3 07:21:03 2012	(r3116)
+++ cpu/arm/olpc/3.0/config.fth	Fri Aug  3 07:23:49 2012	(r3117)
@@ -6,6 +6,7 @@
 create use-screen-kbd
 create use-small-font
 
+fload ${BP}/cpu/arm/mmp2/soc-config.fth
 fload ${BP}/cpu/arm/mmp2/hwaddrs.fth
 fload ${BP}/cpu/arm/olpc/addrs.fth
 
@@ -32,6 +33,4 @@
 
 h# 18000 constant console-uart-base
 
-fload ${BP}/cpu/arm/mmp2/soc-config.fth
-
 fload ${BP}/cpu/arm/olpc/3.0/gpiopins.fth

Modified: cpu/arm/olpc/addrs.fth
==============================================================================
--- cpu/arm/olpc/addrs.fth	Fri Aug  3 07:21:03 2012	(r3116)
+++ cpu/arm/olpc/addrs.fth	Fri Aug  3 07:23:49 2012	(r3117)
@@ -17,6 +17,9 @@
 h# fe00.0000 constant io-va  \ We map IO (APB + AXI) space at this virtual address
 h# fe30.0000 constant io2-va \ Mapping area for AXI2 space
 
+h# fe40.0000 constant mmp3-audio-va \ Used only if mmp3-audio-pa is defined
+: audio-sram-va  ( -- )  audio-sram-pa  ;
+
 [ifdef] virtual-mode
 h# f700.0000 constant fw-virt-base
 h# 0100.0000 constant fw-virt-size  \ 16 megs of mapping space

Modified: cpu/arm/olpc/build-fw.fth
==============================================================================
--- cpu/arm/olpc/build-fw.fth	Fri Aug  3 07:21:03 2012	(r3116)
+++ cpu/arm/olpc/build-fw.fth	Fri Aug  3 07:23:49 2012	(r3117)
@@ -841,11 +841,7 @@
 \+ use-screen-kbd  open-hotspot
 
    install-alarm
-[ifdef] olpc-cl4
-   ." build-fw.fth: not sounding" cr
-[else]
    ?sound
-[then]
 
    ?games
 
@@ -876,7 +872,7 @@
 
 \+ use-screen-kbd  ?text-on
 [ifdef] olpc-cl4
-   ." Quitting before auto-boot" cr  quit
+   ." Quitting before auto-boot" cr  visible banner  quit
 [then]
    auto-boot
 \+ use-screen-kbd  close-hotspot

Modified: cpu/arm/olpc/cl4/config.fth
==============================================================================
--- cpu/arm/olpc/cl4/config.fth	Fri Aug  3 07:21:03 2012	(r3116)
+++ cpu/arm/olpc/cl4/config.fth	Fri Aug  3 07:23:49 2012	(r3117)
@@ -7,6 +7,7 @@
 create has-sp-kbd
 create has-dcon
 
+fload ${BP}/cpu/arm/mmp3/soc-config.fth
 fload ${BP}/cpu/arm/mmp2/hwaddrs.fth
 fload ${BP}/cpu/arm/olpc/addrs.fth
 
@@ -28,6 +29,4 @@
 h# ec00 constant /ec-flash
 h# eb80 constant ec-flags-offset   \ don't program or verify this page
 
-fload ${BP}/cpu/arm/mmp3/soc-config.fth
-
 fload ${BP}/cpu/arm/olpc/cl4/gpiopins.fth

Modified: cpu/arm/olpc/cl4/fw.bth
==============================================================================
--- cpu/arm/olpc/cl4/fw.bth	Fri Aug  3 07:21:03 2012	(r3116)
+++ cpu/arm/olpc/cl4/fw.bth	Fri Aug  3 07:23:49 2012	(r3117)
@@ -12,7 +12,7 @@
 
 fload ${BP}/cpu/arm/olpc/build-fw.fth
 
-true to stand-init-debug?
+\ true to stand-init-debug?
 
 \ Setup UART configuration 
 h# d4017000 to uart-base     \ UART2

Modified: cpu/arm/olpc/sound.fth
==============================================================================
--- cpu/arm/olpc/sound.fth	Fri Aug  3 07:21:03 2012	(r3116)
+++ cpu/arm/olpc/sound.fth	Fri Aug  3 07:23:49 2012	(r3117)
@@ -1,4 +1,8 @@
+[ifdef] olpc-cl4
+0 0  " c0ffd800"  " /" begin-package
+[else]
 0 0  " d42a0800"  " /" begin-package
+[then]
 " audio" name
 my-space h# 800 reg
 
@@ -12,7 +16,14 @@
 : adma!  ( n offset -- )  adma-base + rl!  ;
 : adma@  ( offset -- n )  adma-base + rl@  ;
 
-: audio-clock!  ( -- )  h# 10c pmua!  ;
+h# 10c +pmua constant audio-clk
+[ifdef] mmp3
+h# 164 +pmua constant audio-dsa
+h# 1e4 +pmua constant isld-dspa-ctrl
+h# 240 +pmua constant audio-sram-pwr
+[then]
+
+: audio-clock!     ( -- )  audio-clk pmua!  ;
 : audio-clock-off  ( -- )
    0 h# 38 sspa!
    0 audio-clock!
@@ -31,43 +42,76 @@
    true
 ;
 
-: audio-clock-on  ( -- error? )
-   h# 600 audio-clock!  d# 10 us  \ Enable
-   h# 610 audio-clock!  d# 10 us  \ Release reset
-   h# 710 audio-clock!  d# 10 us  \ Enable
-   h# 712 audio-clock!  d# 10 us  \ Release reset
-
-[ifdef] setup-audio-pll
-   start-audio-pll  if  true exit  then
-
-   \ Bits 14:9 set the divisor from SYSCLK to BITCLK.  The setting below
-   \ is d# 8, which gives BITCLK = 1.536 MHz.  That's 32x 48000, just enough
-   \ for two (stereo) 16-bit samples.
-   \ The 80 bit is 0, choosing the AudioPLL instead of the I2SCLK
-   h#  1103 h# 34 sspa!  \ SSPA_AUD_CTRL0
-[else]
-   \ This section of the code uses I2SCLK instead of the Audio PLL.  Marvell
-   \ says that I2SCLK is prone to jitter so the Audio PLL is preferred.
+: dly  d# 10 us  ;
 
-   \  * 10 / 27 gives about 147.456
-   \ The M/N divisor gets 199.33 MHz (Figure 283 - clock tree - in Datasheet)
-   \ But the M/N divisors always have an implicit /2 (section 7.3.7 in datasheet),
-   \ so the input frequency is 99.67 with respect to NOM (sic) and DENOM.
-   \ we want 12.288 MHz SYSCLK.  99.67 * 9 / 73 = 12.2876 so 50 ppm error.
-   d# 9 d# 15 lshift d# 73 or h# d000.0000 or  h# 40 mpmu!
-
-\  The manual says that bit 5 enables I2SCLK to SSPA1, but empirically, bit 21 seems to do it
-\  h# 1024 mpmu@  h# 20 or  h# 1024 mpmu!  \ Enable 12S clock out to SSPA1
-   h# 1024 mpmu@  h# 20.0000 or  h# 1024 mpmu!  \ Enable 12S clock out to SSPA1
-
-   h# 10800 h# 38 sspa!
-
-   \ Bits 14:9 set the divisor from SYSCLK to BITCLK.  The setting below
-   \ is d# 8, which gives BITCLK = 1.536 MHz.  That's 32x 48000, just enough
-   \ for two (stereo) 16-bit samples.
-   \ The 80 bit is 1, choosing the I2SCLK instead of the AudioPLL
-   h#  1183 h# 34 sspa!  \ SSPA_AUD_CTRL0
+\ Discrepancies - ms vs us, double-enabling of AXI
+: audio-island-on  ( -- )
+[ifdef] mmp3
+   h# 200  audio-clk  io-set  dly  \ Power switch on
+   h# 400  audio-clk  io-set  dly  \ Power switch more on
+   1  audio-sram-pwr  io-set  dly  \ Audio SRAM on
+   2  audio-sram-pwr  io-set  dly  \ Audio SRAM more on
+   4  audio-sram-pwr  io-set  dly  \ Audio core on
+   8  audio-sram-pwr  io-set  dly  \ Audio core more on
+   h# 100  audio-clk  io-set  dly  \ Disable isolation
+
+   4  audio-clk io-set           \ Start audio SRAM redundancy repair
+   begin  4 audio-clk io@  4 and 0=  until  \ And wait until done
+
+   \ Bring audio island out of reset
+   1 audio-dsa io-set
+   4 audio-dsa io-set
+   1 audio-dsa io-set
+
+   \ Enable dummy clocks to the SRAMs
+   h# 10 isld-dspa-ctrl io-set  d# 250 us  h# 10 isld-dspa-ctrl io-clr
+
+   \ Enable the AXI/APB clocks to the Audio island prior to programming island registers
+   2 audio-dsa io-set
+   8 audio-dsa io-set
+[else]
+   h# 600 audio-clock!  dly  \ Enable
+   h# 610 audio-clock!  dly  \ Release reset
+   h# 710 audio-clock!  dly  \ Enable
+   h# 712 audio-clock!  dly  \ Release reset
 [then]
+;
+
+false value use-audio-pll?
+: audio-clock-on  ( -- error? )
+   audio-island-on
+
+   use-audio-pll?  if
+      start-audio-pll  if  true exit  then
+
+      \ Bits 14:9 set the divisor from SYSCLK to BITCLK.  The setting below
+      \ is d# 8, which gives BITCLK = 1.536 MHz.  That's 32x 48000, just enough
+      \ for two (stereo) 16-bit samples.
+      \ The 80 bit is 0, choosing the AudioPLL instead of the I2SCLK
+      h#  1103 h# 34 sspa!  \ SSPA_AUD_CTRL0
+   else
+      \ This section of the code uses I2SCLK instead of the Audio PLL.  Marvell
+      \ says that I2SCLK is prone to jitter so the Audio PLL is preferred.
+
+      \  * 10 / 27 gives about 147.456
+      \ The M/N divisor gets 199.33 MHz (Figure 283 - clock tree - in Datasheet)
+      \ But the M/N divisors always have an implicit /2 (section 7.3.7 in datasheet),
+      \ so the input frequency is 99.67 with respect to NOM (sic) and DENOM.
+      \ we want 12.288 MHz SYSCLK.  99.67 * 9 / 73 = 12.2876 so 50 ppm error.
+      d# 9 d# 15 lshift d# 73 or h# d000.0000 or  h# 40 mpmu!
+
+      \ The manual says that bit 5 enables I2SCLK to SSPA1, but empirically, bit 21 seems to do it
+      \ That is true on both MMP2 and MMP3
+      h# 20.0000  h# 1024 +mpmu  io-set  \ Enable 12S clock out to SSPA1
+
+      h# 10800 h# 38 sspa!
+
+      \ Bits 14:9 set the divisor from SYSCLK to BITCLK.  The setting below
+      \ is d# 8, which gives BITCLK = 1.536 MHz.  That's 32x 48000, just enough
+      \ for two (stereo) 16-bit samples.
+      \ The 80 bit is 1, choosing the I2SCLK instead of the AudioPLL
+      h#  1183 h# 34 sspa!  \ SSPA_AUD_CTRL0
+   then
    false
 ;
 
@@ -150,12 +194,11 @@
 : slave-tx  ( -- )  h# 8c sspa@  h# 8000.0001 or  h# 8c sspa!  ;  \ Slave, on
 : disable-sspa-tx  ( -- )  h# 8c sspa@  h# 8000.0004 or  h# 4.0001 invert and  h# 8c sspa!  ;
 
-h# e000.0000 constant audio-sram
 h# fc0 constant /audio-buf
-audio-sram           constant out-bufs
-audio-sram h# 1f80 + constant out-desc
-audio-sram h# 2000 + constant in-bufs
-audio-sram h# 3f80 + constant in-desc
+audio-sram-va           constant out-bufs
+audio-sram-va h# 1f80 + constant out-desc
+audio-sram-va h# 2000 + constant in-bufs
+audio-sram-va h# 3f80 + constant in-desc
 
 \ Descriptor format:
 \ Byte count
@@ -246,7 +289,7 @@
 [ifdef] cl2-a1
 fload ${BP}/cpu/arm/olpc/alc5624.fth  \ Realtek ALC5624 CODEC
 [else]
-d# 97 constant headphone-jack
+hp-plug-gpio# constant headphone-jack
 d# 96 constant external-mic
 : pin-sense?  ( gpio# -- flag )  gpio-pin@  ;
 : headphones-inserted?  ( -- flag )  headphone-jack pin-sense?  ;



More information about the openfirmware mailing list