Changeset 3255
- Timestamp:
- Aug 31, 2012 12:57:10 AM (9 months ago)
- Location:
- cpu/arm
- Files:
-
- 2 added
- 5 edited
-
mmp2/twsi-node.fth (added)
-
mmp2/twsi-package.fth (added)
-
olpc/accelerometer.fth (modified) (5 diffs)
-
olpc/prefw.fth (modified) (1 diff)
-
olpc/rtc.fth (modified) (2 diffs)
-
olpc/sound.fth (modified) (5 diffs)
-
olpc/twsi-i2c.fth (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cpu/arm/olpc/accelerometer.fth
r3183 r3255 1 hex 2 0 0 " " " /twsi" begin-package 1 dev /i2c@d4034000 \ TWSI6 2 new-device 3 3 4 " accelerometer" name 5 " lis3lv02d" +compatible 4 6 5 7 \ reg is set dynamically by probing to find which chip is present 6 \ my-address my-space encode-phys " reg" property7 8 8 9 \ This is for the stand-alone accelerometers LIS3DHTR and LIS33DETR 9 10 10 11 \ We could call this just once in open if we had a TWSI parent node 11 : acc-reg@ ( reg# -- b ) 1 1 " smbus-out-in" $call-parent ;12 : acc-reg! ( b reg# -- ) 2 0 " smbus-out-in" $call-parent ;12 : acc-reg@ ( reg# -- b ) " byte@" $call-parent ; 13 : acc-reg! ( b reg# -- ) " byte!" $call-parent ; 13 14 : ctl1! ( b -- ) h# 20 acc-reg! ; 14 15 : ctl4! ( b -- ) h# 23 acc-reg! ; … … 18 19 : acceleration@ ( -- x y z ) 19 20 begin h# 27 acc-reg@ h# 08 and until \ wait for data available 20 h# 0a8 1 6 " smbus-out-in" $call-parent ( xl xh yl yh zl zh )21 h# 0a8 1 6 " bytes-out-in" $call-parent ( xl xh yl yh zl zh ) 21 22 bwjoin wext 5 >>a ( xl xh yl yh z ) 22 23 >r ( xl xh yl yh r: z ) … … 143 144 144 145 : probe ( -- ) 145 h# 3a 6" set-address" $call-parent146 h# 1d " set-address" $call-parent 146 147 d# 25,000 " set-bus-speed" $call-parent \ XO-1.75 B1 lacks pullups SCL SDA 147 148 ['] accelerometer-on catch if … … 151 152 d# 50 to min-x d# 50 to min-y d# 50 to min-z 152 153 d# 150 to max-x d# 150 to max-y d# 450 to max-z 153 h# 19 6 encode-phys " reg" property154 h# 19 1 reg 154 155 ['] lis3dhtr-selftest to lis-selftest 155 156 else … … 160 161 d# 20 to min-x d# 20 to min-y d# 20 to min-z 161 162 d# 400 to max-x d# 400 to max-y d# 400 to max-z 162 h# 1d 6 encode-phys " reg" property163 h# 1d 1 reg 163 164 ['] lis33de-selftest to lis-selftest 164 165 then 165 166 ; 166 167 167 end-package 168 finish-device 169 device-end 168 170 169 171 stand-init: Accelerometer -
cpu/arm/olpc/prefw.fth
r3168 r3255 233 233 fload ${BP}/cpu/arm/mmp2/mfpr.fth 234 234 235 fload ${BP}/cpu/arm/mmp2/twsi-package.fth 236 235 237 \ Uninstall the diag menu from the general user interface vector 236 238 \ so exiting from emacs doesn't invoke the diag menu. -
cpu/arm/olpc/rtc.fth
r3207 r3255 1 1 purpose: Driver for external IDT1388 RTC chip on XO-1.75 2 2 3 0 0 " 68" " /i2c@d4031000" begin-package \ TWSI2 3 dev /i2c@d4031000 \ TWSI2 4 new-device 4 5 " rtc" name 5 6 " idt,idt1338-rtc" +compatible 6 my-address my-space1 reg7 h# 68 1 reg 7 8 8 9 [ifdef] cl2-a1 … … 92 93 ; 93 94 94 end-package 95 finish-device 96 device-end -
cpu/arm/olpc/sound.fth
r3238 r3255 1 0 0 " 1a" " /i2c@d4011000" begin-package \ TWSI1 1 dev /i2c@d4011000 2 new-device 2 3 " audio-codec" name 3 4 " realtek,alc5631" +compatible 4 5 " realtek,rt5631" +compatible 5 my-address my-space1 reg6 h# 1a 1 reg 6 7 " rt5631-hifi" " dai-name" string-property \ snd_soc_dai_link.codec_dai_name 7 end-package 8 : open ( -- true ) my-unit " set-address" $call-parent true ; 9 : close ( -- ) ; 10 : codec@ ( reg# -- w ) 1 2 " bytes-out-in" $call-parent swap bwjoin ; 11 : codec! ( w reg# -- ) >r wbsplit r> 3 " bytes-out" $call-parent ; 12 finish-device 13 device-end 8 14 9 15 : +audio ( offset -- address ) … … 289 295 ; 290 296 291 [ifdef] cl2-a1292 : choose-smbus ( -- ) h# 18 1 set-twsi-target ;293 [else]294 : choose-smbus ( -- ) h# 1a 1 set-twsi-target ;295 [then]296 297 297 \ Reset is unconnected on current boards 298 298 \ : audio-reset ( -- ) audio-reset-gpio# gpio-clr ; 299 299 \ : audio-unreset ( -- ) audio-reset-gpio# gpio-set ; 300 : codec@ ( reg# -- w ) choose-smbus 1 2 twsi-get swap bwjoin ; 301 : codec! ( w reg# -- ) choose-smbus >r wbsplit r> 3 twsi-out ; 300 0 value codec-ih 301 : $call-codec ( ? -- ? ) codec-ih $call-method ; 302 303 : codec@ ( reg# -- w ) " codec@" $call-codec ; 304 : codec! ( w reg# -- ) " codec!" $call-codec ; 305 302 306 : codec-i@ ( index# -- w ) h# 6a codec! h# 6c codec@ ; 303 307 : codec-i! ( w index# -- ) h# 6a codec! h# 6c codec! ; … … 636 640 0 to adma-base 0 to sspa-base 637 641 ; 642 638 643 0 value open-count 639 644 : open ( -- flag ) … … 642 647 my-unit h# 100 " map-in" $call-parent to sspa-base 643 648 audio-clock-on if (close) false exit then 649 " /audio-codec" open-dev to codec-ih 650 codec-ih 0= if (close) false exit then 644 651 init-codec 645 652 then … … 650 657 open-count 1 = if 651 658 uninstall-playback-alarm codec-off 659 codec-ih close-dev 652 660 (close) 653 661 then -
cpu/arm/olpc/twsi-i2c.fth
r3234 r3255 1 1 purpose: Device tree nodes for board-specific I2C buses implemented by TWSI hardware 2 2 3 : make-twsi-node ( baseadr clock# irq# muxed-irq? fast? unit# -- ) 4 root-device 5 new-device 6 " linux,unit#" integer-property 7 " i2c" name 8 " mrvl,mmp-twsi" +compatible ( baseadr clock# irq# muxed-irq? fast? ) 9 if 0 0 " mrvl,i2c-fast-mode" property then ( baseadr clock# irq# muxed-irq? ) 10 if 11 " /interrupt-controller/interrupt-controller@158" encode-phandle " interrupt-parent" property 12 then ( baseadr clock# irq# ) 13 " interrupts" integer-property ( baseadr clock# ) 14 " /apbc" encode-phandle rot encode-int encode+ " clocks" property 15 16 h# 1000 reg ( ) 17 1 " #address-cells" integer-property 18 1 " #size-cells" integer-property 19 " : open true ; : close ;" evaluate 20 " : encode-unit ( phys.. -- str ) push-hex (u.) pop-base ;" evaluate 21 " : decode-unit ( str -- phys.. ) push-hex $number if 0 then pop-base ;" evaluate 22 finish-device 23 device-end 24 ; 3 : make-twsi-node " ${BP}/cpu/arm/mmp2/twsi-methods.fth" included ; 25 4 26 5 \ baseadr clk irq mux? fast? unit# … … 31 10 \ h# d4038000 d# 30 3 true true N make-twsi-node \ TWSI5 32 11 h# d4034000 d# 31 4 true true 4 make-twsi-node \ TWSI6 33 34 12 35 13 [ifdef] soon-olpc-cl2 \ this breaks cl4-a1 boards, which ofw calls cl2. … … 50 28 end-package 51 29 [then] 52 53 0 0 " 19" " /i2c@d4034000" begin-package \ TWSI654 " accelerometer" name55 " lis3lv02d" +compatible56 my-address my-space 1 reg57 end-package
Note: See TracChangeset
for help on using the changeset viewer.
