From owner-freebsd-arm@freebsd.org Mon Jan 7 21:45:30 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 C8E0714A0CEC for ; Mon, 7 Jan 2019 21:45:29 +0000 (UTC) (envelope-from per@hedeland.org) Received: from outbound1g.eu.mailhop.org (outbound1g.eu.mailhop.org [52.28.6.212]) (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 4887F82F5A for ; Mon, 7 Jan 2019 21:45:27 +0000 (UTC) (envelope-from per@hedeland.org) ARC-Seal: i=1; a=rsa-sha256; t=1546897520; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=B4KtljnqaxFjUY9HSMiS6NhI/NuECdI6mr1fESEumGmbiuuGZzhtTSXIiqor0WL7wVjh4/aj3Es0X 8gN6nPRPZGPlvtuS4qKW2A+Ja7X4Z1NUwwt9SI1BIWip/589/JRAYhfcji1QD6ioH/Z3QNOEcINbSq y/WdmaNPYnwJ3mKFVnUSP83zuTefEyauolUkDB4/d4byh+G/PfSaCLEDpMfobybYWvXg8ehr2EgUZa NRTe9BNBqHLrytOmD1FhpJ6cg2MfdsGY8AoX1GIvgHrQZJmtx569+2MGJ0HBbiXJqAvhK11ZKz3kId J+9jnoFs7NREfSERAaR/yQtVp46s15Q== 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=3tm6X+QXDc3xxAqJNDFE63zWCjVgtW67XxtfA7dard0=; b=bTaiDLb97djnVwOcH8X+5gCFFvdyssUtxcBpvcUTPcRL017RT3WYNFTKY2pSXfaWLbHOiw708XZF1 OVPF4cY14EK5w+/dRnkSmItbP+igzGz9c5azyHGXgKX9/DemUf3l1j0knc9GYzK6cjsNO8ieHtSJpm YoTg7Hf4g2+i+fClVF+6bbUosaBSA+Zdqfkll/+qFsDKOyF/ncLVNHrEJ2Hu1ci8Qp0M6WZHzzm+zK X+38WQlzL8h1oFunrWBHwp8jigL31ZPfQ0GLsJ85oK++w/Q2Ph4xJKLxDDRQcqrb0uALudSYfVMDi2 zeZ1DkLGhvTklKZCBXX+qYtgiNcPzng== ARC-Authentication-Results: i=1; outbound3.eu.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=3tm6X+QXDc3xxAqJNDFE63zWCjVgtW67XxtfA7dard0=; b=NTmOXWrAMI6dZH7yHMXEBoAxlnmvy+bERU+pJ/XP/xg/nS5s3y3e/Nc1H8oP6HpG34f07g/ggt19i O6fB9d2CmqiXtYWhP0HDnw4xp8tsP+FNhagkj4Uh/JnP3jav/lmeOkKZ3tq8PgATjUil2aLh3FvEM/ gLKOnU18Xcqszo2kZTS/1x6gDRLw39kRuBAjcLBEbTccNr2PHAQTXp144+JRQRclWTO1RbA8VXHeCV ezTEd9cRNxfdPg9QbwRH1CTOxtVV9HaQyAsOLaGI2G3JjF4NyNPlr+zdo+Gt25oyNtYA/GHA7ceey4 ddsZ1/LTIMY8zaC+JEw+y0WbRLSo01A== X-MHO-RoutePath: cGVyaGVkZWxhbmQ= X-MHO-User: 84bf698e-12c5-11e9-8a28-a1efd8da9a94 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 outbound3.eu.mailhop.org (Halon) with ESMTPSA id 84bf698e-12c5-11e9-8a28-a1efd8da9a94; Mon, 07 Jan 2019 21:45:17 +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 x07LjEV5084746 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Mon, 7 Jan 2019 22:45:14 +0100 (CET) (envelope-from per@hedeland.org) Subject: Re: i2c on RPi Zero? To: Ronald Klop Cc: Emmanuel Vadot , 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: Mon, 7 Jan 2019 22:45:14 +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: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4887F82F5A X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=outbound.mailhop.org header.s=dkim-high header.b=NTmOXWrA X-Spamd-Result: default: False [-3.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)[hedeland.org,mx2.mailhop.org]; NEURAL_HAM_SHORT(-0.95)[-0.955,0]; FROM_EQ_ENVFROM(0.00)[]; IP_SCORE(-0.27)[asn: 16509(-1.26), 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:52.28.0.0/16, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,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)[212.6.28.52.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: Mon, 07 Jan 2019 21:45:30 -0000 On 2019-01-07 21:10, Ronald Klop wrote: > 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 Great, thanks! Though AFAIU the "needs dt config" for i2c is not specific for Zero, I believe it is disabled in all the .dtb files for 12+. E.g. from the RPI-B image: pi0 1> dtc -I dtb -O dts /boot/msdos/bcm2708-rpi-b-plus.dtb | awk '$1~/^i2c@/ {print; ++p} p && /status/ {print; p=0}' i2c@7e205000 { status = "disabled"; i2c@7e804000 { status = "disabled"; i2c@7e805000 { status = "disabled"; (guessing that those are the relevant lines:-). --Per > 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"