[openfirmware] [commit] r3257 - cpu/arm/olpc

repository service svn at openfirmware.info
Fri Aug 31 01:28:31 CEST 2012


Author: wmb
Date: Fri Aug 31 01:28:30 2012
New Revision: 3257
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3257

Log:
OLPC ARM - Converted the nn-touchscreen driver to use the new TWSI factoring.  It now has no references to "twsi" - so it doesn't care what kind of I2C hardware implements its system interface.  There is now only one "touchscreen" device node.

Modified:
   cpu/arm/olpc/nn-touchscreen.fth
   cpu/arm/olpc/twsi-i2c.fth

Modified: cpu/arm/olpc/nn-touchscreen.fth
==============================================================================
--- cpu/arm/olpc/nn-touchscreen.fth	Fri Aug 31 01:14:17 2012	(r3256)
+++ cpu/arm/olpc/nn-touchscreen.fth	Fri Aug 31 01:28:30 2012	(r3257)
@@ -1,8 +1,19 @@
 \ See license at end of file
 purpose: Driver and diagnostic for Neonode zForce MultiSensing I2C Touchscreen
 
-0 0  " 4,50"  " /twsi" begin-package
-my-space encode-int  my-address encode-int encode+  " reg" property
+dev /i2c at d4033000
+new-device
+
+h# 50 1 reg
+
+" zforce" +compatible
+touch-rst-gpio# 1  " reset-gpios" gpio-property
+touch-tck-gpio# 1  " test-gpios"  gpio-property
+touch-hd-gpio#  1  " hd-gpios"    gpio-property
+touch-int-gpio# 1  " dr-gpios"    gpio-property
+
+: read-bytes  ( adr len -- )  " read-bytes"  $call-parent  ;
+: bytes-out  ( byte .. #bytes -- )  " bytes-out"  $call-parent  ;
 
 create nn-os            \ open short test
 create nn-fll           \ forced led levels test
@@ -50,11 +61,11 @@
 : in?  ( -- got-data? )
    no-data?  if  false exit  then
 
-   pbuf 2  twsi-read                            ( )
+   pbuf 2  read-bytes                           ( )
    pbuf 1+ c@                                   ( len )
    dup 2+ to plen                               ( len )
 
-   pbuf 2+ swap  twsi-read                      ( )
+   pbuf 2+ swap  read-bytes                     ( )
 
    pbuf 2+ c@ h# 07 =  pbuf 3 + c@ 0=  and  if  ( )
       true to configure?
@@ -80,18 +91,18 @@
 
 : read-boot-complete  ( -- )  h# 07 d# 0 anticipate  ;
 
-: initialise  ( -- )  h# 01 h# 01 h# ee  3 twsi-out  h# 01 d# 20 anticipate  ;
+: initialise  ( -- )  h# 01 h# 01 h# ee  3 bytes-out  h# 01 d# 20 anticipate  ;
 
 : set-resolution  ( -- )
    set-geometry
-   screen-h wbsplit swap  screen-w wbsplit swap  h# 02 h# 05 h# ee  7 twsi-out
+   screen-h wbsplit swap  screen-w wbsplit swap  h# 02 h# 05 h# ee  7 bytes-out
    h# 02 d# 20 anticipate
 ;
 
-: start  ( -- )  h# 04 h# 01 h# ee  3 twsi-out  ;
+: start  ( -- )  h# 04 h# 01 h# ee  3 bytes-out  ;
 
 : deactivate  ( -- )
-   h# 00 h# 01 h# ee  3 twsi-out  h# 00 d# 20 anticipate
+   h# 00 h# 01 h# ee  3 bytes-out  h# 00 d# 20 anticipate
    true to configure?
 ;
 
@@ -106,7 +117,7 @@
 
 : open  ( -- okay? )
    pbuf-alloc
-   my-unit set-twsi-target
+   my-unit " set-address" $call-parent
    set-gpios
    no-data?  if
       reset
@@ -174,7 +185,7 @@
 ;
 
 : test-version  ( -- )
-   h# 1e h# 01 h# ee  3 twsi-out
+   h# 1e h# 01 h# ee  3 bytes-out
    h# 1e d# 30 anticipate
 
    .version
@@ -334,7 +345,7 @@
 d# 48 constant /y-os
 
 : test-os-axis  ( axis -- )
-   h# 21 h# 02 h# ee  4 twsi-out
+   h# 21 h# 02 h# ee  4 bytes-out
    h# 21 d# 30 anticipate
    pbuf 2+ c@ h# 21 <> abort" bad response"
 
@@ -394,7 +405,7 @@
 d# 1 value fss-min
 
 : test-fss-axis  ( axis -- )
-   d# 64 swap h# 0f h# 03 h# ee  5 twsi-out
+   d# 64 swap h# 0f h# 03 h# ee  5 bytes-out
    h# 0f d# 20 anticipate
    pbuf 2+ c@ h# 0f <> abort" bad response"
    8sp
@@ -424,7 +435,7 @@
 
 [ifdef] nn-ls \ low signals test
 : test-ls-axis  ( axis -- )
-   h# 0d h# 02 h# ee  4 twsi-out
+   h# 0d h# 02 h# ee  4 bytes-out
    h# 0d d# 200 anticipate
    pbuf 2+ c@ h# 0d <> abort" bad response"
 
@@ -481,7 +492,7 @@
 ;
 
 : test-fll-axis  ( axis -- )
-   h# 20 h# 02 h# ee  4 twsi-out
+   h# 20 h# 02 h# ee  4 bytes-out
    h# 1c d# 200 anticipate
    pbuf plen cdump cr
    pbuf 4 + c@  2/  0  do
@@ -590,7 +601,8 @@
    close false
 ;
 
-end-package
+finish-device
+device-end
 
 \ LICENSE_BEGIN
 \ Copyright (c) 2012 FirmWorks

Modified: cpu/arm/olpc/twsi-i2c.fth
==============================================================================
--- cpu/arm/olpc/twsi-i2c.fth	Fri Aug 31 01:14:17 2012	(r3256)
+++ cpu/arm/olpc/twsi-i2c.fth	Fri Aug 31 01:28:30 2012	(r3257)
@@ -11,22 +11,11 @@
   h# d4034000 d# 31   4 true  true     4 make-twsi-node  \ TWSI6
 
 [ifdef] soon-olpc-cl2  \ this breaks cl4-a1 boards, which ofw calls cl2.
-0 0  " 30" " /i2c at d4033000" begin-package  \ TWSI4
-   " touchscreen" name
-   " raydium_ts" +compatible
-   my-address my-space 1 reg
-end-package
-[else]
 dev /i2c at d4033000  \ TWSI4
 new-device
-   h# 50 1 reg
+   h# 30 1 reg
    " touchscreen" name
-   " zforce" +compatible
-   my-address my-space 1 reg
-   touch-rst-gpio# 1  " reset-gpios" gpio-property
-   touch-tck-gpio# 1  " test-gpios"  gpio-property
-   touch-hd-gpio#  1  " hd-gpios"    gpio-property
-   touch-int-gpio# 1  " dr-gpios"    gpio-property
+   " raydium_ts" +compatible
 finish-device
 device-end
 [then]



More information about the openfirmware mailing list