From owner-freebsd-arm@freebsd.org Mon Jan 7 20:10:50 2019 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F6B7149E0D7 for ; Mon, 7 Jan 2019 20:10:50 +0000 (UTC) (envelope-from ronald-lists@klop.ws) Received: from smarthost1.greenhost.nl (smarthost1.greenhost.nl [195.190.28.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B67C976EE9 for ; Mon, 7 Jan 2019 20:10:48 +0000 (UTC) (envelope-from ronald-lists@klop.ws) Received: from smtp.greenhost.nl ([213.108.110.112]) by smarthost1.greenhost.nl with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1ggbEN-00088y-I4; Mon, 07 Jan 2019 21:10:39 +0100 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "Emmanuel Vadot" , "Per Hedeland" Cc: freebsd-arm@freebsd.org Subject: Re: i2c on RPi Zero? References: <229e0d36-a07b-8551-9613-0bf5748352e7@hedeland.org> <20190105195808.GA53872@bluezbox.com> <20190105215608.GA55315@bluezbox.com> <20190105230306.2ad9d0ba2c2df0e8fac5f053@bidouilliste.com> Date: Mon, 07 Jan 2019 21:10:43 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: "Ronald Klop" Message-ID: In-Reply-To: User-Agent: Opera Mail/12.16 (FreeBSD) X-Authenticated-As-Hash: 398f5522cb258ce43cb679602f8cfe8b62a256d1 X-Virus-Scanned: by clamav at smarthost1.samage.net X-Spam-Level: / X-Spam-Score: -0.2 X-Spam-Status: No, score=-0.2 required=5.0 tests=ALL_TRUSTED, BAYES_50 autolearn=disabled version=3.4.2 X-Scan-Signature: 10fb2eeb1e6a32429c7ce102d6ec6cdf X-Rspamd-Queue-Id: B67C976EE9 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of ronald-lists@klop.ws designates 195.190.28.88 as permitted sender) smtp.mailfrom=ronald-lists@klop.ws X-Spamd-Result: default: False [0.84 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.22)[-0.222,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+ip4:195.190.28.64/27]; NEURAL_HAM_LONG(-0.47)[-0.470,0]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[klop.ws]; TO_DN_SOME(0.00)[]; NEURAL_SPAM_SHORT(0.34)[0.336,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MX_GOOD(-0.01)[mx2.greenhost.nl,mx1.greenhost.nl]; IP_SCORE(0.00)[country: NL(0.02)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; SUBJECT_ENDS_QUESTION(1.00)[]; ASN(0.00)[asn:47172, ipnet:195.190.28.0/24, country:NL]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jan 2019 20:10:50 -0000 On Sun, 06 Jan 2019 00:39:48 +0100, Per Hedeland wrote: > On 2019-01-05 23:03, Emmanuel Vadot wrote: >> On Sat, 5 Jan 2019 13:56:08 -0800 >> Oleksandr Tymoshenko wrote: >> >>> Per Hedeland (per@hedeland.org) wrote: >>>> On 2019-01-05 20:58, Oleksandr Tymoshenko wrote: >>>>> Per Hedeland (per@hedeland.org) wrote: >>>>>> I did a bit more testing on the Zero to see if the FreeBSD version >>>>>> mattered: >>>>>> >>>>>> FreeBSD-12.0-STABLE-arm-armv6-RPI-B-20190103-r342709.img - still no >>>>>> luck. >>>>>> >>>>>> FreeBSD-11.2-STABLE-arm-armv6-RPI-B-20190103-r342709.img - works! >>>>>> (I.e. dmesg reports as below and /dev/iic{0,1} get created - I >>>>>> haven't >>>>>> tested actual usage beyond having 'i2c -s' report "no devices >>>>>> found".) >>>>>> >>>>>> I guess that the i2c support hasn't been removed intentionally, >>>>>> i.e. this seems to be a regression - or is there some additional >>>>>> config etc required to enable it with FreeBSD-12? The iic and iicbus >>>>>> drivers appear to be built into the kernel in both 11 and 12. >>>>>> >>>>>> (I haven't tested FreeBSD-12 on the Pi B, but I would guess that the >>>>>> result will be the same as on the Zero, since it seems the hardware >>>>>> is >>>>>> the same.) >>>>> >>>>> There was a transition in device tree files between 11 and 12. >>>>> bcm2708-rpi-0-w.dtb has i2c nodes but they're disabled by default. >>>>> Try editing config.txt on FAT partition and adding following line: >>>>> >>>>> dtparam=i2c >>>>> >>>>> This should make boot firmware to enable device nodes in the device >>>>> tree blob during the boot. >>>> >>>> Thanks a lot! I can confirm that this makes i2c "work" on Zero with >>>> 12-RELEASE (almost) to the extent described above for 11.2-STABLE (it >>>> detects/creates only iic0, not iic1, but as far as I understand from >>>> other sources, iic0 is all that is needed for "plain B" and thus also >>>> for Zero). >>>> >>>> Should I file a PR for this? I assume that the i2c nodes being >>>> disabled is not intentional... >>> >>> Yes, please do. There are also other devices, that should be enabled by >>> default, like SPI. >> Why should we enabled them by default ? >> We have no correct way for switching a pin to gpio mode (you can do >> that with gpioctl on some system but I consider it as a bug) so if I >> want to use the i2c/spi/whatever pins as gpio and the default image set >> it to another function I'm stuck. >> Using the rpi fundation dtb means that every settings that they set >> for Linux will also be set for us, so every tutorial on the web where >> people saying that you should set something in config.txt will apply to >> FreeBSD too. >> The current settings aren't a bug, it's a feature (c). > > OK... - so your take seems to be that FreeBSD users should google for > the "Linux way" to (e.g.) enable i2c on RPi. I googled "enable i2c on > raspberry pi" now, and indeed it brought up lots of Linux stuff, but > unfortunately it mostly says to run 'raspi-config', which I can't find > on my FreeBSD installation (and didn't actually expect to, of course). > > If I explicitly add "config.txt" to the search string, I do indeed > find some info about what to put in that file - but of course I > wouldn't have done that if I didn't already know that this was the > file that needed to be edited... > > I'm all for using "standard" components (even when "standard" means > "Linux"), and reducing the amount of FreeBSD-specific work that you > and others need to put in to support FreeBSD on these "odd" systems - > and as a long time (Free)BSD user, I actually prefer to edit a file > over running some GUI tool without knowing what it does. > > But I really think there needs to be a bit more help directed > specifically at the FreeBSD user here (if there is and I just haven't > found it, please enlighten me). A few words (besides "configuration > for start.elf":-) about what config.txt is good for, and perhaps a > pointer to e.g. > https://www.raspberrypi.org/documentation/configuration/device-tree.md > (found it from your hints, thanks!), on the > https://wiki.freebsd.org/FreeBSD/arm/Raspberry%20Pi page may be > enough. I added this to the wiki. https://wiki.freebsd.org/action/info/FreeBSD/arm/Raspberry%20Pi?action=diff&rev2=83&rev1=82 Regards, Ronald. > > And despite the whining above, I really do appreciate all your efforts > to make it possible to run FreeBSD on these systems - many thanks! > > --Per Hedeland > _______________________________________________ > freebsd-arm@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-arm > To unsubscribe, send any mail to "freebsd-arm-unsubscribe@freebsd.org"