From owner-p4-projects@FreeBSD.ORG Tue Dec 19 07:51:11 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D5C9416A416; Tue, 19 Dec 2006 07:51:10 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 995B116A40F for ; Tue, 19 Dec 2006 07:51:10 +0000 (UTC) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.FreeBSD.org (Postfix) with ESMTP id 59EB543CA3 for ; Tue, 19 Dec 2006 07:51:10 +0000 (GMT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id kBJ7p4aZ057295 for ; Tue, 19 Dec 2006 07:51:05 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id kBJ7p4Tk057283 for perforce@freebsd.org; Tue, 19 Dec 2006 07:51:04 GMT (envelope-from imp@freebsd.org) Date: Tue, 19 Dec 2006 07:51:04 GMT Message-Id: <200612190751.kBJ7p4Tk057283@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Cc: Subject: PERFORCE change 111930 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Dec 2006 07:51:11 -0000 http://perforce.freebsd.org/chv.cgi?CH=111930 Change 111930 by imp@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