Author: wmb Date: Thu Aug 16 22:15:40 2012 New Revision: 3183 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3183
Log: OLPC ARM - Change all uses of I2C addresses for TWSI-connected devices to use the unshifted address form.
Modified: cpu/arm/mmp2/boardtwsi.fth cpu/arm/mmp2/dsi.fth cpu/arm/mmp2/twsi.fth cpu/arm/mmp3/thunderstone/boardtwsi.fth cpu/arm/olpc/1.75/compass.fth cpu/arm/olpc/accelerometer.fth cpu/arm/olpc/nn-touchscreen.fth cpu/arm/olpc/rtc.fth cpu/arm/olpc/sound.fth
Modified: cpu/arm/mmp2/boardtwsi.fth ============================================================================== --- cpu/arm/mmp2/boardtwsi.fth Thu Aug 16 04:19:35 2012 (r3182) +++ cpu/arm/mmp2/boardtwsi.fth Thu Aug 16 22:15:40 2012 (r3183) @@ -8,7 +8,7 @@ \ 5 TC358762 MIPI bridge 16, TM-1210 or TM1414 touchscreen 40 \ 6 HDMI DDC EDID a0
-: select-touch-panel ( -- ) h# 40 5 set-twsi-target ; +: select-touch-panel ( -- ) h# 20 5 set-twsi-target ; : touch-panel-type ( -- n ) select-touch-panel h# bd twsi-b@ ; : get-tm1414-data ( -- x y finger-mask ) select-touch-panel ( ) @@ -29,7 +29,7 @@ ;
: compass@ ( -- x y z temp id ) - h# 3c 4 set-twsi-target + h# 1e 4 set-twsi-target 0 0 twsi-b! \ Config register A h# 50 1 twsi-b! \ Config register B 0 2 twsi-b! \ Mode register @@ -40,7 +40,7 @@ h# a twsi-b@ 9 twsi-b@ bwjoin ( x y z temp id ) ;
-: select-pmic ( -- ) h# 78 1 set-twsi-target ; +: select-pmic ( -- ) h# 3c 1 set-twsi-target ;
: accel-power-on ( -- ) \ LDO8 - vout is 36, ctl is 34 select-pmic @@ -52,7 +52,7 @@ h# 1e h# 34 twsi-b! ; : accel@ ( -- x y z temp id ) - h# 70 4 set-twsi-target + h# 38 4 set-twsi-target
2 twsi-b@ 6 rshift ( x-low ) 3 twsi-b@ 2 lshift or ( x ) @@ -67,24 +67,24 @@ ;
: init-pals ( -- ) - h# b0 4 set-twsi-target \ Set PS parameters address + h# 58 4 set-twsi-target \ Set PS parameters address 0 1 twsi-out \ clear interrupt settings
- h# 22 4 set-twsi-target \ Device init address + h# 11 4 set-twsi-target \ Device init address h# 10 1 twsi-out \ Init device
- h# 20 4 set-twsi-target \ Ambient Light Sensor address + h# 10 4 set-twsi-target \ Ambient Light Sensor address 2 1 twsi-out \ Enable ALS in most sensitive mode, 16-bit data ; : als@ ( -- n ) - h# 22 4 set-twsi-target \ Ambient Light Sensor LSB address + h# 11 4 set-twsi-target \ Ambient Light Sensor LSB address 0 1 twsi-get ( low ) - h# 20 4 set-twsi-target \ Ambient Light Sensor MSB address + h# 10 4 set-twsi-target \ Ambient Light Sensor MSB address 0 1 twsi-get bwjoin ( n ) ;
: proximity@ ( -- byte ) - h# b0 4 set-twsi-target \ Proximity Sensor address + h# 58 4 set-twsi-target \ Proximity Sensor address 0 1 twsi-get ( byte ) ;
@@ -128,7 +128,7 @@ ; : twsi-bcd@ ( reg# -- binary ) twsi-b@ bcd> ; : get-rtc ( -- ) - h# d0 1 set-twsi-target + h# 68 1 set-twsi-target
\ 3 twsi-b@ ( dow ) \ @@ -142,7 +142,7 @@ ;
: core-voltage! ( mv -- ) - h# c0 1 set-twsi-target \ MAX8649 power management IC + h# 60 1 set-twsi-target \ MAX8649 power management IC
d# 750 umax d# 1350 umin \ Clipped voltage d# 750 - d# 10 / ( offset-in-mv/10 ) @@ -150,7 +150,7 @@ 2 twsi-b! ; : core-voltage@ ( -- mv ) - h# c0 1 set-twsi-target \ MAX8649 power management IC + h# 60 1 set-twsi-target \ MAX8649 power management IC 2 twsi-b@ ( code ) h# 7f and ( offset-mv/10 ) d# 10 * ( offset-mv )
Modified: cpu/arm/mmp2/dsi.fth ============================================================================== --- cpu/arm/mmp2/dsi.fth Thu Aug 16 04:19:35 2012 (r3182) +++ cpu/arm/mmp2/dsi.fth Thu Aug 16 22:15:40 2012 (r3183) @@ -45,7 +45,7 @@ 2 ms d# 83 gpio-clr 1 ms d# 83 gpio-set 1 ms \ LCD_RST_N line resets DSI bridge
- h# 16 5 set-twsi-target \ TWSI address of TC358762 MIPI DSI bridge + h# 0b 5 set-twsi-target \ TWSI address of TC358762 MIPI DSI bridge \ Data Reg#....... 0 h# 047c dsi-twsi! \ Turn off sleep mode 2 ms @@ -142,7 +142,7 @@ : .dsi ( index -- ) dup 3 u.r space dsi-twsi@ 8 u.r cr ; : .dsiw ( index -- ) dup 3 u.r space dsi-twsi-w@ 8 u.r cr ; : dump-dsi ( -- ) - 16 5 set-twsi-target + 0b 5 set-twsi-target 47c .dsi 210 .dsi 470 .dsi
Modified: cpu/arm/mmp2/twsi.fth ============================================================================== --- cpu/arm/mmp2/twsi.fth Thu Aug 16 04:19:35 2012 (r3182) +++ cpu/arm/mmp2/twsi.fth Thu Aug 16 22:15:40 2012 (r3183) @@ -42,7 +42,7 @@ ; : set-twsi-target ( slave channel -- ) \ Channel numbers range from 1 to 6 set-twsi-channel - to slave-address + 2* to slave-address ;
\ Bit defines @@ -195,7 +195,7 @@ h# d4034000 d# 31 4 true true 1 make-twsi-node \ TWSI6
-0 0 " 34" " /i2c@d4011000" begin-package \ TWSI1 +0 0 " 1a" " /i2c@d4011000" begin-package \ TWSI1 " audio-codec" name " realtek,alc5631" +compatible " realtek,rt5631" +compatible
Modified: cpu/arm/mmp3/thunderstone/boardtwsi.fth ============================================================================== --- cpu/arm/mmp3/thunderstone/boardtwsi.fth Thu Aug 16 04:19:35 2012 (r3182) +++ cpu/arm/mmp3/thunderstone/boardtwsi.fth Thu Aug 16 22:15:40 2012 (r3183) @@ -8,7 +8,7 @@ \ 5 TC358762 MIPI bridge 16, TM-1210 or TM1414 touchscreen 40 \ 6 HDMI DDC EDID a0
-: select-touch-panel ( -- ) h# 40 5 set-twsi-target ; +: select-touch-panel ( -- ) h# 20 5 set-twsi-target ; : touch-panel-type ( -- n ) select-touch-panel h# bd twsi-b@ ; : get-tm1414-data ( -- x y finger-mask ) select-touch-panel ( ) @@ -29,7 +29,7 @@ ;
: compass@ ( -- x y z temp id ) - h# 3c 4 set-twsi-target + h# 1e 4 set-twsi-target 0 0 twsi-b! \ Config register A h# 50 1 twsi-b! \ Config register B 0 2 twsi-b! \ Mode register @@ -40,7 +40,7 @@ h# a twsi-b@ 9 twsi-b@ bwjoin ( x y z temp id ) ;
-: select-pmic ( -- ) h# 78 1 set-twsi-target ; +: select-pmic ( -- ) h# 3c 1 set-twsi-target ;
: accel-power-on ( -- ) \ LDO8 - vout is 36, ctl is 34 select-pmic @@ -52,7 +52,7 @@ h# 1e h# 34 twsi-b! ; : accel@ ( -- x y z temp id ) - h# 70 4 set-twsi-target + h# 38 4 set-twsi-target
2 twsi-b@ 6 rshift ( x-low ) 3 twsi-b@ 2 lshift or ( x ) @@ -67,24 +67,24 @@ ;
: init-pals ( -- ) - h# b0 4 set-twsi-target \ Set PS parameters address + h# 58 4 set-twsi-target \ Set PS parameters address 0 1 twsi-out \ clear interrupt settings
- h# 22 4 set-twsi-target \ Device init address + h# 11 4 set-twsi-target \ Device init address h# 10 1 twsi-out \ Init device
- h# 20 4 set-twsi-target \ Ambient Light Sensor address + h# 10 4 set-twsi-target \ Ambient Light Sensor address 2 1 twsi-out \ Enable ALS in most sensitive mode, 16-bit data ; : als@ ( -- n ) - h# 22 4 set-twsi-target \ Ambient Light Sensor LSB address + h# 11 4 set-twsi-target \ Ambient Light Sensor LSB address 0 1 twsi-get ( low ) - h# 20 4 set-twsi-target \ Ambient Light Sensor MSB address + h# 10 4 set-twsi-target \ Ambient Light Sensor MSB address 0 1 twsi-get bwjoin ( n ) ;
: proximity@ ( -- byte ) - h# b0 4 set-twsi-target \ Proximity Sensor address + h# 58 4 set-twsi-target \ Proximity Sensor address 0 1 twsi-get ( byte ) ;
@@ -128,7 +128,7 @@ ; : twsi-bcd@ ( reg# -- binary ) twsi-b@ bcd> ; : get-rtc ( -- ) - h# d0 1 set-twsi-target + h# 68 1 set-twsi-target
\ 3 twsi-b@ ( dow ) \ @@ -142,7 +142,7 @@ ;
: core-voltage! ( mv -- ) - h# c0 1 set-twsi-target \ MAX8649 power management IC + h# 60 1 set-twsi-target \ MAX8649 power management IC
d# 750 umax d# 1350 umin \ Clipped voltage d# 750 - d# 10 / ( offset-in-mv/10 ) @@ -150,7 +150,7 @@ 2 twsi-b! ; : core-voltage@ ( -- mv ) - h# c0 1 set-twsi-target \ MAX8649 power management IC + h# 60 1 set-twsi-target \ MAX8649 power management IC 2 twsi-b@ ( code ) h# 7f and ( offset-mv/10 ) d# 10 * ( offset-mv )
Modified: cpu/arm/olpc/1.75/compass.fth ============================================================================== --- cpu/arm/olpc/1.75/compass.fth Thu Aug 16 04:19:35 2012 (r3182) +++ cpu/arm/olpc/1.75/compass.fth Thu Aug 16 22:15:40 2012 (r3183) @@ -4,7 +4,7 @@ : set-compass-slave ( -- ) compass-scl-gpio# to smb-clock-gpio# compass-sda-gpio# to smb-data-gpio# - h# 3c to smb-slave + h# 1e to smb-slave smb-data-gpio# gpio-dir-out ; : smb-init ( -- ) set-compass-slave smb-on smb-pulses ; @@ -35,11 +35,11 @@ 0 0 " " " /" begin-package " combo-accelerometer" name
-\ : set-sensor-slave ( -- ) h# 30 6 set-twsi-target ; +\ : set-sensor-slave ( -- ) h# 18 6 set-twsi-target ; : set-sensor-slave ( -- ) 4 to smb-clock-gpio# 5 to smb-data-gpio# - h# 30 to smb-slave + h# 18 to smb-slave smb-data-gpio# gpio-dir-out ;
Modified: cpu/arm/olpc/accelerometer.fth ============================================================================== --- cpu/arm/olpc/accelerometer.fth Thu Aug 16 04:19:35 2012 (r3182) +++ cpu/arm/olpc/accelerometer.fth Thu Aug 16 22:15:40 2012 (r3183) @@ -2,6 +2,7 @@ 0 0 " " " /twsi" begin-package " accelerometer" name
+\ reg is set dynamically by probing to find which chip is present \ my-address my-space encode-phys " reg" property
\ This is for the stand-alone accelerometers LIS3DHTR and LIS33DETR @@ -149,7 +150,7 @@ d# 400,000 to bus-speed d# 50 to min-x d# 50 to min-y d# 50 to min-z d# 150 to max-x d# 150 to max-y d# 450 to max-z - h# 32 6 encode-phys " reg" property + h# 19 6 encode-phys " reg" property ['] lis3dhtr-selftest to lis-selftest else accelerometer-off @@ -158,7 +159,7 @@ d# 25,000 to bus-speed d# 20 to min-x d# 20 to min-y d# 20 to min-z d# 400 to max-x d# 400 to max-y d# 400 to max-z - h# 3a 6 encode-phys " reg" property + h# 1d 6 encode-phys " reg" property ['] lis33de-selftest to lis-selftest then ;
Modified: cpu/arm/olpc/nn-touchscreen.fth ============================================================================== --- cpu/arm/olpc/nn-touchscreen.fth Thu Aug 16 04:19:35 2012 (r3182) +++ cpu/arm/olpc/nn-touchscreen.fth Thu Aug 16 22:15:40 2012 (r3183) @@ -1,7 +1,7 @@ \ See license at end of file purpose: Driver and diagnostic for Neonode zForce MultiSensing I2C Touchscreen
-0 0 " 4,a0" " /twsi" begin-package +0 0 " 4,50" " /twsi" begin-package my-space encode-int my-address encode-int encode+ " reg" property
\ XXX these are really platform-related, not touchscreen-related
Modified: cpu/arm/olpc/rtc.fth ============================================================================== --- cpu/arm/olpc/rtc.fth Thu Aug 16 04:19:35 2012 (r3182) +++ cpu/arm/olpc/rtc.fth Thu Aug 16 22:15:40 2012 (r3183) @@ -22,7 +22,7 @@ : rtc@ ( reg# -- byte ) set-address smb-byte@ ; : rtc! ( byte reg# -- ) set-address smb-byte! ; [else] -: set-address ( -- ) h# d0 2 set-twsi-target ; +: set-address ( -- ) h# 68 2 set-twsi-target ; : rtc@ ( reg# -- byte ) set-address twsi-b@ ; : rtc! ( byte reg# -- ) set-address twsi-b! ; [then]
Modified: cpu/arm/olpc/sound.fth ============================================================================== --- cpu/arm/olpc/sound.fth Thu Aug 16 04:19:35 2012 (r3182) +++ cpu/arm/olpc/sound.fth Thu Aug 16 22:15:40 2012 (r3183) @@ -264,9 +264,9 @@ ;
[ifdef] cl2-a1 -: choose-smbus ( -- ) h# 30 1 set-twsi-target ; +: choose-smbus ( -- ) h# 18 1 set-twsi-target ; [else] -: choose-smbus ( -- ) h# 34 1 set-twsi-target ; +: choose-smbus ( -- ) h# 1a 1 set-twsi-target ; [then]
\ Reset is unconnected on current boards
openfirmware@openfirmware.info