PERFORCE change 111930 for review

Warner Losh imp at FreeBSD.org
Mon Dec 18 23:51:11 PST 2006


http://perforce.freebsd.org/chv.cgi?CH=111930

Change 111930 by imp at imp_lighthouse on 2006/12/19 07:50:08

	Make this bad-boy work.
	o Eliminate the I2C_DELAY.  bb driver does that so we don't need
	  to.  this doubles the performance to merely 5 times slower than
	  the twi device.
	o Don't enable pullups for this device.  Turns out that we already
	  have them on the board....
	o In setsda, use TWD rather than TWCK since SDA is for data...
	
	Submitted by:	Bernd
	The Pointy Hat for Excessive Cut and paste goes to: imp

Affected files ...

.. //depot/projects/arm/src/sys/arm/at91/at91_bbiic.c#2 edit

Differences ...

==== //depot/projects/arm/src/sys/arm/at91/at91_bbiic.c#2 (text+ko) ====

@@ -48,8 +48,6 @@
 
 #include "iicbb_if.h"
 
-#define I2C_DELAY	10
-
 #define TWD	AT91C_PIO_PA25
 #define TWCK	AT91C_PIO_PA26
 #define PIO	AT91RM92_PIOA_BASE
@@ -73,7 +71,7 @@
 
 	sc->sc_dev = dev;
 	at91_pio_use_gpio(PIO, TWD | TWCK);
-	at91_pio_gpio_output(PIO, TWD | TWCK, 1);
+	at91_pio_gpio_output(PIO, TWD | TWCK, 0);
 	at91_pio_gpio_high_z(PIO, TWD | TWCK, 1);
 	/* add generic bit-banging code */	
 	if ((sc->iicbb = device_add_child(dev, "iicbb", -1)) == NULL)
@@ -106,10 +104,9 @@
 at91_bbiic_setsda(device_t dev, char val)
 {
 	if (val)
-		at91_pio_gpio_set(PIO, TWCK);
+		at91_pio_gpio_set(PIO, TWD);
 	else
-		at91_pio_gpio_clear(PIO, TWCK);
-	DELAY(I2C_DELAY);
+		at91_pio_gpio_clear(PIO, TWD);
 }
 
 static void 
@@ -119,7 +116,6 @@
 		at91_pio_gpio_set(PIO, TWCK);
 	else
 		at91_pio_gpio_clear(PIO, TWCK);
-	DELAY(I2C_DELAY);
 }
 
 static int


More information about the p4-projects mailing list