From owner-freebsd-arm@freebsd.org Sat Jan 5 23:40:00 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 3FE8C14275E1 for ; Sat, 5 Jan 2019 23:40:00 +0000 (UTC) (envelope-from per@hedeland.org) Received: from outbound2k.ore.mailhop.org (outbound2k.ore.mailhop.org [54.148.219.64]) (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 10941732D3 for ; Sat, 5 Jan 2019 23:39:58 +0000 (UTC) (envelope-from per@hedeland.org) ARC-Seal: i=1; a=rsa-sha256; t=1546731553; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=FRxtQDp7N97H1qhMRVvMPs8eN6wvab4Uoc1TBChnoQgzxJTV4oF4JKgLuVaNLMDMrek+RgYNnOF8R 1PG+U5P5jQt8V1kNmflPn7C8slWE9j1BvJOH1GsKalKQKFRwGaQdNtQJcwMG5OgK7aoIcTt8U9HTGy k8XWfvAX874Vo7Z2oQBrPFboqMfrouUmXIFYxmn14FTE7bMmnMboOcUXrwsBr/H3vTquvIBFozG5Nq +SR74wtGzUv4h/SCJJTOAsGDZKb3nwju3iT5qokN1ND3v5wCXuAbUWO6/YQEi2sX0ITgLtL0/rYBRx K+2YUWYU0N4ln4UyXPxwOn/gvCP3F0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:content-type:in-reply-to:mime-version:date: message-id:from:references:cc:to:subject:dkim-signature:from; bh=3ShzYAo0ZYzsU8dCrGObS9QrsFSfoXcKYF1JbI1Otz0=; b=spj3fHsZDHAkoBMflM5Zaee3UYkPCNIWXVPcipr+mN3ijN43/ol+NlcRVoMz7nPlh7X8O3w94dpa6 a4+ShKL5ND5MR7Ss6ECLZ5/cnWWrFpU78S7PmSAkjaaTd+VjQ7e52TJe1LhEwoBmhMcmTNELgLNs7U sUh+w0D+yq+o3yE6UZ84xN1vRlSBsgNPWU7jKFnI6+S4cUyPU99XFxJ2cMmZys3OeekSvg0BY/0x8y pi5TGqLXWKMM+Ag5kNqZ14yyh6e9NxG5OpdRZYvWMt8edcHevcZOR+5PQ8oUlNBT6URV37iJqx/w6H +CF5TeEpk8//aclLm4UV+FpVsXqcQGA== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=none smtp.mailfrom=hedeland.org smtp.remote-ip=81.228.152.101; dmarc=none header.from=hedeland.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:content-type:in-reply-to:mime-version:date: message-id:from:references:cc:to:subject:from; bh=3ShzYAo0ZYzsU8dCrGObS9QrsFSfoXcKYF1JbI1Otz0=; b=Ec2b98WexPAeKUWN3X9WItyPoq8MxyA8jdm7QC04JBmp1ebai1nf55FyYp5mw4QZL19YGaKK1578q t3QxD69GZ6wh83Zikm8hAeE3KSMNRhUFtfL2rfikbN13XEcX5+g37qzfEie4998g/vOvpHcaOwXS4O VLNBhMsKdAib2C7zpUYB3pH5VmCZH9o88Va6ha6BWdtGED0ME36gNHqBURl/dp0KfbH62Id2lXJOV5 RI2ydwg6wiIEqXr8kNBUA8f81jK/8Z4IYxxt/rMu9O9g442RuhtzPZMciVKJlaRfhnk2QF/iQ9UNeZ noHqfAX18gbrPLiuEakykSNu5LkoARQ== X-MHO-RoutePath: cGVyaGVkZWxhbmQ= X-MHO-User: 17483545-1143-11e9-befd-af03bedce89f X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 81.228.152.101 X-Mail-Handler: DuoCircle Outbound SMTP Received: from hedeland.org (unknown [81.228.152.101]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id 17483545-1143-11e9-befd-af03bedce89f; Sat, 05 Jan 2019 23:39:11 +0000 (UTC) Received: from pluto.hedeland.org (pluto.hedeland.org [10.1.1.5]) by tellus.hedeland.org (8.15.2/8.15.2) with ESMTPS id x05Ndmbm072661 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Sun, 6 Jan 2019 00:39:48 +0100 (CET) (envelope-from per@hedeland.org) Subject: Re: i2c on RPi Zero? To: Emmanuel Vadot Cc: Oleksandr Tymoshenko , freebsd-arm@freebsd.org References: <229e0d36-a07b-8551-9613-0bf5748352e7@hedeland.org> <20190105195808.GA53872@bluezbox.com> <20190105215608.GA55315@bluezbox.com> <20190105230306.2ad9d0ba2c2df0e8fac5f053@bidouilliste.com> From: Per Hedeland Message-ID: Date: Sun, 6 Jan 2019 00:39:48 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190105230306.2ad9d0ba2c2df0e8fac5f053@bidouilliste.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 10941732D3 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=outbound.mailhop.org header.s=dkim-high header.b=Ec2b98We X-Spamd-Result: default: False [-4.53 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_XOIP(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[outbound.mailhop.org:+]; MX_GOOD(-0.01)[cached: hedeland.org]; NEURAL_HAM_SHORT(-0.98)[-0.983,0]; FROM_EQ_ENVFROM(0.00)[]; IP_SCORE(-1.24)[ipnet: 54.148.0.0/15(-4.86), asn: 16509(-1.25), country: US(-0.08)]; SUBJECT_ENDS_QUESTION(1.00)[]; ARC_ALLOW(-1.00)[i=1]; MIME_TRACE(0.00)[0:+]; MID_RHS_MATCH_FROM(0.00)[]; ASN(0.00)[asn:16509, ipnet:54.148.0.0/15, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[outbound.mailhop.org:s=dkim-high]; RECEIVED_SPAMHAUS_PBL(0.00)[101.152.228.81.zen.spamhaus.org : 127.0.0.11]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[hedeland.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[64.219.148.54.list.dnswl.org : 127.0.20.0]; R_SPF_NA(0.00)[]; RCVD_TLS_ALL(0.00)[] 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: Sat, 05 Jan 2019 23:40:00 -0000 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. 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