From owner-freebsd-arm@FreeBSD.ORG Sat May 3 00:10:13 2014 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 28532477 for ; Sat, 3 May 2014 00:10:13 +0000 (UTC) Received: from raven.bwct.de (raven.bwct.de [85.159.14.73]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "raven.bwct.de", Issuer "BWCT" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id C4CDA1ABD for ; Sat, 3 May 2014 00:10:12 +0000 (UTC) Received: from mail.cicely.de ([10.1.1.37]) by raven.bwct.de (8.13.4/8.13.4) with ESMTP id s430A0bX027741 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Sat, 3 May 2014 02:10:00 +0200 (CEST) (envelope-from ticso@cicely7.cicely.de) Received: from cicely7.cicely.de (cicely7.cicely.de [10.1.1.9]) by mail.cicely.de (8.14.5/8.14.4) with ESMTP id s4309mmH089301 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 3 May 2014 02:09:48 +0200 (CEST) (envelope-from ticso@cicely7.cicely.de) Received: from cicely7.cicely.de (localhost [127.0.0.1]) by cicely7.cicely.de (8.14.2/8.14.2) with ESMTP id s4309mTG061179; Sat, 3 May 2014 02:09:48 +0200 (CEST) (envelope-from ticso@cicely7.cicely.de) Received: (from ticso@localhost) by cicely7.cicely.de (8.14.2/8.14.2/Submit) id s4309l5D061178; Sat, 3 May 2014 02:09:47 +0200 (CEST) (envelope-from ticso) Date: Sat, 3 May 2014 02:09:46 +0200 From: Bernd Walter To: Winston Smith Subject: Re: BBB/I2C: Read PMIC data Message-ID: <20140503000946.GK52252@cicely7.cicely.de> References: <53633440.3070702@hot.ee> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD cicely7.cicely.de 7.0-STABLE i386 User-Agent: Mutt/1.5.11 X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED=-1, BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 autolearn=unavailable version=3.3.0 X-Spam-Checker-Version: SpamAssassin 3.3.0 (2010-01-18) on spamd.cicely.de Cc: FreeBSD ARM X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list Reply-To: ticso@cicely.de List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 May 2014 00:10:13 -0000 On Fri, May 02, 2014 at 04:46:02PM -0400, Winston Smith wrote: > On Fri, May 2, 2014 at 11:30 AM, Warner Losh wrote: > > Only if the kernel is actively accessing them so your transactions are messed up. > > In the kernel, all the bridge knows about is transactions of one flavor or another. > > This may indicate a more fundamental issue going on, either in your belief that > > it is at 24, or in the address (which is 7 bits) gets translated to 8 bits. Try a left > > shift 1 bit. > > Alright, figured it out. The "dummy" write that precedes the read is > not a dummy, you're sending a command to the I2C device. For a > EEPROM, you send it a 2 byte address of where to read. For the PMIC, > you need to send it a *1-byte* register ID! > > I've updated the tool and renamed it `bbb_sysutil.c`: > > http://pastebin.com/NhMy9D7d > > Here's the output (still working on the "interrupt storm" issue!): > > root@beaglebone:~ # ./bbb_sysutil > TPS65217 PMIC @ address 24: > ChipID: E2 TPS65217C rev 1.2 > Status: 08 ACPWR > interrupt storm detected on "intr70:"; throttling interrupt source > EEPROM @ address 50: signature=AA:55:33:EE > Model: A335BNLT0A6A > Serial: 0214BBBK4321 So you get valid data. Sounds like the interupt handler is working for what it needs, but not closing an interrupt down. Since most part of acknowleging an interrupt to the hardware is the same for all interrupt sources I expect the IIC controller isn't made aware that an interrupt was processed. One wild guess - without knowing the Sitara IIC controller at all: You write and read in one transaction, the controller may issue an interrupt on read and write, but only the read is handled, so the write interrupt stays active. It could also bee that the controler signals other states, which are unhandled - e.g. addressed device acknowledge. Just read in the datasheet what kind of interrupts it can send. Usually it is a flag register. Read and printf it in the int service and check if one of the signalled interrupts is unhandled. Some interrupt sources might need manual shutdown, while others do not - e.g. data ready is often automatically done when reading the data register and other need to be cleared by writing into a register. > Let me know if there is any more data you want from the PMIC. > > -W > _______________________________________________ > freebsd-arm@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-arm > To unsubscribe, send any mail to "freebsd-arm-unsubscribe@freebsd.org" -- B.Walter http://www.bwct.de Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.