From owner-freebsd-arm@FreeBSD.ORG Sat May 3 01:57:23 2014 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 18A19247 for ; Sat, 3 May 2014 01:57:23 +0000 (UTC) Received: from mail-ee0-x233.google.com (mail-ee0-x233.google.com [IPv6:2a00:1450:4013:c00::233]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9DE98130C for ; Sat, 3 May 2014 01:57:22 +0000 (UTC) Received: by mail-ee0-f51.google.com with SMTP id c13so3585001eek.38 for ; Fri, 02 May 2014 18:57:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=B4ezrRGSPoS4Upzw1eO0QacoaBN7rRcX5xgHnLX1R9s=; b=LQoA1RH6nveBSOUOjmb3wb9gS66jZyb/WR9bKKV2ZvmiSV4k5+aVVy/pJpBL6t9HuY kLh7wZ9inOGTq2mpCAjEgzqb9BMc7cC9TWiWNODT0ZnyaPmMuu0Z+GdyPGKa1vsIZT4i Xjxq9gWPfcb8UPG1r/GLC5kmJ/r+K2WWn/ojyWjhGwpJIXCyJgwDMbiNexzqNC7tpf2x Eh5cA+FipkLzbwgNJjIqLP3pIQ1+K6zuFU8rZfG9BSO84cL0d70nrYx46XxX/DfPjGik NDiknkJOm9FgIiDUb2TLC4npM/E9mrHtZ67C3ApAcQw0/6Epz/kTwhPitkzTriRv3Spc kVoA== X-Received: by 10.15.42.138 with SMTP id u10mr18123590eev.7.1399082240159; Fri, 02 May 2014 18:57:20 -0700 (PDT) Received: from ketas-laptop.mydomain (ketas-laptop6.si.pri.ee. [2001:ad0:91f:0:21a:6bff:fe66:2ad3]) by mx.google.com with ESMTPSA id w1sm8933183eel.16.2014.05.02.18.57.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 02 May 2014 18:57:19 -0700 (PDT) Sender: Sulev-Madis Silber Message-ID: <53644CF7.8050800@hot.ee> Date: Sat, 03 May 2014 04:57:11 +0300 From: "Sulev-Madis Silber (ketas)" User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:15.0) Gecko/20120912 Thunderbird/15.0.1 MIME-Version: 1.0 To: Winston Smith Subject: Re: BBB/I2C: Read PMIC data References: <53633440.3070702@hot.ee> In-Reply-To: X-TagToolbar-Keys: D20140503045710101 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: FreeBSD ARM X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list 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 01:57:23 -0000 On 2014-05-02 23:46, 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 > > > Let me know if there is any more data you want from the PMIC. > > -W > Oh, awesome! Now I think I know why I didn't get correct results... I would also like to share something, it's a script I use to upgrade my BBB: http://ketas.si.pri.ee/bbb-hotinstaller.sh BTW, you could consider adding such small files as attachments, so they will not disappear somewhere.