From owner-freebsd-arm@freebsd.org Fri Mar 24 19:44:33 2017 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D99AD1C214 for ; Fri, 24 Mar 2017 19:44:33 +0000 (UTC) (envelope-from gonzo@bluezbox.com) Received: from id.bluezbox.com (id.bluezbox.com [45.55.20.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CF8C9CFB for ; Fri, 24 Mar 2017 19:44:32 +0000 (UTC) (envelope-from gonzo@bluezbox.com) Received: from [127.0.0.1] (helo=id.bluezbox.com) by id.bluezbox.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87 (FreeBSD)) (envelope-from ) id 1crV8S-000HGQ-1h; Fri, 24 Mar 2017 12:44:32 -0700 Received: (from gonzo@localhost) by id.bluezbox.com (8.15.2/8.15.2/Submit) id v2OJiVaN066365; Fri, 24 Mar 2017 12:44:31 -0700 (PDT) (envelope-from gonzo@bluezbox.com) X-Authentication-Warning: id.bluezbox.com: gonzo set sender to gonzo@bluezbox.com using -f Date: Fri, 24 Mar 2017 12:44:31 -0700 From: Oleksandr Tymoshenko To: Karl Denninger Cc: "freebsd-arm@freebsd.org" Subject: Re: i2c on Pi3? Message-ID: <20170324194431.GA66320@bluezbox.com> References: <0b83d41a-1a9e-28cc-6ecd-03e6a63a06a2@denninger.net> <20170323175342.GA55627@bluezbox.com> <843bbe39-0b74-0d27-598d-ae16aea52a37@denninger.net> <20170324185652.GA65910@bluezbox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD/11.0-RELEASE-p2 (amd64) User-Agent: Mutt/1.6.1 (2016-04-27) X-Spam-Level: -- X-Spam-Report: Spam detection software, running on the system "id.bluezbox.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see The administrator of that system for details. Content preview: Karl Denninger (karl@denninger.net) wrote: > On 3/24/2017 13:56, Oleksandr Tymoshenko wrote: > > Karl Denninger (karl@denninger.net) wrote: > >> On 3/23/2017 12:53, Oleksandr Tymoshenko wrote: > >>> Karl Denninger (karl@denninger.net) wrote: > >>>> On 3/23/2017 12:34, John Howie wrote: > >>>> > >>>>> Hi Karl, > >>>>> > >>>>> I can only speak to the Raspberry Pi 2 kernel, but I2C is supported. For an example how to use it from userland, check out a project I posted on github eighteen months ago, that was for the PiFace RTC. > >>>>> > >>>>> https://github.com/jhowie/FreeBSDPiFaceRTC > >>>>> > >>>>> There are useful routines I created for working with devices on the I2C bus, which you are free to use. They are not RPI2-specific, so they should work on other boards. > >>> .. skipped .. > >>>> It works on the Pi2; I am using it in production. > >>>> > >>>> The driver appears to be /missing /in the Pi3 kernel. > >>> Probably it's not enabled in DTB. Try adding this line to config.txt: > >>> > >>> dtparam=i2c_arm=on,spi=on > >>> > >> Nope, already in the base config.txt file: > >> > >> arm_control=0x200 > >> dtparam=audio=on, i2c_arm=on, spi=on > >> dtoverlay=mmc > >> dtoverlay=pi3-disable-bt > >> device_tree_address=0x4000 > >> kernel=u-boot.bin > > I just built latest HEAD, i2c driver is available in GENERIC kernel: > > # dmesg | grep iic > > iichb0: mem 0x7e804000-0x7e804fff irq 31 > > on simplebus0 > > iicbus0: on iichb0 > > random: harvesting attach, 8 bytes (4 bits) from iicbus0 > > random: harvesting attach, 8 bytes (4 bits) from iichb0 > > > > The driver itself is sys/arm/broadcom/bcm2835/bcm2835_bsc.c > > > > Could you run this command on your Pi3 and send output? Thanks > > > > sysctl -b hw.fdt.dtb | dtc -I dtb | grep -A 13 'i2c@.*{' > > > > I have a copy of Generic with a couple of tweaks in it; I DO NOT get the > iic identifiers. > > Here's what I have in the dtb; I will svn update and rebuild with > GENERIC (don't see why the tweaks would change anything, but will [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: github.com] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Mar 2017 19:44:33 -0000 Karl Denninger (karl@denninger.net) wrote: > On 3/24/2017 13:56, Oleksandr Tymoshenko wrote: > > Karl Denninger (karl@denninger.net) wrote: > >> On 3/23/2017 12:53, Oleksandr Tymoshenko wrote: > >>> Karl Denninger (karl@denninger.net) wrote: > >>>> On 3/23/2017 12:34, John Howie wrote: > >>>> > >>>>> Hi Karl, > >>>>> > >>>>> I can only speak to the Raspberry Pi 2 kernel, but I2C is supported. For an example how to use it from userland, check out a project I posted on github eighteen months ago, that was for the PiFace RTC. > >>>>> > >>>>> https://github.com/jhowie/FreeBSDPiFaceRTC > >>>>> > >>>>> There are useful routines I created for working with devices on the I2C bus, which you are free to use. They are not RPI2-specific, so they should work on other boards. > >>> .. skipped .. > >>>> It works on the Pi2; I am using it in production. > >>>> > >>>> The driver appears to be /missing /in the Pi3 kernel. > >>> Probably it's not enabled in DTB. Try adding this line to config.txt: > >>> > >>> dtparam=i2c_arm=on,spi=on > >>> > >> Nope, already in the base config.txt file: > >> > >> arm_control=0x200 > >> dtparam=audio=on,i2c_arm=on,spi=on > >> dtoverlay=mmc > >> dtoverlay=pi3-disable-bt > >> device_tree_address=0x4000 > >> kernel=u-boot.bin > > I just built latest HEAD, i2c driver is available in GENERIC kernel: > > # dmesg | grep iic > > iichb0: mem 0x7e804000-0x7e804fff irq 31 > > on simplebus0 > > iicbus0: on iichb0 > > random: harvesting attach, 8 bytes (4 bits) from iicbus0 > > random: harvesting attach, 8 bytes (4 bits) from iichb0 > > > > The driver itself is sys/arm/broadcom/bcm2835/bcm2835_bsc.c > > > > Could you run this command on your Pi3 and send output? Thanks > > > > sysctl -b hw.fdt.dtb | dtc -I dtb | grep -A 13 'i2c@.*{' > > > > I have a copy of Generic with a couple of tweaks in it; I DO NOT get the > iic identifiers. > > Here's what I have in the dtb; I will svn update and rebuild with > GENERIC (don't see why the tweaks would change anything, but will try > with GENERIC anyway and see if anything changes. Looks like DTB in your firmware is different from what I have (my is relatively old). Try applying this patch to your kernel: https://people.freebsd.org/~gonzo/arm/patches/rpi3-bcm2835-i2c.diff -- gonzo